LLVM: include/llvm/CodeGen/WindowScheduler.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42#ifndef LLVM_CODEGEN_WINDOWSCHEDULER_H

43#define LLVM_CODEGEN_WINDOWSCHEDULER_H

44

50

51namespace llvm {

52

58

59

60

62protected:

71

72

73

74

75

76

77

78 std::unique_ptr TripleDAG;

79

81

83

84

86

88

89

91

92

94

95

97

98

99

102

103

105

106public:

109

110 bool run();

111

112protected:

113

114

117

119

121

123

125

127

129

131

132

133

135 unsigned SearchRatio);

136

138

140

142

144

146

148

150

151

152 virtual void expand();

153

155

157

159 unsigned Num);

160

162

164

165

167

169};

170}

171#endif

uint64_t IntrinsicInst * II

Representation of each machine instruction.

MachineRegisterInfo - Keep track of information for virtual and physical registers,...

Wrapper class representing virtual and physical registers.

A ScheduleDAG for scheduling lists of MachineInstr.

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

TargetInstrInfo - Interface to description of machine instruction set.

TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...

TargetSubtargetInfo - Generic base class for all target subtargets.

MachineInstr * getOriMI(MachineInstr *NewMI)

Get the original MI from which the new MI is cloned.

virtual ScheduleDAGInstrs * createMachineScheduler(bool OnlyBuildGraph=false)

Two types of ScheduleDAGs are needed, one for creating dependency graphs only, and the other for list...

virtual ~WindowScheduler()=default

unsigned SchedPhiNum

SchedPhiNum records the number of phi in the original MBB, and the scheduling starts with MI after ph...

Definition WindowScheduler.h:93

virtual void preProcess()

Add some related processing before running window scheduling.

MachineSchedContext * Context

Definition WindowScheduler.h:63

virtual void restoreTripleMBB()

Restore the order of MIs in TripleMBB after each list scheduling.

virtual void postProcess()

Add some related processing after running window scheduling.

DenseMap< MachineInstr *, int > OriToCycle

OriToCycle keeps the mappings between the original MI and its issue cycle.

Definition WindowScheduler.h:87

virtual int calculateMaxCycle(ScheduleDAGInstrs &DAG, unsigned Offset)

Calculate MIs execution cycle after list scheduling.

MachineRegisterInfo * MRI

Definition WindowScheduler.h:70

unsigned BestOffset

Definition WindowScheduler.h:101

MachineBasicBlock * MBB

Definition WindowScheduler.h:65

unsigned BestII

BestII and BestOffset record the characteristics of the best scheduling result and are used together ...

Definition WindowScheduler.h:100

void backupMBB()

Back up the MIs in the original MBB and remove them from MBB.

MachineLoop & Loop

Definition WindowScheduler.h:66

DenseMap< MachineInstr *, MachineInstr * > TriToOri

TriToOri keeps the mappings between the MI clones in TripleMBB and their original MI.

Definition WindowScheduler.h:85

int getEstimatedII(ScheduleDAGInstrs &DAG)

Estimate a II value at which all MIs will be scheduled successfully.

virtual void expand()

Using the scheduling infrastructure to expand the results of window scheduling.

DenseMap< MachineInstr *, int > getIssueOrder(unsigned Offset, unsigned II)

Get the final issue order of all scheduled MIs including phis.

Register getAntiRegister(MachineInstr *Phi)

Gets the register in phi which is generated from the current MBB.

unsigned getOriStage(MachineInstr *OriMI, unsigned Offset)

Get the scheduling stage, where the stage of the new MI is identical to the original MI.

const TargetRegisterInfo * TRI

Definition WindowScheduler.h:69

virtual void updateLiveIntervals()

Update the live intervals for all registers used within MBB.

const TargetSubtargetInfo * Subtarget

Definition WindowScheduler.h:67

std::unique_ptr< ScheduleDAGInstrs > TripleDAG

To innovatively identify the dependencies between MIs across two trips, we construct a DAG for a new ...

Definition WindowScheduler.h:78

unsigned BaseII

BaseII is the II obtained when the window offset is SchedPhiNum.

Definition WindowScheduler.h:104

virtual void schedulePhi(int Offset, unsigned &II)

Phis are scheduled separately after each list scheduling.

MachineFunction * MF

Definition WindowScheduler.h:64

virtual unsigned analyseII(ScheduleDAGInstrs &DAG, unsigned Offset)

Analyzes the II value after each list scheduling.

int getOriCycle(MachineInstr *NewMI)

Get the issue cycle of the new MI based on the cycle of the original MI.

unsigned SchedInstrNum

SchedInstrNum records the MIs involved in scheduling in the original MBB, excluding debug instruction...

Definition WindowScheduler.h:96

const TargetInstrInfo * TII

Definition WindowScheduler.h:68

virtual void generateTripleMBB()

Make three copies of the original MBB to generate a new TripleMBB.

iterator_range< MachineBasicBlock::iterator > getScheduleRange(unsigned Offset, unsigned Num)

Gets the iterator range of MIs in the scheduling window.

virtual bool isScheduleValid()

Check whether the final result of window scheduling is valid.

Definition WindowScheduler.h:149

virtual int calculateStallCycle(unsigned Offset, int MaxCycle)

Calculate the stall cycle between two trips after list scheduling.

virtual void updateScheduleResult(unsigned Offset, unsigned II)

Update the scheduling result after each list scheduling.

SmallVector< MachineInstr * > OriMIs

OriMIs keeps the MIs removed from the original MBB.

Definition WindowScheduler.h:80

virtual bool initialize()

Initializes the algorithm and determines if it can be executed.

SmallVector< std::tuple< MachineInstr *, int, int, int >, 256 > SchedResult

SchedResult keeps the result of each list scheduling, and the format of the tuple is <MI pointer,...

Definition WindowScheduler.h:90

virtual SmallVector< unsigned > getSearchIndexes(unsigned SearchNum, unsigned SearchRatio)

Give the folding position in the window algorithm, where different heuristics can be used.

void restoreMBB()

Erase the MIs in current MBB and restore the original MIs.

WindowScheduler(MachineSchedContext *C, MachineLoop &ML)

SmallVector< MachineInstr * > TriMIs

TriMIs keeps the MIs of TripleMBB, which is used to restore TripleMBB.

Definition WindowScheduler.h:82

A range adaptor for a pair of iterators.

@ C

The default llvm calling convention, compatible with C.

This is an optimization pass for GlobalISel generic memory operations.

WindowSchedulingFlag

Definition WindowScheduler.h:53

@ WS_Force

Use window algorithm after SMS algorithm fails.

Definition WindowScheduler.h:56

@ WS_Off

Definition WindowScheduler.h:54

@ WS_On

Turn off window algorithm.

Definition WindowScheduler.h:55

MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...