aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Bytecode/Reader/Reader.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index c97b9a824c..5e6550215b 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -717,6 +717,13 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds,
Result = new VAArgInst(foo, getSanitizedType(Oprnds[1]));
break;
}
+ case Instruction::ExtractElement: {
+ if (Oprnds.size() != 2)
+ throw std::string("Invalid extractelement instruction!");
+ Result = new ExtractElementInst(getValue(iType, Oprnds[0]),
+ getValue(Type::UIntTyID, Oprnds[1]));
+ break;
+ }
case Instruction::Cast:
Result = new CastInst(getValue(iType, Oprnds[0]),
getSanitizedType(Oprnds[1]));
@@ -1441,6 +1448,12 @@ Constant *BytecodeReader::ParseConstantValue(unsigned TypeID) {
ArgVec[2]);
if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
return Result;
+ } else if (Opcode == Instruction::ExtractElement) {
+ if (ArgVec.size() != 2)
+ error("ExtractElement instruction must have two arguments.");
+ Constant* Result = ConstantExpr::getExtractElement(ArgVec[0], ArgVec[1]);
+ if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
+ return Result;
} else { // All other 2-operand expressions
Constant* Result = ConstantExpr::get(Opcode, ArgVec[0], ArgVec[1]);
if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);