aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/PostRASchedulerList.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-02-03 18:57:45 +0000
committerDan Gohman <gohman@apple.com>2009-02-03 18:57:45 +0000
commit0dcda31cb40614d1adec10aad1a40a57ad581c69 (patch)
treea2d7af29f753d187edb5bfe102d672656ae7eb77 /lib/CodeGen/PostRASchedulerList.cpp
parentd3ef6c92d046a662273e4fc6d739f0de17e43551 (diff)
downloadexternal_llvm-0dcda31cb40614d1adec10aad1a40a57ad581c69.zip
external_llvm-0dcda31cb40614d1adec10aad1a40a57ad581c69.tar.gz
external_llvm-0dcda31cb40614d1adec10aad1a40a57ad581c69.tar.bz2
Change the post-RA scheduler to iterate through the
basic-block segments bottom-up instead of top down. This is the first step in a general restructuring of the way register liveness is tracked in the post-RA scheduler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63643 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PostRASchedulerList.cpp')
-rw-r--r--lib/CodeGen/PostRASchedulerList.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/CodeGen/PostRASchedulerList.cpp b/lib/CodeGen/PostRASchedulerList.cpp
index 7bf3b3c..0cb3b03 100644
--- a/lib/CodeGen/PostRASchedulerList.cpp
+++ b/lib/CodeGen/PostRASchedulerList.cpp
@@ -189,15 +189,17 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
MBB != MBBe; ++MBB) {
// Schedule each sequence of instructions not interrupted by a label
// or anything else that effectively needs to shut down scheduling.
- MachineBasicBlock::iterator Current = MBB->begin(), End = MBB->end();
- for (MachineBasicBlock::iterator MI = Current; MI != End; ++MI)
+ MachineBasicBlock::iterator Current = MBB->end(), Top = MBB->begin();
+ for (MachineBasicBlock::iterator I = Current; I != Top; ) {
+ MachineInstr *MI = --I;
if (MI->getDesc().isTerminator() || MI->isLabel()) {
- Scheduler.Run(0, MBB, Current, MI);
+ Scheduler.Run(0, MBB, next(I), Current);
Scheduler.EmitSchedule();
- Current = next(MI);
+ Current = I;
}
+ }
- Scheduler.Run(0, MBB, Current, End);
+ Scheduler.Run(0, MBB, Top, Current);
Scheduler.EmitSchedule();
}
@@ -415,10 +417,10 @@ bool SchedulePostRATDList::BreakAntiDependencies() {
// instructions from the bottom up, tracking information about liveness
// as we go to help determine which registers are available.
bool Changed = false;
- unsigned Count = BB->size() - 1;
- for (MachineBasicBlock::reverse_iterator I = BB->rbegin(), E = BB->rend();
- I != E; ++I, --Count) {
- MachineInstr *MI = &*I;
+ unsigned Count = SUnits.size() - 1;
+ for (MachineBasicBlock::iterator I = End, E = Begin;
+ I != E; --Count) {
+ MachineInstr *MI = --I;
// After regalloc, IMPLICIT_DEF instructions aren't safe to treat as
// dependence-breaking. In the case of an INSERT_SUBREG, the IMPLICIT_DEF