summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-12-30 16:25:48 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-12-30 16:25:48 +0000
commitb6ad98224a0f3efbc5a4b2f591e8ca2ba081a8dc (patch)
treec6afef5b1fef22fe57404820c0a65c4b0ee87ae7 /llvm/lib/ExecutionEngine
parent12be928dfb1b08d1209de5558f324413ab6d3d0e (diff)
downloadbcm5719-llvm-b6ad98224a0f3efbc5a4b2f591e8ca2ba081a8dc.tar.gz
bcm5719-llvm-b6ad98224a0f3efbc5a4b2f591e8ca2ba081a8dc.zip
convert a bunch of callers from DataLayout::getIndexedOffset() to GEP::accumulateConstantOffset().
The later API is nicer than the former, and is correct regarding wrap-around offsets (if anyone cares). There are a few more places left with duplicated code, which I'll remove soon. llvm-svn: 171259
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 21e0ad3fcd3..c2a22e6b3fe 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -21,6 +21,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/Module.h"
+#include "llvm/Operator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/ErrorHandling.h"
@@ -555,11 +556,11 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
case Instruction::GetElementPtr: {
// Compute the index
GenericValue Result = getConstantValue(Op0);
- SmallVector<Value*, 8> Indices(CE->op_begin()+1, CE->op_end());
- uint64_t Offset = TD->getIndexedOffset(Op0->getType(), Indices);
+ APInt Offset(TD->getPointerSizeInBits(), 0);
+ cast<GEPOperator>(CE)->accumulateConstantOffset(*TD, Offset);
char* tmp = (char*) Result.PointerVal;
- Result = PTOGV(tmp + Offset);
+ Result = PTOGV(tmp + Offset.getSExtValue());
return Result;
}
case Instruction::Trunc: {
OpenPOWER on IntegriCloud