LLVM 24.0.0git
TargetPassConfig.cpp File Reference
#include "llvm/CodeGen/TargetPassConfig.h"
#include "CodeGenOptions.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/Analysis/ScopedNoAliasAA.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
#include "llvm/CodeGen/BasicBlockSectionsProfileReader.h"
#include "llvm/CodeGen/CSEConfigBase.h"
#include "llvm/CodeGen/CodeGenTargetMachineImpl.h"
#include "llvm/CodeGen/MachineBlockHashInfo.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/PassInstrumentation.h"
#include "llvm/IR/Verifier.h"
#include "llvm/InitializePasses.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/Discriminator.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/Threading.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Target/CGPassBuilderOption.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/ObjCARC.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils.h"
#include <cassert>
#include <optional>
#include <string>

Go to the source code of this file.

Classes

struct  INITIALIZE_PASS::InsertedPass
class  llvm::PassConfigImpl

Namespaces

namespace  INITIALIZE_PASS
 TargetPassConfig.
namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.

Macros

#define DISABLE_PASS(Option, Name)

Functions

static IdentifyingPassPtr applyDisable (IdentifyingPassPtr PassID, bool Override)
 Allow standard passes to be disabled by command line options.
static IdentifyingPassPtr overridePass (AnalysisID StandardID, IdentifyingPassPtr TargetID)
 Allow standard passes to be disabled by the command line, regardless of who is adding the pass.
static std::string getFSProfileFile (const TargetMachine *TM)
static std::string getFSRemappingFile (const TargetMachine *TM)
static const PassInfo * getPassInfo (StringRef PassName)
static AnalysisID getPassIDFromName (StringRef PassName)
static std::pair< StringRef, unsigned > getPassNameAndInstanceNum (StringRef PassName)
static cl::boolOrDefault toBoolOrDefault (BoolOrDefault B)
static MachineVerifierMode computeMachineVerifierMode (const CodeGenOptions &Opts, bool VerifyEach)
static FunctionPass * useDefaultRegisterAllocator ()
 -regalloc=... command line option.
static void initializeDefaultRegisterAllocatorOnce ()

Variables

static cl::opt< RunOutliner > EnableMachineOutliner ("enable-machine-outliner", cl::desc("Enable the machine outliner"), cl::Hidden, cl::ValueOptional, cl::init(RunOutliner::TargetDefault), cl::values(clEnumValN(RunOutliner::AlwaysOutline, "always", "Run on all functions guaranteed to be beneficial"), clEnumValN(RunOutliner::OptimisticPGO, "optimistic-pgo", "Outline cold code only. If a code block does not have " "profile data, optimistically assume it is cold."), clEnumValN(RunOutliner::ConservativePGO, "conservative-pgo", "Outline cold code only. If a code block does not have " "profile, data, conservatively assume it is hot."), clEnumValN(RunOutliner::NeverOutline, "never", "Disable all outlining"), clEnumValN(RunOutliner::AlwaysOutline, "", "")))
static const char StartAfterOptName [] = "start-after"
 Option names for limiting the codegen pipeline.
static const char StartBeforeOptName [] = "start-before"
static const char StopAfterOptName [] = "stop-after"
static const char StopBeforeOptName [] = "stop-before"
static cl::opt< RegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser< RegisterRegAlloc > > RegAlloc ("regalloc", cl::Hidden, cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use"))
static llvm::once_flag InitializeDefaultRegisterAllocatorFlag
 Register Allocation Pass Configuration.
static RegisterRegAlloc defaultRegAlloc ("default", "pick register allocator based on -O option", useDefaultRegisterAllocator)

Macro Definition Documentation

◆ DISABLE_PASS

#define DISABLE_PASS ( Option,
Name )
Value:
if (Option && P.contains(#Name)) \
return false;
#define P(N)

Referenced by llvm::registerCodeGenCallback().

Function Documentation

◆ applyDisable()

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 105 of file TargetPassConfig.cpp.

Referenced by overridePass().

◆ computeMachineVerifierMode()

MachineVerifierMode computeMachineVerifierMode ( const CodeGenOptions & Opts,
bool VerifyEach )
static

◆ getFSProfileFile()

◆ getFSRemappingFile()

◆ getPassIDFromName()

AnalysisID getPassIDFromName ( StringRef PassName)
static

Definition at line 262 of file TargetPassConfig.cpp.

References getPassInfo(), llvm::PassInfo::getTypeInfo(), and PassName.

◆ getPassInfo()

◆ getPassNameAndInstanceNum()

std::pair< StringRef, unsigned > getPassNameAndInstanceNum ( StringRef PassName)
static

◆ initializeDefaultRegisterAllocatorOnce()

◆ overridePass()

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 124 of file TargetPassConfig.cpp.

References applyDisable(), llvm::BranchFolderPassID, llvm::DeadMachineInstructionElimID, llvm::EarlyIfConverterLegacyID, llvm::EarlyMachineLICMID, llvm::EarlyTailDuplicateLegacyID, llvm::MachineBlockPlacementID, llvm::MachineCopyPropagationID, llvm::MachineCSELegacyID, llvm::MachineLICMID, llvm::MachineSinkingLegacyID, llvm::PostRAMachineSinkingID, llvm::PostRASchedulerID, llvm::StackSlotColoringID, and llvm::TailDuplicateLegacyID.

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

◆ toBoolOrDefault()

◆ useDefaultRegisterAllocator()

Variable Documentation

◆ defaultRegAlloc

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

◆ EnableMachineOutliner

cl::opt< RunOutliner > EnableMachineOutliner("enable-machine-outliner", cl::desc("Enable the machine outliner"), cl::Hidden, cl::ValueOptional, cl::init(RunOutliner::TargetDefault), cl::values( clEnumValN(RunOutliner::AlwaysOutline, "always", "Run on all functions guaranteed to be beneficial"), clEnumValN(RunOutliner::OptimisticPGO, "optimistic-pgo", "Outline cold code only. If a code block does not have " "profile data, optimistically assume it is cold."), clEnumValN(RunOutliner::ConservativePGO, "conservative-pgo", "Outline cold code only. If a code block does not have " "profile, data, conservatively assume it is hot."), clEnumValN(RunOutliner::NeverOutline, "never", "Disable all outlining"), clEnumValN(RunOutliner::AlwaysOutline, "", ""))) ( "enable-machine-outliner" ,
cl::desc("Enable the machine outliner") ,
cl::Hidden ,
cl::ValueOptional ,
cl::init(RunOutliner::TargetDefault) ,
cl::values( clEnumValN(RunOutliner::AlwaysOutline, "always", "Run on all functions guaranteed to be beneficial"), clEnumValN(RunOutliner::OptimisticPGO, "optimistic-pgo", "Outline cold code only. If a code block does not have " "profile data, optimistically assume it is cold."), clEnumValN(RunOutliner::ConservativePGO, "conservative-pgo", "Outline cold code only. If a code block does not have " "profile, data, conservatively assume it is hot."), clEnumValN(RunOutliner::NeverOutline, "never", "Disable all outlining"), clEnumValN(RunOutliner::AlwaysOutline, "", ""))  )
static

◆ InitializeDefaultRegisterAllocatorFlag

llvm::once_flag InitializeDefaultRegisterAllocatorFlag
static

Register Allocation Pass Configuration.

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

Definition at line 1213 of file TargetPassConfig.cpp.

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

◆ RegAlloc

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

◆ StartAfterOptName

const char StartAfterOptName[] = "start-after"
static

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 96 of file TargetPassConfig.cpp.

Referenced by llvm::TargetPassConfig::getLimitedCodeGenPipelineReason(), and llvm::TargetPassConfig::getStartStopInfo().

◆ StartBeforeOptName

const char StartBeforeOptName[] = "start-before"
static

◆ StopAfterOptName

const char StopAfterOptName[] = "stop-after"
static

◆ StopBeforeOptName

const char StopBeforeOptName[] = "stop-before"
static