13#ifndef LLVM_CODEGEN_TARGETPASSCONFIG_H
14#define LLVM_CODEGEN_TARGETPASSCONFIG_H
28class PassInstrumentationCallbacks;
58 bool IsInstance =
false;
69 assert(!IsInstance &&
"Not a Pass ID");
74 assert(IsInstance &&
"Not a Pass Instance");
92 unsigned StartBeforeInstanceNum = 0;
93 unsigned StartBeforeCount = 0;
95 unsigned StartAfterInstanceNum = 0;
96 unsigned StartAfterCount = 0;
98 unsigned StopBeforeInstanceNum = 0;
99 unsigned StopBeforeCount = 0;
101 unsigned StopAfterInstanceNum = 0;
102 unsigned StopAfterCount = 0;
105 bool Stopped =
false;
106 bool AddingMachinePasses =
false;
107 bool DebugifyIsSafe =
true;
119 void setStartStopPasses();
124 bool Initialized =
false;
128 bool DisableVerify =
false;
131 bool EnableTailMerge =
true;
136 bool EnableSinkAndFold =
false;
140 bool RequireCodeGenSCCOrder =
false;
143 bool EnableLoopTermFold =
false;
147 bool addCoreISelPasses();
159 template<
typename TMC> TMC &
getTM()
const {
160 return *
static_cast<TMC*
>(TM);
170 static bool hasLimitedCodeGenPipeline();
174 static bool willCompleteCodeGenPipeline();
179 static std::string getLimitedCodeGenPipelineReason();
205 setOpt(RequireCodeGenSCCOrder,
Enable);
230 bool isPassSubstitutedOrOverridden(
AnalysisID ID)
const;
233 bool getOptimizeRegAlloc()
const;
237 bool usingDefaultRegAlloc()
const;
244 bool addISelPasses();
248 virtual void addIRPasses();
251 void addPassesToHandleExceptions();
255 virtual void addCodeGenPrepare();
259 virtual void addISelPrepare();
300 virtual void addMachinePasses();
304 void printAndVerify(
const std::string &Banner);
307 void addPrintPass(
const std::string &Banner);
311 void addVerifyPass(
const std::string &Banner);
314 void addDebugifyPass();
317 void addStripDebugPass();
320 void addCheckDebugPass();
324 void addMachinePrePasses(
bool AllowDebugify =
true);
328 void addMachinePostPasses(
const std::string &Banner);
333 bool isGlobalISelAbortEnabled()
const;
338 virtual bool reportDiagnosticWhenGlobalISelFallback()
const;
342 virtual bool isGISelCSEEnabled()
const;
345 virtual std::unique_ptr<CSEConfigBase> getCSEConfig()
const;
349 void setOpt(
bool &Opt,
bool Val);
352 bool isCustomizedRegAlloc();
369 virtual void addMachineSSAOptimization();
387 virtual FunctionPass *createTargetRegisterAllocator(
bool Optimized);
391 virtual void addFastRegAlloc();
396 virtual void addOptimizedRegAlloc();
427 virtual void addMachineLateOptimization();
436 virtual bool addGCPasses();
439 virtual void addBlockPlacement();
466 void addPass(
Pass *
P);
470 virtual FunctionPass *createRegAllocPass(
bool Optimized);
474 virtual bool addRegAssignAndRewriteFast();
475 virtual bool addRegAssignAndRewriteOptimized();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
PassInstrumentationCallbacks PIC
Tagged union holding either a T or a Error.
FunctionPass class - This class is used to implement most global optimizations.
Discriminated union of Pass ID types.
Pass * getInstance() const
IdentifyingPassPtr(AnalysisID IDPtr)
IdentifyingPassPtr(Pass *InstancePtr)
ImmutablePass class - This class is used to provide information that does not need to be run.
Pass interface - Implemented by all 'passes'.
StringRef - Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
Target-Independent Code Generator Pass Configuration Options.
void enablePass(AnalysisID PassID)
Allow the target to enable a specific standard pass by default.
bool requiresCodeGenSCCOrder() const
virtual void addPreLegalizeMachineIR()
This method may be implemented by targets that want to run passes immediately before legalization.
virtual void addPreEmitPass2()
Targets may add passes immediately before machine code is emitted in this callback.
bool getEnableTailMerge() const
virtual void addPreSched2()
This method may be implemented by targets that want to run passes after prolog-epilog insertion and b...
virtual bool addILPOpts()
Add passes that optimize instruction level parallelism for out-of-order targets.
virtual void addPostRegAlloc()
This method may be implemented by targets that want to run passes after register allocation pass pipe...
virtual bool addInstSelector()
addInstSelector - This method should install an instruction selector pass, which converts from LLVM c...
bool getEnableSinkAndFold() const
virtual bool addPreISel()
Methods with trivial inline returns are convenient points in the common codegen pass pipeline where t...
virtual void addPostBBSections()
This pass may be implemented by targets that want to run passes immediately after basic block section...
virtual void addPreEmitPass()
This pass may be implemented by targets that want to run passes immediately before machine code is em...
virtual void addPreRegBankSelect()
This method may be implemented by targets that want to run passes immediately before the register ban...
virtual bool addPreRewrite()
addPreRewrite - Add passes to the optimized register allocation pipeline after register allocation is...
virtual bool addRegBankSelect()
This method should install a register bank selector pass, which assigns register banks to virtual reg...
void setEnableSinkAndFold(bool Enable)
void setRequiresCodeGenSCCOrder(bool Enable=true)
virtual void addPreGlobalInstructionSelect()
This method may be implemented by targets that want to run passes immediately before the (global) ins...
virtual bool addLegalizeMachineIR()
This method should install a legalize pass, which converts the instruction sequence into one that can...
void disablePass(AnalysisID PassID)
Allow the target to disable a specific standard pass by default.
virtual bool addGlobalInstructionSelect()
This method should install a (global) instruction selector pass, which converts possibly generic inst...
virtual void addPreRegAlloc()
This method may be implemented by targets that want to run passes immediately before register allocat...
void setEnableTailMerge(bool Enable)
void setDisableVerify(bool Disable)
TMC & getTM() const
Get the right type of TargetMachine for this target.
virtual bool addIRTranslator()
This method should install an IR translator pass, which converts from LLVM code to machine instructio...
virtual bool addPostFastRegAllocRewrite()
addPostFastRegAllocRewrite - Add passes to the optimized register allocation pipeline after fast regi...
virtual void addPostRewrite()
Add passes to be run immediately after virtual registers are rewritten to physical registers.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void registerCodeGenCallback(PassInstrumentationCallbacks &PIC, TargetMachine &)
CodeGenOptLevel
Code generation optimization level.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
unsigned StartInstanceNum