mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-14 15:19:33 +00:00
Reader support for the insertelement operation.
llvm-svn: 25404
This commit is contained in:
parent
30daf8a531
commit
a1ce64b534
@ -725,6 +725,17 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds,
|
|||||||
getValue(Type::UIntTyID, Oprnds[1]));
|
getValue(Type::UIntTyID, Oprnds[1]));
|
||||||
break;
|
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:
|
case Instruction::Cast:
|
||||||
Result = new CastInst(getValue(iType, Oprnds[0]),
|
Result = new CastInst(getValue(iType, Oprnds[0]),
|
||||||
getSanitizedType(Oprnds[1]));
|
getSanitizedType(Oprnds[1]));
|
||||||
@ -1455,6 +1466,13 @@ Constant *BytecodeReader::ParseConstantValue(unsigned TypeID) {
|
|||||||
Constant* Result = ConstantExpr::getExtractElement(ArgVec[0], ArgVec[1]);
|
Constant* Result = ConstantExpr::getExtractElement(ArgVec[0], ArgVec[1]);
|
||||||
if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
|
if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
|
||||||
return 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
|
} else { // All other 2-operand expressions
|
||||||
Constant* Result = ConstantExpr::get(Opcode, ArgVec[0], ArgVec[1]);
|
Constant* Result = ConstantExpr::get(Opcode, ArgVec[0], ArgVec[1]);
|
||||||
if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
|
if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
|
||||||
|
Loading…
Reference in New Issue
Block a user