mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Change Constant::getNullConstant to Constant::getNullValue
llvm-svn: 2323
This commit is contained in:
parent
dfdfae42df
commit
078d292f4c
@ -115,7 +115,7 @@ InductionVariable::InductionVariable(PHINode *P, cfg::LoopInfo *LoopInfo) {
|
|||||||
Step = 0;
|
Step = 0;
|
||||||
|
|
||||||
if (V2 == Phi) { // referencing the PHI directly? Must have zero step
|
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)) {
|
} else if (BinaryOperator *I = dyn_cast<BinaryOperator>(V2)) {
|
||||||
// TODO: This could be much better...
|
// TODO: This could be much better...
|
||||||
if (I->getOpcode() == Instruction::Add) {
|
if (I->getOpcode() == Instruction::Add) {
|
||||||
@ -143,7 +143,7 @@ InductionVariable::InductionVariable(PHINode *P, cfg::LoopInfo *LoopInfo) {
|
|||||||
if (StepE.Offset)
|
if (StepE.Offset)
|
||||||
Step = (Value*)StepE.Offset;
|
Step = (Value*)StepE.Offset;
|
||||||
else
|
else
|
||||||
Step = Constant::getNullConstant(Step->getType());
|
Step = Constant::getNullValue(Step->getType());
|
||||||
const Type *ETy = Phi->getType();
|
const Type *ETy = Phi->getType();
|
||||||
if (ETy->isPointerType()) ETy = Type::ULongTy;
|
if (ETy->isPointerType()) ETy = Type::ULongTy;
|
||||||
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy,0));
|
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy,0));
|
||||||
|
@ -1205,11 +1205,10 @@ CreateCopyInstructionsByType(const TargetMachine& target,
|
|||||||
// Use (unsigned long) 0 for a NULL pointer value.
|
// Use (unsigned long) 0 for a NULL pointer value.
|
||||||
//
|
//
|
||||||
const Type* zeroValueType =
|
const Type* zeroValueType =
|
||||||
(resultType->getPrimitiveID() == Type::PointerTyID)? Type::ULongTy
|
isa<PointerType>(resultType) ? Type::ULongTy : resultType;
|
||||||
: resultType;
|
|
||||||
MachineInstr* minstr = new MachineInstr(opCode);
|
MachineInstr* minstr = new MachineInstr(opCode);
|
||||||
minstr->SetMachineOperandVal(0, MachineOperand::MO_VirtualRegister,
|
minstr->SetMachineOperandVal(0, MachineOperand::MO_VirtualRegister,
|
||||||
Constant::getNullConstant(zeroValueType));
|
Constant::getNullValue(zeroValueType));
|
||||||
minstr->SetMachineOperandVal(1, MachineOperand::MO_VirtualRegister, src);
|
minstr->SetMachineOperandVal(1, MachineOperand::MO_VirtualRegister, src);
|
||||||
minstr->SetMachineOperandVal(2, MachineOperand::MO_VirtualRegister,dest);
|
minstr->SetMachineOperandVal(2, MachineOperand::MO_VirtualRegister,dest);
|
||||||
minstrVec.push_back(minstr);
|
minstrVec.push_back(minstr);
|
||||||
|
@ -386,7 +386,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
|
|||||||
|
|
||||||
ValueHandle IHandle(VMC, I); // Prevent I from being removed!
|
ValueHandle IHandle(VMC, I); // Prevent I from being removed!
|
||||||
|
|
||||||
Constant *Dummy = Constant::getNullConstant(Ty);
|
Constant *Dummy = Constant::getNullValue(Ty);
|
||||||
|
|
||||||
switch (I->getOpcode()) {
|
switch (I->getOpcode()) {
|
||||||
case Instruction::Cast:
|
case Instruction::Cast:
|
||||||
@ -415,7 +415,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
|
|||||||
LoadInst *LI = cast<LoadInst>(I);
|
LoadInst *LI = cast<LoadInst>(I);
|
||||||
assert(!LI->hasIndices() || AllIndicesZero(LI));
|
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;
|
VMC.ExprMap[I] = Res;
|
||||||
Res->setOperand(0, ConvertExpressionToType(LI->getPointerOperand(),
|
Res->setOperand(0, ConvertExpressionToType(LI->getPointerOperand(),
|
||||||
PointerType::get(Ty), VMC));
|
PointerType::get(Ty), VMC));
|
||||||
@ -499,7 +499,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
|
|||||||
Indices, &It);
|
Indices, &It);
|
||||||
if (ElTy) {
|
if (ElTy) {
|
||||||
assert(ElTy == PVTy && "Internal error, setup wrong!");
|
assert(ElTy == PVTy && "Internal error, setup wrong!");
|
||||||
Res = new GetElementPtrInst(Constant::getNullConstant(NewSrcTy),
|
Res = new GetElementPtrInst(Constant::getNullValue(NewSrcTy),
|
||||||
Indices, Name);
|
Indices, Name);
|
||||||
VMC.ExprMap[I] = Res;
|
VMC.ExprMap[I] = Res;
|
||||||
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),
|
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),
|
||||||
@ -514,7 +514,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
|
|||||||
//
|
//
|
||||||
if (Res == 0) {
|
if (Res == 0) {
|
||||||
const PointerType *NewSrcTy = PointerType::get(PVTy);
|
const PointerType *NewSrcTy = PointerType::get(PVTy);
|
||||||
Res = new GetElementPtrInst(Constant::getNullConstant(NewSrcTy),
|
Res = new GetElementPtrInst(Constant::getNullValue(NewSrcTy),
|
||||||
GEP->copyIndices(), Name);
|
GEP->copyIndices(), Name);
|
||||||
VMC.ExprMap[I] = Res;
|
VMC.ExprMap[I] = Res;
|
||||||
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),
|
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),
|
||||||
@ -925,7 +925,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
|
|||||||
|
|
||||||
const Type *NewTy = NewVal->getType();
|
const Type *NewTy = NewVal->getType();
|
||||||
Constant *Dummy = (NewTy != Type::VoidTy) ?
|
Constant *Dummy = (NewTy != Type::VoidTy) ?
|
||||||
Constant::getNullConstant(NewTy) : 0;
|
Constant::getNullValue(NewTy) : 0;
|
||||||
|
|
||||||
switch (I->getOpcode()) {
|
switch (I->getOpcode()) {
|
||||||
case Instruction::Cast:
|
case Instruction::Cast:
|
||||||
@ -1001,7 +1001,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
|
|||||||
case Instruction::Store: {
|
case Instruction::Store: {
|
||||||
if (I->getOperand(0) == OldVal) { // Replace the source value
|
if (I->getOperand(0) == OldVal) { // Replace the source value
|
||||||
const PointerType *NewPT = PointerType::get(NewTy);
|
const PointerType *NewPT = PointerType::get(NewTy);
|
||||||
Res = new StoreInst(NewVal, Constant::getNullConstant(NewPT));
|
Res = new StoreInst(NewVal, Constant::getNullValue(NewPT));
|
||||||
VMC.ExprMap[I] = Res;
|
VMC.ExprMap[I] = Res;
|
||||||
Res->setOperand(1, ConvertExpressionToType(I->getOperand(1), NewPT, VMC));
|
Res->setOperand(1, ConvertExpressionToType(I->getOperand(1), NewPT, VMC));
|
||||||
} else { // Replace the source pointer
|
} else { // Replace the source pointer
|
||||||
@ -1015,7 +1015,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
|
|||||||
assert(Offset == 0 && ValTy);
|
assert(Offset == 0 && ValTy);
|
||||||
}
|
}
|
||||||
|
|
||||||
Res = new StoreInst(Constant::getNullConstant(ValTy), NewVal, Indices);
|
Res = new StoreInst(Constant::getNullValue(ValTy), NewVal, Indices);
|
||||||
VMC.ExprMap[I] = Res;
|
VMC.ExprMap[I] = Res;
|
||||||
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0), ValTy, VMC));
|
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0), ValTy, VMC));
|
||||||
}
|
}
|
||||||
|
@ -108,10 +108,8 @@ static bool RemoveSingularPHIs(BasicBlock *BB) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ReplaceUsesWithConstant(Instruction *I) {
|
static void ReplaceUsesWithConstant(Instruction *I) {
|
||||||
Constant *CPV = Constant::getNullConstant(I->getType());
|
|
||||||
|
|
||||||
// Make all users of this instruction reference the constant instead
|
// Make all users of this instruction reference the constant instead
|
||||||
I->replaceAllUsesWith(CPV);
|
I->replaceAllUsesWith(Constant::getNullValue(I->getType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// PropogatePredecessors - This gets "Succ" ready to have the predecessors from
|
// PropogatePredecessors - This gets "Succ" ready to have the predecessors from
|
||||||
|
@ -101,7 +101,7 @@ static bool TransformLoop(cfg::LoopInfo *Loops, cfg::Loop *Loop) {
|
|||||||
assert(PI == pred_end(Header) && "Loop headers should have 2 preds!");
|
assert(PI == pred_end(Header) && "Loop headers should have 2 preds!");
|
||||||
|
|
||||||
// Add incoming values for the PHI node...
|
// Add incoming values for the PHI node...
|
||||||
PN->addIncoming(Constant::getNullConstant(Type::UIntTy), Incoming);
|
PN->addIncoming(Constant::getNullValue(Type::UIntTy), Incoming);
|
||||||
PN->addIncoming(Add, BackEdgeBlock);
|
PN->addIncoming(Add, BackEdgeBlock);
|
||||||
|
|
||||||
// Analyze the new induction variable...
|
// Analyze the new induction variable...
|
||||||
|
@ -123,7 +123,7 @@ Instruction *InstCombiner::visitSub(BinaryOperator *I) {
|
|||||||
//
|
//
|
||||||
if (Constant *Op2 = dyn_cast<Constant>(I->getOperand(1)))
|
if (Constant *Op2 = dyn_cast<Constant>(I->getOperand(1)))
|
||||||
// Calculate 0 - RHS
|
// Calculate 0 - RHS
|
||||||
if (Constant *RHS = *Constant::getNullConstant(I->getType()) - *Op2) {
|
if (Constant *RHS = *Constant::getNullValue(I->getType()) - *Op2) {
|
||||||
return BinaryOperator::create(Instruction::Add, I->getOperand(0), RHS,
|
return BinaryOperator::create(Instruction::Add, I->getOperand(0), RHS,
|
||||||
I->getName());
|
I->getName());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user