45 cl::desc(
"Dump dropped debug variables stats for MIR passes"),
49 const std::string &Banner)
const {
53bool MachineFunctionPass::runOnFunction(
Function &
F) {
56 if (
F.hasAvailableExternallyLinkage())
67 <<
" pass are not met by function " <<
F.getName() <<
".\n"
68 <<
"Required properties: ";
69 RequiredProperties.print(
errs());
70 errs() <<
"\nCurrent properties: ";
77 unsigned CountBefore, CountAfter;
80 bool ShouldEmitSizeRemarks =
81 F.getParent()->shouldEmitInstrCountChangedRemark();
85 if (ShouldEmitSizeRemarks)
88 MFProps.
reset(ClearedProperties);
92 DroppedVariableStatsMIR DroppedVarStatsMF;
101 if (ShouldEmitSizeRemarks) {
105 if (CountBefore != CountAfter) {
106 MachineOptimizationRemarkEmitter
MORE(MF,
nullptr);
108 int64_t Delta =
static_cast<int64_t
>(CountAfter) -
109 static_cast<int64_t
>(CountBefore);
110 MachineOptimizationRemarkAnalysis
R(
"size-info",
"FunctionMISizeChange",
114 <<
": Function: " <<
NV(
"Function",
F.getName()) <<
": "
115 <<
"MI Instruction count changed from "
116 <<
NV(
"MIInstrsBefore", CountBefore) <<
" to "
117 <<
NV(
"MIInstrsAfter", CountAfter)
118 <<
"; Delta: " <<
NV(
"Delta", Delta);
124 MFProps.
set(SetProperties);
131 if (
F.hasAvailableExternallyLinkage())
138 if (!SourceLocFilterEmpty &&
none_of(MF, [](
const MachineBasicBlock &
MBB) {
This is the interface for LLVM's primary stateless and local alias analysis.
This file declares an analysis pass that computes CycleInfo for LLVM IR, specialized from GenericCycl...
===- DroppedVariableStatsMIR.h - Opt Diagnostics -*- C++ -*----------—===//
This is the interface for a simple mod/ref and alias analysis over globals.
Module.h This file contains the declarations for the Module class.
static cl::opt< bool > DroppedVarStatsMIR("dropped-variable-stats-mir", cl::Hidden, cl::desc("Dump dropped debug variables stats for MIR passes"), cl::init(false))
This is the interface for a SCEV-based alias analysis.
static const char PassName[]
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
Legacy wrapper pass to provide the BasicAAResult object.
Legacy analysis pass which computes BranchProbabilityInfo.
Legacy analysis pass which computes a CycleInfo.
Legacy analysis pass which computes a DominatorTree.
void runBeforePass(StringRef PassID, MachineFunction *MF)
void runAfterPass(StringRef PassID, MachineFunction *MF)
DISubprogram * getSubprogram() const
Get the attached subprogram.
Legacy wrapper pass to provide the GlobalsAAResult object.
This is an alternative analysis pass to BlockFrequencyInfoWrapperPass.
This is an alternative analysis pass to BranchProbabilityInfoWrapperPass.
The legacy pass manager's analysis pass to compute loop information.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
LLVM_ABI void print(raw_ostream &OS) const
Print the MachineFunctionProperties in human-readable form.
bool verifyRequiredProperties(const MachineFunctionProperties &V) const
MachineFunctionProperties & set(Property P)
MachineFunctionProperties & reset(Property P)
unsigned getInstructionCount() const
Return the number of MachineInstrs in this MachineFunction.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Function & getFunction()
Return the LLVM function that this machine code represents.
const MachineFunctionProperties & getProperties() const
Get the function properties.
const MachineBasicBlock & front() const
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream.
LLVM_ABI MachineFunction & getOrCreateMachineFunction(Function &F)
Returns the MachineFunction constructed for the IR function F.
A wrapper analysis pass for the legacy pass manager that exposes a MemoryDepnedenceResults instance.
Pass interface - Implemented by all 'passes'.
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Legacy wrapper pass to provide the SCEVAAResult object.
This class implements an extremely fast bulk output stream that can only output to a stream.
initializer< Ty > init(const Ty &Val)
Add a small namespace to avoid name clashes with the classes used in the streaming interface.
DiagnosticInfoOptimizationBase::Argument NV
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool isSourceLocInPrintList(const DebugLoc &Loc)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI bool isFunctionInPrintList(StringRef FunctionName)
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI MachineFunctionPass * createMachineFunctionPrinterPass(raw_ostream &OS, const std::string &Banner="")
MachineFunctionPrinter pass - This pass prints out the machine function to the given stream as a debu...
LLVM_ABI bool isSourceLocFilterEmpty()
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.