Fix some register-alias-related bugs in the post-RA scheduler liveness
[oota-llvm.git] / include / llvm / CodeGen / ScheduleDAGInstrs.h
1 //==- llvm/CodeGen/ScheduleDAGInstrs.h - MachineInstr Scheduling -*- C++ -*-==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the ScheduleDAGInstrs class, which implements
11 // scheduling for a MachineInstr-based dependency graph.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_SCHEDULEDAGINSTRS_H
16 #define LLVM_CODEGEN_SCHEDULEDAGINSTRS_H
17
18 #include "llvm/CodeGen/ScheduleDAG.h"
19
20 namespace llvm {
21   class MachineLoopInfo;
22   class MachineDominatorTree;
23
24   class ScheduleDAGInstrs : public ScheduleDAG {
25     const MachineLoopInfo &MLI;
26     const MachineDominatorTree &MDT;
27
28   public:
29     ScheduleDAGInstrs(MachineBasicBlock *bb,
30                       const TargetMachine &tm,
31                       const MachineLoopInfo &mli,
32                       const MachineDominatorTree &mdt);
33
34     virtual ~ScheduleDAGInstrs() {}
35
36     /// NewSUnit - Creates a new SUnit and return a ptr to it.
37     ///
38     SUnit *NewSUnit(MachineInstr *MI) {
39       SUnits.push_back(SUnit(MI, (unsigned)SUnits.size()));
40       SUnits.back().OrigNode = &SUnits.back();
41       return &SUnits.back();
42     }
43
44     /// BuildSchedUnits - Build SUnits from the MachineBasicBlock that we are
45     /// input.
46     virtual void BuildSchedUnits();
47
48     /// ComputeLatency - Compute node latency.
49     ///
50     virtual void ComputeLatency(SUnit *SU);
51
52     virtual MachineBasicBlock *EmitSchedule();
53
54     /// Schedule - Order nodes according to selected style, filling
55     /// in the Sequence member.
56     ///
57     virtual void Schedule() = 0;
58
59     virtual void dumpNode(const SUnit *SU) const;
60
61     virtual std::string getGraphNodeLabel(const SUnit *SU) const;
62   };
63 }
64
65 #endif