LLVM  6.0.0svn
Classes | Namespaces | Enumerations | Functions | Variables
TargetPassConfig.cpp File Reference
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/CFLAndersAliasAnalysis.h"
#include "llvm/Analysis/CFLSteensAliasAnalysis.h"
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/Analysis/ScopedNoAliasAA.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachinePassRegistry.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/RegAllocRegistry.h"
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Verifier.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Pass.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Threading.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/SymbolRewriter.h"
#include <cassert>
#include <string>
Include dependency graph for TargetPassConfig.cpp:

Go to the source code of this file.

Classes

class  llvm::PassConfigImpl
 

Namespaces

 llvm
 Compute iterated dominance frontiers using a linear time algorithm.
 

Enumerations

enum  CFLAAType {
  CFLAAType::None, CFLAAType::Steensgaard, CFLAAType::Andersen, CFLAAType::Both,
  CFLAAType::None, CFLAAType::Steensgaard, CFLAAType::Andersen, CFLAAType::Both
}
 

Functions

static IdentifyingPassPtr applyDisable (IdentifyingPassPtr PassID, bool Override)
 Allow standard passes to be disabled by command line options. More...
 
static IdentifyingPassPtr overridePass (AnalysisID StandardID, IdentifyingPassPtr TargetID)
 Allow standard passes to be disabled by the command line, regardless of who is adding the pass. More...
 
static const PassInfogetPassInfo (StringRef PassName)
 
static AnalysisID getPassIDFromName (StringRef PassName)
 
static FunctionPassuseDefaultRegisterAllocator ()
 -regalloc=... command line option. More...
 
static void initializeDefaultRegisterAllocatorOnce ()
 

Variables

cl::opt< boolEnableIPRA ("enable-ipra", cl::init(false), cl::Hidden, cl::desc("Enable interprocedural register allocation " "to reduce load/store at procedure calls."))
 
static cl::opt< boolDisablePostRASched ("disable-post-ra", cl::Hidden, cl::desc("Disable Post Regalloc Scheduler"))
 
static cl::opt< boolDisableBranchFold ("disable-branch-fold", cl::Hidden, cl::desc("Disable branch folding"))
 
static cl::opt< boolDisableTailDuplicate ("disable-tail-duplicate", cl::Hidden, cl::desc("Disable tail duplication"))
 
static cl::opt< boolDisableEarlyTailDup ("disable-early-taildup", cl::Hidden, cl::desc("Disable pre-register allocation tail duplication"))
 
static cl::opt< boolDisableBlockPlacement ("disable-block-placement", cl::Hidden, cl::desc("Disable probability-driven block placement"))
 
static cl::opt< boolEnableBlockPlacementStats ("enable-block-placement-stats", cl::Hidden, cl::desc("Collect probability-driven block placement stats"))
 
static cl::opt< boolDisableSSC ("disable-ssc", cl::Hidden, cl::desc("Disable Stack Slot Coloring"))
 
static cl::opt< boolDisableMachineDCE ("disable-machine-dce", cl::Hidden, cl::desc("Disable Machine Dead Code Elimination"))
 
static cl::opt< boolDisableEarlyIfConversion ("disable-early-ifcvt", cl::Hidden, cl::desc("Disable Early If-conversion"))
 
static cl::opt< boolDisableMachineLICM ("disable-machine-licm", cl::Hidden, cl::desc("Disable Machine LICM"))
 
static cl::opt< boolDisableMachineCSE ("disable-machine-cse", cl::Hidden, cl::desc("Disable Machine Common Subexpression Elimination"))
 
static cl::opt< cl::boolOrDefaultOptimizeRegAlloc ("optimize-regalloc", cl::Hidden, cl::desc("Enable optimized register allocation compilation path."))
 
static cl::opt< boolDisablePostRAMachineLICM ("disable-postra-machine-licm", cl::Hidden, cl::desc("Disable Machine LICM"))
 
static cl::opt< boolDisableMachineSink ("disable-machine-sink", cl::Hidden, cl::desc("Disable Machine Sinking"))
 
static cl::opt< boolDisableLSR ("disable-lsr", cl::Hidden, cl::desc("Disable Loop Strength Reduction Pass"))
 
static cl::opt< boolDisableConstantHoisting ("disable-constant-hoisting", cl::Hidden, cl::desc("Disable ConstantHoisting"))
 
static cl::opt< boolDisableCGP ("disable-cgp", cl::Hidden, cl::desc("Disable Codegen Prepare"))
 
static cl::opt< boolDisableCopyProp ("disable-copyprop", cl::Hidden, cl::desc("Disable Copy Propagation pass"))
 
static cl::opt< boolDisablePartialLibcallInlining ("disable-partial-libcall-inlining", cl::Hidden, cl::desc("Disable Partial Libcall Inlining"))
 
static cl::opt< boolEnableImplicitNullChecks ("enable-implicit-null-checks", cl::desc("Fold null checks into faulting memory operations"), cl::init(false))
 
static cl::opt< boolEnableMergeICmps ("enable-mergeicmps", cl::desc("Merge ICmp chains into a single memcmp"), cl::init(false))
 
static cl::opt< boolPrintLSR ("print-lsr-output", cl::Hidden, cl::desc("Print LLVM IR produced by the loop-reduce pass"))
 
static cl::opt< boolPrintISelInput ("print-isel-input", cl::Hidden, cl::desc("Print LLVM IR input to isel pass"))
 
static cl::opt< boolPrintGCInfo ("print-gc", cl::Hidden, cl::desc("Dump garbage collector data"))
 
static cl::opt< boolVerifyMachineCode ("verify-machineinstrs", cl::Hidden, cl::desc("Verify generated machine code"), cl::init(false), cl::ZeroOrMore)
 
static cl::opt< boolEnableMachineOutliner ("enable-machine-outliner", cl::Hidden, cl::desc("Enable machine outliner"))
 
static cl::opt< boolEnableLinkOnceODROutlining ("enable-linkonceodr-outlining", cl::Hidden, cl::desc("Enable the machine outliner on linkonceodr functions"), cl::init(false))
 
static cl::opt< cl::boolOrDefaultEnableFastISelOption ("fast-isel", cl::Hidden, cl::desc("Enable the \ast\instruction selector"))
 
static cl::opt< cl::boolOrDefaultEnableGlobalISel ("global-isel", cl::Hidden, cl::desc("Enable the \lobal\instruction selector"))
 
static cl::opt< std::string > PrintMachineInstrs ("print-machineinstrs", cl::ValueOptional, cl::desc("Print machine instrs"), cl::value_desc("pass-name"), cl::init("option-unspecified"))
 
static cl::opt< int > EnableGlobalISelAbort ("global-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \lobal\instruction selection " "fails to lower/select an instruction: 0 disable the abort, " "1 enable the abort, and " "2 disable the abort but emit a diagnostic on failure"), cl::init(1))
 
cl::opt< boolMISchedPostRA ("misched-postra", cl::Hidden, cl::desc("Run MachineScheduler post regalloc (independent of preRA sched)"))
 
static cl::opt< boolEarlyLiveIntervals ("early-live-intervals", cl::Hidden, cl::desc("Run live interval analysis earlier in the pipeline"))
 
static cl::opt< CFLAATypeUseCFLAA ("use-cfl-aa-in-codegen", cl::init(CFLAAType::None), cl::Hidden, cl::desc("Enable the new, experimental CFL alias analysis in CodeGen"), cl::values(clEnumValN(CFLAAType::None, "none", "Disable CFL-AA"), clEnumValN(CFLAAType::Steensgaard, "steens", "Enable unification-based CFL-AA"), clEnumValN(CFLAAType::Andersen, "anders", "Enable inclusion-based CFL-AA"), clEnumValN(CFLAAType::Both, "both", "Enable both variants of CFL-AA")))
 
const charStartAfterOptName = "start-after"
 Option names for limiting the codegen pipeline. More...
 
const charStartBeforeOptName = "start-before"
 
const charStopAfterOptName = "stop-after"
 
const charStopBeforeOptName = "stop-before"
 
static cl::opt< std::string > StartAfterOpt (StringRef(StartAfterOptName), cl::desc("Resume compilation after a specific pass"), cl::value_desc("pass-name"), cl::init(""))
 
static cl::opt< std::string > StartBeforeOpt (StringRef(StartBeforeOptName), cl::desc("Resume compilation before a specific pass"), cl::value_desc("pass-name"), cl::init(""))
 
static cl::opt< std::string > StopAfterOpt (StringRef(StopAfterOptName), cl::desc("Stop compilation after a specific pass"), cl::value_desc("pass-name"), cl::init(""))
 
static cl::opt< std::string > StopBeforeOpt (StringRef(StopBeforeOptName), cl::desc("Stop compilation before a specific pass"), cl::value_desc("pass-name"), cl::init(""))
 
static cl::opt< RegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser< RegisterRegAlloc > > RegAlloc ("regalloc", cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use"))
 
static llvm::once_flag InitializeDefaultRegisterAllocatorFlag
 A dummy default pass factory indicates whether the register allocator is overridden on the command line. More...
 
static RegisterRegAlloc defaultRegAlloc ("default", "pick register allocator based on -O option", useDefaultRegisterAllocator)
 

Enumeration Type Documentation

◆ CFLAAType

enum CFLAAType
strong
Enumerator
None 
Steensgaard 
Andersen 
Both 
None 
Steensgaard 
Andersen 
Both 

Definition at line 156 of file TargetPassConfig.cpp.

Function Documentation

◆ applyDisable()

static IdentifyingPassPtr applyDisable ( IdentifyingPassPtr  PassID,
bool  Override 
)
static

Allow standard passes to be disabled by command line options.

This supports simple binary flags that either suppress the pass or do nothing. i.e. -disable-mypass=false has no effect. These should be converted to boolOrDefault in order to use applyOverride.

Definition at line 200 of file TargetPassConfig.cpp.

Referenced by overridePass().

◆ getPassIDFromName()

static AnalysisID getPassIDFromName ( StringRef  PassName)
static

◆ getPassInfo()

static const PassInfo* getPassInfo ( StringRef  PassName)
static

◆ initializeDefaultRegisterAllocatorOnce()

static void initializeDefaultRegisterAllocatorOnce ( )
static

◆ overridePass()

static IdentifyingPassPtr overridePass ( AnalysisID  StandardID,
IdentifyingPassPtr  TargetID 
)
static

Allow standard passes to be disabled by the command line, regardless of who is adding the pass.

StandardID is the pass identified in the standard pass pipeline and provided to addPass(). It may be a target-specific ID in the case that the target directly adds its own pass, but in that case we harmlessly fall through.

TargetID is the pass that the target has configured to override StandardID.

StandardID may be a pseudo ID. In that case TargetID is the name of the real pass to run. This allows multiple options to control a single pass depending on where in the pipeline that pass is added.

Definition at line 219 of file TargetPassConfig.cpp.

References applyDisable(), assert(), llvm::BranchFolderPassID, llvm::Pass::createPass(), llvm::DeadMachineInstructionElimID, DisableBlockPlacement, DisableBranchFold, DisableCopyProp, DisableEarlyIfConversion, DisableEarlyTailDup, DisableMachineCSE, DisableMachineDCE, DisableMachineLICM, DisableMachineSink, DisablePostRAMachineLICM, DisablePostRASched, DisableSSC, DisableTailDuplicate, llvm::EarlyIfConverterID, llvm::TargetPassConfig::EarlyTailDuplicateID, llvm::IdentifyingPassPtr::getID(), llvm::IdentifyingPassPtr::getInstance(), llvm::TargetPassConfig::ID, INITIALIZE_PASS, llvm::IdentifyingPassPtr::isInstance(), llvm::IdentifyingPassPtr::isValid(), llvm::MachineBlockPlacementID, llvm::MachineCopyPropagationID, llvm::MachineCSEID, llvm::MachineLICMID, llvm::MachineSinkingID, llvm::TargetPassConfig::PostRAMachineLICMID, llvm::PostRASchedulerID, PrintAfter(), llvm::StackSlotColoringID, and llvm::TailDuplicateID.

Referenced by llvm::TargetPassConfig::addPass(), and llvm::TargetPassConfig::isPassSubstitutedOrOverridden().

◆ useDefaultRegisterAllocator()

static FunctionPass* useDefaultRegisterAllocator ( )
static

-regalloc=... command line option.

Definition at line 768 of file TargetPassConfig.cpp.

References llvm::cl::init(), and RegAlloc.

Referenced by llvm::TargetPassConfig::addMachinePasses(), and llvm::TargetPassConfig::createRegAllocPass().

Variable Documentation

◆ defaultRegAlloc

RegisterRegAlloc defaultRegAlloc("default", "pick register allocator based on -O option", useDefaultRegisterAllocator)
static

◆ DisableBlockPlacement

cl::opt<bool> DisableBlockPlacement("disable-block-placement", cl::Hidden, cl::desc("Disable probability-driven block placement"))
static

Referenced by overridePass().

◆ DisableBranchFold

cl::opt<bool> DisableBranchFold("disable-branch-fold", cl::Hidden, cl::desc("Disable branch folding"))
static

Referenced by overridePass().

◆ DisableCGP

cl::opt<bool> DisableCGP("disable-cgp", cl::Hidden, cl::desc("Disable Codegen Prepare"))
static

◆ DisableConstantHoisting

cl::opt<bool> DisableConstantHoisting("disable-constant-hoisting", cl::Hidden, cl::desc("Disable ConstantHoisting"))
static

◆ DisableCopyProp

cl::opt<bool> DisableCopyProp("disable-copyprop", cl::Hidden, cl::desc("Disable Copy Propagation pass"))
static

Referenced by overridePass().

◆ DisableEarlyIfConversion

cl::opt<bool> DisableEarlyIfConversion("disable-early-ifcvt", cl::Hidden, cl::desc("Disable Early If-conversion"))
static

Referenced by overridePass().

◆ DisableEarlyTailDup

cl::opt<bool> DisableEarlyTailDup("disable-early-taildup", cl::Hidden, cl::desc("Disable pre-register allocation tail duplication"))
static

Referenced by overridePass().

◆ DisableLSR

cl::opt<bool> DisableLSR("disable-lsr", cl::Hidden, cl::desc("Disable Loop Strength Reduction Pass"))
static

◆ DisableMachineCSE

cl::opt<bool> DisableMachineCSE("disable-machine-cse", cl::Hidden, cl::desc("Disable Machine Common Subexpression Elimination"))
static

Referenced by overridePass().

◆ DisableMachineDCE

cl::opt<bool> DisableMachineDCE("disable-machine-dce", cl::Hidden, cl::desc("Disable Machine Dead Code Elimination"))
static

Referenced by overridePass().

◆ DisableMachineLICM

cl::opt<bool> DisableMachineLICM("disable-machine-licm", cl::Hidden, cl::desc("Disable Machine LICM"))
static

Referenced by overridePass().

◆ DisableMachineSink

cl::opt<bool> DisableMachineSink("disable-machine-sink", cl::Hidden, cl::desc("Disable Machine Sinking"))
static

Referenced by overridePass().

◆ DisablePartialLibcallInlining

cl::opt<bool> DisablePartialLibcallInlining("disable-partial-libcall-inlining", cl::Hidden, cl::desc("Disable Partial Libcall Inlining"))
static

◆ DisablePostRAMachineLICM

cl::opt<bool> DisablePostRAMachineLICM("disable-postra-machine-licm", cl::Hidden, cl::desc("Disable Machine LICM"))
static

Referenced by overridePass().

◆ DisablePostRASched

cl::opt<bool> DisablePostRASched("disable-post-ra", cl::Hidden, cl::desc("Disable Post Regalloc Scheduler"))
static

Referenced by overridePass().

◆ DisableSSC

cl::opt<bool> DisableSSC("disable-ssc", cl::Hidden, cl::desc("Disable Stack Slot Coloring"))
static

Referenced by overridePass().

◆ DisableTailDuplicate

cl::opt<bool> DisableTailDuplicate("disable-tail-duplicate", cl::Hidden, cl::desc("Disable tail duplication"))
static

Referenced by overridePass().

◆ EarlyLiveIntervals

cl::opt<bool> EarlyLiveIntervals("early-live-intervals", cl::Hidden, cl::desc("Run live interval analysis earlier in the pipeline"))
static

◆ EnableBlockPlacementStats

cl::opt<bool> EnableBlockPlacementStats("enable-block-placement-stats", cl::Hidden, cl::desc("Collect probability-driven block placement stats"))
static

◆ EnableFastISelOption

cl::opt<cl::boolOrDefault> EnableFastISelOption("fast-isel", cl::Hidden, cl::desc("Enable the \fast\ instruction selector"))
static

◆ EnableGlobalISel

cl::opt<cl::boolOrDefault> EnableGlobalISel("global-isel", cl::Hidden, cl::desc("Enable the \global\ instruction selector"))
static

◆ EnableGlobalISelAbort

cl::opt<int> EnableGlobalISelAbort("global-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \global\ instruction selection " "fails to lower/select an instruction: 0 disable the abort, " "1 enable the abort, and " "2 disable the abort but emit a diagnostic on failure"), cl::init(1))
static

◆ EnableImplicitNullChecks

cl::opt<bool> EnableImplicitNullChecks("enable-implicit-null-checks", cl::desc("Fold null checks into faulting memory operations"), cl::init(false))
static

◆ EnableIPRA

cl::opt<bool> EnableIPRA("enable-ipra", cl::init(false), cl::Hidden, cl::desc("Enable interprocedural register allocation " "to reduce load/store at procedure calls."))

◆ EnableLinkOnceODROutlining

cl::opt<bool> EnableLinkOnceODROutlining("enable-linkonceodr-outlining", cl::Hidden, cl::desc("Enable the machine outliner on linkonceodr functions"), cl::init(false))
static

◆ EnableMachineOutliner

cl::opt<bool> EnableMachineOutliner("enable-machine-outliner", cl::Hidden, cl::desc("Enable machine outliner"))
static

◆ EnableMergeICmps

cl::opt<bool> EnableMergeICmps("enable-mergeicmps", cl::desc("Merge ICmp chains into a single memcmp"), cl::init(false))
static

◆ InitializeDefaultRegisterAllocatorFlag

llvm::once_flag InitializeDefaultRegisterAllocatorFlag
static

A dummy default pass factory indicates whether the register allocator is overridden on the command line.

Definition at line 967 of file TargetPassConfig.cpp.

◆ MISchedPostRA

cl::opt<bool> MISchedPostRA("misched-postra", cl::Hidden, cl::desc("Run MachineScheduler post regalloc (independent of preRA sched)"))

◆ OptimizeRegAlloc

cl::opt<cl::boolOrDefault> OptimizeRegAlloc("optimize-regalloc", cl::Hidden, cl::desc("Enable optimized register allocation compilation path."))
static

◆ PrintGCInfo

cl::opt<bool> PrintGCInfo("print-gc", cl::Hidden, cl::desc("Dump garbage collector data"))
static

◆ PrintISelInput

cl::opt<bool> PrintISelInput("print-isel-input", cl::Hidden, cl::desc("Print LLVM IR input to isel pass"))
static

◆ PrintLSR

cl::opt<bool> PrintLSR("print-lsr-output", cl::Hidden, cl::desc("Print LLVM IR produced by the loop-reduce pass"))
static

◆ PrintMachineInstrs

cl::opt<std::string> PrintMachineInstrs("print-machineinstrs", cl::ValueOptional, cl::desc("Print machine instrs"), cl::value_desc("pass-name"), cl::init("option-unspecified"))
static

◆ RegAlloc

cl::opt<RegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser<RegisterRegAlloc> > RegAlloc("regalloc", cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use"))
static

◆ StartAfterOpt

cl::opt<std::string> StartAfterOpt(StringRef(StartAfterOptName), cl::desc("Resume compilation after a specific pass"), cl::value_desc("pass-name"), cl::init(""))
static

◆ StartAfterOptName

const char* StartAfterOptName = "start-after"

Option names for limiting the codegen pipeline.

Those are used in error reporting and we didn't want to duplicate their names all over the place.

Definition at line 171 of file TargetPassConfig.cpp.

Referenced by llvm::TargetPassConfig::getLimitedCodeGenPipelineReason().

◆ StartBeforeOpt

cl::opt<std::string> StartBeforeOpt(StringRef(StartBeforeOptName), cl::desc("Resume compilation before a specific pass"), cl::value_desc("pass-name"), cl::init(""))
static

◆ StartBeforeOptName

const char* StartBeforeOptName = "start-before"

◆ StopAfterOpt

cl::opt<std::string> StopAfterOpt(StringRef(StopAfterOptName), cl::desc("Stop compilation after a specific pass"), cl::value_desc("pass-name"), cl::init(""))
static

◆ StopAfterOptName

const char* StopAfterOptName = "stop-after"

◆ StopBeforeOpt

cl::opt<std::string> StopBeforeOpt(StringRef(StopBeforeOptName), cl::desc("Stop compilation before a specific pass"), cl::value_desc("pass-name"), cl::init(""))
static

◆ StopBeforeOptName

const char* StopBeforeOptName = "stop-before"

Definition at line 174 of file TargetPassConfig.cpp.

◆ UseCFLAA

cl::opt<CFLAAType> UseCFLAA("use-cfl-aa-in-codegen", cl::init(CFLAAType::None), cl::Hidden, cl::desc("Enable the new, experimental CFL alias analysis in CodeGen"), cl::values(clEnumValN(CFLAAType::None, "none", "Disable CFL-AA"), clEnumValN(CFLAAType::Steensgaard, "steens", "Enable unification-based CFL-AA"), clEnumValN(CFLAAType::Andersen, "anders", "Enable inclusion-based CFL-AA"), clEnumValN(CFLAAType::Both, "both", "Enable both variants of CFL-AA")))
static

◆ VerifyMachineCode

cl::opt<bool> VerifyMachineCode("verify-machineinstrs", cl::Hidden, cl::desc("Verify generated machine code"), cl::init(false), cl::ZeroOrMore)
static