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 | 1d87bcf4909b06dcd86320722653341f08b8b396 (patch) | |
tree | c96a6176090b950f14ac44061b68f243a1920fe3 /lib/Target | |
parent | cfe26c930ae691ff3012736555846c45087e1a9e (diff) |
Convert more code to use new style casts
Eliminate old style casts from value.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@696 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/SparcV9/InstrSched/SchedGraph.cpp | 3 | ||||
-rw-r--r-- | lib/Target/SparcV9/InstrSelection/InstrForest.cpp | 14 | ||||
-rw-r--r-- | lib/Target/SparcV9/SparcV9InstrSelection.cpp | 22 |
3 files changed, 19 insertions, 20 deletions
diff --git a/lib/Target/SparcV9/InstrSched/SchedGraph.cpp b/lib/Target/SparcV9/InstrSched/SchedGraph.cpp index 40601300f7..852c4f2686 100644 --- a/lib/Target/SparcV9/InstrSched/SchedGraph.cpp +++ b/lib/Target/SparcV9/InstrSched/SchedGraph.cpp @@ -532,7 +532,7 @@ SchedGraph::addSSAEdge(SchedGraphNode* node, const Value* val, const TargetMachine& target) { - if (!val->isInstruction()) return; + if (!isa<Instruction>(val)) return; const Instruction* thisVMInstr = node->getInstr(); const Instruction* defVMInstr = cast<const Instruction>(val); @@ -642,7 +642,6 @@ void SchedGraph::addNonSSAEdgesForValue(const Instruction* instr, const TargetMachine& target) { - assert(instr->isInstruction()); if (instr->isPHINode()) return; diff --git a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp index 9f4df08d38..f5a524707b 100644 --- a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp +++ b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp @@ -275,12 +275,12 @@ InstrForest::buildTreeForInstruction(Instruction *instr) // Check latter condition here just to simplify the next IF. bool includeAddressOperand = - (operand->isBasicBlock() || operand->isMethod()) + (isa<BasicBlock>(operand) || isa<Method>(operand)) && !instr->isTerminator(); - if (includeAddressOperand || operand->isInstruction() || - operand->isConstant() || operand->isMethodArgument() || - operand->isGlobal()) + if (includeAddressOperand || isa<Instruction>(operand) || + isa<ConstPoolVal>(operand) || isa<MethodArgument>(operand) || + isa<GlobalVariable>(operand)) { // This operand is a data value @@ -300,15 +300,15 @@ InstrForest::buildTreeForInstruction(Instruction *instr) // is used directly, i.e., made a child of the instruction node. // InstrTreeNode* opTreeNode; - if (operand->isInstruction() && operand->use_size() == 1 && - ((Instruction*)operand)->getParent() == instr->getParent() && + if (isa<Instruction>(operand) && operand->use_size() == 1 && + cast<Instruction>(operand)->getParent() == instr->getParent() && ! instr->isPHINode() && instr->getOpcode() != Instruction::Call) { // Recursively create a treeNode for it. opTreeNode = buildTreeForInstruction((Instruction*)operand); } - else if (ConstPoolVal *CPV = operand->castConstant()) + else if (ConstPoolVal *CPV = dyn_cast<ConstPoolVal>(operand)) { // Create a leaf node for a constant opTreeNode = new ConstantNode(CPV); diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp index 572e1b175b..b1b5e01aff 100644 --- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp +++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp @@ -60,7 +60,7 @@ static int64_t GetConstantValueAsSignedInt(const Value *V, bool &isValidConstant) { - if (!V->isConstant()) + if (!isa<ConstPoolVal>(V)) { isValidConstant = false; return 0; @@ -374,8 +374,8 @@ ChooseAddInstructionByType(const Type* resultType) MachineOpCode opCode = INVALID_OPCODE; if (resultType->isIntegral() || - resultType->isPointerType() || - resultType->isMethodType() || + isa<PointerType>(resultType) || + isa<MethodType>(resultType) || resultType->isLabelType() || resultType == Type::BoolTy) { @@ -419,7 +419,7 @@ CreateAddConstInstruction(const InstructionNode* instrNode) MachineInstr* minstr = NULL; Value* constOp = ((InstrTreeNode*) instrNode->rightChild())->getValue(); - assert(constOp->isConstant()); + assert(isa<ConstPoolVal>(constOp)); // Cases worth optimizing are: // (1) Add with 0 for float or double: use an FMOV of appropriate type, @@ -469,7 +469,7 @@ CreateSubConstInstruction(const InstructionNode* instrNode) MachineInstr* minstr = NULL; Value* constOp = ((InstrTreeNode*) instrNode->rightChild())->getValue(); - assert(constOp->isConstant()); + assert(isa<ConstPoolVal>(constOp)); // Cases worth optimizing are: // (1) Sub with 0 for float or double: use an FMOV of appropriate type, @@ -575,7 +575,7 @@ CreateMulConstInstruction(TargetMachine &target, bool needNeg = false; Value* constOp = ((InstrTreeNode*) instrNode->rightChild())->getValue(); - assert(constOp->isConstant()); + assert(isa<ConstPoolVal>(constOp)); // Cases worth optimizing are: // (1) Multiply by 0 or 1 for any type: replace with copy (ADD or FMOV) @@ -699,7 +699,7 @@ CreateDivConstInstruction(TargetMachine &target, getMinstr2 = NULL; Value* constOp = ((InstrTreeNode*) instrNode->rightChild())->getValue(); - assert(constOp->isConstant()); + assert(isa<ConstPoolVal>(constOp)); // Cases worth optimizing are: // (1) Divide by 1 for any type: replace with copy (ADD or FMOV) @@ -952,7 +952,7 @@ SetMemOperands_Internal(MachineInstr* minstr, assert(arrayOffsetVal != NULL && "Expect to be given Value* for array offsets"); - if (ConstPoolVal *CPV = arrayOffsetVal->castConstant()) + if (ConstPoolVal *CPV = dyn_cast<ConstPoolVal>(arrayOffsetVal)) { isConstantOffset = true; // always constant for structs assert(arrayOffsetVal->getType()->isIntegral()); @@ -1037,7 +1037,7 @@ CreateLoadConstInstr(const TargetMachine &target, Instruction* dest, MachineInstr*& getMinstr2) { - assert(val->isConstant()); + assert(isa<ConstPoolVal>(val)); MachineInstr* minstr1 = NULL; @@ -1183,7 +1183,7 @@ FixConstantOperands(const InstructionNode* vmInstrNode, Value* opValue = mop.getVRegValue(); - if (opValue->isConstant()) + if (isa<ConstPoolVal>(opValue)) { unsigned int machineRegNum; int64_t immedValue; @@ -1298,7 +1298,7 @@ CreateCopyInstructionsByType(const TargetMachine& target, // if `src' is a constant that doesn't fit in the immed field, generate // a load instruction instead of an add - if (src->isConstant()) + if (isa<ConstPoolVal>(src)) { unsigned int machineRegNum; int64_t immedValue; |