LLVM 19.0.0git
Macros | Functions | Variables
Debugify.cpp File Reference
#include "llvm/Transforms/Utils/Debugify.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassInstrumentation.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/JSON.h"
#include <optional>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "debugify"
 

Functions

static bool applyDebugify (Function &F, enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, DebugInfoPerPass *DebugInfoBeforePass=nullptr, StringRef NameOfWrappedPass="")
 
static bool applyDebugify (Module &M, enum DebugifyMode Mode=DebugifyMode::SyntheticDebugInfo, DebugInfoPerPass *DebugInfoBeforePass=nullptr, StringRef NameOfWrappedPass="")
 
static bool checkFunctions (const DebugFnMap &DIFunctionsBefore, const DebugFnMap &DIFunctionsAfter, StringRef NameOfWrappedPass, StringRef FileNameFromCU, bool ShouldWriteIntoJSON, llvm::json::Array &Bugs)
 
static bool checkInstructions (const DebugInstMap &DILocsBefore, const DebugInstMap &DILocsAfter, const WeakInstValueMap &InstToDelete, StringRef NameOfWrappedPass, StringRef FileNameFromCU, bool ShouldWriteIntoJSON, llvm::json::Array &Bugs)
 
static bool checkVars (const DebugVarMap &DIVarsBefore, const DebugVarMap &DIVarsAfter, StringRef NameOfWrappedPass, StringRef FileNameFromCU, bool ShouldWriteIntoJSON, llvm::json::Array &Bugs)
 
static void writeJSON (StringRef OrigDIVerifyBugsReportFilePath, StringRef FileNameFromCU, StringRef NameOfWrappedPass, llvm::json::Array &Bugs)
 
ModulePasscreateDebugifyModulePass (enum DebugifyMode Mode, llvm::StringRef NameOfWrappedPass, DebugInfoPerPass *DebugInfoBeforePass)
 
FunctionPasscreateDebugifyFunctionPass (enum DebugifyMode Mode, llvm::StringRef NameOfWrappedPass, DebugInfoPerPass *DebugInfoBeforePass)
 
ModulePasscreateCheckDebugifyModulePass (bool Strip, StringRef NameOfWrappedPass, DebugifyStatsMap *StatsMap, enum DebugifyMode Mode, DebugInfoPerPass *DebugInfoBeforePass, StringRef OrigDIVerifyBugsReportFilePath)
 
FunctionPasscreateCheckDebugifyFunctionPass (bool Strip, StringRef NameOfWrappedPass, DebugifyStatsMap *StatsMap, enum DebugifyMode Mode, DebugInfoPerPass *DebugInfoBeforePass, StringRef OrigDIVerifyBugsReportFilePath)
 
static bool isIgnoredPass (StringRef PassID)
 

Variables

static RegisterPass< DebugifyModulePass > DM ("debugify", "Attach debug info to everything")
 
static RegisterPass< CheckDebugifyModulePass > CDM ("check-debugify", "Check debug info from -debugify")
 
static RegisterPass< DebugifyFunctionPass > DF ("debugify-function", "Attach debug info to a function")
 
static RegisterPass< CheckDebugifyFunctionPass > CDF ("check-debugify-function", "Check debug info from -debugify-function")
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "debugify"

Definition at line 32 of file Debugify.cpp.

Function Documentation

◆ applyDebugify() [1/2]

static bool applyDebugify ( Function F,
enum DebugifyMode  Mode = DebugifyMode::SyntheticDebugInfo,
DebugInfoPerPass DebugInfoBeforePass = nullptr,
StringRef  NameOfWrappedPass = "" 
)
static

◆ applyDebugify() [2/2]

static bool applyDebugify ( Module M,
enum DebugifyMode  Mode = DebugifyMode::SyntheticDebugInfo,
DebugInfoPerPass DebugInfoBeforePass = nullptr,
StringRef  NameOfWrappedPass = "" 
)
static

◆ checkFunctions()

static bool checkFunctions ( const DebugFnMap DIFunctionsBefore,
const DebugFnMap DIFunctionsAfter,
StringRef  NameOfWrappedPass,
StringRef  FileNameFromCU,
bool  ShouldWriteIntoJSON,
llvm::json::Array Bugs 
)
static

◆ checkInstructions()

static bool checkInstructions ( const DebugInstMap DILocsBefore,
const DebugInstMap DILocsAfter,
const WeakInstValueMap InstToDelete,
StringRef  NameOfWrappedPass,
StringRef  FileNameFromCU,
bool  ShouldWriteIntoJSON,
llvm::json::Array Bugs 
)
static

◆ checkVars()

static bool checkVars ( const DebugVarMap DIVarsBefore,
const DebugVarMap DIVarsAfter,
StringRef  NameOfWrappedPass,
StringRef  FileNameFromCU,
bool  ShouldWriteIntoJSON,
llvm::json::Array Bugs 
)
static

◆ createCheckDebugifyFunctionPass()

FunctionPass * createCheckDebugifyFunctionPass ( bool  Strip,
StringRef  NameOfWrappedPass,
DebugifyStatsMap StatsMap,
enum DebugifyMode  Mode,
DebugInfoPerPass DebugInfoBeforePass,
StringRef  OrigDIVerifyBugsReportFilePath 
)

Definition at line 1025 of file Debugify.cpp.

References assert(), OriginalDebugInfo, and SyntheticDebugInfo.

Referenced by llvm::DebugifyCustomPassManager::add().

◆ createCheckDebugifyModulePass()

ModulePass * createCheckDebugifyModulePass ( bool  Strip,
StringRef  NameOfWrappedPass,
DebugifyStatsMap StatsMap,
enum DebugifyMode  Mode,
DebugInfoPerPass DebugInfoBeforePass,
StringRef  OrigDIVerifyBugsReportFilePath 
)

Definition at line 1013 of file Debugify.cpp.

References assert(), OriginalDebugInfo, and SyntheticDebugInfo.

Referenced by llvm::DebugifyCustomPassManager::add().

◆ createDebugifyFunctionPass()

FunctionPass * createDebugifyFunctionPass ( enum DebugifyMode  Mode,
llvm::StringRef  NameOfWrappedPass,
DebugInfoPerPass DebugInfoBeforePass 
)

Definition at line 990 of file Debugify.cpp.

References assert(), OriginalDebugInfo, and SyntheticDebugInfo.

Referenced by llvm::DebugifyCustomPassManager::add().

◆ createDebugifyModulePass()

ModulePass * createDebugifyModulePass ( enum DebugifyMode  Mode,
llvm::StringRef  NameOfWrappedPass,
DebugInfoPerPass DebugInfoBeforePass 
)

Definition at line 980 of file Debugify.cpp.

References assert(), OriginalDebugInfo, and SyntheticDebugInfo.

Referenced by llvm::DebugifyCustomPassManager::add().

◆ isIgnoredPass()

static bool isIgnoredPass ( StringRef  PassID)
static

◆ writeJSON()

static void writeJSON ( StringRef  OrigDIVerifyBugsReportFilePath,
StringRef  FileNameFromCU,
StringRef  NameOfWrappedPass,
llvm::json::Array Bugs 
)
static

Variable Documentation

◆ CDF

RegisterPass< CheckDebugifyFunctionPass > CDF("check-debugify-function", "Check debug info from -debugify-function") ( "check-debugify-function"  ,
"Check debug info from -debugify-function"   
)
static

◆ CDM

RegisterPass< CheckDebugifyModulePass > CDM("check-debugify", "Check debug info from -debugify") ( "check-debugify"  ,
"Check debug info from -debugify"   
)
static

◆ DF

RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function") ( "debugify-function"  ,
"Attach debug info to a function"   
)
static

Referenced by AttemptToFoldSymbolOffsetDifference(), llvm::DILocation::cloneByMultiplyingDuplicationFactor(), llvm::DILocation::cloneWithBaseDiscriminator(), llvm::DILocation::decodeDiscriminator(), llvm::MCFragment::dump(), llvm::DWARFContext::dump(), llvm::MCELFStreamer::emitBundleLock(), llvm::MCELFStreamer::emitBundleUnlock(), llvm::MCObjectStreamer::emitBytes(), llvm::MCWinCOFFStreamer::emitCOFFImgRel32(), llvm::MCWinCOFFStreamer::emitCOFFSecRel32(), llvm::MCWinCOFFStreamer::emitCOFFSectionIndex(), llvm::MCObjectStreamer::emitDTPRel32Value(), llvm::MCObjectStreamer::emitDTPRel64Value(), llvm::MCObjectStreamer::emitFill(), llvm::MCObjectStreamer::emitGPRel32Value(), llvm::MCObjectStreamer::emitGPRel64Value(), llvm::MCXCOFFStreamer::emitInstToData(), llvm::MCWinCOFFStreamer::emitInstToData(), llvm::MCObjectStreamer::emitLabelAtPos(), llvm::MCObjectStreamer::emitNops(), llvm::MCObjectStreamer::emitRelocDirective(), llvm::MCObjectStreamer::emitTPRel32Value(), llvm::MCObjectStreamer::emitTPRel64Value(), llvm::MCObjectStreamer::emitValueImpl(), llvm::MCXCOFFStreamer::emitXCOFFRefDirective(), llvm::DILocation::encodeDiscriminator(), llvm::RISCVAsmBackend::evaluateTargetFixup(), llvm::MCAsmBackend::fixupNeedsRelaxationAdvanced(), ThreadUnsafeDWARFContextState::getDebugFrame(), ThreadUnsafeDWARFContextState::getEHFrame(), getOffsetAndDataFragment(), llvm::RISCVMCExpr::getPCRelHiFixup(), llvm::MCInstrInfo::InitMCInstrInfo(), isRightAfterData(), llvm::MCAssembler::layout(), llvm::LoongArchAsmBackend::relaxDwarfCFA(), llvm::RISCVAsmBackend::relaxDwarfCFA(), llvm::LoongArchAsmBackend::relaxDwarfLineAddr(), llvm::RISCVAsmBackend::relaxDwarfLineAddr(), llvm::DominanceFrontierAnalysis::run(), llvm::RegionInfoAnalysis::run(), llvm::RegionInfoPass::runOnFunction(), llvm::MachineRegionInfoPass::runOnMachineFunction(), and llvm::MCAssembler::writeSectionData().

◆ DM

RegisterPass< DebugifyModulePass > DM("debugify", "Attach debug info to everything") ( "debugify"  ,
"Attach debug info to everything"   
)
static