Commit Graph

5 Commits

Author SHA1 Message Date
Yaxun Liu b1dff4f2e3 [AMDGPU] Switch to the new addr space mapping by default
This requires corresponding llvm change.

Differential Revision: https://reviews.llvm.org/D40956


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324102 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-02 16:08:24 +00:00
Yaxun Liu 2ce35b601d CodeGen: Fix address space of global variable
Certain targets (e.g. amdgcn) require global variable to stay in global or constant address
space. In C or C++ global variables are emitted in the default (generic) address space.
This patch introduces virtual functions TargetCodeGenInfo::getGlobalVarAddressSpace
and TargetInfo::getConstantAddressSpace to handle this in a general approach.

It only affects IR generated for amdgcn target.

Differential Revision: https://reviews.llvm.org/D33842


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307470 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-08 13:24:52 +00:00
Yaxun Liu aae294bfd9 [AMDGPU] Fix size and alignment of size_t and pointer types
Differential Revision: https://reviews.llvm.org/D34995


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307121 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 04:58:24 +00:00
Yaxun Liu 1b12bf4092 CodeGen: Cast temporary variable to proper address space
In C++ all variables are in default address space. Previously change has been
made to cast automatic variables to default address space. However that is
not sufficient since all temporary variables need to be casted to default
address space.

This patch casts all temporary variables to default address space except those
for passing indirect arguments since they are only used for load/store.

This patch only affects target having non-zero alloca address space.

Differential Revision: https://reviews.llvm.org/D33706


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305711 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19 17:03:41 +00:00
Yaxun Liu 44e7dd4bbb [OpenCL] Map default address space to alloca address space
For OpenCL, the private address space qualifier is 0 in AST. Before this change, 0 address space qualifier
is always mapped to target address space 0. As now target private address space is specified by
alloca address space in data layout, address space qualifier 0 needs to be mapped to alloca addr space specified by the data layout.

This change has no impact on targets whose alloca addr space is 0.

With contributions from Matt Arsenault, Tony Tye and Wen-Heng (Jack) Chung

Differential Revision: https://reviews.llvm.org/D31404


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299965 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 17:24:23 +00:00