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
diff --git a/lib/CodeGen/ScheduleDAG.cpp b/lib/CodeGen/ScheduleDAG.cpp
index e309a43..718f591 100644
--- a/lib/CodeGen/ScheduleDAG.cpp
+++ b/lib/CodeGen/ScheduleDAG.cpp
@@ -46,11 +46,18 @@
 
 /// Run - perform scheduling.
 ///
-void ScheduleDAG::Run(SelectionDAG *dag, MachineBasicBlock *bb) {
+void ScheduleDAG::Run(SelectionDAG *dag, MachineBasicBlock *bb,
+                      MachineBasicBlock::iterator begin,
+                      MachineBasicBlock::iterator end) {
+  assert((!dag || begin == end) &&
+         "An instruction range was given for SelectionDAG scheduling!");
+
   SUnits.clear();
   Sequence.clear();
   DAG = dag;
   BB = bb;
+  Begin = begin;
+  End = end;
 
   Schedule();