From f3840d2c16a4ec4c879a8ded402835746de380f8 Mon Sep 17 00:00:00 2001 From: Micah Villmow Date: Thu, 11 Oct 2012 17:21:41 +0000 Subject: Add in the first iteration of support for llvm/clang/lldb to allow variable per address space pointer sizes to be optimized correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165726 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/Target/NVPTX') diff --git a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index d3dfb35e26..7146f6f7f8 100644 --- a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -126,8 +126,9 @@ const MCExpr *nvptx::LowerConstant(const Constant *CV, AsmPrinter &AP) { return Base; // Truncate/sext the offset to the pointer size. - if (TD.getPointerSizeInBits() != 64) { - int SExtAmount = 64-TD.getPointerSizeInBits(); + unsigned AS = cast(CE)->getPointerAddressSpace(); + if (TD.getPointerSizeInBits(AS) != 64) { + int SExtAmount = 64-TD.getPointerSizeInBits(AS); Offset = (Offset << SExtAmount) >> SExtAmount; } @@ -1378,7 +1379,7 @@ getOpenCLAlignment(const DataLayout *TD, const FunctionType *FTy = dyn_cast(Ty); if (FTy) - return TD->getPointerPrefAlignment(); + return TD->getPointerPrefAlignment(0); return TD->getPrefTypeAlignment(Ty); } -- cgit v1.2.3-18-g5258