LLVM 24.0.0git
llvm::CodeGenPassBuilder Class Reference

This class provides access to building LLVM's passes. More...

#include "llvm/Passes/CodeGenPassBuilder.h"

Inheritance diagram for llvm::CodeGenPassBuilder:
[legend]

Public Member Functions

 CodeGenPassBuilder (TargetMachine &TM, const CGPassBuilderOption &Opts, PassInstrumentationCallbacks *PIC)
 CodeGenPassBuilder (const CodeGenPassBuilder &)=delete
CodeGenPassBuilderoperator= (const CodeGenPassBuilder &)=delete
virtual ~CodeGenPassBuilder ()
Error buildPipeline (ModulePassManager &MPM, ModuleAnalysisManager &MAM, raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType, MCContext &Ctx)
PassInstrumentationCallbacksgetPassInstrumentationCallbacks () const

Protected Types

template<typename PassT>
using is_module_pass_t
template<typename PassT>
using is_function_pass_t
template<typename PassT>
using is_machine_function_pass_t

Protected Member Functions

template<typename PassT>
void addFunctionPass (PassT &&Pass, PassManagerWrapper &PMW, bool Force=false, StringRef Name=PassT::name())
template<typename PassT>
void addModulePass (PassT &&Pass, PassManagerWrapper &PMW, bool Force=false, StringRef Name=PassT::name())
template<typename PassT>
void addMachineFunctionPass (PassT &&Pass, PassManagerWrapper &PMW, bool Force=false, StringRef Name=PassT::name())
void flushFPMsToMPM (PassManagerWrapper &PMW, bool FreeMachineFunctions=false)
void requireCGSCCOrder (PassManagerWrapper &PMW)
void stopAddingInCGSCCOrder (PassManagerWrapper &PMW)
CodeGenOptLevel getOptLevel () const
bool isGlobalISelAbortEnabled () const
 Check whether or not GlobalISel should abort on error.
bool reportDiagnosticWhenGlobalISelFallback () const
 Check whether or not a diagnostic should be emitted when GlobalISel uses the fallback path.
virtual Error addInstSelector (PassManagerWrapper &PMW)
 addInstSelector - This method should install an instruction selector pass, which converts from LLVM code to machine instructions.
virtual void addGlobalMergePass (PassManagerWrapper &PMW)
 Target can override this to add GlobalMergePass before all IR passes.
virtual void addILPOpts (PassManagerWrapper &PMW)
 Add passes that optimize instruction level parallelism for out-of-order targets.
virtual void addPreRegAlloc (PassManagerWrapper &PMW)
 This method may be implemented by targets that want to run passes immediately before register allocation.
virtual void addPreRewrite (PassManagerWrapper &PMW)
 addPreRewrite - Add passes to the optimized register allocation pipeline after register allocation is complete, but before virtual registers are rewritten to physical registers.
virtual void addPostRewrite (PassManagerWrapper &PMW)
 Add passes to be run immediately after virtual registers are rewritten to physical registers.
virtual void addPostRegAlloc (PassManagerWrapper &PMW)
 This method may be implemented by targets that want to run passes after register allocation pass pipeline but before prolog-epilog insertion.
virtual void addPreSched2 (PassManagerWrapper &PMW)
 This method may be implemented by targets that want to run passes after prolog-epilog insertion and before the second instruction scheduling pass.
virtual void addPreEmitPass (PassManagerWrapper &PMW)
 This pass may be implemented by targets that want to run passes immediately before machine code is emitted.
virtual void addPreEmitPass2 (PassManagerWrapper &PMW)
 Targets may add passes immediately before machine code is emitted in this callback.
virtual void addPreISel (PassManagerWrapper &PMW)
 {{@ For GlobalISel
virtual Error addIRTranslator (PassManagerWrapper &PMW)
 This method should install an IR translator pass, which converts from LLVM code to machine instructions with possibly generic opcodes.
virtual void addPreLegalizeMachineIR (PassManagerWrapper &PMW)
 This method may be implemented by targets that want to run passes immediately before legalization.
virtual Error addLegalizeMachineIR (PassManagerWrapper &PMW)
 This method should install a legalize pass, which converts the instruction sequence into one that can be selected by the target.
virtual void addPreRegBankSelect (PassManagerWrapper &PMW)
 This method may be implemented by targets that want to run passes immediately before the register bank selection.
virtual Error addRegBankSelect (PassManagerWrapper &PMW)
 This method should install a register bank selector pass, which assigns register banks to virtual registers without a register class or register banks.
virtual void addPreGlobalInstructionSelect (PassManagerWrapper &PMW)
 This method may be implemented by targets that want to run passes immediately before the (global) instruction selection.
virtual Error addGlobalInstructionSelect (PassManagerWrapper &PMW)
 This method should install a (global) instruction selector pass, which converts possibly generic instructions to fully target-specific instructions, thereby constraining all generic virtual registers to register classes.
void addISelPasses (PassManagerWrapper &PMW)
 High level function that adds all passes necessary to go from llvm IR representation to the MI representation.
Error addCoreISelPasses (PassManagerWrapper &PMW)
 Add the actual instruction selection passes.
virtual Error addMachinePasses (PassManagerWrapper &PMW)
 Add the complete, standard set of LLVM CodeGen passes.
void addPassesToHandleExceptions (PassManagerWrapper &PMW)
 Add passes to lower exception handling for the code generator.
virtual void addIRPasses (PassManagerWrapper &PMW)
 Add common target configurable passes that perform LLVM IR to IR transforms following machine independent optimization.
virtual void addCodeGenPrepare (PassManagerWrapper &PMW)
 Add pass to prepare the LLVM IR for code generation.
virtual void addISelPrepare (PassManagerWrapper &PMW)
 Add common passes that perform LLVM IR to IR transforms in preparation for instruction selection.
virtual void addMachineSSAOptimization (PassManagerWrapper &PMW)
 Methods with trivial inline returns are convenient points in the common codegen pass pipeline where targets may insert passes.
virtual Error addFastRegAlloc (PassManagerWrapper &PMW)
 addFastRegAlloc - Add the minimum set of target-independent passes that are required for fast register allocation.
virtual Error addOptimizedRegAlloc (PassManagerWrapper &PMW)
 addOptimizedRegAlloc - Add passes related to register allocation.
virtual void addMachineLateOptimization (PassManagerWrapper &PMW)
 Add passes that optimize machine instructions after register allocation.
virtual void addGCPasses (PassManagerWrapper &PMW)
 addGCPasses - Add late codegen passes that analyze code for garbage collection.
virtual void addBlockPlacement (PassManagerWrapper &PMW)
 Add standard basic block placement passes.
virtual void addPostBBSections (PassManagerWrapper &PMW)
virtual void addAsmPrinterBegin (PassManagerWrapper &PMW)
virtual void addAsmPrinter (PassManagerWrapper &PMW)
virtual void addAsmPrinterEnd (PassManagerWrapper &PMW)
virtual void addTargetRegisterAllocator (PassManagerWrapper &PMW, bool Optimized)
 Utilities for targets to add passes to the pass manager.
void addRegAllocPass (PassManagerWrapper &PMW, bool Optimized)
 addMachinePasses helper to create the target-selected or overriden regalloc pass.
virtual Error addRegAssignAndRewriteFast (PassManagerWrapper &PMW)
 Add core register allocator passes which do the actual register assignment and rewriting.
virtual Expected< booladdRegAssignAndRewriteOptimized (PassManagerWrapper &PMW)
template<typename... PassTs>
void disablePass ()
 Allow the target to disable a specific pass by default.
template<typename TargetPassT, typename InsertedPassT>
void insertPass (InsertedPassT &&Pass)
 Insert InsertedPass pass after TargetPass pass.

Protected Attributes

TargetMachineTM
CGPassBuilderOption Opt
PassInstrumentationCallbacksPIC

Detailed Description

This class provides access to building LLVM's passes.

Its members provide the baseline state available to passes during their construction. The MachinePassRegistry.def file specifies how to construct all of the built-in passes, and those may reference these members during construction.

Targets customize the pipeline by deriving from this class and overriding the virtual add* hooks below: the addStage hooks replace a whole stage of the pipeline, while the addPreStage / addPostStage hooks inject passes around one. See addMachinePasses for how they fit together.

Dispatch is virtual rather than templated on the derived builder so that the target-independent pipeline is emitted once for the whole build instead of once per target.

Definition at line 86 of file CodeGenPassBuilder.h.

Member Typedef Documentation

◆ is_function_pass_t

template<typename PassT>
using llvm::CodeGenPassBuilder::is_function_pass_t
protected
Initial value:
decltype(std::declval<PassT &>().run(
std::declval<Function &>(), std::declval<FunctionAnalysisManager &>()))

Definition at line 108 of file CodeGenPassBuilder.h.

◆ is_machine_function_pass_t

template<typename PassT>
using llvm::CodeGenPassBuilder::is_machine_function_pass_t
protected
Initial value:
decltype(std::declval<PassT &>().run(
std::declval<MachineFunction &>(),
std::declval<MachineFunctionAnalysisManager &>()))

Definition at line 112 of file CodeGenPassBuilder.h.

◆ is_module_pass_t

template<typename PassT>
using llvm::CodeGenPassBuilder::is_module_pass_t
protected
Initial value:
decltype(std::declval<PassT &>().run(
std::declval<Module &>(), std::declval<ModuleAnalysisManager &>()))

Definition at line 104 of file CodeGenPassBuilder.h.

Constructor & Destructor Documentation

◆ CodeGenPassBuilder() [1/2]

CodeGenPassBuilder::CodeGenPassBuilder ( TargetMachine & TM,
const CGPassBuilderOption & Opts,
PassInstrumentationCallbacks * PIC )

◆ CodeGenPassBuilder() [2/2]

llvm::CodeGenPassBuilder::CodeGenPassBuilder ( const CodeGenPassBuilder & )
delete

References CodeGenPassBuilder().

◆ ~CodeGenPassBuilder()

CodeGenPassBuilder::~CodeGenPassBuilder ( )
virtualdefault

References buildPipeline(), and MAM.

Member Function Documentation

◆ addAsmPrinter()

void CodeGenPassBuilder::addAsmPrinter ( PassManagerWrapper & PMW)
protectedvirtual

Reimplemented in R600CodeGenPassBuilder.

Definition at line 201 of file CodeGenPassBuilder.cpp.

References llvm_unreachable.

Referenced by buildPipeline().

◆ addAsmPrinterBegin()

void CodeGenPassBuilder::addAsmPrinterBegin ( PassManagerWrapper & PMW)
protectedvirtual

Reimplemented in R600CodeGenPassBuilder.

Definition at line 197 of file CodeGenPassBuilder.cpp.

References llvm_unreachable.

Referenced by buildPipeline().

◆ addAsmPrinterEnd()

void CodeGenPassBuilder::addAsmPrinterEnd ( PassManagerWrapper & PMW)
protectedvirtual

Reimplemented in R600CodeGenPassBuilder.

Definition at line 205 of file CodeGenPassBuilder.cpp.

References llvm_unreachable.

Referenced by buildPipeline().

◆ addBlockPlacement()

void CodeGenPassBuilder::addBlockPlacement ( PassManagerWrapper & PMW)
protectedvirtual

Add standard basic block placement passes.

Definition at line 944 of file CodeGenPassBuilder.cpp.

References addMachineFunctionPass(), and Opt.

Referenced by addMachinePasses().

◆ addCodeGenPrepare()

void CodeGenPassBuilder::addCodeGenPrepare ( PassManagerWrapper & PMW)
protectedvirtual

Add pass to prepare the LLVM IR for code generation.

This should be done before exception handling preparation passes.

Definition at line 491 of file CodeGenPassBuilder.cpp.

References addFunctionPass(), getOptLevel(), llvm::None, Opt, and TM.

Referenced by addISelPasses().

◆ addCoreISelPasses()

◆ addFastRegAlloc()

Error CodeGenPassBuilder::addFastRegAlloc ( PassManagerWrapper & PMW)
protectedvirtual

addFastRegAlloc - Add the minimum set of target-independent passes that are required for fast register allocation.

Add the minimum set of target-independent passes that are required for register allocation.

No coalescing or scheduling.

Definition at line 845 of file CodeGenPassBuilder.cpp.

References addMachineFunctionPass(), and addRegAssignAndRewriteFast().

Referenced by addMachinePasses().

◆ addFunctionPass()

template<typename PassT>
void llvm::CodeGenPassBuilder::addFunctionPass ( PassT && Pass,
PassManagerWrapper & PMW,
bool Force = false,
StringRef Name = PassT::name() )
inlineprotected

◆ addGCPasses()

virtual void llvm::CodeGenPassBuilder::addGCPasses ( PassManagerWrapper & PMW)
inlineprotectedvirtual

addGCPasses - Add late codegen passes that analyze code for garbage collection.

This should return true if GC info should be printed after these passes.

Definition at line 342 of file CodeGenPassBuilder.h.

Referenced by addMachinePasses().

◆ addGlobalInstructionSelect()

Error CodeGenPassBuilder::addGlobalInstructionSelect ( PassManagerWrapper & PMW)
protectedvirtual

This method should install a (global) instruction selector pass, which converts possibly generic instructions to fully target-specific instructions, thereby constraining all generic virtual registers to register classes.

Definition at line 192 of file CodeGenPassBuilder.cpp.

References llvm::inconvertibleErrorCode(), and llvm::make_error().

Referenced by addCoreISelPasses().

◆ addGlobalMergePass()

virtual void llvm::CodeGenPassBuilder::addGlobalMergePass ( PassManagerWrapper & PMW)
inlineprotectedvirtual

Target can override this to add GlobalMergePass before all IR passes.

Definition at line 197 of file CodeGenPassBuilder.h.

Referenced by addISelPasses().

◆ addILPOpts()

virtual void llvm::CodeGenPassBuilder::addILPOpts ( PassManagerWrapper & PMW)
inlineprotectedvirtual

Add passes that optimize instruction level parallelism for out-of-order targets.

These passes are run while the machine code is still in SSA form, so they can use MachineTraceMetrics to control their heuristics.

All passes added here should preserve the MachineDominatorTree, MachineLoopInfo, and MachineTraceMetrics analyses.

Definition at line 205 of file CodeGenPassBuilder.h.

Referenced by addMachineSSAOptimization().

◆ addInstSelector()

Error CodeGenPassBuilder::addInstSelector ( PassManagerWrapper & PMW)
protectedvirtual

addInstSelector - This method should install an instruction selector pass, which converts from LLVM code to machine instructions.

Reimplemented in R600CodeGenPassBuilder.

Definition at line 172 of file CodeGenPassBuilder.cpp.

References llvm::inconvertibleErrorCode(), and llvm::make_error().

Referenced by addCoreISelPasses().

◆ addIRPasses()

void CodeGenPassBuilder::addIRPasses ( PassManagerWrapper & PMW)
protectedvirtual

Add common target configurable passes that perform LLVM IR to IR transforms following machine independent optimization.

Definition at line 378 of file CodeGenPassBuilder.cpp.

References addFunctionPass(), addModulePass(), llvm::createFunctionToLoopPassAdaptor(), flushFPMsToMPM(), getOptLevel(), llvm::detail::InfoMixin< ShadowStackGCLoweringPass >::name(), llvm::None, Opt, and TM.

Referenced by addISelPasses().

◆ addIRTranslator()

Error CodeGenPassBuilder::addIRTranslator ( PassManagerWrapper & PMW)
protectedvirtual

This method should install an IR translator pass, which converts from LLVM code to machine instructions with possibly generic opcodes.

Definition at line 177 of file CodeGenPassBuilder.cpp.

References llvm::inconvertibleErrorCode(), and llvm::make_error().

Referenced by addCoreISelPasses().

◆ addISelPasses()

void CodeGenPassBuilder::addISelPasses ( PassManagerWrapper & PMW)
protected

High level function that adds all passes necessary to go from llvm IR representation to the MI representation.

Adds IR based lowering and target specific optimization passes and finally the core instruction selection passes.

Definition at line 356 of file CodeGenPassBuilder.cpp.

References addCodeGenPrepare(), addFunctionPass(), addGlobalMergePass(), addIRPasses(), addISelPrepare(), addModulePass(), addPassesToHandleExceptions(), flushFPMsToMPM(), getOptLevel(), llvm::None, and TM.

Referenced by buildPipeline().

◆ addISelPrepare()

void CodeGenPassBuilder::addISelPrepare ( PassManagerWrapper & PMW)
protectedvirtual

Add common passes that perform LLVM IR to IR transforms in preparation for instruction selection.

Definition at line 500 of file CodeGenPassBuilder.cpp.

References addFunctionPass(), addPreISel(), llvm::dbgs(), Opt, requireCGSCCOrder(), and TM.

Referenced by addISelPasses().

◆ addLegalizeMachineIR()

Error CodeGenPassBuilder::addLegalizeMachineIR ( PassManagerWrapper & PMW)
protectedvirtual

This method should install a legalize pass, which converts the instruction sequence into one that can be selected by the target.

Definition at line 182 of file CodeGenPassBuilder.cpp.

References llvm::inconvertibleErrorCode(), and llvm::make_error().

Referenced by addCoreISelPasses().

◆ addMachineFunctionPass()

template<typename PassT>
void llvm::CodeGenPassBuilder::addMachineFunctionPass ( PassT && Pass,
PassManagerWrapper & PMW,
bool Force = false,
StringRef Name = PassT::name() )
inlineprotected

◆ addMachineLateOptimization()

void CodeGenPassBuilder::addMachineLateOptimization ( PassManagerWrapper & PMW)
protectedvirtual

Add passes that optimize machine instructions after register allocation.

Post RegAlloc Pass Configuration.

Add passes that optimize machine instructions after register allocation.

Definition at line 925 of file CodeGenPassBuilder.cpp.

References addMachineFunctionPass(), Opt, and TM.

Referenced by addMachinePasses().

◆ addMachinePasses()

Error CodeGenPassBuilder::addMachinePasses ( PassManagerWrapper & PMW)
protectedvirtual

Add the complete, standard set of LLVM CodeGen passes.

Add the complete set of target-independent postISel code generator passes.

Fully developed targets will not generally override this.

This can be read as the standard order of major LLVM CodeGen stages. Stages with nontrivial configuration or multiple passes are broken out below in addStage routines.

Any CodeGenPassBuilder::addXX routine may be overriden by the Target. The addPre/Post methods with empty header implementations allow injecting target-specific fixups just before or after major stages. Additionally, targets have the flexibility to change pass order within a stage by overriding default implementation of addStage routines below. Each technique has maintainability tradeoffs because alternate pass orders are not well supported. addPre/Post works better if the target pass is easily tied to a common pass. But if it has subtle dependencies on multiple passes, the target should override the stage instead.

Add passes that optimize machine instructions after register allocation.

Definition at line 614 of file CodeGenPassBuilder.cpp.

References addBlockPlacement(), addFastRegAlloc(), addGCPasses(), addMachineFunctionPass(), addMachineLateOptimization(), addMachineSSAOptimization(), addModulePass(), addOptimizedRegAlloc(), addPostBBSections(), addPostRegAlloc(), addPreEmitPass(), addPreEmitPass2(), addPreRegAlloc(), addPreSched2(), llvm::cl::BOU_TRUE, llvm::errs(), flushFPMsToMPM(), getOptLevel(), llvm::NeverOutline, llvm::None, Opt, llvm::Error::success(), llvm::TargetDefault, and TM.

Referenced by buildPipeline().

◆ addMachineSSAOptimization()

void CodeGenPassBuilder::addMachineSSAOptimization ( PassManagerWrapper & PMW)
protectedvirtual

Methods with trivial inline returns are convenient points in the common codegen pass pipeline where targets may insert passes.

Add passes that optimize machine instructions in SSA form.

Methods with out-of-line standard implementations are major CodeGen stages called by addMachinePasses. Some targets may override major stages when inserting passes is insufficient, but maintaining overriden stages is more work. addMachineSSAOptimization - Add standard passes that optimize machine instructions in SSA form.

Definition at line 736 of file CodeGenPassBuilder.cpp.

References addILPOpts(), addMachineFunctionPass(), and Opt.

Referenced by addMachinePasses().

◆ addModulePass()

template<typename PassT>
void llvm::CodeGenPassBuilder::addModulePass ( PassT && Pass,
PassManagerWrapper & PMW,
bool Force = false,
StringRef Name = PassT::name() )
inlineprotected

◆ addOptimizedRegAlloc()

Error CodeGenPassBuilder::addOptimizedRegAlloc ( PassManagerWrapper & PMW)
protectedvirtual

addOptimizedRegAlloc - Add passes related to register allocation.

Add standard target-independent passes that are tightly coupled with optimized register allocation, including coalescing, machine instruction scheduling, and register allocation itself.

CodeGenTargetMachineImpl provides standard regalloc passes for most targets.

Definition at line 854 of file CodeGenPassBuilder.cpp.

References addMachineFunctionPass(), addPostRewrite(), addRegAssignAndRewriteOptimized(), llvm::Expected< T >::get(), Opt, llvm::Error::success(), llvm::Expected< T >::takeError(), and TM.

Referenced by addMachinePasses().

◆ addPassesToHandleExceptions()

void CodeGenPassBuilder::addPassesToHandleExceptions ( PassManagerWrapper & PMW)
protected

Add passes to lower exception handling for the code generator.

Turn exception handling constructs into something the code generators can handle.

Definition at line 447 of file CodeGenPassBuilder.cpp.

References addFunctionPass(), llvm::AIX, llvm::ARM, llvm::DwarfCFI, llvm::MCAsmInfo::getExceptionHandlingType(), llvm::None, llvm::SjLj, TM, llvm::Wasm, llvm::WinEH, and llvm::ZOS.

Referenced by addISelPasses().

◆ addPostBBSections()

virtual void llvm::CodeGenPassBuilder::addPostBBSections ( PassManagerWrapper & PMW)
inlineprotectedvirtual

Definition at line 347 of file CodeGenPassBuilder.h.

Referenced by addMachinePasses().

◆ addPostRegAlloc()

virtual void llvm::CodeGenPassBuilder::addPostRegAlloc ( PassManagerWrapper & PMW)
inlineprotectedvirtual

This method may be implemented by targets that want to run passes after register allocation pass pipeline but before prolog-epilog insertion.

Definition at line 231 of file CodeGenPassBuilder.h.

Referenced by addMachinePasses().

◆ addPostRewrite()

virtual void llvm::CodeGenPassBuilder::addPostRewrite ( PassManagerWrapper & PMW)
inlineprotectedvirtual

Add passes to be run immediately after virtual registers are rewritten to physical registers.

Definition at line 227 of file CodeGenPassBuilder.h.

Referenced by addOptimizedRegAlloc().

◆ addPreEmitPass()

virtual void llvm::CodeGenPassBuilder::addPreEmitPass ( PassManagerWrapper & PMW)
inlineprotectedvirtual

This pass may be implemented by targets that want to run passes immediately before machine code is emitted.

Definition at line 239 of file CodeGenPassBuilder.h.

Referenced by addMachinePasses().

◆ addPreEmitPass2()

virtual void llvm::CodeGenPassBuilder::addPreEmitPass2 ( PassManagerWrapper & PMW)
inlineprotectedvirtual

Targets may add passes immediately before machine code is emitted in this callback.

This is called even later than addPreEmitPass.

Definition at line 246 of file CodeGenPassBuilder.h.

Referenced by addMachinePasses().

◆ addPreGlobalInstructionSelect()

virtual void llvm::CodeGenPassBuilder::addPreGlobalInstructionSelect ( PassManagerWrapper & PMW)
inlineprotectedvirtual

This method may be implemented by targets that want to run passes immediately before the (global) instruction selection.

Definition at line 278 of file CodeGenPassBuilder.h.

Referenced by addCoreISelPasses().

◆ addPreISel()

virtual void llvm::CodeGenPassBuilder::addPreISel ( PassManagerWrapper & PMW)
inlineprotectedvirtual

{{@ For GlobalISel

addPreISel - This method should add any "last minute" LLVM->LLVM passes (which are run just before instruction selector).

Reimplemented in R600CodeGenPassBuilder.

Definition at line 253 of file CodeGenPassBuilder.h.

Referenced by addISelPrepare().

◆ addPreLegalizeMachineIR()

virtual void llvm::CodeGenPassBuilder::addPreLegalizeMachineIR ( PassManagerWrapper & PMW)
inlineprotectedvirtual

This method may be implemented by targets that want to run passes immediately before legalization.

Definition at line 261 of file CodeGenPassBuilder.h.

Referenced by addCoreISelPasses().

◆ addPreRegAlloc()

virtual void llvm::CodeGenPassBuilder::addPreRegAlloc ( PassManagerWrapper & PMW)
inlineprotectedvirtual

This method may be implemented by targets that want to run passes immediately before register allocation.

Definition at line 209 of file CodeGenPassBuilder.h.

Referenced by addMachinePasses().

◆ addPreRegBankSelect()

virtual void llvm::CodeGenPassBuilder::addPreRegBankSelect ( PassManagerWrapper & PMW)
inlineprotectedvirtual

This method may be implemented by targets that want to run passes immediately before the register bank selection.

Definition at line 269 of file CodeGenPassBuilder.h.

Referenced by addCoreISelPasses().

◆ addPreRewrite()

virtual void llvm::CodeGenPassBuilder::addPreRewrite ( PassManagerWrapper & PMW)
inlineprotectedvirtual

addPreRewrite - Add passes to the optimized register allocation pipeline after register allocation is complete, but before virtual registers are rewritten to physical registers.

These passes must preserve VirtRegMap and LiveIntervals, and when running after RABasic or RAGreedy, they should take advantage of LiveRegMatrix. When these passes run, VirtRegMap contains legal physreg assignments for all virtual registers.

Note if the target overloads addRegAssignAndRewriteOptimized, this may not be honored. This is also not generally used for the fast variant, where the allocation and rewriting are done in one pass.

Definition at line 223 of file CodeGenPassBuilder.h.

Referenced by addRegAssignAndRewriteOptimized().

◆ addPreSched2()

virtual void llvm::CodeGenPassBuilder::addPreSched2 ( PassManagerWrapper & PMW)
inlineprotectedvirtual

This method may be implemented by targets that want to run passes after prolog-epilog insertion and before the second instruction scheduling pass.

Definition at line 235 of file CodeGenPassBuilder.h.

Referenced by addMachinePasses().

◆ addRegAllocPass()

void CodeGenPassBuilder::addRegAllocPass ( PassManagerWrapper & PMW,
bool Optimized )
protected

addMachinePasses helper to create the target-selected or overriden regalloc pass.

Find and instantiate the register allocation pass requested by this target at the current optimization level.

Different register allocators are defined as separate passes because they may require different analysis.

This helper ensures that the -regalloc-npm= option is always available, even for targets that override the default allocator.

Definition at line 802 of file CodeGenPassBuilder.cpp.

References addMachineFunctionPass(), addTargetRegisterAllocator(), llvm::Default, llvm::Fast, llvm::Greedy, Opt, and llvm::reportFatalUsageError().

Referenced by addRegAssignAndRewriteFast(), and addRegAssignAndRewriteOptimized().

◆ addRegAssignAndRewriteFast()

Error CodeGenPassBuilder::addRegAssignAndRewriteFast ( PassManagerWrapper & PMW)
protectedvirtual

Add core register allocator passes which do the actual register assignment and rewriting.

addRegAssignAndRewriteOptimized should return true if any passes were added.

Definition at line 823 of file CodeGenPassBuilder.cpp.

References addRegAllocPass(), and llvm::Error::success().

Referenced by addFastRegAlloc().

◆ addRegAssignAndRewriteOptimized()

Expected< bool > CodeGenPassBuilder::addRegAssignAndRewriteOptimized ( PassManagerWrapper & PMW)
protectedvirtual

◆ addRegBankSelect()

Error CodeGenPassBuilder::addRegBankSelect ( PassManagerWrapper & PMW)
protectedvirtual

This method should install a register bank selector pass, which assigns register banks to virtual registers without a register class or register banks.

Definition at line 187 of file CodeGenPassBuilder.cpp.

References llvm::inconvertibleErrorCode(), and llvm::make_error().

Referenced by addCoreISelPasses().

◆ addTargetRegisterAllocator()

void CodeGenPassBuilder::addTargetRegisterAllocator ( PassManagerWrapper & PMW,
bool Optimized )
protectedvirtual

Utilities for targets to add passes to the pass manager.

Register Allocation Pass Configuration.

Create the register allocator pass for this target at the current optimization level.

Instantiate the default register allocator pass for this target for either the optimized or unoptimized allocation path. This will be added to the pass manager by addFastRegAlloc in the unoptimized case or addOptimizedRegAlloc in the optimized case.

A target that uses the standard regalloc pass order for fast or optimized allocation may still override this for per-target regalloc selection. But -regalloc-npm=... always takes precedence. If a target does not want to allow users to set -regalloc-npm=... at all, check if Opt.RegAlloc == RegAllocType::Unset.

Definition at line 788 of file CodeGenPassBuilder.cpp.

References addMachineFunctionPass().

Referenced by addRegAllocPass().

◆ buildPipeline()

◆ disablePass()

template<typename... PassTs>
void llvm::CodeGenPassBuilder::disablePass ( )
inlineprotected

Allow the target to disable a specific pass by default.

Backend can declare unwanted passes in constructor.

Definition at line 376 of file CodeGenPassBuilder.h.

◆ flushFPMsToMPM()

◆ getOptLevel()

CodeGenOptLevel llvm::CodeGenPassBuilder::getOptLevel ( ) const
inlineprotected

Definition at line 176 of file CodeGenPassBuilder.h.

References TM.

Referenced by addCodeGenPrepare(), addIRPasses(), addISelPasses(), and addMachinePasses().

◆ getPassInstrumentationCallbacks()

PassInstrumentationCallbacks * llvm::CodeGenPassBuilder::getPassInstrumentationCallbacks ( ) const
inline

Definition at line 98 of file CodeGenPassBuilder.h.

References PIC.

◆ insertPass()

template<typename TargetPassT, typename InsertedPassT>
void llvm::CodeGenPassBuilder::insertPass ( InsertedPassT && Pass)
inlineprotected

Insert InsertedPass pass after TargetPass pass.

Only machine function passes are supported.

Definition at line 384 of file CodeGenPassBuilder.h.

References llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::addPass().

◆ isGlobalISelAbortEnabled()

bool llvm::CodeGenPassBuilder::isGlobalISelAbortEnabled ( ) const
inlineprotected

Check whether or not GlobalISel should abort on error.

When this is disabled, GlobalISel will fall back on SDISel instead of erroring out.

Definition at line 181 of file CodeGenPassBuilder.h.

References llvm::Enable, and TM.

Referenced by addCoreISelPasses().

◆ operator=()

CodeGenPassBuilder & llvm::CodeGenPassBuilder::operator= ( const CodeGenPassBuilder & )
delete

References CodeGenPassBuilder().

◆ reportDiagnosticWhenGlobalISelFallback()

bool llvm::CodeGenPassBuilder::reportDiagnosticWhenGlobalISelFallback ( ) const
inlineprotected

Check whether or not a diagnostic should be emitted when GlobalISel uses the fallback path.

In other words, it will emit a diagnostic when GlobalISel failed and isGlobalISelAbortEnabled is false.

Definition at line 188 of file CodeGenPassBuilder.h.

References llvm::DisableWithDiag, and TM.

Referenced by addCoreISelPasses().

◆ requireCGSCCOrder()

void llvm::CodeGenPassBuilder::requireCGSCCOrder ( PassManagerWrapper & PMW)
inlineprotected

◆ stopAddingInCGSCCOrder()

void llvm::CodeGenPassBuilder::stopAddingInCGSCCOrder ( PassManagerWrapper & PMW)
inlineprotected

Member Data Documentation

◆ Opt

◆ PIC

◆ TM


The documentation for this class was generated from the following files: