From 34005e1774ef0cf283b204923112fbef972112c6 Mon Sep 17 00:00:00 2001 From: Andrew Rogers Date: Mon, 9 Jun 2025 15:14:59 -0700 Subject: [PATCH 1/3] [llvm] annotate interfaces in Passes library for DLL export --- llvm/include/llvm/InitializePasses.h | 574 +++++++++--------- llvm/include/llvm/Pass.h | 13 +- llvm/include/llvm/PassAnalysisSupport.h | 15 +- llvm/include/llvm/PassRegistry.h | 17 +- llvm/include/llvm/PassSupport.h | 3 +- llvm/include/llvm/Passes/OptimizationLevel.h | 13 +- llvm/include/llvm/Passes/PassBuilder.h | 93 +-- llvm/include/llvm/Passes/PassPlugin.h | 4 +- .../llvm/Passes/StandardInstrumentations.h | 49 +- 9 files changed, 394 insertions(+), 387 deletions(-) diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 42610d505c2bd..c5e66732eb330 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -19,313 +19,313 @@ namespace llvm { class PassRegistry; /// Initialize all passes linked into the Core library. -void initializeCore(PassRegistry &); +LLVM_ABI void initializeCore(PassRegistry &); /// Initialize all passes linked into the TransformUtils library. -void initializeTransformUtils(PassRegistry &); +LLVM_ABI void initializeTransformUtils(PassRegistry &); /// Initialize all passes linked into the ScalarOpts library. -void initializeScalarOpts(PassRegistry &); +LLVM_ABI void initializeScalarOpts(PassRegistry &); /// Initialize all passes linked into the Vectorize library. -void initializeVectorization(PassRegistry &); +LLVM_ABI void initializeVectorization(PassRegistry &); /// Initialize all passes linked into the InstCombine library. -void initializeInstCombine(PassRegistry &); +LLVM_ABI void initializeInstCombine(PassRegistry &); /// Initialize all passes linked into the IPO library. -void initializeIPO(PassRegistry &); +LLVM_ABI void initializeIPO(PassRegistry &); /// Initialize all passes linked into the Analysis library. -void initializeAnalysis(PassRegistry &); +LLVM_ABI void initializeAnalysis(PassRegistry &); /// Initialize all passes linked into the CodeGen library. -void initializeCodeGen(PassRegistry &); +LLVM_ABI void initializeCodeGen(PassRegistry &); /// Initialize all passes linked into the GlobalISel library. -void initializeGlobalISel(PassRegistry &); +LLVM_ABI void initializeGlobalISel(PassRegistry &); /// Initialize all passes linked into the CodeGen library. -void initializeTarget(PassRegistry &); +LLVM_ABI void initializeTarget(PassRegistry &); -void initializeAAResultsWrapperPassPass(PassRegistry &); -void initializeAlwaysInlinerLegacyPassPass(PassRegistry &); -void initializeAssignmentTrackingAnalysisPass(PassRegistry &); -void initializeAssumptionCacheTrackerPass(PassRegistry &); -void initializeAtomicExpandLegacyPass(PassRegistry &); -void initializeBasicBlockPathCloningPass(PassRegistry &); -void initializeBasicBlockSectionsProfileReaderWrapperPassPass(PassRegistry &); -void initializeBasicBlockSectionsPass(PassRegistry &); -void initializeBarrierNoopPass(PassRegistry &); -void initializeBasicAAWrapperPassPass(PassRegistry &); -void initializeBlockFrequencyInfoWrapperPassPass(PassRegistry &); -void initializeBranchFolderLegacyPass(PassRegistry &); -void initializeBranchProbabilityInfoWrapperPassPass(PassRegistry &); -void initializeBranchRelaxationLegacyPass(PassRegistry &); -void initializeBreakCriticalEdgesPass(PassRegistry &); -void initializeBreakFalseDepsPass(PassRegistry &); -void initializeCanonicalizeFreezeInLoopsPass(PassRegistry &); -void initializeCFGSimplifyPassPass(PassRegistry &); -void initializeCFGuardPass(PassRegistry &); -void initializeCFGuardLongjmpPass(PassRegistry &); -void initializeCFIFixupPass(PassRegistry &); -void initializeCFIInstrInserterPass(PassRegistry &); -void initializeCallBrPreparePass(PassRegistry &); -void initializeCallGraphDOTPrinterPass(PassRegistry &); -void initializeCallGraphViewerPass(PassRegistry &); -void initializeCallGraphWrapperPassPass(PassRegistry &); -void initializeCheckDebugMachineModulePass(PassRegistry &); -void initializeCodeGenPrepareLegacyPassPass(PassRegistry &); -void initializeComplexDeinterleavingLegacyPassPass(PassRegistry &); -void initializeConstantHoistingLegacyPassPass(PassRegistry &); -void initializeCycleInfoWrapperPassPass(PassRegistry &); -void initializeDAEPass(PassRegistry &); -void initializeDAHPass(PassRegistry &); -void initializeDCELegacyPassPass(PassRegistry &); -void initializeDXILMetadataAnalysisWrapperPassPass(PassRegistry &); -void initializeDXILMetadataAnalysisWrapperPrinterPass(PassRegistry &); -void initializeDXILResourceBindingWrapperPassPass(PassRegistry &); -void initializeDXILResourceImplicitBindingLegacyPass(PassRegistry &); -void initializeDXILResourceTypeWrapperPassPass(PassRegistry &); -void initializeDXILResourceWrapperPassPass(PassRegistry &); -void initializeDeadMachineInstructionElimPass(PassRegistry &); -void initializeDebugifyMachineModulePass(PassRegistry &); -void initializeDependenceAnalysisWrapperPassPass(PassRegistry &); -void initializeDetectDeadLanesLegacyPass(PassRegistry &); -void initializeDomOnlyPrinterWrapperPassPass(PassRegistry &); -void initializeDomOnlyViewerWrapperPassPass(PassRegistry &); -void initializeDomPrinterWrapperPassPass(PassRegistry &); -void initializeDomViewerWrapperPassPass(PassRegistry &); -void initializeDominanceFrontierWrapperPassPass(PassRegistry &); -void initializeDominatorTreeWrapperPassPass(PassRegistry &); -void initializeDwarfEHPrepareLegacyPassPass(PassRegistry &); -void initializeEarlyCSELegacyPassPass(PassRegistry &); -void initializeEarlyCSEMemSSALegacyPassPass(PassRegistry &); -void initializeEarlyIfConverterLegacyPass(PassRegistry &); -void initializeEarlyIfPredicatorPass(PassRegistry &); -void initializeEarlyMachineLICMPass(PassRegistry &); -void initializeEarlyTailDuplicateLegacyPass(PassRegistry &); -void initializeEdgeBundlesWrapperLegacyPass(PassRegistry &); -void initializeEHContGuardTargetsPass(PassRegistry &); -void initializeExpandFpLegacyPassPass(PassRegistry &); -void initializeExpandLargeDivRemLegacyPassPass(PassRegistry &); -void initializeExpandMemCmpLegacyPassPass(PassRegistry &); -void initializeExpandPostRALegacyPass(PassRegistry &); -void initializeExpandReductionsPass(PassRegistry &); -void initializeExpandVariadicsPass(PassRegistry &); -void initializeExternalAAWrapperPassPass(PassRegistry &); -void initializeFEntryInserterLegacyPass(PassRegistry &); -void initializeFinalizeISelPass(PassRegistry &); -void initializeFinalizeMachineBundlesPass(PassRegistry &); -void initializeFixIrreduciblePass(PassRegistry &); -void initializeFixupStatepointCallerSavedLegacyPass(PassRegistry &); -void initializeFlattenCFGLegacyPassPass(PassRegistry &); -void initializeFuncletLayoutPass(PassRegistry &); -void initializeGCEmptyBasicBlocksPass(PassRegistry &); -void initializeGCMachineCodeAnalysisPass(PassRegistry &); -void initializeGCModuleInfoPass(PassRegistry &); -void initializeGVNLegacyPassPass(PassRegistry &); -void initializeGlobalMergeFuncPassWrapperPass(PassRegistry &); -void initializeGlobalMergePass(PassRegistry &); -void initializeGlobalsAAWrapperPassPass(PassRegistry &); -void initializeHardwareLoopsLegacyPass(PassRegistry &); -void initializeMIRProfileLoaderPassPass(PassRegistry &); -void initializeIRSimilarityIdentifierWrapperPassPass(PassRegistry &); -void initializeIRTranslatorPass(PassRegistry &); -void initializeIVUsersWrapperPassPass(PassRegistry &); -void initializeIfConverterPass(PassRegistry &); -void initializeImmutableModuleSummaryIndexWrapperPassPass(PassRegistry &); -void initializeImplicitNullChecksPass(PassRegistry &); -void initializeIndirectBrExpandLegacyPassPass(PassRegistry &); -void initializeInferAddressSpacesPass(PassRegistry &); -void initializeInstSimplifyLegacyPassPass(PassRegistry &); -void initializeInstructionCombiningPassPass(PassRegistry &); -void initializeInstructionSelectPass(PassRegistry &); -void initializeInterleavedAccessPass(PassRegistry &); -void initializeInterleavedLoadCombinePass(PassRegistry &); -void initializeJMCInstrumenterPass(PassRegistry &); +LLVM_ABI void initializeAAResultsWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeAlwaysInlinerLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeAssignmentTrackingAnalysisPass(PassRegistry &); +LLVM_ABI void initializeAssumptionCacheTrackerPass(PassRegistry &); +LLVM_ABI void initializeAtomicExpandLegacyPass(PassRegistry &); +LLVM_ABI void initializeBasicBlockPathCloningPass(PassRegistry &); +LLVM_ABI void initializeBasicBlockSectionsProfileReaderWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeBasicBlockSectionsPass(PassRegistry &); +LLVM_ABI void initializeBarrierNoopPass(PassRegistry &); +LLVM_ABI void initializeBasicAAWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeBlockFrequencyInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeBranchFolderLegacyPass(PassRegistry &); +LLVM_ABI void initializeBranchProbabilityInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeBranchRelaxationLegacyPass(PassRegistry &); +LLVM_ABI void initializeBreakCriticalEdgesPass(PassRegistry &); +LLVM_ABI void initializeBreakFalseDepsPass(PassRegistry &); +LLVM_ABI void initializeCanonicalizeFreezeInLoopsPass(PassRegistry &); +LLVM_ABI void initializeCFGSimplifyPassPass(PassRegistry &); +LLVM_ABI void initializeCFGuardPass(PassRegistry &); +LLVM_ABI void initializeCFGuardLongjmpPass(PassRegistry &); +LLVM_ABI void initializeCFIFixupPass(PassRegistry &); +LLVM_ABI void initializeCFIInstrInserterPass(PassRegistry &); +LLVM_ABI void initializeCallBrPreparePass(PassRegistry &); +LLVM_ABI void initializeCallGraphDOTPrinterPass(PassRegistry &); +LLVM_ABI void initializeCallGraphViewerPass(PassRegistry &); +LLVM_ABI void initializeCallGraphWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeCheckDebugMachineModulePass(PassRegistry &); +LLVM_ABI void initializeCodeGenPrepareLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeComplexDeinterleavingLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeConstantHoistingLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeCycleInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDAEPass(PassRegistry &); +LLVM_ABI void initializeDAHPass(PassRegistry &); +LLVM_ABI void initializeDCELegacyPassPass(PassRegistry &); +LLVM_ABI void initializeDXILMetadataAnalysisWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDXILMetadataAnalysisWrapperPrinterPass(PassRegistry &); +LLVM_ABI void initializeDXILResourceBindingWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDXILResourceImplicitBindingLegacyPass(PassRegistry &); +LLVM_ABI void initializeDXILResourceTypeWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDXILResourceWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDeadMachineInstructionElimPass(PassRegistry &); +LLVM_ABI void initializeDebugifyMachineModulePass(PassRegistry &); +LLVM_ABI void initializeDependenceAnalysisWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDetectDeadLanesLegacyPass(PassRegistry &); +LLVM_ABI void initializeDomOnlyPrinterWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDomOnlyViewerWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDomPrinterWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDomViewerWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDominanceFrontierWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDominatorTreeWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeDwarfEHPrepareLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeEarlyCSELegacyPassPass(PassRegistry &); +LLVM_ABI void initializeEarlyCSEMemSSALegacyPassPass(PassRegistry &); +LLVM_ABI void initializeEarlyIfConverterLegacyPass(PassRegistry &); +LLVM_ABI void initializeEarlyIfPredicatorPass(PassRegistry &); +LLVM_ABI void initializeEarlyMachineLICMPass(PassRegistry &); +LLVM_ABI void initializeEarlyTailDuplicateLegacyPass(PassRegistry &); +LLVM_ABI void initializeEdgeBundlesWrapperLegacyPass(PassRegistry &); +LLVM_ABI void initializeEHContGuardTargetsPass(PassRegistry &); +LLVM_ABI void initializeExpandFpLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeExpandLargeDivRemLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeExpandMemCmpLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeExpandPostRALegacyPass(PassRegistry &); +LLVM_ABI void initializeExpandReductionsPass(PassRegistry &); +LLVM_ABI void initializeExpandVariadicsPass(PassRegistry &); +LLVM_ABI void initializeExternalAAWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeFEntryInserterLegacyPass(PassRegistry &); +LLVM_ABI void initializeFinalizeISelPass(PassRegistry &); +LLVM_ABI void initializeFinalizeMachineBundlesPass(PassRegistry &); +LLVM_ABI void initializeFixIrreduciblePass(PassRegistry &); +LLVM_ABI void initializeFixupStatepointCallerSavedLegacyPass(PassRegistry &); +LLVM_ABI void initializeFlattenCFGLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeFuncletLayoutPass(PassRegistry &); +LLVM_ABI void initializeGCEmptyBasicBlocksPass(PassRegistry &); +LLVM_ABI void initializeGCMachineCodeAnalysisPass(PassRegistry &); +LLVM_ABI void initializeGCModuleInfoPass(PassRegistry &); +LLVM_ABI void initializeGVNLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeGlobalMergeFuncPassWrapperPass(PassRegistry &); +LLVM_ABI void initializeGlobalMergePass(PassRegistry &); +LLVM_ABI void initializeGlobalsAAWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeHardwareLoopsLegacyPass(PassRegistry &); +LLVM_ABI void initializeMIRProfileLoaderPassPass(PassRegistry &); +LLVM_ABI void initializeIRSimilarityIdentifierWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeIRTranslatorPass(PassRegistry &); +LLVM_ABI void initializeIVUsersWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeIfConverterPass(PassRegistry &); +LLVM_ABI void initializeImmutableModuleSummaryIndexWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeImplicitNullChecksPass(PassRegistry &); +LLVM_ABI void initializeIndirectBrExpandLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeInferAddressSpacesPass(PassRegistry &); +LLVM_ABI void initializeInstSimplifyLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeInstructionCombiningPassPass(PassRegistry &); +LLVM_ABI void initializeInstructionSelectPass(PassRegistry &); +LLVM_ABI void initializeInterleavedAccessPass(PassRegistry &); +LLVM_ABI void initializeInterleavedLoadCombinePass(PassRegistry &); +LLVM_ABI void initializeJMCInstrumenterPass(PassRegistry &); +LLVM_ABI void initializeKCFIPass(PassRegistry &); +LLVM_ABI void initializeLCSSAVerificationPassPass(PassRegistry &); +LLVM_ABI void initializeLCSSAWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeLazyBFIPassPass(PassRegistry &); +LLVM_ABI void initializeLazyBlockFrequencyInfoPassPass(PassRegistry &); +LLVM_ABI void initializeLazyBranchProbabilityInfoPassPass(PassRegistry &); +LLVM_ABI void initializeLazyMachineBlockFrequencyInfoPassPass(PassRegistry &); +LLVM_ABI void initializeLazyValueInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeLegacyLICMPassPass(PassRegistry &); +LLVM_ABI void initializeLegalizerPass(PassRegistry &); +LLVM_ABI void initializeGISelCSEAnalysisWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeGISelValueTrackingAnalysisLegacyPass(PassRegistry &); +LLVM_ABI void initializeLiveDebugValuesLegacyPass(PassRegistry &); +LLVM_ABI void initializeLiveDebugVariablesWrapperLegacyPass(PassRegistry &); +LLVM_ABI void initializeLiveIntervalsWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeLiveRangeShrinkPass(PassRegistry &); +LLVM_ABI void initializeLiveRegMatrixWrapperLegacyPass(PassRegistry &); +LLVM_ABI void initializeLiveStacksWrapperLegacyPass(PassRegistry &); +LLVM_ABI void initializeLiveVariablesWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeLoadStoreOptPass(PassRegistry &); +LLVM_ABI void initializeLoadStoreVectorizerLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeLocalStackSlotPassPass(PassRegistry &); +LLVM_ABI void initializeLocalizerPass(PassRegistry &); +LLVM_ABI void initializeLoopDataPrefetchLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeLoopExtractorLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeLoopInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeLoopPassPass(PassRegistry &); +LLVM_ABI void initializeLoopSimplifyPass(PassRegistry &); +LLVM_ABI void initializeLoopStrengthReducePass(PassRegistry &); +LLVM_ABI void initializeLoopTermFoldPass(PassRegistry &); +LLVM_ABI void initializeLoopUnrollPass(PassRegistry &); +LLVM_ABI void initializeLowerAtomicLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeLowerEmuTLSPass(PassRegistry &); +LLVM_ABI void initializeLowerGlobalDtorsLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeLowerIntrinsicsPass(PassRegistry &); +LLVM_ABI void initializeLowerInvokeLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeLowerSwitchLegacyPassPass(PassRegistry &); void initializeKCFIPass(PassRegistry &); -void initializeLCSSAVerificationPassPass(PassRegistry &); -void initializeLCSSAWrapperPassPass(PassRegistry &); -void initializeLazyBFIPassPass(PassRegistry &); -void initializeLazyBlockFrequencyInfoPassPass(PassRegistry &); -void initializeLazyBranchProbabilityInfoPassPass(PassRegistry &); -void initializeLazyMachineBlockFrequencyInfoPassPass(PassRegistry &); -void initializeLazyValueInfoWrapperPassPass(PassRegistry &); -void initializeLegacyLICMPassPass(PassRegistry &); -void initializeLegalizerPass(PassRegistry &); -void initializeGISelCSEAnalysisWrapperPassPass(PassRegistry &); -void initializeGISelValueTrackingAnalysisLegacyPass(PassRegistry &); -void initializeLiveDebugValuesLegacyPass(PassRegistry &); -void initializeLiveDebugVariablesWrapperLegacyPass(PassRegistry &); -void initializeLiveIntervalsWrapperPassPass(PassRegistry &); -void initializeLiveRangeShrinkPass(PassRegistry &); -void initializeLiveRegMatrixWrapperLegacyPass(PassRegistry &); -void initializeLiveStacksWrapperLegacyPass(PassRegistry &); -void initializeLiveVariablesWrapperPassPass(PassRegistry &); -void initializeLoadStoreOptPass(PassRegistry &); -void initializeLoadStoreVectorizerLegacyPassPass(PassRegistry &); -void initializeLocalStackSlotPassPass(PassRegistry &); -void initializeLocalizerPass(PassRegistry &); -void initializeLoopDataPrefetchLegacyPassPass(PassRegistry &); -void initializeLoopExtractorLegacyPassPass(PassRegistry &); -void initializeLoopInfoWrapperPassPass(PassRegistry &); -void initializeLoopPassPass(PassRegistry &); -void initializeLoopSimplifyPass(PassRegistry &); -void initializeLoopStrengthReducePass(PassRegistry &); -void initializeLoopTermFoldPass(PassRegistry &); -void initializeLoopUnrollPass(PassRegistry &); -void initializeLowerAtomicLegacyPassPass(PassRegistry &); -void initializeLowerEmuTLSPass(PassRegistry &); -void initializeLowerGlobalDtorsLegacyPassPass(PassRegistry &); -void initializeLowerIntrinsicsPass(PassRegistry &); -void initializeLowerInvokeLegacyPassPass(PassRegistry &); -void initializeLowerSwitchLegacyPassPass(PassRegistry &); -void initializeKCFIPass(PassRegistry &); -void initializeMIRAddFSDiscriminatorsPass(PassRegistry &); -void initializeMIRCanonicalizerPass(PassRegistry &); -void initializeMIRNamerPass(PassRegistry &); -void initializeMIRPrintingPassPass(PassRegistry &); -void initializeMachineBlockFrequencyInfoWrapperPassPass(PassRegistry &); -void initializeMachineBlockPlacementLegacyPass(PassRegistry &); -void initializeMachineBlockPlacementStatsLegacyPass(PassRegistry &); -void initializeMachineBranchProbabilityInfoWrapperPassPass(PassRegistry &); -void initializeMachineCFGPrinterPass(PassRegistry &); -void initializeMachineCSELegacyPass(PassRegistry &); -void initializeMachineCombinerPass(PassRegistry &); -void initializeMachineCopyPropagationLegacyPass(PassRegistry &); -void initializeMachineCycleInfoPrinterLegacyPass(PassRegistry &); -void initializeMachineCycleInfoWrapperPassPass(PassRegistry &); -void initializeMachineDominanceFrontierPass(PassRegistry &); -void initializeMachineDominatorTreeWrapperPassPass(PassRegistry &); -void initializeMachineFunctionPrinterPassPass(PassRegistry &); -void initializeMachineFunctionSplitterPass(PassRegistry &); -void initializeMachineLateInstrsCleanupLegacyPass(PassRegistry &); -void initializeMachineLICMPass(PassRegistry &); -void initializeMachineLoopInfoWrapperPassPass(PassRegistry &); -void initializeMachineModuleInfoWrapperPassPass(PassRegistry &); -void initializeMachineOptimizationRemarkEmitterPassPass(PassRegistry &); -void initializeMachineOutlinerPass(PassRegistry &); -void initializeStaticDataProfileInfoWrapperPassPass(PassRegistry &); -void initializeStaticDataAnnotatorPass(PassRegistry &); -void initializeMachinePipelinerPass(PassRegistry &); -void initializeMachinePostDominatorTreeWrapperPassPass(PassRegistry &); -void initializeMachineRegionInfoPassPass(PassRegistry &); -void initializeMachineSanitizerBinaryMetadataLegacyPass(PassRegistry &); -void initializeMachineSchedulerLegacyPass(PassRegistry &); -void initializeMachineSinkingLegacyPass(PassRegistry &); -void initializeMachineTraceMetricsWrapperPassPass(PassRegistry &); -void initializeMachineUniformityInfoPrinterPassPass(PassRegistry &); -void initializeMachineUniformityAnalysisPassPass(PassRegistry &); -void initializeMachineVerifierLegacyPassPass(PassRegistry &); -void initializeMemoryDependenceWrapperPassPass(PassRegistry &); -void initializeMemorySSAWrapperPassPass(PassRegistry &); -void initializeMergeICmpsLegacyPassPass(PassRegistry &); -void initializeModuleSummaryIndexWrapperPassPass(PassRegistry &); -void initializeModuloScheduleTestPass(PassRegistry &); -void initializeNaryReassociateLegacyPassPass(PassRegistry &); -void initializeObjCARCContractLegacyPassPass(PassRegistry &); -void initializeOptimizationRemarkEmitterWrapperPassPass(PassRegistry &); -void initializeOptimizePHIsLegacyPass(PassRegistry &); -void initializePEILegacyPass(PassRegistry &); -void initializePHIEliminationPass(PassRegistry &); -void initializePartiallyInlineLibCallsLegacyPassPass(PassRegistry &); -void initializePatchableFunctionLegacyPass(PassRegistry &); -void initializePeepholeOptimizerLegacyPass(PassRegistry &); -void initializePhiValuesWrapperPassPass(PassRegistry &); -void initializePhysicalRegisterUsageInfoWrapperLegacyPass(PassRegistry &); -void initializePlaceBackedgeSafepointsLegacyPassPass(PassRegistry &); -void initializePostDomOnlyPrinterWrapperPassPass(PassRegistry &); -void initializePostDomOnlyViewerWrapperPassPass(PassRegistry &); -void initializePostDomPrinterWrapperPassPass(PassRegistry &); -void initializePostDomViewerWrapperPassPass(PassRegistry &); -void initializePostDominatorTreeWrapperPassPass(PassRegistry &); -void initializePostInlineEntryExitInstrumenterPass(PassRegistry &); -void initializePostMachineSchedulerLegacyPass(PassRegistry &); -void initializePostRAHazardRecognizerLegacyPass(PassRegistry &); -void initializePostRAMachineSinkingPass(PassRegistry &); -void initializePostRASchedulerLegacyPass(PassRegistry &); -void initializePreISelIntrinsicLoweringLegacyPassPass(PassRegistry &); -void initializePrintFunctionPassWrapperPass(PassRegistry &); -void initializePrintModulePassWrapperPass(PassRegistry &); -void initializeProcessImplicitDefsPass(PassRegistry &); -void initializeProfileSummaryInfoWrapperPassPass(PassRegistry &); -void initializePromoteLegacyPassPass(PassRegistry &); -void initializeRABasicPass(PassRegistry &); -void initializePseudoProbeInserterPass(PassRegistry &); -void initializeRAGreedyLegacyPass(PassRegistry &); -void initializeReachingDefAnalysisPass(PassRegistry &); -void initializeReassociateLegacyPassPass(PassRegistry &); -void initializeRegAllocEvictionAdvisorAnalysisLegacyPass(PassRegistry &); -void initializeRegAllocFastPass(PassRegistry &); -void initializeRegAllocPriorityAdvisorAnalysisLegacyPass(PassRegistry &); -void initializeRegAllocScoringPass(PassRegistry &); -void initializeRegBankSelectPass(PassRegistry &); -void initializeRegToMemWrapperPassPass(PassRegistry &); -void initializeRegUsageInfoCollectorLegacyPass(PassRegistry &); -void initializeRegUsageInfoPropagationLegacyPass(PassRegistry &); -void initializeRegionInfoPassPass(PassRegistry &); -void initializeRegionOnlyPrinterPass(PassRegistry &); -void initializeRegionOnlyViewerPass(PassRegistry &); -void initializeRegionPrinterPass(PassRegistry &); -void initializeRegionViewerPass(PassRegistry &); -void initializeRegisterCoalescerLegacyPass(PassRegistry &); -void initializeRemoveLoadsIntoFakeUsesLegacyPass(PassRegistry &); -void initializeRemoveRedundantDebugValuesLegacyPass(PassRegistry &); -void initializeRenameIndependentSubregsLegacyPass(PassRegistry &); -void initializeReplaceWithVeclibLegacyPass(PassRegistry &); -void initializeResetMachineFunctionPass(PassRegistry &); -void initializeSCEVAAWrapperPassPass(PassRegistry &); -void initializeSROALegacyPassPass(PassRegistry &); -void initializeSafeStackLegacyPassPass(PassRegistry &); -void initializeSafepointIRVerifierPass(PassRegistry &); -void initializeSelectOptimizePass(PassRegistry &); -void initializeScalarEvolutionWrapperPassPass(PassRegistry &); -void initializeScalarizeMaskedMemIntrinLegacyPassPass(PassRegistry &); -void initializeScalarizerLegacyPassPass(PassRegistry &); -void initializeScavengerTestPass(PassRegistry &); -void initializeScopedNoAliasAAWrapperPassPass(PassRegistry &); -void initializeSeparateConstOffsetFromGEPLegacyPassPass(PassRegistry &); -void initializeShadowStackGCLoweringPass(PassRegistry &); -void initializeShrinkWrapLegacyPass(PassRegistry &); -void initializeSingleLoopExtractorPass(PassRegistry &); -void initializeSinkingLegacyPassPass(PassRegistry &); -void initializeSjLjEHPreparePass(PassRegistry &); -void initializeSlotIndexesWrapperPassPass(PassRegistry &); -void initializeSpeculativeExecutionLegacyPassPass(PassRegistry &); -void initializeSpillPlacementWrapperLegacyPass(PassRegistry &); -void initializeStackColoringLegacyPass(PassRegistry &); -void initializeStackFrameLayoutAnalysisLegacyPass(PassRegistry &); -void initializeStaticDataSplitterPass(PassRegistry &); -void initializeStackMapLivenessPass(PassRegistry &); -void initializeStackProtectorPass(PassRegistry &); -void initializeStackSafetyGlobalInfoWrapperPassPass(PassRegistry &); -void initializeStackSafetyInfoWrapperPassPass(PassRegistry &); -void initializeStackSlotColoringLegacyPass(PassRegistry &); -void initializeStraightLineStrengthReduceLegacyPassPass(PassRegistry &); -void initializeStripDebugMachineModulePass(PassRegistry &); -void initializeStructurizeCFGLegacyPassPass(PassRegistry &); -void initializeTailCallElimPass(PassRegistry &); -void initializeTailDuplicateLegacyPass(PassRegistry &); -void initializeTargetLibraryInfoWrapperPassPass(PassRegistry &); -void initializeTargetPassConfigPass(PassRegistry &); -void initializeTargetTransformInfoWrapperPassPass(PassRegistry &); -void initializeTwoAddressInstructionLegacyPassPass(PassRegistry &); -void initializeTypeBasedAAWrapperPassPass(PassRegistry &); -void initializeTypePromotionLegacyPass(PassRegistry &); -void initializeInitUndefPass(PassRegistry &); -void initializeUniformityInfoWrapperPassPass(PassRegistry &); -void initializeUnifyLoopExitsLegacyPassPass(PassRegistry &); -void initializeUnpackMachineBundlesPass(PassRegistry &); -void initializeUnreachableBlockElimLegacyPassPass(PassRegistry &); -void initializeUnreachableMachineBlockElimLegacyPass(PassRegistry &); -void initializeVerifierLegacyPassPass(PassRegistry &); -void initializeVirtRegMapWrapperLegacyPass(PassRegistry &); -void initializeVirtRegRewriterLegacyPass(PassRegistry &); -void initializeWasmEHPreparePass(PassRegistry &); -void initializeWinEHPreparePass(PassRegistry &); -void initializeWriteBitcodePassPass(PassRegistry &); -void initializeXRayInstrumentationLegacyPass(PassRegistry &); +LLVM_ABI void initializeMIRAddFSDiscriminatorsPass(PassRegistry &); +LLVM_ABI void initializeMIRCanonicalizerPass(PassRegistry &); +LLVM_ABI void initializeMIRNamerPass(PassRegistry &); +LLVM_ABI void initializeMIRPrintingPassPass(PassRegistry &); +LLVM_ABI void initializeMachineBlockFrequencyInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeMachineBlockPlacementLegacyPass(PassRegistry &); +LLVM_ABI void initializeMachineBlockPlacementStatsLegacyPass(PassRegistry &); +LLVM_ABI void initializeMachineBranchProbabilityInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeMachineCFGPrinterPass(PassRegistry &); +LLVM_ABI void initializeMachineCSELegacyPass(PassRegistry &); +LLVM_ABI void initializeMachineCombinerPass(PassRegistry &); +LLVM_ABI void initializeMachineCopyPropagationLegacyPass(PassRegistry &); +LLVM_ABI void initializeMachineCycleInfoPrinterLegacyPass(PassRegistry &); +LLVM_ABI void initializeMachineCycleInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeMachineDominanceFrontierPass(PassRegistry &); +LLVM_ABI void initializeMachineDominatorTreeWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeMachineFunctionPrinterPassPass(PassRegistry &); +LLVM_ABI void initializeMachineFunctionSplitterPass(PassRegistry &); +LLVM_ABI void initializeMachineLateInstrsCleanupLegacyPass(PassRegistry &); +LLVM_ABI void initializeMachineLICMPass(PassRegistry &); +LLVM_ABI void initializeMachineLoopInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeMachineModuleInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeMachineOptimizationRemarkEmitterPassPass(PassRegistry &); +LLVM_ABI void initializeMachineOutlinerPass(PassRegistry &); +LLVM_ABI void initializeStaticDataProfileInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeStaticDataAnnotatorPass(PassRegistry &); +LLVM_ABI void initializeMachinePipelinerPass(PassRegistry &); +LLVM_ABI void initializeMachinePostDominatorTreeWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeMachineRegionInfoPassPass(PassRegistry &); +LLVM_ABI void initializeMachineSanitizerBinaryMetadataLegacyPass(PassRegistry &); +LLVM_ABI void initializeMachineSchedulerLegacyPass(PassRegistry &); +LLVM_ABI void initializeMachineSinkingLegacyPass(PassRegistry &); +LLVM_ABI void initializeMachineTraceMetricsWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeMachineUniformityInfoPrinterPassPass(PassRegistry &); +LLVM_ABI void initializeMachineUniformityAnalysisPassPass(PassRegistry &); +LLVM_ABI void initializeMachineVerifierLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeMemoryDependenceWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeMemorySSAWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeMergeICmpsLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeModuleSummaryIndexWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeModuloScheduleTestPass(PassRegistry &); +LLVM_ABI void initializeNaryReassociateLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeObjCARCContractLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeOptimizationRemarkEmitterWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeOptimizePHIsLegacyPass(PassRegistry &); +LLVM_ABI void initializePEILegacyPass(PassRegistry &); +LLVM_ABI void initializePHIEliminationPass(PassRegistry &); +LLVM_ABI void initializePartiallyInlineLibCallsLegacyPassPass(PassRegistry &); +LLVM_ABI void initializePatchableFunctionLegacyPass(PassRegistry &); +LLVM_ABI void initializePeepholeOptimizerLegacyPass(PassRegistry &); +LLVM_ABI void initializePhiValuesWrapperPassPass(PassRegistry &); +LLVM_ABI void initializePhysicalRegisterUsageInfoWrapperLegacyPass(PassRegistry &); +LLVM_ABI void initializePlaceBackedgeSafepointsLegacyPassPass(PassRegistry &); +LLVM_ABI void initializePostDomOnlyPrinterWrapperPassPass(PassRegistry &); +LLVM_ABI void initializePostDomOnlyViewerWrapperPassPass(PassRegistry &); +LLVM_ABI void initializePostDomPrinterWrapperPassPass(PassRegistry &); +LLVM_ABI void initializePostDomViewerWrapperPassPass(PassRegistry &); +LLVM_ABI void initializePostDominatorTreeWrapperPassPass(PassRegistry &); +LLVM_ABI void initializePostInlineEntryExitInstrumenterPass(PassRegistry &); +LLVM_ABI void initializePostMachineSchedulerLegacyPass(PassRegistry &); +LLVM_ABI void initializePostRAHazardRecognizerLegacyPass(PassRegistry &); +LLVM_ABI void initializePostRAMachineSinkingPass(PassRegistry &); +LLVM_ABI void initializePostRASchedulerLegacyPass(PassRegistry &); +LLVM_ABI void initializePreISelIntrinsicLoweringLegacyPassPass(PassRegistry &); +LLVM_ABI void initializePrintFunctionPassWrapperPass(PassRegistry &); +LLVM_ABI void initializePrintModulePassWrapperPass(PassRegistry &); +LLVM_ABI void initializeProcessImplicitDefsPass(PassRegistry &); +LLVM_ABI void initializeProfileSummaryInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializePromoteLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeRABasicPass(PassRegistry &); +LLVM_ABI void initializePseudoProbeInserterPass(PassRegistry &); +LLVM_ABI void initializeRAGreedyLegacyPass(PassRegistry &); +LLVM_ABI void initializeReachingDefAnalysisPass(PassRegistry &); +LLVM_ABI void initializeReassociateLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeRegAllocEvictionAdvisorAnalysisLegacyPass(PassRegistry &); +LLVM_ABI void initializeRegAllocFastPass(PassRegistry &); +LLVM_ABI void initializeRegAllocPriorityAdvisorAnalysisLegacyPass(PassRegistry &); +LLVM_ABI void initializeRegAllocScoringPass(PassRegistry &); +LLVM_ABI void initializeRegBankSelectPass(PassRegistry &); +LLVM_ABI void initializeRegToMemWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeRegUsageInfoCollectorLegacyPass(PassRegistry &); +LLVM_ABI void initializeRegUsageInfoPropagationLegacyPass(PassRegistry &); +LLVM_ABI void initializeRegionInfoPassPass(PassRegistry &); +LLVM_ABI void initializeRegionOnlyPrinterPass(PassRegistry &); +LLVM_ABI void initializeRegionOnlyViewerPass(PassRegistry &); +LLVM_ABI void initializeRegionPrinterPass(PassRegistry &); +LLVM_ABI void initializeRegionViewerPass(PassRegistry &); +LLVM_ABI void initializeRegisterCoalescerLegacyPass(PassRegistry &); +LLVM_ABI void initializeRemoveLoadsIntoFakeUsesLegacyPass(PassRegistry &); +LLVM_ABI void initializeRemoveRedundantDebugValuesLegacyPass(PassRegistry &); +LLVM_ABI void initializeRenameIndependentSubregsLegacyPass(PassRegistry &); +LLVM_ABI void initializeReplaceWithVeclibLegacyPass(PassRegistry &); +LLVM_ABI void initializeResetMachineFunctionPass(PassRegistry &); +LLVM_ABI void initializeSCEVAAWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeSROALegacyPassPass(PassRegistry &); +LLVM_ABI void initializeSafeStackLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeSafepointIRVerifierPass(PassRegistry &); +LLVM_ABI void initializeSelectOptimizePass(PassRegistry &); +LLVM_ABI void initializeScalarEvolutionWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeScalarizeMaskedMemIntrinLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeScalarizerLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeScavengerTestPass(PassRegistry &); +LLVM_ABI void initializeScopedNoAliasAAWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeSeparateConstOffsetFromGEPLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeShadowStackGCLoweringPass(PassRegistry &); +LLVM_ABI void initializeShrinkWrapLegacyPass(PassRegistry &); +LLVM_ABI void initializeSingleLoopExtractorPass(PassRegistry &); +LLVM_ABI void initializeSinkingLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeSjLjEHPreparePass(PassRegistry &); +LLVM_ABI void initializeSlotIndexesWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeSpeculativeExecutionLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeSpillPlacementWrapperLegacyPass(PassRegistry &); +LLVM_ABI void initializeStackColoringLegacyPass(PassRegistry &); +LLVM_ABI void initializeStackFrameLayoutAnalysisLegacyPass(PassRegistry &); +LLVM_ABI void initializeStaticDataSplitterPass(PassRegistry &); +LLVM_ABI void initializeStackMapLivenessPass(PassRegistry &); +LLVM_ABI void initializeStackProtectorPass(PassRegistry &); +LLVM_ABI void initializeStackSafetyGlobalInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeStackSafetyInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeStackSlotColoringLegacyPass(PassRegistry &); +LLVM_ABI void initializeStraightLineStrengthReduceLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeStripDebugMachineModulePass(PassRegistry &); +LLVM_ABI void initializeStructurizeCFGLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeTailCallElimPass(PassRegistry &); +LLVM_ABI void initializeTailDuplicateLegacyPass(PassRegistry &); +LLVM_ABI void initializeTargetLibraryInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeTargetPassConfigPass(PassRegistry &); +LLVM_ABI void initializeTargetTransformInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeTwoAddressInstructionLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeTypeBasedAAWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeTypePromotionLegacyPass(PassRegistry &); +LLVM_ABI void initializeInitUndefPass(PassRegistry &); +LLVM_ABI void initializeUniformityInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void initializeUnifyLoopExitsLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeUnpackMachineBundlesPass(PassRegistry &); +LLVM_ABI void initializeUnreachableBlockElimLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeUnreachableMachineBlockElimLegacyPass(PassRegistry &); +LLVM_ABI void initializeVerifierLegacyPassPass(PassRegistry &); +LLVM_ABI void initializeVirtRegMapWrapperLegacyPass(PassRegistry &); +LLVM_ABI void initializeVirtRegRewriterLegacyPass(PassRegistry &); +LLVM_ABI void initializeWasmEHPreparePass(PassRegistry &); +LLVM_ABI void initializeWinEHPreparePass(PassRegistry &); +LLVM_ABI void initializeWriteBitcodePassPass(PassRegistry &); +LLVM_ABI void initializeXRayInstrumentationLegacyPass(PassRegistry &); } // end namespace llvm diff --git a/llvm/include/llvm/Pass.h b/llvm/include/llvm/Pass.h index 921db0b5f7aec..58c45e75b3f0a 100644 --- a/llvm/include/llvm/Pass.h +++ b/llvm/include/llvm/Pass.h @@ -31,6 +31,7 @@ #ifdef EXPENSIVE_CHECKS #include #endif +#include "llvm/Support/Compiler.h" #include namespace llvm { @@ -95,7 +96,7 @@ const char *to_string(ThinOrFullLTOPhase Phase); /// interprocedural optimization or you do not fit into any of the more /// constrained passes described below. /// -class Pass { +class LLVM_ABI Pass { AnalysisResolver *Resolver = nullptr; // Used to resolve analysis const void *PassID; PassKind Kind; @@ -252,7 +253,7 @@ class Pass { /// interprocedural optimizations and analyses. ModulePasses may do anything /// they want to the program. /// -class ModulePass : public Pass { +class LLVM_ABI ModulePass : public Pass { public: explicit ModulePass(char &pid) : Pass(PT_Module, pid) {} @@ -282,7 +283,7 @@ class ModulePass : public Pass { /// ImmutablePass class - This class is used to provide information that does /// not need to be run. This is useful for things like target information. /// -class ImmutablePass : public ModulePass { +class LLVM_ABI ImmutablePass : public ModulePass { public: explicit ImmutablePass(char &pid) : ModulePass(pid) {} @@ -311,7 +312,7 @@ class ImmutablePass : public ModulePass { /// 2. Optimizing a function does not cause the addition or removal of any /// functions in the module /// -class FunctionPass : public Pass { +class LLVM_ABI FunctionPass : public Pass { public: explicit FunctionPass(char &pid) : Pass(PT_Function, pid) {} @@ -338,13 +339,13 @@ class FunctionPass : public Pass { /// If the user specifies the -time-passes argument on an LLVM tool command line /// then the value of this boolean will be true, otherwise false. /// This is the storage for the -time-passes option. -extern bool TimePassesIsEnabled; +LLVM_ABI extern bool TimePassesIsEnabled; /// If TimePassesPerRun is true, there would be one line of report for /// each pass invocation. /// If TimePassesPerRun is false, there would be only one line of /// report for each pass (even there are more than one pass objects). /// (For new pass manager only) -extern bool TimePassesPerRun; +LLVM_ABI extern bool TimePassesPerRun; } // end namespace llvm diff --git a/llvm/include/llvm/PassAnalysisSupport.h b/llvm/include/llvm/PassAnalysisSupport.h index 4bed3cb55a901..cbf859df37bf8 100644 --- a/llvm/include/llvm/PassAnalysisSupport.h +++ b/llvm/include/llvm/PassAnalysisSupport.h @@ -22,6 +22,7 @@ #ifndef LLVM_PASSANALYSISSUPPORT_H #define LLVM_PASSANALYSISSUPPORT_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" #include @@ -69,14 +70,14 @@ class AnalysisUsage { ///@{ /// Add the specified ID to the required set of the usage info for a pass. - AnalysisUsage &addRequiredID(const void *ID); - AnalysisUsage &addRequiredID(char &ID); + LLVM_ABI AnalysisUsage &addRequiredID(const void *ID); + LLVM_ABI AnalysisUsage &addRequiredID(char &ID); template AnalysisUsage &addRequired() { return addRequiredID(PassClass::ID); } - AnalysisUsage &addRequiredTransitiveID(char &ID); + LLVM_ABI AnalysisUsage &addRequiredTransitiveID(char &ID); template AnalysisUsage &addRequiredTransitive() { return addRequiredTransitiveID(PassClass::ID); @@ -124,7 +125,7 @@ class AnalysisUsage { /// preserved by this pass. If no such Pass exists, do nothing. This can be /// useful when a pass is trivially preserved, but may not be linked in. Be /// careful about spelling! - AnalysisUsage &addPreserved(StringRef Arg); + LLVM_ABI AnalysisUsage &addPreserved(StringRef Arg); /// Set by analyses that do not transform their input at all void setPreservesAll() { PreservesAll = true; } @@ -139,7 +140,7 @@ class AnalysisUsage { /// /// This function annotates the AnalysisUsage info object to say that analyses /// that only depend on the CFG are preserved by this pass. - void setPreservesCFG(); + LLVM_ABI void setPreservesCFG(); const VectorType &getRequiredSet() const { return Required; } const VectorType &getRequiredTransitiveSet() const { @@ -174,7 +175,7 @@ class AnalysisResolver { } /// Find pass that is implementing PI. Initialize pass for Function F. - std::tuple findImplPass(Pass *P, AnalysisID PI, Function &F); + LLVM_ABI std::tuple findImplPass(Pass *P, AnalysisID PI, Function &F); void addAnalysisImplsPair(AnalysisID PI, Pass *P) { if (findImplPass(PI) == P) @@ -189,7 +190,7 @@ class AnalysisResolver { } /// Return analysis result or null if it doesn't exist. - Pass *getAnalysisIfAvailable(AnalysisID ID) const; + LLVM_ABI Pass *getAnalysisIfAvailable(AnalysisID ID) const; private: /// This keeps track of which passes implements the interfaces that are diff --git a/llvm/include/llvm/PassRegistry.h b/llvm/include/llvm/PassRegistry.h index 003c0ac4c374b..8f2b1919a2a3a 100644 --- a/llvm/include/llvm/PassRegistry.h +++ b/llvm/include/llvm/PassRegistry.h @@ -16,6 +16,7 @@ #ifndef LLVM_PASSREGISTRY_H #define LLVM_PASSREGISTRY_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" @@ -49,36 +50,36 @@ class PassRegistry { public: PassRegistry() = default; - ~PassRegistry(); + LLVM_ABI ~PassRegistry(); /// getPassRegistry - Access the global registry object, which is /// automatically initialized at application launch and destroyed by /// llvm_shutdown. - static PassRegistry *getPassRegistry(); + LLVM_ABI static PassRegistry *getPassRegistry(); /// getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass' /// type identifier (&MyPass::ID). - const PassInfo *getPassInfo(const void *TI) const; + LLVM_ABI const PassInfo *getPassInfo(const void *TI) const; /// getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass' /// argument string. - const PassInfo *getPassInfo(StringRef Arg) const; + LLVM_ABI const PassInfo *getPassInfo(StringRef Arg) const; /// registerPass - Register a pass (by means of its PassInfo) with the /// registry. Required in order to use the pass with a PassManager. - void registerPass(const PassInfo &PI, bool ShouldFree = false); + LLVM_ABI void registerPass(const PassInfo &PI, bool ShouldFree = false); /// enumerateWith - Enumerate the registered passes, calling the provided /// PassRegistrationListener's passEnumerate() callback on each of them. - void enumerateWith(PassRegistrationListener *L); + LLVM_ABI void enumerateWith(PassRegistrationListener *L); /// addRegistrationListener - Register the given PassRegistrationListener /// to receive passRegistered() callbacks whenever a new pass is registered. - void addRegistrationListener(PassRegistrationListener *L); + LLVM_ABI void addRegistrationListener(PassRegistrationListener *L); /// removeRegistrationListener - Unregister a PassRegistrationListener so that /// it no longer receives passRegistered() callbacks. - void removeRegistrationListener(PassRegistrationListener *L); + LLVM_ABI void removeRegistrationListener(PassRegistrationListener *L); }; } // end namespace llvm diff --git a/llvm/include/llvm/PassSupport.h b/llvm/include/llvm/PassSupport.h index b0897a6be37d1..b0a58b6752ce5 100644 --- a/llvm/include/llvm/PassSupport.h +++ b/llvm/include/llvm/PassSupport.h @@ -24,6 +24,7 @@ #ifndef LLVM_PASSSUPPORT_H #define LLVM_PASSSUPPORT_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/StringRef.h" #include "llvm/PassInfo.h" #include "llvm/PassRegistry.h" @@ -112,7 +113,7 @@ struct PassRegistrationListener { /// enumeratePasses - Iterate over the registered passes, calling the /// passEnumerate callback on each PassInfo object. - void enumeratePasses(); + LLVM_ABI void enumeratePasses(); /// passEnumerate - Callback function invoked when someone calls /// enumeratePasses on this PassRegistrationListener object. diff --git a/llvm/include/llvm/Passes/OptimizationLevel.h b/llvm/include/llvm/Passes/OptimizationLevel.h index d2c3fde4935fb..1cf258f1ffd0d 100644 --- a/llvm/include/llvm/Passes/OptimizationLevel.h +++ b/llvm/include/llvm/Passes/OptimizationLevel.h @@ -15,6 +15,7 @@ #ifndef LLVM_PASSES_OPTIMIZATIONLEVEL_H #define LLVM_PASSES_OPTIMIZATIONLEVEL_H +#include "llvm/Support/Compiler.h" #include namespace llvm { @@ -38,7 +39,7 @@ class OptimizationLevel final { /// Disable as many optimizations as possible. This doesn't completely /// disable the optimizer in all cases, for example always_inline functions /// can be required to be inlined for correctness. - static const OptimizationLevel O0; + LLVM_ABI static const OptimizationLevel O0; /// Optimize quickly without destroying debuggability. /// @@ -54,7 +55,7 @@ class OptimizationLevel final { /// vectorization, or fusion don't make sense here due to the degree to /// which the executed code differs from the source code, and the compile /// time cost. - static const OptimizationLevel O1; + LLVM_ABI static const OptimizationLevel O1; /// Optimize for fast execution as much as possible without triggering /// significant incremental compile time or code size growth. /// @@ -71,7 +72,7 @@ class OptimizationLevel final { /// /// This is expected to be a good default optimization level for the vast /// majority of users. - static const OptimizationLevel O2; + LLVM_ABI static const OptimizationLevel O2; /// Optimize for fast execution as much as possible. /// /// This mode is significantly more aggressive in trading off compile time @@ -86,7 +87,7 @@ class OptimizationLevel final { /// order to make even significantly slower compile times at least scale /// reasonably. This does not preclude very substantial constant factor /// costs though. - static const OptimizationLevel O3; + LLVM_ABI static const OptimizationLevel O3; /// Similar to \c O2 but tries to optimize for small code size instead of /// fast execution without triggering significant incremental execution /// time slowdowns. @@ -97,7 +98,7 @@ class OptimizationLevel final { /// A consequence of the different core goal is that this should in general /// produce substantially smaller executables that still run in /// a reasonable amount of time. - static const OptimizationLevel Os; + LLVM_ABI static const OptimizationLevel Os; /// A very specialized mode that will optimize for code size at any and all /// costs. /// @@ -105,7 +106,7 @@ class OptimizationLevel final { /// any effort taken to reduce the size is worth it regardless of the /// execution time impact. You should expect this level to produce rather /// slow, but very small, code. - static const OptimizationLevel Oz; + LLVM_ABI static const OptimizationLevel Oz; bool isOptimizingForSpeed() const { return SizeLevel == 0 && SpeedLevel > 0; } diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h index 51ccaa53447d7..d9d65ee514107 100644 --- a/llvm/include/llvm/Passes/PassBuilder.h +++ b/llvm/include/llvm/Passes/PassBuilder.h @@ -15,6 +15,7 @@ #ifndef LLVM_PASSES_PASSBUILDER_H #define LLVM_PASSES_PASSBUILDER_H +#include "llvm/Support/Compiler.h" #include "llvm/Analysis/CGSCCPassManager.h" #include "llvm/CodeGen/MachinePassManager.h" #include "llvm/CodeGen/RegAllocCommon.h" @@ -44,7 +45,7 @@ class PipelineTuningOptions { public: /// Constructor sets pipeline tuning defaults based on cl::opts. Each option /// can be set in the PassBuilder when using a LLVM as a library. - PipelineTuningOptions(); + LLVM_ABI PipelineTuningOptions(); /// Tuning option to set loop interleaving on/off, set based on opt level. bool LoopInterleaving; @@ -126,7 +127,7 @@ class PassBuilder { std::vector InnerPipeline; }; - explicit PassBuilder(TargetMachine *TM = nullptr, + LLVM_ABI explicit PassBuilder(TargetMachine *TM = nullptr, PipelineTuningOptions PTO = PipelineTuningOptions(), std::optional PGOOpt = std::nullopt, PassInstrumentationCallbacks *PIC = nullptr); @@ -135,7 +136,7 @@ class PassBuilder { /// /// This is an interface that can be used to cross register each /// AnalysisManager with all the others analysis managers. - void crossRegisterProxies(LoopAnalysisManager &LAM, + LLVM_ABI void crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM, @@ -147,7 +148,7 @@ class PassBuilder { /// ModuleAnalysisManager with all registered module analyses. Callers can /// still manually register any additional analyses. Callers can also /// pre-register analyses and this will not override those. - void registerModuleAnalyses(ModuleAnalysisManager &MAM); + LLVM_ABI void registerModuleAnalyses(ModuleAnalysisManager &MAM); /// Registers all available CGSCC analysis passes. /// @@ -155,7 +156,7 @@ class PassBuilder { /// with all registered CGSCC analyses. Callers can still manually register any /// additional analyses. Callers can also pre-register analyses and this will /// not override those. - void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM); + LLVM_ABI void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM); /// Registers all available function analysis passes. /// @@ -163,14 +164,14 @@ class PassBuilder { /// FunctionAnalysisManager with all registered function analyses. Callers can /// still manually register any additional analyses. Callers can also /// pre-register analyses and this will not override those. - void registerFunctionAnalyses(FunctionAnalysisManager &FAM); + LLVM_ABI void registerFunctionAnalyses(FunctionAnalysisManager &FAM); /// Registers all available loop analysis passes. /// /// This is an interface that can be used to populate a \c LoopAnalysisManager /// with all registered loop analyses. Callers can still manually register any /// additional analyses. - void registerLoopAnalyses(LoopAnalysisManager &LAM); + LLVM_ABI void registerLoopAnalyses(LoopAnalysisManager &LAM); /// Registers all available machine function analysis passes. /// @@ -178,7 +179,7 @@ class PassBuilder { /// MachineFunctionAnalysisManager with all registered function analyses. /// Callers can still manually register any additional analyses. Callers can /// also pre-register analyses and this will not override those. - void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM); + LLVM_ABI void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM); /// Construct the core LLVM function canonicalization and simplification /// pipeline. @@ -194,7 +195,7 @@ class PassBuilder { /// build them. /// /// \p Phase indicates the current ThinLTO phase. - FunctionPassManager + LLVM_ABI FunctionPassManager buildFunctionSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase); @@ -213,17 +214,17 @@ class PassBuilder { /// build them. /// /// \p Phase indicates the current ThinLTO phase. - ModulePassManager buildModuleSimplificationPipeline(OptimizationLevel Level, + LLVM_ABI ModulePassManager buildModuleSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase); /// Construct the module pipeline that performs inlining as well as /// the inlining-driven cleanups. - ModuleInlinerWrapperPass buildInlinerPipeline(OptimizationLevel Level, + LLVM_ABI ModuleInlinerWrapperPass buildInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase); /// Construct the module pipeline that performs inlining with /// module inliner pass. - ModulePassManager buildModuleInlinerPipeline(OptimizationLevel Level, + LLVM_ABI ModulePassManager buildModuleInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase); /// Construct the core LLVM module optimization pipeline. @@ -239,7 +240,7 @@ class PassBuilder { /// only intended for use when attempting to optimize code. If frontends /// require some transformations for semantic reasons, they should explicitly /// build them. - ModulePassManager + LLVM_ABI ModulePassManager buildModuleOptimizationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase LTOPhase); @@ -249,7 +250,7 @@ class PassBuilder { /// optimization and code generation without any link-time optimization. It /// typically correspond to frontend "-O[123]" options for optimization /// levels \c O1, \c O2 and \c O3 resp. - ModulePassManager buildPerModuleDefaultPipeline( + LLVM_ABI ModulePassManager buildPerModuleDefaultPipeline( OptimizationLevel Level, ThinOrFullLTOPhase Phase = ThinOrFullLTOPhase::None); @@ -258,7 +259,7 @@ class PassBuilder { /// This builds a pipeline that runs the LTO/ThinLTO pre-link pipeline, and /// emits a section containing the pre-link bitcode along side the object code /// generated in non-LTO compilation. - ModulePassManager buildFatLTODefaultPipeline(OptimizationLevel Level, + LLVM_ABI ModulePassManager buildFatLTODefaultPipeline(OptimizationLevel Level, bool ThinLTO, bool EmitSummary); /// Build a pre-link, ThinLTO-targeting default optimization pipeline to @@ -268,7 +269,7 @@ class PassBuilder { /// a ThinLTO run. It works to minimize the IR which needs to be analyzed /// without making irreversible decisions which could be made better during /// the LTO run. - ModulePassManager buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level); + LLVM_ABI ModulePassManager buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level); /// Build a ThinLTO default optimization pipeline to a pass manager. /// @@ -276,7 +277,7 @@ class PassBuilder { /// optimization and code generation. It is particularly tuned to fit well /// when IR coming into the LTO phase was first run through \c /// buildThinLTOPreLinkDefaultPipeline, and the two coordinate closely. - ModulePassManager + LLVM_ABI ModulePassManager buildThinLTODefaultPipeline(OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary); @@ -287,7 +288,7 @@ class PassBuilder { /// run. It works to minimize the IR which needs to be analyzed without /// making irreversible decisions which could be made better during the LTO /// run. - ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level); + LLVM_ABI ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level); /// Build an LTO default optimization pipeline to a pass manager. /// @@ -295,13 +296,13 @@ class PassBuilder { /// optimization and code generation. It is particularly tuned to fit well /// when IR coming into the LTO phase was first run through \c /// buildLTOPreLinkDefaultPipeline, and the two coordinate closely. - ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level, + LLVM_ABI ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level, ModuleSummaryIndex *ExportSummary); /// Build an O0 pipeline with the minimal semantically required passes. /// /// This should only be used for non-LTO and LTO pre-link pipelines. - ModulePassManager + LLVM_ABI ModulePassManager buildO0DefaultPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase = ThinOrFullLTOPhase::None); @@ -310,7 +311,7 @@ class PassBuilder { /// /// This also adds target-specific alias analyses registered via /// TargetMachine::registerDefaultAliasAnalyses(). - AAManager buildDefaultAAPipeline(); + LLVM_ABI AAManager buildDefaultAAPipeline(); /// Parse a textual pass pipeline description into a \c /// ModulePassManager. @@ -352,7 +353,7 @@ class PassBuilder { /// specifically want the pass to run under a adaptor directly. This is /// preferred when a pipeline is largely of one type, but one or just a few /// passes are of different types(See PassBuilder.cpp for examples). - Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText); + LLVM_ABI Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText); /// {{@ Parse a textual pass pipeline description into a specific PassManager /// @@ -361,9 +362,9 @@ class PassBuilder { /// this is the valid pipeline text: /// /// function(lpass) - Error parsePassPipeline(CGSCCPassManager &CGPM, StringRef PipelineText); - Error parsePassPipeline(FunctionPassManager &FPM, StringRef PipelineText); - Error parsePassPipeline(LoopPassManager &LPM, StringRef PipelineText); + LLVM_ABI Error parsePassPipeline(CGSCCPassManager &CGPM, StringRef PipelineText); + LLVM_ABI Error parsePassPipeline(FunctionPassManager &FPM, StringRef PipelineText); + LLVM_ABI Error parsePassPipeline(LoopPassManager &LPM, StringRef PipelineText); /// @}} /// Parse a textual MIR pipeline into the provided \c MachineFunctionPass @@ -375,7 +376,7 @@ class PassBuilder { /// /// There is no need to specify the pass nesting, and this function /// currently cannot handle the pass nesting. - Error parsePassPipeline(MachineFunctionPassManager &MFPM, + LLVM_ABI Error parsePassPipeline(MachineFunctionPassManager &MFPM, StringRef PipelineText); /// Parse a textual alias analysis pipeline into the provided AA manager. @@ -393,14 +394,14 @@ class PassBuilder { /// Returns false if the text cannot be parsed cleanly. The specific state of /// the \p AA manager is unspecified if such an error is encountered and this /// returns false. - Error parseAAPipeline(AAManager &AA, StringRef PipelineText); + LLVM_ABI Error parseAAPipeline(AAManager &AA, StringRef PipelineText); /// Parse RegAllocFilterName to get RegAllocFilterFunc. - std::optional + LLVM_ABI std::optional parseRegAllocFilter(StringRef RegAllocFilterName); /// Print pass names. - void printPassNames(raw_ostream &OS); + LLVM_ABI void printPassNames(raw_ostream &OS); /// Register a callback for a default optimizer pipeline extension /// point @@ -614,12 +615,12 @@ class PassBuilder { /// If the PassManager type is not given at the top level of the pipeline /// text, this Callback should be used to determine the appropriate stack of /// PassManagers and populate the passed ModulePassManager. - void registerParseTopLevelPipelineCallback( + LLVM_ABI void registerParseTopLevelPipelineCallback( const std::function)> &C); /// Add PGOInstrumenation passes for O0 only. - void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen, + LLVM_ABI void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen, bool IsCS, bool AtomicCounterUpdate, std::string ProfileFile, std::string ProfileRemappingFile, @@ -634,33 +635,33 @@ class PassBuilder { // Invoke the callbacks registered for the various extension points. // Custom pipelines should use these to invoke the callbacks registered // by TargetMachines and other clients. - void invokePeepholeEPCallbacks(FunctionPassManager &FPM, + LLVM_ABI void invokePeepholeEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level); - void invokeLateLoopOptimizationsEPCallbacks(LoopPassManager &LPM, + LLVM_ABI void invokeLateLoopOptimizationsEPCallbacks(LoopPassManager &LPM, OptimizationLevel Level); - void invokeLoopOptimizerEndEPCallbacks(LoopPassManager &LPM, + LLVM_ABI void invokeLoopOptimizerEndEPCallbacks(LoopPassManager &LPM, OptimizationLevel Level); - void invokeScalarOptimizerLateEPCallbacks(FunctionPassManager &FPM, + LLVM_ABI void invokeScalarOptimizerLateEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level); - void invokeCGSCCOptimizerLateEPCallbacks(CGSCCPassManager &CGPM, + LLVM_ABI void invokeCGSCCOptimizerLateEPCallbacks(CGSCCPassManager &CGPM, OptimizationLevel Level); - void invokeVectorizerStartEPCallbacks(FunctionPassManager &FPM, + LLVM_ABI void invokeVectorizerStartEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level); - void invokeVectorizerEndEPCallbacks(FunctionPassManager &FPM, + LLVM_ABI void invokeVectorizerEndEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level); - void invokeOptimizerEarlyEPCallbacks(ModulePassManager &MPM, + LLVM_ABI void invokeOptimizerEarlyEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase); - void invokeOptimizerLastEPCallbacks(ModulePassManager &MPM, + LLVM_ABI void invokeOptimizerLastEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase); - void invokeFullLinkTimeOptimizationEarlyEPCallbacks(ModulePassManager &MPM, + LLVM_ABI void invokeFullLinkTimeOptimizationEarlyEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level); - void invokeFullLinkTimeOptimizationLastEPCallbacks(ModulePassManager &MPM, + LLVM_ABI void invokeFullLinkTimeOptimizationLastEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level); - void invokePipelineStartEPCallbacks(ModulePassManager &MPM, + LLVM_ABI void invokePipelineStartEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level); - void invokePipelineEarlySimplificationEPCallbacks(ModulePassManager &MPM, + LLVM_ABI void invokePipelineEarlySimplificationEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase); @@ -713,7 +714,7 @@ class PassBuilder { /// Handle passes only accept one bool-valued parameter. /// /// \return false when Params is empty. - static Expected parseSinglePassOption(StringRef Params, + LLVM_ABI static Expected parseSinglePassOption(StringRef Params, StringRef OptionName, StringRef PassName); @@ -978,7 +979,7 @@ class NoOpLoopAnalysis : public AnalysisInfoMixin { }; /// Common option used by multiple tools to print pipeline passes -extern cl::opt PrintPipelinePasses; +LLVM_ABI extern cl::opt PrintPipelinePasses; } diff --git a/llvm/include/llvm/Passes/PassPlugin.h b/llvm/include/llvm/Passes/PassPlugin.h index 013b7a827c47d..580e4438cc1fa 100644 --- a/llvm/include/llvm/Passes/PassPlugin.h +++ b/llvm/include/llvm/Passes/PassPlugin.h @@ -64,7 +64,7 @@ class PassPlugin { /// \returns Returns an error if either the library cannot be found or loaded, /// there is no public entry point, or the plugin implements the wrong API /// version. - static Expected Load(const std::string &Filename); + LLVM_ABI static Expected Load(const std::string &Filename); /// Get the filename of the loaded plugin. StringRef getFilename() const { return Filename; } @@ -107,7 +107,7 @@ class PassPlugin { /// }; /// } /// ``` -extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK +extern "C" LLVM_ABI ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK llvmGetPassPluginInfo(); #endif /* LLVM_PASSES_PASSPLUGIN_H */ diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h b/llvm/include/llvm/Passes/StandardInstrumentations.h index f7a65a88ecf5b..4d0fcc3aca231 100644 --- a/llvm/include/llvm/Passes/StandardInstrumentations.h +++ b/llvm/include/llvm/Passes/StandardInstrumentations.h @@ -15,6 +15,7 @@ #ifndef LLVM_PASSES_STANDARDINSTRUMENTATIONS_H #define LLVM_PASSES_STANDARDINSTRUMENTATIONS_H +#include "llvm/Support/Compiler.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -46,9 +47,9 @@ class PassInstrumentationCallbacks; /// (typically Loop or SCC). class PrintIRInstrumentation { public: - ~PrintIRInstrumentation(); + LLVM_ABI ~PrintIRInstrumentation(); - void registerCallbacks(PassInstrumentationCallbacks &PIC); + LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC); private: struct PassRunDescriptor { @@ -104,7 +105,7 @@ class PrintIRInstrumentation { class OptNoneInstrumentation { public: OptNoneInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {} - void registerCallbacks(PassInstrumentationCallbacks &PIC); + LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC); private: bool DebugLogging; @@ -116,8 +117,8 @@ class OptPassGateInstrumentation { bool HasWrittenIR = false; public: OptPassGateInstrumentation(LLVMContext &Context) : Context(Context) {} - bool shouldRun(StringRef PassName, Any IR); - void registerCallbacks(PassInstrumentationCallbacks &PIC); + LLVM_ABI bool shouldRun(StringRef PassName, Any IR); + LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC); }; struct PrintPassOptions { @@ -136,7 +137,7 @@ class PrintPassInstrumentation { public: PrintPassInstrumentation(bool Enabled, PrintPassOptions Opts) : Enabled(Enabled), Opts(Opts) {} - void registerCallbacks(PassInstrumentationCallbacks &PIC); + LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC); private: bool Enabled; @@ -167,7 +168,7 @@ class PreservedCFGCheckerInstrumentation { std::optional> BBGuards; DenseMap> Graph; - CFG(const Function *F, bool TrackBBLifetime); + LLVM_ABI CFG(const Function *F, bool TrackBBLifetime); bool operator==(const CFG &G) const { return !isPoisoned() && !G.isPoisoned() && Graph == G.Graph; @@ -179,9 +180,9 @@ class PreservedCFGCheckerInstrumentation { }); } - static void printDiff(raw_ostream &out, const CFG &Before, + LLVM_ABI static void printDiff(raw_ostream &out, const CFG &Before, const CFG &After); - bool invalidate(Function &F, const PreservedAnalyses &PA, + LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &); }; @@ -189,7 +190,7 @@ class PreservedCFGCheckerInstrumentation { SmallVector PassStack; #endif - void registerCallbacks(PassInstrumentationCallbacks &PIC, + LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager &MAM); }; @@ -281,7 +282,7 @@ class TextChangeReporter : public ChangeReporter { // by unwrapAndPrint. The string representation is stored in a std::string // to preserve it as the IR changes in each pass. Note that the banner is // included in this representation but it is massaged before reporting. -class IRChangedPrinter : public TextChangeReporter { +class LLVM_ABI IRChangedPrinter : public TextChangeReporter { public: IRChangedPrinter(bool VerboseMode) : TextChangeReporter(VerboseMode) {} @@ -298,7 +299,7 @@ class IRChangedPrinter : public TextChangeReporter { Any) override; }; -class IRChangedTester : public IRChangedPrinter { +class LLVM_ABI IRChangedTester : public IRChangedPrinter { public: IRChangedTester() : IRChangedPrinter(true) {} ~IRChangedTester() override; @@ -444,7 +445,7 @@ template class IRComparer { // and added, respectively. Changes to the IR that do not affect basic // blocks are not reported as having changed the IR. The option // -print-module-scope does not affect this change reporter. -class InLineChangePrinter : public TextChangeReporter> { +class LLVM_ABI InLineChangePrinter : public TextChangeReporter> { public: InLineChangePrinter(bool VerboseMode, bool ColourMode) : TextChangeReporter>(VerboseMode), @@ -475,7 +476,7 @@ class VerifyInstrumentation { public: VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {} - void registerCallbacks(PassInstrumentationCallbacks &PIC, + LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager *MAM); }; @@ -484,12 +485,12 @@ class VerifyInstrumentation { /// execution time. They collect time tracing info by TimeProfiler. class TimeProfilingPassesHandler { public: - TimeProfilingPassesHandler(); + LLVM_ABI TimeProfilingPassesHandler(); // We intend this to be unique per-compilation, thus no copies. TimeProfilingPassesHandler(const TimeProfilingPassesHandler &) = delete; void operator=(const TimeProfilingPassesHandler &) = delete; - void registerCallbacks(PassInstrumentationCallbacks &PIC); + LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC); private: // Implementation of pass instrumentation callbacks. @@ -502,8 +503,8 @@ class TimeProfilingPassesHandler { class DCData { public: // Fill the map with the transitions from basic block \p B. - DCData(const BasicBlock &B); - DCData(const MachineBasicBlock &B); + LLVM_ABI DCData(const BasicBlock &B); + LLVM_ABI DCData(const MachineBasicBlock &B); // Return an iterator to the names of the successor blocks. StringMap::const_iterator begin() const { @@ -531,7 +532,7 @@ class DCData { // A change reporter that builds a website with links to pdf files showing // dot control flow graphs with changed instructions shown in colour. -class DotCfgChangeReporter : public ChangeReporter> { +class LLVM_ABI DotCfgChangeReporter : public ChangeReporter> { public: DotCfgChangeReporter(bool Verbose); ~DotCfgChangeReporter() override; @@ -578,9 +579,9 @@ class PrintCrashIRInstrumentation { public: PrintCrashIRInstrumentation() : SavedIR("*** Dump of IR Before Last Pass Unknown ***") {} - ~PrintCrashIRInstrumentation(); - void registerCallbacks(PassInstrumentationCallbacks &PIC); - void reportCrashIR(); + LLVM_ABI ~PrintCrashIRInstrumentation(); + LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC); + LLVM_ABI void reportCrashIR(); protected: std::string SavedIR; @@ -614,13 +615,13 @@ class StandardInstrumentations { bool VerifyEach; public: - StandardInstrumentations(LLVMContext &Context, bool DebugLogging, + LLVM_ABI StandardInstrumentations(LLVMContext &Context, bool DebugLogging, bool VerifyEach = false, PrintPassOptions PrintPassOpts = PrintPassOptions()); // Register all the standard instrumentation callbacks. If \p FAM is nullptr // then PreservedCFGChecker is not enabled. - void registerCallbacks(PassInstrumentationCallbacks &PIC, + LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager *MAM = nullptr); TimePassesHandler &getTimePasses() { return TimePasses; } From 86464dac9f3041169f122dc41e015e3448e1d9c6 Mon Sep 17 00:00:00 2001 From: Andrew Rogers Date: Wed, 11 Jun 2025 11:24:34 -0700 Subject: [PATCH 2/3] [llvm] manual fix-ups to llvm-c codemod of Passes library --- llvm/include/llvm/InitializePasses.h | 3 ++- llvm/include/llvm/Passes/PassBuilder.h | 8 ++++---- llvm/include/llvm/Passes/PassPlugin.h | 2 +- llvm/include/llvm/Passes/StandardInstrumentations.h | 9 ++------- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index c5e66732eb330..b7971d72af228 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -14,6 +14,8 @@ #ifndef LLVM_INITIALIZEPASSES_H #define LLVM_INITIALIZEPASSES_H +#include "llvm/Support/Compiler.h" + namespace llvm { class PassRegistry; @@ -181,7 +183,6 @@ LLVM_ABI void initializeLowerGlobalDtorsLegacyPassPass(PassRegistry &); LLVM_ABI void initializeLowerIntrinsicsPass(PassRegistry &); LLVM_ABI void initializeLowerInvokeLegacyPassPass(PassRegistry &); LLVM_ABI void initializeLowerSwitchLegacyPassPass(PassRegistry &); -void initializeKCFIPass(PassRegistry &); LLVM_ABI void initializeMIRAddFSDiscriminatorsPass(PassRegistry &); LLVM_ABI void initializeMIRCanonicalizerPass(PassRegistry &); LLVM_ABI void initializeMIRNamerPass(PassRegistry &); diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h index d9d65ee514107..94eb067e3f275 100644 --- a/llvm/include/llvm/Passes/PassBuilder.h +++ b/llvm/include/llvm/Passes/PassBuilder.h @@ -899,7 +899,7 @@ struct NoOpModulePass : PassInfoMixin { /// No-op module analysis. class NoOpModuleAnalysis : public AnalysisInfoMixin { friend AnalysisInfoMixin; - static AnalysisKey Key; + LLVM_ABI static AnalysisKey Key; public: struct Result {}; @@ -917,7 +917,7 @@ struct NoOpCGSCCPass : PassInfoMixin { /// No-op CGSCC analysis. class NoOpCGSCCAnalysis : public AnalysisInfoMixin { friend AnalysisInfoMixin; - static AnalysisKey Key; + LLVM_ABI static AnalysisKey Key; public: struct Result {}; @@ -936,7 +936,7 @@ struct NoOpFunctionPass : PassInfoMixin { /// No-op function analysis. class NoOpFunctionAnalysis : public AnalysisInfoMixin { friend AnalysisInfoMixin; - static AnalysisKey Key; + LLVM_ABI static AnalysisKey Key; public: struct Result {}; @@ -969,7 +969,7 @@ struct NoOpMachineFunctionPass : public PassInfoMixin { /// No-op loop analysis. class NoOpLoopAnalysis : public AnalysisInfoMixin { friend AnalysisInfoMixin; - static AnalysisKey Key; + LLVM_ABI static AnalysisKey Key; public: struct Result {}; diff --git a/llvm/include/llvm/Passes/PassPlugin.h b/llvm/include/llvm/Passes/PassPlugin.h index 580e4438cc1fa..947504bc207a7 100644 --- a/llvm/include/llvm/Passes/PassPlugin.h +++ b/llvm/include/llvm/Passes/PassPlugin.h @@ -107,7 +107,7 @@ class PassPlugin { /// }; /// } /// ``` -extern "C" LLVM_ABI ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK +extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK llvmGetPassPluginInfo(); #endif /* LLVM_PASSES_PASSPLUGIN_H */ diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h b/llvm/include/llvm/Passes/StandardInstrumentations.h index 4d0fcc3aca231..e92d76d46e2f8 100644 --- a/llvm/include/llvm/Passes/StandardInstrumentations.h +++ b/llvm/include/llvm/Passes/StandardInstrumentations.h @@ -209,7 +209,7 @@ class PreservedCFGCheckerInstrumentation { // 6. When a pass is run on an IR that is not interesting (based on options). // 7. When a pass is ignored (pass manager or adapter pass). // 8. To compare two IR representations (of type \p T). -template class ChangeReporter { +template class LLVM_ABI ChangeReporter { protected: ChangeReporter(bool RunInVerboseMode) : VerboseMode(RunInVerboseMode) {} @@ -258,7 +258,7 @@ template class ChangeReporter { // An abstract template base class that handles printing banners and // reporting when things have not changed or are filtered out. template -class TextChangeReporter : public ChangeReporter { +class LLVM_ABI TextChangeReporter : public ChangeReporter { protected: TextChangeReporter(bool Verbose); @@ -627,14 +627,9 @@ class StandardInstrumentations { TimePassesHandler &getTimePasses() { return TimePasses; } }; -extern template class ChangeReporter; -extern template class TextChangeReporter; - extern template class BlockDataT; extern template class FuncDataT; extern template class IRDataT; -extern template class ChangeReporter>; -extern template class TextChangeReporter>; extern template class IRComparer; } // namespace llvm From 7310ceaa94b376cd1c344a008b47bd2bfc7ef9a4 Mon Sep 17 00:00:00 2001 From: Andrew Rogers Date: Wed, 11 Jun 2025 11:24:59 -0700 Subject: [PATCH 3/3] [llvm] clang-format changes to Passes library --- llvm/include/llvm/InitializePasses.h | 36 +++-- llvm/include/llvm/PassAnalysisSupport.h | 5 +- llvm/include/llvm/PassRegistry.h | 2 +- llvm/include/llvm/PassSupport.h | 2 +- llvm/include/llvm/Passes/PassBuilder.h | 134 ++++++++++-------- .../llvm/Passes/StandardInstrumentations.h | 18 +-- 6 files changed, 110 insertions(+), 87 deletions(-) diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index b7971d72af228..1b5b1d5888824 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -56,7 +56,8 @@ LLVM_ABI void initializeAssignmentTrackingAnalysisPass(PassRegistry &); LLVM_ABI void initializeAssumptionCacheTrackerPass(PassRegistry &); LLVM_ABI void initializeAtomicExpandLegacyPass(PassRegistry &); LLVM_ABI void initializeBasicBlockPathCloningPass(PassRegistry &); -LLVM_ABI void initializeBasicBlockSectionsProfileReaderWrapperPassPass(PassRegistry &); +LLVM_ABI void +initializeBasicBlockSectionsProfileReaderWrapperPassPass(PassRegistry &); LLVM_ABI void initializeBasicBlockSectionsPass(PassRegistry &); LLVM_ABI void initializeBarrierNoopPass(PassRegistry &); LLVM_ABI void initializeBasicAAWrapperPassPass(PassRegistry &); @@ -136,7 +137,8 @@ LLVM_ABI void initializeIRSimilarityIdentifierWrapperPassPass(PassRegistry &); LLVM_ABI void initializeIRTranslatorPass(PassRegistry &); LLVM_ABI void initializeIVUsersWrapperPassPass(PassRegistry &); LLVM_ABI void initializeIfConverterPass(PassRegistry &); -LLVM_ABI void initializeImmutableModuleSummaryIndexWrapperPassPass(PassRegistry &); +LLVM_ABI void +initializeImmutableModuleSummaryIndexWrapperPassPass(PassRegistry &); LLVM_ABI void initializeImplicitNullChecksPass(PassRegistry &); LLVM_ABI void initializeIndirectBrExpandLegacyPassPass(PassRegistry &); LLVM_ABI void initializeInferAddressSpacesPass(PassRegistry &); @@ -187,10 +189,12 @@ LLVM_ABI void initializeMIRAddFSDiscriminatorsPass(PassRegistry &); LLVM_ABI void initializeMIRCanonicalizerPass(PassRegistry &); LLVM_ABI void initializeMIRNamerPass(PassRegistry &); LLVM_ABI void initializeMIRPrintingPassPass(PassRegistry &); -LLVM_ABI void initializeMachineBlockFrequencyInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void +initializeMachineBlockFrequencyInfoWrapperPassPass(PassRegistry &); LLVM_ABI void initializeMachineBlockPlacementLegacyPass(PassRegistry &); LLVM_ABI void initializeMachineBlockPlacementStatsLegacyPass(PassRegistry &); -LLVM_ABI void initializeMachineBranchProbabilityInfoWrapperPassPass(PassRegistry &); +LLVM_ABI void +initializeMachineBranchProbabilityInfoWrapperPassPass(PassRegistry &); LLVM_ABI void initializeMachineCFGPrinterPass(PassRegistry &); LLVM_ABI void initializeMachineCSELegacyPass(PassRegistry &); LLVM_ABI void initializeMachineCombinerPass(PassRegistry &); @@ -205,14 +209,16 @@ LLVM_ABI void initializeMachineLateInstrsCleanupLegacyPass(PassRegistry &); LLVM_ABI void initializeMachineLICMPass(PassRegistry &); LLVM_ABI void initializeMachineLoopInfoWrapperPassPass(PassRegistry &); LLVM_ABI void initializeMachineModuleInfoWrapperPassPass(PassRegistry &); -LLVM_ABI void initializeMachineOptimizationRemarkEmitterPassPass(PassRegistry &); +LLVM_ABI void +initializeMachineOptimizationRemarkEmitterPassPass(PassRegistry &); LLVM_ABI void initializeMachineOutlinerPass(PassRegistry &); LLVM_ABI void initializeStaticDataProfileInfoWrapperPassPass(PassRegistry &); LLVM_ABI void initializeStaticDataAnnotatorPass(PassRegistry &); LLVM_ABI void initializeMachinePipelinerPass(PassRegistry &); LLVM_ABI void initializeMachinePostDominatorTreeWrapperPassPass(PassRegistry &); LLVM_ABI void initializeMachineRegionInfoPassPass(PassRegistry &); -LLVM_ABI void initializeMachineSanitizerBinaryMetadataLegacyPass(PassRegistry &); +LLVM_ABI void +initializeMachineSanitizerBinaryMetadataLegacyPass(PassRegistry &); LLVM_ABI void initializeMachineSchedulerLegacyPass(PassRegistry &); LLVM_ABI void initializeMachineSinkingLegacyPass(PassRegistry &); LLVM_ABI void initializeMachineTraceMetricsWrapperPassPass(PassRegistry &); @@ -226,7 +232,8 @@ LLVM_ABI void initializeModuleSummaryIndexWrapperPassPass(PassRegistry &); LLVM_ABI void initializeModuloScheduleTestPass(PassRegistry &); LLVM_ABI void initializeNaryReassociateLegacyPassPass(PassRegistry &); LLVM_ABI void initializeObjCARCContractLegacyPassPass(PassRegistry &); -LLVM_ABI void initializeOptimizationRemarkEmitterWrapperPassPass(PassRegistry &); +LLVM_ABI void +initializeOptimizationRemarkEmitterWrapperPassPass(PassRegistry &); LLVM_ABI void initializeOptimizePHIsLegacyPass(PassRegistry &); LLVM_ABI void initializePEILegacyPass(PassRegistry &); LLVM_ABI void initializePHIEliminationPass(PassRegistry &); @@ -234,7 +241,8 @@ LLVM_ABI void initializePartiallyInlineLibCallsLegacyPassPass(PassRegistry &); LLVM_ABI void initializePatchableFunctionLegacyPass(PassRegistry &); LLVM_ABI void initializePeepholeOptimizerLegacyPass(PassRegistry &); LLVM_ABI void initializePhiValuesWrapperPassPass(PassRegistry &); -LLVM_ABI void initializePhysicalRegisterUsageInfoWrapperLegacyPass(PassRegistry &); +LLVM_ABI void +initializePhysicalRegisterUsageInfoWrapperLegacyPass(PassRegistry &); LLVM_ABI void initializePlaceBackedgeSafepointsLegacyPassPass(PassRegistry &); LLVM_ABI void initializePostDomOnlyPrinterWrapperPassPass(PassRegistry &); LLVM_ABI void initializePostDomOnlyViewerWrapperPassPass(PassRegistry &); @@ -257,9 +265,11 @@ LLVM_ABI void initializePseudoProbeInserterPass(PassRegistry &); LLVM_ABI void initializeRAGreedyLegacyPass(PassRegistry &); LLVM_ABI void initializeReachingDefAnalysisPass(PassRegistry &); LLVM_ABI void initializeReassociateLegacyPassPass(PassRegistry &); -LLVM_ABI void initializeRegAllocEvictionAdvisorAnalysisLegacyPass(PassRegistry &); +LLVM_ABI void +initializeRegAllocEvictionAdvisorAnalysisLegacyPass(PassRegistry &); LLVM_ABI void initializeRegAllocFastPass(PassRegistry &); -LLVM_ABI void initializeRegAllocPriorityAdvisorAnalysisLegacyPass(PassRegistry &); +LLVM_ABI void +initializeRegAllocPriorityAdvisorAnalysisLegacyPass(PassRegistry &); LLVM_ABI void initializeRegAllocScoringPass(PassRegistry &); LLVM_ABI void initializeRegBankSelectPass(PassRegistry &); LLVM_ABI void initializeRegToMemWrapperPassPass(PassRegistry &); @@ -286,7 +296,8 @@ LLVM_ABI void initializeScalarizeMaskedMemIntrinLegacyPassPass(PassRegistry &); LLVM_ABI void initializeScalarizerLegacyPassPass(PassRegistry &); LLVM_ABI void initializeScavengerTestPass(PassRegistry &); LLVM_ABI void initializeScopedNoAliasAAWrapperPassPass(PassRegistry &); -LLVM_ABI void initializeSeparateConstOffsetFromGEPLegacyPassPass(PassRegistry &); +LLVM_ABI void +initializeSeparateConstOffsetFromGEPLegacyPassPass(PassRegistry &); LLVM_ABI void initializeShadowStackGCLoweringPass(PassRegistry &); LLVM_ABI void initializeShrinkWrapLegacyPass(PassRegistry &); LLVM_ABI void initializeSingleLoopExtractorPass(PassRegistry &); @@ -303,7 +314,8 @@ LLVM_ABI void initializeStackProtectorPass(PassRegistry &); LLVM_ABI void initializeStackSafetyGlobalInfoWrapperPassPass(PassRegistry &); LLVM_ABI void initializeStackSafetyInfoWrapperPassPass(PassRegistry &); LLVM_ABI void initializeStackSlotColoringLegacyPass(PassRegistry &); -LLVM_ABI void initializeStraightLineStrengthReduceLegacyPassPass(PassRegistry &); +LLVM_ABI void +initializeStraightLineStrengthReduceLegacyPassPass(PassRegistry &); LLVM_ABI void initializeStripDebugMachineModulePass(PassRegistry &); LLVM_ABI void initializeStructurizeCFGLegacyPassPass(PassRegistry &); LLVM_ABI void initializeTailCallElimPass(PassRegistry &); diff --git a/llvm/include/llvm/PassAnalysisSupport.h b/llvm/include/llvm/PassAnalysisSupport.h index cbf859df37bf8..02abb00b66b52 100644 --- a/llvm/include/llvm/PassAnalysisSupport.h +++ b/llvm/include/llvm/PassAnalysisSupport.h @@ -22,9 +22,9 @@ #ifndef LLVM_PASSANALYSISSUPPORT_H #define LLVM_PASSANALYSISSUPPORT_H -#include "llvm/Support/Compiler.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Support/Compiler.h" #include #include #include @@ -175,7 +175,8 @@ class AnalysisResolver { } /// Find pass that is implementing PI. Initialize pass for Function F. - LLVM_ABI std::tuple findImplPass(Pass *P, AnalysisID PI, Function &F); + LLVM_ABI std::tuple findImplPass(Pass *P, AnalysisID PI, + Function &F); void addAnalysisImplsPair(AnalysisID PI, Pass *P) { if (findImplPass(PI) == P) diff --git a/llvm/include/llvm/PassRegistry.h b/llvm/include/llvm/PassRegistry.h index 8f2b1919a2a3a..f3dada0c0ba6c 100644 --- a/llvm/include/llvm/PassRegistry.h +++ b/llvm/include/llvm/PassRegistry.h @@ -16,10 +16,10 @@ #ifndef LLVM_PASSREGISTRY_H #define LLVM_PASSREGISTRY_H -#include "llvm/Support/Compiler.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/RWMutex.h" #include #include diff --git a/llvm/include/llvm/PassSupport.h b/llvm/include/llvm/PassSupport.h index b0a58b6752ce5..7f0306e33e832 100644 --- a/llvm/include/llvm/PassSupport.h +++ b/llvm/include/llvm/PassSupport.h @@ -24,10 +24,10 @@ #ifndef LLVM_PASSSUPPORT_H #define LLVM_PASSSUPPORT_H -#include "llvm/Support/Compiler.h" #include "llvm/ADT/StringRef.h" #include "llvm/PassInfo.h" #include "llvm/PassRegistry.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include "llvm/Support/Threading.h" #include diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h index 94eb067e3f275..f13b5c678a894 100644 --- a/llvm/include/llvm/Passes/PassBuilder.h +++ b/llvm/include/llvm/Passes/PassBuilder.h @@ -15,12 +15,12 @@ #ifndef LLVM_PASSES_PASSBUILDER_H #define LLVM_PASSES_PASSBUILDER_H -#include "llvm/Support/Compiler.h" #include "llvm/Analysis/CGSCCPassManager.h" #include "llvm/CodeGen/MachinePassManager.h" #include "llvm/CodeGen/RegAllocCommon.h" #include "llvm/IR/PassManager.h" #include "llvm/Passes/OptimizationLevel.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include "llvm/Support/PGOOptions.h" #include "llvm/Support/raw_ostream.h" @@ -127,20 +127,20 @@ class PassBuilder { std::vector InnerPipeline; }; - LLVM_ABI explicit PassBuilder(TargetMachine *TM = nullptr, - PipelineTuningOptions PTO = PipelineTuningOptions(), - std::optional PGOOpt = std::nullopt, - PassInstrumentationCallbacks *PIC = nullptr); + LLVM_ABI explicit PassBuilder( + TargetMachine *TM = nullptr, + PipelineTuningOptions PTO = PipelineTuningOptions(), + std::optional PGOOpt = std::nullopt, + PassInstrumentationCallbacks *PIC = nullptr); /// Cross register the analysis managers through their proxies. /// /// This is an interface that can be used to cross register each /// AnalysisManager with all the others analysis managers. - LLVM_ABI void crossRegisterProxies(LoopAnalysisManager &LAM, - FunctionAnalysisManager &FAM, - CGSCCAnalysisManager &CGAM, - ModuleAnalysisManager &MAM, - MachineFunctionAnalysisManager *MFAM = nullptr); + LLVM_ABI void + crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, + CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM, + MachineFunctionAnalysisManager *MFAM = nullptr); /// Registers all available module analysis passes. /// @@ -179,7 +179,8 @@ class PassBuilder { /// MachineFunctionAnalysisManager with all registered function analyses. /// Callers can still manually register any additional analyses. Callers can /// also pre-register analyses and this will not override those. - LLVM_ABI void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM); + LLVM_ABI void + registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM); /// Construct the core LLVM function canonicalization and simplification /// pipeline. @@ -195,9 +196,8 @@ class PassBuilder { /// build them. /// /// \p Phase indicates the current ThinLTO phase. - LLVM_ABI FunctionPassManager - buildFunctionSimplificationPipeline(OptimizationLevel Level, - ThinOrFullLTOPhase Phase); + LLVM_ABI FunctionPassManager buildFunctionSimplificationPipeline( + OptimizationLevel Level, ThinOrFullLTOPhase Phase); /// Construct the core LLVM module canonicalization and simplification /// pipeline. @@ -214,18 +214,18 @@ class PassBuilder { /// build them. /// /// \p Phase indicates the current ThinLTO phase. - LLVM_ABI ModulePassManager buildModuleSimplificationPipeline(OptimizationLevel Level, - ThinOrFullLTOPhase Phase); + LLVM_ABI ModulePassManager buildModuleSimplificationPipeline( + OptimizationLevel Level, ThinOrFullLTOPhase Phase); /// Construct the module pipeline that performs inlining as well as /// the inlining-driven cleanups. - LLVM_ABI ModuleInlinerWrapperPass buildInlinerPipeline(OptimizationLevel Level, - ThinOrFullLTOPhase Phase); + LLVM_ABI ModuleInlinerWrapperPass + buildInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase); /// Construct the module pipeline that performs inlining with /// module inliner pass. - LLVM_ABI ModulePassManager buildModuleInlinerPipeline(OptimizationLevel Level, - ThinOrFullLTOPhase Phase); + LLVM_ABI ModulePassManager + buildModuleInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase); /// Construct the core LLVM module optimization pipeline. /// @@ -240,9 +240,8 @@ class PassBuilder { /// only intended for use when attempting to optimize code. If frontends /// require some transformations for semantic reasons, they should explicitly /// build them. - LLVM_ABI ModulePassManager - buildModuleOptimizationPipeline(OptimizationLevel Level, - ThinOrFullLTOPhase LTOPhase); + LLVM_ABI ModulePassManager buildModuleOptimizationPipeline( + OptimizationLevel Level, ThinOrFullLTOPhase LTOPhase); /// Build a per-module default optimization pipeline. /// @@ -260,7 +259,8 @@ class PassBuilder { /// emits a section containing the pre-link bitcode along side the object code /// generated in non-LTO compilation. LLVM_ABI ModulePassManager buildFatLTODefaultPipeline(OptimizationLevel Level, - bool ThinLTO, bool EmitSummary); + bool ThinLTO, + bool EmitSummary); /// Build a pre-link, ThinLTO-targeting default optimization pipeline to /// a pass manager. @@ -269,7 +269,8 @@ class PassBuilder { /// a ThinLTO run. It works to minimize the IR which needs to be analyzed /// without making irreversible decisions which could be made better during /// the LTO run. - LLVM_ABI ModulePassManager buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level); + LLVM_ABI ModulePassManager + buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level); /// Build a ThinLTO default optimization pipeline to a pass manager. /// @@ -277,9 +278,8 @@ class PassBuilder { /// optimization and code generation. It is particularly tuned to fit well /// when IR coming into the LTO phase was first run through \c /// buildThinLTOPreLinkDefaultPipeline, and the two coordinate closely. - LLVM_ABI ModulePassManager - buildThinLTODefaultPipeline(OptimizationLevel Level, - const ModuleSummaryIndex *ImportSummary); + LLVM_ABI ModulePassManager buildThinLTODefaultPipeline( + OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary); /// Build a pre-link, LTO-targeting default optimization pipeline to a pass /// manager. @@ -288,7 +288,8 @@ class PassBuilder { /// run. It works to minimize the IR which needs to be analyzed without /// making irreversible decisions which could be made better during the LTO /// run. - LLVM_ABI ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level); + LLVM_ABI ModulePassManager + buildLTOPreLinkDefaultPipeline(OptimizationLevel Level); /// Build an LTO default optimization pipeline to a pass manager. /// @@ -296,8 +297,8 @@ class PassBuilder { /// optimization and code generation. It is particularly tuned to fit well /// when IR coming into the LTO phase was first run through \c /// buildLTOPreLinkDefaultPipeline, and the two coordinate closely. - LLVM_ABI ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level, - ModuleSummaryIndex *ExportSummary); + LLVM_ABI ModulePassManager buildLTODefaultPipeline( + OptimizationLevel Level, ModuleSummaryIndex *ExportSummary); /// Build an O0 pipeline with the minimal semantically required passes. /// @@ -353,7 +354,8 @@ class PassBuilder { /// specifically want the pass to run under a adaptor directly. This is /// preferred when a pipeline is largely of one type, but one or just a few /// passes are of different types(See PassBuilder.cpp for examples). - LLVM_ABI Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText); + LLVM_ABI Error parsePassPipeline(ModulePassManager &MPM, + StringRef PipelineText); /// {{@ Parse a textual pass pipeline description into a specific PassManager /// @@ -362,9 +364,12 @@ class PassBuilder { /// this is the valid pipeline text: /// /// function(lpass) - LLVM_ABI Error parsePassPipeline(CGSCCPassManager &CGPM, StringRef PipelineText); - LLVM_ABI Error parsePassPipeline(FunctionPassManager &FPM, StringRef PipelineText); - LLVM_ABI Error parsePassPipeline(LoopPassManager &LPM, StringRef PipelineText); + LLVM_ABI Error parsePassPipeline(CGSCCPassManager &CGPM, + StringRef PipelineText); + LLVM_ABI Error parsePassPipeline(FunctionPassManager &FPM, + StringRef PipelineText); + LLVM_ABI Error parsePassPipeline(LoopPassManager &LPM, + StringRef PipelineText); /// @}} /// Parse a textual MIR pipeline into the provided \c MachineFunctionPass @@ -377,7 +382,7 @@ class PassBuilder { /// There is no need to specify the pass nesting, and this function /// currently cannot handle the pass nesting. LLVM_ABI Error parsePassPipeline(MachineFunctionPassManager &MFPM, - StringRef PipelineText); + StringRef PipelineText); /// Parse a textual alias analysis pipeline into the provided AA manager. /// @@ -620,11 +625,12 @@ class PassBuilder { &C); /// Add PGOInstrumenation passes for O0 only. - LLVM_ABI void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen, - bool IsCS, bool AtomicCounterUpdate, - std::string ProfileFile, - std::string ProfileRemappingFile, - IntrusiveRefCntPtr FS); + LLVM_ABI void addPGOInstrPassesForO0(ModulePassManager &MPM, + bool RunProfileGen, bool IsCS, + bool AtomicCounterUpdate, + std::string ProfileFile, + std::string ProfileRemappingFile, + IntrusiveRefCntPtr FS); /// Returns PIC. External libraries can use this to register pass /// instrumentation callbacks. @@ -636,34 +642,37 @@ class PassBuilder { // Custom pipelines should use these to invoke the callbacks registered // by TargetMachines and other clients. LLVM_ABI void invokePeepholeEPCallbacks(FunctionPassManager &FPM, - OptimizationLevel Level); + OptimizationLevel Level); LLVM_ABI void invokeLateLoopOptimizationsEPCallbacks(LoopPassManager &LPM, - OptimizationLevel Level); + OptimizationLevel Level); LLVM_ABI void invokeLoopOptimizerEndEPCallbacks(LoopPassManager &LPM, - OptimizationLevel Level); + OptimizationLevel Level); LLVM_ABI void invokeScalarOptimizerLateEPCallbacks(FunctionPassManager &FPM, - OptimizationLevel Level); + OptimizationLevel Level); LLVM_ABI void invokeCGSCCOptimizerLateEPCallbacks(CGSCCPassManager &CGPM, - OptimizationLevel Level); + OptimizationLevel Level); LLVM_ABI void invokeVectorizerStartEPCallbacks(FunctionPassManager &FPM, - OptimizationLevel Level); + OptimizationLevel Level); LLVM_ABI void invokeVectorizerEndEPCallbacks(FunctionPassManager &FPM, - OptimizationLevel Level); + OptimizationLevel Level); LLVM_ABI void invokeOptimizerEarlyEPCallbacks(ModulePassManager &MPM, - OptimizationLevel Level, - ThinOrFullLTOPhase Phase); + OptimizationLevel Level, + ThinOrFullLTOPhase Phase); LLVM_ABI void invokeOptimizerLastEPCallbacks(ModulePassManager &MPM, - OptimizationLevel Level, - ThinOrFullLTOPhase Phase); - LLVM_ABI void invokeFullLinkTimeOptimizationEarlyEPCallbacks(ModulePassManager &MPM, - OptimizationLevel Level); - LLVM_ABI void invokeFullLinkTimeOptimizationLastEPCallbacks(ModulePassManager &MPM, - OptimizationLevel Level); + OptimizationLevel Level, + ThinOrFullLTOPhase Phase); + LLVM_ABI void + invokeFullLinkTimeOptimizationEarlyEPCallbacks(ModulePassManager &MPM, + OptimizationLevel Level); + LLVM_ABI void + invokeFullLinkTimeOptimizationLastEPCallbacks(ModulePassManager &MPM, + OptimizationLevel Level); LLVM_ABI void invokePipelineStartEPCallbacks(ModulePassManager &MPM, - OptimizationLevel Level); - LLVM_ABI void invokePipelineEarlySimplificationEPCallbacks(ModulePassManager &MPM, - OptimizationLevel Level, - ThinOrFullLTOPhase Phase); + OptimizationLevel Level); + LLVM_ABI void + invokePipelineEarlySimplificationEPCallbacks(ModulePassManager &MPM, + OptimizationLevel Level, + ThinOrFullLTOPhase Phase); static bool checkParametrizedPassName(StringRef Name, StringRef PassName) { if (!Name.consume_front(PassName)) @@ -715,8 +724,8 @@ class PassBuilder { /// /// \return false when Params is empty. LLVM_ABI static Expected parseSinglePassOption(StringRef Params, - StringRef OptionName, - StringRef PassName); + StringRef OptionName, + StringRef PassName); private: // O1 pass pipeline @@ -980,7 +989,6 @@ class NoOpLoopAnalysis : public AnalysisInfoMixin { /// Common option used by multiple tools to print pipeline passes LLVM_ABI extern cl::opt PrintPipelinePasses; - } #endif diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h b/llvm/include/llvm/Passes/StandardInstrumentations.h index e92d76d46e2f8..4ee5ab2554868 100644 --- a/llvm/include/llvm/Passes/StandardInstrumentations.h +++ b/llvm/include/llvm/Passes/StandardInstrumentations.h @@ -15,7 +15,6 @@ #ifndef LLVM_PASSES_STANDARDINSTRUMENTATIONS_H #define LLVM_PASSES_STANDARDINSTRUMENTATIONS_H -#include "llvm/Support/Compiler.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -28,6 +27,7 @@ #include "llvm/IR/PassTimingInfo.h" #include "llvm/IR/ValueHandle.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/TimeProfiler.h" #include "llvm/Transforms/IPO/SampleProfileProbe.h" @@ -181,9 +181,9 @@ class PreservedCFGCheckerInstrumentation { } LLVM_ABI static void printDiff(raw_ostream &out, const CFG &Before, - const CFG &After); + const CFG &After); LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA, - FunctionAnalysisManager::Invalidator &); + FunctionAnalysisManager::Invalidator &); }; #if LLVM_ENABLE_ABI_BREAKING_CHECKS @@ -191,7 +191,7 @@ class PreservedCFGCheckerInstrumentation { #endif LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC, - ModuleAnalysisManager &MAM); + ModuleAnalysisManager &MAM); }; // Base class for classes that report changes to the IR. @@ -445,7 +445,8 @@ template class IRComparer { // and added, respectively. Changes to the IR that do not affect basic // blocks are not reported as having changed the IR. The option // -print-module-scope does not affect this change reporter. -class LLVM_ABI InLineChangePrinter : public TextChangeReporter> { +class LLVM_ABI InLineChangePrinter + : public TextChangeReporter> { public: InLineChangePrinter(bool VerboseMode, bool ColourMode) : TextChangeReporter>(VerboseMode), @@ -477,7 +478,7 @@ class VerifyInstrumentation { public: VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {} LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC, - ModuleAnalysisManager *MAM); + ModuleAnalysisManager *MAM); }; /// This class implements --time-trace functionality for new pass manager. @@ -615,14 +616,15 @@ class StandardInstrumentations { bool VerifyEach; public: - LLVM_ABI StandardInstrumentations(LLVMContext &Context, bool DebugLogging, + LLVM_ABI + StandardInstrumentations(LLVMContext &Context, bool DebugLogging, bool VerifyEach = false, PrintPassOptions PrintPassOpts = PrintPassOptions()); // Register all the standard instrumentation callbacks. If \p FAM is nullptr // then PreservedCFGChecker is not enabled. LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC, - ModuleAnalysisManager *MAM = nullptr); + ModuleAnalysisManager *MAM = nullptr); TimePassesHandler &getTimePasses() { return TimePasses; } };