18void DroppedVariableStatsIR::runOnFunction(
const Function *
F,
bool Before) {
20 auto FuncName =
F->getName();
25void DroppedVariableStatsIR::calculateDroppedVarStatsOnFunction(
35void DroppedVariableStatsIR::runOnModule(
const Module *M,
bool Before) {
40void DroppedVariableStatsIR::calculateDroppedVarStatsOnModule(
44 calculateDroppedVarStatsOnFunction(&
F, PassID, FuncOrModName, PassLevel);
63void DroppedVariableStatsIR::visitEveryInstruction(
66 const DIScope *DbgValScope = std::get<0>(Var);
68 auto *DbgLoc =
I.getDebugLoc().get();
72 InlinedAtsMap, Var, DroppedCount))
77void DroppedVariableStatsIR::visitEveryDebugRecord(
83 if (
auto *Dbg = dyn_cast<DbgVariableRecord>(&DR)) {
84 auto *DbgVar =
Dbg->getVariable();
85 auto DbgLoc = DR.getDebugLoc();
Expand Atomic instructions
===- DroppedVariableStatsIR.h - Opt Diagnostics -*- C++ -*-----------—===//
Legalize the Machine IR a function s Machine IR
PassInstrumentationCallbacks PIC
Base class for scope-like contexts.
Base class for non-instruction debug metadata records that have positions within IR.
Implements a dense probed hash-table based set.
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void runAfterPass(StringRef P, Any IR)
void runBeforePass(Any IR)
void calculateDroppedStatsAndPrint(DebugVariables &DbgVariables, StringRef FuncName, StringRef PassID, StringRef FuncOrModName, StringRef PassLevel, const Function *Func)
Calculate the number of dropped variables in an llvm::Function or llvm::MachineFunction and print the...
void populateVarIDSetAndInlinedMap(const DILocalVariable *DbgVar, DebugLoc DbgLoc, DenseSet< VarID > &VarIDSet, DenseMap< StringRef, DenseMap< VarID, DILocation * > > &InlinedAtsMap, StringRef FuncName, bool Before)
Populate the VarIDSet and InlinedAtMap with the relevant information needed for before and after pass...
bool DroppedVariableStatsEnabled
bool updateDroppedCount(DILocation *DbgLoc, const DIScope *Scope, const DIScope *DbgValScope, DenseMap< VarID, DILocation * > &InlinedAtsMap, VarID Var, unsigned &DroppedCount)
Check if a Var has been dropped or is a false positive.
void run(DebugVariables &DbgVariables, StringRef FuncName, bool Before)
Run code to populate relevant data structures over an llvm::Function or llvm::MachineFunction.
SmallVector< DenseMap< const Function *, DebugVariables > > DebugVariablesStack
A stack of a DenseMap, that maps DebugVariables for every pass to an llvm::Function.
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.
std::tuple< const DIScope *, const DIScope *, const DILocalVariable * > VarID
A unique key that represents a debug variable.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
void registerAfterPassInvalidatedCallback(CallableT C, bool ToFront=false)
void registerBeforeNonSkippedPassCallback(CallableT C)
void registerAfterPassCallback(CallableT C, bool ToFront=false)