LLVM: include/llvm/MC/MCInstrItineraries.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_MC_MCINSTRITINERARIES_H

16#define LLVM_MC_MCINSTRITINERARIES_H

17

19#include

20#include

21

22namespace llvm {

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

93

94

95

96

97

98

106

107

108

109

111public:

115 const unsigned *OperandCycles = nullptr;

116 const unsigned *Forwardings = nullptr;

118 nullptr;

119

122 const unsigned *OS, const unsigned *F)

125

126

128

129

131 return ((Itineraries[ItinClassIndx].FirstStage == UINT16_MAX) &&

132 (Itineraries[ItinClassIndx].LastStage == UINT16_MAX));

133 }

134

135

137 unsigned StageIdx = Itineraries[ItinClassIndx].FirstStage;

138 return Stages + StageIdx;

139 }

140

141

143 unsigned StageIdx = Itineraries[ItinClassIndx].LastStage;

144 return Stages + StageIdx;

145 }

146

147

148

149

151

152

154 return 1;

155

156

157 unsigned Latency = 0, StartCycle = 0;

159 *E = endStage(ItinClassIndx); IS != E; ++IS) {

160 Latency = std::max(Latency, StartCycle + IS->getCycles());

161 StartCycle += IS->getNextCycles();

162 }

164 }

165

166

167

169 unsigned OperandIdx) const {

171 return std::nullopt;

172

173 unsigned FirstIdx = Itineraries[ItinClassIndx].FirstOperandCycle;

174 unsigned LastIdx = Itineraries[ItinClassIndx].LastOperandCycle;

175 if ((FirstIdx + OperandIdx) >= LastIdx)

176 return std::nullopt;

177

179 }

180

181

182

183

184

185

187 unsigned UseClass, unsigned UseIdx) const {

188 unsigned FirstDefIdx = Itineraries[DefClass].FirstOperandCycle;

189 unsigned LastDefIdx = Itineraries[DefClass].LastOperandCycle;

190 if ((FirstDefIdx + DefIdx) >= LastDefIdx)

191 return false;

192 if (Forwardings[FirstDefIdx + DefIdx] == 0)

193 return false;

194

195 unsigned FirstUseIdx = Itineraries[UseClass].FirstOperandCycle;

196 unsigned LastUseIdx = Itineraries[UseClass].LastOperandCycle;

197 if ((FirstUseIdx + UseIdx) >= LastUseIdx)

198 return false;

199

200 return Forwardings[FirstDefIdx + DefIdx] ==

202 }

203

204

205

206

207

208 std::optional getOperandLatency(unsigned DefClass, unsigned DefIdx,

209 unsigned UseClass,

210 unsigned UseIdx) const {

212 return std::nullopt;

213

214 std::optional DefCycle = getOperandCycle(DefClass, DefIdx);

215 std::optional UseCycle = getOperandCycle(UseClass, UseIdx);

216 if (!DefCycle || !UseCycle)

217 return std::nullopt;

218

219 if (UseCycle > *DefCycle + 1)

220 return std::nullopt;

221

222 UseCycle = *DefCycle - *UseCycle + 1;

223 if (UseCycle > 0u &&

225

226 UseCycle = *UseCycle - 1;

227 return UseCycle;

228 }

229

230

231

234 return 1;

235 return Itineraries[ItinClassIndx].NumMicroOps;

236 }

237};

238

239}

240

241#endif

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

int getNumMicroOps(unsigned ItinClassIndx) const

Return the number of micro-ops that the given class decodes to.

Definition MCInstrItineraries.h:232

std::optional< unsigned > getOperandCycle(unsigned ItinClassIndx, unsigned OperandIdx) const

Return the cycle for the given class and operand.

Definition MCInstrItineraries.h:168

const InstrStage * Stages

Array of stages selected.

Definition MCInstrItineraries.h:114

unsigned getStageLatency(unsigned ItinClassIndx) const

Return the total stage latency of the given class.

Definition MCInstrItineraries.h:150

bool isEndMarker(unsigned ItinClassIndx) const

Returns true if the index is for the end marker itinerary.

Definition MCInstrItineraries.h:130

std::optional< unsigned > getOperandLatency(unsigned DefClass, unsigned DefIdx, unsigned UseClass, unsigned UseIdx) const

Compute and return the use operand latency of a given itinerary class and operand index if the value ...

Definition MCInstrItineraries.h:208

const InstrStage * beginStage(unsigned ItinClassIndx) const

Return the first stage of the itinerary.

Definition MCInstrItineraries.h:136

MCSchedModel SchedModel

Basic machine properties.

Definition MCInstrItineraries.h:112

bool hasPipelineForwarding(unsigned DefClass, unsigned DefIdx, unsigned UseClass, unsigned UseIdx) const

Return true if there is a pipeline forwarding between instructions of itinerary classes DefClass and ...

Definition MCInstrItineraries.h:186

InstrItineraryData(const MCSchedModel &SM, const InstrStage *S, const unsigned *OS, const unsigned *F)

Definition MCInstrItineraries.h:121

const unsigned * Forwardings

Array of pipeline forwarding paths.

Definition MCInstrItineraries.h:116

InstrItineraryData()=default

const InstrStage * endStage(unsigned ItinClassIndx) const

Return the last+1 stage of the itinerary.

Definition MCInstrItineraries.h:142

const unsigned * OperandCycles

Array of operand cycles selected.

Definition MCInstrItineraries.h:115

const InstrItinerary * Itineraries

Array of itineraries selected.

Definition MCInstrItineraries.h:117

bool isEmpty() const

Returns true if there are no itineraries.

Definition MCInstrItineraries.h:127

This is an optimization pass for GlobalISel generic memory operations.

An itinerary represents the scheduling information for an instruction.

Definition MCInstrItineraries.h:99

uint16_t LastOperandCycle

Index of last + 1 operand rd/wr.

Definition MCInstrItineraries.h:104

uint16_t FirstOperandCycle

Index of first operand rd/wr.

Definition MCInstrItineraries.h:103

uint16_t FirstStage

Index of first stage in itinerary.

Definition MCInstrItineraries.h:101

int16_t NumMicroOps

Definition MCInstrItineraries.h:100

uint16_t LastStage

Index of last + 1 stage in itinerary.

Definition MCInstrItineraries.h:102

These values represent a non-pipelined step in the execution of an instruction.

Definition MCInstrItineraries.h:59

ReservationKinds

Definition MCInstrItineraries.h:60

@ Required

Definition MCInstrItineraries.h:61

@ Reserved

Definition MCInstrItineraries.h:62

uint64_t FuncUnits

Bitmask representing a set of functional units.

Definition MCInstrItineraries.h:66

unsigned getNextCycles() const

Returns the number of cycles from the start of this stage to the start of the next stage in the itine...

Definition MCInstrItineraries.h:89

FuncUnits getUnits() const

Returns the choice of FUs.

Definition MCInstrItineraries.h:79

ReservationKinds getReservationKind() const

Definition MCInstrItineraries.h:83

FuncUnits Units_

Choice of functional units.

Definition MCInstrItineraries.h:69

unsigned Cycles_

Length of stage in machine cycles.

Definition MCInstrItineraries.h:68

unsigned getCycles() const

Returns the number of cycles the stage is occupied.

Definition MCInstrItineraries.h:74

int NextCycles_

Number of machine cycles to next stage.

Definition MCInstrItineraries.h:70

ReservationKinds Kind_

Kind of the FU reservation.

Definition MCInstrItineraries.h:71

Machine model for scheduling, bundling, and heuristics.

static LLVM_ABI const MCSchedModel Default

Returns the default initialized model.