Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 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 | struct SUnit; |
| 22 | class MachineConstantPool; |
| 23 | class MachineFunction; |
| 24 | class MachineModuleInfo; |
| 25 | class MachineRegisterInfo; |
| 26 | class MachineInstr; |
| 27 | class TargetRegisterInfo; |
| 28 | class ScheduleDAG; |
| 29 | class SelectionDAG; |
| 30 | class SelectionDAGISel; |
| 31 | class TargetInstrInfo; |
| 32 | class TargetInstrDesc; |
| 33 | class TargetLowering; |
| 34 | class TargetMachine; |
| 35 | class TargetRegisterClass; |
| 36 | |
| 37 | class ScheduleDAGInstrs : public ScheduleDAG { |
| 38 | public: |
| 39 | ScheduleDAGInstrs(MachineBasicBlock *bb, |
| 40 | const TargetMachine &tm); |
| 41 | |
| 42 | virtual ~ScheduleDAGInstrs() {} |
| 43 | |
| 44 | /// NewSUnit - Creates a new SUnit and return a ptr to it. |
| 45 | /// |
| 46 | SUnit *NewSUnit(MachineInstr *MI) { |
| 47 | SUnits.push_back(SUnit(MI, (unsigned)SUnits.size())); |
| 48 | SUnits.back().OrigNode = &SUnits.back(); |
| 49 | return &SUnits.back(); |
| 50 | } |
| 51 | |
| 52 | /// BuildSchedUnits - Build SUnits from the MachineBasicBlock that we are |
| 53 | /// input. |
| 54 | virtual void BuildSchedUnits(); |
| 55 | |
Dan Gohman | c8c2827 | 2008-11-21 00:12:10 +0000 | [diff] [blame^] | 56 | /// ComputeLatency - Compute node latency. |
| 57 | /// |
| 58 | virtual void ComputeLatency(SUnit *SU); |
| 59 | |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 60 | virtual MachineBasicBlock *EmitSchedule(); |
| 61 | |
| 62 | /// Schedule - Order nodes according to selected style, filling |
| 63 | /// in the Sequence member. |
| 64 | /// |
| 65 | virtual void Schedule() = 0; |
| 66 | |
| 67 | virtual void dumpNode(const SUnit *SU) const; |
| 68 | |
| 69 | virtual std::string getGraphNodeLabel(const SUnit *SU) const; |
| 70 | }; |
| 71 | } |
| 72 | |
| 73 | #endif |