diff options
| author | Dan Gohman <gohman@apple.com> | 2009-01-16 22:10:20 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-01-16 22:10:20 +0000 |
| commit | 5f8a2598b29d996f980594f79f74564e6b89c34e (patch) | |
| tree | 6088ad2b50f0e439c10865d6de772b2535086023 /llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp | |
| parent | 157e008816080b09eea6e9aeca7b53afcf6fe054 (diff) | |
| download | bcm5719-llvm-5f8a2598b29d996f980594f79f74564e6b89c34e.tar.gz bcm5719-llvm-5f8a2598b29d996f980594f79f74564e6b89c34e.zip | |
Instead of adding dependence edges between terminator instructions
and every other instruction in their blocks to keep the terminator
instructions at the end, teach the post-RA scheduler how to operate
on ranges of instructions, and exclude terminators from the range
of instructions that get scheduled.
Also, exclude mid-block labels, such as EH_LABEL instructions, and
schedule code before them separately from code after them. This
fixes problems with the post-RA scheduler moving code past
EH_LABELs.
llvm-svn: 62366
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp index 7bb9bc20c01..2fa53e08e22 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp @@ -127,7 +127,7 @@ void ScheduleDAGSDNodes::EmitCopyFromReg(SDNode *Node, unsigned ResNo, // Create the reg, emit the copy. VRBase = MRI.createVirtualRegister(DstRC); bool Emitted = - TII->copyRegToReg(*BB, BB->end(), VRBase, SrcReg, DstRC, SrcRC); + TII->copyRegToReg(*BB, End, VRBase, SrcReg, DstRC, SrcRC); Emitted = Emitted; // Silence compiler warning. assert(Emitted && "Unable to issue a copy instruction!"); } @@ -410,7 +410,7 @@ void ScheduleDAGSDNodes::EmitSubregNode(SDNode *Node, MI->addOperand(MachineOperand::CreateReg(VRBase, true)); AddOperand(MI, Node->getOperand(0), 0, 0, VRBaseMap); MI->addOperand(MachineOperand::CreateImm(SubIdx)); - BB->push_back(MI); + BB->insert(End, MI); } else if (Opc == TargetInstrInfo::INSERT_SUBREG || Opc == TargetInstrInfo::SUBREG_TO_REG) { SDValue N0 = Node->getOperand(0); @@ -445,7 +445,7 @@ void ScheduleDAGSDNodes::EmitSubregNode(SDNode *Node, // Add the subregster being inserted AddOperand(MI, N1, 0, 0, VRBaseMap); MI->addOperand(MachineOperand::CreateImm(SubIdx)); - BB->push_back(MI); + BB->insert(End, MI); } else assert(0 && "Node is not insert_subreg, extract_subreg, or subreg_to_reg"); @@ -505,12 +505,13 @@ void ScheduleDAGSDNodes::EmitNode(SDNode *Node, bool IsClone, bool IsCloned, for (unsigned i = NodeOperands; i != MemOperandsEnd; ++i) AddMemOperand(MI, cast<MemOperandSDNode>(Node->getOperand(i))->MO); - if (II.usesCustomDAGSchedInsertionHook()) + if (II.usesCustomDAGSchedInsertionHook()) { // Insert this instruction into the basic block using a target // specific inserter which may returns a new basic block. BB = TLI->EmitInstrWithCustomInserter(MI, BB); - else - BB->push_back(MI); + Begin = End = BB->end(); + } else + BB->insert(End, MI); // Additional results must be an physical register def. if (HasPhysRegOuts) { @@ -559,7 +560,7 @@ void ScheduleDAGSDNodes::EmitNode(SDNode *Node, bool IsClone, bool IsCloned, else DstTRC = TRI->getPhysicalRegisterRegClass(DestReg, Node->getOperand(1).getValueType()); - TII->copyRegToReg(*BB, BB->end(), DestReg, SrcReg, DstTRC, SrcTRC); + TII->copyRegToReg(*BB, End, DestReg, SrcReg, DstTRC, SrcTRC); break; } case ISD::CopyFromReg: { @@ -614,7 +615,7 @@ void ScheduleDAGSDNodes::EmitNode(SDNode *Node, bool IsClone, bool IsCloned, break; } } - BB->push_back(MI); + BB->insert(End, MI); break; } } |

