[#llvm-MachineFunctionPass] = xref:llvm.adoc[llvm]::MachineFunctionPass :relfileprefix: ../ :mrdocs: FunctionPass adapter for passes that operate on a MachineFunction. == Synopsis Declared in `<llvm/CodeGen/MachineFunctionPass.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class MachineFunctionPass : public xref:llvm/FunctionPass.adoc[FunctionPass] ---- == Description This class adapts the FunctionPass interface to allow convenient creation of passes that operate on the MachineFunction representation. Instead of overriding runOnFunction, subclasses override runOnMachineFunction. == Base Classes [cols="1,4"] |=== | Name| Description | `xref:llvm/FunctionPass.adoc[FunctionPass]` | FunctionPass class ‐ This class is used to implement most global optimizations. Optimizations should subclass this class if they meet the following constraints: |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:llvm/Pass/operator_assign.adoc[`operator=`] [.small]#[deleted]# | Passes are not assignable. | xref:llvm/FunctionPass/assignPassManager.adoc[`assignPassManager`] [.small]#[virtual]# | Find or create a `FunctionPassManager` on `PMS` and register this pass. | xref:llvm/FunctionPass/createPrinterPass.adoc[`createPrinterPass`] [.small]#[virtual]# | createPrinterPass ‐ Get a function printer pass. | xref:llvm/Pass/doFinalization.adoc[`doFinalization`] [.small]#[virtual]# | Perform any cleanup needed after all passes have run. | xref:llvm/MachineFunctionPass/doInitialization.adoc[`doInitialization`] [.small]#[virtual]# | Cache this pass's MachineFunctionProperties at module initialization. | xref:llvm/Pass/dump.adoc[`dump`] | Print this pass's state to stderr for debugging. | xref:llvm/Pass/dumpPassStructure.adoc[`dumpPassStructure`] [.small]#[virtual]# | Print the pass nesting structure for ‐debug‐passes=PassStructure. | xref:llvm/Pass/getAnalysis-034.adoc[`getAnalysis`] | `getAnalysis` overloads | xref:llvm/Pass/getAnalysisID-08.adoc[`getAnalysisID`] | `getAnalysisID` overloads | xref:llvm/Pass/getAnalysisIfAvailable.adoc[`getAnalysisIfAvailable`] | Get an optional analysis result that may already be available. | xref:llvm/Pass/getAnalysisUsage.adoc[`getAnalysisUsage`] [.small]#[virtual]# | Declare which analyses this pass requires and preserves. | xref:llvm/Pass/getAsImmutablePass.adoc[`getAsImmutablePass`] [.small]#[virtual]# | Return this pass as an ImmutablePass, or null if it is not one. | xref:llvm/Pass/getAsPMDataManager.adoc[`getAsPMDataManager`] [.small]#[virtual]# | Return this pass as a PMDataManager when it is a nested pass manager. | xref:llvm/Pass/getPassArgument.adoc[`getPassArgument`] | Return a nice clean name for a pass corresponding to that used to enable the pass in opt. | xref:llvm/Pass/getPassID.adoc[`getPassID`] | getPassID ‐ Return the PassID number that corresponds to this pass. | xref:llvm/Pass/getPassKind.adoc[`getPassKind`] | Return the kind of pass (module, function, loop, etc.). | xref:llvm/Pass/getPassName.adoc[`getPassName`] [.small]#[virtual]# | Return a human‐readable name for this pass. | xref:llvm/FunctionPass/getPotentialPassManagerType.adoc[`getPotentialPassManagerType`] [.small]#[virtual]# | Return what kind of Pass Manager can manage this pass. | xref:llvm/Pass/getResolver.adoc[`getResolver`] | Return the analysis resolver installed for this pass. | xref:llvm/Pass/mustPreserveAnalysisID.adoc[`mustPreserveAnalysisID`] | Report whether the analysis identified by `AID` must be preserved. | xref:llvm/Pass/preparePassManager.adoc[`preparePassManager`] [.small]#[virtual]# | Check whether available pass managers are suitable for this pass. | xref:llvm/Pass/print.adoc[`print`] [.small]#[virtual]# | Print the internal state of this pass for analysis dumping. | xref:llvm/FunctionPass/printIRUnit.adoc[`printIRUnit`] [.small]#[virtual]# | Serialize the IR unit this pass operates on for ‐‐print‐changed. | xref:llvm/Pass/releaseMemory.adoc[`releaseMemory`] [.small]#[virtual]# | Release memory held by this pass when it is no longer needed. | xref:llvm/FunctionPass/runOnFunction.adoc[`runOnFunction`] [.small]#[virtual]# | runOnFunction ‐ Virtual method overriden by subclasses to do the per‐function processing of the pass. | xref:llvm/Pass/setResolver.adoc[`setResolver`] | Install the analysis resolver used to satisfy this pass's dependencies. | xref:llvm/Pass/verifyAnalysis.adoc[`verifyAnalysis`] [.small]#[virtual]# | verifyAnalysis() ‐ This member can be implemented by a analysis pass to check state of analysis information. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:llvm/Pass/createPass.adoc[`createPass`] | Construct a new instance of the pass identified by `ID.` | xref:llvm/Pass/lookupPassInfo-0e.adoc[`lookupPassInfo`] | `lookupPassInfo` overloads |=== == Protected Member Functions [cols="1,4"] |=== | Name| Description | xref:llvm/MachineFunctionPass/2constructor.adoc[`MachineFunctionPass`] [.small]#[constructor]# | Construct a MachineFunctionPass with the given pass identifier. | xref:llvm/MachineFunctionPass/getAnalysisUsage.adoc[`getAnalysisUsage`] [.small]#[virtual]# | getAnalysisUsage ‐ Subclasses that override getAnalysisUsage must call this. | xref:llvm/MachineFunctionPass/getClearedProperties.adoc[`getClearedProperties`] [.small]#[virtual]# | Return the MachineFunctionProperties this pass clears when it runs. | xref:llvm/MachineFunctionPass/getRequiredProperties.adoc[`getRequiredProperties`] [.small]#[virtual]# | Return the MachineFunctionProperties this pass requires before running. | xref:llvm/MachineFunctionPass/getSetProperties.adoc[`getSetProperties`] [.small]#[virtual]# | Return the MachineFunctionProperties this pass sets after running. | xref:llvm/MachineFunctionPass/runOnMachineFunction.adoc[`runOnMachineFunction`] [.small]#[virtual]# | runOnMachineFunction ‐ This method must be overloaded to perform the desired machine code transformation or analysis. | xref:llvm/FunctionPass/skipFunction.adoc[`skipFunction`] | Check whether this optional pass should be skipped for `F.` |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:llvm/createBasicBlockMatchingAndInferencePass.adoc[`createBasicBlockMatchingAndInferencePass`] | createBasicBlockMatchingAndInferencePass ‐ This pass enables matching and inference when using propeller. | xref:llvm/createBasicBlockPathCloningPass.adoc[`createBasicBlockPathCloningPass`] | Create a pass that clones machine basic‐block paths for BB sections. | xref:llvm/createBasicBlockSectionsPass.adoc[`createBasicBlockSectionsPass`] | createBasicBlockSections Pass ‐ This pass assigns sections to machine basic blocks and is enabled with ‐fbasic‐block‐sections. | xref:llvm/createGCEmptyBasicBlocksLegacyPass.adoc[`createGCEmptyBasicBlocksLegacyPass`] | Create a pass that garbage‐collects empty machine basic blocks. | xref:llvm/createInsertCodePrefetchPass.adoc[`createInsertCodePrefetchPass`] | createInsertCodePrefetchPass ‐ This pass enables inserting code prefetch hints based on the basic block section profile. | xref:llvm/createMIR2VecPrinterLegacyPass.adoc[`createMIR2VecPrinterLegacyPass`] | MIR2VecPrinter pass ‐ This pass prints out the MIR2Vec embeddings for machine functions, basic blocks and instructions. | xref:llvm/createMIR2VecVocabPrinterLegacyPass.adoc[`createMIR2VecVocabPrinterLegacyPass`] | MIR2VecVocabPrinter pass ‐ This pass prints out the MIR2Vec vocabulary contents to the given stream as a debugging tool. | xref:llvm/createMachineBlockHashInfoPass.adoc[`createMachineBlockHashInfoPass`] | createMachineBlockHashInfoPass ‐ This pass computes basic block hashes. | xref:llvm/createMachineCopyPropagationPass.adoc[`createMachineCopyPropagationPass`] | Create a pass that performs copy propagation on machine instructions. | xref:llvm/createMachineFunctionPrinterPass.adoc[`createMachineFunctionPrinterPass`] | MachineFunctionPrinter pass ‐ This pass prints out the machine function to the given stream as a debugging tool. | xref:llvm/createMachineFunctionSplitterPass.adoc[`createMachineFunctionSplitterPass`] | createMachineFunctionSplitterPass ‐ This pass splits machine functions using profile information. | xref:llvm/createPrintMIRPass.adoc[`createPrintMIRPass`] | MIRPrinting pass ‐ this pass prints out the LLVM IR into the given stream using the MIR serialization format. | xref:llvm/createPrologEpilogInserterPass.adoc[`createPrologEpilogInserterPass`] | Create a pass that inserts prolog/epilog code and eliminates frame refs. | xref:llvm/createResetMachineFunctionPass.adoc[`createResetMachineFunctionPass`] | Create a pass that resets MachineFunctions that failed ISel. | xref:llvm/createStackFrameLayoutAnalysisPass.adoc[`createStackFrameLayoutAnalysisPass`] | StackFramePrinter pass ‐ This pass prints out the machine function's stack frame to the given stream as a debugging tool. | xref:llvm/createStaticDataSplitterLegacyPass.adoc[`createStaticDataSplitterLegacyPass`] | createStaticDataSplitterPass ‐ This is a machine‐function pass that categorizes static data hotness using profile information. | xref:llvm/getBestSimplifyQuery-05.adoc[`getBestSimplifyQuery`] | Build a SimplifyQuery from analyses currently valid in a pass. | xref:llvm/getPassTimer.adoc[`getPassTimer`] | Request the timer for this legacy‐pass‐manager's pass instance. | xref:llvm/isBitcodeWriterPass.adoc[`isBitcodeWriterPass`] | Check whether a pass is a BitcodeWriterPass. | xref:llvm/isIRPrintingPass.adoc[`isIRPrintingPass`] | Return true if a pass is for IR printing. |=== == Derived Classes [cols="1,4"] |=== | Name| Description | xref:llvm/AsmPrinter.adoc[`AsmPrinter`] | This class is intended to be used as a driving class for all asm writers. | xref:llvm/BasicBlockMatchingAndInference.adoc[`BasicBlockMatchingAndInference`] | Pass that matches Propeller profile basic blocks and infers their weights. | xref:llvm/CFIFixupLegacy.adoc[`CFIFixupLegacy`] | Legacy MachineFunctionPass that inserts CFI remember/restore instructions. | xref:llvm/EdgeBundlesWrapperLegacy.adoc[`EdgeBundlesWrapperLegacy`] | Legacy MachineFunctionPass wrapper that computes and owns `EdgeBundles.` | xref:llvm/ExecutionDomainFix.adoc[`ExecutionDomainFix`] | Machine function pass that rewrites variant instructions to minimize execution domain crossings. | xref:llvm/GISelCSEAnalysisWrapperPass.adoc[`GISelCSEAnalysisWrapperPass`] | The actual analysis pass wrapper. | xref:llvm/GISelValueTrackingAnalysisLegacy.adoc[`GISelValueTrackingAnalysisLegacy`] | Legacy MachineFunctionPass that owns a GISelValueTracking instance. | xref:llvm/IRTranslatorLegacy.adoc[`IRTranslatorLegacy`] | Legacy pass that translates LLVM IR into MachineInstr for GlobalISel. | xref:llvm/InstructionSelectLegacy.adoc[`InstructionSelectLegacy`] | Legacy pass that selects generic machine instructions to target instructions. | xref:llvm/LazyMachineBlockFrequencyInfoPass.adoc[`LazyMachineBlockFrequencyInfoPass`] | Alternative analysis pass that computes machine block frequencies on demand. | xref:llvm/LegalizerLegacy.adoc[`LegalizerLegacy`] | Legacy pass that legalizes generic machine instructions for GlobalISel. | xref:llvm/LiveDebugVariablesWrapperLegacy.adoc[`LiveDebugVariablesWrapperLegacy`] | Legacy pass wrapper for LiveDebugVariables. | xref:llvm/LiveIntervalsWrapperPass.adoc[`LiveIntervalsWrapperPass`] | Legacy MachineFunctionPass wrapper around LiveIntervals. | xref:llvm/LiveRegMatrixWrapperLegacy.adoc[`LiveRegMatrixWrapperLegacy`] | Legacy MachineFunctionPass wrapper that computes and owns `LiveRegMatrix.` | xref:llvm/LiveStacksWrapperLegacy.adoc[`LiveStacksWrapperLegacy`] | Legacy pass wrapper for LiveStacks. | xref:llvm/LiveVariablesWrapperPass.adoc[`LiveVariablesWrapperPass`] | Legacy pass wrapper for LiveVariables. | xref:llvm/LoadStoreOptLegacy.adoc[`LoadStoreOptLegacy`] | Legacy pass that merges consecutive GlobalISel loads and stores. | xref:llvm/LocalizerLegacy.adoc[`LocalizerLegacy`] | Legacy pass that localizes constant‐like instructions near their uses. | xref:llvm/MIR2VecPrinterLegacyPass.adoc[`MIR2VecPrinterLegacyPass`] | This pass prints the MIR2Vec embeddings for machine functions, basic blocks, and instructions | xref:llvm/MIR2VecVocabPrinterLegacyPass.adoc[`MIR2VecVocabPrinterLegacyPass`] | This pass prints the embeddings in the MIR2Vec vocabulary | xref:llvm/MIRAddFSDiscriminators.adoc[`MIRAddFSDiscriminators`] | MIR pass that adds flow‐sensitive discriminators to instruction debug info. | xref:llvm/MIRProfileLoaderPass.adoc[`MIRProfileLoaderPass`] | Machine function pass that loads SampleFDO profile data into MIR. | xref:llvm/MachineBlockFrequencyInfoWrapperPass.adoc[`MachineBlockFrequencyInfoWrapperPass`] | Legacy analysis pass which computes `MachineBlockFrequencyInfo.` | xref:llvm/MachineBlockHashInfo.adoc[`MachineBlockHashInfo`] | Legacy MachineFunctionPass for MachineBlockHashInfo. | xref:llvm/MachineCycleInfoWrapperPass.adoc[`MachineCycleInfoWrapperPass`] | Legacy analysis pass which computes a xref:llvm/MachineCycleInfo.adoc[`MachineCycleInfo`]. | xref:llvm/MachineDominanceFrontierWrapperPass.adoc[`MachineDominanceFrontierWrapperPass`] | Legacy analysis pass which computes a `MachineDominanceFrontier.` | xref:llvm/MachineDominatorTreeWrapperPass.adoc[`MachineDominatorTreeWrapperPass`] | Analysis pass which computes a `MachineDominatorTree.` | xref:llvm/MachineLoopInfoWrapperPass.adoc[`MachineLoopInfoWrapperPass`] | The legacy pass manager's analysis pass to compute machine loop information. | xref:llvm/MachineOptimizationRemarkEmitterPass.adoc[`MachineOptimizationRemarkEmitterPass`] | The analysis pass | xref:llvm/MachinePipeliner.adoc[`MachinePipeliner`] | The main class in the implementation of the target independent software pipeliner pass. | xref:llvm/MachinePostDominatorTreeWrapperPass.adoc[`MachinePostDominatorTreeWrapperPass`] | Analysis pass which computes a `MachinePostDominatorTree.` | xref:llvm/MachineRegionInfoPass.adoc[`MachineRegionInfoPass`] | Legacy MachineFunctionPass wrapper that computes MachineRegionInfo. | xref:llvm/MachineRegisterClassInfoWrapperPass.adoc[`MachineRegisterClassInfoWrapperPass`] | Legacy machine function pass wrapping RegisterClassInfo. | xref:llvm/MachineTraceMetricsWrapperPass.adoc[`MachineTraceMetricsWrapperPass`] | Legacy pass manager wrapper around MachineTraceMetrics. | xref:llvm/MachineUniformityAnalysisPass.adoc[`MachineUniformityAnalysisPass`] | Legacy analysis pass which computes a xref:llvm/MachineUniformityInfo.adoc[`MachineUniformityInfo`]. | xref:llvm/ReachingDefInfoWrapperPass.adoc[`ReachingDefInfoWrapperPass`] | Legacy pass wrapper for ReachingDefInfo. | xref:llvm/RegBankSelectLegacy.adoc[`RegBankSelectLegacy`] | Legacy pass that assigns register banks to generic virtual registers. | xref:llvm/SelectionDAGISelLegacy.adoc[`SelectionDAGISelLegacy`] | Legacy pass‐manager wrapper that owns a SelectionDAGISel and runs it. | xref:llvm/SlotIndexesWrapperPass.adoc[`SlotIndexesWrapperPass`] | Legacy MachineFunctionPass wrapper around SlotIndexes. | xref:llvm/SpillPlacementWrapperLegacy.adoc[`SpillPlacementWrapperLegacy`] | Legacy machine function pass wrapping SpillPlacement. | xref:llvm/ThunkInserterPass.adoc[`ThunkInserterPass`] | Basic implementation of MachineFunctionPass wrapping one or more `ThunkInserter`s passed as type parameters. | xref:llvm/VirtRegMapWrapperLegacy.adoc[`VirtRegMapWrapperLegacy`] | Legacy MachineFunctionPass wrapper that owns a `VirtRegMap.` |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#