diff options
author | Dan Gohman <gohman@apple.com> | 2008-02-16 00:36:48 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-02-16 00:36:48 +0000 |
commit | 27ae57390080e4a77b1cbfd077efd9a668d6fe3b (patch) | |
tree | b04b5efb24da294ed097fce4e51fdda02e94f76e /llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | |
parent | 28e7108142aa30fe47daa82e9427f6c1b80273fc (diff) | |
download | bcm5719-llvm-27ae57390080e4a77b1cbfd077efd9a668d6fe3b.tar.gz bcm5719-llvm-27ae57390080e4a77b1cbfd077efd9a668d6fe3b.zip |
Rename CountMemOperands to ComputeMemOperandsEnd to reflect what
it actually does. Simplify CountOperands a little by reusing
ComputeMemOperandsEnd. And reword some comments for both.
llvm-svn: 47198
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index e7980156905..da79a991c24 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -279,22 +279,19 @@ unsigned ScheduleDAG::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 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 @@ void ScheduleDAG::EmitNode(SDNode *Node, unsigned InstanceNo, 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 @@ void ScheduleDAG::EmitNode(SDNode *Node, unsigned InstanceNo, 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. |