diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/InstrSched/SchedGraph.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/InstrSelection/InstrForest.cpp | 14 | ||||
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 8 |
3 files changed, 12 insertions, 13 deletions
diff --git a/lib/CodeGen/InstrSched/SchedGraph.cpp b/lib/CodeGen/InstrSched/SchedGraph.cpp index 40601300f7..852c4f2686 100644 --- a/lib/CodeGen/InstrSched/SchedGraph.cpp +++ b/lib/CodeGen/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/CodeGen/InstrSelection/InstrForest.cpp b/lib/CodeGen/InstrSelection/InstrForest.cpp index 9f4df08d38..f5a524707b 100644 --- a/lib/CodeGen/InstrSelection/InstrForest.cpp +++ b/lib/CodeGen/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/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 1e3300763d..64076286f4 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -141,7 +141,7 @@ operator<<(ostream &os, const MachineOperand &mop) case MachineOperand::MO_PCRelativeDisp: { const Value* opVal = mop.getVRegValue(); - bool isLabel = opVal->isMethod() || opVal->isBasicBlock(); + bool isLabel = isa<Method>(opVal) || isa<BasicBlock>(opVal); return os << "%disp(" << (isLabel? "label " : "addr-of-val ") << opVal << ")"; @@ -221,7 +221,7 @@ Set3OperandsFromInstrJUNK(MachineInstr* minstr, minstr->SetMachineOperand(op1Position, /*regNum*/ target.zeroRegNum); else { - if (op1Value->isConstant()) + if (isa<ConstPoolVal>(op1Value)) { // value is constant and must be loaded from constant pool returnFlags = returnFlags | (1 << op1Position); @@ -247,7 +247,7 @@ Set3OperandsFromInstrJUNK(MachineInstr* minstr, minstr->SetMachineOperand(op2Position, machineRegNum); else if (op2type == MachineOperand::MO_VirtualRegister) { - if (op2Value->isConstant()) + if (isa<ConstPoolVal>(op2Value)) { // value is constant and must be loaded from constant pool returnFlags = returnFlags | (1 << op2Position); @@ -318,7 +318,7 @@ ChooseRegOrImmed(Value* val, // Check for the common case first: argument is not constant // - ConstPoolVal *CPV = val->castConstant(); + ConstPoolVal *CPV = dyn_cast<ConstPoolVal>(val); if (!CPV) return opType; if (CPV->getType() == Type::BoolTy) |