1 //===-- R600MachineScheduler.h - R600 Scheduler Interface -*- C++ -*-------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief R600 Machine Scheduler interface
13 //===----------------------------------------------------------------------===//
15 #ifndef R600MACHINESCHEDULER_H_
16 #define R600MACHINESCHEDULER_H_
18 #include "R600InstrInfo.h"
19 #include "llvm/ADT/PriorityQueue.h"
20 #include "llvm/CodeGen/MachineScheduler.h"
21 #include "llvm/Support/Debug.h"
27 class R600SchedStrategy : public MachineSchedStrategy {
29 const ScheduleDAGMI *DAG;
30 const R600InstrInfo *TII;
31 const R600RegisterInfo *TRI;
32 MachineRegisterInfo *MRI;
49 AluDiscarded, // LLVM Instructions that are going to be eliminated
53 std::vector<SUnit *> Available[IDLast], Pending[IDLast];
54 std::vector<SUnit *> AvailableAlus[AluLast];
55 std::vector<SUnit *> UnscheduledARDefs;
56 std::vector<SUnit *> UnscheduledARUses;
57 std::vector<SUnit *> PhysicalRegCopy;
61 InstKind NextInstKind;
63 int InstKindLimit[IDLast];
69 DAG(0), TII(0), TRI(0), MRI(0) {
72 virtual ~R600SchedStrategy() {
75 virtual void initialize(ScheduleDAGMI *dag);
76 virtual SUnit *pickNode(bool &IsTopNode);
77 virtual void schedNode(SUnit *SU, bool IsTopNode);
78 virtual void releaseTopNode(SUnit *SU);
79 virtual void releaseBottomNode(SUnit *SU);
82 std::vector<MachineInstr *> InstructionsGroupCandidate;
84 int getInstKind(SUnit *SU);
85 bool regBelongsToClass(unsigned Reg, const TargetRegisterClass *RC) const;
86 AluKind getAluKind(SUnit *SU) const;
88 bool isAvailablesAluEmpty() const;
89 SUnit *AttemptFillSlot (unsigned Slot);
90 void PrepareNextSlot();
91 SUnit *PopInst(std::vector<SUnit*> &Q);
93 void AssignSlot(MachineInstr *MI, unsigned Slot);
95 SUnit* pickOther(int QID);
96 void MoveUnits(std::vector<SUnit *> &QSrc, std::vector<SUnit *> &QDst);
101 #endif /* R600MACHINESCHEDULER_H_ */