LLVM 22.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/Config/llvm-config.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.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, DebugInfoPerPass *DebugInfoBeforePass, StringRef NameOfWrappedPass="")
 
static bool applyDebugify (Module &M, enum DebugifyMode Mode, DebugInfoPerPass *DebugInfoBeforePass, StringRef NameOfWrappedPass="")
 
bool hasLoc (const Instruction &I)
 
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 38 of file Debugify.cpp.

Function Documentation

◆ applyDebugify() [1/2]

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

◆ applyDebugify() [2/2]

static bool applyDebugify ( Module M,
enum DebugifyMode  Mode,
DebugInfoPerPass DebugInfoBeforePass,
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 1089 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 1077 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 1054 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 1044 of file Debugify.cpp.

References assert(), OriginalDebugInfo, and SyntheticDebugInfo.

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

◆ hasLoc()

bool hasLoc ( const Instruction I)

Definition at line 355 of file Debugify.cpp.

References I.

Referenced by llvm::checkDebugInfoMetadata(), and llvm::collectDebugInfoMetadata().

◆ 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

◆ DM

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