LLVM: include/llvm/CodeGen/MachineTraceMetrics.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

43

44

45

46#ifndef LLVM_CODEGEN_MACHINETRACEMETRICS_H

47#define LLVM_CODEGEN_MACHINETRACEMETRICS_H

48

57

58namespace llvm {

59

70

71

72

73

74

79 unsigned Op = 0;

80

82

84};

85

87

88

98

106

107public:

111

113

114

116

120

122

124

127

128

129

131

132

134

135

137

139

140

142

143

145 };

146

147

149

150

151

152

153

154

156

157

158

160

162

163

164

166

169 };

170

171

172

173

175

176

178

179

180

182

183

185

186

188

189

190

192

193

194

196

198

199

200

202

203

204

206

207

209

210

212

213

214

215

216

217

218

220

222 return false;

223

225 return false;

226

227

228

229

230

232 }

233

234

235

236

237

238

240

241

243

244

245

246

248

249

250

251

252

254

257 };

258

259

260

262

263

264

266

267

268

270 };

271

272

273

274

278

279 unsigned getBlockNum() const { return &TBI - &TE.BlockInfo[0]; }

280

281 public:

283

286

287

289 return TBI.InstrDepth + TBI.InstrHeight;

290 }

291

292

293

294

295

296

298

299

300

301

302

303

304

305

306

311

312

313

315

316

317

318

320 return TE.Cycles.lookup(&MI);

321 }

322

323

324

325

327

328

329

331

332

333

334

337 };

338

339

340

341

344

349

353 unsigned computeCrossBlockCriticalPath(const TraceBlockInfo&);

358

359 protected:

361

363

371

372 public:

374

375 virtual const char *getName() const = 0;

380

381

382

384

385

390

391

395 };

396

397

398

399

401

402

403

404

405

406

407

408

409

411

412

414 MachineFunctionAnalysisManager::Invalidator &);

415

417

418private:

419

421

422

423

424

425

426

428

429

430 std::unique_ptr

432

433

434

435 unsigned getCycles(unsigned Scaled) {

437 return (Scaled + Factor - 1) / Factor;

438 }

439};

440

446

452

462

463

470

484

485}

486

487#endif

MachineInstrBuilder & UseMI

MachineInstrBuilder MachineInstrBuilder & DefMI

This file defines the DenseMap class.

LiveInRegUnits addLiveIns(MBB)

This file defines the SmallVector class.

This file defines the SparseSet class derived from the version described in Briggs,...

Represent the analysis usage information of a pass.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

MachineInstrBundleIterator< MachineInstr > iterator

MachineFunctionPass(char &ID)

Representation of each machine instruction.

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

Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)

MachineTraceMetrics Result

Definition MachineTraceMetrics.h:459

MachineTraceMetrics MTM

Definition MachineTraceMetrics.h:474

void getAnalysisUsage(AnalysisUsage &) const override

getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.

bool runOnMachineFunction(MachineFunction &) override

runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...

void verifyAnalysis() const override

verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...

Definition MachineTraceMetrics.h:481

void releaseMemory() override

releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...

Definition MachineTraceMetrics.h:480

static char ID

Definition MachineTraceMetrics.h:473

MachineTraceMetrics & getMTM()

Definition MachineTraceMetrics.h:482

MachineTraceMetricsWrapperPass()

A trace ensemble is a collection of traces selected using the same strategy, for example 'minimum res...

Definition MachineTraceMetrics.h:342

void invalidate(const MachineBasicBlock *MBB)

Invalidate traces through BadMBB.

ArrayRef< unsigned > getProcResourceHeights(unsigned MBBNum) const

Get an array of processor resource heights for MBB.

virtual const MachineBasicBlock * pickTracePred(const MachineBasicBlock *)=0

void dump() const

Definition MachineTraceMetrics.h:377

void updateDepth(TraceBlockInfo &TBI, const MachineInstr &, LiveRegUnitSet &RegUnits)

Updates the depth of an machine instruction, given RegUnits.

const MachineLoop * getLoopFor(const MachineBasicBlock *) const

void updateDepths(MachineBasicBlock::iterator Start, MachineBasicBlock::iterator End, LiveRegUnitSet &RegUnits)

Updates the depth of the instructions from Start to End.

const TraceBlockInfo * getHeightResources(const MachineBasicBlock *) const

const TraceBlockInfo * getDepthResources(const MachineBasicBlock *) const

virtual const char * getName() const =0

ArrayRef< unsigned > getProcResourceDepths(unsigned MBBNum) const

Get an array of processor resource depths for MBB.

Ensemble(MachineTraceMetrics *)

friend class Trace

Definition MachineTraceMetrics.h:343

MachineTraceMetrics & MTM

Definition MachineTraceMetrics.h:360

virtual const MachineBasicBlock * pickTraceSucc(const MachineBasicBlock *)=0

void print(raw_ostream &) const

Trace getTrace(const MachineBasicBlock *MBB)

Get the trace that passes through MBB.

A trace represents a plausible sequence of executed basic blocks that passes through the current basi...

Definition MachineTraceMetrics.h:275

unsigned getInstrCount() const

Compute the total number of instructions in the trace.

Definition MachineTraceMetrics.h:288

unsigned getResourceLength(ArrayRef< const MachineBasicBlock * > Extrablocks={}, ArrayRef< const MCSchedClassDesc * > ExtraInstrs={}, ArrayRef< const MCSchedClassDesc * > RemoveInstrs={}) const

Return the resource length of the trace.

InstrCycles getInstrCycles(const MachineInstr &MI) const

Return the depth and height of MI.

Definition MachineTraceMetrics.h:319

unsigned getInstrSlack(const MachineInstr &MI) const

Return the slack of MI.

bool isDepInTrace(const MachineInstr &DefMI, const MachineInstr &UseMI) const

A dependence is useful if the basic block of the defining instruction is part of the trace of the use...

Trace(Ensemble &te, TraceBlockInfo &tbi)

Definition MachineTraceMetrics.h:282

void dump() const

Definition MachineTraceMetrics.h:285

unsigned getCriticalPath() const

Return the length of the (data dependency) critical path through the trace.

Definition MachineTraceMetrics.h:314

unsigned getPHIDepth(const MachineInstr &PHI) const

Return the Depth of a PHI instruction in a trace center block successor.

void print(raw_ostream &) const

unsigned getResourceDepth(bool Bottom) const

Return the resource depth of the top/bottom of the trace center block.

friend class MachineTraceMetricsWrapperPass

Definition MachineTraceMetrics.h:108

friend class Ensemble

Definition MachineTraceMetrics.h:109

MachineTraceMetrics(MachineTraceMetrics &&)=default

MachineTraceMetrics()=default

Ensemble * getEnsemble(MachineTraceStrategy)

Get the trace ensemble representing the given trace selection strategy.

void verifyAnalysis() const

void invalidate(const MachineBasicBlock *MBB)

Invalidate cached information about MBB.

const FixedBlockInfo * getResources(const MachineBasicBlock *)

Get the fixed resource information about MBB. Compute it on demand.

ArrayRef< unsigned > getProcReleaseAtCycles(unsigned MBBNum) const

Get the scaled number of cycles used per processor resource in MBB.

void init(MachineFunction &Func, const MachineLoopInfo &LI)

MachineTraceMetrics(MachineFunction &MF, const MachineLoopInfo &LI)

Definition MachineTraceMetrics.h:117

A set of analyses that are preserved following a run of a transformation pass.

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

SparseSet - Fast set implementation for objects that can be identified by small unsigned keys.

TargetInstrInfo - Interface to description of machine instruction set.

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

Provide an instruction scheduling machine model to CodeGen passes.

unsigned getLatencyFactor() const

Multiply cycle count by this factor to normalize it relative to other resources.

Wrapper class representing a virtual register or register unit.

This class implements an extremely fast bulk output stream that can only output to a stream.

This is an optimization pass for GlobalISel generic memory operations.

MachineTraceStrategy

Strategies for selecting traces.

Definition MachineTraceMetrics.h:89

@ TS_MinInstrCount

Select the trace through a block that has the fewest instructions.

Definition MachineTraceMetrics.h:91

@ TS_NumStrategies

Definition MachineTraceMetrics.h:96

@ TS_Local

Select the trace that contains only the current basic block.

Definition MachineTraceMetrics.h:95

AnalysisManager< MachineFunction > MachineFunctionAnalysisManager

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

SparseSet< LiveRegUnit, MCRegUnit, MCRegUnitToIndex > LiveRegUnitSet

Definition MachineTraceMetrics.h:86

raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)

ArrayRef(const T &OneElt) -> ArrayRef< T >

A CRTP mix-in that provides informational APIs needed for analysis passes.

A special type used by analysis passes to provide an address that identifies that particular analysis...

unsigned getSparseSetIndex() const

Definition MachineTraceMetrics.h:81

const MachineInstr * MI

Definition MachineTraceMetrics.h:78

unsigned Cycle

Definition MachineTraceMetrics.h:77

LiveRegUnit(MCRegUnit RU)

Definition MachineTraceMetrics.h:83

MCRegUnit RegUnit

Definition MachineTraceMetrics.h:76

unsigned Op

Definition MachineTraceMetrics.h:79

Summarize the scheduling resources required for an instruction of a particular scheduling class.

Verifier pass for MachineTraceMetrics.

Definition MachineTraceMetrics.h:465

static bool isRequired()

Definition MachineTraceMetrics.h:468

PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)

bool hasResources() const

Returns true when resource information for this block has been computed.

Definition MachineTraceMetrics.h:141

unsigned InstrCount

The number of non-trivial instructions in the block.

Definition MachineTraceMetrics.h:133

void invalidate()

Invalidate resource information.

Definition MachineTraceMetrics.h:144

bool HasCalls

True when the block contains calls.

Definition MachineTraceMetrics.h:136

InstrCycles represents the cycle height and depth of an instruction in a trace.

Definition MachineTraceMetrics.h:261

unsigned Height

Minimum number of cycles from this instruction is issued to the of the trace, as determined by data d...

Definition MachineTraceMetrics.h:269

unsigned Depth

Earliest issue cycle as determined by data dependencies and instruction latencies from the beginning ...

Definition MachineTraceMetrics.h:265

LiveInReg(VirtRegOrUnit VRegOrUnit, unsigned Height=0)

Definition MachineTraceMetrics.h:167

unsigned Height

For virtual registers: Minimum height of the defining instruction.

Definition MachineTraceMetrics.h:165

VirtRegOrUnit VRegOrUnit

The virtual register required, or a register unit.

Definition MachineTraceMetrics.h:161

Per-basic block information that relates to a specific trace through the block.

Definition MachineTraceMetrics.h:174

unsigned InstrDepth

Accumulated number of instructions in the trace above this block.

Definition MachineTraceMetrics.h:191

void invalidateDepth()

Invalidate depth resources when some block above this one has changed.

Definition MachineTraceMetrics.h:208

const MachineBasicBlock * Pred

Trace predecessor, or NULL for the first block in the trace.

Definition MachineTraceMetrics.h:177

unsigned InstrHeight

Accumulated number of instructions in the trace below this block.

Definition MachineTraceMetrics.h:195

SmallVector< LiveInReg, 4 > LiveIns

Live-in registers.

Definition MachineTraceMetrics.h:253

const MachineBasicBlock * Succ

Trace successor, or NULL for the last block in the trace.

Definition MachineTraceMetrics.h:181

void dump() const

Definition MachineTraceMetrics.h:256

bool hasValidDepth() const

Returns true if the depth resources have been computed from the trace above this block.

Definition MachineTraceMetrics.h:201

bool isUsefulDominator(const TraceBlockInfo &TBI) const

Assuming that this is a dominator of TBI, determine if it contains useful instruction depths.

Definition MachineTraceMetrics.h:219

void invalidateHeight()

Invalidate height resources when a block below this one has changed.

Definition MachineTraceMetrics.h:211

unsigned CriticalPath

Critical path length.

Definition MachineTraceMetrics.h:247

void print(raw_ostream &) const

unsigned Head

The block number of the head of the trace. (When hasValidDepth()).

Definition MachineTraceMetrics.h:184

bool HasValidInstrDepths

Instruction depths have been computed. This implies hasValidDepth().

Definition MachineTraceMetrics.h:239

bool hasValidHeight() const

Returns true if the height resources have been computed from the trace below this block.

Definition MachineTraceMetrics.h:205

unsigned Tail

The block number of the tail of the trace. (When hasValidHeight()).

Definition MachineTraceMetrics.h:187

bool HasValidInstrHeights

Instruction heights have been computed. This implies hasValidHeight().

Definition MachineTraceMetrics.h:242

A CRTP mix-in to automatically provide informational APIs needed for passes.