14#ifndef LLVM_CODEGEN_DROPPEDVARIABLESTATSIR_H
15#define LLVM_CODEGEN_DROPPEDVARIABLESTATSIR_H
33 if (
const auto *M = unwrapIR<Module>(
IR))
34 return this->runOnModule(M,
true);
35 if (
const auto *
F = unwrapIR<Function>(
IR))
36 return this->runOnFunction(
F,
true);
40 if (
const auto *M = unwrapIR<Module>(
IR))
41 runAfterPassModule(
P, M);
42 else if (
const auto *
F = unwrapIR<Function>(
IR))
43 runAfterPassFunction(
P,
F);
53 runOnFunction(
F,
false);
54 calculateDroppedVarStatsOnFunction(
F, PassID,
F->getName().str(),
58 void runAfterPassModule(StringRef PassID,
const Module *M) {
59 runOnModule(M,
false);
60 calculateDroppedVarStatsOnModule(M, PassID, M->getName().str(),
"Module");
65 void runOnFunction(
const Function *
F,
bool Before);
68 void calculateDroppedVarStatsOnFunction(
const Function *
F, StringRef PassID,
69 StringRef FuncOrModName,
74 void runOnModule(
const Module *M,
bool Before);
78 void calculateDroppedVarStatsOnModule(
const Module *M, StringRef PassID,
79 StringRef FuncOrModName,
83 visitEveryInstruction(
unsigned &DroppedCount,
84 DenseMap<VarID, DILocation *> &InlinedAtsMap,
88 virtual void visitEveryDebugRecord(
89 DenseSet<VarID> &VarIDSet,
90 DenseMap<StringRef, DenseMap<VarID, DILocation *>> &InlinedAtsMap,
91 StringRef FuncName,
bool Before)
override;
93 template <
typename IRUnitT>
static const IRUnitT *unwrapIR(Any
IR) {
94 const IRUnitT **IRPtr = llvm::any_cast<const IRUnitT *>(&
IR);
95 return IRPtr ? *IRPtr :
nullptr;
===- DroppedVariableStats.h - Opt Diagnostics -*- C++ -*-------------—===//
Module.h This file contains the declarations for the Module class.
Legalize the Machine IR a function s Machine IR
PassInstrumentationCallbacks PIC
A class to collect and print dropped debug information due to LLVM IR optimization passes.
void registerCallbacks(PassInstrumentationCallbacks &PIC)
DroppedVariableStatsIR(bool DroppedVarStatsEnabled)
void runAfterPass(StringRef P, Any IR)
void runBeforePass(Any IR)
A base class to collect and print dropped debug information variable statistics.
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...