LLVM 24.0.0git
llvm::DroppedVariableStats Class Referenceabstract

A base class to collect and print dropped debug information variable statistics. More...

#include "llvm/IR/DroppedVariableStats.h"

Inheritance diagram for llvm::DroppedVariableStats:
[legend]

Classes

struct  DebugVariables

Public Member Functions

LLVM_ABI DroppedVariableStats (bool DroppedVarStatsEnabled)
virtual ~DroppedVariableStats ()=default
 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 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 (const DILocation *DbgLoc, VarID Var, unsigned &DroppedCount)
 Check if a Var has been dropped or is a false positive.
LLVM_ABI void run (DebugVariables &DbgVariables, bool Before)
 Run code to populate relevant data structures over an llvm::Function or llvm::MachineFunction.
LLVM_ABI void populateVarIDSet (const DILocalVariable *DbgVar, DebugLoc DbgLoc, DenseSet< VarID > &VarIDSet)
 Add the VarID of the debug record of DbgVar at DbgLoc to VarIDSet.
virtual void visitEveryInstruction (unsigned &DroppedCount, 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)=0
 Visit every debug record in an llvm::Function or llvm::MachineFunction and call populateVarIDSet 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.

Detailed Description

A base class to collect and print dropped debug information variable statistics.

Definition at line 33 of file DroppedVariableStats.h.

Constructor & Destructor Documentation

◆ DroppedVariableStats() [1/2]

DroppedVariableStats::DroppedVariableStats ( bool DroppedVarStatsEnabled)

◆ ~DroppedVariableStats()

virtual llvm::DroppedVariableStats::~DroppedVariableStats ( )
virtualdefault

◆ DroppedVariableStats() [2/2]

llvm::DroppedVariableStats::DroppedVariableStats ( const DroppedVariableStats & )
delete

Member Function Documentation

◆ calculateDroppedStatsAndPrint()

void DroppedVariableStats::calculateDroppedStatsAndPrint ( DebugVariables & DbgVariables,
StringRef PassID,
StringRef FuncOrModName,
StringRef PassLevel,
const Function * Func )
protected

◆ cleanup()

◆ getPassDroppedVariables()

bool llvm::DroppedVariableStats::getPassDroppedVariables ( )
inline

Definition at line 43 of file DroppedVariableStats.h.

◆ operator=()

void llvm::DroppedVariableStats::operator= ( const DroppedVariableStats & )
delete

◆ populateVarIDSet()

void DroppedVariableStats::populateVarIDSet ( const DILocalVariable * DbgVar,
DebugLoc DbgLoc,
DenseSet< VarID > & VarIDSet )
protected

Add the VarID of the debug record of DbgVar at DbgLoc to VarIDSet.

Definition at line 78 of file DroppedVariableStats.cpp.

References llvm::DebugLoc::getInlinedAt(), and llvm::detail::DenseSetImpl< ValueT, MapTy >::insert().

◆ run()

void DroppedVariableStats::run ( DebugVariables & DbgVariables,
bool Before )
protected

◆ setup()

void DroppedVariableStats::setup ( )
protected

◆ updateDroppedCount()

bool DroppedVariableStats::updateDroppedCount ( const DILocation * DbgLoc,
VarID Var,
unsigned & DroppedCount )
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 60 of file DroppedVariableStats.cpp.

◆ visitEveryDebugRecord()

virtual void llvm::DroppedVariableStats::visitEveryDebugRecord ( DenseSet< VarID > & VarIDSet)
protectedpure virtual

Visit every debug record in an llvm::Function or llvm::MachineFunction and call populateVarIDSet on it.

References F.

Referenced by run().

◆ visitEveryInstruction()

virtual void llvm::DroppedVariableStats::visitEveryInstruction ( unsigned & DroppedCount,
VarID Var )
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().

Member Data Documentation

◆ DebugVariablesStack

SmallVector<DenseMap<const Function *, DebugVariables> > llvm::DroppedVariableStats::DebugVariablesStack
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 61 of file DroppedVariableStats.h.

Referenced by cleanup(), and setup().

◆ DroppedVariableStatsEnabled

bool llvm::DroppedVariableStats::DroppedVariableStatsEnabled = false
protected

The documentation for this class was generated from the following files: