summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2019-01-10 16:07:20 +0000
committerJames Y Knight <jyknight@google.com>2019-01-10 16:07:20 +0000
commit62df5eed16a07c4dd183c71d69d6858b5fa19652 (patch)
treee9d9c43424b364b6ed2ee4524e26e16ab34e7047 /llvm/lib/ExecutionEngine/Interpreter
parent20c7844f50a2f2c555bfc6d9b3d2376a6f154511 (diff)
downloadbcm5719-llvm-62df5eed16a07c4dd183c71d69d6858b5fa19652.tar.gz
bcm5719-llvm-62df5eed16a07c4dd183c71d69d6858b5fa19652.zip
[opaque pointer types] Remove some calls to generic Type subtype accessors.
That is, remove many of the calls to Type::getNumContainedTypes(), Type::subtypes(), and Type::getContainedType(N). I'm not intending to remove these accessors -- they are useful/necessary in some cases. However, removing the pointee type from pointers would potentially break some uses, and reducing the number of calls makes it easier to audit. llvm-svn: 350835
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp13
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp5
2 files changed, 7 insertions, 11 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index 39cf6d4a32a..98dca110275 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -1778,17 +1778,14 @@ void Interpreter::visitExtractElementInst(ExtractElementInst &I) {
void Interpreter::visitInsertElementInst(InsertElementInst &I) {
ExecutionContext &SF = ECStack.back();
- Type *Ty = I.getType();
-
- if(!(Ty->isVectorTy()) )
- llvm_unreachable("Unhandled dest type for insertelement instruction");
+ VectorType *Ty = cast<VectorType>(I.getType());
GenericValue Src1 = getOperandValue(I.getOperand(0), SF);
GenericValue Src2 = getOperandValue(I.getOperand(1), SF);
GenericValue Src3 = getOperandValue(I.getOperand(2), SF);
GenericValue Dest;
- Type *TyContained = Ty->getContainedType(0);
+ Type *TyContained = Ty->getElementType();
const unsigned indx = unsigned(Src3.IntVal.getZExtValue());
Dest.AggregateVal = Src1.AggregateVal;
@@ -1814,9 +1811,7 @@ void Interpreter::visitInsertElementInst(InsertElementInst &I) {
void Interpreter::visitShuffleVectorInst(ShuffleVectorInst &I){
ExecutionContext &SF = ECStack.back();
- Type *Ty = I.getType();
- if(!(Ty->isVectorTy()))
- llvm_unreachable("Unhandled dest type for shufflevector instruction");
+ VectorType *Ty = cast<VectorType>(I.getType());
GenericValue Src1 = getOperandValue(I.getOperand(0), SF);
GenericValue Src2 = getOperandValue(I.getOperand(1), SF);
@@ -1827,7 +1822,7 @@ void Interpreter::visitShuffleVectorInst(ShuffleVectorInst &I){
// bytecode can't contain different types for src1 and src2 for a
// shufflevector instruction.
- Type *TyContained = Ty->getContainedType(0);
+ Type *TyContained = Ty->getElementType();
unsigned src1Size = (unsigned)Src1.AggregateVal.size();
unsigned src2Size = (unsigned)Src2.AggregateVal.size();
unsigned src3Size = (unsigned)Src3.AggregateVal.size();
diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index 044d9b7f27a..334fcacf807 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -103,8 +103,9 @@ static ExFunc lookupFunction(const Function *F) {
// composite function name should be.
std::string ExtName = "lle_";
FunctionType *FT = F->getFunctionType();
- for (unsigned i = 0, e = FT->getNumContainedTypes(); i != e; ++i)
- ExtName += getTypeID(FT->getContainedType(i));
+ ExtName += getTypeID(FT->getReturnType());
+ for (Type *T : FT->params())
+ ExtName += getTypeID(T);
ExtName += ("_" + F->getName()).str();
sys::ScopedLock Writer(*FunctionsLock);
OpenPOWER on IntegriCloud