[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp SelectionDAGISel.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Aug 26 13:54:58 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

ScheduleDAG.cpp updated: 1.15 -> 1.16
SelectionDAGISel.cpp updated: 1.74 -> 1.75
---
Log message:

Call the InsertAtEndOfBasicBlock hook if the usesCustomDAGSchedInserter
flag is set on an instruction.


---
Diffs of the changes:  (+22 -1)

 ScheduleDAG.cpp      |    9 ++++++++-
 SelectionDAGISel.cpp |   14 ++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.15 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.16
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.15	Fri Aug 26 12:14:58 2005
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp	Fri Aug 26 15:54:47 2005
@@ -20,6 +20,7 @@
 #include "llvm/CodeGen/SSARegMap.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/Target/TargetLowering.h"
 #include "llvm/Support/CommandLine.h"
 using namespace llvm;
 
@@ -166,7 +167,13 @@
     }
 
     // Now that we have emitted all operands, emit this instruction itself.
-    BB->insert(BB->end(), MI);
+    if ((II.Flags & M_USES_CUSTOM_DAG_SCHED_INSERTION) == 0) {
+      BB->insert(BB->end(), MI);
+    } else {
+      // Insert this instruction into the end of the basic block, potentially
+      // taking some custom action.
+      BB = DAG.getTargetLoweringInfo().InsertAtEndOfBasicBlock(MI, BB);
+    }
   } else {
     switch (Op.getOpcode()) {
     default:


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.74 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.75
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.74	Tue Aug 23 19:34:29 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Fri Aug 26 15:54:47 2005
@@ -855,6 +855,20 @@
   DAG.setRoot(Result.second);
 }
 
+// InsertAtEndOfBasicBlock - This method should be implemented by targets that
+// mark instructions with the 'usesCustomDAGSchedInserter' flag.  These
+// instructions are special in various ways, which require special support to
+// insert.  The specified MachineInstr is created but not inserted into any
+// basic blocks, and the scheduler passes ownership of it to this method.
+MachineBasicBlock *TargetLowering::InsertAtEndOfBasicBlock(MachineInstr *MI,
+                                                       MachineBasicBlock *MBB) {
+  std::cerr << "If a target marks an instruction with "
+               "'usesCustomDAGSchedInserter', it must implement "
+               "TargetLowering::InsertAtEndOfBasicBlock!\n";
+  abort();
+  return 0;  
+}
+
 SDOperand TargetLowering::LowerVAStart(SDOperand Chain,
                                        SDOperand VAListP, Value *VAListV,
                                        SelectionDAG &DAG) {






More information about the llvm-commits mailing list