LLVM: include/llvm/IR/LegacyPassManagers.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_IR_LEGACYPASSMANAGERS_H

14#define LLVM_IR_LEGACYPASSMANAGERS_H

15

22#include

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

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

88

89namespace llvm {

90template class ArrayRef;

95

96

107

108

109

114

115public:

117 : P(p), V(nullptr), M(nullptr) {}

119 : P(p), V(&v), M(nullptr) {}

121 : P(p), V(nullptr), M(&m) {}

122

123

125};

126

127

128

129

130

131

132

133

134

135

136

138public:

139 typedef std::vector<PMDataManager *>::const_reverse_iterator iterator;

142

146 bool empty() const { return S.empty(); }

147

149

150private:

151 std::vector<PMDataManager *> S;

152};

153

154

155

156

157

158

160protected:

162

166

167 void initializeAllAnalysisInfo();

168

169private:

171 virtual PassManagerType getTopLevelPassManagerType() = 0;

172

173public:

174

175

176

177 void schedulePass(Pass *P);

178

179

181

182

184

185

186

187

189

190

192

193

195

197

198

200

202 return ImmutablePasses;

203 }

204

208

209

210

212 IndirectPassManagers.push_back(Manager);

213 }

214

215

216 void dumpPasses() const;

217 void dumpArguments() const;

218

219

221

222protected:

223

225

226private:

227

228

230

231

232

233

235

236

237

239

240

242

243

245

246

247

248

251 AUFoldingSetNode(const AnalysisUsage &AU) : AU(AU) {}

254 }

256

257

260 ID.AddInteger(Vec.size());

262 ID.AddPointer(AID);

263 };

268 }

269 };

270

271

272

273

275

276

277

279

280

281

283

284

285

286

287

289};

290

291

292

293

294

295

297public:

299

301

303

304

306

307

309

310

312

313

316

317

320

321

322

323 void add(Pass *P, bool ProcessAnalysis = true);

324

325

326

327

329

332

333

335 AvailableAnalysis.clear();

337 }

338

339

340

341 bool preserveHigherLevelAnalysis(Pass *P);

342

343

344

345

346 void collectRequiredAndUsedAnalyses(

349

350

351

352

353

354 void initializeAnalysisImpl(Pass *P);

355

356

357

359

360

363

364 unsigned getDepth() const { return Depth; }

365 void setDepth(unsigned newDepth) { Depth = newDepth; }

366

367

368 void dumpLastUses(Pass *P, unsigned Offset) const;

369 void dumpPassArguments() const;

372 void dumpRequiredSet(const Pass *P) const;

373 void dumpPreservedSet(const Pass *P) const;

374 void dumpUsedSet(const Pass *P) const;

375

379

381 assert ( 0 && "Invalid use of getPassManagerType");

383 }

384

386 return &AvailableAnalysis;

387 }

388

389

391 unsigned Index = 0;

394 }

395

396

397

398

399 unsigned initSizeRemarkInfo(

401 StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount);

402

403

404

405

406

407

408

409

410

411

412 void emitInstrCountChangedRemark(

413 Pass *P, Module &M, int64_t Delta, unsigned CountBefore,

414 StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount,

416

417protected:

418

420

421

423

424

425

426

428

429

430

432

433private:

436

437

438

439

440

442

443

444

446

447 unsigned Depth = 0;

448};

449

450

451

452

453

454

455

456

458public:

461

462

463

465 bool runOnModule(Module &M) override;

466

467

469

470

471

472

474

475

476

477 bool doInitialization(Module &M) override;

478

479

480

481

483

484

485

486 bool doFinalization(Module &M) override;

487

490

491

493 Info.setPreservesAll();

494 }

495

496

497 void dumpPassStructure(unsigned Offset) override;

498

500

506

510};

511}

512

513#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)

static void cleanup(BlockFrequencyInfoImplBase &BFI)

Clear all memory not needed downstream.

Analysis containing CSE Info

This file defines the DenseMap class.

static bool runOnFunction(Function &F, bool PostInlining)

This file defines a hash set that can be used to remove duplication of nodes in a graph.

Loop::LoopBounds::Direction Direction

This file defines the SmallPtrSet class.

This file defines the SmallVector class.

Represent the analysis usage information of a pass.

const VectorType & getRequiredSet() const

const VectorType & getRequiredTransitiveSet() const

SmallVectorImpl< AnalysisID > VectorType

const VectorType & getUsedSet() const

bool getPreservesAll() const

Determine whether a pass said it does not transform its input at all.

const VectorType & getPreservedSet() const

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

static char ID

Definition LegacyPassManagers.h:459

FunctionPass * getContainedPass(unsigned N)

Definition LegacyPassManagers.h:501

FPPassManager()

Definition LegacyPassManagers.h:460

StringRef getPassName() const override

getPassName - Return a nice clean name for a pass.

Definition LegacyPassManagers.h:499

Pass * getAsPass() override

Definition LegacyPassManagers.h:489

PassManagerType getPassManagerType() const override

Definition LegacyPassManagers.h:507

void getAnalysisUsage(AnalysisUsage &Info) const override

Pass Manager itself does not invalidate any analysis info.

Definition LegacyPassManagers.h:492

PMDataManager * getAsPMDataManager() override

Definition LegacyPassManagers.h:488

FoldingSetNodeID - This class is used to gather all the unique data bits of a node.

FoldingSet - This template class is used to instantiate a specialized implementation of the folding s...

FunctionPass class - This class is used to implement most global optimizations.

ImmutablePass class - This class is used to provide information that does not need to be run.

A Module instance is used to store all the information related to an LLVM module.

PMDataManager provides the common place to manage the analysis data used by pass managers.

Definition LegacyPassManagers.h:296

PMDataManager()

Definition LegacyPassManagers.h:298

void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)

Remove dead passes used by P.

virtual Pass * getAsPass()=0

virtual std::tuple< Pass *, bool > getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F)

void setDepth(unsigned newDepth)

Definition LegacyPassManagers.h:365

void recordAvailableAnalysis(Pass *P)

Augment AvailableAnalysis by adding analysis made available by pass P.

bool isPassDebuggingExecutionsOrMore() const

isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified.

unsigned getDepth() const

Definition LegacyPassManagers.h:364

SmallVector< Pass *, 16 > PassVector

Definition LegacyPassManagers.h:422

DenseMap< AnalysisID, Pass * > * InheritedAnalysis[PMT_Last]

Definition LegacyPassManagers.h:427

virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass)

Add RequiredPass into list of lower level passes required by pass P.

PMTopLevelManager * getTopLevelManager()

Definition LegacyPassManagers.h:361

void setTopLevelManager(PMTopLevelManager *T)

Definition LegacyPassManagers.h:362

void verifyPreservedAnalysis(Pass *P)

verifyPreservedAnalysis – Verify analysis presreved by pass P.

void initializeAnalysisInfo()

Initialize available analysis information.

Definition LegacyPassManagers.h:334

void freePass(Pass *P, StringRef Msg, enum PassDebuggingString)

Remove P.

unsigned getNumContainedPasses() const

Definition LegacyPassManagers.h:376

virtual PassManagerType getPassManagerType() const

Definition LegacyPassManagers.h:380

PMTopLevelManager * TPM

Definition LegacyPassManagers.h:419

void add(Pass *P, bool ProcessAnalysis=true)

Add pass P into the PassVector.

DenseMap< AnalysisID, Pass * > * getAvailableAnalysis()

Definition LegacyPassManagers.h:385

void populateInheritedAnalysis(PMStack &PMS)

Definition LegacyPassManagers.h:390

void removeNotPreservedAnalysis(Pass *P)

Remove Analysis that is not preserved by the pass.

PMStack - This class implements a stack data structure of PMDataManager pointers.

Definition LegacyPassManagers.h:137

std::vector< PMDataManager * >::const_reverse_iterator iterator

Definition LegacyPassManagers.h:139

iterator end() const

Definition LegacyPassManagers.h:141

PMDataManager * top() const

Definition LegacyPassManagers.h:144

LLVM_ABI void dump() const

bool empty() const

Definition LegacyPassManagers.h:146

LLVM_ABI void push(PMDataManager *PM)

iterator begin() const

Definition LegacyPassManagers.h:140

PMTopLevelManager manages LastUser info and collects common APIs used by top level pass managers.

Definition LegacyPassManagers.h:159

void addIndirectPassManager(PMDataManager *Manager)

Definition LegacyPassManagers.h:211

SmallVector< PMDataManager *, 8 > PassManagers

Collection of pass managers.

Definition LegacyPassManagers.h:224

PMStack activeStack

Definition LegacyPassManagers.h:220

void addPassManager(PMDataManager *Manager)

Definition LegacyPassManagers.h:205

unsigned getNumContainedManagers() const

Definition LegacyPassManagers.h:163

SmallVectorImpl< ImmutablePass * > & getImmutablePasses()

Definition LegacyPassManagers.h:201

PMTopLevelManager(PMDataManager *PMDM)

Initialize top level manager. Create first pass manager.

PassInfo class - An instance of this class exists for every pass known by the system,...

PassManagerPrettyStackEntry(Pass *p, Value &v)

Definition LegacyPassManagers.h:118

PassManagerPrettyStackEntry(Pass *p)

Definition LegacyPassManagers.h:116

PassManagerPrettyStackEntry(Pass *p, Module &m)

Definition LegacyPassManagers.h:120

Pass interface - Implemented by all 'passes'.

virtual bool doInitialization(Module &)

doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...

virtual bool doFinalization(Module &)

doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

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

A BumpPtrAllocator that allows only elements of a specific type to be allocated.

StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...

StringRef - Represent a constant reference to a string, i.e.

LLVM Value Representation.

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

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

This is an optimization pass for GlobalISel generic memory operations.

void fill(R &&Range, T &&Value)

Provide wrappers to std::fill which take ranges instead of having to pass begin/end explicitly.

FoldingSetBase::Node FoldingSetNode

PassManagerType

Different types of internal pass managers.

@ PMT_FunctionPassManager

FPPassManager.

PassDebuggingString

Definition LegacyPassManagers.h:97

@ ON_LOOP_MSG

Definition LegacyPassManagers.h:104

@ EXECUTION_MSG

Definition LegacyPassManagers.h:98

@ ON_FUNCTION_MSG

Definition LegacyPassManagers.h:101

@ MODIFICATION_MSG

Definition LegacyPassManagers.h:99

@ ON_REGION_MSG

Definition LegacyPassManagers.h:103

@ ON_MODULE_MSG

Definition LegacyPassManagers.h:102

@ ON_CG_MSG

Definition LegacyPassManagers.h:105

@ FREEING_MSG

Definition LegacyPassManagers.h:100