aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/PostRASchedulerList.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-01-16 22:10:20 +0000
committerDan Gohman <gohman@apple.com>2009-01-16 22:10:20 +0000
commitf7119393a97c2a10757084b6bc186380f8c19a73 (patch)
tree7824f429705e746de59c9c813df694fd3f19fab0 /lib/CodeGen/PostRASchedulerList.cpp
parent49bb50e0b65d4646a1d44eec3196c003c13caa96 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62366 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PostRASchedulerList.cpp')
-rw-r--r--lib/CodeGen/PostRASchedulerList.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/CodeGen/PostRASchedulerList.cpp b/lib/CodeGen/PostRASchedulerList.cpp
index eef20b9386..7bf3b3c342 100644
--- a/lib/CodeGen/PostRASchedulerList.cpp
+++ b/lib/CodeGen/PostRASchedulerList.cpp
@@ -187,9 +187,17 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
// Loop over all of the basic blocks
for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end();
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)
+ if (MI->getDesc().isTerminator() || MI->isLabel()) {
+ Scheduler.Run(0, MBB, Current, MI);
+ Scheduler.EmitSchedule();
+ Current = next(MI);
+ }
- Scheduler.Run(0, MBB);
-
+ Scheduler.Run(0, MBB, Current, End);
Scheduler.EmitSchedule();
}