14#ifndef LLVM_TRANSFORMS_UTILS_DEBUGIFY_H
15#define LLVM_TRANSFORMS_UTILS_DEBUGIFY_H
91 StringRef OrigDIVerifyBugsReportFilePath);
112 enum DebugifyMode Mode = DebugifyMode::SyntheticDebugInfo,
115 : NameOfWrappedPass(NameOfWrappedPass),
116 DebugInfoBeforePass(DebugInfoBeforePass), Mode(Mode) {}
176 enum DebugifyMode Mode = DebugifyMode::SyntheticDebugInfo,
179 : NameOfWrappedPass(NameOfWrappedPass),
180 OrigDIVerifyBugsReportFilePath(OrigDIVerifyBugsReportFilePath),
181 StatsMap(StatsMap), DebugInfoBeforePass(DebugInfoBeforePass), Mode(Mode),
204 DebugInfoBeforePass = &PerPassMap;
209 OrigDIVerifyBugsReportFilePath = BugsReportFilePath;
212 return OrigDIVerifyBugsReportFilePath;
218 return Mode == DebugifyMode::SyntheticDebugInfo;
221 return Mode == DebugifyMode::OriginalDebugInfo;
230 StringRef OrigDIVerifyBugsReportFilePath;
241 bool WrapWithDebugify = Mode != DebugifyMode::NoDebugify &&
244 if (!WrapWithDebugify) {
262 OrigDIVerifyBugsReportFilePath));
269 OrigDIVerifyBugsReportFilePath));
281 DebugInfoBeforePass = &PerPassDI;
284 OrigDIVerifyBugsReportFilePath = BugsReportFilePath;
287 return OrigDIVerifyBugsReportFilePath;
293 return Mode == DebugifyMode::SyntheticDebugInfo;
296 return Mode == DebugifyMode::OriginalDebugInfo;
This file provides a bitcode writing pass.
DebugifyMode
Used to check whether we track synthetic or original debug info.
llvm::ModulePass * createDebugifyModulePass(enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, llvm::StringRef NameOfWrappedPass="", DebugInfoPerPass *DebugInfoBeforePass=nullptr)
llvm::ModulePass * createCheckDebugifyModulePass(bool Strip=false, llvm::StringRef NameOfWrappedPass="", DebugifyStatsMap *StatsMap=nullptr, enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, DebugInfoPerPass *DebugInfoBeforePass=nullptr, llvm::StringRef OrigDIVerifyBugsReportFilePath="")
llvm::FunctionPass * createCheckDebugifyFunctionPass(bool Strip=false, llvm::StringRef NameOfWrappedPass="", DebugifyStatsMap *StatsMap=nullptr, enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, DebugInfoPerPass *DebugInfoBeforePass=nullptr, llvm::StringRef OrigDIVerifyBugsReportFilePath="")
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.
This file implements a map that provides insertion order iteration.
Module.h This file contains the declarations for the Module class.
ModuleAnalysisManager MAM
PassInstrumentationCallbacks PIC
This file defines the Pass Instrumentation classes that provide instrumentation points into the pass ...
This header defines various interfaces for pass management in LLVM.
static cl::opt< RegAllocEvictionAdvisorAnalysis::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Development, "development", "for training")))
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="")
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM)
NewPMDebugifyPass(enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, llvm::StringRef NameOfWrappedPass="", DebugInfoPerPass *DebugInfoBeforePass=nullptr)
A container for analyses that lazily runs them and caches their results.
DebugifyCustomPassManager wraps each pass with the debugify passes if needed.
bool isOriginalDebugInfoMode() const
void setOrigDIVerifyBugsReportFilePath(StringRef BugsReportFilePath)
void add(Pass *P) override
Add a pass to the queue of passes to run.
void setDebugInfoBeforePass(DebugInfoPerPass &PerPassDI)
const DebugifyStatsMap & getDebugifyStatsMap() const
void setDebugifyMode(enum DebugifyMode M)
DebugInfoPerPass & getDebugInfoPerPass()
void setDIStatsMap(DebugifyStatsMap &StatMap)
StringRef getOrigDIVerifyBugsReportFilePath() const
bool isSyntheticDebugInfo() const
bool isSyntheticDebugInfo() const
StringRef getOrigDIVerifyBugsReportFilePath() const
void setOrigDIVerifyBugsReportFilePath(StringRef BugsReportFilePath)
void setDebugifyMode(enum DebugifyMode M)
const DebugifyStatsMap & getDebugifyStatsMap() const
void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager &MAM)
DebugInfoPerPass & getDebugInfoPerPass()
bool isOriginalDebugInfoMode() const
void setDIStatsMap(DebugifyStatsMap &StatMap)
void setDebugInfoBeforePass(DebugInfoPerPass &PerPassMap)
FunctionPass class - This class is used to implement most global optimizations.
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.
bool applyDebugifyMetadata(Module &M, iterator_range< Module::iterator > Functions, StringRef Banner, std::function< bool(DIBuilder &, Function &)> ApplyToMF)
Add synthesized debug information to a module.
bool stripDebugifyMetadata(Module &M)
Strip out all of the metadata and debug info inserted by debugify.
void exportDebugifyStats(StringRef Path, const DebugifyStatsMap &Map)
bool collectDebugInfoMetadata(Module &M, iterator_range< Module::iterator > Functions, DebugInfoPerPass &DebugInfoBeforePass, StringRef Banner, StringRef NameOfWrappedPass)
Collect original debug information before a pass.
bool checkDebugInfoMetadata(Module &M, iterator_range< Module::iterator > Functions, DebugInfoPerPass &DebugInfoBeforePass, StringRef Banner, StringRef NameOfWrappedPass, StringRef OrigDIVerifyBugsReportFilePath)
Check original debug information after a pass.
bool isIRPrintingPass(Pass *P)
Return true if a pass is for IR printing.
bool isBitcodeWriterPass(Pass *P)
Check whether a pass is a BitcodeWriterPass.
Used to track the Debug Info Metadata information.
WeakInstValueMap InstToDelete
Track how much debugify information (in the synthetic mode only) has been lost.
unsigned NumDbgValuesExpected
Number of dbg.values expected.
unsigned NumDbgLocsExpected
Number of instructions expected to have debug locations.
float getEmptyLocationRatio() const
Get the ratio of missing/expected instructions with locations.
unsigned NumDbgLocsMissing
Number of instructions with empty debug locations.
unsigned NumDbgValuesMissing
Number of missing dbg.values.
float getMissingValueRatio() const
Get the ratio of missing/expected dbg.values.
A CRTP mix-in to automatically provide informational APIs needed for passes.