summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader/Reader.cpp
diff options
context:
space:
mode:
authorRobert Bocchino <bocchino@illinois.edu>2006-01-10 19:04:39 +0000
committerRobert Bocchino <bocchino@illinois.edu>2006-01-10 19:04:39 +0000
commitbec39ee4e5d222fb38ce35433740b8ecf85f9e43 (patch)
treeed451c1d8d51496de2b474c978ea922b7e2119f2 /llvm/lib/Bytecode/Reader/Reader.cpp
parentaa1cf5440e5e9f166be3720d26b84081ee134f36 (diff)
downloadbcm5719-llvm-bec39ee4e5d222fb38ce35433740b8ecf85f9e43.tar.gz
bcm5719-llvm-bec39ee4e5d222fb38ce35433740b8ecf85f9e43.zip
Added bytecode support for the extractelement operation.
llvm-svn: 25178
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.cpp')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index c97b9a824c8..5e6550215bf 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud