Author: djg Date: Fri Feb 15 18:36:48 2008 New Revision: 47198 URL: http://llvm.org/viewvc/llvm-project?rev=47198&view=rev Log: Rename CountMemOperands to ComputeMemOperandsEnd to reflect what it actually does. Simplify CountOperands a little by reusing ComputeMemOperandsEnd. And reword some comments for both.
Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=47198&r1=47197&r2=47198&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Fri Feb 15 18:36:48 2008 @@ -315,13 +315,14 @@ static unsigned CountResults(SDNode *Node); /// CountOperands - The inputs to target nodes have any actual inputs first, - /// followed by optional memory operands chain operand, then flag operands. - /// Compute the number of actual operands that will go into the machine - /// instr. + /// followed by special operands that describe memory references, then an + /// optional chain operand, then flag operands. Compute the number of + /// actual operands that will go into the resulting MachineInstr. static unsigned CountOperands(SDNode *Node); - /// CountMemOperands - Find the index of the last MemOperandSDNode - static unsigned CountMemOperands(SDNode *Node); + /// ComputeMemOperandsEnd - Find the index one past the last + /// MemOperandSDNode operand + static unsigned ComputeMemOperandsEnd(SDNode *Node); /// EmitNode - Generate machine code for an node and needed dependencies. /// VRBaseMap contains, for each already emitted node, the first virtual Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=47198&r1=47197&r2=47198&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Fri Feb 15 18:36:48 2008 @@ -279,22 +279,19 @@ } /// CountOperands - The inputs to target nodes have any actual inputs first, -/// followed by optional memory operands chain operand, then flag operands. -/// Compute the number of actual operands that will go into the resulting -/// MachineInstr. +/// followed by special operands that describe memory references, then an +/// optional chain operand, then flag operands. Compute the number of +/// actual operands that will go into the resulting MachineInstr. unsigned ScheduleDAG::CountOperands(SDNode *Node) { - unsigned N = Node->getNumOperands(); - while (N && Node->getOperand(N - 1).getValueType() == MVT::Flag) - --N; - if (N && Node->getOperand(N - 1).getValueType() == MVT::Other) - --N; // Ignore chain if it exists. + unsigned N = ComputeMemOperandsEnd(Node); while (N && isa<MemOperandSDNode>(Node->getOperand(N - 1).Val)) --N; // Ignore MemOperand nodes return N; } -/// CountMemOperands - Find the index of the last MemOperandSDNode operand -unsigned ScheduleDAG::CountMemOperands(SDNode *Node) { +/// ComputeMemOperandsEnd - Find the index one past the last MemOperandSDNode +/// operand +unsigned ScheduleDAG::ComputeMemOperandsEnd(SDNode *Node) { unsigned N = Node->getNumOperands(); while (N && Node->getOperand(N - 1).getValueType() == MVT::Flag) --N; @@ -698,7 +695,7 @@ unsigned NumResults = CountResults(Node); unsigned NodeOperands = CountOperands(Node); - unsigned NodeMemOperands = CountMemOperands(Node); + unsigned MemOperandsEnd = ComputeMemOperandsEnd(Node); unsigned NumMIOperands = NodeOperands + NumResults; bool HasPhysRegOuts = (NumResults > II.getNumDefs()) && II.getImplicitDefs() != 0; @@ -722,7 +719,7 @@ AddOperand(MI, Node->getOperand(i), i+II.getNumDefs(), &II, VRBaseMap); // Emit all of the memory operands of this instruction - for (unsigned i = NodeOperands; i != NodeMemOperands; ++i) + for (unsigned i = NodeOperands; i != MemOperandsEnd; ++i) AddMemOperand(MI, cast<MemOperandSDNode>(Node->getOperand(i))->MO); // Commute node if it has been determined to be profitable. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits