LLVM 22.0.0git
|
A base class to collect and print dropped debug information variable statistics. More...
#include "llvm/IR/DroppedVariableStats.h"
Classes | |
struct | DebugVariables |
Public Member Functions | |
LLVM_ABI | DroppedVariableStats (bool DroppedVarStatsEnabled) |
virtual | ~DroppedVariableStats () |
DroppedVariableStats (const DroppedVariableStats &)=delete | |
void | operator= (const DroppedVariableStats &)=delete |
bool | getPassDroppedVariables () |
Protected Member Functions | |
LLVM_ABI void | setup () |
LLVM_ABI void | cleanup () |
LLVM_ABI 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 relevant information to stdout. | |
LLVM_ABI 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. | |
LLVM_ABI void | run (DebugVariables &DbgVariables, StringRef FuncName, bool Before) |
Run code to populate relevant data structures over an llvm::Function or llvm::MachineFunction. | |
LLVM_ABI 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 analysis to determine dropped variable status. | |
virtual void | visitEveryInstruction (unsigned &DroppedCount, DenseMap< VarID, DILocation * > &InlinedAtsMap, VarID Var)=0 |
Visit every llvm::Instruction or llvm::MachineInstruction and check if the debug variable denoted by its ID Var may have been dropped by an optimization pass. | |
virtual void | visitEveryDebugRecord (DenseSet< VarID > &VarIDSet, DenseMap< StringRef, DenseMap< VarID, DILocation * > > &InlinedAtsMap, StringRef FuncName, bool Before)=0 |
Visit every debug record in an llvm::Function or llvm::MachineFunction and call populateVarIDSetAndInlinedMap on it. | |
Protected Attributes | |
bool | DroppedVariableStatsEnabled = false |
SmallVector< DenseMap< const Function *, DebugVariables > > | DebugVariablesStack |
A stack of a DenseMap, that maps DebugVariables for every pass to an llvm::Function. | |
DenseSet< const DIScope * > | VisitedScope |
A DenseSet tracking whether a scope was visited before. | |
SmallVector< DenseMap< StringRef, DenseMap< VarID, DILocation * > > > | InlinedAts |
A stack of DenseMaps, which map the name of an llvm::Function to a DenseMap of VarIDs and their inlinedAt locations before an optimization pass has run. | |
A base class to collect and print dropped debug information variable statistics.
Definition at line 41 of file DroppedVariableStats.h.
DroppedVariableStats::DroppedVariableStats | ( | bool | DroppedVarStatsEnabled | ) |
Definition at line 21 of file DroppedVariableStats.cpp.
References llvm::outs().
|
inlinevirtual |
Definition at line 45 of file DroppedVariableStats.h.
|
delete |
|
protected |
Calculate the number of dropped variables in an llvm::Function or llvm::MachineFunction and print the relevant information to stdout.
Definition at line 41 of file DroppedVariableStats.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains(), llvm::DroppedVariableStats::DebugVariables::DebugVariablesAfter, llvm::DroppedVariableStats::DebugVariables::DebugVariablesBefore, InlinedAts, llvm::outs(), and visitEveryInstruction().
|
protected |
Definition at line 33 of file DroppedVariableStats.cpp.
References assert(), DebugVariablesStack, and InlinedAts.
Referenced by llvm::DroppedVariableStatsIR::registerCallbacks(), llvm::DroppedVariableStatsIR::runAfterPass(), and llvm::DroppedVariableStatsMIR::runAfterPass().
|
inline |
Definition at line 51 of file DroppedVariableStats.h.
|
delete |
|
protected |
Populate the VarIDSet and InlinedAtMap with the relevant information needed for before and after pass analysis to determine dropped variable status.
Definition at line 100 of file DroppedVariableStats.cpp.
References llvm::DebugLoc::getInlinedAt(), llvm::DILocalVariable::getScope(), and llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert().
|
protected |
Run code to populate relevant data structures over an llvm::Function or llvm::MachineFunction.
Definition at line 89 of file DroppedVariableStats.cpp.
References llvm::DroppedVariableStats::DebugVariables::DebugVariablesAfter, llvm::DroppedVariableStats::DebugVariables::DebugVariablesBefore, InlinedAts, and visitEveryDebugRecord().
|
protected |
Definition at line 28 of file DroppedVariableStats.cpp.
References DebugVariablesStack, and InlinedAts.
Referenced by llvm::DroppedVariableStatsIR::runBeforePass(), and llvm::DroppedVariableStatsMIR::runBeforePass().
|
protected |
Check if a Var
has been dropped or is a false positive.
Also update the DroppedCount
if a debug variable is dropped.
Definition at line 70 of file DroppedVariableStats.cpp.
|
protectedpure virtual |
Visit every debug record in an llvm::Function or llvm::MachineFunction and call populateVarIDSetAndInlinedMap on it.
Referenced by run().
|
protectedpure virtual |
Visit every llvm::Instruction or llvm::MachineInstruction and check if the debug variable denoted by its ID Var
may have been dropped by an optimization pass.
Referenced by calculateDroppedStatsAndPrint().
|
protected |
A stack of a DenseMap, that maps DebugVariables for every pass to an llvm::Function.
A stack is used because an optimization pass can call other passes.
Definition at line 69 of file DroppedVariableStats.h.
|
protected |
Definition at line 58 of file DroppedVariableStats.h.
Referenced by llvm::DroppedVariableStatsIR::registerCallbacks().
|
protected |
A stack of DenseMaps, which map the name of an llvm::Function to a DenseMap of VarIDs and their inlinedAt locations before an optimization pass has run.
Definition at line 76 of file DroppedVariableStats.h.
Referenced by calculateDroppedStatsAndPrint(), cleanup(), run(), and setup().
A DenseSet tracking whether a scope was visited before.
Definition at line 72 of file DroppedVariableStats.h.