Step = 0;
if (V2 == Phi) { // referencing the PHI directly? Must have zero step
- Step = Constant::getNullConstant(Phi->getType());
+ Step = Constant::getNullValue(Phi->getType());
} else if (BinaryOperator *I = dyn_cast<BinaryOperator>(V2)) {
// TODO: This could be much better...
if (I->getOpcode() == Instruction::Add) {
if (StepE.Offset)
Step = (Value*)StepE.Offset;
else
- Step = Constant::getNullConstant(Step->getType());
+ Step = Constant::getNullValue(Step->getType());
const Type *ETy = Phi->getType();
if (ETy->isPointerType()) ETy = Type::ULongTy;
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy,0));
// Use (unsigned long) 0 for a NULL pointer value.
//
const Type* zeroValueType =
- (resultType->getPrimitiveID() == Type::PointerTyID)? Type::ULongTy
- : resultType;
+ isa<PointerType>(resultType) ? Type::ULongTy : resultType;
MachineInstr* minstr = new MachineInstr(opCode);
minstr->SetMachineOperandVal(0, MachineOperand::MO_VirtualRegister,
- Constant::getNullConstant(zeroValueType));
+ Constant::getNullValue(zeroValueType));
minstr->SetMachineOperandVal(1, MachineOperand::MO_VirtualRegister, src);
minstr->SetMachineOperandVal(2, MachineOperand::MO_VirtualRegister,dest);
minstrVec.push_back(minstr);
ValueHandle IHandle(VMC, I); // Prevent I from being removed!
- Constant *Dummy = Constant::getNullConstant(Ty);
+ Constant *Dummy = Constant::getNullValue(Ty);
switch (I->getOpcode()) {
case Instruction::Cast:
LoadInst *LI = cast<LoadInst>(I);
assert(!LI->hasIndices() || AllIndicesZero(LI));
- Res = new LoadInst(Constant::getNullConstant(PointerType::get(Ty)), Name);
+ Res = new LoadInst(Constant::getNullValue(PointerType::get(Ty)), Name);
VMC.ExprMap[I] = Res;
Res->setOperand(0, ConvertExpressionToType(LI->getPointerOperand(),
PointerType::get(Ty), VMC));
Indices, &It);
if (ElTy) {
assert(ElTy == PVTy && "Internal error, setup wrong!");
- Res = new GetElementPtrInst(Constant::getNullConstant(NewSrcTy),
+ Res = new GetElementPtrInst(Constant::getNullValue(NewSrcTy),
Indices, Name);
VMC.ExprMap[I] = Res;
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),
//
if (Res == 0) {
const PointerType *NewSrcTy = PointerType::get(PVTy);
- Res = new GetElementPtrInst(Constant::getNullConstant(NewSrcTy),
+ Res = new GetElementPtrInst(Constant::getNullValue(NewSrcTy),
GEP->copyIndices(), Name);
VMC.ExprMap[I] = Res;
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),
const Type *NewTy = NewVal->getType();
Constant *Dummy = (NewTy != Type::VoidTy) ?
- Constant::getNullConstant(NewTy) : 0;
+ Constant::getNullValue(NewTy) : 0;
switch (I->getOpcode()) {
case Instruction::Cast:
case Instruction::Store: {
if (I->getOperand(0) == OldVal) { // Replace the source value
const PointerType *NewPT = PointerType::get(NewTy);
- Res = new StoreInst(NewVal, Constant::getNullConstant(NewPT));
+ Res = new StoreInst(NewVal, Constant::getNullValue(NewPT));
VMC.ExprMap[I] = Res;
Res->setOperand(1, ConvertExpressionToType(I->getOperand(1), NewPT, VMC));
} else { // Replace the source pointer
assert(Offset == 0 && ValTy);
}
- Res = new StoreInst(Constant::getNullConstant(ValTy), NewVal, Indices);
+ Res = new StoreInst(Constant::getNullValue(ValTy), NewVal, Indices);
VMC.ExprMap[I] = Res;
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0), ValTy, VMC));
}