Add DebugLoc-aware constructors for SDNode derived
[oota-llvm.git] / include / llvm / CodeGen / SelectionDAGISel.h
index a1c6f5b79d7a491952f3f527c29ca70c07adf5af..1b680f72f07b641a0d8616af9666a6f324467ded 100644 (file)
@@ -29,9 +29,11 @@ namespace llvm {
   class MachineFunction;
   class MachineInstr;
   class MachineModuleInfo;
+  class DwarfWriter;
   class TargetLowering;
+  class TargetInstrInfo;
   class FunctionLoweringInfo;
-  class HazardRecognizer;
+  class ScheduleHazardRecognizer;
   class GCFunctionInfo;
   class ScheduleDAG;
  
@@ -39,19 +41,20 @@ namespace llvm {
 /// pattern-matching instruction selectors.
 class SelectionDAGISel : public FunctionPass {
 public:
+  const TargetMachine &TM;
   TargetLowering &TLI;
-  MachineRegisterInfo *RegInfo;
   FunctionLoweringInfo *FuncInfo;
+  MachineFunction *MF;
+  MachineRegisterInfo *RegInfo;
   SelectionDAG *CurDAG;
   SelectionDAGLowering *SDL;
   MachineBasicBlock *BB;
   AliasAnalysis *AA;
   GCFunctionInfo *GFI;
   bool Fast;
-  std::vector<SDNode*> TopOrder;
   static char ID;
 
-  explicit SelectionDAGISel(TargetLowering &tli, bool fast = false);
+  explicit SelectionDAGISel(TargetMachine &tm, bool fast = false);
   virtual ~SelectionDAGISel();
   
   TargetLowering &getTargetLowering() { return TLI; }
@@ -64,10 +67,9 @@ public:
 
   virtual void EmitFunctionEntryCode(Function &Fn, MachineFunction &MF) {}
   virtual void InstructionSelect() = 0;
-  virtual void InstructionSelectPostProcessing() {}
   
   void SelectRootInit() {
-    DAGSize = CurDAG->AssignTopologicalOrder(TopOrder);
+    DAGSize = CurDAG->AssignTopologicalOrder();
   }
 
   /// SelectInlineAsmMemoryOperand - Select the specified address as a target
@@ -81,15 +83,17 @@ public:
     return true;
   }
 
-  /// CanBeFoldedBy - Returns true if the specific operand node N of U can be
-  /// folded during instruction selection that starts at Root?
-  virtual bool CanBeFoldedBy(SDNode *N, SDNode *U, SDNode *Root) const {
+  /// IsLegalAndProfitableToFold - Returns true if the specific operand node N of
+  /// U can be folded during instruction selection that starts at Root and
+  /// folding N is profitable.
+  virtual
+  bool IsLegalAndProfitableToFold(SDNode *N, SDNode *U, SDNode *Root) const {
     return true;
   }
   
   /// CreateTargetHazardRecognizer - Return a newly allocated hazard recognizer
   /// to use for this target when scheduling the DAG.
-  virtual HazardRecognizer *CreateTargetHazardRecognizer();
+  virtual ScheduleHazardRecognizer *CreateTargetHazardRecognizer();
   
 protected:
   /// DAGSize - Size of DAG being instruction selected.
@@ -108,7 +112,9 @@ protected:
   
 private:
   void SelectAllBasicBlocks(Function &Fn, MachineFunction &MF,
-                            MachineModuleInfo *MMI);
+                            MachineModuleInfo *MMI,
+                            DwarfWriter *DW,
+                            const TargetInstrInfo &TII);
   void FinishBasicBlock();
 
   void SelectBasicBlock(BasicBlock *LLVMBB,