From: Chris Lattner Date: Sun, 30 Dec 2007 00:51:11 +0000 (+0000) Subject: use simplified operand addition methods. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fec65d55626d302de8049eea8f3a1338a261dd11;p=oota-llvm.git use simplified operand addition methods. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45435 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index 2a1bd79923f..53fec718ff2 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -454,26 +454,19 @@ void ScheduleDAG::AddOperand(MachineInstr *MI, SDOperand Op, abort(); } } - } else if (ConstantSDNode *C = - dyn_cast(Op)) { + } else if (ConstantSDNode *C = dyn_cast(Op)) { MI->addOperand(MachineOperand::CreateImm(C->getValue())); - } else if (RegisterSDNode *R = - dyn_cast(Op)) { + } else if (RegisterSDNode *R = dyn_cast(Op)) { MI->addOperand(MachineOperand::CreateReg(R->getReg(), false)); - } else if (GlobalAddressSDNode *TGA = - dyn_cast(Op)) { - MI->addGlobalAddressOperand(TGA->getGlobal(), TGA->getOffset()); - } else if (BasicBlockSDNode *BB = - dyn_cast(Op)) { - MI->addMachineBasicBlockOperand(BB->getBasicBlock()); - } else if (FrameIndexSDNode *FI = - dyn_cast(Op)) { - MI->addFrameIndexOperand(FI->getIndex()); - } else if (JumpTableSDNode *JT = - dyn_cast(Op)) { - MI->addJumpTableIndexOperand(JT->getIndex()); - } else if (ConstantPoolSDNode *CP = - dyn_cast(Op)) { + } else if (GlobalAddressSDNode *TGA = dyn_cast(Op)) { + MI->addOperand(MachineOperand::CreateGA(TGA->getGlobal(),TGA->getOffset())); + } else if (BasicBlockSDNode *BB = dyn_cast(Op)) { + MI->addOperand(MachineOperand::CreateMBB(BB->getBasicBlock())); + } else if (FrameIndexSDNode *FI = dyn_cast(Op)) { + MI->addOperand(MachineOperand::CreateFI(FI->getIndex())); + } else if (JumpTableSDNode *JT = dyn_cast(Op)) { + MI->addOperand(MachineOperand::CreateJTI(JT->getIndex())); + } else if (ConstantPoolSDNode *CP = dyn_cast(Op)) { int Offset = CP->getOffset(); unsigned Align = CP->getAlignment(); const Type *Type = CP->getType(); @@ -492,10 +485,9 @@ void ScheduleDAG::AddOperand(MachineInstr *MI, SDOperand Op, Idx = ConstPool->getConstantPoolIndex(CP->getMachineCPVal(), Align); else Idx = ConstPool->getConstantPoolIndex(CP->getConstVal(), Align); - MI->addConstantPoolIndexOperand(Idx, Offset); - } else if (ExternalSymbolSDNode *ES = - dyn_cast(Op)) { - MI->addExternalSymbolOperand(ES->getSymbol()); + MI->addOperand(MachineOperand::CreateCPI(Idx, Offset)); + } else if (ExternalSymbolSDNode *ES = dyn_cast(Op)) { + MI->addOperand(MachineOperand::CreateES(ES->getSymbol())); } else { assert(Op.getValueType() != MVT::Other && Op.getValueType() != MVT::Flag && @@ -590,7 +582,7 @@ void ScheduleDAG::EmitSubregNode(SDNode *Node, // Add def, source, and subreg index MI->addOperand(MachineOperand::CreateReg(VRBase, true)); AddOperand(MI, Node->getOperand(0), 0, 0, VRBaseMap); - MI->addImmOperand(SubIdx); + MI->addOperand(MachineOperand::CreateImm(SubIdx)); } else if (Opc == TargetInstrInfo::INSERT_SUBREG) { assert((Node->getNumOperands() == 2 || Node->getNumOperands() == 3) && @@ -647,7 +639,7 @@ void ScheduleDAG::EmitSubregNode(SDNode *Node, AddOperand(MI, Node->getOperand(0), 0, 0, VRBaseMap); if (!isUndefInput) AddOperand(MI, Node->getOperand(1), 0, 0, VRBaseMap); - MI->addImmOperand(SubIdx); + MI->addOperand(MachineOperand::CreateImm(SubIdx)); } else assert(0 && "Node is not a subreg insert or extract"); @@ -774,14 +766,14 @@ void ScheduleDAG::EmitNode(SDNode *Node, unsigned InstanceNo, // Add the asm string as an external symbol operand. const char *AsmStr = cast(Node->getOperand(1))->getSymbol(); - MI->addExternalSymbolOperand(AsmStr); + MI->addOperand(MachineOperand::CreateES(AsmStr)); // Add all of the operand registers to the instruction. for (unsigned i = 2; i != NumOps;) { unsigned Flags = cast(Node->getOperand(i))->getValue(); unsigned NumVals = Flags >> 3; - MI->addImmOperand(Flags); + MI->addOperand(MachineOperand::CreateImm(Flags)); ++i; // Skip the ID value. switch (Flags & 7) { @@ -805,11 +797,11 @@ void ScheduleDAG::EmitNode(SDNode *Node, unsigned InstanceNo, MI->addOperand(MachineOperand::CreateImm(CS->getValue())); } else if (GlobalAddressSDNode *GA = dyn_cast(Node->getOperand(i))) { - MI->addGlobalAddressOperand(GA->getGlobal(), GA->getOffset()); + MI->addOperand(MachineOperand::CreateGA(GA->getGlobal(), + GA->getOffset())); } else { - BasicBlockSDNode *BB = - cast(Node->getOperand(i)); - MI->addMachineBasicBlockOperand(BB->getBasicBlock()); + BasicBlockSDNode *BB =cast(Node->getOperand(i)); + MI->addOperand(MachineOperand::CreateMBB(BB->getBasicBlock())); } } break;