LLVM 20.0.0git
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
llvm::CodeGenPassBuilder< DerivedT, TargetMachineT > Class Template Reference

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

#include "llvm/Passes/CodeGenPassBuilder.h"

Inheritance diagram for llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >:
Inheritance graph
[legend]

Classes

class  AddIRPass
 
class  AddMachinePass
 

Public Member Functions

 CodeGenPassBuilder (TargetMachineT &TM, const CGPassBuilderOption &Opts, PassInstrumentationCallbacks *PIC)
 
Error buildPipeline (ModulePassManager &MPM, raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType) const
 
PassInstrumentationCallbacksgetPassInstrumentationCallbacks () const
 

Protected Types

template<typename PassT >
using has_required_t = decltype(std::declval< PassT & >().isRequired())
 
template<typename PassT >
using is_module_pass_t = decltype(std::declval< PassT & >().run(std::declval< Module & >(), std::declval< ModuleAnalysisManager & >()))
 
template<typename PassT >
using is_function_pass_t = decltype(std::declval< PassT & >().run(std::declval< Function & >(), std::declval< FunctionAnalysisManager & >()))
 
template<typename PassT >
using is_machine_function_pass_t = decltype(std::declval< PassT & >().run(std::declval< MachineFunction & >(), std::declval< MachineFunctionAnalysisManager & >()))
 
using CreateMCStreamer = std::function< Expected< std::unique_ptr< MCStreamer > >(MCContext &)>
 

Protected Member Functions

template<typename TMC >
TMC & getTM () const
 
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.
 
Error addInstSelector (AddMachinePass &) const
 addInstSelector - This method should install an instruction selector pass, which converts from LLVM code to machine instructions.
 
void addGlobalMergePass (AddIRPass &) const
 Target can override this to add GlobalMergePass before all IR passes.
 
void addILPOpts (AddMachinePass &) const
 Add passes that optimize instruction level parallelism for out-of-order targets.
 
void addPreRegAlloc (AddMachinePass &) const
 This method may be implemented by targets that want to run passes immediately before register allocation.
 
void addPreRewrite (AddMachinePass &) const
 addPreRewrite - Add passes to the optimized register allocation pipeline after register allocation is complete, but before virtual registers are rewritten to physical registers.
 
void addPostRewrite (AddMachinePass &) const
 Add passes to be run immediately after virtual registers are rewritten to physical registers.
 
void addPostRegAlloc (AddMachinePass &) const
 This method may be implemented by targets that want to run passes after register allocation pass pipeline but before prolog-epilog insertion.
 
void addPreSched2 (AddMachinePass &) const
 This method may be implemented by targets that want to run passes after prolog-epilog insertion and before the second instruction scheduling pass.
 
void addPreEmitPass (AddMachinePass &) const
 This pass may be implemented by targets that want to run passes immediately before machine code is emitted.
 
void addPreEmitPass2 (AddMachinePass &) const
 Targets may add passes immediately before machine code is emitted in this callback.
 
void addPreISel (AddIRPass &) const
 {{@ For GlobalISel
 
Error addIRTranslator (AddMachinePass &) const
 This method should install an IR translator pass, which converts from LLVM code to machine instructions with possibly generic opcodes.
 
void addPreLegalizeMachineIR (AddMachinePass &) const
 This method may be implemented by targets that want to run passes immediately before legalization.
 
Error addLegalizeMachineIR (AddMachinePass &) const
 This method should install a legalize pass, which converts the instruction sequence into one that can be selected by the target.
 
void addPreRegBankSelect (AddMachinePass &) const
 This method may be implemented by targets that want to run passes immediately before the register bank selection.
 
Error addRegBankSelect (AddMachinePass &) const
 This method should install a register bank selector pass, which assigns register banks to virtual registers without a register class or register banks.
 
void addPreGlobalInstructionSelect (AddMachinePass &) const
 This method may be implemented by targets that want to run passes immediately before the (global) instruction selection.
 
Error addGlobalInstructionSelect (AddMachinePass &) const
 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 (AddIRPass &) const
 High level function that adds all passes necessary to go from llvm IR representation to the MI representation.
 
Error addCoreISelPasses (AddMachinePass &) const
 Add the actual instruction selection passes.
 
Error addMachinePasses (AddMachinePass &) const
 Add the complete, standard set of LLVM CodeGen passes.
 
void addPassesToHandleExceptions (AddIRPass &) const
 Add passes to lower exception handling for the code generator.
 
void addIRPasses (AddIRPass &) const
 Add common target configurable passes that perform LLVM IR to IR transforms following machine independent optimization.
 
void addCodeGenPrepare (AddIRPass &) const
 Add pass to prepare the LLVM IR for code generation.
 
void addISelPrepare (AddIRPass &) const
 Add common passes that perform LLVM IR to IR transforms in preparation for instruction selection.
 
void addMachineSSAOptimization (AddMachinePass &) const
 Methods with trivial inline returns are convenient points in the common codegen pass pipeline where targets may insert passes.
 
Error addFastRegAlloc (AddMachinePass &) const
 addFastRegAlloc - Add the minimum set of target-independent passes that are required for fast register allocation.
 
void addOptimizedRegAlloc (AddMachinePass &) const
 addOptimizedRegAlloc - Add passes related to register allocation.
 
void addMachineLateOptimization (AddMachinePass &) const
 Add passes that optimize machine instructions after register allocation.
 
void addGCPasses (AddMachinePass &) const
 addGCPasses - Add late codegen passes that analyze code for garbage collection.
 
void addBlockPlacement (AddMachinePass &) const
 Add standard basic block placement passes.
 
void addAsmPrinter (AddMachinePass &, CreateMCStreamer) const
 
void addTargetRegisterAllocator (AddMachinePass &, bool Optimized) const
 Utilities for targets to add passes to the pass manager.
 
void addRegAllocPass (AddMachinePass &, bool Optimized) const
 addMachinePasses helper to create the target-selected or overriden regalloc pass.
 
Error addRegAssignmentFast (AddMachinePass &) const
 Add core register alloator passes which do the actual register assignment and rewriting.
 
Error addRegAssignmentOptimized (AddMachinePass &) const
 
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

TargetMachineT & TM
 
CGPassBuilderOption Opt
 
PassInstrumentationCallbacksPIC
 

Detailed Description

template<typename DerivedT, typename TargetMachineT>
class llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >

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.

Definition at line 133 of file CodeGenPassBuilder.h.

Member Typedef Documentation

◆ CreateMCStreamer

template<typename DerivedT , typename TargetMachineT >
using llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::CreateMCStreamer = std::function<Expected<std::unique_ptr<MCStreamer> >(MCContext &)>
protected

Definition at line 465 of file CodeGenPassBuilder.h.

◆ has_required_t

template<typename DerivedT , typename TargetMachineT >
template<typename PassT >
using llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::has_required_t = decltype(std::declval<PassT &>().isRequired())
protected

Definition at line 164 of file CodeGenPassBuilder.h.

◆ is_function_pass_t

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

Definition at line 171 of file CodeGenPassBuilder.h.

◆ is_machine_function_pass_t

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

Definition at line 175 of file CodeGenPassBuilder.h.

◆ is_module_pass_t

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

Definition at line 167 of file CodeGenPassBuilder.h.

Constructor & Destructor Documentation

◆ CodeGenPassBuilder()

template<typename DerivedT , typename TargetMachineT >
llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::CodeGenPassBuilder ( TargetMachineT &  TM,
const CGPassBuilderOption Opts,
PassInstrumentationCallbacks PIC 
)
inlineexplicit

Member Function Documentation

◆ addAsmPrinter()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addAsmPrinter ( AddMachinePass ,
CreateMCStreamer   
) const
inlineprotected

Definition at line 467 of file CodeGenPassBuilder.h.

References llvm_unreachable.

◆ addBlockPlacement()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addBlockPlacement ( AddMachinePass addPass) const
protected

Add standard basic block placement passes.

Definition at line 1190 of file CodeGenPassBuilder.h.

References llvm::CGPassBuilderOption::EnableBlockPlacementStats.

◆ addCodeGenPrepare()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addCodeGenPrepare ( AddIRPass addPass) const
protected

Add pass to prepare the LLVM IR for code generation.

This should be done before exception handling preparation passes.

Definition at line 777 of file CodeGenPassBuilder.h.

References llvm::CGPassBuilderOption::DisableCGP.

◆ addCoreISelPasses()

template<typename Derived , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addCoreISelPasses ( AddMachinePass addPass) const
protected

Add the actual instruction selection passes.

This does not include preparation passes on IR.

Definition at line 809 of file CodeGenPassBuilder.h.

References llvm::CGPassBuilderOption::EnableFastISelOption, and llvm::CGPassBuilderOption::EnableGlobalISelOption.

◆ addFastRegAlloc()

template<typename Derived , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addFastRegAlloc ( AddMachinePass addPass) const
protected

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 1110 of file CodeGenPassBuilder.h.

◆ addGCPasses()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addGCPasses ( AddMachinePass ) const
inlineprotected

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 460 of file CodeGenPassBuilder.h.

◆ addGlobalInstructionSelect()

template<typename DerivedT , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addGlobalInstructionSelect ( AddMachinePass ) const
inlineprotected

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 398 of file CodeGenPassBuilder.h.

References llvm::inconvertibleErrorCode().

◆ addGlobalMergePass()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addGlobalMergePass ( AddIRPass ) const
inlineprotected

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

Definition at line 300 of file CodeGenPassBuilder.h.

Referenced by llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addISelPasses().

◆ addILPOpts()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addILPOpts ( AddMachinePass ) const
inlineprotected

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 308 of file CodeGenPassBuilder.h.

◆ addInstSelector()

template<typename DerivedT , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addInstSelector ( AddMachinePass ) const
inlineprotected

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

Definition at line 294 of file CodeGenPassBuilder.h.

References llvm::inconvertibleErrorCode().

◆ addIRPasses()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addIRPasses ( AddIRPass addPass) const
protected

◆ addIRTranslator()

template<typename DerivedT , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addIRTranslator ( AddMachinePass ) const
inlineprotected

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

Definition at line 362 of file CodeGenPassBuilder.h.

References llvm::inconvertibleErrorCode().

◆ addISelPasses()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addISelPasses ( AddIRPass addPass) const
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 641 of file CodeGenPassBuilder.h.

References llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addGlobalMergePass().

◆ addISelPrepare()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addISelPrepare ( AddIRPass addPass) const
protected

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

Definition at line 788 of file CodeGenPassBuilder.h.

References llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPreISel(), llvm::dbgs(), llvm::CGPassBuilderOption::DisableVerify, and llvm::CGPassBuilderOption::PrintISelInput.

◆ addLegalizeMachineIR()

template<typename DerivedT , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addLegalizeMachineIR ( AddMachinePass ) const
inlineprotected

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

Definition at line 373 of file CodeGenPassBuilder.h.

References llvm::inconvertibleErrorCode().

◆ addMachineLateOptimization()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addMachineLateOptimization ( AddMachinePass addPass) const
protected

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 1169 of file CodeGenPassBuilder.h.

◆ addMachinePasses()

template<typename Derived , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addMachinePasses ( AddMachinePass addPass) const
protected

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<Derived, TargetMachine>::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 902 of file CodeGenPassBuilder.h.

References llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addMachineSSAOptimization(), llvm::CGPassBuilderOption::EnableImplicitNullChecks, llvm::CGPassBuilderOption::EnableMachineOutliner, llvm::CGPassBuilderOption::MISchedPostRA, and llvm::CGPassBuilderOption::OptimizeRegAlloc.

◆ addMachineSSAOptimization()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addMachineSSAOptimization ( AddMachinePass addPass) const
protected

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 1010 of file CodeGenPassBuilder.h.

Referenced by llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addMachinePasses().

◆ addOptimizedRegAlloc()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addOptimizedRegAlloc ( AddMachinePass addPass) const
protected

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 1121 of file CodeGenPassBuilder.h.

References llvm::CGPassBuilderOption::EarlyLiveIntervals.

◆ addPassesToHandleExceptions()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addPassesToHandleExceptions ( AddIRPass addPass) const
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 730 of file CodeGenPassBuilder.h.

References assert(), and llvm::MCAsmInfo::getExceptionHandlingType().

◆ addPostRegAlloc()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPostRegAlloc ( AddMachinePass ) const
inlineprotected

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 334 of file CodeGenPassBuilder.h.

◆ addPostRewrite()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPostRewrite ( AddMachinePass ) const
inlineprotected

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

Definition at line 330 of file CodeGenPassBuilder.h.

◆ addPreEmitPass()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPreEmitPass ( AddMachinePass ) const
inlineprotected

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

Definition at line 342 of file CodeGenPassBuilder.h.

◆ addPreEmitPass2()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPreEmitPass2 ( AddMachinePass ) const
inlineprotected

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

This is called even later than addPreEmitPass.

Definition at line 349 of file CodeGenPassBuilder.h.

◆ addPreGlobalInstructionSelect()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPreGlobalInstructionSelect ( AddMachinePass ) const
inlineprotected

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

Definition at line 392 of file CodeGenPassBuilder.h.

◆ addPreISel()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPreISel ( AddIRPass ) const
inlineprotected

{{@ For GlobalISel

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

Definition at line 356 of file CodeGenPassBuilder.h.

References llvm_unreachable.

Referenced by llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addISelPrepare().

◆ addPreLegalizeMachineIR()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPreLegalizeMachineIR ( AddMachinePass ) const
inlineprotected

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

Definition at line 369 of file CodeGenPassBuilder.h.

◆ addPreRegAlloc()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPreRegAlloc ( AddMachinePass ) const
inlineprotected

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

Definition at line 312 of file CodeGenPassBuilder.h.

◆ addPreRegBankSelect()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPreRegBankSelect ( AddMachinePass ) const
inlineprotected

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

Definition at line 380 of file CodeGenPassBuilder.h.

◆ addPreRewrite()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPreRewrite ( AddMachinePass ) const
inlineprotected

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 326 of file CodeGenPassBuilder.h.

◆ addPreSched2()

template<typename DerivedT , typename TargetMachineT >
void llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addPreSched2 ( AddMachinePass ) const
inlineprotected

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 338 of file CodeGenPassBuilder.h.

◆ addRegAllocPass()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addRegAllocPass ( AddMachinePass addPass,
bool  Optimized 
) const
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.

Definition at line 1074 of file CodeGenPassBuilder.h.

◆ addRegAssignmentFast()

template<typename Derived , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addRegAssignmentFast ( AddMachinePass addPass) const
protected

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

Returns
true if any passes were added.

Definition at line 1080 of file CodeGenPassBuilder.h.

◆ addRegAssignmentOptimized()

template<typename Derived , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addRegAssignmentOptimized ( AddMachinePass addPass) const
protected

Definition at line 1088 of file CodeGenPassBuilder.h.

◆ addRegBankSelect()

template<typename DerivedT , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::addRegBankSelect ( AddMachinePass ) const
inlineprotected

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 385 of file CodeGenPassBuilder.h.

References llvm::inconvertibleErrorCode().

◆ addTargetRegisterAllocator()

template<typename Derived , typename TargetMachineT >
void llvm::CodeGenPassBuilder< Derived, TargetMachineT >::addTargetRegisterAllocator ( AddMachinePass addPass,
bool  Optimized 
) const
protected

Utilities for targets to add passes to the pass manager.

Register Allocation Pass Configuration.

createTargetRegisterAllocator - 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=... always takes precedence.

Definition at line 1062 of file CodeGenPassBuilder.h.

◆ buildPipeline()

template<typename Derived , typename TargetMachineT >
Error llvm::CodeGenPassBuilder< Derived, TargetMachineT >::buildPipeline ( ModulePassManager MPM,
raw_pwrite_stream Out,
raw_pwrite_stream DwoOut,
CodeGenFileType  FileType 
) const

◆ disablePass()

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

Allow the target to disable a specific pass by default.

Backend can declare unwanted passes in constructor.

Definition at line 489 of file CodeGenPassBuilder.h.

References Name.

◆ getOptLevel()

template<typename DerivedT , typename TargetMachineT >
CodeGenOptLevel llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::getOptLevel ( ) const
inlineprotected

◆ getPassInstrumentationCallbacks()

template<typename DerivedT , typename TargetMachineT >
PassInstrumentationCallbacks * llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::getPassInstrumentationCallbacks ( ) const
inline

◆ getTM()

template<typename DerivedT , typename TargetMachineT >
template<typename TMC >
TMC & llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::getTM ( ) const
inlineprotected

◆ insertPass()

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

Insert InsertedPass pass after TargetPass pass.

Only machine function passes are supported.

Definition at line 497 of file CodeGenPassBuilder.h.

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

◆ isGlobalISelAbortEnabled()

template<typename DerivedT , typename TargetMachineT >
bool llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::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 281 of file CodeGenPassBuilder.h.

References llvm::Enable, and llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::TM.

◆ reportDiagnosticWhenGlobalISelFallback()

template<typename DerivedT , typename TargetMachineT >
bool llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::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 288 of file CodeGenPassBuilder.h.

References llvm::DisableWithDiag, and llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::TM.

Member Data Documentation

◆ Opt

template<typename DerivedT , typename TargetMachineT >
CGPassBuilderOption llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::Opt
protected

◆ PIC

template<typename DerivedT , typename TargetMachineT >
PassInstrumentationCallbacks* llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::PIC
protected

◆ TM

template<typename DerivedT , typename TargetMachineT >
TargetMachineT& llvm::CodeGenPassBuilder< DerivedT, TargetMachineT >::TM
protected

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