diff options
| author | David Tweed <david.tweed@arm.com> | 2013-12-11 13:39:46 +0000 |
|---|---|---|
| committer | David Tweed <david.tweed@arm.com> | 2013-12-11 13:39:46 +0000 |
| commit | 142f01674857b0fac52ddf1e4d315d74210a4584 (patch) | |
| tree | 0ae792b4768f79af5a0ae653787877ebcd5e6a28 /lib/CodeGen/CGExprConstant.cpp | |
| parent | 440a474a58e1005572dd51b18a4e21b44aad8d20 (diff) | |
| download | clang-142f01674857b0fac52ddf1e4d315d74210a4584.tar.gz clang-142f01674857b0fac52ddf1e4d315d74210a4584.tar.bz2 clang-142f01674857b0fac52ddf1e4d315d74210a4584.tar.xz | |
Add front-end infrastructure now address space casts are in LLVM IR.
With the introduction of explicit address space casts into LLVM, there's
a need to provide a new cast kind the front-end can create for C/OpenCL/CUDA
and code to produce address space casts from those kinds when appropriate.
Patch by Michele Scandale!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197036 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index f4d6861c8b..ad3e1fcbef 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -633,6 +633,9 @@ public: return llvm::ConstantStruct::get(STy, Elts); } + case CK_AddressSpaceConversion: + return llvm::ConstantExpr::getAddrSpaceCast(C, destType); + case CK_LValueToRValue: case CK_AtomicToNonAtomic: case CK_NonAtomicToAtomic: @@ -1062,13 +1065,13 @@ llvm::Constant *CodeGenModule::EmitConstantValue(const APValue &Value, if (!Offset->isNullValue()) { llvm::Constant *Casted = llvm::ConstantExpr::getBitCast(C, Int8PtrTy); Casted = llvm::ConstantExpr::getGetElementPtr(Casted, Offset); - C = llvm::ConstantExpr::getBitCast(Casted, C->getType()); + C = llvm::ConstantExpr::getPointerCast(Casted, C->getType()); } // Convert to the appropriate type; this could be an lvalue for // an integer. if (isa<llvm::PointerType>(DestTy)) - return llvm::ConstantExpr::getBitCast(C, DestTy); + return llvm::ConstantExpr::getPointerCast(C, DestTy); return llvm::ConstantExpr::getPtrToInt(C, DestTy); } else { |
