LLVM 24.0.0git
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
18#include "llvm/IR/IRUnitRef.h"
20
21namespace llvm {
22
23class StringRef;
25class Function;
26class Module;
27
28/// A class to collect and print dropped debug information due to LLVM IR
29/// optimization passes. After every LLVM IR pass is run, it will print how many
30/// #dbg_values were dropped due to that pass.
32public:
33 DroppedVariableStatsIR(bool DroppedVarStatsEnabled)
34 : llvm::DroppedVariableStats(DroppedVarStatsEnabled) {}
35
36 void runBeforePass(StringRef P, IRUnitRef IR);
37
38 void runAfterPass(StringRef P, IRUnitRef IR);
39
41
42private:
43 const Function *Func;
44
45 void runAfterPassFunction(StringRef PassID, const Function *F);
46
47 void runAfterPassModule(StringRef PassID, const Module *M);
48
49 /// Populate DebugVariablesBefore or DebugVariablesAfter before or after a
50 /// pass has run to facilitate dropped variable calculation for an
51 /// llvm::Function.
52 void runOnFunction(StringRef PassID, const Function *F, bool Before);
53
54 /// Iterate over all Instructions in a Function and report any dropped debug
55 /// information.
56 void calculateDroppedVarStatsOnFunction(const Function *F, StringRef PassID,
57 StringRef FuncOrModName,
58 StringRef PassLevel);
59
60 /// Populate DebugVariablesBefore or DebugVariablesAfter before or after a
61 /// pass has run to facilitate dropped variable calculation for an
62 /// llvm::Module. Calls runOnFunction on every Function in the Module.
63 void runOnModule(StringRef PassID, const Module *M, bool Before);
64
65 /// Iterate over all Functions in a Module and report any dropped debug
66 /// information. Will call calculateDroppedVarStatsOnFunction on every
67 /// Function.
68 void calculateDroppedVarStatsOnModule(const Module *M, StringRef PassID,
69 StringRef FuncOrModName,
70 StringRef PassLevel);
71
72 /// Override base class method to run on an llvm::Function specifically.
73 void visitEveryInstruction(unsigned &DroppedCount, VarID Var) override;
74
75 /// Override base class method to run on #dbg_values specifically.
76 void visitEveryDebugRecord(DenseSet<VarID> &VarIDSet) override;
77};
78
79} // namespace llvm
80
81#endif
#define LLVM_ABI
Definition Compiler.h:211
===- DroppedVariableStats.h - Opt Diagnostics -*- C++ -*-------------—===//
static bool runOnFunction(Function &F, bool PostInlining)
This file defines IRUnitRef, a type-erased reference to the IR unit a pass or analysis is running on,...
Legalize the Machine IR a function s Machine IR
Definition Legalizer.cpp:85
#define F(x, y, z)
Definition MD5.cpp:54
#define P(N)
SI registerCallbacks(PIC, &MAM)
PassInstrumentationCallbacks PIC
Implements a dense probed hash-table based set.
Definition DenseSet.h:283
DroppedVariableStatsIR(bool DroppedVarStatsEnabled)
LLVM_ABI DroppedVariableStats(bool DroppedVarStatsEnabled)
A type-erased reference to the IR unit a pass or analysis is running on, together with the kind of IR...
Definition IRUnitRef.h:60
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
This is an optimization pass for GlobalISel generic memory operations.
DebugVariableAggregate VarID
A unique key that represents one instance of a debug variable.