diff options
author | Yaxun Liu <Yaxun.Liu@amd.com> | 2017-07-08 13:24:52 +0000 |
---|---|---|
committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2017-07-08 13:24:52 +0000 |
commit | cbf647cc3a712ada34fcd78f7d39756193f323d2 (patch) | |
tree | 7122745644a399b3aa8ac176c4fea1c9064462d5 /clang/lib/CodeGen/CodeGenFunction.h | |
parent | affab3047e777ab69e09d18d23e8e7748b86b728 (diff) | |
download | llvm-cbf647cc3a712ada34fcd78f7d39756193f323d2.zip llvm-cbf647cc3a712ada34fcd78f7d39756193f323d2.tar.gz llvm-cbf647cc3a712ada34fcd78f7d39756193f323d2.tar.bz2 |
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
llvm-svn: 307470
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 6785111b..85aa5d4 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -1479,6 +1479,9 @@ public: const TargetInfo &getTarget() const { return Target; } llvm::LLVMContext &getLLVMContext() { return CGM.getLLVMContext(); } + const TargetCodeGenInfo &getTargetHooks() const { + return CGM.getTargetCodeGenInfo(); + } //===--------------------------------------------------------------------===// // Cleanups @@ -3820,10 +3823,6 @@ public: private: QualType getVarArgType(const Expr *Arg); - const TargetCodeGenInfo &getTargetHooks() const { - return CGM.getTargetCodeGenInfo(); - } - void EmitDeclMetadata(); BlockByrefHelpers *buildByrefHelpers(llvm::StructType &byrefType, |