summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-12-02 02:24:42 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-12-02 02:24:42 +0000
commitab85225be49b2abf5112823d84525e91d469d6bd (patch)
tree409fc728e31d6bd0afc63bdb4ba06b7c96f6a816 /llvm/lib/ExecutionEngine/Interpreter
parent6afcab35887245f36751790ba33debaf74b0d2ee (diff)
downloadbcm5719-llvm-ab85225be49b2abf5112823d84525e91d469d6bd.tar.gz
bcm5719-llvm-ab85225be49b2abf5112823d84525e91d469d6bd.zip
IR: Change the gep_type_iterator API to avoid always exposing the "current" type.
Instead, expose whether the current type is an array or a struct, if an array what the upper bound is, and if a struct the struct type itself. This is in preparation for a later change which will make PointerType derive from Type rather than SequentialType. Differential Revision: https://reviews.llvm.org/D26594 llvm-svn: 288458
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index 1eb4f7d1934..923f6e7147d 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -999,7 +999,7 @@ GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I,
uint64_t Total = 0;
for (; I != E; ++I) {
- if (StructType *STy = dyn_cast<StructType>(*I)) {
+ if (StructType *STy = I.getStructTypeOrNull()) {
const StructLayout *SLO = getDataLayout().getStructLayout(STy);
const ConstantInt *CPU = cast<ConstantInt>(I.getOperand());
@@ -1007,7 +1007,6 @@ GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I,
Total += SLO->getElementOffset(Index);
} else {
- SequentialType *ST = cast<SequentialType>(*I);
// Get the index number for the array... which must be long type...
GenericValue IdxGV = getOperandValue(I.getOperand(), SF);
@@ -1020,7 +1019,7 @@ GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I,
assert(BitWidth == 64 && "Invalid index type for getelementptr");
Idx = (int64_t)IdxGV.IntVal.getZExtValue();
}
- Total += getDataLayout().getTypeAllocSize(ST->getElementType()) * Idx;
+ Total += getDataLayout().getTypeAllocSize(I.getIndexedType()) * Idx;
}
}
OpenPOWER on IntegriCloud