LLVM
22.0.0git
include
llvm
IR
DroppedVariableStatsIR.h
Go to the documentation of this file.
1
///===- DroppedVariableStatsIR.h - Opt Diagnostics -*- C++ -*--------------===//
2
///
3
/// Part of the LLVM Project, under the Apache License v2.0 with LLVM
4
/// Exceptions. See https://llvm.org/LICENSE.txt for license information.
5
/// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
///
7
///===---------------------------------------------------------------------===//
8
/// \file
9
/// Dropped Variable Statistics for Debug Information. Reports any number
10
/// of #dbg_value that get dropped due to an optimization pass.
11
///
12
///===---------------------------------------------------------------------===//
13
14
#ifndef LLVM_CODEGEN_DROPPEDVARIABLESTATSIR_H
15
#define LLVM_CODEGEN_DROPPEDVARIABLESTATSIR_H
16
17
#include "
llvm/IR/DroppedVariableStats.h
"
18
#include "
llvm/Support/Compiler.h
"
19
20
namespace
llvm
{
21
22
class
Any
;
23
class
StringRef
;
24
class
PassInstrumentationCallbacks
;
25
class
Function
;
26
class
Module
;
27
class
DILocation
;
28
29
/// A class to collect and print dropped debug information due to LLVM IR
30
/// optimization passes. After every LLVM IR pass is run, it will print how many
31
/// #dbg_values were dropped due to that pass.
32
class
LLVM_ABI
DroppedVariableStatsIR
:
public
DroppedVariableStats
{
33
public
:
34
DroppedVariableStatsIR
(
bool
DroppedVarStatsEnabled)
35
:
llvm
::
DroppedVariableStats
(DroppedVarStatsEnabled) {}
36
37
void
runBeforePass(
StringRef
P
,
Any
IR
);
38
39
void
runAfterPass(
StringRef
P
,
Any
IR
);
40
41
void
registerCallbacks
(
PassInstrumentationCallbacks
&
PIC
);
42
43
private
:
44
const
Function
*Func;
45
46
void
runAfterPassFunction(
StringRef
PassID,
const
Function
*
F
);
47
48
void
runAfterPassModule(
StringRef
PassID,
const
Module
*M);
49
50
/// Populate DebugVariablesBefore, DebugVariablesAfter, InlinedAts before or
51
/// after a pass has run to facilitate dropped variable calculation for an
52
/// llvm::Function.
53
void
runOnFunction
(
StringRef
PassID,
const
Function
*
F
,
bool
Before);
54
55
/// Iterate over all Instructions in a Function and report any dropped debug
56
/// information.
57
void
calculateDroppedVarStatsOnFunction(
const
Function
*
F
,
StringRef
PassID,
58
StringRef
FuncOrModName,
59
StringRef
PassLevel);
60
61
/// Populate DebugVariablesBefore, DebugVariablesAfter, InlinedAts before or
62
/// after a pass has run to facilitate dropped variable calculation for an
63
/// llvm::Module. Calls runOnFunction on every Function in the Module.
64
void
runOnModule(
StringRef
PassID,
const
Module
*M,
bool
Before);
65
66
/// Iterate over all Functions in a Module and report any dropped debug
67
/// information. Will call calculateDroppedVarStatsOnFunction on every
68
/// Function.
69
void
calculateDroppedVarStatsOnModule(
const
Module
*M,
StringRef
PassID,
70
StringRef
FuncOrModName,
71
StringRef
PassLevel);
72
73
/// Override base class method to run on an llvm::Function specifically.
74
virtual
void
75
visitEveryInstruction(
unsigned
&DroppedCount,
76
DenseMap<VarID, DILocation *>
&InlinedAtsMap,
77
VarID
Var)
override
;
78
79
/// Override base class method to run on #dbg_values specifically.
80
virtual
void
visitEveryDebugRecord(
81
DenseSet<VarID>
&VarIDSet,
82
DenseMap
<
StringRef
,
DenseMap<VarID, DILocation *>
> &InlinedAtsMap,
83
StringRef
FuncName,
bool
Before)
override
;
84
85
template
<
typename
IRUnitT>
static
const
IRUnitT *
unwrapIR
(
Any
IR
);
86
};
87
88
}
// namespace llvm
89
90
#endif
Compiler.h
LLVM_ABI
#define LLVM_ABI
Definition
Compiler.h:213
DroppedVariableStats.h
===- DroppedVariableStats.h - Opt Diagnostics -*- C++ -*-------------—===//
runOnFunction
static bool runOnFunction(Function &F, bool PostInlining)
Definition
EntryExitInstrumenter.cpp:103
IR
Legalize the Machine IR a function s Machine IR
Definition
Legalizer.cpp:80
F
#define F(x, y, z)
Definition
MD5.cpp:55
P
#define P(N)
registerCallbacks
SI registerCallbacks(PIC, &MAM)
PIC
PassInstrumentationCallbacks PIC
Definition
PassBuilderBindings.cpp:57
unwrapIR
static const IRUnitT * unwrapIR(Any IR)
Definition
StandardInstrumentations.cpp:143
llvm::Any
Definition
Any.h:28
llvm::DILocation
Debug location.
Definition
DebugInfoMetadata.h:2506
llvm::DenseMap
Definition
DenseMap.h:700
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition
DenseSet.h:261
llvm::DroppedVariableStatsIR::DroppedVariableStatsIR
DroppedVariableStatsIR(bool DroppedVarStatsEnabled)
Definition
DroppedVariableStatsIR.h:34
llvm::DroppedVariableStats::DroppedVariableStats
LLVM_ABI DroppedVariableStats(bool DroppedVarStatsEnabled)
Definition
DroppedVariableStats.cpp:21
llvm::Function
Definition
Function.h:64
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition
Module.h:67
llvm::PassInstrumentationCallbacks
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
Definition
PassInstrumentation.h:75
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition
StringRef.h:55
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
AddressRanges.h:18
llvm::VarID
std::tuple< const DIScope *, const DIScope *, const DILocalVariable * > VarID
A unique key that represents a debug variable.
Definition
DroppedVariableStats.h:36
Generated on
for LLVM by
1.14.0