summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
diff options
context:
space:
mode:
authorYaxun Liu <Yaxun.Liu@amd.com>2017-02-07 00:43:21 +0000
committerYaxun Liu <Yaxun.Liu@amd.com>2017-02-07 00:43:21 +0000
commit8f844f39607f21daf7be93f7253d0e2eda83fb5f (patch)
tree145cea75c9b36a438397ad93de266ca2e9f23227 /llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
parentc80bd0486d1b7e4e54b098b0f459b88e5f131f42 (diff)
downloadbcm5719-llvm-8f844f39607f21daf7be93f7253d0e2eda83fb5f.tar.gz
bcm5719-llvm-8f844f39607f21daf7be93f7253d0e2eda83fb5f.zip
[AMDGPU] Lower null pointers in static variable initializer
For amdgcn target Clang generates addrspacecast to represent null pointers in private and local address spaces. In LLVM codegen, the static variable initializer is lowered by virtual function AsmPrinter::lowerConstant which is target generic. Since addrspacecast is target specific, AsmPrinter::lowerConst This patch overrides AsmPrinter::lowerConstant with AMDGPUAsmPrinter::lowerConstant, which is able to lower the target-specific addrspacecast in the null pointer representation so that -1 is co Differential Revision: https://reviews.llvm.org/D29284 llvm-svn: 294265
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h')
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
index e6981943f49..bf0b9543b89 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
@@ -59,6 +59,18 @@ public:
}
void adjustPassManager(PassManagerBuilder &) override;
+ /// Get the integer value of a null pointer in the given address space.
+ uint64_t getNullPointerValue(unsigned AddrSpace) const {
+ switch(AddrSpace) {
+ case AMDGPUAS::PRIVATE_ADDRESS:
+ case AMDGPUAS::LOCAL_ADDRESS:
+ case AMDGPUAS::REGION_ADDRESS:
+ return -1;
+ default:
+ return 0;
+ }
+ }
+
};
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud