51 cl::desc(
"Percentile profile summary cutoff used to " 52 "determine cold blocks. Unused if set to zero."),
56 "mfs-count-threshold",
58 "Minimum number of times a block must be executed to be retained."),
71 return "Machine Function Splitter Transformation";
93 bool MachineFunctionSplitter::runOnMachineFunction(
MachineFunction &MF) {
121 auto *MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
122 auto *PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
124 for (
auto &
MBB : MF) {
135 return X.getSectionID().Type <
Y.getSectionID().Type;
142 void MachineFunctionSplitter::getAnalysisUsage(
AnalysisUsage &AU)
const {
150 "Split machine functions using profile information",
false,
154 return new MachineFunctionSplitter();
StringRef getSection() const
Get the custom section of this global if it has one.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void setSectionID(MBBSectionID V)
Sets the section ID for this basic block.
This class represents lattice values for constants.
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them.
void initializeMachineFunctionSplitterPass(PassRegistry &)
Analysis providing profile information.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
Function & getFunction()
Return the LLVM function that this machine code represents.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
AnalysisUsage & addRequired()
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Optional< uint64_t > getBlockProfileCount(const MachineBasicBlock *MBB) const
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)
void setBBSectionsType(BasicBlockSection V)
INITIALIZE_PASS(MachineFunctionSplitter, "machine-function-splitter", "Split machine functions using profile information", false, false) MachineFunctionPass *llvm
void sortBasicBlocksAndUpdateBranches(MachineFunction &MF, MachineBasicBlockComparator MBBCmp)
static const MBBSectionID ColdSectionID
initializer< Ty > init(const Ty &Val)
Represent the analysis usage information of a pass.
Optional< StringRef > getSectionPrefix() const
Get the section prefix for this function.
bool hasProfileData(bool IncludeSynthetic=false) const
Return true if the function is annotated with profile data.
static bool isColdBlock(MachineBasicBlock &MBB, const MachineBlockFrequencyInfo *MBFI, ProfileSummaryInfo *PSI)
Module.h This file contains the declarations for the Module class.
constexpr const T & getValue() const LLVM_LVALUE_FUNCTION
constexpr bool hasValue() const
MachineFunctionPass * createMachineFunctionSplitterPass()
createMachineFunctionSplitterPass - This pass splits machine functions using profile information.
LLVM_NODISCARD bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
bool isEHPad() const
Returns true if the block is a landing pad.
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.
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)
StringRef - Represent a constant reference to a string, i.e.