summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter
diff options
context:
space:
mode:
authorMicah Villmow <villmow@gmail.com>2012-10-11 17:21:41 +0000
committerMicah Villmow <villmow@gmail.com>2012-10-11 17:21:41 +0000
commit083189730e40a2da15e6b66e5b220b707febdb9e (patch)
tree6daffbfbb571af888a60f19b0933c443c8488107 /llvm/lib/ExecutionEngine/Interpreter
parentb1e3e5f553024fcdb5436081854f7d9c3f12852b (diff)
downloadbcm5719-llvm-083189730e40a2da15e6b66e5b220b707febdb9e.tar.gz
bcm5719-llvm-083189730e40a2da15e6b66e5b220b707febdb9e.zip
Add in the first iteration of support for llvm/clang/lldb to allow variable per address space pointer sizes to be optimized correctly.
llvm-svn: 165726
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp3
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index 5202b091654..326bf79c589 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -1054,7 +1054,8 @@ GenericValue Interpreter::executeIntToPtrInst(Value *SrcVal, Type *DstTy,
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
assert(DstTy->isPointerTy() && "Invalid PtrToInt instruction");
- uint32_t PtrSize = TD.getPointerSizeInBits();
+ unsigned AS = cast<PointerType>(DstTy)->getAddressSpace();
+ uint32_t PtrSize = TD.getPointerSizeInBits(AS);
if (PtrSize != Src.IntVal.getBitWidth())
Src.IntVal = Src.IntVal.zextOrTrunc(PtrSize);
diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index e16e2d112a9..f58adbe1e1a 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -376,7 +376,7 @@ GenericValue lle_X_sprintf(FunctionType *FT,
case 'x': case 'X':
if (HowLong >= 1) {
if (HowLong == 1 &&
- TheInterpreter->getDataLayout()->getPointerSizeInBits() == 64 &&
+ TheInterpreter->getDataLayout()->getPointerSizeInBits(0) == 64 &&
sizeof(long) < sizeof(int64_t)) {
// Make sure we use %lld with a 64 bit argument because we might be
// compiling LLI on a 32 bit compiler.
OpenPOWER on IntegriCloud