36 const std::string &Banner)
const {
40bool MachineFunctionPass::runOnFunction(
Function &
F) {
43 if (
F.hasAvailableExternallyLinkage())
54 <<
" pass are not met by function " <<
F.getName() <<
".\n"
55 <<
"Required properties: ";
57 errs() <<
"\nCurrent properties: ";
64 unsigned CountBefore, CountAfter;
67 bool ShouldEmitSizeRemarks =
68 F.getParent()->shouldEmitInstrCountChangedRemark();
72 if (ShouldEmitSizeRemarks)
81 PassID = PI->getPassArgument();
87 if (ShouldPrintChanged) {
92 MFProps.
reset(ClearedProperties);
96 if (ShouldEmitSizeRemarks) {
100 if (CountBefore != CountAfter) {
103 int64_t Delta =
static_cast<int64_t
>(CountAfter) -
104 static_cast<int64_t
>(CountBefore);
109 <<
": Function: " <<
NV(
"Function",
F.getName()) <<
": "
110 <<
"MI Instruction count changed from "
111 <<
NV(
"MIInstrsBefore", CountBefore) <<
" to "
112 <<
NV(
"MIInstrsAfter", CountAfter)
113 <<
"; Delta: " <<
NV(
"Delta", Delta);
119 MFProps.
set(SetProperties);
123 if (ShouldPrintChanged || !IsInterestingPass) {
124 if (ShouldPrintChanged) {
128 if (IsInterestingPass && BeforeStr != AfterStr) {
130 ") on " + MF.
getName() +
" ***\n");
147 StringRef Removed = Color ?
"\033[31m-%l\033[0m\n" :
"-%l\n";
159 IsInterestingPass ?
" omitted because no change" :
" filtered out";
162 errs() <<
" (" << PassID <<
")";
163 errs() <<
" on " << MF.
getName() + Reason +
" ***\n";
This is the interface for LLVM's primary stateless and local alias analysis.
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.
This is the interface for a SCEV-based alias analysis.
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 a DominatorTree.
DISubprogram * getSubprogram() const
Get the attached subprogram.
Legacy wrapper pass to provide the GlobalsAAResult object.
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...
Properties which a MachineFunction may have at a given point in time.
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.
This class contains meta information specific to a module.
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.
PassInfo class - An instance of this class exists for every pass known by the system,...
Pass interface - Implemented by all 'passes'.
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
static const PassInfo * lookupPassInfo(const void *TI)
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Legacy wrapper pass to provide the SCEVAAResult object.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
DiagnosticInfoOptimizationBase::Argument NV
This is an optimization pass for GlobalISel generic memory operations.
cl::opt< ChangePrinter > PrintChanged
bool isFunctionInPrintList(StringRef FunctionName)
bool isPassInPrintList(StringRef PassName)
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
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...
std::string doSystemDiff(StringRef Before, StringRef After, StringRef OldLineFormat, StringRef NewLineFormat, StringRef UnchangedLineFormat)
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.