summaryrefslogtreecommitdiffstats
path: root/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorYaxun Liu <Yaxun.Liu@amd.com>2017-07-05 04:58:24 +0000
committerYaxun Liu <Yaxun.Liu@amd.com>2017-07-05 04:58:24 +0000
commitaae294bfd9bd98fd91c7a9eb00e09b5198046d87 (patch)
tree48d7b282fc5e4016d571e828482fdd4d76200892 /lib/Basic/Targets.cpp
parent16280f9d13d776349f9dacd3378e307d662f4769 (diff)
[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
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r--lib/Basic/Targets.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 4ff61eb522..28e6d834cc 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -2189,6 +2189,15 @@ public:
Triple.getEnvironmentName() == "amdgizcl" ||
!isAMDGCN(Triple));
UseAddrSpaceMapMangling = true;
+
+ // Set pointer width and alignment for target address space 0.
+ PointerWidth = PointerAlign = DataLayout->getPointerSizeInBits();
+ if (getMaxPointerWidth() == 64) {
+ LongWidth = LongAlign = 64;
+ SizeType = UnsignedLong;
+ PtrDiffType = SignedLong;
+ IntPtrType = SignedLong;
+ }
}
void setAddressSpaceMap(bool DefaultIsPrivate) {
@@ -2216,6 +2225,10 @@ public:
return 64;
}
+ uint64_t getPointerAlignV(unsigned AddrSpace) const override {
+ return getPointerWidthV(AddrSpace);
+ }
+
uint64_t getMaxPointerWidth() const override {
return getTriple().getArch() == llvm::Triple::amdgcn ? 64 : 32;
}
@@ -2392,12 +2405,7 @@ public:
}
/// \returns Target specific vtbl ptr address space.
- unsigned getVtblPtrAddressSpace() const override {
- // \todo: We currently have address spaces defined in AMDGPU Backend. It
- // would be nice if we could use it here instead of using bare numbers (same
- // applies to getDWARFAddressSpace).
- return 2; // constant.
- }
+ unsigned getVtblPtrAddressSpace() const override { return AS.Constant; }
/// \returns If a target requires an address within a target specific address
/// space \p AddressSpace to be converted in order to be used, then return the