Rewrite the SDep class, and simplify some of the related code.
[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 ScheduleDAGInstrs : public ScheduleDAG {
22   public:
23     ScheduleDAGInstrs(MachineBasicBlock *bb,
24                       const TargetMachine &tm);
25
26     virtual ~ScheduleDAGInstrs() {}
27
28     /// NewSUnit - Creates a new SUnit and return a ptr to it.
29     ///
30     SUnit *NewSUnit(MachineInstr *MI) {
31       SUnits.push_back(SUnit(MI, (unsigned)SUnits.size()));
32       SUnits.back().OrigNode = &SUnits.back();
33       return &SUnits.back();
34     }
35
36     /// BuildSchedUnits - Build SUnits from the MachineBasicBlock that we are
37     /// input.
38     virtual void BuildSchedUnits();
39
40     /// ComputeLatency - Compute node latency.
41     ///
42     virtual void ComputeLatency(SUnit *SU);
43
44     virtual MachineBasicBlock *EmitSchedule();
45
46     /// Schedule - Order nodes according to selected style, filling
47     /// in the Sequence member.
48     ///
49     virtual void Schedule() = 0;
50
51     virtual void dumpNode(const SUnit *SU) const;
52
53     virtual std::string getGraphNodeLabel(const SUnit *SU) const;
54   };
55 }
56
57 #endif