LLVM: include/llvm/Pass.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#ifndef LLVM_PASS_H

29#define LLVM_PASS_H

30

31#ifdef EXPENSIVE_CHECKS

32#include

33#endif

34#include

35

36namespace llvm {

37

38class AnalysisResolver;

39class AnalysisUsage;

41class ImmutablePass;

43class PassInfo;

44class PMDataManager;

45class PMStack;

46class raw_ostream;

47class StringRef;

48

49

51

52

53

54

64

65

74

75

77

79

81

83

85

87};

88

89

90

91

92

93

96 const void *PassID;

98

99public:

100 explicit Pass(PassKind K, char &pid) : PassID(&pid), Kind(K) {}

104

106

107

108

109

111

112

114 return PassID;

115 }

116

117

118

120

121

122

124

125

126

127

128

129

130

132

133 void dump() const;

134

135

136

138 const std::string &Banner) const = 0;

139

140

141

144

145

147

148

150

151

154

155

156

157

158

160

161

162

163

164

165

166

167

168

169

170

172

173

174

175

176

180

181

182

184

185

187

188

189

191

192

193

195

196

197

199

200

201

202

203

204

205

206

207 template AnalysisType *

209

210

211

212

213

214

216

217

218

219

220 template

221 AnalysisType &getAnalysis() const;

222

223 template

224 AnalysisType &

226 bool *Changed = nullptr);

227

228 template

230

231 template

233 bool *Changed = nullptr);

234

235#ifdef EXPENSIVE_CHECKS

236

237

239

240

241

243#endif

244};

245

246

247

248

249

250

252public:

254

255

257

258

260 const std::string &Banner) const override;

261

262

263

265

267

268

270

271protected:

272

273

275};

276

277

278

279

280

282public:

284

285

287

288

289

290

291

292

294

296

297

299};

300

301

302

303

304

305

306

307

308

309

311public:

313

314

316 const std::string &Banner) const override;

317

318

319

321

323

324

326

327protected:

328

329

330

332};

333

334

335

336

338

339

340

341

342

344

345}

346

347

348

351

352#endif

Machine Check Debug Module

AnalysisResolver - Simple interface used by Pass objects to pull all analysis information out of pass...

Represent the analysis usage information of a pass.

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

PassManagerType getPotentialPassManagerType() const override

Return what kind of Pass Manager can manage this pass.

void assignPassManager(PMStack &PMS, PassManagerType T) override

Find appropriate Function Pass Manager or Call Graph Pass Manager in the PM Stack and add self into t...

Pass * createPrinterPass(raw_ostream &OS, const std::string &Banner) const override

createPrinterPass - Get a function printer pass.

virtual bool runOnFunction(Function &F)=0

runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.

bool skipFunction(const Function &F) const

Optional passes call this function to check whether the pass should be skipped.

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

~ImmutablePass() override

ImmutablePass * getAsImmutablePass() override

virtual void initializePass()

initializePass - This method may be overriden by immutable passes to allow them to perform various in...

bool runOnModule(Module &) override

ImmutablePasses are never run.

ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...

PassManagerType getPotentialPassManagerType() const override

Return what kind of Pass Manager can manage this pass.

bool skipModule(Module &M) const

Optional passes call this function to check whether the pass should be skipped.

void assignPassManager(PMStack &PMS, PassManagerType T) override

Find appropriate Module Pass Manager in the PM Stack and add self into that manager.

virtual bool runOnModule(Module &M)=0

runOnModule - Virtual method overriden by subclasses to process the module being operated on.

Pass * createPrinterPass(raw_ostream &OS, const std::string &Banner) const override

createPrinterPass - Get a module printer pass.

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.

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

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

Pass interface - Implemented by all 'passes'.

virtual void * getAdjustedAnalysisPointer(AnalysisID ID)

getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through...

virtual PassManagerType getPotentialPassManagerType() const

Return what kind of Pass Manager can manage this pass.

virtual void print(raw_ostream &OS, const Module *M) const

print - Print out the internal state of the pass.

bool mustPreserveAnalysisID(char &AID) const

mustPreserveAnalysisID - This method serves the same function as getAnalysisIfAvailable,...

Pass(PassKind K, char &pid)

void setResolver(AnalysisResolver *AR)

static Pass * createPass(AnalysisID ID)

AnalysisType & getAnalysis() const

getAnalysis() - This function is used by subclasses to get to the analysis information ...

virtual PMDataManager * getAsPMDataManager()

AnalysisID getPassID() const

getPassID - Return the PassID number that corresponds to this pass.

virtual void getAnalysisUsage(AnalysisUsage &) const

getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...

AnalysisType & getAnalysisID(AnalysisID PI) const

virtual void assignPassManager(PMStack &, PassManagerType)

Each pass is responsible for assigning a pass manager to itself.

AnalysisResolver * getResolver() const

PassKind getPassKind() const

virtual void preparePassManager(PMStack &)

Check if available pass managers are suitable for this pass or not.

static const PassInfo * lookupPassInfo(const void *TI)

virtual bool doInitialization(Module &)

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

virtual Pass * createPrinterPass(raw_ostream &OS, const std::string &Banner) const =0

createPrinterPass - Get a Pass appropriate to print the IR this pass operates on (Module,...

virtual bool doFinalization(Module &)

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

virtual void verifyAnalysis() const

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

virtual void dumpPassStructure(unsigned Offset=0)

Pass(const Pass &)=delete

virtual StringRef getPassName() const

getPassName - Return a nice clean name for a pass.

virtual ImmutablePass * getAsImmutablePass()

virtual void releaseMemory()

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

Pass & operator=(const Pass &)=delete

AnalysisType * getAnalysisIfAvailable() const

getAnalysisIfAvailable() - Subclasses use this function to get analysis information tha...

Interface for looking up the initializer for a variable name, used by Init::resolveReferences.

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

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.

PassManagerType

Different types of internal pass managers.

@ PMT_LoopPassManager

LPPassManager.

@ PMT_RegionPassManager

RGPassManager.

@ PMT_CallGraphPassManager

CGPassManager.

@ PMT_ModulePassManager

MPPassManager.

@ PMT_FunctionPassManager

FPPassManager.

bool TimePassesIsEnabled

If the user specifies the -time-passes argument on an LLVM tool command line then the value of this b...

bool TimePassesPerRun

If TimePassesPerRun is true, there would be one line of report for each pass invocation.

ThinOrFullLTOPhase

This enumerates the LLVM full LTO or ThinLTO optimization phases.

@ FullLTOPreLink

Full LTO prelink phase.

@ ThinLTOPostLink

ThinLTO postlink (backend compile) phase.

@ FullLTOPostLink

Full LTO postlink (backend compile) phase.

@ ThinLTOPreLink

ThinLTO prelink (summary) phase.