diff options
author | Robert Bocchino <bocchino@illinois.edu> | 2006-01-17 20:06:35 +0000 |
---|---|---|
committer | Robert Bocchino <bocchino@illinois.edu> | 2006-01-17 20:06:35 +0000 |
commit | b1f240b8efb6eb54cfa9f003e11a25d0a3eddb75 (patch) | |
tree | 8c35274605a8f94ea8ae18b3260e0d860df3d483 /lib/Bytecode | |
parent | 2def1b3e73164f1779fc964168515036dce31149 (diff) |
Reader support for the insertelement operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25404 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 8abf68c32c..2ec670e662 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -725,6 +725,17 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds, getValue(Type::UIntTyID, Oprnds[1])); break; } + case Instruction::InsertElement: { + const PackedType *PackedTy = dyn_cast<PackedType>(InstTy); + if (!PackedTy || Oprnds.size() != 3) + throw std::string("Invalid insertelement instruction!"); + Result = + new InsertElementInst(getValue(iType, Oprnds[0]), + getValue(getTypeSlot(PackedTy->getElementType()), + Oprnds[1]), + getValue(Type::UIntTyID, Oprnds[2])); + break; + } case Instruction::Cast: Result = new CastInst(getValue(iType, Oprnds[0]), getSanitizedType(Oprnds[1])); @@ -1455,6 +1466,13 @@ Constant *BytecodeReader::ParseConstantValue(unsigned TypeID) { Constant* Result = ConstantExpr::getExtractElement(ArgVec[0], ArgVec[1]); if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result); return Result; + } else if (Opcode == Instruction::InsertElement) { + if (ArgVec.size() != 3) + error("InsertElement instruction must have three arguments."); + Constant* Result = + ConstantExpr::getInsertElement(ArgVec[0], ArgVec[1], ArgVec[2]); + 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); |