IMPLEMENT_BINARY_OPERATOR(+, Float);
IMPLEMENT_BINARY_OPERATOR(+, Double);
default:
- errs() << "Unhandled type for FAdd instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for FAdd instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
}
IMPLEMENT_BINARY_OPERATOR(-, Float);
IMPLEMENT_BINARY_OPERATOR(-, Double);
default:
- errs() << "Unhandled type for FSub instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for FSub instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
}
IMPLEMENT_BINARY_OPERATOR(*, Float);
IMPLEMENT_BINARY_OPERATOR(*, Double);
default:
- errs() << "Unhandled type for FMul instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for FMul instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
}
IMPLEMENT_BINARY_OPERATOR(/, Float);
IMPLEMENT_BINARY_OPERATOR(/, Double);
default:
- errs() << "Unhandled type for FDiv instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for FDiv instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
}
Dest.DoubleVal = fmod(Src1.DoubleVal, Src2.DoubleVal);
break;
default:
- errs() << "Unhandled type for Rem instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for Rem instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
}
IMPLEMENT_INTEGER_ICMP(eq,Ty);
IMPLEMENT_POINTER_ICMP(==);
default:
- errs() << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n";
+ dbgs() << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_INTEGER_ICMP(ne,Ty);
IMPLEMENT_POINTER_ICMP(!=);
default:
- errs() << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n";
+ dbgs() << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_INTEGER_ICMP(ult,Ty);
IMPLEMENT_POINTER_ICMP(<);
default:
- errs() << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n";
+ dbgs() << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_INTEGER_ICMP(slt,Ty);
IMPLEMENT_POINTER_ICMP(<);
default:
- errs() << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n";
+ dbgs() << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_INTEGER_ICMP(ugt,Ty);
IMPLEMENT_POINTER_ICMP(>);
default:
- errs() << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n";
+ dbgs() << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_INTEGER_ICMP(sgt,Ty);
IMPLEMENT_POINTER_ICMP(>);
default:
- errs() << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n";
+ dbgs() << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_INTEGER_ICMP(ule,Ty);
IMPLEMENT_POINTER_ICMP(<=);
default:
- errs() << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n";
+ dbgs() << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_INTEGER_ICMP(sle,Ty);
IMPLEMENT_POINTER_ICMP(<=);
default:
- errs() << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n";
+ dbgs() << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_INTEGER_ICMP(uge,Ty);
IMPLEMENT_POINTER_ICMP(>=);
default:
- errs() << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n";
+ dbgs() << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_INTEGER_ICMP(sge,Ty);
IMPLEMENT_POINTER_ICMP(>=);
default:
- errs() << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n";
+ dbgs() << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
case ICmpInst::ICMP_UGE: R = executeICMP_UGE(Src1, Src2, Ty); break;
case ICmpInst::ICMP_SGE: R = executeICMP_SGE(Src1, Src2, Ty); break;
default:
- errs() << "Don't know how to handle this ICmp predicate!\n-->" << I;
+ dbgs() << "Don't know how to handle this ICmp predicate!\n-->" << I;
llvm_unreachable(0);
}
IMPLEMENT_FCMP(==, Float);
IMPLEMENT_FCMP(==, Double);
default:
- errs() << "Unhandled type for FCmp EQ instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for FCmp EQ instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_FCMP(!=, Double);
default:
- errs() << "Unhandled type for FCmp NE instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for FCmp NE instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_FCMP(<=, Float);
IMPLEMENT_FCMP(<=, Double);
default:
- errs() << "Unhandled type for FCmp LE instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for FCmp LE instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_FCMP(>=, Float);
IMPLEMENT_FCMP(>=, Double);
default:
- errs() << "Unhandled type for FCmp GE instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for FCmp GE instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_FCMP(<, Float);
IMPLEMENT_FCMP(<, Double);
default:
- errs() << "Unhandled type for FCmp LT instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for FCmp LT instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
IMPLEMENT_FCMP(>, Float);
IMPLEMENT_FCMP(>, Double);
default:
- errs() << "Unhandled type for FCmp GT instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled type for FCmp GT instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
return Dest;
case FCmpInst::FCMP_UGE: R = executeFCMP_UGE(Src1, Src2, Ty); break;
case FCmpInst::FCMP_OGE: R = executeFCMP_OGE(Src1, Src2, Ty); break;
default:
- errs() << "Don't know how to handle this FCmp predicate!\n-->" << I;
+ dbgs() << "Don't know how to handle this FCmp predicate!\n-->" << I;
llvm_unreachable(0);
}
return Result;
}
default:
- errs() << "Unhandled Cmp predicate\n";
+ dbgs() << "Unhandled Cmp predicate\n";
llvm_unreachable(0);
}
}
case Instruction::Or: R.IntVal = Src1.IntVal | Src2.IntVal; break;
case Instruction::Xor: R.IntVal = Src1.IntVal ^ Src2.IntVal; break;
default:
- errs() << "Don't know how to handle this binary operator!\n-->" << I;
+ dbgs() << "Don't know how to handle this binary operator!\n-->" << I;
llvm_unreachable(0);
}
// Allocate enough memory to hold the type...
void *Memory = malloc(MemToAlloc);
- DEBUG(errs() << "Allocated Type: " << *Ty << " (" << TypeSize << " bytes) x "
+ DEBUG(dbgs() << "Allocated Type: " << *Ty << " (" << TypeSize << " bytes) x "
<< NumElements << " (Total: " << MemToAlloc << ") at "
<< uintptr_t(Memory) << '\n');
GenericValue Result;
Result.PointerVal = ((char*)getOperandValue(Ptr, SF).PointerVal) + Total;
- DEBUG(errs() << "GEP Index " << Total << " bytes.\n");
+ DEBUG(dbgs() << "GEP Index " << Total << " bytes.\n");
return Result;
}
LoadValueFromMemory(Result, Ptr, I.getType());
SetValue(&I, Result, SF);
if (I.isVolatile() && PrintVolatile)
- errs() << "Volatile load " << I;
+ dbgs() << "Volatile load " << I;
}
void Interpreter::visitStoreInst(StoreInst &I) {
StoreValueToMemory(Val, (GenericValue *)GVTOP(SRC),
I.getOperand(0)->getType());
if (I.isVolatile() && PrintVolatile)
- errs() << "Volatile store: " << I;
+ dbgs() << "Volatile store: " << I;
}
//===----------------------------------------------------------------------===//
IMPLEMENT_VAARG(Float);
IMPLEMENT_VAARG(Double);
default:
- errs() << "Unhandled dest type for vaarg instruction: " << *Ty << "\n";
+ dbgs() << "Unhandled dest type for vaarg instruction: " << *Ty << "\n";
llvm_unreachable(0);
}
Dest.IntVal = Op0.IntVal.ashr(Op1.IntVal.getZExtValue());
break;
default:
- errs() << "Unhandled ConstantExpr: " << *CE << "\n";
+ dbgs() << "Unhandled ConstantExpr: " << *CE << "\n";
llvm_unreachable(0);
return GenericValue();
}
// Track the number of dynamic instructions executed.
++NumDynamicInsts;
- DEBUG(errs() << "About to interpret: " << I);
+ DEBUG(dbgs() << "About to interpret: " << I);
visit(I); // Dispatch to one of the visit* methods...
#if 0
// This is not safe, as visiting the instruction could lower it and free I.
DEBUG(
if (!isa<CallInst>(I) && !isa<InvokeInst>(I) &&
I.getType() != Type::VoidTy) {
- errs() << " --> ";
+ dbgs() << " --> ";
const GenericValue &Val = SF.Values[&I];
switch (I.getType()->getTypeID()) {
default: llvm_unreachable("Invalid GenericValue Type");
- case Type::VoidTyID: errs() << "void"; break;
- case Type::FloatTyID: errs() << "float " << Val.FloatVal; break;
- case Type::DoubleTyID: errs() << "double " << Val.DoubleVal; break;
- case Type::PointerTyID: errs() << "void* " << intptr_t(Val.PointerVal);
+ case Type::VoidTyID: dbgs() << "void"; break;
+ case Type::FloatTyID: dbgs() << "float " << Val.FloatVal; break;
+ case Type::DoubleTyID: dbgs() << "double " << Val.DoubleVal; break;
+ case Type::PointerTyID: dbgs() << "void* " << intptr_t(Val.PointerVal);
break;
case Type::IntegerTyID:
- errs() << "i" << Val.IntVal.getBitWidth() << " "
+ dbgs() << "i" << Val.IntVal.getBitWidth() << " "
<< Val.IntVal.toStringUnsigned(10)
<< " (0x" << Val.IntVal.toStringUnsigned(16) << ")\n";
break;