static GenericValue executeCastOperation(Value *Src, const Type *DestTy,
ExecutionContext &SF);
static GenericValue executeAddInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF);
+ const Type *Ty);
static GenericValue getOperandValue(Value *V, ExecutionContext &SF) {
case Instruction::Add:
return executeAddInst(getOperandValue(CE->getOperand(0), SF),
getOperandValue(CE->getOperand(1), SF),
- CE->getType(), SF);
+ CE->getType());
default:
cerr << "Unhandled ConstantExpr: " << CE << "\n";
abort();
case Type::TY##TyID: Dest.TY##Val = Src1.TY##Val OP Src2.TY##Val; break
static GenericValue executeAddInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_BINARY_OPERATOR(+, UByte);
}
static GenericValue executeSubInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_BINARY_OPERATOR(-, UByte);
}
static GenericValue executeMulInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_BINARY_OPERATOR(*, UByte);
}
static GenericValue executeDivInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_BINARY_OPERATOR(/, UByte);
}
static GenericValue executeRemInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_BINARY_OPERATOR(%, UByte);
}
static GenericValue executeAndInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_BINARY_OPERATOR(&, UByte);
static GenericValue executeOrInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_BINARY_OPERATOR(|, UByte);
static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_BINARY_OPERATOR(^, UByte);
case Type::TY##TyID: Dest.BoolVal = Src1.TY##Val OP Src2.TY##Val; break
static GenericValue executeSetEQInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_SETCC(==, UByte);
}
static GenericValue executeSetNEInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_SETCC(!=, UByte);
}
static GenericValue executeSetLEInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_SETCC(<=, UByte);
}
static GenericValue executeSetGEInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_SETCC(>=, UByte);
}
static GenericValue executeSetLTInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_SETCC(<, UByte);
}
static GenericValue executeSetGTInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty, ExecutionContext &SF) {
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getPrimitiveID()) {
IMPLEMENT_SETCC(>, UByte);
GenericValue R; // Result
switch (I.getOpcode()) {
- case Instruction::Add: R = executeAddInst (Src1, Src2, Ty, SF); break;
- case Instruction::Sub: R = executeSubInst (Src1, Src2, Ty, SF); break;
- case Instruction::Mul: R = executeMulInst (Src1, Src2, Ty, SF); break;
- case Instruction::Div: R = executeDivInst (Src1, Src2, Ty, SF); break;
- case Instruction::Rem: R = executeRemInst (Src1, Src2, Ty, SF); break;
- case Instruction::And: R = executeAndInst (Src1, Src2, Ty, SF); break;
- case Instruction::Or: R = executeOrInst (Src1, Src2, Ty, SF); break;
- case Instruction::Xor: R = executeXorInst (Src1, Src2, Ty, SF); break;
- case Instruction::SetEQ: R = executeSetEQInst(Src1, Src2, Ty, SF); break;
- case Instruction::SetNE: R = executeSetNEInst(Src1, Src2, Ty, SF); break;
- case Instruction::SetLE: R = executeSetLEInst(Src1, Src2, Ty, SF); break;
- case Instruction::SetGE: R = executeSetGEInst(Src1, Src2, Ty, SF); break;
- case Instruction::SetLT: R = executeSetLTInst(Src1, Src2, Ty, SF); break;
- case Instruction::SetGT: R = executeSetGTInst(Src1, Src2, Ty, SF); break;
+ case Instruction::Add: R = executeAddInst (Src1, Src2, Ty); break;
+ case Instruction::Sub: R = executeSubInst (Src1, Src2, Ty); break;
+ case Instruction::Mul: R = executeMulInst (Src1, Src2, Ty); break;
+ case Instruction::Div: R = executeDivInst (Src1, Src2, Ty); break;
+ case Instruction::Rem: R = executeRemInst (Src1, Src2, Ty); break;
+ case Instruction::And: R = executeAndInst (Src1, Src2, Ty); break;
+ case Instruction::Or: R = executeOrInst (Src1, Src2, Ty); break;
+ case Instruction::Xor: R = executeXorInst (Src1, Src2, Ty); break;
+ case Instruction::SetEQ: R = executeSetEQInst(Src1, Src2, Ty); break;
+ case Instruction::SetNE: R = executeSetNEInst(Src1, Src2, Ty); break;
+ case Instruction::SetLE: R = executeSetLEInst(Src1, Src2, Ty); break;
+ case Instruction::SetGE: R = executeSetGEInst(Src1, Src2, Ty); break;
+ case Instruction::SetLT: R = executeSetLTInst(Src1, Src2, Ty); break;
+ case Instruction::SetGT: R = executeSetGTInst(Src1, Src2, Ty); break;
default:
cout << "Don't know how to handle this binary operator!\n-->" << I;
R = Src1;
// Check to see if any of the cases match...
for (unsigned i = 2, e = I.getNumOperands(); i != e; i += 2) {
if (executeSetEQInst(CondVal,
- getOperandValue(I.getOperand(i), SF),ElTy,SF).BoolVal){
+ getOperandValue(I.getOperand(i), SF), ElTy).BoolVal) {
Dest = cast<BasicBlock>(I.getOperand(i+1));
break;
}