LLVM 20.0.0git
Classes | Namespaces | Functions | Variables
PassBuilderBindings.cpp File Reference

This file defines the C bindings to the new pass manager. More...

#include "llvm-c/Transforms/PassBuilder.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Passes/StandardInstrumentations.h"
#include "llvm/Support/CBindingWrapping.h"

Go to the source code of this file.

Classes

class  llvm::LLVMPassBuilderOptions
 Helper struct for holding a set of builder options for LLVMRunPasses. More...
 

Namespaces

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

Functions

static TargetMachineunwrap (LLVMTargetMachineRef P)
 
 DEFINE_SIMPLE_CONVERSION_FUNCTIONS (LLVMPassBuilderOptions, LLVMPassBuilderOptionsRef) static LLVMErrorRef runPasses(Module *Mod
 
PassBuilder PB (Machine, PassOpts->PTO, std::nullopt, &PIC)
 
 if (PassOpts->AAPipeline)
 
PB registerLoopAnalyses (LAM)
 
PB registerFunctionAnalyses (FAM)
 
PB registerCGSCCAnalyses (CGAM)
 
PB registerModuleAnalyses (MAM)
 
PB crossRegisterProxies (LAM, FAM, CGAM, MAM)
 
StandardInstrumentations SI (Mod->getContext(), Debug, VerifyEach)
 
SI registerCallbacks (PIC, &MAM)
 
 if (Fun)
 
 if (VerifyEach) MPM.addPass(VerifierPass())
 
LLVMErrorRef LLVMRunPasses (LLVMModuleRef M, const char *Passes, LLVMTargetMachineRef TM, LLVMPassBuilderOptionsRef Options)
 Construct and run a set of passes over a module.
 
LLVMErrorRef LLVMRunPassesOnFunction (LLVMValueRef F, const char *Passes, LLVMTargetMachineRef TM, LLVMPassBuilderOptionsRef Options)
 Construct and run a set of passes over a function.
 
LLVMPassBuilderOptionsRef LLVMCreatePassBuilderOptions ()
 Create a new set of options for a PassBuilder.
 
void LLVMPassBuilderOptionsSetVerifyEach (LLVMPassBuilderOptionsRef Options, LLVMBool VerifyEach)
 Toggle adding the VerifierPass for the PassBuilder, ensuring all functions inside the module is valid.
 
void LLVMPassBuilderOptionsSetDebugLogging (LLVMPassBuilderOptionsRef Options, LLVMBool DebugLogging)
 Toggle debug logging when running the PassBuilder.
 
void LLVMPassBuilderOptionsSetAAPipeline (LLVMPassBuilderOptionsRef Options, const char *AAPipeline)
 Specify a custom alias analysis pipeline for the PassBuilder to be used instead of the default one.
 
void LLVMPassBuilderOptionsSetLoopInterleaving (LLVMPassBuilderOptionsRef Options, LLVMBool LoopInterleaving)
 
void LLVMPassBuilderOptionsSetLoopVectorization (LLVMPassBuilderOptionsRef Options, LLVMBool LoopVectorization)
 
void LLVMPassBuilderOptionsSetSLPVectorization (LLVMPassBuilderOptionsRef Options, LLVMBool SLPVectorization)
 
void LLVMPassBuilderOptionsSetLoopUnrolling (LLVMPassBuilderOptionsRef Options, LLVMBool LoopUnrolling)
 
void LLVMPassBuilderOptionsSetForgetAllSCEVInLoopUnroll (LLVMPassBuilderOptionsRef Options, LLVMBool ForgetAllSCEVInLoopUnroll)
 
void LLVMPassBuilderOptionsSetLicmMssaOptCap (LLVMPassBuilderOptionsRef Options, unsigned LicmMssaOptCap)
 
void LLVMPassBuilderOptionsSetLicmMssaNoAccForPromotionCap (LLVMPassBuilderOptionsRef Options, unsigned LicmMssaNoAccForPromotionCap)
 
void LLVMPassBuilderOptionsSetCallGraphProfile (LLVMPassBuilderOptionsRef Options, LLVMBool CallGraphProfile)
 
void LLVMPassBuilderOptionsSetMergeFunctions (LLVMPassBuilderOptionsRef Options, LLVMBool MergeFunctions)
 
void LLVMPassBuilderOptionsSetInlinerThreshold (LLVMPassBuilderOptionsRef Options, int Threshold)
 
void LLVMDisposePassBuilderOptions (LLVMPassBuilderOptionsRef Options)
 Dispose of a heap-allocated PassBuilderOptions instance.
 

Variables

FunctionFun
 
Function const charPasses
 
Function const char TargetMachineMachine
 
Function const char TargetMachine LLVMPassBuilderOptionsPassOpts
 
bool VerifyEach = PassOpts->VerifyEach
 
PassInstrumentationCallbacks PIC
 
LoopAnalysisManager LAM
 
FunctionAnalysisManager FAM
 
CGSCCAnalysisManager CGAM
 
ModuleAnalysisManager MAM
 
 else
 
if(auto Err=PB.parsePassPipeline(MPM, Passes)) return wrap(std MPM run * Mod
 
return LLVMErrorSuccess
 

Detailed Description

This file defines the C bindings to the new pass manager.

Definition in file PassBuilderBindings.cpp.

Function Documentation

◆ crossRegisterProxies()

PB crossRegisterProxies ( LAM  ,
FAM  ,
CGAM  ,
MAM   
)

◆ DEFINE_SIMPLE_CONVERSION_FUNCTIONS()

DEFINE_SIMPLE_CONVERSION_FUNCTIONS ( LLVMPassBuilderOptions  ,
LLVMPassBuilderOptionsRef   
)

◆ if() [1/3]

if ( Fun  )

◆ if() [2/3]

if ( PassOpts->  AAPipeline)

Definition at line 64 of file PassBuilderBindings.cpp.

References FAM, llvm::PassBuilder::parseAAPipeline(), PassOpts, PB(), llvm::AnalysisManager< IRUnitT, ExtraArgTs >::registerPass(), and llvm::wrap().

Referenced by _rpmalloc_heap_global_finalize(), llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::add(), allocset(), llvm::SwitchCG::SwitchLowering::buildBitTests(), canLowerToLDG(), llvm::GenericScheduler::checkAcyclicLatency(), llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneStringAttr(), llvm::IRSimilarity::IRSimilarityCandidate::compareNonCommutativeOperandMapping(), llvm::slpvectorizer::BoUpSLP::computeMinimumValueSizes(), llvm::DebuginfodServer::DebuginfodServer(), llvm::VPlanTransforms::dropPoisonGeneratingRecipes(), llvm::RangeListEntry::dump(), llvm::DWARFLocationTable::dumpLocationList(), eliminateConstraints(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::AsmPrinter::emitFunctionBody(), llvm::LoopVectorizationPlanner::emitInvalidCostRemarks(), llvm::LoopVectorizeHints::emitRemarkWithHints(), llvm::MCDwarfLineAddr::encode(), llvm::SystemZPostRASchedStrategy::enterMBB(), llvm::CodeExtractor::extractCodeRegion(), llvm::opt::OptTable::findNearest(), findReturnsToZap(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), llvm::gatherUnrollingPreferences(), llvm::dxil::ResourceInfo::getAnnotateProps(), llvm::ARMTTIImpl::getArithmeticInstrCost(), llvm::DWARFFormValue::getAsSectionedAddress(), llvm::Clause::getFormattedParserClassName(), llvm::IndexedInstrProfReader::getInstrProfRecord(), llvm::AArch64TTIImpl::getIntrinsicInstrCost(), llvm::PPCTTIImpl::getMemoryOpCost(), llvm::X86TTIImpl::getMinMaxReductionCost(), llvm::NVPTXTargetLowering::getPrototype(), llvm::RISCVTTIImpl::getVectorInstrCost(), llvm::objcopy::coff::handleArgs(), hashFullyQualifiedName(), llvm::GCNSchedStage::initGCNRegion(), llvm::object::DirectX::Signature::initialize(), llvm::orc::IRMaterializationUnit::IRMaterializationUnit(), isDereferenceableAndAlignedPointer(), llvm::isSafeToMoveBefore(), llvm::isSafeToUnrollAndJam(), lowerV4I32Shuffle(), llvm::AMDGPUSubtarget::makeLIDRangeMetadata(), llvm::MipsLegalizerInfo::MipsLegalizerInfo(), llvm::MLInlineAdvisor::onSuccessfulInlining(), llvm::opt::OptTable::ParseArgs(), llvm::opt::OptTable::ParseOneArg(), llvm::performOptimizedStructLayout(), predictValueUseListOrder(), predictValueUseListOrderImpl(), llvm::print(), llvm::CallGraph::print(), llvm::json::Path::Root::printErrorContext(), llvm::opt::OptTable::printHelp(), llvm::printRegClassOrBank(), qualifyCalleeCandidates(), llvm::WebAssemblyExceptionInfo::recalculate(), llvm::objcopy::elf::Object::removeSections(), llvm::reportMismatch(), llvm::SystemZPostRASchedStrategy::schedNode(), llvm::GenericSchedulerBase::setPolicy(), simplifyAMDGCNImageIntrinsic(), sortGlobalExprs(), translateImmediate(), translateRMMemory(), llvm::mca::RegisterFile::tryEliminateMoveOrSwap(), updateAndRemoveSymbols(), updateRegisterMapForDbgValueListAfterMove(), llvm::objcopy::elf::ELFSectionWriter< ELFT >::visit(), llvm::DWARFLocationTable::visitAbsoluteLocationList(), llvm::logicalview::LVSymbolVisitor::visitKnownRecord(), llvm::logicalview::LVTypeVisitor::visitKnownRecord(), llvm::InstCombinerImpl::visitPHINode(), llvm::coverage::CoverageMappingWriter::write(), llvm::TimeTraceProfiler::write(), and writeMemProfFrameArray().

◆ if() [3/3]

if ( VerifyEach  )

◆ PB()

PassBuilder PB ( Machine  ,
PassOpts->  PTO,
std::nullopt  ,
PIC 
)

◆ registerCallbacks()

SI registerCallbacks ( PIC  ,
MAM 
)

◆ registerCGSCCAnalyses()

PB registerCGSCCAnalyses ( CGAM  )

◆ registerFunctionAnalyses()

PB registerFunctionAnalyses ( FAM  )

◆ registerLoopAnalyses()

PB registerLoopAnalyses ( LAM  )

◆ registerModuleAnalyses()

PB registerModuleAnalyses ( MAM  )

◆ SI()

StandardInstrumentations SI ( Mod->  getContext(),
Debug  ,
VerifyEach   
)

◆ unwrap()

static TargetMachine * unwrap ( LLVMTargetMachineRef  P)
static

Variable Documentation

◆ CGAM

◆ else

else
Initial value:

Definition at line 89 of file PassBuilderBindings.cpp.

◆ FAM

Definition at line 61 of file PassBuilderBindings.cpp.

Referenced by llvm::AnalysisGetter::AnalysisGetter(), llvm::OpenMPIRBuilder::applySimd(), computeHeuristicUnrollFactor(), computeVirtualCallSiteTypeInfoMap(), llvm::PassBuilder::crossRegisterProxies(), doPromotion(), eliminateDeadCode(), llvm::FunctionPropertiesUpdater::finish(), llvm::FunctionPropertiesUpdater::finishAndTest(), llvm::FunctionAnalysisManagerMachineFunctionProxy::FunctionAnalysisManagerMachineFunctionProxy(), llvm::FunctionSpecializer::FunctionSpecializer(), getDefaultInlineAdvice(), llvm::getDefaultInlineOrder(), llvm::FunctionPropertiesInfo::getFunctionPropertiesInfo(), llvm::getInlineOrder(), llvm::getReplayInlineAdvisor(), if(), incorporateNewSCCRange(), llvm::AMDGPULibCalls::initFunction(), llvm::CallGraphUpdater::initialize(), llvm::SelectionDAGISel::initializeAnalysisResults(), llvm::FunctionAnalysisManagerCGSCCProxy::Result::invalidate(), llvm::lintFunction(), llvm::orc::BlockFreqQuery::operator()(), llvm::MIRParserImpl::parseMachineFunction(), promoteArguments(), promoteIndirectCalls(), llvm::PreservedCFGCheckerInstrumentation::registerCallbacks(), llvm::PassBuilder::registerFunctionAnalyses(), llvm::FunctionAnalysisManagerCGSCCProxy::Result::Result(), llvm::FunctionAnalysisManagerMachineFunctionProxy::Result::Result(), llvm::AMDGPUCodeGenPreparePass::run(), llvm::AMDGPULateCodeGenPreparePass::run(), llvm::AssumptionAnalysis::run(), llvm::UniformityInfoAnalysis::run(), llvm::ADCEPass::run(), llvm::DivRemPairsPass::run(), llvm::VectorCombinePass::run(), llvm::LoopAccessAnalysis::run(), llvm::AMDGPUAnnotateUniformValuesPass::run(), llvm::SIAnnotateControlFlowPass::run(), llvm::DependenceAnalysis::run(), llvm::DependenceAnalysisPrinterPass::run(), llvm::DOTGraphTraitsViewer< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >::run(), llvm::DOTGraphTraitsPrinter< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >::run(), llvm::FunctionPropertiesAnalysis::run(), llvm::InlineCostAnnotationPrinterPass::run(), llvm::LazyValueAnalysis::run(), llvm::DebugAssignmentTrackingPrinterPass::run(), llvm::DwarfEHPreparePass::run(), llvm::ExpandMemCmpPass::run(), llvm::GCFunctionAnalysis::run(), llvm::GCLoweringPass::run(), llvm::IndirectBrExpandPass::run(), llvm::InterleavedAccessPass::run(), llvm::InterleavedLoadCombinePass::run(), llvm::MachineFunctionAnalysis::run(), llvm::FunctionToMachineFunctionPassAdaptor::run(), llvm::SafeStackPass::run(), llvm::SelectOptimizePass::run(), llvm::StackProtectorPass::run(), llvm::ControlHeightReductionPass::run(), llvm::ThreadSanitizerPass::run(), llvm::LoopSinkPass::run(), llvm::LibCallsShrinkWrapPass::run(), llvm::PGOMemOPSizeOpt::run(), llvm::CallBrPreparePass::run(), llvm::CGSCCToFunctionPassAdaptor::run(), llvm::CoroSplitPass::run(), llvm::ArgumentPromotionPass::run(), llvm::AttributorCGSCCPass::run(), llvm::AttributorLightCGSCCPass::run(), llvm::PostOrderFunctionAttrsPass::run(), llvm::InlinerPass::run(), llvm::OpenMPOptCGSCCPass::run(), llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::run(), llvm::AMDGPUISelDAGToDAGPass::run(), llvm::ModuleInlinerPass::run(), llvm::MetaRenamerPass::run(), llvm::AlwaysInlinerPass::run(), llvm::PartialInlinerPass::run(), llvm::WholeProgramDevirtPass::run(), llvm::CallGraphDOTPrinterPass::run(), llvm::CallGraphViewerPass::run(), llvm::ModuleToPostOrderCGSCCPassAdaptor::run(), llvm::GlobalsAA::run(), llvm::LazyCallGraphAnalysis::run(), llvm::ModuleSummaryIndexAnalysis::run(), llvm::MustBeExecutedContextPrinterPass::run(), llvm::StackSafetyGlobalAnalysis::run(), llvm::PreISelIntrinsicLoweringPass::run(), llvm::ModuleToFunctionPassAdaptor::run(), llvm::AddressSanitizerPass::run(), llvm::CGProfilePass::run(), llvm::DataFlowSanitizerPass::run(), llvm::GCOVProfilerPass::run(), llvm::InstrProfilingLoweringPass::run(), llvm::MemorySanitizerPass::run(), llvm::MemProfUsePass::run(), llvm::NumericalStabilitySanitizerPass::run(), llvm::PGOForceFunctionAttrsPass::run(), llvm::SanitizerCoveragePass::run(), llvm::AttributorPass::run(), llvm::AttributorLightPass::run(), llvm::GlobalOptPass::run(), llvm::HotColdSplittingPass::run(), llvm::InferFunctionAttrsPass::run(), llvm::IROutlinerPass::run(), llvm::LoopExtractorPass::run(), llvm::MemProfContextDisambiguation::run(), llvm::OpenMPOptPass::run(), llvm::SampleProfileLoaderPass::run(), llvm::PseudoProbeUpdatePass::run(), llvm::IPSCCPPass::run(), llvm::ThinLTOBitcodeWriterPass::run(), llvm::RewriteStatepointsForGC::run(), llvm::RelLookupTableConverterPass::run(), llvm::AMDGPUAttributorPass::run(), llvm::ShadowStackGCLoweringPass::run(), llvm::CoroCleanupPass::run(), llvm::HWAddressSanitizerPass::run(), llvm::PGOInstrumentationGen::run(), llvm::PGOInstrumentationUse::run(), llvm::SyntheticCountsPropagation::run(), llvm::AMDGPUSplitModulePass::run(), runAttributorLightOnFunctions(), runCGProfilePass(), runIPSCCP(), runNewPMPasses(), shouldRunOnFunction(), llvm::AMDGPUTargetMachine::splitModule(), llvm::InlineAdvisorAnalysis::Result::tryCreate(), llvm::MLInlineAdvice::updateCachedCallerFPI(), updateCallGraphAfterCoroutineSplit(), llvm::updateCGAndAnalysisManagerForCGSCCPass(), llvm::updateCGAndAnalysisManagerForFunctionPass(), updateCGAndAnalysisManagerForPass(), llvm::FunctionAnalysisManagerCGSCCProxy::Result::updateFAM(), and updateNewSCCFunctionAnalyses().

◆ Fun

Function* Fun

Definition at line 51 of file PassBuilderBindings.cpp.

Referenced by if(), and LLVMRunPassesOnFunction().

◆ LAM

◆ LLVMErrorSuccess

return LLVMErrorSuccess

Definition at line 98 of file PassBuilderBindings.cpp.

◆ Machine

Definition at line 52 of file PassBuilderBindings.cpp.

Referenced by LLVMRunPasses(), and LLVMRunPassesOnFunction().

◆ MAM

Definition at line 63 of file PassBuilderBindings.cpp.

Referenced by computeVirtualCallSiteTypeInfoMap(), llvm::PassBuilder::crossRegisterProxies(), llvm::getInlineOrder(), llvm::getReleaseModeAdvisor(), llvm::MIRParserImpl::parseMachineFunction(), llvm::MIRParserImpl::parseMachineFunctions(), llvm::MIRParser::parseMachineFunctions(), promoteIndirectCalls(), llvm::PreservedCFGCheckerInstrumentation::registerCallbacks(), llvm::DebugifyEachInstrumentation::registerCallbacks(), llvm::VerifyInstrumentation::registerCallbacks(), llvm::StandardInstrumentations::registerCallbacks(), llvm::PassBuilder::registerModuleAnalyses(), llvm::InlineAdvisorAnalysis::Result::Result(), llvm::ModuleInlinerWrapperPass::run(), llvm::ModuleInlinerPass::run(), llvm::AlwaysInlinerPass::run(), llvm::DXILPrettyPrinterPass::run(), llvm::DXILTranslateMetadata::run(), llvm::AddressSanitizerPass::run(), llvm::CGProfilePass::run(), llvm::NumericalStabilitySanitizerPass::run(), llvm::SanitizerCoveragePass::run(), llvm::CtxProfAnalysisPrinterPass::run(), llvm::InlineAdvisorAnalysis::run(), llvm::InlineAdvisorAnalysisPrinterPass::run(), llvm::ShadowStackGCLoweringPass::run(), llvm::CoroCleanupPass::run(), llvm::HipStdParAcceleratorCodeSelectionPass::run(), llvm::HWAddressSanitizerPass::run(), llvm::PGOCtxProfLoweringPass::run(), llvm::PGOInstrumentationGen::run(), llvm::PGOInstrumentationUse::run(), llvm::PGOIndirectCallPromotion::run(), llvm::SyntheticCountsPropagation::run(), llvm::AMDGPUSplitModulePass::run(), runNewPMPasses(), and llvm::AMDGPUTargetMachine::splitModule().

◆ Mod

if (auto Err = PB.parsePassPipeline(MPM, Passes)) return wrap(std MPM run* Mod

◆ Passes

Function const char* Passes

◆ PassOpts

Initial value:
{
bool Debug = PassOpts->DebugLogging
static ManagedStatic< cl::opt< bool, true >, CreateDebug > Debug
Definition: Debug.cpp:108
Function const char TargetMachine LLVMPassBuilderOptions * PassOpts

Definition at line 53 of file PassBuilderBindings.cpp.

Referenced by if(), LLVMRunPasses(), and LLVMRunPassesOnFunction().

◆ PIC

◆ VerifyEach

bool VerifyEach = PassOpts->VerifyEach

Definition at line 55 of file PassBuilderBindings.cpp.

Referenced by if(), and LLVMPassBuilderOptionsSetVerifyEach().