diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-01 20:11:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-01 20:11:19 +0000 |
commit | 38569343868ee3dad90dcdddfb9fee1ca0bcf25f (patch) | |
tree | 1b9bc0f2b6911aed0815f3a00945714c26a8a5ce /llvm/lib/Transforms | |
parent | 8f191129239552b876f2c6717fae9619a7701a03 (diff) | |
download | bcm5719-llvm-38569343868ee3dad90dcdddfb9fee1ca0bcf25f.tar.gz bcm5719-llvm-38569343868ee3dad90dcdddfb9fee1ca0bcf25f.zip |
Convert more code to use new style casts
Eliminate old style casts from value.h
llvm-svn: 696
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/InlineSimple.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/ConstantProp.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/InductionVars.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 4 |
4 files changed, 14 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp index 27ef66e42e3..8bc0a77cd1f 100644 --- a/llvm/lib/Transforms/IPO/InlineSimple.cpp +++ b/llvm/lib/Transforms/IPO/InlineSimple.cpp @@ -40,7 +40,7 @@ static inline void RemapInstruction(Instruction *I, for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) { const Value *Op = I->getOperand(op); Value *V = ValueMap[Op]; - if (!V && (Op->isMethod() || Op->isConstant())) + if (!V && (isa<Method>(Op) || isa<ConstPoolVal>(Op))) continue; // Methods and constants don't get relocated if (!V) { diff --git a/llvm/lib/Transforms/Scalar/ConstantProp.cpp b/llvm/lib/Transforms/Scalar/ConstantProp.cpp index 8b879162426..d43f693dd17 100644 --- a/llvm/lib/Transforms/Scalar/ConstantProp.cpp +++ b/llvm/lib/Transforms/Scalar/ConstantProp.cpp @@ -88,9 +88,9 @@ bool opt::ConstantFoldTerminator(TerminatorInst *T) { BasicBlock *Dest1 = cast<BasicBlock>(BI->getOperand(0)); BasicBlock *Dest2 = cast<BasicBlock>(BI->getOperand(1)); - if (BI->getCondition()->isConstant()) { // Are we branching on constant? + if (ConstPoolBool *Cond = dyn_cast<ConstPoolBool>(BI->getCondition())) { + // Are we branching on constant? // YES. Change to unconditional branch... - ConstPoolBool *Cond = (ConstPoolBool*)BI->getCondition(); BasicBlock *Destination = Cond->getValue() ? Dest1 : Dest2; BasicBlock *OldDest = Cond->getValue() ? Dest2 : Dest1; @@ -137,14 +137,14 @@ inline static bool ConstantFoldInstruction(Method *M, Method::inst_iterator &II) { Instruction *Inst = *II; if (Inst->isBinaryOp()) { - ConstPoolVal *D1 = Inst->getOperand(0)->castConstant(); - ConstPoolVal *D2 = Inst->getOperand(1)->castConstant(); + ConstPoolVal *D1 = dyn_cast<ConstPoolVal>(Inst->getOperand(0)); + ConstPoolVal *D2 = dyn_cast<ConstPoolVal>(Inst->getOperand(1)); if (D1 && D2) return ConstantFoldBinaryInst(M, II, (BinaryOperator*)Inst, D1, D2); } else if (Inst->isUnaryOp()) { - ConstPoolVal *D = Inst->getOperand(0)->castConstant(); + ConstPoolVal *D = dyn_cast<ConstPoolVal>(Inst->getOperand(0)); if (D) return ConstantFoldUnaryInst(M, II, (UnaryOperator*)Inst, D); } else if (Inst->isTerminator()) { return opt::ConstantFoldTerminator((TerminatorInst*)Inst); diff --git a/llvm/lib/Transforms/Scalar/InductionVars.cpp b/llvm/lib/Transforms/Scalar/InductionVars.cpp index 6815ccb9a40..f2dcb451535 100644 --- a/llvm/lib/Transforms/Scalar/InductionVars.cpp +++ b/llvm/lib/Transforms/Scalar/InductionVars.cpp @@ -36,9 +36,9 @@ using namespace opt; // an interval invariant computation. // static bool isLoopInvariant(cfg::Interval *Int, Value *V) { - assert(V->isConstant() || V->isInstruction() || V->isMethodArgument()); + assert(isa<ConstPoolVal>(V) || isa<Instruction>(V) || isa<MethodArgument>(V)); - if (!V->isInstruction()) + if (!isa<Instruction>(V)) return true; // Constants and arguments are always loop invariant BasicBlock *ValueBlock = ((Instruction*)V)->getParent(); @@ -132,7 +132,7 @@ static inline bool isLinearInductionVariable(cfg::Interval *Int, Value *V, static inline bool isSimpleInductionVar(PHINode *PN) { assert(PN->getNumIncomingValues() == 2 && "Must have cannonical PHI node!"); Value *Initializer = PN->getIncomingValue(0); - if (!Initializer->isConstant()) return false; + if (!isa<ConstPoolVal>(Initializer)) return false; if (Initializer->getType()->isSigned()) { // Signed constant value... if (((ConstPoolSInt*)Initializer)->getValue() != 0) return false; @@ -143,18 +143,18 @@ static inline bool isSimpleInductionVar(PHINode *PN) { } Value *StepExpr = PN->getIncomingValue(1); - if (!StepExpr->isInstruction() || + if (!isa<Instruction>(StepExpr) || ((Instruction*)StepExpr)->getOpcode() != Instruction::Add) return false; BinaryOperator *I = (BinaryOperator*)StepExpr; - assert(I->getOperand(0)->isInstruction() && + assert(isa<Instruction>(I->getOperand(0)) && ((Instruction*)I->getOperand(0))->isPHINode() && "PHI node should be first operand of ADD instruction!"); // Get the right hand side of the ADD node. See if it is a constant 1. Value *StepSize = I->getOperand(1); - if (!StepSize->isConstant()) return false; + if (!isa<ConstPoolVal>(StepSize)) return false; if (StepSize->getType()->isSigned()) { // Signed constant value... if (((ConstPoolSInt*)StepSize)->getValue() != 1) return false; diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index 78b6c3df7b4..91e002d8be9 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -146,9 +146,9 @@ private: map<Value*, InstVal>::iterator I = ValueState.find(V); if (I != ValueState.end()) return I->second; // Common case, in the map - if (ConstPoolVal *CPV = V->castConstant()) { // Constants are constant + if (ConstPoolVal *CPV = dyn_cast<ConstPoolVal>(V)) {//Constants are constant ValueState[CPV].markConstant(CPV); - } else if (V->isMethodArgument()) { // MethodArgs are overdefined + } else if (isa<MethodArgument>(V)) { // MethodArgs are overdefined ValueState[V].markOverdefined(); } // All others are underdefined by default... |