LLVM: include/llvm/Transforms/Utils/Debugify.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_TRANSFORMS_UTILS_DEBUGIFY_H

15#define LLVM_TRANSFORMS_UTILS_DEBUGIFY_H

16

28

35

36

48

49namespace llvm {

50class DIBuilder;

51

52

53

54

55

56

57

58

59

64

65

66

67

69

70

71

72

73

74

75

76

81

82

83

84

85

86

87

88

94 StringRef OrigDIVerifyBugsReportFilePath);

95}

96

97

99

108

113public:

118 : NameOfWrappedPass(NameOfWrappedPass),

119 DebugInfoBeforePass(DebugInfoBeforePass), Mode(Mode) {}

120

123};

124

125

126

128

130

131

133

134

136

137

139

140

144

145

149};

150

151

153

155 bool Strip = false, llvm::StringRef NameOfWrappedPass = "",

160

162 bool Strip = false, llvm::StringRef NameOfWrappedPass = "",

167

175 bool Strip;

176public:

178 bool Strip = false, llvm::StringRef NameOfWrappedPass = "",

183 : NameOfWrappedPass(NameOfWrappedPass),

184 OrigDIVerifyBugsReportFilePath(OrigDIVerifyBugsReportFilePath),

185 StatsMap(StatsMap), DebugInfoBeforePass(DebugInfoBeforePass), Mode(Mode),

186 Strip(Strip) {}

187

190};

191

192namespace llvm {

194

200

201public:

204

207

209 DebugInfoBeforePass = &PerPassMap;

210 }

212

214 OrigDIVerifyBugsReportFilePath = BugsReportFilePath;

215 }

217 return OrigDIVerifyBugsReportFilePath;

218 }

219

221

228};

229

230

231

232

233

235 StringRef OrigDIVerifyBugsReportFilePath;

239

240public:

242

244

245

249 if (!WrapWithDebugify) {

251 return;

252 }

253

254

255

256

257 PassKind Kind = P->getPassKind();

259

260

261 switch (Kind) {

267 OrigDIVerifyBugsReportFilePath));

268 break;

274 OrigDIVerifyBugsReportFilePath));

275 break;

276 default:

278 break;

279 }

280 }

281

282

284

286 DebugInfoBeforePass = &PerPassDI;

287 }

289 OrigDIVerifyBugsReportFilePath = BugsReportFilePath;

290 }

292 return OrigDIVerifyBugsReportFilePath;

293 }

294

296

303

306};

307}

308

309#endif

This file provides a bitcode writing pass.

LLVM_ABI llvm::ModulePass * createCheckDebugifyModulePass(bool Strip=false, llvm::StringRef NameOfWrappedPass="", DebugifyStatsMap *StatsMap=nullptr, enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, DebugInfoPerPass *DebugInfoBeforePass=nullptr, llvm::StringRef OrigDIVerifyBugsReportFilePath="")

DebugifyMode

Used to check whether we track synthetic or original debug info.

Definition Debugify.h:98

@ SyntheticDebugInfo

Definition Debugify.h:98

@ NoDebugify

Definition Debugify.h:98

@ OriginalDebugInfo

Definition Debugify.h:98

llvm::MapVector< const llvm::Function *, const llvm::DISubprogram * > DebugFnMap

Definition Debugify.h:29

llvm::MapVector< llvm::StringRef, DebugifyStatistics > DebugifyStatsMap

Map pass names to a per-pass DebugifyStatistics instance.

Definition Debugify.h:152

llvm::MapVector< const llvm::Instruction *, bool > DebugInstMap

Definition Debugify.h:31

llvm::MapVector< const llvm::Instruction *, llvm::WeakVH > WeakInstValueMap

Definition Debugify.h:33

LLVM_ABI llvm::FunctionPass * createCheckDebugifyFunctionPass(bool Strip=false, llvm::StringRef NameOfWrappedPass="", DebugifyStatsMap *StatsMap=nullptr, enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, DebugInfoPerPass *DebugInfoBeforePass=nullptr, llvm::StringRef OrigDIVerifyBugsReportFilePath="")

llvm::MapVector< const llvm::DILocalVariable *, unsigned > DebugVarMap

Definition Debugify.h:32

LLVM_ABI llvm::ModulePass * createDebugifyModulePass(enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, llvm::StringRef NameOfWrappedPass="", DebugInfoPerPass *DebugInfoBeforePass=nullptr)

LLVM_ABI llvm::FunctionPass * createDebugifyFunctionPass(enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, llvm::StringRef NameOfWrappedPass="", DebugInfoPerPass *DebugInfoBeforePass=nullptr)

This file contains an interface for creating legacy passes to print out IR in various granularities.

Module.h This file contains the declarations for the Module class.

This header defines various interfaces for pass management in LLVM.

This file implements a map that provides insertion order iteration.

ModuleAnalysisManager MAM

PassInstrumentationCallbacks PIC

This file defines the Pass Instrumentation classes that provide instrumentation points into the pass ...

static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))

LLVM_ABI llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM)

NewPMCheckDebugifyPass(bool Strip=false, llvm::StringRef NameOfWrappedPass="", DebugifyStatsMap *StatsMap=nullptr, enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, DebugInfoPerPass *DebugInfoBeforePass=nullptr, llvm::StringRef OrigDIVerifyBugsReportFilePath="")

Definition Debugify.h:177

LLVM_ABI llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM)

NewPMDebugifyPass(enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, llvm::StringRef NameOfWrappedPass="", DebugInfoPerPass *DebugInfoBeforePass=nullptr)

Definition Debugify.h:114

DebugifyCustomPassManager wraps each pass with the debugify passes if needed.

Definition Debugify.h:234

bool isOriginalDebugInfoMode() const

Definition Debugify.h:300

legacy::PassManager super

Definition Debugify.h:241

void setOrigDIVerifyBugsReportFilePath(StringRef BugsReportFilePath)

Definition Debugify.h:288

void add(Pass *P) override

Add a pass to the queue of passes to run.

Definition Debugify.h:243

void setDebugInfoBeforePass(DebugInfoPerPass &PerPassDI)

Definition Debugify.h:285

const DebugifyStatsMap & getDebugifyStatsMap() const

Definition Debugify.h:304

void setDebugifyMode(enum DebugifyMode M)

Definition Debugify.h:295

DebugInfoPerPass & getDebugInfoPerPass()

Definition Debugify.h:305

void setDIStatsMap(DebugifyStatsMap &StatMap)

Definition Debugify.h:283

StringRef getOrigDIVerifyBugsReportFilePath() const

Definition Debugify.h:291

bool isSyntheticDebugInfo() const

Definition Debugify.h:297

Definition Debugify.h:195

bool isSyntheticDebugInfo() const

Definition Debugify.h:222

StringRef getOrigDIVerifyBugsReportFilePath() const

Definition Debugify.h:216

void setOrigDIVerifyBugsReportFilePath(StringRef BugsReportFilePath)

Definition Debugify.h:213

void setDebugifyMode(enum DebugifyMode M)

Definition Debugify.h:220

const DebugifyStatsMap & getDebugifyStatsMap() const

Definition Debugify.h:206

LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager &MAM)

DebugInfoPerPass & getDebugInfoPerPass()

Definition Debugify.h:211

bool isOriginalDebugInfoMode() const

Definition Debugify.h:225

void setDIStatsMap(DebugifyStatsMap &StatMap)

Definition Debugify.h:205

void setDebugInfoBeforePass(DebugInfoPerPass &PerPassMap)

Definition Debugify.h:208

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

This class implements a map that also provides access to all stored values in a deterministic order.

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

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

This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...

Pass interface - Implemented by all 'passes'.

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

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

A range adaptor for a pair of iterators.

PassManager manages ModulePassManagers.

void add(Pass *P) override

Add a pass to the queue of passes to run.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI bool stripDebugifyMetadata(Module &M)

Strip out all of the metadata and debug info inserted by debugify.

LLVM_ABI void exportDebugifyStats(StringRef Path, const DebugifyStatsMap &Map)

LLVM_ABI bool applyDebugifyMetadata(Module &M, iterator_range< Module::iterator > Functions, StringRef Banner, std::function< bool(DIBuilder &, Function &)> ApplyToMF)

Add synthesized debug information to a module.

LLVM_ABI bool collectDebugInfoMetadata(Module &M, iterator_range< Module::iterator > Functions, DebugInfoPerPass &DebugInfoBeforePass, StringRef Banner, StringRef NameOfWrappedPass)

Collect original debug information before a pass.

LLVM_ABI bool checkDebugInfoMetadata(Module &M, iterator_range< Module::iterator > Functions, DebugInfoPerPass &DebugInfoBeforePass, StringRef Banner, StringRef NameOfWrappedPass, StringRef OrigDIVerifyBugsReportFilePath)

Check original debug information after a pass.

LLVM_ABI bool isIRPrintingPass(Pass *P)

Return true if a pass is for IR printing.

LLVM_ABI bool isBitcodeWriterPass(Pass *P)

Check whether a pass is a BitcodeWriterPass.

AnalysisManager< Module > ModuleAnalysisManager

Convenience typedef for the Module analysis manager.

Used to track the Debug Info Metadata information.

Definition Debugify.h:37

DebugInstMap DILocations

Definition Debugify.h:41

DebugFnMap DIFunctions

Definition Debugify.h:39

DebugVarMap DIVariables

Definition Debugify.h:46

WeakInstValueMap InstToDelete

Definition Debugify.h:44

Track how much debugify information (in the synthetic mode only) has been lost.

Definition Debugify.h:127

unsigned NumDbgValuesExpected

Number of dbg.values expected.

Definition Debugify.h:132

unsigned NumDbgLocsExpected

Number of instructions expected to have debug locations.

Definition Debugify.h:138

float getEmptyLocationRatio() const

Get the ratio of missing/expected instructions with locations.

Definition Debugify.h:146

unsigned NumDbgLocsMissing

Number of instructions with empty debug locations.

Definition Debugify.h:135

unsigned NumDbgValuesMissing

Number of missing dbg.values.

Definition Debugify.h:129

float getMissingValueRatio() const

Get the ratio of missing/expected dbg.values.

Definition Debugify.h:141

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