Go to the documentation of this file.
50 cl::desc(
"Percentile profile summary cutoff used to "
51 "determine cold blocks. Unused if set to zero."),
55 "mfs-count-threshold",
57 "Minimum number of times a block must be executed to be retained."),
70 return "Machine Function Splitter Transformation";
92 bool MachineFunctionSplitter::runOnMachineFunction(
MachineFunction &MF) {
121 auto *MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
122 auto *PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
125 for (
auto &
MBB : MF) {
130 LandingPads.push_back(&
MBB);
136 bool HasHotLandingPads =
false;
139 HasHotLandingPads =
true;
141 if (!HasHotLandingPads) {
147 return X.getSectionID().Type <
Y.getSectionID().Type;
154 void MachineFunctionSplitter::getAnalysisUsage(
AnalysisUsage &AU)
const {
162 "Split machine functions using profile information",
false,
166 return new MachineFunctionSplitter();
This is an optimization pass for GlobalISel generic memory operations.
void sortBasicBlocksAndUpdateBranches(MachineFunction &MF, MachineBasicBlockComparator MBBCmp)
MachineFunctionPass * createMachineFunctionSplitterPass()
createMachineFunctionSplitterPass - This pass splits machine functions using profile information.
Optional< uint64_t > getBlockProfileCount(const MachineBasicBlock *MBB) const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
bool isEntryBlock() const
Returns true if this is the entry block of the function.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
INITIALIZE_PASS(MachineFunctionSplitter, "machine-function-splitter", "Split machine functions using profile information", false, false) MachineFunctionPass *llvm
constexpr bool hasValue() const
void setSectionID(MBBSectionID V)
Sets the section ID for this basic block.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
void initializeMachineFunctionSplitterPass(PassRegistry &)
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
Represent the analysis usage information of a pass.
static cl::opt< unsigned > ColdCountThreshold("mfs-count-threshold", cl::desc("Minimum number of times a block must be executed to be retained."), cl::init(1), cl::Hidden)
Optional< StringRef > getSectionPrefix() const
Get the section prefix for this function.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
LLVM_NODISCARD bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
Analysis providing profile information.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
bool hasSection() const
Check if this global has a custom object file section.
static cl::opt< unsigned > PercentileCutoff("mfs-psi-cutoff", cl::desc("Percentile profile summary cutoff used to " "determine cold blocks. Unused if set to zero."), cl::init(999950), cl::Hidden)
initializer< Ty > init(const Ty &Val)
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
constexpr const T & getValue() const &
static bool isColdBlock(const MachineBasicBlock &MBB, const MachineBlockFrequencyInfo *MBFI, ProfileSummaryInfo *PSI)
bool isEHPad() const
Returns true if the block is a landing pad.
StringRef - Represent a constant reference to a string, i.e.
Function & getFunction()
Return the LLVM function that this machine code represents.
const static MBBSectionID ColdSectionID
bool hasProfileData(bool IncludeSynthetic=false) const
Return true if the function is annotated with profile data.
AnalysisUsage & addRequired()
void setBBSectionsType(BasicBlockSection V)
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them.
bool isColdCountNthPercentile(int PercentileCutoff, uint64_t C) const
Returns true if count C is considered cold with regard to a given cold percentile cutoff value.