[llvm] [LLVM] Add all missing `LLVM_ABI` annotations (PR #178006)

Fabrice de Gans via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 26 10:06:06 PST 2026


https://github.com/Steelskin updated https://github.com/llvm/llvm-project/pull/178006

>From f3a7c0cb014fa54dbd92a2627db543b038914f2d Mon Sep 17 00:00:00 2001
From: Fabrice de Gans <fabrice at thebrowser.company>
Date: Mon, 26 Jan 2026 18:33:55 +0100
Subject: [PATCH] [LLVM] Add all missing `LLVM_ABI` annotations

These were found by running the `ids` tool on every LLVM header.

This effort is tracked in #109483.
---
 llvm/include/llvm-c/Remarks.h                 |   2 +-
 llvm/include/llvm-c/lto.h                     | 286 +++----
 llvm/include/llvm/Analysis/AssumptionCache.h  |   2 +-
 .../llvm/Analysis/BlockFrequencyInfoImpl.h    |  32 +-
 llvm/include/llvm/Analysis/CFGSCCPrinter.h    |   3 +-
 llvm/include/llvm/Analysis/CmpInstAnalysis.h  |  18 +-
 llvm/include/llvm/Analysis/CostModel.h        |   3 +-
 llvm/include/llvm/Analysis/CycleAnalysis.h    |  11 +-
 llvm/include/llvm/Analysis/DDGPrinter.h       |  14 +-
 .../llvm/Analysis/DXILMetadataAnalysis.h      |   9 +-
 llvm/include/llvm/Analysis/Delinearization.h  |  60 +-
 .../include/llvm/Analysis/DomConditionCache.h |   3 +-
 .../include/llvm/Analysis/DominanceFrontier.h |  13 +-
 .../Analysis/FunctionPropertiesAnalysis.h     |   2 +-
 llvm/include/llvm/Analysis/GuardUtils.h       |  27 +-
 llvm/include/llvm/Analysis/HashRecognize.h    |  24 +-
 llvm/include/llvm/Analysis/IR2Vec.h           |  58 +-
 llvm/include/llvm/Analysis/IVUsers.h          |  32 +-
 .../Analysis/IndirectCallPromotionAnalysis.h  |   9 +-
 llvm/include/llvm/Analysis/InstCount.h        |   3 +-
 llvm/include/llvm/Analysis/KernelInfo.h       |   3 +-
 .../llvm/Analysis/LazyBlockFrequencyInfo.h    |   3 +-
 .../llvm/Analysis/LazyBranchProbabilityInfo.h |   5 +-
 llvm/include/llvm/Analysis/LazyValueInfo.h    |  64 +-
 llvm/include/llvm/Analysis/Lint.h             |  12 +-
 .../include/llvm/Analysis/LoopCacheAnalysis.h |  36 +-
 llvm/include/llvm/Analysis/LoopIterator.h     |   3 +-
 llvm/include/llvm/Analysis/MLInlineAdvisor.h  |   5 +-
 llvm/include/llvm/Analysis/MemDerefPrinter.h  |   3 +-
 .../llvm/Analysis/MemoryDependenceAnalysis.h  |  67 +-
 .../llvm/Analysis/ModuleDebugInfoPrinter.h    |   5 +-
 .../llvm/Analysis/ObjCARCAliasAnalysis.h      |  19 +-
 .../llvm/Analysis/ObjCARCAnalysisUtils.h      |   5 +-
 llvm/include/llvm/Analysis/ObjCARCInstKind.h  |  29 +-
 .../llvm/Analysis/OverflowInstAnalysis.h      |   9 +-
 llvm/include/llvm/Analysis/PtrUseVisitor.h    |   5 +-
 llvm/include/llvm/Analysis/RegionInfo.h       |  19 +-
 .../llvm/Analysis/ReplayInlineAdvisor.h       |   8 +-
 .../llvm/Analysis/ScalarEvolutionDivision.h   |  19 +-
 llvm/include/llvm/Analysis/StackLifetime.h    |  23 +-
 .../llvm/Analysis/StackSafetyAnalysis.h       |  52 +-
 .../llvm/Analysis/StaticDataProfileInfo.h     |   4 +-
 llvm/include/llvm/Analysis/StructuralHash.h   |   3 +-
 .../llvm/Analysis/TargetTransformInfo.h       |  17 +-
 .../llvm/Analysis/TargetTransformInfoImpl.h   |   3 +-
 llvm/include/llvm/Analysis/Trace.h            |   9 +-
 .../include/llvm/Analysis/TypeMetadataUtils.h |  13 +-
 .../llvm/Analysis/UniformityAnalysis.h        |   9 +-
 .../include/llvm/Analysis/ValueLatticeUtils.h |   8 +-
 llvm/include/llvm/AsmParser/LLLexer.h         |  11 +-
 llvm/include/llvm/AsmParser/LLParser.h        |  64 +-
 llvm/include/llvm/BinaryFormat/DXContainer.h  |  18 +-
 llvm/include/llvm/CAS/ActionCache.h           |   5 +-
 llvm/include/llvm/CAS/BuiltinCASContext.h     |   3 +-
 llvm/include/llvm/CAS/CASID.h                 |   5 +-
 llvm/include/llvm/CAS/CASReference.h          |   9 +-
 llvm/include/llvm/CAS/ObjectStore.h           |  17 +-
 llvm/include/llvm/CAS/OnDiskDataAllocator.h   |   3 +-
 llvm/include/llvm/CAS/OnDiskGraphDB.h         |  13 +-
 llvm/include/llvm/CAS/OnDiskTrieRawHashMap.h  |   5 +-
 llvm/include/llvm/CAS/UnifiedOnDiskCache.h    |   5 +-
 llvm/include/llvm/CGData/StableFunctionMap.h  |   2 +-
 llvm/include/llvm/CodeGen/Analysis.h          |  88 +-
 llvm/include/llvm/CodeGen/AntiDepBreaker.h    |   9 +-
 .../llvm/CodeGen/AssignmentTrackingAnalysis.h |  13 +-
 llvm/include/llvm/CodeGen/AtomicExpand.h      |   3 +-
 llvm/include/llvm/CodeGen/AtomicExpandUtils.h |   4 +-
 .../CodeGen/BasicBlockMatchingAndInference.h  |   3 +-
 .../llvm/CodeGen/BasicBlockSectionUtils.h     |  12 +-
 .../CodeGen/BasicBlockSectionsProfileReader.h |  22 +-
 llvm/include/llvm/CodeGen/BasicTTIImpl.h      |   5 +-
 llvm/include/llvm/CodeGen/BranchFoldingPass.h |   5 +-
 llvm/include/llvm/CodeGen/BranchRelaxation.h  |   5 +-
 llvm/include/llvm/CodeGen/CFIFixup.h          |   3 +-
 llvm/include/llvm/CodeGen/CalcSpillWeights.h  |  35 +-
 llvm/include/llvm/CodeGen/CallBrPrepare.h     |   3 +-
 llvm/include/llvm/CodeGen/CodeGenCommonISel.h |  18 +-
 llvm/include/llvm/CodeGen/CodeGenPrepare.h    |   3 +-
 .../llvm/CodeGen/ComplexDeinterleavingPass.h  |   3 +-
 llvm/include/llvm/CodeGen/DFAPacketizer.h     |  15 +-
 .../llvm/CodeGen/DbgEntityHistoryCalculator.h |  30 +-
 .../llvm/CodeGen/DeadMachineInstructionElim.h |   5 +-
 llvm/include/llvm/CodeGen/DebugHandlerBase.h  |   5 +-
 llvm/include/llvm/CodeGen/DetectDeadLanes.h   |  21 +-
 llvm/include/llvm/CodeGen/DwarfEHPrepare.h    |   3 +-
 llvm/include/llvm/CodeGen/EarlyIfConversion.h |   5 +-
 llvm/include/llvm/CodeGen/EdgeBundles.h       |  12 +-
 .../include/llvm/CodeGen/ExecutionDomainFix.h |   3 +-
 llvm/include/llvm/CodeGen/ExpandIRInsts.h     |  11 +-
 llvm/include/llvm/CodeGen/ExpandMemCmp.h      |   3 +-
 .../llvm/CodeGen/ExpandPostRAPseudos.h        |   5 +-
 llvm/include/llvm/CodeGen/ExpandReductions.h  |   3 +-
 .../llvm/CodeGen/ExpandVectorPredication.h    |   6 +-
 llvm/include/llvm/CodeGen/FEntryInserter.h    |   5 +-
 llvm/include/llvm/CodeGen/FastISel.h          |  11 +-
 llvm/include/llvm/CodeGen/FaultMaps.h         |  12 +-
 llvm/include/llvm/CodeGen/FinalizeISel.h      |   4 +-
 .../llvm/CodeGen/FixupStatepointCallerSaved.h |   5 +-
 .../llvm/CodeGen/FunctionLoweringInfo.h       |  28 +-
 .../include/llvm/CodeGen/GCEmptyBasicBlocks.h |   5 +-
 llvm/include/llvm/CodeGen/GCMetadataPrinter.h |   3 +-
 .../llvm/CodeGen/GlobalISel/Combiner.h        |   3 +-
 .../llvm/CodeGen/GlobalISel/CombinerHelper.h  | 810 ++++++++++--------
 .../llvm/CodeGen/GlobalISel/IRTranslator.h    |   3 +-
 .../CodeGen/GlobalISel/InlineAsmLowering.h    |   3 +-
 .../llvm/CodeGen/GlobalISel/LegalizerHelper.h |   3 +-
 .../llvm/CodeGen/GlobalISel/Localizer.h       |   3 +-
 .../llvm/CodeGen/GlobalISel/RegBankSelect.h   |  42 +-
 llvm/include/llvm/CodeGen/GlobalMerge.h       |   3 +-
 .../llvm/CodeGen/GlobalMergeFunctions.h       |  13 +-
 llvm/include/llvm/CodeGen/HardwareLoops.h     |   3 +-
 llvm/include/llvm/CodeGen/IndirectBrExpand.h  |   3 +-
 llvm/include/llvm/CodeGen/InitUndef.h         |   5 +-
 llvm/include/llvm/CodeGen/InterleavedAccess.h |   3 +-
 .../llvm/CodeGen/InterleavedLoadCombine.h     |   3 +-
 llvm/include/llvm/CodeGen/IntrinsicLowering.h |   6 +-
 llvm/include/llvm/CodeGen/JMCInstrumenter.h   |   3 +-
 .../llvm/CodeGen/LatencyPriorityQueue.h       |   5 +-
 .../CodeGen/LazyMachineBlockFrequencyInfo.h   |   3 +-
 .../llvm/CodeGen/LibcallLoweringInfo.h        |  11 +-
 .../llvm/CodeGen/LiveDebugValuesPass.h        |  10 +-
 .../include/llvm/CodeGen/LiveDebugVariables.h |  31 +-
 llvm/include/llvm/CodeGen/LiveIntervalUnion.h |  15 +-
 llvm/include/llvm/CodeGen/LivePhysRegs.h      |  46 +-
 llvm/include/llvm/CodeGen/LiveRangeEdit.h     |   5 +-
 llvm/include/llvm/CodeGen/LiveRegMatrix.h     |  39 +-
 llvm/include/llvm/CodeGen/LiveStacks.h        |  19 +-
 .../llvm/CodeGen/LocalStackSlotAllocation.h   |   4 +-
 llvm/include/llvm/CodeGen/LoopTraversal.h     |   3 +-
 llvm/include/llvm/CodeGen/LowerEmuTLS.h       |   3 +-
 llvm/include/llvm/CodeGen/MBFIWrapper.h       |  11 +-
 llvm/include/llvm/CodeGen/MIR2Vec.h           |  15 +-
 .../include/llvm/CodeGen/MIRFSDiscriminator.h |   3 +-
 .../llvm/CodeGen/MIRFSDiscriminatorOptions.h  |   3 +-
 .../include/llvm/CodeGen/MIRParser/MIParser.h |  87 +-
 llvm/include/llvm/CodeGen/MIRSampleProfile.h  |   3 +-
 llvm/include/llvm/CodeGen/MIRYamlMapping.h    |   5 +-
 .../llvm/CodeGen/MachineBlockHashInfo.h       |   3 +-
 .../llvm/CodeGen/MachineBlockPlacement.h      |  11 +-
 .../CodeGen/MachineBranchProbabilityInfo.h    |  29 +-
 llvm/include/llvm/CodeGen/MachineCSE.h        |   5 +-
 .../llvm/CodeGen/MachineConstantPool.h        |  20 +-
 .../llvm/CodeGen/MachineCopyPropagation.h     |   5 +-
 .../llvm/CodeGen/MachineDominanceFrontier.h   |   3 +-
 .../llvm/CodeGen/MachineFunctionAnalysis.h    |   2 +-
 .../llvm/CodeGen/MachineLateInstrsCleanup.h   |   6 +-
 llvm/include/llvm/CodeGen/MachineLoopUtils.h  |  10 +-
 .../llvm/CodeGen/MachineModuleInfoImpls.h     |   9 +-
 llvm/include/llvm/CodeGen/MachinePipeliner.h  | 100 ++-
 llvm/include/llvm/CodeGen/MachineRegionInfo.h |  14 +-
 llvm/include/llvm/CodeGen/MachineSSAUpdater.h |  21 +-
 llvm/include/llvm/CodeGen/MachineSink.h       |   9 +-
 .../llvm/CodeGen/MachineTraceMetrics.h        |  48 +-
 .../llvm/CodeGen/MachineUniformityAnalysis.h  |  12 +-
 llvm/include/llvm/CodeGen/ModuloSchedule.h    |  42 +-
 .../llvm/CodeGen/MultiHazardRecognizer.h      |   3 +-
 llvm/include/llvm/CodeGen/OptimizePHIs.h      |   5 +-
 llvm/include/llvm/CodeGen/PEI.h               |   5 +-
 llvm/include/llvm/CodeGen/PHIElimination.h    |   5 +-
 llvm/include/llvm/CodeGen/PatchableFunction.h |   5 +-
 llvm/include/llvm/CodeGen/PeepholeOptimizer.h |   5 +-
 .../llvm/CodeGen/PostRAHazardRecognizer.h     |   5 +-
 llvm/include/llvm/CodeGen/PostRAMachineSink.h |   5 +-
 .../llvm/CodeGen/PostRASchedulerList.h        |   5 +-
 .../llvm/CodeGen/PreISelIntrinsicLowering.h   |   3 +-
 .../llvm/CodeGen/ProcessImplicitDefs.h        |   5 +-
 llvm/include/llvm/CodeGen/RDFGraph.h          | 138 +--
 llvm/include/llvm/CodeGen/RDFLiveness.h       |  37 +-
 llvm/include/llvm/CodeGen/RDFRegisters.h      |  49 +-
 .../llvm/CodeGen/ReachingDefAnalysis.h        |  99 ++-
 .../llvm/CodeGen/RegAllocEvictionAdvisor.h    |  35 +-
 llvm/include/llvm/CodeGen/RegAllocFast.h      |   9 +-
 .../include/llvm/CodeGen/RegAllocGreedyPass.h |   6 +-
 llvm/include/llvm/CodeGen/RegAllocPBQP.h      |   9 +-
 .../llvm/CodeGen/RegAllocPriorityAdvisor.h    |  26 +-
 .../llvm/CodeGen/RegUsageInfoCollector.h      |   5 +-
 .../llvm/CodeGen/RegUsageInfoPropagate.h      |   5 +-
 llvm/include/llvm/CodeGen/RegisterBankInfo.h  |  43 +-
 .../llvm/CodeGen/RegisterCoalescerPass.h      |   5 +-
 .../include/llvm/CodeGen/RegisterScavenging.h |  26 +-
 llvm/include/llvm/CodeGen/RegisterUsageInfo.h |  25 +-
 .../llvm/CodeGen/RemoveLoadsIntoFakeUses.h    |   5 +-
 .../llvm/CodeGen/RemoveRedundantDebugValues.h |   5 +-
 .../llvm/CodeGen/RenameIndependentSubregs.h   |   5 +-
 .../llvm/CodeGen/ResourcePriorityQueue.h      |   5 +-
 llvm/include/llvm/CodeGen/SDNodeInfo.h        |   3 +-
 llvm/include/llvm/CodeGen/SafeStack.h         |   3 +-
 .../llvm/CodeGen/SanitizerBinaryMetadata.h    |   5 +-
 llvm/include/llvm/CodeGen/ScheduleDFS.h       |  11 +-
 .../llvm/CodeGen/ScheduleHazardRecognizer.h   |   4 +-
 .../llvm/CodeGen/ScoreboardHazardRecognizer.h |   5 +-
 llvm/include/llvm/CodeGen/SelectOptimize.h    |   3 +-
 llvm/include/llvm/CodeGen/SelectionDAGISel.h  |   9 +-
 .../llvm/CodeGen/SelectionDAGTargetInfo.h     |   5 +-
 .../llvm/CodeGen/ShadowStackGCLowering.h      |   3 +-
 llvm/include/llvm/CodeGen/ShrinkWrap.h        |   5 +-
 llvm/include/llvm/CodeGen/SjLjEHPrepare.h     |   3 +-
 llvm/include/llvm/CodeGen/SpillPlacement.h    |  34 +-
 llvm/include/llvm/CodeGen/Spiller.h           |  11 +-
 llvm/include/llvm/CodeGen/StackColoring.h     |   5 +-
 .../CodeGen/StackFrameLayoutAnalysisPass.h    |   5 +-
 llvm/include/llvm/CodeGen/StackProtector.h    |  15 +-
 llvm/include/llvm/CodeGen/StackSlotColoring.h |   5 +-
 .../llvm/CodeGen/SwiftErrorValueTracking.h    |  28 +-
 .../llvm/CodeGen/SwitchLoweringUtils.h        |  44 +-
 llvm/include/llvm/CodeGen/TailDuplicator.h    |  23 +-
 .../CodeGen/TargetLoweringObjectFileImpl.h    |  13 +-
 .../llvm/CodeGen/TwoAddressInstructionPass.h  |   5 +-
 llvm/include/llvm/CodeGen/TypePromotion.h     |   3 +-
 .../llvm/CodeGen/UnreachableBlockElim.h       |   6 +-
 .../llvm/CodeGen/VLIWMachineScheduler.h       |  23 +-
 llvm/include/llvm/CodeGen/WasmEHFuncInfo.h    |   3 +-
 llvm/include/llvm/CodeGen/WasmEHPrepare.h     |   3 +-
 llvm/include/llvm/CodeGen/WinEHFuncInfo.h     |  29 +-
 llvm/include/llvm/CodeGen/WinEHPrepare.h      |   3 +-
 llvm/include/llvm/CodeGen/WindowScheduler.h   |   3 +-
 .../llvm/CodeGen/XRayInstrumentation.h        |   5 +-
 llvm/include/llvm/DTLTO/DTLTO.h               |   9 +-
 .../Classic/DWARFLinkerDeclContext.h          |  10 +-
 .../CodeView/DebugSubsectionVisitor.h         |   7 +-
 .../CodeView/DebugSymbolRVASubsection.h       |   7 +-
 .../llvm/DebugInfo/DWARF/DWARFDebugAddr.h     |  23 +-
 .../llvm/DebugInfo/DWARF/DWARFDebugAranges.h  |   5 +-
 .../llvm/DebugInfo/DWARF/DWARFDebugMacro.h    |  18 +-
 .../llvm/DebugInfo/DWARF/DWARFGdbIndex.h      |   5 +-
 .../llvm/DebugInfo/DWARF/DWARFTypeUnit.h      |   3 +-
 .../DWARF/LowLevel/DWARFDataExtractorSimple.h |   6 +-
 .../include/llvm/DebugInfo/GSYM/GsymContext.h |   3 +-
 .../LogicalView/Readers/LVBinaryReader.h      |  69 +-
 .../LogicalView/Readers/LVCodeViewReader.h    |   3 +-
 .../LogicalView/Readers/LVCodeViewVisitor.h   | 232 ++---
 .../LogicalView/Readers/LVDWARFReader.h       |   3 +-
 .../include/llvm/DebugInfo/PDB/DIA/DIAError.h |   5 +-
 .../llvm/DebugInfo/PDB/IPDBDataStream.h       |   3 +-
 .../llvm/DebugInfo/PDB/IPDBSectionContrib.h   |   3 +-
 llvm/include/llvm/DebugInfo/PDB/IPDBTable.h   |   3 +-
 .../llvm/DebugInfo/PDB/Native/EnumTables.h    |   3 +-
 .../PDB/Native/InjectedSourceStream.h         |   5 +-
 .../llvm/DebugInfo/PDB/Native/InputFile.h     |   6 +-
 .../PDB/Native/NativeCompilandSymbol.h        |   3 +-
 .../DebugInfo/PDB/Native/NativeEnumGlobals.h  |   3 +-
 .../PDB/Native/NativeEnumInjectedSources.h    |   4 +-
 .../PDB/Native/NativeEnumLineNumbers.h        |   3 +-
 .../DebugInfo/PDB/Native/NativeEnumModules.h  |   3 +-
 .../DebugInfo/PDB/Native/NativeEnumSymbols.h  |   3 +-
 .../DebugInfo/PDB/Native/NativeEnumTypes.h    |   3 +-
 .../DebugInfo/PDB/Native/NativeExeSymbol.h    |   3 +-
 .../PDB/Native/NativeFunctionSymbol.h         |   3 +-
 .../PDB/Native/NativeInlineSiteSymbol.h       |   3 +-
 .../DebugInfo/PDB/Native/NativeLineNumber.h   |   3 +-
 .../DebugInfo/PDB/Native/NativePublicSymbol.h |   3 +-
 .../PDB/Native/NativeSymbolEnumerator.h       |   3 +-
 .../DebugInfo/PDB/Native/NativeTypeArray.h    |   3 +-
 .../DebugInfo/PDB/Native/NativeTypeBuiltin.h  |   3 +-
 .../DebugInfo/PDB/Native/NativeTypeEnum.h     |   3 +-
 .../PDB/Native/NativeTypeFunctionSig.h        |   3 +-
 .../DebugInfo/PDB/Native/NativeTypePointer.h  |   3 +-
 .../DebugInfo/PDB/Native/NativeTypeTypedef.h  |   3 +-
 .../llvm/DebugInfo/PDB/Native/NativeTypeUDT.h |   3 +-
 .../DebugInfo/PDB/Native/NativeTypeVTShape.h  |   3 +-
 llvm/include/llvm/DebugInfo/PDB/PDBContext.h  |  55 +-
 .../llvm/DebugInfo/PDB/PDBSymbolAnnotation.h  |   3 +-
 .../llvm/DebugInfo/PDB/PDBSymbolBlock.h       |   3 +-
 .../DebugInfo/PDB/PDBSymbolCompilandDetails.h |   3 +-
 .../DebugInfo/PDB/PDBSymbolCompilandEnv.h     |   3 +-
 .../llvm/DebugInfo/PDB/PDBSymbolCustom.h      |   3 +-
 .../llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h  |   3 +-
 .../DebugInfo/PDB/PDBSymbolTypeDimension.h    |   3 +-
 .../llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h  |   3 +-
 .../llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h |   3 +-
 .../Symbolize/SymbolizableObjectFile.h        |   3 +-
 llvm/include/llvm/Demangle/Utility.h          |   2 +-
 .../llvm/ExecutionEngine/JITLink/COFF.h       |   7 +-
 .../ExecutionEngine/JITLink/COFF_x86_64.h     |  10 +-
 .../JITLink/DWARFRecordSectionSplitter.h      |   5 +-
 .../llvm/ExecutionEngine/JITLink/ELF.h        |   7 +-
 .../ExecutionEngine/JITLink/ELF_aarch32.h     |   8 +-
 .../ExecutionEngine/JITLink/ELF_aarch64.h     |   8 +-
 .../ExecutionEngine/JITLink/ELF_loongarch.h   |  10 +-
 .../llvm/ExecutionEngine/JITLink/ELF_ppc64.h  |  14 +-
 .../llvm/ExecutionEngine/JITLink/ELF_riscv.h  |   9 +-
 .../ExecutionEngine/JITLink/ELF_systemz.h     |   8 +-
 .../llvm/ExecutionEngine/JITLink/ELF_x86.h    |   7 +-
 .../llvm/ExecutionEngine/JITLink/ELF_x86_64.h |   7 +-
 .../llvm/ExecutionEngine/JITLink/XCOFF.h      |   7 +-
 .../ExecutionEngine/JITLink/XCOFF_ppc64.h     |   8 +-
 .../llvm/ExecutionEngine/JITLink/systemz.h    |   7 +-
 .../Orc/ExecutorResolutionGenerator.h         |   3 +-
 .../Orc/TargetProcess/ExecutorResolver.h      |   3 +-
 .../Orc/TargetProcess/LibraryResolver.h       |  35 +-
 .../Orc/TargetProcess/LibraryScanner.h        |  44 +-
 llvm/include/llvm/Frontend/HLSL/CBuffer.h     |   5 +-
 llvm/include/llvm/Frontend/HLSL/HLSLBinding.h |   2 +-
 .../Frontend/HLSL/RootSignatureMetadata.h     |   2 +-
 llvm/include/llvm/Frontend/OpenMP/OMP.h       |   2 +-
 .../llvm/Frontend/OpenMP/OMPIRBuilder.h       |  11 +-
 llvm/include/llvm/IR/Attributes.h             |   3 +-
 llvm/include/llvm/IR/AutoUpgrade.h            |   2 +-
 llvm/include/llvm/IR/DebugInfoMetadata.h      |   4 +-
 llvm/include/llvm/IR/GVMaterializer.h         |   3 +-
 llvm/include/llvm/IR/Instructions.h           |   3 +-
 llvm/include/llvm/IR/NVVMIntrinsicUtils.h     |  25 +-
 llvm/include/llvm/IR/PrintPasses.h            |  43 +-
 llvm/include/llvm/IR/RuntimeLibcalls.h        |  17 +-
 llvm/include/llvm/IR/SafepointIRVerifier.h    |   7 +-
 llvm/include/llvm/IR/Statepoint.h             |   6 +-
 llvm/include/llvm/IR/TypeFinder.h             |   5 +-
 llvm/include/llvm/LTO/LTO.h                   |  22 +-
 .../llvm/LTO/legacy/UpdateCompilerUsed.h      |   5 +-
 llvm/include/llvm/MC/ConstantPools.h          |  21 +-
 llvm/include/llvm/MC/DXContainerPSVInfo.h     |  10 +-
 llvm/include/llvm/MC/MCAsmInfoCOFF.h          |   7 +-
 llvm/include/llvm/MC/MCAsmInfoDarwin.h        |   3 +-
 llvm/include/llvm/MC/MCAsmInfoELF.h           |   3 +-
 llvm/include/llvm/MC/MCAsmInfoGOFF.h          |   3 +-
 llvm/include/llvm/MC/MCAsmInfoWasm.h          |   3 +-
 llvm/include/llvm/MC/MCAsmInfoXCOFF.h         |   3 +-
 llvm/include/llvm/MC/MCCodeView.h             |  70 +-
 llvm/include/llvm/MC/MCDXContainerWriter.h    |   5 +-
 .../MC/MCDisassembler/MCExternalSymbolizer.h  |   4 +-
 llvm/include/llvm/MC/MCELFObjectWriter.h      |   5 +-
 llvm/include/llvm/MC/MCELFStreamer.h          |  13 +-
 llvm/include/llvm/MC/MCGOFFObjectWriter.h     |   5 +-
 llvm/include/llvm/MC/MCLabel.h                |   6 +-
 .../llvm/MC/MCParser/MCAsmParserExtension.h   |  14 +-
 .../llvm/MC/MCParser/MCAsmParserUtils.h       |   6 +-
 llvm/include/llvm/MC/MCSFrame.h               |   8 +-
 llvm/include/llvm/MC/MCSPIRVObjectWriter.h    |   5 +-
 llvm/include/llvm/MC/MCSectionCOFF.h          |   5 +-
 llvm/include/llvm/MC/MCSectionXCOFF.h         |   3 +-
 llvm/include/llvm/MC/MCSymbol.h               |   2 +-
 llvm/include/llvm/MC/MCSymbolELF.h            |  31 +-
 llvm/include/llvm/MC/MCSymbolGOFF.h           |   3 +-
 llvm/include/llvm/MC/MCSymbolXCOFF.h          |   5 +-
 llvm/include/llvm/MC/MCWasmObjectWriter.h     |   7 +-
 llvm/include/llvm/MC/MCWasmStreamer.h         |   3 +-
 llvm/include/llvm/MC/MCWin64EH.h              |   7 +-
 llvm/include/llvm/MC/MCWinCOFFObjectWriter.h  |   9 +-
 llvm/include/llvm/MC/MCWinCOFFStreamer.h      |   3 +-
 llvm/include/llvm/MC/MCXCOFFObjectWriter.h    |   5 +-
 llvm/include/llvm/MC/MCXCOFFStreamer.h        |   3 +-
 llvm/include/llvm/MCA/CustomBehaviour.h       |   2 +-
 .../llvm/MCA/HardwareUnits/RegisterFile.h     |  59 +-
 .../MCA/HardwareUnits/RetireControlUnit.h     |  13 +-
 llvm/include/llvm/MCA/Stages/DispatchStage.h  |   3 +-
 llvm/include/llvm/MCA/Stages/ExecuteStage.h   |   3 +-
 .../llvm/MCA/Stages/InOrderIssueStage.h       |   9 +-
 .../llvm/MCA/Stages/MicroOpQueueStage.h       |   3 +-
 llvm/include/llvm/MCA/Stages/RetireStage.h    |   3 +-
 .../ObjCopy/DXContainer/DXContainerObjcopy.h  |  10 +-
 .../include/llvm/ObjCopy/XCOFF/XCOFFObjcopy.h |   8 +-
 llvm/include/llvm/Object/GOFF.h               |  18 +-
 llvm/include/llvm/Object/OffloadBundle.h      |   7 +-
 llvm/include/llvm/ObjectYAML/ArchiveYAML.h    |  13 +-
 llvm/include/llvm/ObjectYAML/COFFYAML.h       |  77 +-
 .../llvm/ObjectYAML/CodeViewYAMLTypeHashing.h |   7 +-
 llvm/include/llvm/ObjectYAML/ELFYAML.h        | 126 +--
 llvm/include/llvm/ObjectYAML/GOFFYAML.h       |   3 +-
 llvm/include/llvm/ObjectYAML/MachOYAML.h      |  59 +-
 llvm/include/llvm/ObjectYAML/MinidumpYAML.h   |  19 +-
 llvm/include/llvm/ObjectYAML/ObjectYAML.h     |   3 +-
 llvm/include/llvm/ObjectYAML/OffloadYAML.h    |  11 +-
 llvm/include/llvm/ObjectYAML/WasmYAML.h       |  79 +-
 llvm/include/llvm/ObjectYAML/XCOFFYAML.h      |  37 +-
 llvm/include/llvm/Option/Option.h             |   2 +-
 llvm/include/llvm/Plugins/PassPlugin.h        |   2 +-
 .../llvm/ProfileData/InstrProfReader.h        |   2 +-
 llvm/include/llvm/ProfileData/SampleProf.h    |   2 +-
 .../llvm/Remarks/BitstreamRemarkSerializer.h  |  30 +-
 llvm/include/llvm/Remarks/RemarkStreamer.h    |  10 +-
 .../llvm/Support/AArch64BuildAttributes.h     |  26 +-
 llvm/include/llvm/Support/BranchProbability.h |   2 +-
 llvm/include/llvm/Support/CodeGenCoverage.h   |  15 +-
 llvm/include/llvm/Support/DebugCounter.h      |   2 +-
 llvm/include/llvm/Support/Jobserver.h         |   9 +-
 llvm/include/llvm/Support/LSP/Protocol.h      |  55 +-
 llvm/include/llvm/Support/LSP/Transport.h     |  14 +-
 llvm/include/llvm/Support/OptionStrCmp.h      |   9 +-
 llvm/include/llvm/Support/SourceMgr.h         |   8 +-
 .../Support/SystemZ/zos_wrappers/string.h     |   5 +-
 .../llvm/Support/VirtualOutputBackend.h       |   5 +-
 .../llvm/Support/VirtualOutputBackends.h      |   7 +-
 .../llvm/Support/VirtualOutputConfig.h        |   2 +-
 .../include/llvm/Support/VirtualOutputError.h |  15 +-
 llvm/include/llvm/Support/VirtualOutputFile.h |   9 +-
 llvm/include/llvm/Support/Watchdog.h          |   5 +-
 .../llvm/Support/circular_raw_ostream.h       | 263 +++---
 llvm/include/llvm/Support/raw_ostream_proxy.h |   5 +-
 llvm/include/llvm/TableGen/DirectiveEmitter.h |   3 +-
 llvm/include/llvm/TableGen/Error.h            |  57 +-
 llvm/include/llvm/TableGen/Main.h             |   8 +-
 llvm/include/llvm/TableGen/Parser.h           |   4 +-
 llvm/include/llvm/TableGen/Record.h           | 196 +++--
 llvm/include/llvm/TableGen/SetTheory.h        |  17 +-
 llvm/include/llvm/TableGen/StringMatcher.h    |   3 +-
 .../llvm/TableGen/StringToOffsetTable.h       |   7 +-
 llvm/include/llvm/TableGen/TGTimer.h          |   9 +-
 llvm/include/llvm/TableGen/TableGenBackend.h  |  12 +-
 .../llvm/TargetParser/XtensaTargetParser.h    |  10 +-
 .../llvm/Testing/Annotations/Annotations.h    |  27 +-
 llvm/include/llvm/Testing/Support/Error.h     |   3 +-
 .../llvm/Testing/Support/SupportHelpers.h     |   3 +-
 .../AggressiveInstCombine.h                   |   3 +-
 .../Coroutines/CoroAnnotationElide.h          |   6 +-
 .../llvm/Transforms/Coroutines/CoroCleanup.h  |   3 +-
 .../Coroutines/CoroConditionalWrapper.h       |  10 +-
 .../llvm/Transforms/Coroutines/CoroEarly.h    |   3 +-
 .../llvm/Transforms/Coroutines/CoroElide.h    |   3 +-
 .../llvm/Transforms/Coroutines/SpillUtils.h   |  23 +-
 .../llvm/Transforms/IPO/Annotation2Metadata.h |   3 +-
 .../llvm/Transforms/IPO/ArgumentPromotion.h   |   6 +-
 .../Transforms/IPO/CalledValuePropagation.h   |   3 +-
 .../llvm/Transforms/IPO/ConstantMerge.h       |   3 +-
 .../include/llvm/Transforms/IPO/CrossDSOCFI.h |   3 +-
 .../Transforms/IPO/DeadArgumentElimination.h  |   3 +-
 .../llvm/Transforms/IPO/ElimAvailExtern.h     |   3 +-
 .../llvm/Transforms/IPO/ExpandVariadics.h     |   7 +-
 .../llvm/Transforms/IPO/FatLTOCleanup.h       |   3 +-
 .../llvm/Transforms/IPO/ForceFunctionAttrs.h  |   3 +-
 llvm/include/llvm/Transforms/IPO/GlobalOpt.h  |   3 +-
 .../include/llvm/Transforms/IPO/GlobalSplit.h |   3 +-
 .../llvm/Transforms/IPO/HotColdSplitting.h    |   5 +-
 llvm/include/llvm/Transforms/IPO/IROutliner.h |  18 +-
 .../llvm/Transforms/IPO/LoopExtractor.h       |   8 +-
 .../IPO/MemProfContextDisambiguation.h        |  13 +-
 llvm/include/llvm/Transforms/IPO/OpenMPOpt.h  |  16 +-
 .../llvm/Transforms/IPO/PartialInlining.h     |   3 +-
 llvm/include/llvm/Transforms/IPO/SCCP.h       |   3 +-
 .../Transforms/IPO/SampleProfileMatcher.h     |   3 +-
 .../Transforms/InstCombine/InstCombiner.h     |  18 +-
 .../Instrumentation/AddressSanitizerCommon.h  |  10 +-
 .../Instrumentation/BlockCoverageInference.h  |  15 +-
 .../Transforms/Instrumentation/CGProfile.h    |   3 +-
 .../Instrumentation/ControlHeightReduction.h  |   5 +-
 .../Instrumentation/PGOCtxProfFlattening.h    |   3 +-
 .../Instrumentation/PGOCtxProfLowering.h      |   7 +-
 .../Instrumentation/PGOForceFunctionAttrs.h   |   3 +-
 llvm/include/llvm/Transforms/Scalar/ADCE.h    |   3 +-
 .../Scalar/AlignmentFromAssumptions.h         |  14 +-
 .../Transforms/Scalar/AnnotationRemarks.h     |   3 +-
 llvm/include/llvm/Transforms/Scalar/BDCE.h    |   3 +-
 .../Transforms/Scalar/CallSiteSplitting.h     |   3 +-
 .../llvm/Transforms/Scalar/ConstantHoisting.h |   9 +-
 .../Transforms/Scalar/ConstraintElimination.h |   3 +-
 .../Scalar/CorrelatedValuePropagation.h       |   3 +-
 llvm/include/llvm/Transforms/Scalar/DCE.h     |   5 +-
 .../llvm/Transforms/Scalar/DFAJumpThreading.h |   3 +-
 .../Transforms/Scalar/DeadStoreElimination.h  |   3 +-
 .../llvm/Transforms/Scalar/DivRemPairs.h      |   3 +-
 .../Scalar/DropUnnecessaryAssumes.h           |   3 +-
 .../llvm/Transforms/Scalar/FlattenCFG.h       |   3 +-
 .../llvm/Transforms/Scalar/Float2Int.h        |   5 +-
 .../llvm/Transforms/Scalar/GVNExpression.h    |  14 +-
 .../llvm/Transforms/Scalar/GuardWidening.h    |   8 +-
 .../llvm/Transforms/Scalar/IVUsersPrinter.h   |   6 +-
 .../llvm/Transforms/Scalar/IndVarSimplify.h   |   6 +-
 .../Scalar/InductiveRangeCheckElimination.h   |   3 +-
 .../Transforms/Scalar/InferAddressSpaces.h    |   7 +-
 .../llvm/Transforms/Scalar/InferAlignment.h   |   3 +-
 .../llvm/Transforms/Scalar/InstSimplifyPass.h |   3 +-
 .../Transforms/Scalar/JumpTableToSwitch.h     |   3 +-
 llvm/include/llvm/Transforms/Scalar/LICM.h    |  25 +-
 .../Scalar/LoopAccessAnalysisPrinter.h        |   3 +-
 .../llvm/Transforms/Scalar/LoopBoundSplit.h   |   6 +-
 .../llvm/Transforms/Scalar/LoopDataPrefetch.h |   3 +-
 .../llvm/Transforms/Scalar/LoopDeletion.h     |   6 +-
 .../llvm/Transforms/Scalar/LoopDistribute.h   |   3 +-
 .../llvm/Transforms/Scalar/LoopFlatten.h      |   6 +-
 .../include/llvm/Transforms/Scalar/LoopFuse.h |   3 +-
 .../Transforms/Scalar/LoopIdiomRecognize.h    |  18 +-
 .../llvm/Transforms/Scalar/LoopInstSimplify.h |   6 +-
 .../llvm/Transforms/Scalar/LoopInterchange.h  |   6 +-
 .../Transforms/Scalar/LoopLoadElimination.h   |   3 +-
 .../llvm/Transforms/Scalar/LoopPredication.h  |   6 +-
 .../llvm/Transforms/Scalar/LoopRotation.h     |  15 +-
 .../llvm/Transforms/Scalar/LoopSimplifyCFG.h  |   6 +-
 .../include/llvm/Transforms/Scalar/LoopSink.h |   3 +-
 .../Transforms/Scalar/LoopStrengthReduce.h    |   6 +-
 .../llvm/Transforms/Scalar/LoopTermFold.h     |   6 +-
 .../Transforms/Scalar/LoopUnrollAndJamPass.h  |   6 +-
 .../llvm/Transforms/Scalar/LoopUnrollPass.h   |  15 +-
 .../Transforms/Scalar/LoopVersioningLICM.h    |   6 +-
 .../llvm/Transforms/Scalar/LowerAtomicPass.h  |   3 +-
 .../Scalar/LowerConstantIntrinsics.h          |   7 +-
 .../Transforms/Scalar/LowerGuardIntrinsic.h   |   3 +-
 .../Transforms/Scalar/LowerMatrixIntrinsics.h |   8 +-
 .../Scalar/LowerWidenableCondition.h          |   3 +-
 .../Transforms/Scalar/MakeGuardsExplicit.h    |   3 +-
 .../llvm/Transforms/Scalar/MergeICmps.h       |   3 +-
 .../Transforms/Scalar/MergedLoadStoreMotion.h |   8 +-
 .../llvm/Transforms/Scalar/NaryReassociate.h  |   9 +-
 llvm/include/llvm/Transforms/Scalar/NewGVN.h  |   3 +-
 .../Scalar/PartiallyInlineLibCalls.h          |   3 +-
 .../llvm/Transforms/Scalar/PlaceSafepoints.h  |   5 +-
 llvm/include/llvm/Transforms/Scalar/Reg2Mem.h |   3 +-
 .../Scalar/RewriteStatepointsForGC.h          |   7 +-
 llvm/include/llvm/Transforms/Scalar/SROA.h    |  10 +-
 .../Scalar/ScalarizeMaskedMemIntrin.h         |   3 +-
 .../Scalar/SeparateConstOffsetFromGEP.h       |   8 +-
 .../Transforms/Scalar/SimpleLoopUnswitch.h    |  13 +-
 llvm/include/llvm/Transforms/Scalar/Sink.h    |   3 +-
 .../Transforms/Scalar/SpeculativeExecution.h  |  12 +-
 .../Scalar/StraightLineStrengthReduce.h       |   3 +-
 .../llvm/Transforms/Scalar/StructurizeCFG.h   |  10 +-
 .../Scalar/TailRecursionElimination.h         |   3 +-
 .../Transforms/Scalar/WarnMissedTransforms.h  |   3 +-
 .../llvm/Transforms/Utils/AddDiscriminators.h |   3 +-
 .../Transforms/Utils/BreakCriticalEdges.h     |   3 +-
 .../Transforms/Utils/BypassSlowDivision.h     |   6 +-
 .../Transforms/Utils/CanonicalizeAliases.h    |   3 +-
 .../Utils/CanonicalizeFreezeInLoops.h         |   6 +-
 .../llvm/Transforms/Utils/ControlFlowUtils.h  |   3 +-
 .../llvm/Transforms/Utils/CountVisits.h       |   3 +-
 .../include/llvm/Transforms/Utils/CtorUtils.h |   6 +-
 .../llvm/Transforms/Utils/DXILUpgrade.h       |   3 +-
 .../llvm/Transforms/Utils/DebugSSAUpdater.h   |  26 +-
 .../Transforms/Utils/DeclareRuntimeLibcalls.h |   3 +-
 .../Transforms/Utils/EntryExitInstrumenter.h  |   8 +-
 .../llvm/Transforms/Utils/EscapeEnumerator.h  |   3 +-
 .../include/llvm/Transforms/Utils/Evaluator.h |  13 +-
 .../llvm/Transforms/Utils/FixIrreducible.h    |   3 +-
 .../llvm/Transforms/Utils/GlobalStatus.h      |   7 +-
 .../llvm/Transforms/Utils/GuardUtils.h        |  10 +-
 .../llvm/Transforms/Utils/HelloWorld.h        |   3 +-
 .../llvm/Transforms/Utils/IRNormalizer.h      |   4 +-
 .../llvm/Transforms/Utils/InjectTLIMappings.h |   3 +-
 .../llvm/Transforms/Utils/InstructionNamer.h  |   3 +-
 .../Transforms/Utils/LibCallsShrinkWrap.h     |   3 +-
 .../llvm/Transforms/Utils/LoopConstrainer.h   |  13 +-
 llvm/include/llvm/Transforms/Utils/LoopPeel.h |  27 +-
 .../include/llvm/Transforms/Utils/LoopUtils.h |  11 +-
 .../llvm/Transforms/Utils/LoopVersioning.h    |  22 +-
 .../llvm/Transforms/Utils/LowerAtomic.h       |  17 +-
 .../llvm/Transforms/Utils/LowerGlobalDtors.h  |   3 +-
 .../llvm/Transforms/Utils/LowerIFunc.h        |   3 +-
 .../llvm/Transforms/Utils/LowerInvoke.h       |   3 +-
 .../llvm/Transforms/Utils/LowerSwitch.h       |   3 +-
 .../Transforms/Utils/LowerVectorIntrinsics.h  |   3 +-
 .../llvm/Transforms/Utils/MatrixUtils.h       |   7 +-
 .../llvm/Transforms/Utils/MemoryOpRemark.h    |   5 +-
 .../Transforms/Utils/MemoryTaggingSupport.h   |  45 +-
 .../llvm/Transforms/Utils/MetaRenamer.h       |   3 +-
 .../include/llvm/Transforms/Utils/MisExpect.h |  20 +-
 .../llvm/Transforms/Utils/MoveAutoInit.h      |   3 +-
 .../llvm/Transforms/Utils/NameAnonGlobals.h   |   3 +-
 .../Utils/RelLookupTableConverter.h           |   3 +-
 .../llvm/Transforms/Utils/SSAUpdater.h        |  35 +-
 .../Transforms/Utils/SampleProfileInference.h |   5 +-
 .../Utils/SampleProfileLoaderBaseImpl.h       |   5 +-
 .../Utils/SampleProfileLoaderBaseUtil.h       |  33 +-
 .../Utils/ScalarEvolutionExpander.h           |   2 +-
 .../llvm/Transforms/Utils/SimplifyIndVar.h    |  31 +-
 .../llvm/Transforms/Utils/SimplifyLibCalls.h  |  15 +-
 .../llvm/Transforms/Utils/StripGCRelocates.h  |   3 +-
 .../Utils/StripNonLineTableDebugInfo.h        |   3 +-
 .../Transforms/Utils/UnifyFunctionExitNodes.h |   3 +-
 .../llvm/Transforms/Utils/UnifyLoopExits.h    |   3 +-
 .../llvm/Transforms/Utils/VNCoercion.h        |  44 +-
 .../Transforms/Vectorize/LoopIdiomVectorize.h |   6 +-
 .../Vectorize/LoopVectorizationLegality.h     |  57 +-
 .../llvm/Transforms/Vectorize/SLPVectorizer.h |  12 +-
 .../SandboxVectorizer/Passes/BottomUpVec.h    |   3 +-
 .../SandboxVectorizer/Passes/PackReuse.h      |   3 +-
 .../SandboxVectorizer/Passes/RegionsFromBBs.h |   3 +-
 .../Passes/RegionsFromMetadata.h              |   3 +-
 .../SandboxVectorizer/Passes/SeedCollection.h |   3 +-
 .../Passes/TransactionAcceptOrRevert.h        |   3 +-
 .../Passes/TransactionSave.h                  |   3 +-
 .../SandboxVectorizerPassBuilder.h            |   9 +-
 .../llvm/Transforms/Vectorize/VectorCombine.h |   3 +-
 .../llvm/WindowsResource/ResourceProcessor.h  |   5 +-
 .../WindowsResource/ResourceScriptToken.h     |  13 +-
 llvm/include/llvm/XRay/FDRTraceExpander.h     |   3 +-
 llvm/utils/git/ids-check-helper.py            |   3 +-
 574 files changed, 4498 insertions(+), 3602 deletions(-)

diff --git a/llvm/include/llvm-c/Remarks.h b/llvm/include/llvm-c/Remarks.h
index b3468a55e5046..31b1fd9acd697 100644
--- a/llvm/include/llvm-c/Remarks.h
+++ b/llvm/include/llvm-c/Remarks.h
@@ -343,7 +343,7 @@ LLVM_C_ABI extern void LLVMRemarkParserDispose(LLVMRemarkParserRef Parser);
  *
  * \since REMARKS_API_VERSION=0
  */
-extern uint32_t LLVMRemarkVersion(void);
+LLVM_C_ABI extern uint32_t LLVMRemarkVersion(void);
 
 /**
  * @} // endgoup LLVMCREMARKS
diff --git a/llvm/include/llvm-c/lto.h b/llvm/include/llvm-c/lto.h
index 91195b0fe9458..d0a92a6db90d5 100644
--- a/llvm/include/llvm-c/lto.h
+++ b/llvm/include/llvm-c/lto.h
@@ -17,6 +17,7 @@
 #define LLVM_C_LTO_H
 
 #include "llvm-c/ExternC.h"
+#include "llvm-c/Visibility.h"
 
 #ifdef __cplusplus
 #include <cstddef>
@@ -107,33 +108,30 @@ LLVM_C_EXTERN_C_BEGIN
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern const char*
-lto_get_version(void);
+LLVM_C_ABI extern const char *lto_get_version(void);
 
 /**
  * Returns the last error string or NULL if last operation was successful.
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern const char*
-lto_get_error_message(void);
+LLVM_C_ABI extern const char *lto_get_error_message(void);
 
 /**
  * Checks if a file is a loadable object file.
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_bool_t
-lto_module_is_object_file(const char* path);
+LLVM_C_ABI extern lto_bool_t lto_module_is_object_file(const char *path);
 
 /**
  * Checks if a file is a loadable object compiled for requested target.
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_bool_t
-lto_module_is_object_file_for_target(const char* path,
-                                     const char* target_triple_prefix);
+LLVM_C_ABI extern lto_bool_t
+lto_module_is_object_file_for_target(const char *path,
+                                     const char *target_triple_prefix);
 
 /**
  * Return true if \p Buffer contains a bitcode file with ObjC code (category
@@ -141,25 +139,24 @@ lto_module_is_object_file_for_target(const char* path,
  *
  * \since LTO_API_VERSION=20
  */
-extern lto_bool_t
-lto_module_has_objc_category(const void *mem, size_t length);
+LLVM_C_ABI extern lto_bool_t lto_module_has_objc_category(const void *mem,
+                                                          size_t length);
 
 /**
  * Checks if a buffer is a loadable object file.
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_bool_t lto_module_is_object_file_in_memory(const void *mem,
-                                                      size_t length);
+LLVM_C_ABI extern lto_bool_t
+lto_module_is_object_file_in_memory(const void *mem, size_t length);
 
 /**
  * Checks if a buffer is a loadable object compiled for requested target.
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_bool_t
-lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length,
-                                              const char* target_triple_prefix);
+LLVM_C_ABI extern lto_bool_t lto_module_is_object_file_in_memory_for_target(
+    const void *mem, size_t length, const char *target_triple_prefix);
 
 /**
  * Loads an object file from disk.
@@ -167,8 +164,7 @@ lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length,
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_module_t
-lto_module_create(const char* path);
+LLVM_C_ABI extern lto_module_t lto_module_create(const char *path);
 
 /**
  * Loads an object file from memory.
@@ -176,8 +172,8 @@ lto_module_create(const char* path);
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_module_t
-lto_module_create_from_memory(const void* mem, size_t length);
+LLVM_C_ABI extern lto_module_t lto_module_create_from_memory(const void *mem,
+                                                             size_t length);
 
 /**
  * Loads an object file from memory with an extra path argument.
@@ -185,8 +181,8 @@ lto_module_create_from_memory(const void* mem, size_t length);
  *
  * \since LTO_API_VERSION=9
  */
-extern lto_module_t
-lto_module_create_from_memory_with_path(const void* mem, size_t length,
+LLVM_C_ABI extern lto_module_t
+lto_module_create_from_memory_with_path(const void *mem, size_t length,
                                         const char *path);
 
 /**
@@ -200,7 +196,7 @@ lto_module_create_from_memory_with_path(const void* mem, size_t length,
  *
  * \since LTO_API_VERSION=11
  */
-extern lto_module_t
+LLVM_C_ABI extern lto_module_t
 lto_module_create_in_local_context(const void *mem, size_t length,
                                    const char *path);
 
@@ -214,7 +210,7 @@ lto_module_create_in_local_context(const void *mem, size_t length,
  *
  * \since LTO_API_VERSION=11
  */
-extern lto_module_t
+LLVM_C_ABI extern lto_module_t
 lto_module_create_in_codegen_context(const void *mem, size_t length,
                                      const char *path, lto_code_gen_t cg);
 
@@ -224,7 +220,7 @@ lto_module_create_in_codegen_context(const void *mem, size_t length,
  *
  * \since LTO_API_VERSION=5
  */
-extern lto_module_t
+LLVM_C_ABI extern lto_module_t
 lto_module_create_from_fd(int fd, const char *path, size_t file_size);
 
 /**
@@ -233,7 +229,7 @@ lto_module_create_from_fd(int fd, const char *path, size_t file_size);
  *
  * \since LTO_API_VERSION=5
  */
-extern lto_module_t
+LLVM_C_ABI extern lto_module_t
 lto_module_create_from_fd_at_offset(int fd, const char *path, size_t file_size,
                                     size_t map_size, off_t offset);
 
@@ -243,47 +239,44 @@ lto_module_create_from_fd_at_offset(int fd, const char *path, size_t file_size,
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern void
-lto_module_dispose(lto_module_t mod);
+LLVM_C_ABI extern void lto_module_dispose(lto_module_t mod);
 
 /**
  * Returns triple string which the object module was compiled under.
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern const char*
-lto_module_get_target_triple(lto_module_t mod);
+LLVM_C_ABI extern const char *lto_module_get_target_triple(lto_module_t mod);
 
 /**
  * Sets triple string with which the object will be codegened.
  *
  * \since LTO_API_VERSION=4
  */
-extern void
-lto_module_set_target_triple(lto_module_t mod, const char *triple);
+LLVM_C_ABI extern void lto_module_set_target_triple(lto_module_t mod,
+                                                    const char *triple);
 
 /**
  * Returns the number of symbols in the object module.
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern unsigned int
-lto_module_get_num_symbols(lto_module_t mod);
+LLVM_C_ABI extern unsigned int lto_module_get_num_symbols(lto_module_t mod);
 
 /**
  * Returns the name of the ith symbol in the object module.
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern const char*
-lto_module_get_symbol_name(lto_module_t mod, unsigned int index);
+LLVM_C_ABI extern const char *lto_module_get_symbol_name(lto_module_t mod,
+                                                         unsigned int index);
 
 /**
  * Returns the attributes of the ith symbol in the object module.
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_symbol_attributes
+LLVM_C_ABI extern lto_symbol_attributes
 lto_module_get_symbol_attribute(lto_module_t mod, unsigned int index);
 
 /**
@@ -291,15 +284,16 @@ lto_module_get_symbol_attribute(lto_module_t mod, unsigned int index);
  *
  * \since prior to LTO_API_VERSION=30
  */
-extern unsigned int lto_module_get_num_asm_undef_symbols(lto_module_t mod);
+LLVM_C_ABI extern unsigned int
+lto_module_get_num_asm_undef_symbols(lto_module_t mod);
 
 /**
  * Returns the name of the ith asm undefined symbol in the object module.
  *
  * \since prior to LTO_API_VERSION=30
  */
-extern const char *lto_module_get_asm_undef_symbol_name(lto_module_t mod,
-                                                        unsigned int index);
+LLVM_C_ABI extern const char *
+lto_module_get_asm_undef_symbol_name(lto_module_t mod, unsigned int index);
 
 /**
  * Returns the module's linker options.
@@ -309,8 +303,7 @@ extern const char *lto_module_get_asm_undef_symbol_name(lto_module_t mod,
  *
  * \since LTO_API_VERSION=16
  */
-extern const char*
-lto_module_get_linkeropts(lto_module_t mod);
+LLVM_C_ABI extern const char *lto_module_get_linkeropts(lto_module_t mod);
 
 /**
  * If targeting mach-o on darwin, this function gets the CPU type and subtype
@@ -323,9 +316,9 @@ lto_module_get_linkeropts(lto_module_t mod);
  *
  * \since LTO_API_VERSION=27
  */
-extern lto_bool_t lto_module_get_macho_cputype(lto_module_t mod,
-                                               unsigned int *out_cputype,
-                                               unsigned int *out_cpusubtype);
+LLVM_C_ABI extern lto_bool_t
+lto_module_get_macho_cputype(lto_module_t mod, unsigned int *out_cputype,
+                             unsigned int *out_cpusubtype);
 
 /**
  * This function can be used by the linker to check if a given module has
@@ -336,7 +329,7 @@ extern lto_bool_t lto_module_get_macho_cputype(lto_module_t mod,
  *
  * \since LTO_API_VERSION=29
  */
-extern lto_bool_t lto_module_has_ctor_dtor(lto_module_t mod);
+LLVM_C_ABI extern lto_bool_t lto_module_has_ctor_dtor(lto_module_t mod);
 /**
  * Diagnostic severity.
  *
@@ -368,9 +361,9 @@ typedef void (*lto_diagnostic_handler_t)(
  *
  * \since LTO_API_VERSION=7
  */
-extern void lto_codegen_set_diagnostic_handler(lto_code_gen_t,
-                                               lto_diagnostic_handler_t,
-                                               void *);
+LLVM_C_ABI extern void
+lto_codegen_set_diagnostic_handler(lto_code_gen_t, lto_diagnostic_handler_t,
+                                   void *);
 
 /**
  * Instantiates a code generator.
@@ -381,8 +374,7 @@ extern void lto_codegen_set_diagnostic_handler(lto_code_gen_t,
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_code_gen_t
-lto_codegen_create(void);
+LLVM_C_ABI extern lto_code_gen_t lto_codegen_create(void);
 
 /**
  * Instantiate a code generator in its own context.
@@ -393,8 +385,7 @@ lto_codegen_create(void);
  *
  * \since LTO_API_VERSION=11
  */
-extern lto_code_gen_t
-lto_codegen_create_in_local_context(void);
+LLVM_C_ABI extern lto_code_gen_t lto_codegen_create_in_local_context(void);
 
 /**
  * Frees all code generator and all memory it internally allocated.
@@ -402,8 +393,7 @@ lto_codegen_create_in_local_context(void);
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern void
-lto_codegen_dispose(lto_code_gen_t);
+LLVM_C_ABI extern void lto_codegen_dispose(lto_code_gen_t);
 
 /**
  * Add an object module to the set of modules for which code will be generated.
@@ -415,8 +405,8 @@ lto_codegen_dispose(lto_code_gen_t);
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_bool_t
-lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
+LLVM_C_ABI extern lto_bool_t lto_codegen_add_module(lto_code_gen_t cg,
+                                                    lto_module_t mod);
 
 /**
  * Sets the object module for code generation. This will transfer the ownership
@@ -426,8 +416,8 @@ lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
  *
  * \since LTO_API_VERSION=13
  */
-extern void
-lto_codegen_set_module(lto_code_gen_t cg, lto_module_t mod);
+LLVM_C_ABI extern void lto_codegen_set_module(lto_code_gen_t cg,
+                                              lto_module_t mod);
 
 /**
  * Sets if debug info should be generated.
@@ -435,8 +425,8 @@ lto_codegen_set_module(lto_code_gen_t cg, lto_module_t mod);
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_bool_t
-lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);
+LLVM_C_ABI extern lto_bool_t lto_codegen_set_debug_model(lto_code_gen_t cg,
+                                                         lto_debug_model);
 
 /**
  * Sets which PIC code model to generated.
@@ -444,16 +434,15 @@ lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern lto_bool_t
-lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model);
+LLVM_C_ABI extern lto_bool_t lto_codegen_set_pic_model(lto_code_gen_t cg,
+                                                       lto_codegen_model);
 
 /**
  * Sets the cpu to generate code for.
  *
  * \since LTO_API_VERSION=4
  */
-extern void
-lto_codegen_set_cpu(lto_code_gen_t cg, const char *cpu);
+LLVM_C_ABI extern void lto_codegen_set_cpu(lto_code_gen_t cg, const char *cpu);
 
 /**
  * Sets the location of the assembler tool to run. If not set, libLTO
@@ -461,17 +450,16 @@ lto_codegen_set_cpu(lto_code_gen_t cg, const char *cpu);
  *
  * \since LTO_API_VERSION=3
  */
-extern void
-lto_codegen_set_assembler_path(lto_code_gen_t cg, const char* path);
+LLVM_C_ABI extern void lto_codegen_set_assembler_path(lto_code_gen_t cg,
+                                                      const char *path);
 
 /**
  * Sets extra arguments that libLTO should pass to the assembler.
  *
  * \since LTO_API_VERSION=4
  */
-extern void
-lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
-                               int nargs);
+LLVM_C_ABI extern void
+lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args, int nargs);
 
 /**
  * Adds to a list of all global symbols that must exist in the final generated
@@ -480,8 +468,8 @@ lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern void
-lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const char* symbol);
+LLVM_C_ABI extern void lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg,
+                                                            const char *symbol);
 
 /**
  * Writes a new object file at the specified path that contains the
@@ -490,8 +478,8 @@ lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const char* symbol);
  *
  * \since LTO_API_VERSION=5
  */
-extern lto_bool_t
-lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);
+LLVM_C_ABI extern lto_bool_t lto_codegen_write_merged_modules(lto_code_gen_t cg,
+                                                              const char *path);
 
 /**
  * Generates code for all added modules into one native object file.
@@ -505,8 +493,8 @@ lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern const void*
-lto_codegen_compile(lto_code_gen_t cg, size_t* length);
+LLVM_C_ABI extern const void *lto_codegen_compile(lto_code_gen_t cg,
+                                                  size_t *length);
 
 /**
  * Generates code for all added modules into one native object file.
@@ -517,16 +505,15 @@ lto_codegen_compile(lto_code_gen_t cg, size_t* length);
  *
  * \since LTO_API_VERSION=5
  */
-extern lto_bool_t
-lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name);
+LLVM_C_ABI extern lto_bool_t lto_codegen_compile_to_file(lto_code_gen_t cg,
+                                                         const char **name);
 
 /**
  * Runs optimization for the merged module. Returns true on error.
  *
  * \since LTO_API_VERSION=12
  */
-extern lto_bool_t
-lto_codegen_optimize(lto_code_gen_t cg);
+LLVM_C_ABI extern lto_bool_t lto_codegen_optimize(lto_code_gen_t cg);
 
 /**
  * Generates code for the optimized merged module into one native object file.
@@ -540,16 +527,15 @@ lto_codegen_optimize(lto_code_gen_t cg);
  *
  * \since LTO_API_VERSION=12
  */
-extern const void*
-lto_codegen_compile_optimized(lto_code_gen_t cg, size_t* length);
+LLVM_C_ABI extern const void *lto_codegen_compile_optimized(lto_code_gen_t cg,
+                                                            size_t *length);
 
 /**
  * Returns the runtime API version.
  *
  * \since LTO_API_VERSION=12
  */
-extern unsigned int
-lto_api_version(void);
+LLVM_C_ABI extern unsigned int lto_api_version(void);
 
 /**
  * Parses options immediately, making them available as early as possible. For
@@ -563,7 +549,8 @@ lto_api_version(void);
  *
  * \since LTO_API_VERSION=28
  */
-extern void lto_set_debug_options(const char *const *options, int number);
+LLVM_C_ABI extern void lto_set_debug_options(const char *const *options,
+                                             int number);
 
 /**
  * Sets options to help debug codegen bugs. Since parsing shud only happen once,
@@ -576,8 +563,8 @@ extern void lto_set_debug_options(const char *const *options, int number);
  *
  * \since prior to LTO_API_VERSION=3
  */
-extern void
-lto_codegen_debug_options(lto_code_gen_t cg, const char *);
+LLVM_C_ABI extern void lto_codegen_debug_options(lto_code_gen_t cg,
+                                                 const char *);
 
 /**
  * Same as the previous function, but takes every option separately through an
@@ -585,8 +572,9 @@ lto_codegen_debug_options(lto_code_gen_t cg, const char *);
  *
  * \since prior to LTO_API_VERSION=26
  */
-extern void lto_codegen_debug_options_array(lto_code_gen_t cg,
-                                            const char *const *, int number);
+LLVM_C_ABI extern void lto_codegen_debug_options_array(lto_code_gen_t cg,
+                                                       const char *const *,
+                                                       int number);
 
 /**
  * Initializes LLVM disassemblers.
@@ -594,8 +582,7 @@ extern void lto_codegen_debug_options_array(lto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=5
  */
-extern void
-lto_initialize_disassembler(void);
+LLVM_C_ABI extern void lto_initialize_disassembler(void);
 
 /**
  * Sets if we should run internalize pass during optimization and code
@@ -603,7 +590,7 @@ lto_initialize_disassembler(void);
  *
  * \since LTO_API_VERSION=14
  */
-extern void
+LLVM_C_ABI extern void
 lto_codegen_set_should_internalize(lto_code_gen_t cg,
                                    lto_bool_t ShouldInternalize);
 
@@ -615,7 +602,7 @@ lto_codegen_set_should_internalize(lto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=15
  */
-extern void
+LLVM_C_ABI extern void
 lto_codegen_set_should_embed_uselists(lto_code_gen_t cg,
                                       lto_bool_t ShouldEmbedUselists);
 
@@ -630,9 +617,8 @@ typedef struct LLVMOpaqueLTOInput *lto_input_t;
   *
   * \since LTO_API_VERSION=24
   */
-extern lto_input_t lto_input_create(const void *buffer,
-                                    size_t buffer_size,
-                                    const char *path);
+LLVM_C_ABI extern lto_input_t
+lto_input_create(const void *buffer, size_t buffer_size, const char *path);
 
 /**
   * Frees all memory internally allocated by the LTO input file.
@@ -640,7 +626,7 @@ extern lto_input_t lto_input_create(const void *buffer,
   *
   * \since LTO_API_VERSION=24
   */
-extern void lto_input_dispose(lto_input_t input);
+LLVM_C_ABI extern void lto_input_dispose(lto_input_t input);
 
 /**
   * Returns the number of dependent library specifiers
@@ -648,7 +634,8 @@ extern void lto_input_dispose(lto_input_t input);
   *
   * \since LTO_API_VERSION=24
   */
-extern unsigned lto_input_get_num_dependent_libraries(lto_input_t input);
+LLVM_C_ABI extern unsigned
+lto_input_get_num_dependent_libraries(lto_input_t input);
 
 /**
   * Returns the ith dependent library specifier
@@ -657,9 +644,8 @@ extern unsigned lto_input_get_num_dependent_libraries(lto_input_t input);
   *
   * \since LTO_API_VERSION=24
   */
-extern const char * lto_input_get_dependent_library(lto_input_t input,
-                                                    size_t index,
-                                                    size_t *size);
+LLVM_C_ABI extern const char *
+lto_input_get_dependent_library(lto_input_t input, size_t index, size_t *size);
 
 /**
  * Returns the list of libcall symbols that can be generated by LTO
@@ -667,7 +653,7 @@ extern const char * lto_input_get_dependent_library(lto_input_t input,
  *
  * \since prior to LTO_API_VERSION=25
  */
-extern const char *const *lto_runtime_lib_symbols_list(size_t *size);
+LLVM_C_ABI extern const char *const *lto_runtime_lib_symbols_list(size_t *size);
 
 /**
  * @} // endgoup LLVMCLTO
@@ -699,7 +685,7 @@ typedef struct {
  *
  * \since LTO_API_VERSION=18
  */
-extern thinlto_code_gen_t thinlto_create_codegen(void);
+LLVM_C_ABI extern thinlto_code_gen_t thinlto_create_codegen(void);
 
 /**
  * Frees the generator and all memory it internally allocated.
@@ -707,7 +693,7 @@ extern thinlto_code_gen_t thinlto_create_codegen(void);
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_dispose(thinlto_code_gen_t cg);
+LLVM_C_ABI extern void thinlto_codegen_dispose(thinlto_code_gen_t cg);
 
 /**
  * Add a module to a ThinLTO code generator. Identifier has to be unique among
@@ -720,9 +706,9 @@ extern void thinlto_codegen_dispose(thinlto_code_gen_t cg);
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_add_module(thinlto_code_gen_t cg,
-                                       const char *identifier, const char *data,
-                                       int length);
+LLVM_C_ABI extern void thinlto_codegen_add_module(thinlto_code_gen_t cg,
+                                                  const char *identifier,
+                                                  const char *data, int length);
 
 /**
  * Optimize and codegen all the modules added to the codegenerator using
@@ -730,7 +716,7 @@ extern void thinlto_codegen_add_module(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_process(thinlto_code_gen_t cg);
+LLVM_C_ABI extern void thinlto_codegen_process(thinlto_code_gen_t cg);
 
 /**
  * Returns the number of object files produced by the ThinLTO CodeGenerator.
@@ -741,7 +727,8 @@ extern void thinlto_codegen_process(thinlto_code_gen_t cg);
  *
  * \since LTO_API_VERSION=18
  */
-extern unsigned int thinlto_module_get_num_objects(thinlto_code_gen_t cg);
+LLVM_C_ABI extern unsigned int
+thinlto_module_get_num_objects(thinlto_code_gen_t cg);
 
 /**
  * Returns a reference to the ith object file produced by the ThinLTO
@@ -752,8 +739,8 @@ extern unsigned int thinlto_module_get_num_objects(thinlto_code_gen_t cg);
  *
  * \since LTO_API_VERSION=18
  */
-extern LTOObjectBuffer thinlto_module_get_object(thinlto_code_gen_t cg,
-                                                 unsigned int index);
+LLVM_C_ABI extern LTOObjectBuffer
+thinlto_module_get_object(thinlto_code_gen_t cg, unsigned int index);
 
 /**
  * Returns the number of object files produced by the ThinLTO CodeGenerator.
@@ -764,7 +751,8 @@ extern LTOObjectBuffer thinlto_module_get_object(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=21
  */
-unsigned int thinlto_module_get_num_object_files(thinlto_code_gen_t cg);
+LLVM_C_ABI unsigned int
+thinlto_module_get_num_object_files(thinlto_code_gen_t cg);
 
 /**
  * Returns the path to the ith object file produced by the ThinLTO
@@ -775,8 +763,8 @@ unsigned int thinlto_module_get_num_object_files(thinlto_code_gen_t cg);
  *
  * \since LTO_API_VERSION=21
  */
-const char *thinlto_module_get_object_file(thinlto_code_gen_t cg,
-                                           unsigned int index);
+LLVM_C_ABI const char *thinlto_module_get_object_file(thinlto_code_gen_t cg,
+                                                      unsigned int index);
 
 /**
  * Sets which PIC code model to generate.
@@ -784,8 +772,8 @@ const char *thinlto_module_get_object_file(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=18
  */
-extern lto_bool_t thinlto_codegen_set_pic_model(thinlto_code_gen_t cg,
-                                                lto_codegen_model);
+LLVM_C_ABI extern lto_bool_t
+thinlto_codegen_set_pic_model(thinlto_code_gen_t cg, lto_codegen_model);
 
 /**
  * Sets the path to a directory to use as a storage for temporary bitcode files.
@@ -794,8 +782,9 @@ extern lto_bool_t thinlto_codegen_set_pic_model(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_set_savetemps_dir(thinlto_code_gen_t cg,
-                                              const char *save_temps_dir);
+LLVM_C_ABI extern void
+thinlto_codegen_set_savetemps_dir(thinlto_code_gen_t cg,
+                                  const char *save_temps_dir);
 
 /**
  * Set the path to a directory where to save generated object files. This
@@ -805,15 +794,16 @@ extern void thinlto_codegen_set_savetemps_dir(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=21
  */
-void thinlto_set_generated_objects_dir(thinlto_code_gen_t cg,
-                                       const char *save_temps_dir);
+LLVM_C_ABI void thinlto_set_generated_objects_dir(thinlto_code_gen_t cg,
+                                                  const char *save_temps_dir);
 
 /**
  * Sets the cpu to generate code for.
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_set_cpu(thinlto_code_gen_t cg, const char *cpu);
+LLVM_C_ABI extern void thinlto_codegen_set_cpu(thinlto_code_gen_t cg,
+                                               const char *cpu);
 
 /**
  * Disable CodeGen, only run the stages till codegen and stop. The output will
@@ -821,30 +811,32 @@ extern void thinlto_codegen_set_cpu(thinlto_code_gen_t cg, const char *cpu);
  *
  * \since LTO_API_VERSION=19
  */
-extern void thinlto_codegen_disable_codegen(thinlto_code_gen_t cg,
-                                            lto_bool_t disable);
+LLVM_C_ABI extern void thinlto_codegen_disable_codegen(thinlto_code_gen_t cg,
+                                                       lto_bool_t disable);
 
 /**
  * Perform CodeGen only: disable all other stages.
  *
  * \since LTO_API_VERSION=19
  */
-extern void thinlto_codegen_set_codegen_only(thinlto_code_gen_t cg,
-                                             lto_bool_t codegen_only);
+LLVM_C_ABI extern void
+thinlto_codegen_set_codegen_only(thinlto_code_gen_t cg,
+                                 lto_bool_t codegen_only);
 
 /**
  * Parse -mllvm style debug options.
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_debug_options(const char *const *options, int number);
+LLVM_C_ABI extern void thinlto_debug_options(const char *const *options,
+                                             int number);
 
 /**
  * Test if a module has support for ThinLTO linking.
  *
  * \since LTO_API_VERSION=18
  */
-extern lto_bool_t lto_module_is_thinlto(lto_module_t mod);
+LLVM_C_ABI extern lto_bool_t lto_module_is_thinlto(lto_module_t mod);
 
 /**
  * Adds a symbol to the list of global symbols that must exist in the final
@@ -854,9 +846,9 @@ extern lto_bool_t lto_module_is_thinlto(lto_module_t mod);
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_add_must_preserve_symbol(thinlto_code_gen_t cg,
-                                                     const char *name,
-                                                     int length);
+LLVM_C_ABI extern void
+thinlto_codegen_add_must_preserve_symbol(thinlto_code_gen_t cg,
+                                         const char *name, int length);
 
 /**
  * Adds a symbol to the list of global symbols that are cross-referenced between
@@ -866,9 +858,9 @@ extern void thinlto_codegen_add_must_preserve_symbol(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_add_cross_referenced_symbol(thinlto_code_gen_t cg,
-                                                        const char *name,
-                                                        int length);
+LLVM_C_ABI extern void
+thinlto_codegen_add_cross_referenced_symbol(thinlto_code_gen_t cg,
+                                            const char *name, int length);
 
 /**
  * @} // endgoup LLVMCTLTO
@@ -897,8 +889,8 @@ extern void thinlto_codegen_add_cross_referenced_symbol(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_set_cache_dir(thinlto_code_gen_t cg,
-                                          const char *cache_dir);
+LLVM_C_ABI extern void thinlto_codegen_set_cache_dir(thinlto_code_gen_t cg,
+                                                     const char *cache_dir);
 
 /**
  * Sets the cache pruning interval (in seconds). A negative value disables the
@@ -907,8 +899,8 @@ extern void thinlto_codegen_set_cache_dir(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_set_cache_pruning_interval(thinlto_code_gen_t cg,
-                                                       int interval);
+LLVM_C_ABI extern void
+thinlto_codegen_set_cache_pruning_interval(thinlto_code_gen_t cg, int interval);
 
 /**
  * Sets the maximum cache size that can be persistent across build, in terms of
@@ -923,7 +915,8 @@ extern void thinlto_codegen_set_cache_pruning_interval(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_set_final_cache_size_relative_to_available_space(
+LLVM_C_ABI extern void
+thinlto_codegen_set_final_cache_size_relative_to_available_space(
     thinlto_code_gen_t cg, unsigned percentage);
 
 /**
@@ -932,8 +925,9 @@ extern void thinlto_codegen_set_final_cache_size_relative_to_available_space(
  *
  * \since LTO_API_VERSION=18
  */
-extern void thinlto_codegen_set_cache_entry_expiration(thinlto_code_gen_t cg,
-                                                       unsigned expiration);
+LLVM_C_ABI extern void
+thinlto_codegen_set_cache_entry_expiration(thinlto_code_gen_t cg,
+                                           unsigned expiration);
 
 /**
  * Sets the maximum size of the cache directory (in bytes). A value over the
@@ -943,8 +937,9 @@ extern void thinlto_codegen_set_cache_entry_expiration(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=22
  */
-extern void thinlto_codegen_set_cache_size_bytes(thinlto_code_gen_t cg,
-                                                 unsigned max_size_bytes);
+LLVM_C_ABI extern void
+thinlto_codegen_set_cache_size_bytes(thinlto_code_gen_t cg,
+                                     unsigned max_size_bytes);
 
 /**
  * Same as thinlto_codegen_set_cache_size_bytes, except the maximum size is in
@@ -952,7 +947,7 @@ extern void thinlto_codegen_set_cache_size_bytes(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=23
  */
-extern void
+LLVM_C_ABI extern void
 thinlto_codegen_set_cache_size_megabytes(thinlto_code_gen_t cg,
                                          unsigned max_size_megabytes);
 
@@ -962,8 +957,9 @@ thinlto_codegen_set_cache_size_megabytes(thinlto_code_gen_t cg,
  *
  * \since LTO_API_VERSION=22
  */
-extern void thinlto_codegen_set_cache_size_files(thinlto_code_gen_t cg,
-                                                 unsigned max_size_files);
+LLVM_C_ABI extern void
+thinlto_codegen_set_cache_size_files(thinlto_code_gen_t cg,
+                                     unsigned max_size_files);
 
 /**
  * @} // endgroup LLVMCTLTO_CACHING
diff --git a/llvm/include/llvm/Analysis/AssumptionCache.h b/llvm/include/llvm/Analysis/AssumptionCache.h
index 5656729d20366..2d117a8b60feb 100644
--- a/llvm/include/llvm/Analysis/AssumptionCache.h
+++ b/llvm/include/llvm/Analysis/AssumptionCache.h
@@ -168,7 +168,7 @@ class AssumptionCache {
   }
 
   /// Determine which values are affected by this assume operand bundle.
-  static void
+  LLVM_ABI static void
   findValuesAffectedByOperandBundle(OperandBundleUse Bundle,
                                     function_ref<void(Value *)> InsertAffected);
 };
diff --git a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
index 3d0942aa2d9f3..9a5cf9d1d083c 100644
--- a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
+++ b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
@@ -30,6 +30,7 @@
 #include "llvm/Support/BlockFrequency.h"
 #include "llvm/Support/BranchProbability.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DOTGraphTraits.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
@@ -52,11 +53,11 @@
 #define DEBUG_TYPE "block-freq"
 
 namespace llvm {
-extern llvm::cl::opt<bool> CheckBFIUnknownBlockQueries;
+extern LLVM_ABI llvm::cl::opt<bool> CheckBFIUnknownBlockQueries;
 
-extern llvm::cl::opt<bool> UseIterativeBFIInference;
-extern llvm::cl::opt<unsigned> IterativeBFIMaxIterationsPerBlock;
-extern llvm::cl::opt<double> IterativeBFIPrecision;
+extern LLVM_ABI llvm::cl::opt<bool> UseIterativeBFIInference;
+extern LLVM_ABI llvm::cl::opt<unsigned> IterativeBFIMaxIterationsPerBlock;
+extern LLVM_ABI llvm::cl::opt<double> IterativeBFIPrecision;
 
 class BranchProbabilityInfo;
 class Function;
@@ -141,10 +142,10 @@ class BlockMass {
   ///
   /// Convert to \a ScaledNumber.  \a isFull() gives 1.0, while \a isEmpty()
   /// gives slightly above 0.0.
-  ScaledNumber<uint64_t> toScaled() const;
+  LLVM_ABI ScaledNumber<uint64_t> toScaled() const;
 
-  void dump() const;
-  raw_ostream &print(raw_ostream &OS) const;
+  LLVM_ABI void dump() const;
+  LLVM_ABI raw_ostream &print(raw_ostream &OS) const;
 };
 
 inline BlockMass operator+(BlockMass L, BlockMass R) {
@@ -174,7 +175,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, BlockMass X) {
 ///
 /// Nevertheless, the majority of the overall algorithm documentation lives with
 /// BlockFrequencyInfoImpl.  See there for details.
-class BlockFrequencyInfoImplBase {
+class LLVM_ABI BlockFrequencyInfoImplBase {
 public:
   using Scaled64 = ScaledNumber<uint64_t>;
   using BlockMass = bfi_detail::BlockMass;
@@ -409,10 +410,11 @@ class BlockFrequencyInfoImplBase {
     /// cases, adjacent edge weights are combined by sorting WeightList and
     /// combining adjacent weights.  However, for very large edge lists an
     /// auxiliary hash table is used.
-    void normalize();
+    LLVM_ABI void normalize();
 
   private:
-    void add(const BlockNode &Node, uint64_t Amount, Weight::DistType Type);
+    LLVM_ABI void add(const BlockNode &Node, uint64_t Amount,
+                      Weight::DistType Type);
   };
 
   /// Data about each block.  This is used downstream.
@@ -636,20 +638,20 @@ struct IrreducibleGraph {
   template <class BlockEdgesAdder>
   void initialize(const BFIBase::LoopData *OuterLoop,
                   BlockEdgesAdder addBlockEdges);
-  void addNodesInLoop(const BFIBase::LoopData &OuterLoop);
-  void addNodesInFunction();
+  LLVM_ABI void addNodesInLoop(const BFIBase::LoopData &OuterLoop);
+  LLVM_ABI void addNodesInFunction();
 
   void addNode(const BlockNode &Node) {
     Nodes.emplace_back(Node);
     BFI.Working[Node.Index].getMass() = BlockMass::getEmpty();
   }
 
-  void indexNodes();
+  LLVM_ABI void indexNodes();
   template <class BlockEdgesAdder>
   void addEdges(const BlockNode &Node, const BFIBase::LoopData *OuterLoop,
                 BlockEdgesAdder addBlockEdges);
-  void addEdge(IrrNode &Irr, const BlockNode &Succ,
-               const BFIBase::LoopData *OuterLoop);
+  LLVM_ABI void addEdge(IrrNode &Irr, const BlockNode &Succ,
+                        const BFIBase::LoopData *OuterLoop);
 };
 
 template <class BlockEdgesAdder>
diff --git a/llvm/include/llvm/Analysis/CFGSCCPrinter.h b/llvm/include/llvm/Analysis/CFGSCCPrinter.h
index 0ea0b46c46269..16bb86d339ed1 100644
--- a/llvm/include/llvm/Analysis/CFGSCCPrinter.h
+++ b/llvm/include/llvm/Analysis/CFGSCCPrinter.h
@@ -10,6 +10,7 @@
 #define LLVM_ANALYSIS_CFGSCCPRINTER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -18,7 +19,7 @@ class CFGSCCPrinterPass : public PassInfoMixin<CFGSCCPrinterPass> {
 
 public:
   explicit CFGSCCPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 } // namespace llvm
diff --git a/llvm/include/llvm/Analysis/CmpInstAnalysis.h b/llvm/include/llvm/Analysis/CmpInstAnalysis.h
index adcac0360632d..b5ac8ca60e60e 100644
--- a/llvm/include/llvm/Analysis/CmpInstAnalysis.h
+++ b/llvm/include/llvm/Analysis/CmpInstAnalysis.h
@@ -16,6 +16,7 @@
 
 #include "llvm/ADT/APInt.h"
 #include "llvm/IR/InstrTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
   class Type;
@@ -44,7 +45,7 @@ namespace llvm {
   /// 110     6   A <= B
   /// 111     7   Always true
   ///
-  unsigned getICmpCode(CmpInst::Predicate Pred);
+  LLVM_ABI unsigned getICmpCode(CmpInst::Predicate Pred);
 
   /// This is the complement of getICmpCode. It turns a predicate code into
   /// either a constant true or false or the predicate for a new ICmp.
@@ -52,12 +53,13 @@ namespace llvm {
   /// new ICmp instruction.
   /// Non-NULL return value will be a true or false constant.
   /// NULL return means a new ICmp is needed. The predicate is output in Pred.
-  Constant *getPredForICmpCode(unsigned Code, bool Sign, Type *OpTy,
-                               CmpInst::Predicate &Pred);
+  LLVM_ABI Constant *getPredForICmpCode(unsigned Code, bool Sign, Type *OpTy,
+                                        CmpInst::Predicate &Pred);
 
   /// Return true if both predicates match sign or if at least one of them is an
   /// equality comparison (which is signless).
-  bool predicatesFoldable(CmpInst::Predicate P1, CmpInst::Predicate P2);
+  LLVM_ABI bool predicatesFoldable(CmpInst::Predicate P1,
+                                   CmpInst::Predicate P2);
 
   /// Similar to getICmpCode but for FCmpInst. This encodes a fcmp predicate
   /// into a four bit mask.
@@ -89,8 +91,8 @@ namespace llvm {
   /// either a constant true or false or the predicate for a new FCmp.
   /// Non-NULL return value will be a true or false constant.
   /// NULL return means a new ICmp is needed. The predicate is output in Pred.
-  Constant *getPredForFCmpCode(unsigned Code, Type *OpTy,
-                               CmpInst::Predicate &Pred);
+  LLVM_ABI Constant *getPredForFCmpCode(unsigned Code, Type *OpTy,
+                                        CmpInst::Predicate &Pred);
 
   /// Represents the operation icmp (X & Mask) pred C, where pred can only be
   /// eq or ne.
@@ -105,7 +107,7 @@ namespace llvm {
   /// Unless \p AllowNonZeroC is true, C will always be 0. If \p
   /// DecomposeAnd is specified, then, for equality predicates, this will
   /// decompose bitmasking via `and`.
-  std::optional<DecomposedBitTest>
+  LLVM_ABI std::optional<DecomposedBitTest>
   decomposeBitTestICmp(Value *LHS, Value *RHS, CmpInst::Predicate Pred,
                        bool LookThroughTrunc = true, bool AllowNonZeroC = false,
                        bool DecomposeAnd = false);
@@ -114,7 +116,7 @@ namespace llvm {
   /// possible. Unless \p AllowNonZeroC is true, C will always be 0.
   /// If \p DecomposeAnd is specified, then, for equality predicates, this
   /// will decompose bitmasking via `and`.
-  std::optional<DecomposedBitTest>
+  LLVM_ABI std::optional<DecomposedBitTest>
   decomposeBitTest(Value *Cond, bool LookThroughTrunc = true,
                    bool AllowNonZeroC = false, bool DecomposeAnd = false);
 
diff --git a/llvm/include/llvm/Analysis/CostModel.h b/llvm/include/llvm/Analysis/CostModel.h
index 9b127c27ba7ef..57b92c175ff0a 100644
--- a/llvm/include/llvm/Analysis/CostModel.h
+++ b/llvm/include/llvm/Analysis/CostModel.h
@@ -10,6 +10,7 @@
 #define LLVM_ANALYSIS_COSTMODEL_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 /// Printer pass for cost modeling results.
@@ -19,7 +20,7 @@ class CostModelPrinterPass : public PassInfoMixin<CostModelPrinterPass> {
 public:
   explicit CostModelPrinterPass(raw_ostream &OS) : OS(OS) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   static bool isRequired() { return true; }
 };
diff --git a/llvm/include/llvm/Analysis/CycleAnalysis.h b/llvm/include/llvm/Analysis/CycleAnalysis.h
index 40c42d5495f7c..c85feb8102254 100644
--- a/llvm/include/llvm/Analysis/CycleAnalysis.h
+++ b/llvm/include/llvm/Analysis/CycleAnalysis.h
@@ -18,11 +18,12 @@
 #include "llvm/IR/CycleInfo.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 /// Legacy analysis pass which computes a \ref CycleInfo.
-class CycleInfoWrapperPass : public FunctionPass {
+class LLVM_ABI CycleInfoWrapperPass : public FunctionPass {
   Function *F = nullptr;
   CycleInfo CI;
 
@@ -54,7 +55,7 @@ class CycleAnalysis : public AnalysisInfoMixin<CycleAnalysis> {
   using LegacyWrapper = CycleInfoWrapperPass;
 
   /// Run the analysis pass over a function and produce a dominator tree.
-  CycleInfo run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI CycleInfo run(Function &F, FunctionAnalysisManager &);
 
   // TODO: verify analysis?
 };
@@ -63,13 +64,13 @@ class CycleInfoPrinterPass : public PassInfoMixin<CycleInfoPrinterPass> {
   raw_ostream &OS;
 
 public:
-  explicit CycleInfoPrinterPass(raw_ostream &OS);
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI explicit CycleInfoPrinterPass(raw_ostream &OS);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 
 struct CycleInfoVerifierPass : public PassInfoMixin<CycleInfoVerifierPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/Analysis/DDGPrinter.h b/llvm/include/llvm/Analysis/DDGPrinter.h
index 4aa154d173bad..94ab4a25eeabe 100644
--- a/llvm/include/llvm/Analysis/DDGPrinter.h
+++ b/llvm/include/llvm/Analysis/DDGPrinter.h
@@ -16,6 +16,7 @@
 #define LLVM_ANALYSIS_DDGPRINTER_H
 
 #include "llvm/Analysis/DDG.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DOTGraphTraits.h"
 
 namespace llvm {
@@ -27,8 +28,9 @@ class Loop;
 //===--------------------------------------------------------------------===//
 class DDGDotPrinterPass : public PassInfoMixin<DDGDotPrinterPass> {
 public:
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
   static bool isRequired() { return true; }
 };
 
@@ -49,20 +51,20 @@ struct DOTGraphTraits<const DataDependenceGraph *>
 
   /// Print a DDG node either in concise form (-ddg-dot-only) or
   /// verbose mode (-ddg-dot).
-  std::string getNodeLabel(const DDGNode *Node,
-                           const DataDependenceGraph *Graph);
+  LLVM_ABI std::string getNodeLabel(const DDGNode *Node,
+                                    const DataDependenceGraph *Graph);
 
   /// Print attributes of an edge in the DDG graph. If the edge
   /// is a MemoryDependence edge, then detailed dependence info
   /// available from DependenceAnalysis is displayed.
-  std::string
+  LLVM_ABI std::string
   getEdgeAttributes(const DDGNode *Node,
                     GraphTraits<const DDGNode *>::ChildIteratorType I,
                     const DataDependenceGraph *G);
 
   /// Do not print nodes that are part of a pi-block separately. They
   /// will be printed when their containing pi-block is being printed.
-  bool isNodeHidden(const DDGNode *Node, const DataDependenceGraph *G);
+  LLVM_ABI bool isNodeHidden(const DDGNode *Node, const DataDependenceGraph *G);
 
 private:
   /// Print a DDG node in concise form.
diff --git a/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h b/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h
index a1b030c157eae..eb46942b17be4 100644
--- a/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h
+++ b/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/VersionTuple.h"
 #include "llvm/TargetParser/Triple.h"
 
@@ -40,7 +41,7 @@ struct ModuleMetadataInfo {
   Triple::EnvironmentType ShaderProfile{Triple::UnknownEnvironment};
   VersionTuple ValidatorVersion{};
   SmallVector<EntryProperties> EntryPropertyVec{};
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 };
 
 } // namespace dxil
@@ -54,7 +55,7 @@ class DXILMetadataAnalysis : public AnalysisInfoMixin<DXILMetadataAnalysis> {
 public:
   using Result = dxil::ModuleMetadataInfo;
   /// Gather module metadata info for the module \c M.
-  dxil::ModuleMetadataInfo run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI dxil::ModuleMetadataInfo run(Module &M, ModuleAnalysisManager &AM);
 };
 
 /// Printer pass for the \c DXILMetadataAnalysis results.
@@ -65,13 +66,13 @@ class DXILMetadataAnalysisPrinterPass
 public:
   explicit DXILMetadataAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
   static bool isRequired() { return true; }
 };
 
 /// Legacy pass
-class DXILMetadataAnalysisWrapperPass : public ModulePass {
+class LLVM_ABI DXILMetadataAnalysisWrapperPass : public ModulePass {
   std::unique_ptr<dxil::ModuleMetadataInfo> MetadataInfo;
 
 public:
diff --git a/llvm/include/llvm/Analysis/Delinearization.h b/llvm/include/llvm/Analysis/Delinearization.h
index d48b57cc4284f..0662af143ef47 100644
--- a/llvm/include/llvm/Analysis/Delinearization.h
+++ b/llvm/include/llvm/Analysis/Delinearization.h
@@ -18,6 +18,7 @@
 
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class raw_ostream;
@@ -30,21 +31,21 @@ class SCEV;
 /// Compute the array dimensions Sizes from the set of Terms extracted from
 /// the memory access function of this SCEVAddRecExpr (second step of
 /// delinearization).
-void findArrayDimensions(ScalarEvolution &SE,
-                         SmallVectorImpl<const SCEV *> &Terms,
-                         SmallVectorImpl<const SCEV *> &Sizes,
-                         const SCEV *ElementSize);
+LLVM_ABI void findArrayDimensions(ScalarEvolution &SE,
+                                  SmallVectorImpl<const SCEV *> &Terms,
+                                  SmallVectorImpl<const SCEV *> &Sizes,
+                                  const SCEV *ElementSize);
 
 /// Collect parametric terms occurring in step expressions (first step of
 /// delinearization).
-void collectParametricTerms(ScalarEvolution &SE, const SCEV *Expr,
-                            SmallVectorImpl<const SCEV *> &Terms);
+LLVM_ABI void collectParametricTerms(ScalarEvolution &SE, const SCEV *Expr,
+                                     SmallVectorImpl<const SCEV *> &Terms);
 
 /// Return in Subscripts the access functions for each dimension in Sizes
 /// (third step of delinearization).
-void computeAccessFunctions(ScalarEvolution &SE, const SCEV *Expr,
-                            SmallVectorImpl<const SCEV *> &Subscripts,
-                            SmallVectorImpl<const SCEV *> &Sizes);
+LLVM_ABI void computeAccessFunctions(ScalarEvolution &SE, const SCEV *Expr,
+                                     SmallVectorImpl<const SCEV *> &Subscripts,
+                                     SmallVectorImpl<const SCEV *> &Sizes);
 /// Split this SCEVAddRecExpr into two vectors of SCEVs representing the
 /// subscripts and sizes of an array access.
 ///
@@ -109,15 +110,17 @@ void computeAccessFunctions(ScalarEvolution &SE, const SCEV *Expr,
 /// The subscript of the outermost dimension is the Quotient: [j+k].
 ///
 /// Overall, we have: A[][n][m], and the access function: A[j+k][2i][5i].
-void delinearize(ScalarEvolution &SE, const SCEV *Expr,
-                 SmallVectorImpl<const SCEV *> &Subscripts,
-                 SmallVectorImpl<const SCEV *> &Sizes, const SCEV *ElementSize);
+LLVM_ABI void delinearize(ScalarEvolution &SE, const SCEV *Expr,
+                          SmallVectorImpl<const SCEV *> &Subscripts,
+                          SmallVectorImpl<const SCEV *> &Sizes,
+                          const SCEV *ElementSize);
 
 /// Compute the dimensions of fixed size array from \Expr and save the results
 /// in \p Sizes.
-bool findFixedSizeArrayDimensions(ScalarEvolution &SE, const SCEV *Expr,
-                                  SmallVectorImpl<uint64_t> &Sizes,
-                                  const SCEV *ElementSize);
+LLVM_ABI bool findFixedSizeArrayDimensions(ScalarEvolution &SE,
+                                           const SCEV *Expr,
+                                           SmallVectorImpl<uint64_t> &Sizes,
+                                           const SCEV *ElementSize);
 
 /// Split this SCEVAddRecExpr into two vectors of SCEVs representing the
 /// subscripts and sizes of an access to a fixed size array. This is a special
@@ -136,17 +139,18 @@ bool findFixedSizeArrayDimensions(ScalarEvolution &SE, const SCEV *Expr,
 ///
 /// This function is intended to replace getIndexExpressionsFromGEP. They rely
 /// on the GEP source element type so that will be removed in the future.
-bool delinearizeFixedSizeArray(ScalarEvolution &SE, const SCEV *Expr,
-                               SmallVectorImpl<const SCEV *> &Subscripts,
-                               SmallVectorImpl<const SCEV *> &Sizes,
-                               const SCEV *ElementSize);
+LLVM_ABI bool
+delinearizeFixedSizeArray(ScalarEvolution &SE, const SCEV *Expr,
+                          SmallVectorImpl<const SCEV *> &Subscripts,
+                          SmallVectorImpl<const SCEV *> &Sizes,
+                          const SCEV *ElementSize);
 
 /// Check that each subscript in \p Subscripts is within the corresponding size
 /// in \p Sizes. For the outermost dimension, the subscript being negative is
 /// allowed.
-bool validateDelinearizationResult(ScalarEvolution &SE,
-                                   ArrayRef<const SCEV *> Sizes,
-                                   ArrayRef<const SCEV *> Subscripts);
+LLVM_ABI bool validateDelinearizationResult(ScalarEvolution &SE,
+                                            ArrayRef<const SCEV *> Sizes,
+                                            ArrayRef<const SCEV *> Subscripts);
 
 /// Gathers the individual index expressions from a GEP instruction.
 ///
@@ -157,15 +161,15 @@ bool validateDelinearizationResult(ScalarEvolution &SE,
 /// lists have either equal length or the size list is one element shorter in
 /// case there is no known size available for the outermost array dimension.
 /// Returns true if successful and false otherwise.
-bool getIndexExpressionsFromGEP(ScalarEvolution &SE,
-                                const GetElementPtrInst *GEP,
-                                SmallVectorImpl<const SCEV *> &Subscripts,
-                                SmallVectorImpl<const SCEV *> &Sizes);
+LLVM_ABI bool
+getIndexExpressionsFromGEP(ScalarEvolution &SE, const GetElementPtrInst *GEP,
+                           SmallVectorImpl<const SCEV *> &Subscripts,
+                           SmallVectorImpl<const SCEV *> &Sizes);
 
 struct DelinearizationPrinterPass
     : public PassInfoMixin<DelinearizationPrinterPass> {
-  explicit DelinearizationPrinterPass(raw_ostream &OS);
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI explicit DelinearizationPrinterPass(raw_ostream &OS);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 
 private:
diff --git a/llvm/include/llvm/Analysis/DomConditionCache.h b/llvm/include/llvm/Analysis/DomConditionCache.h
index ac25803143f49..fd10fbae4868b 100644
--- a/llvm/include/llvm/Analysis/DomConditionCache.h
+++ b/llvm/include/llvm/Analysis/DomConditionCache.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -34,7 +35,7 @@ class DomConditionCache {
 
 public:
   /// Add a branch condition to the cache.
-  void registerBranch(BranchInst *BI);
+  LLVM_ABI void registerBranch(BranchInst *BI);
 
   /// Remove a value from the cache, e.g. because it will be erased.
   void removeValue(Value *V) { AffectedValues.erase(V); }
diff --git a/llvm/include/llvm/Analysis/DominanceFrontier.h b/llvm/include/llvm/Analysis/DominanceFrontier.h
index 787793501f98a..e331220ff07ec 100644
--- a/llvm/include/llvm/Analysis/DominanceFrontier.h
+++ b/llvm/include/llvm/Analysis/DominanceFrontier.h
@@ -22,6 +22,7 @@
 #include "llvm/ADT/SetVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/GenericDomTree.h"
 #include <cassert>
 
@@ -129,11 +130,11 @@ class DominanceFrontier : public ForwardDominanceFrontierBase<BasicBlock> {
       DominanceFrontierBase<BasicBlock, false>::const_iterator;
 
   /// Handle invalidation explicitly.
-  bool invalidate(Function &F, const PreservedAnalyses &PA,
-                  FunctionAnalysisManager::Invalidator &);
+  LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA,
+                           FunctionAnalysisManager::Invalidator &);
 };
 
-class DominanceFrontierWrapperPass : public FunctionPass {
+class LLVM_ABI DominanceFrontierWrapperPass : public FunctionPass {
   DominanceFrontier DF;
 
 public:
@@ -171,7 +172,7 @@ class DominanceFrontierAnalysis
   using Result = DominanceFrontier;
 
   /// Run the analysis pass over a function and produce a dominator tree.
-  DominanceFrontier run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI DominanceFrontier run(Function &F, FunctionAnalysisManager &AM);
 };
 
 /// Printer pass for the \c DominanceFrontier.
@@ -180,9 +181,9 @@ class DominanceFrontierPrinterPass
   raw_ostream &OS;
 
 public:
-  explicit DominanceFrontierPrinterPass(raw_ostream &OS);
+  LLVM_ABI explicit DominanceFrontierPrinterPass(raw_ostream &OS);
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   static bool isRequired() { return true; }
 };
diff --git a/llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h b/llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h
index 1619671d8f7dc..6b553898ee1e8 100644
--- a/llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h
+++ b/llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h
@@ -187,7 +187,7 @@ class FunctionPropertiesPrinterPass
 /// Statistics pass for the FunctionPropertiesAnalysis results.
 struct FunctionPropertiesStatisticsPass
     : PassInfoMixin<FunctionPropertiesStatisticsPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 /// Correctly update FunctionPropertiesInfo post-inlining. A
diff --git a/llvm/include/llvm/Analysis/GuardUtils.h b/llvm/include/llvm/Analysis/GuardUtils.h
index 208f08b82d987..6b5abed4d6305 100644
--- a/llvm/include/llvm/Analysis/GuardUtils.h
+++ b/llvm/include/llvm/Analysis/GuardUtils.h
@@ -12,6 +12,8 @@
 #ifndef LLVM_ANALYSIS_GUARDUTILS_H
 #define LLVM_ANALYSIS_GUARDUTILS_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 
 class BasicBlock;
@@ -22,19 +24,19 @@ template <typename T> class SmallVectorImpl;
 
 /// Returns true iff \p U has semantics of a guard expressed in a form of call
 /// of llvm.experimental.guard intrinsic.
-bool isGuard(const User *U);
+LLVM_ABI bool isGuard(const User *U);
 
 /// Returns true iff \p V has semantics of llvm.experimental.widenable.condition
 /// call
-bool isWidenableCondition(const Value *V);
+LLVM_ABI bool isWidenableCondition(const Value *V);
 
 /// Returns true iff \p U is a widenable branch (that is,
 /// extractWidenableCondition returns widenable condition).
-bool isWidenableBranch(const User *U);
+LLVM_ABI bool isWidenableBranch(const User *U);
 
 /// Returns true iff \p U has semantics of a guard expressed in a form of a
 /// widenable conditional branch to deopt block.
-bool isGuardAsWidenableBranch(const User *U);
+LLVM_ABI bool isGuardAsWidenableBranch(const User *U);
 
 /// If U is widenable branch looking like:
 ///   %cond = ...
@@ -45,25 +47,28 @@ bool isGuardAsWidenableBranch(const User *U);
 /// %if_true_bb, if_false_bb are returned in
 /// the parameters (Condition, WidenableCondition, IfTrueBB and IfFalseFF)
 /// respectively. If \p U does not match this pattern, return false.
-bool parseWidenableBranch(const User *U, Value *&Condition,
-                          Value *&WidenableCondition, BasicBlock *&IfTrueBB,
-                          BasicBlock *&IfFalseBB);
+LLVM_ABI bool parseWidenableBranch(const User *U, Value *&Condition,
+                                   Value *&WidenableCondition,
+                                   BasicBlock *&IfTrueBB,
+                                   BasicBlock *&IfFalseBB);
 
 /// Analogous to the above, but return the Uses so that they can be
 /// modified. Unlike previous version, Condition is optional and may be null.
-bool parseWidenableBranch(User *U, Use *&Cond, Use *&WC, BasicBlock *&IfTrueBB,
-                          BasicBlock *&IfFalseBB);
+LLVM_ABI bool parseWidenableBranch(User *U, Use *&Cond, Use *&WC,
+                                   BasicBlock *&IfTrueBB,
+                                   BasicBlock *&IfFalseBB);
 
 // The guard condition is expected to be in form of:
 //   cond1 && cond2 && cond3 ...
 // or in case of widenable branch:
 //   cond1 && cond2 && cond3 && widenable_contidion ...
 // Method collects the list of checks, but skips widenable_condition.
-void parseWidenableGuard(const User *U, llvm::SmallVectorImpl<Value *> &Checks);
+LLVM_ABI void parseWidenableGuard(const User *U,
+                                  llvm::SmallVectorImpl<Value *> &Checks);
 
 // Returns widenable_condition if it exists in the expression tree rooting from
 // \p U and has only one use.
-Value *extractWidenableCondition(const User *U);
+LLVM_ABI Value *extractWidenableCondition(const User *U);
 } // llvm
 
 #endif // LLVM_ANALYSIS_GUARDUTILS_H
diff --git a/llvm/include/llvm/Analysis/HashRecognize.h b/llvm/include/llvm/Analysis/HashRecognize.h
index 6dea3d24885ff..8f37ca6ed7c85 100644
--- a/llvm/include/llvm/Analysis/HashRecognize.h
+++ b/llvm/include/llvm/Analysis/HashRecognize.h
@@ -20,6 +20,7 @@
 #include "llvm/Analysis/ScalarEvolution.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
 #include <variant>
 
 namespace llvm {
@@ -28,7 +29,7 @@ class LPMUpdater;
 
 /// A custom std::array with 256 entries, that also has a print function.
 struct CRCTable : public std::array<APInt, 256> {
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   LLVM_DUMP_METHOD void dump() const;
@@ -65,9 +66,9 @@ struct PolynomialInfo {
   // zero.
   Value *LHSAux;
 
-  PolynomialInfo(unsigned TripCount, Value *LHS, const APInt &RHS,
-                 Value *ComputedValue, bool ByteOrderSwapped,
-                 Value *LHSAux = nullptr);
+  LLVM_ABI PolynomialInfo(unsigned TripCount, Value *LHS, const APInt &RHS,
+                          Value *ComputedValue, bool ByteOrderSwapped,
+                          Value *LHSAux = nullptr);
 };
 
 /// The analysis.
@@ -76,17 +77,18 @@ class HashRecognize {
   ScalarEvolution &SE;
 
 public:
-  HashRecognize(const Loop &L, ScalarEvolution &SE);
+  LLVM_ABI HashRecognize(const Loop &L, ScalarEvolution &SE);
 
   // The main analysis entry points.
-  std::variant<PolynomialInfo, StringRef> recognizeCRC() const;
-  std::optional<PolynomialInfo> getResult() const;
+  LLVM_ABI std::variant<PolynomialInfo, StringRef> recognizeCRC() const;
+  LLVM_ABI std::optional<PolynomialInfo> getResult() const;
 
   // Auxilary entry point after analysis to interleave the generating polynomial
   // and return a 256-entry CRC table.
-  static CRCTable genSarwateTable(const APInt &GenPoly, bool ByteOrderSwapped);
+  LLVM_ABI static CRCTable genSarwateTable(const APInt &GenPoly,
+                                           bool ByteOrderSwapped);
 
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   LLVM_DUMP_METHOD void dump() const;
@@ -99,8 +101,8 @@ class HashRecognizePrinterPass
 
 public:
   explicit HashRecognizePrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR, LPMUpdater &);
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Analysis/IR2Vec.h b/llvm/include/llvm/Analysis/IR2Vec.h
index fdaed0f0901a9..d6edd043d655a 100644
--- a/llvm/include/llvm/Analysis/IR2Vec.h
+++ b/llvm/include/llvm/Analysis/IR2Vec.h
@@ -217,9 +217,9 @@ class VocabStorage {
   using VocabMap = std::map<std::string, Embedding>;
   /// Parse a vocabulary section from JSON and populate the target vocabulary
   /// map.
-  static Error parseVocabSection(StringRef Key,
-                                 const json::Value &ParsedVocabValue,
-                                 VocabMap &TargetVocab, unsigned &Dim);
+  LLVM_ABI static Error parseVocabSection(StringRef Key,
+                                          const json::Value &ParsedVocabValue,
+                                          VocabMap &TargetVocab, unsigned &Dim);
 };
 
 /// Class for storing and accessing the IR2Vec vocabulary.
@@ -319,7 +319,7 @@ class Vocabulary {
       NumICmpPredicates + NumFCmpPredicates;
 
   Vocabulary() = default;
-  LLVM_ABI Vocabulary(VocabStorage &&Storage) : Storage(std::move(Storage)) {}
+  Vocabulary(VocabStorage &&Storage) : Storage(std::move(Storage)) {}
 
   Vocabulary(const Vocabulary &) = delete;
   Vocabulary &operator=(const Vocabulary &) = delete;
@@ -337,11 +337,9 @@ class Vocabulary {
                                                 float TypeWeight = 0.5,
                                                 float ArgWeight = 0.2);
 
-  LLVM_ABI bool isValid() const {
-    return Storage.size() == NumCanonicalEntries;
-  }
+  bool isValid() const { return Storage.size() == NumCanonicalEntries; }
 
-  LLVM_ABI unsigned getDimension() const {
+  unsigned getDimension() const {
     assert(isValid() && "IR2Vec Vocabulary is invalid");
     return Storage.getDimension();
   }
@@ -354,12 +352,12 @@ class Vocabulary {
   LLVM_ABI static StringRef getVocabKeyForOpcode(unsigned Opcode);
 
   /// Function to get vocabulary key for a given TypeID
-  LLVM_ABI static StringRef getVocabKeyForTypeID(Type::TypeID TypeID) {
+  static StringRef getVocabKeyForTypeID(Type::TypeID TypeID) {
     return getVocabKeyForCanonicalTypeID(getCanonicalTypeID(TypeID));
   }
 
   /// Function to get vocabulary key for a given OperandKind
-  LLVM_ABI static StringRef getVocabKeyForOperandKind(OperandKind Kind) {
+  static StringRef getVocabKeyForOperandKind(OperandKind Kind) {
     unsigned Index = static_cast<unsigned>(Kind);
     assert(Index < MaxOperandKinds && "Invalid OperandKind");
     return OperandKindNames[Index];
@@ -372,45 +370,45 @@ class Vocabulary {
   LLVM_ABI static StringRef getVocabKeyForPredicate(CmpInst::Predicate P);
 
   /// Functions to return flat index
-  LLVM_ABI static unsigned getIndex(unsigned Opcode) {
+  static unsigned getIndex(unsigned Opcode) {
     assert(Opcode >= 1 && Opcode <= MaxOpcodes && "Invalid opcode");
     return Opcode - 1; // Convert to zero-based index
   }
 
-  LLVM_ABI static unsigned getIndex(Type::TypeID TypeID) {
+  static unsigned getIndex(Type::TypeID TypeID) {
     assert(static_cast<unsigned>(TypeID) < MaxTypeIDs && "Invalid type ID");
     return MaxOpcodes + static_cast<unsigned>(getCanonicalTypeID(TypeID));
   }
 
-  LLVM_ABI static unsigned getIndex(const Value &Op) {
+  static unsigned getIndex(const Value &Op) {
     unsigned Index = static_cast<unsigned>(getOperandKind(&Op));
     assert(Index < MaxOperandKinds && "Invalid OperandKind");
     return OperandBaseOffset + Index;
   }
 
-  LLVM_ABI static unsigned getIndex(CmpInst::Predicate P) {
+  static unsigned getIndex(CmpInst::Predicate P) {
     return PredicateBaseOffset + getPredicateLocalIndex(P);
   }
 
   /// Accessors to get the embedding for a given entity.
-  LLVM_ABI const ir2vec::Embedding &operator[](unsigned Opcode) const {
+  const ir2vec::Embedding &operator[](unsigned Opcode) const {
     assert(Opcode >= 1 && Opcode <= MaxOpcodes && "Invalid opcode");
     return Storage[static_cast<unsigned>(Section::Opcodes)][Opcode - 1];
   }
 
-  LLVM_ABI const ir2vec::Embedding &operator[](Type::TypeID TypeID) const {
+  const ir2vec::Embedding &operator[](Type::TypeID TypeID) const {
     assert(static_cast<unsigned>(TypeID) < MaxTypeIDs && "Invalid type ID");
     unsigned LocalIndex = static_cast<unsigned>(getCanonicalTypeID(TypeID));
     return Storage[static_cast<unsigned>(Section::CanonicalTypes)][LocalIndex];
   }
 
-  LLVM_ABI const ir2vec::Embedding &operator[](const Value &Arg) const {
+  const ir2vec::Embedding &operator[](const Value &Arg) const {
     unsigned LocalIndex = static_cast<unsigned>(getOperandKind(&Arg));
     assert(LocalIndex < MaxOperandKinds && "Invalid OperandKind");
     return Storage[static_cast<unsigned>(Section::Operands)][LocalIndex];
   }
 
-  LLVM_ABI const ir2vec::Embedding &operator[](CmpInst::Predicate P) const {
+  const ir2vec::Embedding &operator[](CmpInst::Predicate P) const {
     unsigned LocalIndex = getPredicateLocalIndex(P);
     return Storage[static_cast<unsigned>(Section::Predicates)][LocalIndex];
   }
@@ -454,8 +452,9 @@ class Vocabulary {
       OperandBaseOffset + MaxOperandKinds;
 
   /// Functions for predicate index calculations
-  static unsigned getPredicateLocalIndex(CmpInst::Predicate P);
-  static CmpInst::Predicate getPredicateFromLocalIndex(unsigned LocalIndex);
+  LLVM_ABI static unsigned getPredicateLocalIndex(CmpInst::Predicate P);
+  LLVM_ABI static CmpInst::Predicate
+  getPredicateFromLocalIndex(unsigned LocalIndex);
 
   /// String mappings for CanonicalTypeID values
   static constexpr StringLiteral CanonicalTypeNames[] = {
@@ -502,15 +501,14 @@ class Vocabulary {
                 "TypeIDMapping must cover all Type::TypeID values");
 
   /// Function to get vocabulary key for canonical type by enum
-  LLVM_ABI static StringRef
-  getVocabKeyForCanonicalTypeID(CanonicalTypeID CType) {
+  static StringRef getVocabKeyForCanonicalTypeID(CanonicalTypeID CType) {
     unsigned Index = static_cast<unsigned>(CType);
     assert(Index < MaxCanonicalTypeIDs && "Invalid CanonicalTypeID");
     return CanonicalTypeNames[Index];
   }
 
   /// Function to convert TypeID to CanonicalTypeID
-  LLVM_ABI static CanonicalTypeID getCanonicalTypeID(Type::TypeID TypeID) {
+  static CanonicalTypeID getCanonicalTypeID(Type::TypeID TypeID) {
     unsigned Index = static_cast<unsigned>(TypeID);
     assert(Index < MaxTypeIDs && "Invalid TypeID");
     return TypeIDMapping[Index];
@@ -550,16 +548,16 @@ class Embedder {
   /// in the IR instructions to generate the vector representation.
   const float OpcWeight, TypeWeight, ArgWeight;
 
-  LLVM_ABI Embedder(const Function &F, const Vocabulary &Vocab)
+  Embedder(const Function &F, const Vocabulary &Vocab)
       : F(F), Vocab(Vocab), Dimension(Vocab.getDimension()),
         OpcWeight(ir2vec::OpcWeight), TypeWeight(ir2vec::TypeWeight),
         ArgWeight(ir2vec::ArgWeight) {}
 
   /// Function to compute embeddings.
-  Embedding computeEmbeddings() const;
+  LLVM_ABI Embedding computeEmbeddings() const;
 
   /// Function to compute the embedding for a given basic block.
-  Embedding computeEmbeddings(const BasicBlock &BB) const;
+  LLVM_ABI Embedding computeEmbeddings(const BasicBlock &BB) const;
 
   /// Function to compute the embedding for a given instruction.
   /// Specific to the kind of embeddings being computed.
@@ -574,18 +572,18 @@ class Embedder {
 
   /// Computes and returns the embedding for a given instruction in the function
   /// F
-  LLVM_ABI Embedding getInstVector(const Instruction &I) const {
+  Embedding getInstVector(const Instruction &I) const {
     return computeEmbeddings(I);
   }
 
   /// Computes and returns the embedding for a given basic block in the function
   /// F
-  LLVM_ABI Embedding getBBVector(const BasicBlock &BB) const {
+  Embedding getBBVector(const BasicBlock &BB) const {
     return computeEmbeddings(BB);
   }
 
   /// Computes and returns the embedding for the current function.
-  LLVM_ABI Embedding getFunctionVector() const { return computeEmbeddings(); }
+  Embedding getFunctionVector() const { return computeEmbeddings(); }
 
   /// Invalidate embeddings if cached. The embeddings may not be relevant
   /// anymore when the IR changes due to transformations. In such cases, the
@@ -636,7 +634,7 @@ class IR2VecVocabAnalysis : public AnalysisInfoMixin<IR2VecVocabAnalysis> {
 public:
   LLVM_ABI static AnalysisKey Key;
   IR2VecVocabAnalysis() = default;
-  LLVM_ABI explicit IR2VecVocabAnalysis(ir2vec::VocabStorage &&Vocab)
+  explicit IR2VecVocabAnalysis(ir2vec::VocabStorage &&Vocab)
       : Vocab(std::move(Vocab)) {}
   using Result = ir2vec::Vocabulary;
   LLVM_ABI Result run(Module &M, ModuleAnalysisManager &MAM);
diff --git a/llvm/include/llvm/Analysis/IVUsers.h b/llvm/include/llvm/Analysis/IVUsers.h
index 2af3e389446c6..28125cfbaea70 100644
--- a/llvm/include/llvm/Analysis/IVUsers.h
+++ b/llvm/include/llvm/Analysis/IVUsers.h
@@ -19,6 +19,7 @@
 #include "llvm/Analysis/ScalarEvolutionNormalization.h"
 #include "llvm/IR/Instruction.h"
 #include "llvm/IR/ValueHandle.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -32,7 +33,8 @@ class IVUsers;
 /// The Expr member keeps track of the expression, User is the actual user
 /// instruction of the operand, and 'OperandValToReplace' is the operand of
 /// the User that is the use.
-class IVStrideUse final : public CallbackVH, public ilist_node<IVStrideUse> {
+class LLVM_ABI IVStrideUse final : public CallbackVH,
+                                   public ilist_node<IVStrideUse> {
   friend class IVUsers;
 public:
   IVStrideUse(IVUsers *P, Instruction* U, Value *O)
@@ -105,8 +107,8 @@ class IVUsers {
   SmallPtrSet<const Value *, 32> EphValues;
 
 public:
-  IVUsers(Loop *L, AssumptionCache *AC, LoopInfo *LI, DominatorTree *DT,
-          ScalarEvolution *SE);
+  LLVM_ABI IVUsers(Loop *L, AssumptionCache *AC, LoopInfo *LI,
+                   DominatorTree *DT, ScalarEvolution *SE);
 
   IVUsers(IVUsers &&X)
       : L(std::move(X.L)), AC(std::move(X.AC)), DT(std::move(X.DT)),
@@ -124,19 +126,19 @@ class IVUsers {
   /// AddUsersIfInteresting - Inspect the specified Instruction.  If it is a
   /// reducible SCEV, recursively add its users to the IVUsesByStride set and
   /// return true.  Otherwise, return false.
-  bool AddUsersIfInteresting(Instruction *I);
+  LLVM_ABI bool AddUsersIfInteresting(Instruction *I);
 
-  IVStrideUse &AddUser(Instruction *User, Value *Operand);
+  LLVM_ABI IVStrideUse &AddUser(Instruction *User, Value *Operand);
 
   /// getReplacementExpr - Return a SCEV expression which computes the
   /// value of the OperandValToReplace of the given IVStrideUse.
-  const SCEV *getReplacementExpr(const IVStrideUse &IU) const;
+  LLVM_ABI const SCEV *getReplacementExpr(const IVStrideUse &IU) const;
 
   /// getExpr - Return the expression for the use. Returns nullptr if the result
   /// is not invertible.
-  const SCEV *getExpr(const IVStrideUse &IU) const;
+  LLVM_ABI const SCEV *getExpr(const IVStrideUse &IU) const;
 
-  const SCEV *getStride(const IVStrideUse &IU, const Loop *L) const;
+  LLVM_ABI const SCEV *getStride(const IVStrideUse &IU, const Loop *L) const;
 
   typedef ilist<IVStrideUse>::iterator iterator;
   typedef ilist<IVStrideUse>::const_iterator const_iterator;
@@ -150,17 +152,17 @@ class IVUsers {
     return Processed.count(Inst);
   }
 
-  void releaseMemory();
+  LLVM_ABI void releaseMemory();
 
-  void print(raw_ostream &OS, const Module * = nullptr) const;
+  LLVM_ABI void print(raw_ostream &OS, const Module * = nullptr) const;
 
   /// dump - This method is used for debugging.
-  void dump() const;
+  LLVM_ABI void dump() const;
 };
 
-Pass *createIVUsersPass();
+LLVM_ABI Pass *createIVUsersPass();
 
-class IVUsersWrapperPass : public LoopPass {
+class LLVM_ABI IVUsersWrapperPass : public LoopPass {
   std::unique_ptr<IVUsers> IU;
 
 public:
@@ -188,8 +190,8 @@ class IVUsersAnalysis : public AnalysisInfoMixin<IVUsersAnalysis> {
 public:
   typedef IVUsers Result;
 
-  IVUsers run(Loop &L, LoopAnalysisManager &AM,
-              LoopStandardAnalysisResults &AR);
+  LLVM_ABI IVUsers run(Loop &L, LoopAnalysisManager &AM,
+                       LoopStandardAnalysisResults &AR);
 };
 
 }
diff --git a/llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h b/llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h
index 40c87b99af6a2..bb9172c1615e8 100644
--- a/llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h
+++ b/llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h
@@ -14,6 +14,7 @@
 #define LLVM_ANALYSIS_INDIRECTCALLPROMOTIONANALYSIS_H
 
 #include "llvm/ProfileData/InstrProf.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -57,9 +58,11 @@ class ICallPromotionAnalysis {
   ///
   /// The returned array space is owned by this class, and overwritten on
   /// subsequent calls.
-  MutableArrayRef<InstrProfValueData> getPromotionCandidatesForInstruction(
-      const Instruction *I, uint64_t &TotalCount, uint32_t &NumCandidates,
-      unsigned MaxNumValueData = 0);
+  LLVM_ABI MutableArrayRef<InstrProfValueData>
+  getPromotionCandidatesForInstruction(const Instruction *I,
+                                       uint64_t &TotalCount,
+                                       uint32_t &NumCandidates,
+                                       unsigned MaxNumValueData = 0);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Analysis/InstCount.h b/llvm/include/llvm/Analysis/InstCount.h
index e5ce822caf6ef..3daf0123546f1 100644
--- a/llvm/include/llvm/Analysis/InstCount.h
+++ b/llvm/include/llvm/Analysis/InstCount.h
@@ -14,13 +14,14 @@
 #define LLVM_ANALYSIS_INSTCOUNT_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class Function;
 
 struct InstCountPass : PassInfoMixin<InstCountPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Analysis/KernelInfo.h b/llvm/include/llvm/Analysis/KernelInfo.h
index 75d92c202212b..0078a5d789276 100644
--- a/llvm/include/llvm/Analysis/KernelInfo.h
+++ b/llvm/include/llvm/Analysis/KernelInfo.h
@@ -16,6 +16,7 @@
 #define LLVM_ANALYSIS_KERNELINFO_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,7 +28,7 @@ class KernelInfoPrinter : public PassInfoMixin<KernelInfoPrinter> {
 public:
   explicit KernelInfoPrinter(TargetMachine *TM) : TM(TM) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   static bool isRequired() { return true; }
 };
diff --git a/llvm/include/llvm/Analysis/LazyBlockFrequencyInfo.h b/llvm/include/llvm/Analysis/LazyBlockFrequencyInfo.h
index 0ce882fcd7a9d..d5d587a43bbd2 100644
--- a/llvm/include/llvm/Analysis/LazyBlockFrequencyInfo.h
+++ b/llvm/include/llvm/Analysis/LazyBlockFrequencyInfo.h
@@ -19,6 +19,7 @@
 #include "llvm/Analysis/BlockFrequencyInfo.h"
 #include "llvm/Analysis/LazyBranchProbabilityInfo.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Function;
@@ -94,7 +95,7 @@ class LazyBlockFrequencyInfo {
 /// Note that it is expected that we wouldn't need this functionality for the
 /// new PM since with the new PM, analyses are executed on demand.
 
-class LazyBlockFrequencyInfoPass : public FunctionPass {
+class LLVM_ABI LazyBlockFrequencyInfoPass : public FunctionPass {
 private:
   LazyBlockFrequencyInfo<Function, LazyBranchProbabilityInfoPass, LoopInfo,
                          BlockFrequencyInfo>
diff --git a/llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h b/llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h
index fe1f7b25c0f15..c150ab769e5d7 100644
--- a/llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h
+++ b/llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h
@@ -18,6 +18,7 @@
 
 #include "llvm/Analysis/BranchProbabilityInfo.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Function;
@@ -46,7 +47,7 @@ class TargetLibraryInfo;
 ///
 /// Note that it is expected that we wouldn't need this functionality for the
 /// new PM since with the new PM, analyses are executed on demand.
-class LazyBranchProbabilityInfoPass : public FunctionPass {
+class LLVM_ABI LazyBranchProbabilityInfoPass : public FunctionPass {
 
   /// Wraps a BPI to allow lazy computation of the branch probabilities.
   ///
@@ -105,7 +106,7 @@ class LazyBranchProbabilityInfoPass : public FunctionPass {
 };
 
 /// Helper for client passes to initialize dependent passes for LBPI.
-void initializeLazyBPIPassPass(PassRegistry &Registry);
+LLVM_ABI void initializeLazyBPIPassPass(PassRegistry &Registry);
 
 /// Simple trait class that provides a mapping between BPI passes and the
 /// corresponding BPInfo.
diff --git a/llvm/include/llvm/Analysis/LazyValueInfo.h b/llvm/include/llvm/Analysis/LazyValueInfo.h
index 52c7f68361a5b..2ea51f08591bc 100644
--- a/llvm/include/llvm/Analysis/LazyValueInfo.h
+++ b/llvm/include/llvm/Analysis/LazyValueInfo.h
@@ -17,6 +17,7 @@
 #include "llvm/IR/InstrTypes.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
   class AssumptionCache;
@@ -41,7 +42,7 @@ namespace llvm {
     LazyValueInfoImpl &getOrCreateImpl(const Module *M);
 
   public:
-    ~LazyValueInfo();
+    LLVM_ABI ~LazyValueInfo();
     LazyValueInfo() = default;
     LazyValueInfo(AssumptionCache *AC_, const DataLayout *DL_)
         : AC(AC_), DL(DL_) {}
@@ -63,83 +64,88 @@ namespace llvm {
     /// Determine whether the specified value comparison with a constant is
     /// known to be true or false on the specified CFG edge. Pred is a CmpInst
     /// predicate.
-    Constant *getPredicateOnEdge(CmpInst::Predicate Pred, Value *V, Constant *C,
-                                 BasicBlock *FromBB, BasicBlock *ToBB,
-                                 Instruction *CxtI = nullptr);
+    LLVM_ABI Constant *getPredicateOnEdge(CmpInst::Predicate Pred, Value *V,
+                                          Constant *C, BasicBlock *FromBB,
+                                          BasicBlock *ToBB,
+                                          Instruction *CxtI = nullptr);
 
     /// Determine whether the specified value comparison with a constant is
     /// known to be true or false at the specified instruction. \p Pred is a
     /// CmpInst predicate. If \p UseBlockValue is true, the block value is also
     /// taken into account.
-    Constant *getPredicateAt(CmpInst::Predicate Pred, Value *V, Constant *C,
-                             Instruction *CxtI, bool UseBlockValue);
+    LLVM_ABI Constant *getPredicateAt(CmpInst::Predicate Pred, Value *V,
+                                      Constant *C, Instruction *CxtI,
+                                      bool UseBlockValue);
 
     /// Determine whether the specified value comparison is known to be true
     /// or false at the specified instruction. While this takes two Value's,
     /// it still requires that one of them is a constant.
     /// \p Pred is a CmpInst predicate.
     /// If \p UseBlockValue is true, the block value is also taken into account.
-    Constant *getPredicateAt(CmpInst::Predicate Pred, Value *LHS, Value *RHS,
-                             Instruction *CxtI, bool UseBlockValue);
+    LLVM_ABI Constant *getPredicateAt(CmpInst::Predicate Pred, Value *LHS,
+                                      Value *RHS, Instruction *CxtI,
+                                      bool UseBlockValue);
 
     /// Determine whether the specified value is known to be a constant at the
     /// specified instruction. Return null if not.
-    Constant *getConstant(Value *V, Instruction *CxtI);
+    LLVM_ABI Constant *getConstant(Value *V, Instruction *CxtI);
 
     /// Return the ConstantRange constraint that is known to hold for the
     /// specified value at the specified instruction. This may only be called
     /// on integer-typed Values.
-    ConstantRange getConstantRange(Value *V, Instruction *CxtI,
-                                   bool UndefAllowed);
+    LLVM_ABI ConstantRange getConstantRange(Value *V, Instruction *CxtI,
+                                            bool UndefAllowed);
 
     /// Return the ConstantRange constraint that is known to hold for the value
     /// at a specific use-site.
-    ConstantRange getConstantRangeAtUse(const Use &U, bool UndefAllowed);
+    LLVM_ABI ConstantRange getConstantRangeAtUse(const Use &U,
+                                                 bool UndefAllowed);
 
     /// Determine whether the specified value is known to be a
     /// constant on the specified edge.  Return null if not.
-    Constant *getConstantOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB,
-                                Instruction *CxtI = nullptr);
+    LLVM_ABI Constant *getConstantOnEdge(Value *V, BasicBlock *FromBB,
+                                         BasicBlock *ToBB,
+                                         Instruction *CxtI = nullptr);
 
     /// Return the ConstantRage constraint that is known to hold for the
     /// specified value on the specified edge. This may be only be called
     /// on integer-typed Values.
-    ConstantRange getConstantRangeOnEdge(Value *V, BasicBlock *FromBB,
-                                         BasicBlock *ToBB,
-                                         Instruction *CxtI = nullptr);
+    LLVM_ABI ConstantRange getConstantRangeOnEdge(Value *V, BasicBlock *FromBB,
+                                                  BasicBlock *ToBB,
+                                                  Instruction *CxtI = nullptr);
 
     /// Inform the analysis cache that we have threaded an edge from
     /// PredBB to OldSucc to be from PredBB to NewSucc instead.
-    void threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc,
-                    BasicBlock *NewSucc);
+    LLVM_ABI void threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc,
+                             BasicBlock *NewSucc);
 
     /// Remove information related to this value from the cache.
-    void forgetValue(Value *V);
+    LLVM_ABI void forgetValue(Value *V);
 
     /// Inform the analysis cache that we have erased a block.
-    void eraseBlock(BasicBlock *BB);
+    LLVM_ABI void eraseBlock(BasicBlock *BB);
 
     /// Complete flush all previously computed values
-    void clear();
+    LLVM_ABI void clear();
 
     /// Print the \LazyValueInfo Analysis.
     /// We pass in the DTree that is required for identifying which basic blocks
     /// we can solve/print for, in the LVIPrinter.
-    void printLVI(Function &F, DominatorTree &DTree, raw_ostream &OS);
+    LLVM_ABI void printLVI(Function &F, DominatorTree &DTree, raw_ostream &OS);
 
     // For old PM pass. Delete once LazyValueInfoWrapperPass is gone.
-    void releaseMemory();
+    LLVM_ABI void releaseMemory();
 
     /// Handle invalidation events in the new pass manager.
-    bool invalidate(Function &F, const PreservedAnalyses &PA,
-                    FunctionAnalysisManager::Invalidator &Inv);
+    LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA,
+                             FunctionAnalysisManager::Invalidator &Inv);
   };
 
 /// Analysis to compute lazy value information.
 class LazyValueAnalysis : public AnalysisInfoMixin<LazyValueAnalysis> {
 public:
   typedef LazyValueInfo Result;
-  Result run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI Result run(Function &F, FunctionAnalysisManager &FAM);
 
 private:
   static AnalysisKey Key;
@@ -154,13 +160,13 @@ class LazyValueInfoPrinterPass
 public:
   explicit LazyValueInfoPrinterPass(raw_ostream &OS) : OS(OS) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   static bool isRequired() { return true; }
 };
 
 /// Wrapper around LazyValueInfo.
-class LazyValueInfoWrapperPass : public FunctionPass {
+class LLVM_ABI LazyValueInfoWrapperPass : public FunctionPass {
   LazyValueInfoWrapperPass(const LazyValueInfoWrapperPass&) = delete;
   void operator=(const LazyValueInfoWrapperPass&) = delete;
 public:
diff --git a/llvm/include/llvm/Analysis/Lint.h b/llvm/include/llvm/Analysis/Lint.h
index b0bc0ff4e1d89..73297c867f0de 100644
--- a/llvm/include/llvm/Analysis/Lint.h
+++ b/llvm/include/llvm/Analysis/Lint.h
@@ -19,6 +19,7 @@
 #define LLVM_ANALYSIS_LINT_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -29,20 +30,21 @@ class Function;
 ///
 /// This should only be used for debugging, because it plays games with
 /// PassManagers and stuff.
-void lintModule(const Module &M, bool AbortOnError = false);
+LLVM_ABI void lintModule(const Module &M, bool AbortOnError = false);
 
 // Lint a function.
-void lintFunction(const Function &F, bool AbortOnError = false);
+LLVM_ABI void lintFunction(const Function &F, bool AbortOnError = false);
 
 class LintPass : public PassInfoMixin<LintPass> {
   const bool AbortOnError;
 
 public:
   LintPass(bool AbortOnError) : AbortOnError(AbortOnError) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Analysis/LoopCacheAnalysis.h b/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
index 70ccd8aaed20f..53cc44c1d9f3b 100644
--- a/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
@@ -16,6 +16,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/InstructionCost.h"
 #include <optional>
 
@@ -51,8 +52,8 @@ class IndexedReference {
 
 public:
   /// Construct an indexed reference given a \p StoreOrLoadInst instruction.
-  IndexedReference(Instruction &StoreOrLoadInst, const LoopInfo &LI,
-                   ScalarEvolution &SE);
+  LLVM_ABI IndexedReference(Instruction &StoreOrLoadInst, const LoopInfo &LI,
+                            ScalarEvolution &SE);
 
   bool isValid() const { return IsValid; }
   const SCEV *getBasePointer() const { return BasePointer; }
@@ -74,16 +75,17 @@ class IndexedReference {
   /// are/aren't in the same cache line of size \p CLS. Two references are in
   /// the same chace line iff the distance between them in the innermost
   /// dimension is less than the cache line size. Return std::nullopt if unsure.
-  std::optional<bool> hasSpacialReuse(const IndexedReference &Other,
-                                      unsigned CLS, AAResults &AA) const;
+  LLVM_ABI std::optional<bool> hasSpacialReuse(const IndexedReference &Other,
+                                               unsigned CLS,
+                                               AAResults &AA) const;
 
   /// Return true if the current object and the indexed reference \p Other
   /// have distance smaller than \p MaxDistance in the dimension associated with
   /// the given loop \p L. Return false if the distance is not smaller than \p
   /// MaxDistance and std::nullopt if unsure.
-  std::optional<bool> hasTemporalReuse(const IndexedReference &Other,
-                                       unsigned MaxDistance, const Loop &L,
-                                       DependenceInfo &DI, AAResults &AA) const;
+  LLVM_ABI std::optional<bool>
+  hasTemporalReuse(const IndexedReference &Other, unsigned MaxDistance,
+                   const Loop &L, DependenceInfo &DI, AAResults &AA) const;
 
   /// Compute the cost of the reference w.r.t. the given loop \p L when it is
   /// considered in the innermost position in the loop nest.
@@ -94,7 +96,7 @@ class IndexedReference {
   ///     + the coefficient of this loop's index variable used in all other
   ///       subscripts is zero
   ///   - or otherwise equal to 'TripCount'.
-  CacheCostTy computeRefCost(const Loop &L, unsigned CLS) const;
+  LLVM_ABI CacheCostTy computeRefCost(const Loop &L, unsigned CLS) const;
 
 private:
   /// Attempt to delinearize the indexed reference.
@@ -198,15 +200,16 @@ class CacheCost {
   /// The optional parameter \p TRT can be used to specify the max. distance
   /// between array elements accessed in a loop so that the elements are
   /// classified to have temporal reuse.
-  CacheCost(const LoopVectorTy &Loops, const LoopInfo &LI, ScalarEvolution &SE,
-            TargetTransformInfo &TTI, AAResults &AA, DependenceInfo &DI,
-            std::optional<unsigned> TRT = std::nullopt);
+  LLVM_ABI CacheCost(const LoopVectorTy &Loops, const LoopInfo &LI,
+                     ScalarEvolution &SE, TargetTransformInfo &TTI,
+                     AAResults &AA, DependenceInfo &DI,
+                     std::optional<unsigned> TRT = std::nullopt);
 
   /// Create a CacheCost for the loop nest rooted by \p Root.
   /// The optional parameter \p TRT can be used to specify the max. distance
   /// between array elements accessed in a loop so that the elements are
   /// classified to have temporal reuse.
-  static std::unique_ptr<CacheCost>
+  LLVM_ABI static std::unique_ptr<CacheCost>
   getCacheCost(Loop &Root, LoopStandardAnalysisResults &AR, DependenceInfo &DI,
                std::optional<unsigned> TRT = std::nullopt);
 
@@ -279,8 +282,8 @@ class CacheCost {
   DependenceInfo &DI;
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const IndexedReference &R);
-raw_ostream &operator<<(raw_ostream &OS, const CacheCost &CC);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const IndexedReference &R);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const CacheCost &CC);
 
 /// Printer pass for the \c CacheCost results.
 class LoopCachePrinterPass : public PassInfoMixin<LoopCachePrinterPass> {
@@ -289,8 +292,9 @@ class LoopCachePrinterPass : public PassInfoMixin<LoopCachePrinterPass> {
 public:
   explicit LoopCachePrinterPass(raw_ostream &OS) : OS(OS) {}
 
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 
   static bool isRequired() { return true; }
 };
diff --git a/llvm/include/llvm/Analysis/LoopIterator.h b/llvm/include/llvm/Analysis/LoopIterator.h
index 1ac8e68bfa2f1..f7e2af67c2b17 100644
--- a/llvm/include/llvm/Analysis/LoopIterator.h
+++ b/llvm/include/llvm/Analysis/LoopIterator.h
@@ -25,6 +25,7 @@
 
 #include "llvm/ADT/PostOrderIterator.h"
 #include "llvm/Analysis/LoopInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -120,7 +121,7 @@ class LoopBlocksDFS {
   Loop *getLoop() const { return L; }
 
   /// Traverse the loop blocks and store the DFS result.
-  void perform(const LoopInfo *LI);
+  LLVM_ABI void perform(const LoopInfo *LI);
 
   /// Return true if postorder numbers are assigned to all loop blocks.
   bool isComplete() const { return PostBlocks.size() == L->getNumBlocks(); }
diff --git a/llvm/include/llvm/Analysis/MLInlineAdvisor.h b/llvm/include/llvm/Analysis/MLInlineAdvisor.h
index d71fa55487e69..5b7d532842654 100644
--- a/llvm/include/llvm/Analysis/MLInlineAdvisor.h
+++ b/llvm/include/llvm/Analysis/MLInlineAdvisor.h
@@ -14,6 +14,7 @@
 #include "llvm/Analysis/LazyCallGraph.h"
 #include "llvm/Analysis/MLModelRunner.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 #include <map>
 #include <memory>
@@ -25,7 +26,7 @@ class Module;
 class MLInlineAdvice;
 class ProfileSummaryInfo;
 
-class MLInlineAdvisor : public InlineAdvisor {
+class LLVM_ABI MLInlineAdvisor : public InlineAdvisor {
 public:
   MLInlineAdvisor(Module &M, ModuleAnalysisManager &MAM,
                   std::function<std::unique_ptr<MLModelRunner>(
@@ -101,7 +102,7 @@ class MLInlineAdvisor : public InlineAdvisor {
 
 /// InlineAdvice that tracks changes post inlining. For that reason, it only
 /// overrides the "successful inlining" extension points.
-class MLInlineAdvice : public InlineAdvice {
+class LLVM_ABI MLInlineAdvice : public InlineAdvice {
 public:
   MLInlineAdvice(MLInlineAdvisor *Advisor, CallBase &CB,
                  OptimizationRemarkEmitter &ORE, bool Recommendation);
diff --git a/llvm/include/llvm/Analysis/MemDerefPrinter.h b/llvm/include/llvm/Analysis/MemDerefPrinter.h
index ba376dadb2a75..5b152613e094e 100644
--- a/llvm/include/llvm/Analysis/MemDerefPrinter.h
+++ b/llvm/include/llvm/Analysis/MemDerefPrinter.h
@@ -10,6 +10,7 @@
 #define LLVM_ANALYSIS_MEMDEREFPRINTER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class MemDerefPrinterPass : public PassInfoMixin<MemDerefPrinterPass> {
@@ -17,7 +18,7 @@ class MemDerefPrinterPass : public PassInfoMixin<MemDerefPrinterPass> {
 
 public:
   MemDerefPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 } // namespace llvm
diff --git a/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h b/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
index d6288f2aa061e..1f21f7a370791 100644
--- a/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
+++ b/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
@@ -24,6 +24,7 @@
 #include "llvm/IR/PredIteratorCache.h"
 #include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
@@ -371,19 +372,19 @@ class MemoryDependenceResults {
         DefaultBlockScanLimit(DefaultBlockScanLimit) {}
 
   /// Handle invalidation in the new PM.
-  bool invalidate(Function &F, const PreservedAnalyses &PA,
-                  FunctionAnalysisManager::Invalidator &Inv);
+  LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA,
+                           FunctionAnalysisManager::Invalidator &Inv);
 
   /// Some methods limit the number of instructions they will examine.
   /// The return value of this method is the default limit that will be
   /// used if no limit is explicitly passed in.
-  unsigned getDefaultBlockScanLimit() const;
+  LLVM_ABI unsigned getDefaultBlockScanLimit() const;
 
   /// Returns the instruction on which a memory operation depends.
   ///
   /// See the class comment for more details. It is illegal to call this on
   /// non-memory instructions.
-  MemDepResult getDependency(Instruction *QueryInst);
+  LLVM_ABI MemDepResult getDependency(Instruction *QueryInst);
 
   /// Perform a full dependency query for the specified call, returning the set
   /// of blocks that the value is potentially live across.
@@ -398,7 +399,8 @@ class MemoryDependenceResults {
   /// invalidated on the next non-local query or when an instruction is
   /// removed.  Clients must copy this data if they want it around longer than
   /// that.
-  const NonLocalDepInfo &getNonLocalCallDependency(CallBase *QueryCall);
+  LLVM_ABI const NonLocalDepInfo &
+  getNonLocalCallDependency(CallBase *QueryCall);
 
   /// Perform a full dependency query for an access to the QueryInst's
   /// specified memory location, returning the set of instructions that either
@@ -410,12 +412,13 @@ class MemoryDependenceResults {
   ///
   /// This method assumes the pointer has a "NonLocal" dependency within
   /// QueryInst's parent basic block.
-  void getNonLocalPointerDependency(Instruction *QueryInst,
-                                    SmallVectorImpl<NonLocalDepResult> &Result);
+  LLVM_ABI void
+  getNonLocalPointerDependency(Instruction *QueryInst,
+                               SmallVectorImpl<NonLocalDepResult> &Result);
 
   /// Removes an instruction from the dependence analysis, updating the
   /// dependence of instructions that previously depended on it.
-  void removeInstruction(Instruction *InstToRemove);
+  LLVM_ABI void removeInstruction(Instruction *InstToRemove);
 
   /// Invalidates cached information about the specified pointer, because it
   /// may be too conservative in memdep.
@@ -424,13 +427,13 @@ class MemoryDependenceResults {
   /// equivalence between the pointer and some other value and replaces the
   /// other value with ptr. This can make Ptr available in more places that
   /// cached info does not necessarily keep.
-  void invalidateCachedPointerInfo(Value *Ptr);
+  LLVM_ABI void invalidateCachedPointerInfo(Value *Ptr);
 
   /// Clears the PredIteratorCache info.
   ///
   /// This needs to be done when the CFG changes, e.g., due to splitting
   /// critical edges.
-  void invalidateCachedPredecessors();
+  LLVM_ABI void invalidateCachedPredecessors();
 
   /// Returns the instruction on which a memory location depends.
   ///
@@ -445,24 +448,20 @@ class MemoryDependenceResults {
   /// in, the limit will default to the value of -memdep-block-scan-limit.
   ///
   /// Note that this is an uncached query, and thus may be inefficient.
-  MemDepResult getPointerDependencyFrom(const MemoryLocation &Loc, bool isLoad,
-                                        BasicBlock::iterator ScanIt,
-                                        BasicBlock *BB,
-                                        Instruction *QueryInst = nullptr,
-                                        unsigned *Limit = nullptr);
-
-  MemDepResult getPointerDependencyFrom(const MemoryLocation &Loc, bool isLoad,
-                                        BasicBlock::iterator ScanIt,
-                                        BasicBlock *BB,
-                                        Instruction *QueryInst,
-                                        unsigned *Limit,
-                                        BatchAAResults &BatchAA);
-
-  MemDepResult
-  getSimplePointerDependencyFrom(const MemoryLocation &MemLoc, bool isLoad,
-                                 BasicBlock::iterator ScanIt, BasicBlock *BB,
-                                 Instruction *QueryInst, unsigned *Limit,
-                                 BatchAAResults &BatchAA);
+  LLVM_ABI MemDepResult getPointerDependencyFrom(
+      const MemoryLocation &Loc, bool isLoad, BasicBlock::iterator ScanIt,
+      BasicBlock *BB, Instruction *QueryInst = nullptr,
+      unsigned *Limit = nullptr);
+
+  LLVM_ABI MemDepResult getPointerDependencyFrom(
+      const MemoryLocation &Loc, bool isLoad, BasicBlock::iterator ScanIt,
+      BasicBlock *BB, Instruction *QueryInst, unsigned *Limit,
+      BatchAAResults &BatchAA);
+
+  LLVM_ABI MemDepResult getSimplePointerDependencyFrom(
+      const MemoryLocation &MemLoc, bool isLoad, BasicBlock::iterator ScanIt,
+      BasicBlock *BB, Instruction *QueryInst, unsigned *Limit,
+      BatchAAResults &BatchAA);
 
   /// This analysis looks for other loads and stores with invariant.group
   /// metadata and the same pointer operand. Returns Unknown if it does not
@@ -470,10 +469,11 @@ class MemoryDependenceResults {
   /// store the same value and NonLocal which indicate that non-local Def was
   /// found, which can be retrieved by calling getNonLocalPointerDependency
   /// with the same queried instruction.
-  MemDepResult getInvariantGroupPointerDependency(LoadInst *LI, BasicBlock *BB);
+  LLVM_ABI MemDepResult getInvariantGroupPointerDependency(LoadInst *LI,
+                                                           BasicBlock *BB);
 
   /// Release memory in caches.
-  void releaseMemory();
+  LLVM_ABI void releaseMemory();
 
   /// Return the clobber offset to dependent instruction.
   std::optional<int32_t> getClobberOffset(LoadInst *DepInst) const {
@@ -521,15 +521,16 @@ class MemoryDependenceAnalysis
 public:
   using Result = MemoryDependenceResults;
 
-  MemoryDependenceAnalysis();
+  LLVM_ABI MemoryDependenceAnalysis();
   MemoryDependenceAnalysis(unsigned DefaultBlockScanLimit) : DefaultBlockScanLimit(DefaultBlockScanLimit) { }
 
-  MemoryDependenceResults run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI MemoryDependenceResults run(Function &F,
+                                       FunctionAnalysisManager &AM);
 };
 
 /// A wrapper analysis pass for the legacy pass manager that exposes a \c
 /// MemoryDepnedenceResults instance.
-class MemoryDependenceWrapperPass : public FunctionPass {
+class LLVM_ABI MemoryDependenceWrapperPass : public FunctionPass {
   std::optional<MemoryDependenceResults> MemDep;
 
 public:
diff --git a/llvm/include/llvm/Analysis/ModuleDebugInfoPrinter.h b/llvm/include/llvm/Analysis/ModuleDebugInfoPrinter.h
index e69db780a2061..d2d6b31ddd3d0 100644
--- a/llvm/include/llvm/Analysis/ModuleDebugInfoPrinter.h
+++ b/llvm/include/llvm/Analysis/ModuleDebugInfoPrinter.h
@@ -11,6 +11,7 @@
 
 #include "llvm/IR/DebugInfo.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class raw_ostream;
@@ -21,8 +22,8 @@ class ModuleDebugInfoPrinterPass
   raw_ostream &OS;
 
 public:
-  explicit ModuleDebugInfoPrinterPass(raw_ostream &OS);
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI explicit ModuleDebugInfoPrinterPass(raw_ostream &OS);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 } // end namespace llvm
diff --git a/llvm/include/llvm/Analysis/ObjCARCAliasAnalysis.h b/llvm/include/llvm/Analysis/ObjCARCAliasAnalysis.h
index 8195fb93938b0..6ab9bd7d0ebb0 100644
--- a/llvm/include/llvm/Analysis/ObjCARCAliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/ObjCARCAliasAnalysis.h
@@ -23,6 +23,7 @@
 #define LLVM_ANALYSIS_OBJCARCALIASANALYSIS_H
 
 #include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace objcarc {
@@ -49,17 +50,19 @@ class ObjCARCAAResult : public AAResultBase {
     return false;
   }
 
-  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
-                    AAQueryInfo &AAQI, const Instruction *CtxI);
-  ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, AAQueryInfo &AAQI,
-                               bool IgnoreLocals);
+  LLVM_ABI AliasResult alias(const MemoryLocation &LocA,
+                             const MemoryLocation &LocB, AAQueryInfo &AAQI,
+                             const Instruction *CtxI);
+  LLVM_ABI ModRefInfo getModRefInfoMask(const MemoryLocation &Loc,
+                                        AAQueryInfo &AAQI, bool IgnoreLocals);
 
   using AAResultBase::getMemoryEffects;
-  MemoryEffects getMemoryEffects(const Function *F);
+  LLVM_ABI MemoryEffects getMemoryEffects(const Function *F);
 
   using AAResultBase::getModRefInfo;
-  ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc,
-                           AAQueryInfo &AAQI);
+  LLVM_ABI ModRefInfo getModRefInfo(const CallBase *Call,
+                                    const MemoryLocation &Loc,
+                                    AAQueryInfo &AAQI);
 };
 
 /// Analysis pass providing a never-invalidated alias analysis result.
@@ -70,7 +73,7 @@ class ObjCARCAA : public AnalysisInfoMixin<ObjCARCAA> {
 public:
   typedef ObjCARCAAResult Result;
 
-  ObjCARCAAResult run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI ObjCARCAAResult run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // namespace objcarc
diff --git a/llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h b/llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h
index 0026239b96518..ec25403c2074e 100644
--- a/llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h
+++ b/llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h
@@ -27,6 +27,7 @@
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/ValueHandle.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
@@ -36,7 +37,7 @@ class AAResults;
 namespace objcarc {
 
 /// A handy option to enable/disable all ARC Optimizations.
-extern bool EnableARCOpts;
+extern LLVM_ABI bool EnableARCOpts;
 
 /// Test if the given module looks interesting to run ARC optimization
 /// on.
@@ -174,7 +175,7 @@ inline bool IsPotentialRetainableObjPtr(const Value *Op) {
   return true;
 }
 
-bool IsPotentialRetainableObjPtr(const Value *Op, AAResults &AA);
+LLVM_ABI bool IsPotentialRetainableObjPtr(const Value *Op, AAResults &AA);
 
 /// Helper for GetARCInstKind. Determines what kind of construct CS
 /// is.
diff --git a/llvm/include/llvm/Analysis/ObjCARCInstKind.h b/llvm/include/llvm/Analysis/ObjCARCInstKind.h
index e332bcf88be79..872b2ed9d5ed0 100644
--- a/llvm/include/llvm/Analysis/ObjCARCInstKind.h
+++ b/llvm/include/llvm/Analysis/ObjCARCInstKind.h
@@ -10,6 +10,7 @@
 #define LLVM_ANALYSIS_OBJCARCINSTKIND_H
 
 #include "llvm/IR/Instructions.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace objcarc {
@@ -53,48 +54,48 @@ enum class ARCInstKind {
   None                      ///< anything that is inert from an ARC perspective.
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const ARCInstKind Class);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const ARCInstKind Class);
 
 /// Test if the given class is a kind of user.
-bool IsUser(ARCInstKind Class);
+LLVM_ABI bool IsUser(ARCInstKind Class);
 
 /// Test if the given class is objc_retain or equivalent.
-bool IsRetain(ARCInstKind Class);
+LLVM_ABI bool IsRetain(ARCInstKind Class);
 
 /// Test if the given class is objc_autorelease or equivalent.
-bool IsAutorelease(ARCInstKind Class);
+LLVM_ABI bool IsAutorelease(ARCInstKind Class);
 
 /// Test if the given class represents instructions which return their
 /// argument verbatim.
-bool IsForwarding(ARCInstKind Class);
+LLVM_ABI bool IsForwarding(ARCInstKind Class);
 
 /// Test if the given class represents instructions which do nothing if
 /// passed a null pointer.
-bool IsNoopOnNull(ARCInstKind Class);
+LLVM_ABI bool IsNoopOnNull(ARCInstKind Class);
 
 /// Test if the given class represents instructions which do nothing if
 /// passed a global variable.
-bool IsNoopOnGlobal(ARCInstKind Class);
+LLVM_ABI bool IsNoopOnGlobal(ARCInstKind Class);
 
 /// Test if the given class represents instructions which are always safe
 /// to mark with the "tail" keyword.
-bool IsAlwaysTail(ARCInstKind Class);
+LLVM_ABI bool IsAlwaysTail(ARCInstKind Class);
 
 /// Test if the given class represents instructions which are never safe
 /// to mark with the "tail" keyword.
-bool IsNeverTail(ARCInstKind Class);
+LLVM_ABI bool IsNeverTail(ARCInstKind Class);
 
 /// Test if the given class represents instructions which are always safe
 /// to mark with the nounwind attribute.
-bool IsNoThrow(ARCInstKind Class);
+LLVM_ABI bool IsNoThrow(ARCInstKind Class);
 
 /// Test whether the given instruction can autorelease any pointer or cause an
 /// autoreleasepool pop.
-bool CanInterruptRV(ARCInstKind Class);
+LLVM_ABI bool CanInterruptRV(ARCInstKind Class);
 
 /// Determine if F is one of the special known Functions.  If it isn't,
 /// return ARCInstKind::CallOrUser.
-ARCInstKind GetFunctionClass(const Function *F);
+LLVM_ABI ARCInstKind GetFunctionClass(const Function *F);
 
 /// Determine which objc runtime call instruction class V belongs to.
 ///
@@ -114,11 +115,11 @@ inline ARCInstKind GetBasicARCInstKind(const Value *V) {
 }
 
 /// Map V to its ARCInstKind equivalence class.
-ARCInstKind GetARCInstKind(const Value *V);
+LLVM_ABI ARCInstKind GetARCInstKind(const Value *V);
 
 /// Returns false if conservatively we can prove that any instruction mapped to
 /// this kind can not decrement ref counts. Returns true otherwise.
-bool CanDecrementRefCount(ARCInstKind Kind);
+LLVM_ABI bool CanDecrementRefCount(ARCInstKind Kind);
 
 } // end namespace objcarc
 } // end namespace llvm
diff --git a/llvm/include/llvm/Analysis/OverflowInstAnalysis.h b/llvm/include/llvm/Analysis/OverflowInstAnalysis.h
index 761d20f17a8b8..61ec3ee448c5a 100644
--- a/llvm/include/llvm/Analysis/OverflowInstAnalysis.h
+++ b/llvm/include/llvm/Analysis/OverflowInstAnalysis.h
@@ -14,6 +14,8 @@
 #ifndef LLVM_ANALYSIS_OVERFLOWINSTANALYSIS_H
 #define LLVM_ANALYSIS_OVERFLOWINSTANALYSIS_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 class Use;
 class Value;
@@ -35,9 +37,10 @@ class Value;
 /// If Op0 and Op1 match one of the patterns above, return true and fill Y's
 /// use.
 
-bool isCheckForZeroAndMulWithOverflow(Value *Op0, Value *Op1, bool IsAnd,
-                                      Use *&Y);
-bool isCheckForZeroAndMulWithOverflow(Value *Op0, Value *Op1, bool IsAnd);
+LLVM_ABI bool isCheckForZeroAndMulWithOverflow(Value *Op0, Value *Op1,
+                                               bool IsAnd, Use *&Y);
+LLVM_ABI bool isCheckForZeroAndMulWithOverflow(Value *Op0, Value *Op1,
+                                               bool IsAnd);
 } // end namespace llvm
 
 #endif
diff --git a/llvm/include/llvm/Analysis/PtrUseVisitor.h b/llvm/include/llvm/Analysis/PtrUseVisitor.h
index 0858d8aee2186..f2503f39717db 100644
--- a/llvm/include/llvm/Analysis/PtrUseVisitor.h
+++ b/llvm/include/llvm/Analysis/PtrUseVisitor.h
@@ -29,6 +29,7 @@
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/InstVisitor.h"
 #include "llvm/IR/IntrinsicInst.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <type_traits>
 
@@ -168,13 +169,13 @@ class PtrUseVisitorBase {
   ///
   /// This will visit the users with the same offset of the current visit
   /// (including an unknown offset if that is the current state).
-  void enqueueUsers(Value &I);
+  LLVM_ABI void enqueueUsers(Value &I);
 
   /// Walk the operands of a GEP and adjust the offset as appropriate.
   ///
   /// This routine does the heavy lifting of the pointer walk by computing
   /// offsets and looking through GEPs.
-  bool adjustOffsetForGEP(GetElementPtrInst &GEPI);
+  LLVM_ABI bool adjustOffsetForGEP(GetElementPtrInst &GEPI);
 };
 
 } // end namespace detail
diff --git a/llvm/include/llvm/Analysis/RegionInfo.h b/llvm/include/llvm/Analysis/RegionInfo.h
index 474bd3a9483e7..23e5037f8be81 100644
--- a/llvm/include/llvm/Analysis/RegionInfo.h
+++ b/llvm/include/llvm/Analysis/RegionInfo.h
@@ -44,6 +44,7 @@
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 #include <algorithm>
 #include <cassert>
 #include <map>
@@ -886,16 +887,16 @@ class RegionNode : public RegionNodeBase<RegionTraits<Function>> {
 
 class Region : public RegionBase<RegionTraits<Function>> {
 public:
-  Region(BasicBlock *Entry, BasicBlock *Exit, RegionInfo *RI, DominatorTree *DT,
-         Region *Parent = nullptr);
-  ~Region();
+  LLVM_ABI Region(BasicBlock *Entry, BasicBlock *Exit, RegionInfo *RI,
+                  DominatorTree *DT, Region *Parent = nullptr);
+  LLVM_ABI ~Region();
 
   bool operator==(const RegionNode &RN) const {
     return &RN == reinterpret_cast<const RegionNode *>(this);
   }
 };
 
-class RegionInfo : public RegionInfoBase<RegionTraits<Function>> {
+class LLVM_ABI RegionInfo : public RegionInfoBase<RegionTraits<Function>> {
 public:
   using Base = RegionInfoBase<RegionTraits<Function>>;
 
@@ -937,7 +938,7 @@ class RegionInfo : public RegionInfoBase<RegionTraits<Function>> {
 #endif
 };
 
-class RegionInfoPass : public FunctionPass {
+class LLVM_ABI RegionInfoPass : public FunctionPass {
   RegionInfo RI;
 
 public:
@@ -970,7 +971,7 @@ class RegionInfoAnalysis : public AnalysisInfoMixin<RegionInfoAnalysis> {
 public:
   using Result = RegionInfo;
 
-  RegionInfo run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI RegionInfo run(Function &F, FunctionAnalysisManager &AM);
 };
 
 /// Printer pass for the \c RegionInfo.
@@ -978,16 +979,16 @@ class RegionInfoPrinterPass : public PassInfoMixin<RegionInfoPrinterPass> {
   raw_ostream &OS;
 
 public:
-  explicit RegionInfoPrinterPass(raw_ostream &OS);
+  LLVM_ABI explicit RegionInfoPrinterPass(raw_ostream &OS);
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   static bool isRequired() { return true; }
 };
 
 /// Verifier pass for the \c RegionInfo.
 struct RegionInfoVerifierPass : PassInfoMixin<RegionInfoVerifierPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h b/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h
index 6f6ce763746a1..ba8c129b1c7d4 100644
--- a/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h
+++ b/llvm/include/llvm/Analysis/ReplayInlineAdvisor.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Analysis/InlineAdvisor.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class CallBase;
@@ -50,9 +51,10 @@ struct ReplayInlinerSettings {
 };
 
 /// Get call site location as a string with the given format
-std::string formatCallSiteLocation(DebugLoc DLoc, const CallSiteFormat &Format);
+LLVM_ABI std::string formatCallSiteLocation(DebugLoc DLoc,
+                                            const CallSiteFormat &Format);
 
-std::unique_ptr<InlineAdvisor>
+LLVM_ABI std::unique_ptr<InlineAdvisor>
 getReplayInlineAdvisor(Module &M, FunctionAnalysisManager &FAM,
                        LLVMContext &Context,
                        std::unique_ptr<InlineAdvisor> OriginalAdvisor,
@@ -61,7 +63,7 @@ getReplayInlineAdvisor(Module &M, FunctionAnalysisManager &FAM,
 
 /// Replay inline advisor that uses optimization remarks from inlining of
 /// previous build to guide current inlining. This is useful for inliner tuning.
-class ReplayInlineAdvisor : public InlineAdvisor {
+class LLVM_ABI ReplayInlineAdvisor : public InlineAdvisor {
 public:
   ReplayInlineAdvisor(Module &M, FunctionAnalysisManager &FAM,
                       LLVMContext &Context,
diff --git a/llvm/include/llvm/Analysis/ScalarEvolutionDivision.h b/llvm/include/llvm/Analysis/ScalarEvolutionDivision.h
index d3df7e346b4a5..04c258785b1d8 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolutionDivision.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolutionDivision.h
@@ -14,6 +14,7 @@
 #define LLVM_ANALYSIS_SCALAREVOLUTIONDIVISION_H
 
 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -40,9 +41,9 @@ struct SCEVDivision : public SCEVVisitor<SCEVDivision, void> {
   /// * Division of constants is performed as signed.
   /// * The multiplication of Quotient and Denominator may wrap.
   /// * The addition of Quotient*Denominator and Remainder may wrap.
-  static void divide(ScalarEvolution &SE, const SCEV *Numerator,
-                     const SCEV *Denominator, const SCEV **Quotient,
-                     const SCEV **Remainder);
+  LLVM_ABI static void divide(ScalarEvolution &SE, const SCEV *Numerator,
+                              const SCEV *Denominator, const SCEV **Quotient,
+                              const SCEV **Remainder);
 
   // Except in the trivial case described above, we do not know how to divide
   // Expr by Denominator for the following functions with empty implementation.
@@ -60,15 +61,15 @@ struct SCEVDivision : public SCEVVisitor<SCEVDivision, void> {
   void visitUnknown(const SCEVUnknown *Numerator) {}
   void visitCouldNotCompute(const SCEVCouldNotCompute *Numerator) {}
 
-  void visitConstant(const SCEVConstant *Numerator);
+  LLVM_ABI void visitConstant(const SCEVConstant *Numerator);
 
-  void visitVScale(const SCEVVScale *Numerator);
+  LLVM_ABI void visitVScale(const SCEVVScale *Numerator);
 
-  void visitAddRecExpr(const SCEVAddRecExpr *Numerator);
+  LLVM_ABI void visitAddRecExpr(const SCEVAddRecExpr *Numerator);
 
-  void visitAddExpr(const SCEVAddExpr *Numerator);
+  LLVM_ABI void visitAddExpr(const SCEVAddExpr *Numerator);
 
-  void visitMulExpr(const SCEVMulExpr *Numerator);
+  LLVM_ABI void visitMulExpr(const SCEVMulExpr *Numerator);
 
 private:
   SCEVDivision(ScalarEvolution &S, const SCEV *Numerator,
@@ -88,7 +89,7 @@ class SCEVDivisionPrinterPass : public PassInfoMixin<SCEVDivisionPrinterPass> {
 
 public:
   explicit SCEVDivisionPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Analysis/StackLifetime.h b/llvm/include/llvm/Analysis/StackLifetime.h
index 13f837a22281a..d5d96a19b81d6 100644
--- a/llvm/include/llvm/Analysis/StackLifetime.h
+++ b/llvm/include/llvm/Analysis/StackLifetime.h
@@ -15,6 +15,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include <utility>
 
@@ -130,10 +131,11 @@ class StackLifetime {
   void calculateLiveIntervals();
 
 public:
-  StackLifetime(const Function &F, ArrayRef<const AllocaInst *> Allocas,
-                LivenessType Type);
+  LLVM_ABI StackLifetime(const Function &F,
+                         ArrayRef<const AllocaInst *> Allocas,
+                         LivenessType Type);
 
-  void run();
+  LLVM_ABI void run();
 
   iterator_range<
       filter_iterator<ArrayRef<const IntrinsicInst *>::const_iterator,
@@ -147,13 +149,13 @@ class StackLifetime {
   /// Returns a set of "interesting" instructions where the given alloca is
   /// live. Not all instructions in a function are interesting: we pick a set
   /// that is large enough for LiveRange::Overlaps to be correct.
-  const LiveRange &getLiveRange(const AllocaInst *AI) const;
+  LLVM_ABI const LiveRange &getLiveRange(const AllocaInst *AI) const;
 
   /// Returns true if instruction is reachable from entry.
-  bool isReachable(const Instruction *I) const;
+  LLVM_ABI bool isReachable(const Instruction *I) const;
 
   /// Returns true if the alloca is alive after the instruction.
-  bool isAliveAfter(const AllocaInst *AI, const Instruction *I) const;
+  LLVM_ABI bool isAliveAfter(const AllocaInst *AI, const Instruction *I) const;
 
   /// Returns a live range that represents an alloca that is live throughout the
   /// entire function.
@@ -161,7 +163,7 @@ class StackLifetime {
     return LiveRange(Instructions.size(), true);
   }
 
-  void print(raw_ostream &O);
+  LLVM_ABI void print(raw_ostream &O);
 };
 
 static inline raw_ostream &operator<<(raw_ostream &OS, const BitVector &V) {
@@ -187,10 +189,11 @@ class StackLifetimePrinterPass
 public:
   StackLifetimePrinterPass(raw_ostream &OS, StackLifetime::LivenessType Type)
       : Type(Type), OS(OS) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Analysis/StackSafetyAnalysis.h b/llvm/include/llvm/Analysis/StackSafetyAnalysis.h
index b7b816fa4021e..7b810f6dd879a 100644
--- a/llvm/include/llvm/Analysis/StackSafetyAnalysis.h
+++ b/llvm/include/llvm/Analysis/StackSafetyAnalysis.h
@@ -16,6 +16,7 @@
 #include "llvm/IR/ModuleSummaryIndex.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -33,16 +34,17 @@ class StackSafetyInfo {
   mutable std::unique_ptr<InfoTy> Info;
 
 public:
-  StackSafetyInfo();
-  StackSafetyInfo(Function *F, std::function<ScalarEvolution &()> GetSE);
-  StackSafetyInfo(StackSafetyInfo &&);
-  StackSafetyInfo &operator=(StackSafetyInfo &&);
-  ~StackSafetyInfo();
+  LLVM_ABI StackSafetyInfo();
+  LLVM_ABI StackSafetyInfo(Function *F,
+                           std::function<ScalarEvolution &()> GetSE);
+  LLVM_ABI StackSafetyInfo(StackSafetyInfo &&);
+  LLVM_ABI StackSafetyInfo &operator=(StackSafetyInfo &&);
+  LLVM_ABI ~StackSafetyInfo();
 
-  const InfoTy &getInfo() const;
+  LLVM_ABI const InfoTy &getInfo() const;
 
   // TODO: Add useful for client methods.
-  void print(raw_ostream &O) const;
+  LLVM_ABI void print(raw_ostream &O) const;
 
   /// Parameters use for a FunctionSummary.
   /// Function collects access information of all pointer parameters.
@@ -51,7 +53,7 @@ class StackSafetyInfo {
   /// StackSafety assumes that missing parameter information means possibility
   /// of access to the parameter with any offset, so we can correctly link
   /// code without StackSafety information, e.g. non-ThinLTO.
-  std::vector<FunctionSummary::ParamAccess>
+  LLVM_ABI std::vector<FunctionSummary::ParamAccess>
   getParamAccesses(ModuleSummaryIndex &Index) const;
 };
 
@@ -67,25 +69,25 @@ class StackSafetyGlobalInfo {
   const InfoTy &getInfo() const;
 
 public:
-  StackSafetyGlobalInfo();
-  StackSafetyGlobalInfo(
+  LLVM_ABI StackSafetyGlobalInfo();
+  LLVM_ABI StackSafetyGlobalInfo(
       Module *M, std::function<const StackSafetyInfo &(Function &F)> GetSSI,
       const ModuleSummaryIndex *Index);
-  StackSafetyGlobalInfo(StackSafetyGlobalInfo &&);
-  StackSafetyGlobalInfo &operator=(StackSafetyGlobalInfo &&);
-  ~StackSafetyGlobalInfo();
+  LLVM_ABI StackSafetyGlobalInfo(StackSafetyGlobalInfo &&);
+  LLVM_ABI StackSafetyGlobalInfo &operator=(StackSafetyGlobalInfo &&);
+  LLVM_ABI ~StackSafetyGlobalInfo();
 
   // Whether we can prove that all accesses to this Alloca are in-range and
   // during its lifetime.
-  bool isSafe(const AllocaInst &AI) const;
+  LLVM_ABI bool isSafe(const AllocaInst &AI) const;
 
   // Returns true if the instruction can be proven to do only two types of
   // memory accesses:
   //  (1) live stack locations in-bounds or
   //  (2) non-stack locations.
-  bool stackAccessIsSafe(const Instruction &I) const;
-  void print(raw_ostream &O) const;
-  void dump() const;
+  LLVM_ABI bool stackAccessIsSafe(const Instruction &I) const;
+  LLVM_ABI void print(raw_ostream &O) const;
+  LLVM_ABI void dump() const;
 };
 
 /// StackSafetyInfo wrapper for the new pass manager.
@@ -95,7 +97,7 @@ class StackSafetyAnalysis : public AnalysisInfoMixin<StackSafetyAnalysis> {
 
 public:
   using Result = StackSafetyInfo;
-  StackSafetyInfo run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI StackSafetyInfo run(Function &F, FunctionAnalysisManager &AM);
 };
 
 /// Printer pass for the \c StackSafetyAnalysis results.
@@ -104,12 +106,12 @@ class StackSafetyPrinterPass : public PassInfoMixin<StackSafetyPrinterPass> {
 
 public:
   explicit StackSafetyPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 
 /// StackSafetyInfo wrapper for the legacy pass manager
-class StackSafetyInfoWrapperPass : public FunctionPass {
+class LLVM_ABI StackSafetyInfoWrapperPass : public FunctionPass {
   StackSafetyInfo SSI;
 
 public:
@@ -133,7 +135,7 @@ class StackSafetyGlobalAnalysis
 
 public:
   using Result = StackSafetyGlobalInfo;
-  Result run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI Result run(Module &M, ModuleAnalysisManager &AM);
 };
 
 /// Printer pass for the \c StackSafetyGlobalAnalysis results.
@@ -143,13 +145,13 @@ class StackSafetyGlobalPrinterPass
 
 public:
   explicit StackSafetyGlobalPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 
 /// This pass performs the global (interprocedural) stack safety analysis
 /// (legacy pass manager).
-class StackSafetyGlobalInfoWrapperPass : public ModulePass {
+class LLVM_ABI StackSafetyGlobalInfoWrapperPass : public ModulePass {
   StackSafetyGlobalInfo SSGI;
 
 public:
@@ -166,9 +168,9 @@ class StackSafetyGlobalInfoWrapperPass : public ModulePass {
   bool runOnModule(Module &M) override;
 };
 
-bool needsParamAccessSummary(const Module &M);
+LLVM_ABI bool needsParamAccessSummary(const Module &M);
 
-void generateParamAccessSummary(ModuleSummaryIndex &Index);
+LLVM_ABI void generateParamAccessSummary(ModuleSummaryIndex &Index);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Analysis/StaticDataProfileInfo.h b/llvm/include/llvm/Analysis/StaticDataProfileInfo.h
index ac03137c93610..56a3eacc973aa 100644
--- a/llvm/include/llvm/Analysis/StaticDataProfileInfo.h
+++ b/llvm/include/llvm/Analysis/StaticDataProfileInfo.h
@@ -21,11 +21,11 @@ enum class AnnotationKind : uint8_t {
   ReservedName,
 };
 /// Returns the annotation kind of the global variable \p GV.
-AnnotationKind getAnnotationKind(const GlobalVariable &GV);
+LLVM_ABI AnnotationKind getAnnotationKind(const GlobalVariable &GV);
 
 /// Returns true if the annotation kind of the global variable \p GV is
 /// AnnotationOK.
-bool IsAnnotationOK(const GlobalVariable &GV);
+LLVM_ABI bool IsAnnotationOK(const GlobalVariable &GV);
 } // namespace memprof
 
 /// A class that holds the constants that represent static data and their
diff --git a/llvm/include/llvm/Analysis/StructuralHash.h b/llvm/include/llvm/Analysis/StructuralHash.h
index 4c9f063bc7d2c..616940ca3c4cd 100644
--- a/llvm/include/llvm/Analysis/StructuralHash.h
+++ b/llvm/include/llvm/Analysis/StructuralHash.h
@@ -10,6 +10,7 @@
 #define LLVM_ANALYSIS_STRUCTURALHASH_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -30,7 +31,7 @@ class StructuralHashPrinterPass
                                      StructuralHashOptions Options)
       : OS(OS), Options(Options) {}
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 
   static bool isRequired() { return true; }
 };
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 13e064d7ee6aa..f41d6a5676060 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -150,22 +150,19 @@ class MemIntrinsicCostAttributes {
   Align Alignment;
 
 public:
-  LLVM_ABI MemIntrinsicCostAttributes(Intrinsic::ID Id, Type *DataTy,
-                                      const Value *Ptr, bool VariableMask,
-                                      Align Alignment,
-                                      const Instruction *I = nullptr)
+  MemIntrinsicCostAttributes(Intrinsic::ID Id, Type *DataTy, const Value *Ptr,
+                             bool VariableMask, Align Alignment,
+                             const Instruction *I = nullptr)
       : I(I), Ptr(Ptr), DataTy(DataTy), IID(Id), VariableMask(VariableMask),
         Alignment(Alignment) {}
 
-  LLVM_ABI MemIntrinsicCostAttributes(Intrinsic::ID Id, Type *DataTy,
-                                      Align Alignment,
-                                      unsigned AddressSpace = 0)
+  MemIntrinsicCostAttributes(Intrinsic::ID Id, Type *DataTy, Align Alignment,
+                             unsigned AddressSpace = 0)
       : DataTy(DataTy), IID(Id), AddressSpace(AddressSpace),
         Alignment(Alignment) {}
 
-  LLVM_ABI MemIntrinsicCostAttributes(Intrinsic::ID Id, Type *DataTy,
-                                      bool VariableMask, Align Alignment,
-                                      const Instruction *I = nullptr)
+  MemIntrinsicCostAttributes(Intrinsic::ID Id, Type *DataTy, bool VariableMask,
+                             Align Alignment, const Instruction *I = nullptr)
       : I(I), DataTy(DataTy), IID(Id), VariableMask(VariableMask),
         Alignment(Alignment) {}
 
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index 07b3755924fd1..a1f417fc3608f 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -23,6 +23,7 @@
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Operator.h"
 #include "llvm/IR/PatternMatch.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 #include <utility>
 
@@ -32,7 +33,7 @@ class Function;
 
 /// Base class for use as a mix-in that aids implementing
 /// a TargetTransformInfo-compatible class.
-class TargetTransformInfoImplBase {
+class LLVM_ABI TargetTransformInfoImplBase {
 
 protected:
   typedef TargetTransformInfo TTI;
diff --git a/llvm/include/llvm/Analysis/Trace.h b/llvm/include/llvm/Analysis/Trace.h
index a1ffd03c40530..c8b417e78a01e 100644
--- a/llvm/include/llvm/Analysis/Trace.h
+++ b/llvm/include/llvm/Analysis/Trace.h
@@ -17,6 +17,7 @@
 #ifndef LLVM_ANALYSIS_TRACE_H
 #define LLVM_ANALYSIS_TRACE_H
 
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <vector>
 
@@ -47,11 +48,11 @@ class Trace {
   BasicBlock *getBlock(unsigned i)   const { return BasicBlocks[i]; }
 
   /// getFunction - Return this trace's parent function.
-  Function *getFunction () const;
+  LLVM_ABI Function *getFunction() const;
 
   /// getModule - Return this Module that contains this trace's parent
   /// function.
-  Module *getModule () const;
+  LLVM_ABI Module *getModule() const;
 
   /// getBlockIndex - Return the index of the specified basic block in the
   /// trace, or -1 if it is not in the trace.
@@ -99,11 +100,11 @@ class Trace {
   iterator erase(iterator q1, iterator q2) { return BasicBlocks.erase (q1, q2); }
 
   /// print - Write trace to output stream.
-  void print(raw_ostream &O) const;
+  LLVM_ABI void print(raw_ostream &O) const;
 
   /// dump - Debugger convenience method; writes trace to standard error
   /// output stream.
-  void dump() const;
+  LLVM_ABI void dump() const;
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Analysis/TypeMetadataUtils.h b/llvm/include/llvm/Analysis/TypeMetadataUtils.h
index bdb477b54b532..d6f4c8c0e8b54 100644
--- a/llvm/include/llvm/Analysis/TypeMetadataUtils.h
+++ b/llvm/include/llvm/Analysis/TypeMetadataUtils.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_ANALYSIS_TYPEMETADATAUTILS_H
 #define LLVM_ANALYSIS_TYPEMETADATAUTILS_H
 
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <utility>
 
@@ -46,14 +47,14 @@ struct DevirtCallSite {
 
 /// Given a call to the intrinsic \@llvm.type.test, find all devirtualizable
 /// call sites based on the call and return them in DevirtCalls.
-void findDevirtualizableCallsForTypeTest(
+LLVM_ABI void findDevirtualizableCallsForTypeTest(
     SmallVectorImpl<DevirtCallSite> &DevirtCalls,
     SmallVectorImpl<CallInst *> &Assumes, const CallInst *CI,
     DominatorTree &DT);
 
 /// Given a call to the intrinsic \@llvm.type.checked.load, find all
 /// devirtualizable call sites based on the call and return them in DevirtCalls.
-void findDevirtualizableCallsForTypeCheckedLoad(
+LLVM_ABI void findDevirtualizableCallsForTypeCheckedLoad(
     SmallVectorImpl<DevirtCallSite> &DevirtCalls,
     SmallVectorImpl<Instruction *> &LoadedPtrs,
     SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses,
@@ -76,19 +77,19 @@ void findDevirtualizableCallsForTypeCheckedLoad(
 /// }
 ///
 /// For such (sub-)expressions, getPointerAtOffset returns the @target pointer.
-Constant *getPointerAtOffset(Constant *I, uint64_t Offset, Module &M,
-                             Constant *TopLevelGlobal = nullptr);
+LLVM_ABI Constant *getPointerAtOffset(Constant *I, uint64_t Offset, Module &M,
+                                      Constant *TopLevelGlobal = nullptr);
 
 /// Given a vtable and a specified offset, returns the function and the trivial
 /// pointer at the specified offset in pair iff the pointer at the specified
 /// offset is a function or an alias to a function. Returns a pair of nullptr
 /// otherwise.
-std::pair<Function *, Constant *>
+LLVM_ABI std::pair<Function *, Constant *>
 getFunctionAtVTableOffset(GlobalVariable *GV, uint64_t Offset, Module &M);
 
 /// Finds the same "relative pointer" pattern as described above, where the
 /// target is `C`, and replaces the entire pattern with a constant zero.
-void replaceRelativePointerUsersWithZero(Constant *C);
+LLVM_ABI void replaceRelativePointerUsersWithZero(Constant *C);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Analysis/UniformityAnalysis.h b/llvm/include/llvm/Analysis/UniformityAnalysis.h
index a067a9b42893c..df579e612a962 100644
--- a/llvm/include/llvm/Analysis/UniformityAnalysis.h
+++ b/llvm/include/llvm/Analysis/UniformityAnalysis.h
@@ -18,6 +18,7 @@
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/SSAContext.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -35,7 +36,7 @@ class UniformityInfoAnalysis
   using Result = UniformityInfo;
 
   /// Run the analysis pass over a function and produce a dominator tree.
-  UniformityInfo run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI UniformityInfo run(Function &F, FunctionAnalysisManager &);
 
   // TODO: verify analysis
 };
@@ -46,15 +47,15 @@ class UniformityInfoPrinterPass
   raw_ostream &OS;
 
 public:
-  explicit UniformityInfoPrinterPass(raw_ostream &OS);
+  LLVM_ABI explicit UniformityInfoPrinterPass(raw_ostream &OS);
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   static bool isRequired() { return true; }
 };
 
 /// Legacy analysis pass which computes a \ref CycleInfo.
-class UniformityInfoWrapperPass : public FunctionPass {
+class LLVM_ABI UniformityInfoWrapperPass : public FunctionPass {
   Function *m_function = nullptr;
   UniformityInfo m_uniformityInfo;
 
diff --git a/llvm/include/llvm/Analysis/ValueLatticeUtils.h b/llvm/include/llvm/Analysis/ValueLatticeUtils.h
index a3bbb96129bff..f0e93ebff4bfd 100644
--- a/llvm/include/llvm/Analysis/ValueLatticeUtils.h
+++ b/llvm/include/llvm/Analysis/ValueLatticeUtils.h
@@ -14,6 +14,8 @@
 #ifndef LLVM_ANALYSIS_VALUELATTICEUTILS_H
 #define LLVM_ANALYSIS_VALUELATTICEUTILS_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 
 class Function;
@@ -22,18 +24,18 @@ class GlobalVariable;
 /// Determine if the values of the given function's arguments can be tracked
 /// interprocedurally. The value of an argument can be tracked if the function
 /// has local linkage and its address is not taken.
-bool canTrackArgumentsInterprocedurally(Function *F);
+LLVM_ABI bool canTrackArgumentsInterprocedurally(Function *F);
 
 /// Determine if the values of the given function's returns can be tracked
 /// interprocedurally. Return values can be tracked if the function has an
 /// exact definition and it doesn't have the "naked" attribute. Naked functions
 /// may contain assembly code that returns untrackable values.
-bool canTrackReturnsInterprocedurally(Function *F);
+LLVM_ABI bool canTrackReturnsInterprocedurally(Function *F);
 
 /// Determine if the value maintained in the given global variable can be
 /// tracked interprocedurally. A value can be tracked if the global variable
 /// has local linkage and is only used by non-volatile loads and stores.
-bool canTrackGlobalVariableInterprocedurally(GlobalVariable *GV);
+LLVM_ABI bool canTrackGlobalVariableInterprocedurally(GlobalVariable *GV);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/AsmParser/LLLexer.h b/llvm/include/llvm/AsmParser/LLLexer.h
index 0e379e5a75e65..c7c673eb6d38c 100644
--- a/llvm/include/llvm/AsmParser/LLLexer.h
+++ b/llvm/include/llvm/AsmParser/LLLexer.h
@@ -16,6 +16,7 @@
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/AsmParser/LLToken.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include "llvm/Support/SourceMgr.h"
 #include <string>
@@ -62,8 +63,8 @@ namespace llvm {
     bool IgnoreColonInIdentifiers = false;
 
   public:
-    explicit LLLexer(StringRef StartBuf, SourceMgr &SM, SMDiagnostic &,
-                     LLVMContext &C);
+    LLVM_ABI explicit LLLexer(StringRef StartBuf, SourceMgr &SM, SMDiagnostic &,
+                              LLVMContext &C);
 
     lltok::Kind Lex() { return CurKind = LexToken(); }
 
@@ -101,11 +102,11 @@ namespace llvm {
     }
     bool ParseError(const Twine &Msg) { return ParseError(getLoc(), Msg); }
 
-    void Warning(LocTy WarningLoc, const Twine &Msg) const;
+    LLVM_ABI void Warning(LocTy WarningLoc, const Twine &Msg) const;
     void Warning(const Twine &Msg) const { return Warning(getLoc(), Msg); }
 
   private:
-    lltok::Kind LexToken();
+    LLVM_ABI lltok::Kind LexToken();
 
     int getNextChar();
     void SkipLineComment();
@@ -133,7 +134,7 @@ namespace llvm {
     void FP80HexToIntPair(const char *Buffer, const char *End,
                           uint64_t Pair[2]);
 
-    void Error(LocTy ErrorLoc, const Twine &Msg, ErrorPriority Origin);
+    LLVM_ABI void Error(LocTy ErrorLoc, const Twine &Msg, ErrorPriority Origin);
 
     void LexError(LocTy ErrorLoc, const Twine &Msg) {
       Error(ErrorLoc, Msg, ErrorPriority::Lexer);
diff --git a/llvm/include/llvm/AsmParser/LLParser.h b/llvm/include/llvm/AsmParser/LLParser.h
index 185847f258cda..98ddd6531008f 100644
--- a/llvm/include/llvm/AsmParser/LLParser.h
+++ b/llvm/include/llvm/AsmParser/LLParser.h
@@ -22,6 +22,7 @@
 #include "llvm/IR/FMF.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/ModuleSummaryIndex.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ModRef.h"
 #include <map>
 #include <optional>
@@ -198,19 +199,21 @@ namespace llvm {
         : Context(Context), OPLex(F, SM, Err, Context),
           Lex(F, SM, Err, Context), M(M), Index(Index), Slots(Slots),
           BlockAddressPFS(nullptr), ParserContext(ParserContext) {}
-    bool Run(
+    LLVM_ABI bool Run(
         bool UpgradeDebugInfo,
         DataLayoutCallbackTy DataLayoutCallback = [](StringRef, StringRef) {
           return std::nullopt;
         });
 
-    bool parseStandaloneConstantValue(Constant *&C, const SlotMapping *Slots);
+    LLVM_ABI bool parseStandaloneConstantValue(Constant *&C,
+                                               const SlotMapping *Slots);
 
-    bool parseTypeAtBeginning(Type *&Ty, unsigned &Read,
-                              const SlotMapping *Slots);
+    LLVM_ABI bool parseTypeAtBeginning(Type *&Ty, unsigned &Read,
+                                       const SlotMapping *Slots);
 
-    bool parseDIExpressionBodyAtBeginning(MDNode *&Result, unsigned &Read,
-                                          const SlotMapping *Slots);
+    LLVM_ABI bool parseDIExpressionBodyAtBeginning(MDNode *&Result,
+                                                   unsigned &Read,
+                                                   const SlotMapping *Slots);
 
     LLVMContext &getContext() { return Context; }
 
@@ -276,12 +279,12 @@ namespace llvm {
       return false;
     }
     bool parseStringConstant(std::string &Result);
-    bool parseUInt32(unsigned &Val);
+    LLVM_ABI bool parseUInt32(unsigned &Val);
     bool parseUInt32(unsigned &Val, LocTy &Loc) {
       Loc = Lex.getLoc();
       return parseUInt32(Val);
     }
-    bool parseUInt64(uint64_t &Val);
+    LLVM_ABI bool parseUInt64(uint64_t &Val);
     bool parseUInt64(uint64_t &Val, LocTy &Loc) {
       Loc = Lex.getLoc();
       return parseUInt64(Val);
@@ -293,14 +296,15 @@ namespace llvm {
     bool parseTLSModel(GlobalVariable::ThreadLocalMode &TLM);
     bool parseOptionalThreadLocal(GlobalVariable::ThreadLocalMode &TLM);
     bool parseOptionalUnnamedAddr(GlobalVariable::UnnamedAddr &UnnamedAddr);
-    bool parseOptionalAddrSpace(unsigned &AddrSpace, unsigned DefaultAS = 0);
+    LLVM_ABI bool parseOptionalAddrSpace(unsigned &AddrSpace,
+                                         unsigned DefaultAS = 0);
     bool parseOptionalProgramAddrSpace(unsigned &AddrSpace) {
       return parseOptionalAddrSpace(
           AddrSpace, M->getDataLayout().getProgramAddressSpace());
     };
     bool parseEnumAttribute(Attribute::AttrKind Attr, AttrBuilder &B,
                             bool InAttrGroup);
-    bool parseOptionalParamOrReturnAttrs(AttrBuilder &B, bool IsParam);
+    LLVM_ABI bool parseOptionalParamOrReturnAttrs(AttrBuilder &B, bool IsParam);
     bool parseOptionalParamAttrs(AttrBuilder &B) {
       return parseOptionalParamOrReturnAttrs(B, true);
     }
@@ -337,8 +341,8 @@ namespace llvm {
     bool parseAllocSizeArguments(unsigned &BaseSizeArg,
                                  std::optional<unsigned> &HowManyArg);
     bool parseVScaleRangeArguments(unsigned &MinValue, unsigned &MaxValue);
-    bool parseIndexList(SmallVectorImpl<unsigned> &Indices,
-                        bool &AteExtraComma);
+    LLVM_ABI bool parseIndexList(SmallVectorImpl<unsigned> &Indices,
+                                 bool &AteExtraComma);
     bool parseIndexList(SmallVectorImpl<unsigned> &Indices) {
       bool AteExtraComma;
       if (parseIndexList(Indices, AteExtraComma))
@@ -452,7 +456,8 @@ namespace llvm {
     bool parseOptionalCallsites(std::vector<CallsiteInfo> &Callsites);
 
     // Type Parsing.
-    bool parseType(Type *&Result, const Twine &Msg, bool AllowVoid = false);
+    LLVM_ABI bool parseType(Type *&Result, const Twine &Msg,
+                            bool AllowVoid = false);
     bool parseType(Type *&Result, bool AllowVoid = false) {
       return parseType(Result, "expected type", AllowVoid);
     }
@@ -488,37 +493,38 @@ namespace llvm {
       int FunctionNumber;
 
     public:
-      PerFunctionState(LLParser &p, Function &f, int functionNumber,
-                       ArrayRef<unsigned> UnnamedArgNums);
-      ~PerFunctionState();
+      LLVM_ABI PerFunctionState(LLParser &p, Function &f, int functionNumber,
+                                ArrayRef<unsigned> UnnamedArgNums);
+      LLVM_ABI ~PerFunctionState();
 
       Function &getFunction() const { return F; }
 
-      bool finishFunction();
+      LLVM_ABI bool finishFunction();
 
       /// GetVal - Get a value with the specified name or ID, creating a
       /// forward reference record if needed.  This can return null if the value
       /// exists but does not have the right type.
-      Value *getVal(const std::string &Name, Type *Ty, LocTy Loc);
-      Value *getVal(unsigned ID, Type *Ty, LocTy Loc);
+      LLVM_ABI Value *getVal(const std::string &Name, Type *Ty, LocTy Loc);
+      LLVM_ABI Value *getVal(unsigned ID, Type *Ty, LocTy Loc);
 
       /// setInstName - After an instruction is parsed and inserted into its
       /// basic block, this installs its name.
-      bool setInstName(int NameID, const std::string &NameStr, LocTy NameLoc,
-                       Instruction *Inst);
+      LLVM_ABI bool setInstName(int NameID, const std::string &NameStr,
+                                LocTy NameLoc, Instruction *Inst);
 
       /// GetBB - Get a basic block with the specified name or ID, creating a
       /// forward reference record if needed.  This can return null if the value
       /// is not a BasicBlock.
-      BasicBlock *getBB(const std::string &Name, LocTy Loc);
-      BasicBlock *getBB(unsigned ID, LocTy Loc);
+      LLVM_ABI BasicBlock *getBB(const std::string &Name, LocTy Loc);
+      LLVM_ABI BasicBlock *getBB(unsigned ID, LocTy Loc);
 
       /// DefineBB - Define the specified basic block, which is either named or
       /// unnamed.  If there is an error, this returns null otherwise it returns
       /// the block being defined.
-      BasicBlock *defineBB(const std::string &Name, int NameID, LocTy Loc);
+      LLVM_ABI BasicBlock *defineBB(const std::string &Name, int NameID,
+                                    LocTy Loc);
 
-      bool resolveForwardRefBlockAddresses();
+      LLVM_ABI bool resolveForwardRefBlockAddresses();
     };
 
     bool convertValIDToValue(Type *Ty, ValID &ID, Value *&V,
@@ -528,7 +534,7 @@ namespace llvm {
                                   Value *Val);
 
     bool parseConstantValue(Type *Ty, Constant *&C);
-    bool parseValue(Type *Ty, Value *&V, PerFunctionState *PFS);
+    LLVM_ABI bool parseValue(Type *Ty, Value *&V, PerFunctionState *PFS);
     bool parseValue(Type *Ty, Value *&V, PerFunctionState &PFS) {
       return parseValue(Ty, V, &PFS);
     }
@@ -538,7 +544,7 @@ namespace llvm {
       return parseValue(Ty, V, &PFS);
     }
 
-    bool parseTypeAndValue(Value *&V, PerFunctionState *PFS);
+    LLVM_ABI bool parseTypeAndValue(Value *&V, PerFunctionState *PFS);
     bool parseTypeAndValue(Value *&V, PerFunctionState &PFS) {
       return parseTypeAndValue(V, &PFS);
     }
@@ -546,8 +552,8 @@ namespace llvm {
       Loc = Lex.getLoc();
       return parseTypeAndValue(V, PFS);
     }
-    bool parseTypeAndBasicBlock(BasicBlock *&BB, LocTy &Loc,
-                                PerFunctionState &PFS);
+    LLVM_ABI bool parseTypeAndBasicBlock(BasicBlock *&BB, LocTy &Loc,
+                                         PerFunctionState &PFS);
     bool parseTypeAndBasicBlock(BasicBlock *&BB, PerFunctionState &PFS) {
       LocTy Loc;
       return parseTypeAndBasicBlock(BB, Loc, PFS);
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index 1756ab0b555ff..22c8fd8277844 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -203,7 +203,7 @@ LLVM_ABI ArrayRef<EnumEntry<RootParameterType>> getRootParameterTypes();
 
 LLVM_ABI_FOR_TEST bool isValidParameterType(uint32_t V);
 
-bool isValidRangeType(uint32_t V);
+LLVM_ABI bool isValidRangeType(uint32_t V);
 
 #define SHADER_VISIBILITY(Val, Enum) Enum = Val,
 enum class ShaderVisibility : uint32_t {
@@ -212,14 +212,14 @@ enum class ShaderVisibility : uint32_t {
 
 LLVM_ABI ArrayRef<EnumEntry<ShaderVisibility>> getShaderVisibility();
 
-bool isValidShaderVisibility(uint32_t V);
+LLVM_ABI bool isValidShaderVisibility(uint32_t V);
 
 #define FILTER(Val, Enum) Enum = Val,
 enum class SamplerFilter : uint32_t {
 #include "DXContainerConstants.def"
 };
 
-bool isValidSamplerFilter(uint32_t V);
+LLVM_ABI bool isValidSamplerFilter(uint32_t V);
 
 LLVM_ABI ArrayRef<EnumEntry<SamplerFilter>> getSamplerFilters();
 
@@ -230,7 +230,7 @@ enum class TextureAddressMode : uint32_t {
 
 LLVM_ABI ArrayRef<EnumEntry<TextureAddressMode>> getTextureAddressModes();
 
-bool isValidAddress(uint32_t V);
+LLVM_ABI bool isValidAddress(uint32_t V);
 
 #define COMPARISON_FUNC(Val, Enum) Enum = Val,
 enum class ComparisonFunc : uint32_t {
@@ -239,20 +239,20 @@ enum class ComparisonFunc : uint32_t {
 
 LLVM_ABI ArrayRef<EnumEntry<ComparisonFunc>> getComparisonFuncs();
 
-bool isValidComparisonFunc(uint32_t V);
+LLVM_ABI bool isValidComparisonFunc(uint32_t V);
 
 #define STATIC_BORDER_COLOR(Val, Enum) Enum = Val,
 enum class StaticBorderColor : uint32_t {
 #include "DXContainerConstants.def"
 };
 
-bool isValidBorderColor(uint32_t V);
+LLVM_ABI bool isValidBorderColor(uint32_t V);
 
-bool isValidRootDesciptorFlags(uint32_t V);
+LLVM_ABI bool isValidRootDesciptorFlags(uint32_t V);
 
-bool isValidDescriptorRangeFlags(uint32_t V);
+LLVM_ABI bool isValidDescriptorRangeFlags(uint32_t V);
 
-bool isValidStaticSamplerFlags(uint32_t V);
+LLVM_ABI bool isValidStaticSamplerFlags(uint32_t V);
 
 LLVM_ABI ArrayRef<EnumEntry<StaticBorderColor>> getStaticBorderColors();
 
diff --git a/llvm/include/llvm/CAS/ActionCache.h b/llvm/include/llvm/CAS/ActionCache.h
index 536e36f6fecd6..acb7dcf092001 100644
--- a/llvm/include/llvm/CAS/ActionCache.h
+++ b/llvm/include/llvm/CAS/ActionCache.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/CAS/CASID.h"
 #include "llvm/CAS/CASReference.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm::cas {
@@ -35,7 +36,7 @@ class CacheKey {
 
   LLVM_ABI CacheKey(const CASID &ID);
   LLVM_ABI_FOR_TEST CacheKey(const ObjectProxy &Proxy);
-  CacheKey(const ObjectStore &CAS, const ObjectRef &Ref);
+  LLVM_ABI CacheKey(const ObjectStore &CAS, const ObjectRef &Ref);
 
 private:
   std::string Key;
@@ -46,7 +47,7 @@ class CacheKey {
 ///
 /// Actions are expected to be pure. Storing mappings from one action to
 /// multiple results will result in error (cache poisoning).
-class ActionCache {
+class LLVM_ABI ActionCache {
   virtual void anchor();
 
 public:
diff --git a/llvm/include/llvm/CAS/BuiltinCASContext.h b/llvm/include/llvm/CAS/BuiltinCASContext.h
index e9a226a423e5a..eec7d78ac913c 100644
--- a/llvm/include/llvm/CAS/BuiltinCASContext.h
+++ b/llvm/include/llvm/CAS/BuiltinCASContext.h
@@ -11,6 +11,7 @@
 
 #include "llvm/CAS/CASID.h"
 #include "llvm/Support/BLAKE3.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm::cas::builtin {
@@ -55,7 +56,7 @@ using HasherT = BLAKE3;
 using HashType = decltype(HasherT::hash(std::declval<ArrayRef<uint8_t> &>()));
 
 /// CASContext for LLVM builtin CAS using BLAKE3 hash type.
-class BuiltinCASContext : public CASContext {
+class LLVM_ABI BuiltinCASContext : public CASContext {
   void printIDImpl(raw_ostream &OS, const CASID &ID) const final;
   void anchor() override;
 
diff --git a/llvm/include/llvm/CAS/CASID.h b/llvm/include/llvm/CAS/CASID.h
index 8d5a48e26a1af..bc8ce4e9c7cb7 100644
--- a/llvm/include/llvm/CAS/CASID.h
+++ b/llvm/include/llvm/CAS/CASID.h
@@ -14,6 +14,7 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
@@ -25,7 +26,7 @@ namespace cas {
 class CASID;
 
 /// Context for CAS identifiers.
-class CASContext {
+class LLVM_ABI CASContext {
   virtual void anchor();
 
 public:
@@ -57,7 +58,7 @@ class CASContext {
 /// compared by hash, in which case the result of \a getHash() is compared.
 class CASID {
 public:
-  void dump() const;
+  LLVM_ABI void dump() const;
 
   friend raw_ostream &operator<<(raw_ostream &OS, const CASID &ID) {
     ID.print(OS);
diff --git a/llvm/include/llvm/CAS/CASReference.h b/llvm/include/llvm/CAS/CASReference.h
index ccbfb25079e8d..696b0c1574c6c 100644
--- a/llvm/include/llvm/CAS/CASReference.h
+++ b/llvm/include/llvm/CAS/CASReference.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -53,8 +54,8 @@ class ReferenceBase {
   }
 
 protected:
-  void print(raw_ostream &OS, const ObjectHandle &This) const;
-  void print(raw_ostream &OS, const ObjectRef &This) const;
+  LLVM_ABI void print(raw_ostream &OS, const ObjectHandle &This) const;
+  LLVM_ABI void print(raw_ostream &OS, const ObjectRef &This) const;
 
   bool hasSameInternalRef(const ReferenceBase &RHS) const {
 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
@@ -126,7 +127,7 @@ class ObjectRef : public ReferenceBase {
   /// Print internal ref and/or CASID. Only suitable for debugging.
   void print(raw_ostream &OS) const { return ReferenceBase::print(OS, *this); }
 
-  LLVM_DUMP_METHOD void dump() const;
+  LLVM_DUMP_METHOD LLVM_ABI void dump() const;
 
 private:
   friend class ObjectStore;
@@ -159,7 +160,7 @@ class ObjectHandle : public ReferenceBase {
   /// Print internal ref and/or CASID. Only suitable for debugging.
   void print(raw_ostream &OS) const { return ReferenceBase::print(OS, *this); }
 
-  LLVM_DUMP_METHOD void dump() const;
+  LLVM_DUMP_METHOD LLVM_ABI void dump() const;
 
 private:
   friend class ObjectStore;
diff --git a/llvm/include/llvm/CAS/ObjectStore.h b/llvm/include/llvm/CAS/ObjectStore.h
index 2e5b939404e42..11064d0c9f488 100644
--- a/llvm/include/llvm/CAS/ObjectStore.h
+++ b/llvm/include/llvm/CAS/ObjectStore.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/CAS/CASID.h"
 #include "llvm/CAS/CASReference.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
 #include <cstddef>
@@ -87,7 +88,7 @@ class ObjectProxy;
 ///   long as \a ObjectStore.
 /// - \a readRef() and \a forEachRef() iterate through the references in an
 ///   object. There is no lifetime assumption.
-class ObjectStore {
+class LLVM_ABI ObjectStore {
   friend class ObjectProxy;
   void anchor();
 
@@ -179,8 +180,7 @@ class ObjectStore {
 
 public:
   /// Helper functions to store object and returns a ObjectProxy.
-  LLVM_ABI_FOR_TEST Expected<ObjectProxy> createProxy(ArrayRef<ObjectRef> Refs,
-                                                      StringRef Data);
+  Expected<ObjectProxy> createProxy(ArrayRef<ObjectRef> Refs, StringRef Data);
 
   /// Store object from StringRef.
   Expected<ObjectRef> storeFromString(ArrayRef<ObjectRef> Refs,
@@ -206,10 +206,10 @@ class ObjectStore {
   static Error createUnknownObjectError(const CASID &ID);
 
   /// Create ObjectProxy from CASID. If the object doesn't exist, get an error.
-  LLVM_ABI Expected<ObjectProxy> getProxy(const CASID &ID);
+  Expected<ObjectProxy> getProxy(const CASID &ID);
   /// Create ObjectProxy from ObjectRef. If the object can't be loaded, get an
   /// error.
-  LLVM_ABI Expected<ObjectProxy> getProxy(ObjectRef Ref);
+  Expected<ObjectProxy> getProxy(ObjectRef Ref);
 
   /// \returns \c std::nullopt if the object is missing from the CAS.
   Expected<std::optional<ObjectProxy>> getProxyIfExists(ObjectRef Ref);
@@ -251,8 +251,7 @@ class ObjectStore {
 
   /// Import object from another CAS. This will import the full tree from the
   /// other CAS.
-  LLVM_ABI Expected<ObjectRef> importObject(ObjectStore &Upstream,
-                                            ObjectRef Other);
+  Expected<ObjectRef> importObject(ObjectStore &Upstream, ObjectRef Other);
 
   /// Print the ObjectStore internals for debugging purpose.
   virtual void print(raw_ostream &) const {}
@@ -294,7 +293,7 @@ class ObjectProxy {
     return CAS->forEachRef(H, Callback);
   }
 
-  std::unique_ptr<MemoryBuffer>
+  LLVM_ABI std::unique_ptr<MemoryBuffer>
   getMemoryBuffer(StringRef Name = "",
                   bool RequiresNullTerminator = true) const;
 
@@ -334,7 +333,7 @@ class ObjectProxy {
 LLVM_ABI std::unique_ptr<ObjectStore> createInMemoryCAS();
 
 /// \returns true if \c LLVM_ENABLE_ONDISK_CAS configuration was enabled.
-bool isOnDiskCASEnabled();
+LLVM_ABI bool isOnDiskCASEnabled();
 
 /// Create a persistent on-disk path at \p Path.
 LLVM_ABI Expected<std::unique_ptr<ObjectStore>>
diff --git a/llvm/include/llvm/CAS/OnDiskDataAllocator.h b/llvm/include/llvm/CAS/OnDiskDataAllocator.h
index f4c8bcb05ce69..ffbefcff7f5ec 100644
--- a/llvm/include/llvm/CAS/OnDiskDataAllocator.h
+++ b/llvm/include/llvm/CAS/OnDiskDataAllocator.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/CAS/FileOffset.h"
 #include "llvm/CAS/OnDiskCASLogger.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm::cas {
@@ -66,7 +67,7 @@ class OnDiskDataAllocator {
 
   /// \returns the buffer that was allocated at \p create time, with size
   /// \p UserHeaderSize.
-  MutableArrayRef<uint8_t> getUserHeader() const;
+  LLVM_ABI MutableArrayRef<uint8_t> getUserHeader() const;
 
   LLVM_ABI_FOR_TEST size_t size() const;
   LLVM_ABI_FOR_TEST size_t capacity() const;
diff --git a/llvm/include/llvm/CAS/OnDiskGraphDB.h b/llvm/include/llvm/CAS/OnDiskGraphDB.h
index 64ad83440bc9c..6ff12cc6c6bd0 100644
--- a/llvm/include/llvm/CAS/OnDiskGraphDB.h
+++ b/llvm/include/llvm/CAS/OnDiskGraphDB.h
@@ -20,6 +20,7 @@
 #include "llvm/CAS/OnDiskCASLogger.h"
 #include "llvm/CAS/OnDiskDataAllocator.h"
 #include "llvm/CAS/OnDiskTrieRawHashMap.h"
+#include "llvm/Support/Compiler.h"
 #include <atomic>
 
 namespace llvm::cas::ondisk {
@@ -202,8 +203,8 @@ class ObjectHandle {
   explicit ObjectHandle(uint64_t Opaque) : Opaque(Opaque) {}
   uint64_t getOpaqueData() const { return Opaque; }
 
-  static ObjectHandle fromFileOffset(FileOffset Offset);
-  static ObjectHandle fromMemory(uintptr_t Ptr);
+  LLVM_ABI static ObjectHandle fromFileOffset(FileOffset Offset);
+  LLVM_ABI static ObjectHandle fromMemory(uintptr_t Ptr);
 
   friend bool operator==(const ObjectHandle &LHS, const ObjectHandle &RHS) {
     return LHS.Opaque == RHS.Opaque;
@@ -285,7 +286,7 @@ class OnDiskGraphDB {
 
   /// Check whether the object associated with \p Ref is stored in the CAS.
   /// Note that this function will fault-in according to the policy.
-  Expected<bool> isMaterialized(ObjectID Ref);
+  LLVM_ABI Expected<bool> isMaterialized(ObjectID Ref);
 
   /// Check whether the object associated with \p Ref is stored in the CAS.
   /// Note that this function does not fault-in.
@@ -324,9 +325,9 @@ class OnDiskGraphDB {
   /// \returns The precentage of space utilization of hard space limits.
   ///
   /// Return value is an integer between 0 and 100 for percentage.
-  unsigned getHardStorageLimitUtilization() const;
+  LLVM_ABI unsigned getHardStorageLimitUtilization() const;
 
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 
   /// Hashing function type for validation.
   using HashingFuncT = function_ref<void(
@@ -338,7 +339,7 @@ class OnDiskGraphDB {
   /// corruption in stored objects, otherwise just validate the structure of
   /// CAS database.
   /// \param Hasher is the hashing function used for objects inside CAS.
-  Error validate(bool Deep, HashingFuncT Hasher) const;
+  LLVM_ABI Error validate(bool Deep, HashingFuncT Hasher) const;
 
   /// Checks that \p ID exists in the index. It is allowed to not have data
   /// associated with it.
diff --git a/llvm/include/llvm/CAS/OnDiskTrieRawHashMap.h b/llvm/include/llvm/CAS/OnDiskTrieRawHashMap.h
index c6cfdd1f62f4d..a3906b419e653 100644
--- a/llvm/include/llvm/CAS/OnDiskTrieRawHashMap.h
+++ b/llvm/include/llvm/CAS/OnDiskTrieRawHashMap.h
@@ -21,6 +21,7 @@
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/CAS/FileOffset.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <optional>
 
@@ -53,8 +54,8 @@ class OnDiskCASLogger;
 ///   are only appropriate for local storage.
 class OnDiskTrieRawHashMap {
 public:
-  LLVM_DUMP_METHOD void dump() const;
-  void
+  LLVM_DUMP_METHOD LLVM_ABI void dump() const;
+  LLVM_ABI void
   print(raw_ostream &OS,
         function_ref<void(ArrayRef<char>)> PrintRecordData = nullptr) const;
 
diff --git a/llvm/include/llvm/CAS/UnifiedOnDiskCache.h b/llvm/include/llvm/CAS/UnifiedOnDiskCache.h
index 54dd8c0571735..1311a4e3c610d 100644
--- a/llvm/include/llvm/CAS/UnifiedOnDiskCache.h
+++ b/llvm/include/llvm/CAS/UnifiedOnDiskCache.h
@@ -11,6 +11,7 @@
 
 #include "llvm/CAS/OnDiskGraphDB.h"
 #include "llvm/CAS/ValidationResult.h"
+#include "llvm/Support/Compiler.h"
 #include <atomic>
 
 namespace llvm::cas::ondisk {
@@ -93,7 +94,7 @@ class UnifiedOnDiskCache {
   /// was invalid but has been cleared, \c Skipped if validation is not needed,
   /// or an \c Error if validation cannot be performed or if the data is left
   /// in an invalid state because \p AllowRecovery is false.
-  static Expected<ValidationResult>
+  LLVM_ABI static Expected<ValidationResult>
   validateIfNeeded(StringRef Path, StringRef HashName, unsigned HashByteSize,
                    bool CheckHash, OnDiskGraphDB::HashingFuncT HashFn,
                    bool AllowRecovery, bool ForceValidation,
@@ -141,7 +142,7 @@ class UnifiedOnDiskCache {
   collectGarbage(StringRef Path, ondisk::OnDiskCASLogger *Logger = nullptr);
 
   /// Remove unused data from the current UnifiedOnDiskCache.
-  Error collectGarbage();
+  LLVM_ABI Error collectGarbage();
 
   /// Helper function to convert the value stored in KeyValueDB and ObjectID.
   LLVM_ABI_FOR_TEST static ObjectID getObjectIDFromValue(ArrayRef<char> Value);
diff --git a/llvm/include/llvm/CGData/StableFunctionMap.h b/llvm/include/llvm/CGData/StableFunctionMap.h
index 96c03287df51f..50db26d31df37 100644
--- a/llvm/include/llvm/CGData/StableFunctionMap.h
+++ b/llvm/include/llvm/CGData/StableFunctionMap.h
@@ -138,7 +138,7 @@ struct StableFunctionMap {
   /// map is lazily loaded, it will deserialize the entries if it is not already
   /// done, other requests to the same hash at the same time will be blocked
   /// until the entries are deserialized.
-  const StableFunctionEntries &
+  LLVM_ABI const StableFunctionEntries &
   at(HashFuncsMapType::key_type FunctionHash) const;
 
   enum SizeType {
diff --git a/llvm/include/llvm/CodeGen/Analysis.h b/llvm/include/llvm/CodeGen/Analysis.h
index debbaa80bd2d2..66625fda458c6 100644
--- a/llvm/include/llvm/CodeGen/Analysis.h
+++ b/llvm/include/llvm/CodeGen/Analysis.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/CodeGen/ISDOpcodes.h"
 #include "llvm/IR/Instructions.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 template <typename T> class SmallVectorImpl;
@@ -44,10 +45,9 @@ struct EVT;
 /// \param CurIndex is the current index in the recursion.
 ///
 /// \returns \p CurIndex plus the linear index in \p Ty  the indices list.
-unsigned ComputeLinearIndex(Type *Ty,
-                            const unsigned *Indices,
-                            const unsigned *IndicesEnd,
-                            unsigned CurIndex = 0);
+LLVM_ABI unsigned ComputeLinearIndex(Type *Ty, const unsigned *Indices,
+                                     const unsigned *IndicesEnd,
+                                     unsigned CurIndex = 0);
 
 inline unsigned ComputeLinearIndex(Type *Ty,
                                    ArrayRef<unsigned> Indices,
@@ -57,10 +57,10 @@ inline unsigned ComputeLinearIndex(Type *Ty,
 
 /// Given an LLVM IR type, compute non-aggregate subtypes. Optionally also
 /// compute their offsets.
-void ComputeValueTypes(const DataLayout &DL, Type *Ty,
-                       SmallVectorImpl<Type *> &Types,
-                       SmallVectorImpl<TypeSize> *Offsets = nullptr,
-                       TypeSize StartingOffset = TypeSize::getZero());
+LLVM_ABI void ComputeValueTypes(const DataLayout &DL, Type *Ty,
+                                SmallVectorImpl<Type *> &Types,
+                                SmallVectorImpl<TypeSize> *Offsets = nullptr,
+                                TypeSize StartingOffset = TypeSize::getZero());
 
 /// ComputeValueVTs - Given an LLVM IR type, compute a sequence of
 /// EVTs that represent all the individual underlying
@@ -69,16 +69,16 @@ void ComputeValueTypes(const DataLayout &DL, Type *Ty,
 /// If Offsets is non-null, it points to a vector to be filled in
 /// with the in-memory offsets of each of the individual values.
 ///
-void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL, Type *Ty,
-                     SmallVectorImpl<EVT> &ValueVTs,
-                     SmallVectorImpl<EVT> *MemVTs = nullptr,
-                     SmallVectorImpl<TypeSize> *Offsets = nullptr,
-                     TypeSize StartingOffset = TypeSize::getZero());
-void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL, Type *Ty,
-                     SmallVectorImpl<EVT> &ValueVTs,
-                     SmallVectorImpl<EVT> *MemVTs,
-                     SmallVectorImpl<uint64_t> *FixedOffsets,
-                     uint64_t StartingOffset);
+LLVM_ABI void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL,
+                              Type *Ty, SmallVectorImpl<EVT> &ValueVTs,
+                              SmallVectorImpl<EVT> *MemVTs = nullptr,
+                              SmallVectorImpl<TypeSize> *Offsets = nullptr,
+                              TypeSize StartingOffset = TypeSize::getZero());
+LLVM_ABI void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL,
+                              Type *Ty, SmallVectorImpl<EVT> &ValueVTs,
+                              SmallVectorImpl<EVT> *MemVTs,
+                              SmallVectorImpl<uint64_t> *FixedOffsets,
+                              uint64_t StartingOffset);
 
 /// computeValueLLTs - Given an LLVM IR type, compute a sequence of
 /// LLTs that represent all the individual underlying
@@ -87,35 +87,35 @@ void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL, Type *Ty,
 /// If Offsets is non-null, it points to a vector to be filled in
 /// with the in-memory offsets of each of the individual values.
 ///
-void computeValueLLTs(const DataLayout &DL, Type &Ty,
-                      SmallVectorImpl<LLT> &ValueLLTs,
-                      SmallVectorImpl<TypeSize> *Offsets = nullptr,
-                      TypeSize StartingOffset = TypeSize::getZero());
-void computeValueLLTs(const DataLayout &DL, Type &Ty,
-                      SmallVectorImpl<LLT> &ValueLLTs,
-                      SmallVectorImpl<uint64_t> *FixedOffsets,
-                      uint64_t FixedStartingOffset = 0);
+LLVM_ABI void computeValueLLTs(const DataLayout &DL, Type &Ty,
+                               SmallVectorImpl<LLT> &ValueLLTs,
+                               SmallVectorImpl<TypeSize> *Offsets = nullptr,
+                               TypeSize StartingOffset = TypeSize::getZero());
+LLVM_ABI void computeValueLLTs(const DataLayout &DL, Type &Ty,
+                               SmallVectorImpl<LLT> &ValueLLTs,
+                               SmallVectorImpl<uint64_t> *FixedOffsets,
+                               uint64_t FixedStartingOffset = 0);
 
 /// ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
-GlobalValue *ExtractTypeInfo(Value *V);
+LLVM_ABI GlobalValue *ExtractTypeInfo(Value *V);
 
 /// getFCmpCondCode - Return the ISD condition code corresponding to
 /// the given LLVM IR floating-point condition code.  This includes
 /// consideration of global floating-point math flags.
 ///
-ISD::CondCode getFCmpCondCode(FCmpInst::Predicate Pred);
+LLVM_ABI ISD::CondCode getFCmpCondCode(FCmpInst::Predicate Pred);
 
 /// getFCmpCodeWithoutNaN - Given an ISD condition code comparing floats,
 /// return the equivalent code if we're allowed to assume that NaNs won't occur.
-ISD::CondCode getFCmpCodeWithoutNaN(ISD::CondCode CC);
+LLVM_ABI ISD::CondCode getFCmpCodeWithoutNaN(ISD::CondCode CC);
 
 /// getICmpCondCode - Return the ISD condition code corresponding to
 /// the given LLVM IR integer condition code.
-ISD::CondCode getICmpCondCode(ICmpInst::Predicate Pred);
+LLVM_ABI ISD::CondCode getICmpCondCode(ICmpInst::Predicate Pred);
 
 /// getICmpCondCode - Return the LLVM IR integer condition code
 /// corresponding to the given ISD integer condition code.
-ICmpInst::Predicate getICmpCondCode(ISD::CondCode Pred);
+LLVM_ABI ICmpInst::Predicate getICmpCondCode(ISD::CondCode Pred);
 
 /// Test if the given instruction is in a position to be optimized
 /// with a tail-call. This roughly means that it's in a block with
@@ -123,8 +123,9 @@ ICmpInst::Predicate getICmpCondCode(ISD::CondCode Pred);
 /// between it and the return.
 ///
 /// This function only tests target-independent requirements.
-bool isInTailCallPosition(const CallBase &Call, const TargetMachine &TM,
-                          bool ReturnsFirstArg = false);
+LLVM_ABI bool isInTailCallPosition(const CallBase &Call,
+                                   const TargetMachine &TM,
+                                   bool ReturnsFirstArg = false);
 
 /// Test if given that the input instruction is in the tail call position, if
 /// there is an attribute mismatch between the caller and the callee that will
@@ -132,24 +133,25 @@ bool isInTailCallPosition(const CallBase &Call, const TargetMachine &TM,
 /// \p AllowDifferingSizes is an output parameter which, if forming a tail call
 /// is permitted, determines whether it's permitted only if the size of the
 /// caller's and callee's return types match exactly.
-bool attributesPermitTailCall(const Function *F, const Instruction *I,
-                              const ReturnInst *Ret,
-                              const TargetLoweringBase &TLI,
-                              bool *AllowDifferingSizes = nullptr);
+LLVM_ABI bool attributesPermitTailCall(const Function *F, const Instruction *I,
+                                       const ReturnInst *Ret,
+                                       const TargetLoweringBase &TLI,
+                                       bool *AllowDifferingSizes = nullptr);
 
 /// Test if given that the input instruction is in the tail call position if the
 /// return type or any attributes of the function will inhibit tail call
 /// optimization.
-bool returnTypeIsEligibleForTailCall(const Function *F, const Instruction *I,
-                                     const ReturnInst *Ret,
-                                     const TargetLoweringBase &TLI,
-                                     bool ReturnsFirstArg = false);
+LLVM_ABI bool returnTypeIsEligibleForTailCall(const Function *F,
+                                              const Instruction *I,
+                                              const ReturnInst *Ret,
+                                              const TargetLoweringBase &TLI,
+                                              bool ReturnsFirstArg = false);
 
 /// Returns true if the parent of \p CI returns CI's first argument after
 /// calling \p CI.
-bool funcReturnsFirstArgOfCall(const CallInst &CI);
+LLVM_ABI bool funcReturnsFirstArgOfCall(const CallInst &CI);
 
-DenseMap<const MachineBasicBlock *, int>
+LLVM_ABI DenseMap<const MachineBasicBlock *, int>
 getEHScopeMembership(const MachineFunction &MF);
 
 } // End llvm namespace
diff --git a/llvm/include/llvm/CodeGen/AntiDepBreaker.h b/llvm/include/llvm/CodeGen/AntiDepBreaker.h
index d8977eec556b4..7862db0e17f62 100644
--- a/llvm/include/llvm/CodeGen/AntiDepBreaker.h
+++ b/llvm/include/llvm/CodeGen/AntiDepBreaker.h
@@ -28,7 +28,7 @@ class RegisterClassInfo;
 
 /// This class works in conjunction with the post-RA scheduler to rename
 /// registers to break register anti-dependencies (WAR hazards).
-class AntiDepBreaker {
+class LLVM_ABI AntiDepBreaker {
 public:
   using DbgValueVector =
       std::vector<std::pair<MachineInstr *, MachineInstr *>>;
@@ -90,12 +90,13 @@ class AntiDepBreaker {
   }
 };
 
-AntiDepBreaker *createAggressiveAntiDepBreaker(
+LLVM_ABI AntiDepBreaker *createAggressiveAntiDepBreaker(
     MachineFunction &MFi, const RegisterClassInfo &RCI,
     TargetSubtargetInfo::RegClassVector &CriticalPathRCs);
 
-AntiDepBreaker *createCriticalAntiDepBreaker(MachineFunction &MFi,
-                                             const RegisterClassInfo &RCI);
+LLVM_ABI AntiDepBreaker *
+createCriticalAntiDepBreaker(MachineFunction &MFi,
+                             const RegisterClassInfo &RCI);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/AssignmentTrackingAnalysis.h b/llvm/include/llvm/CodeGen/AssignmentTrackingAnalysis.h
index fb0ecd828b68f..2a80ff8f93567 100644
--- a/llvm/include/llvm/CodeGen/AssignmentTrackingAnalysis.h
+++ b/llvm/include/llvm/CodeGen/AssignmentTrackingAnalysis.h
@@ -14,6 +14,7 @@
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Instruction;
@@ -92,13 +93,13 @@ class FunctionVarLocs {
   }
   ///@}
 
-  void print(raw_ostream &OS, const Function &Fn) const;
+  LLVM_ABI void print(raw_ostream &OS, const Function &Fn) const;
 
   ///@{
   /// Non-const methods used by AssignmentTrackingAnalysis (which invalidate
   /// analysis results if called incorrectly).
-  void init(FunctionVarLocsBuilder &Builder);
-  void clear();
+  LLVM_ABI void init(FunctionVarLocsBuilder &Builder);
+  LLVM_ABI void clear();
   ///@}
 };
 
@@ -109,7 +110,7 @@ class DebugAssignmentTrackingAnalysis
 
 public:
   using Result = FunctionVarLocs;
-  Result run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI Result run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 class DebugAssignmentTrackingPrinterPass
@@ -118,10 +119,10 @@ class DebugAssignmentTrackingPrinterPass
 
 public:
   DebugAssignmentTrackingPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
-class AssignmentTrackingAnalysis : public FunctionPass {
+class LLVM_ABI AssignmentTrackingAnalysis : public FunctionPass {
   std::unique_ptr<FunctionVarLocs> Results;
 
 public:
diff --git a/llvm/include/llvm/CodeGen/AtomicExpand.h b/llvm/include/llvm/CodeGen/AtomicExpand.h
index 34f520f462e96..3cd149187c4d4 100644
--- a/llvm/include/llvm/CodeGen/AtomicExpand.h
+++ b/llvm/include/llvm/CodeGen/AtomicExpand.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_ATOMICEXPAND_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,7 +23,7 @@ class AtomicExpandPass : public PassInfoMixin<AtomicExpandPass> {
 
 public:
   AtomicExpandPass(const TargetMachine &TM) : TM(&TM) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/AtomicExpandUtils.h b/llvm/include/llvm/CodeGen/AtomicExpandUtils.h
index 3a7eda68cdc27..fdbd95649e60a 100644
--- a/llvm/include/llvm/CodeGen/AtomicExpandUtils.h
+++ b/llvm/include/llvm/CodeGen/AtomicExpandUtils.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/Support/AtomicOrdering.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -57,7 +58,8 @@ using CreateCmpXchgInstFun = function_ref<void(
 ///     [...]
 ///
 /// Returns true if the containing function was modified.
-bool expandAtomicRMWToCmpXchg(AtomicRMWInst *AI, CreateCmpXchgInstFun CreateCmpXchg);
+LLVM_ABI bool expandAtomicRMWToCmpXchg(AtomicRMWInst *AI,
+                                       CreateCmpXchgInstFun CreateCmpXchg);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/BasicBlockMatchingAndInference.h b/llvm/include/llvm/CodeGen/BasicBlockMatchingAndInference.h
index 6e9bbb969a445..666e14754acb8 100644
--- a/llvm/include/llvm/CodeGen/BasicBlockMatchingAndInference.h
+++ b/llvm/include/llvm/CodeGen/BasicBlockMatchingAndInference.h
@@ -15,11 +15,12 @@
 
 #include "llvm/CodeGen/BasicBlockSectionsProfileReader.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Utils/SampleProfileInference.h"
 
 namespace llvm {
 
-class BasicBlockMatchingAndInference : public MachineFunctionPass {
+class LLVM_ABI BasicBlockMatchingAndInference : public MachineFunctionPass {
 private:
   using Edge = std::pair<const MachineBasicBlock *, const MachineBasicBlock *>;
   using BlockWeightMap = DenseMap<const MachineBasicBlock *, uint64_t>;
diff --git a/llvm/include/llvm/CodeGen/BasicBlockSectionUtils.h b/llvm/include/llvm/CodeGen/BasicBlockSectionUtils.h
index 292abf8b2b516..a25eda5fceb98 100644
--- a/llvm/include/llvm/CodeGen/BasicBlockSectionUtils.h
+++ b/llvm/include/llvm/CodeGen/BasicBlockSectionUtils.h
@@ -11,10 +11,11 @@
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
-extern cl::opt<std::string> BBSectionsColdTextPrefix;
+extern LLVM_ABI cl::opt<std::string> BBSectionsColdTextPrefix;
 
 class MachineFunction;
 class MachineBasicBlock;
@@ -22,10 +23,11 @@ class MachineBasicBlock;
 using MachineBasicBlockComparator =
     function_ref<bool(const MachineBasicBlock &, const MachineBasicBlock &)>;
 
-void sortBasicBlocksAndUpdateBranches(MachineFunction &MF,
-                                      MachineBasicBlockComparator MBBCmp);
+LLVM_ABI void
+sortBasicBlocksAndUpdateBranches(MachineFunction &MF,
+                                 MachineBasicBlockComparator MBBCmp);
 
-void avoidZeroOffsetLandingPad(MachineFunction &MF);
+LLVM_ABI void avoidZeroOffsetLandingPad(MachineFunction &MF);
 
 /// This checks if the source of this function has drifted since this binary was
 /// profiled previously.
@@ -34,7 +36,7 @@ void avoidZeroOffsetLandingPad(MachineFunction &MF);
 /// checks if the hash has changed.  Advanced basic block layout is usually done
 /// on top of PGO optimized binaries and hence this check works well in
 /// practice.
-bool hasInstrProfHashMismatch(MachineFunction &MF);
+LLVM_ABI bool hasInstrProfHashMismatch(MachineFunction &MF);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h b/llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h
index b28a55e5be28c..ab710adfac310 100644
--- a/llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h
+++ b/llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h
@@ -23,6 +23,7 @@
 #include "llvm/IR/PassManager.h"
 #include "llvm/InitializePasses.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/LineIterator.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -114,19 +115,19 @@ class BasicBlockSectionsProfileReader {
 
   // Returns true if function \p FuncName is hot based on the basic block
   // section profile.
-  bool isFunctionHot(StringRef FuncName) const;
+  LLVM_ABI bool isFunctionHot(StringRef FuncName) const;
 
   // Returns the cluster info for the function \p FuncName. Returns an empty
   // vector if function has no cluster info.
-  SmallVector<BBClusterInfo>
+  LLVM_ABI SmallVector<BBClusterInfo>
   getClusterInfoForFunction(StringRef FuncName) const;
 
   // Returns the path clonings for the given function.
-  SmallVector<SmallVector<unsigned>>
+  LLVM_ABI SmallVector<SmallVector<unsigned>>
   getClonePathsForFunction(StringRef FuncName) const;
 
-  uint64_t getEdgeCount(StringRef FuncName, const UniqueBBID &SrcBBID,
-                        const UniqueBBID &DestBBID) const;
+  LLVM_ABI uint64_t getEdgeCount(StringRef FuncName, const UniqueBBID &SrcBBID,
+                                 const UniqueBBID &DestBBID) const;
 
   // Returns a pointer to the CFGProfile for the function \p FuncName.
   // Returns nullptr if no profile data is available for the function.
@@ -139,7 +140,7 @@ class BasicBlockSectionsProfileReader {
 
   // Returns the prefetch targets (identified by their containing callsite IDs)
   // for function `FuncName`.
-  SmallVector<CallsiteID>
+  LLVM_ABI SmallVector<CallsiteID>
   getPrefetchTargetsForFunction(StringRef FuncName) const;
 
 private:
@@ -196,7 +197,7 @@ class BasicBlockSectionsProfileReader {
 // Creates a BasicBlockSectionsProfileReader pass to parse the basic block
 // sections profile. \p Buf is a memory buffer that contains the list of
 // functions and basic block ids to selectively enable basic block sections.
-ImmutablePass *
+LLVM_ABI ImmutablePass *
 createBasicBlockSectionsProfileReaderWrapperPass(const MemoryBuffer *Buf);
 
 /// Analysis pass providing the \c BasicBlockSectionsProfileReader.
@@ -207,17 +208,18 @@ class BasicBlockSectionsProfileReaderAnalysis
     : public AnalysisInfoMixin<BasicBlockSectionsProfileReaderAnalysis> {
 
 public:
-  static AnalysisKey Key;
+  LLVM_ABI static AnalysisKey Key;
   typedef BasicBlockSectionsProfileReader Result;
   BasicBlockSectionsProfileReaderAnalysis(const TargetMachine &TM) : TM(&TM) {}
 
-  Result run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI Result run(Function &F, FunctionAnalysisManager &AM);
 
 private:
   const TargetMachine *TM;
 };
 
-class BasicBlockSectionsProfileReaderWrapperPass : public ImmutablePass {
+class LLVM_ABI BasicBlockSectionsProfileReaderWrapperPass
+    : public ImmutablePass {
 public:
   static char ID;
   BasicBlockSectionsProfileReader BBSPR;
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index c430e11168f73..0fc5cc4ea3e3c 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -46,6 +46,7 @@
 #include "llvm/IR/Value.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Target/TargetMachine.h"
@@ -67,7 +68,7 @@ class ScalarEvolution;
 class SCEV;
 class TargetMachine;
 
-extern cl::opt<unsigned> PartialUnrollingThreshold;
+extern LLVM_ABI cl::opt<unsigned> PartialUnrollingThreshold;
 
 /// Base class which can be used to help build a TTI implementation.
 ///
@@ -3397,7 +3398,7 @@ class BasicTTIImpl : public BasicTTIImplBase<BasicTTIImpl> {
   const TargetLoweringBase *getTLI() const { return TLI; }
 
 public:
-  explicit BasicTTIImpl(const TargetMachine *TM, const Function &F);
+  LLVM_ABI explicit BasicTTIImpl(const TargetMachine *TM, const Function &F);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/BranchFoldingPass.h b/llvm/include/llvm/CodeGen/BranchFoldingPass.h
index ae07be28c5962..1627feafe7ff0 100644
--- a/llvm/include/llvm/CodeGen/BranchFoldingPass.h
+++ b/llvm/include/llvm/CodeGen/BranchFoldingPass.h
@@ -9,6 +9,7 @@
 #define LLVM_CODEGEN_BRANCHFOLDINGPASS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -17,8 +18,8 @@ class BranchFolderPass : public PassInfoMixin<BranchFolderPass> {
 
 public:
   BranchFolderPass(bool EnableTailMerge) : EnableTailMerge(EnableTailMerge) {}
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setNoPHIs();
diff --git a/llvm/include/llvm/CodeGen/BranchRelaxation.h b/llvm/include/llvm/CodeGen/BranchRelaxation.h
index 2007cf05b3aa1..9529a711f601a 100644
--- a/llvm/include/llvm/CodeGen/BranchRelaxation.h
+++ b/llvm/include/llvm/CodeGen/BranchRelaxation.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_BRANCHRELAXATION_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class BranchRelaxationPass : public PassInfoMixin<BranchRelaxationPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/CFIFixup.h b/llvm/include/llvm/CodeGen/CFIFixup.h
index d3e4131e3551d..5bf687dddd197 100644
--- a/llvm/include/llvm/CodeGen/CFIFixup.h
+++ b/llvm/include/llvm/CodeGen/CFIFixup.h
@@ -16,9 +16,10 @@
 
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/InitializePasses.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
-class CFIFixup : public MachineFunctionPass {
+class LLVM_ABI CFIFixup : public MachineFunctionPass {
 public:
   static char ID;
 
diff --git a/llvm/include/llvm/CodeGen/CalcSpillWeights.h b/llvm/include/llvm/CodeGen/CalcSpillWeights.h
index 11d1c16561507..ed754b197c000 100644
--- a/llvm/include/llvm/CodeGen/CalcSpillWeights.h
+++ b/llvm/include/llvm/CodeGen/CalcSpillWeights.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_CALCSPILLWEIGHTS_H
 
 #include "llvm/CodeGen/SlotIndexes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -65,31 +66,32 @@ class VirtRegMap;
     virtual ~VirtRegAuxInfo() = default;
 
     /// (re)compute li's spill weight and allocation hint.
-    void calculateSpillWeightAndHint(LiveInterval &LI);
+    LLVM_ABI void calculateSpillWeightAndHint(LiveInterval &LI);
 
     /// Compute spill weights and allocation hints for all virtual register
     /// live intervals.
-    void calculateSpillWeightsAndHints();
+    LLVM_ABI void calculateSpillWeightsAndHints();
 
     /// Return the preferred allocation register for reg, given a COPY
     /// instruction.
-    static Register copyHint(const MachineInstr *MI, Register Reg,
-                             const TargetRegisterInfo &TRI,
-                             const MachineRegisterInfo &MRI);
+    LLVM_ABI static Register copyHint(const MachineInstr *MI, Register Reg,
+                                      const TargetRegisterInfo &TRI,
+                                      const MachineRegisterInfo &MRI);
 
     /// Determine if all values in LI are rematerializable.
-    static bool isRematerializable(const LiveInterval &LI,
-                                   const LiveIntervals &LIS,
-                                   const VirtRegMap &VRM,
-                                   const MachineRegisterInfo &MRI,
-                                   const TargetInstrInfo &TII);
+    LLVM_ABI static bool isRematerializable(const LiveInterval &LI,
+                                            const LiveIntervals &LIS,
+                                            const VirtRegMap &VRM,
+                                            const MachineRegisterInfo &MRI,
+                                            const TargetInstrInfo &TII);
 
     /// \returns true if all registers used by \p MI are also available with the
     /// same value at \p UseIdx.
-    static bool allUsesAvailableAt(const MachineInstr *MI, SlotIndex UseIdx,
-                                   const LiveIntervals &LIS,
-                                   const MachineRegisterInfo &MRI,
-                                   const TargetInstrInfo &TII);
+    LLVM_ABI static bool allUsesAvailableAt(const MachineInstr *MI,
+                                            SlotIndex UseIdx,
+                                            const LiveIntervals &LIS,
+                                            const MachineRegisterInfo &MRI,
+                                            const TargetInstrInfo &TII);
 
   protected:
     /// Helper function for weight calculations.
@@ -104,8 +106,9 @@ class VirtRegMap;
     ///               after end will not affect the weight. Relevant for
     ///               weight calculation of future split artifact.
     /// \return The spill weight. Returns negative weight for unspillable LI.
-    float weightCalcHelper(LiveInterval &LI, SlotIndex *Start = nullptr,
-                           SlotIndex *End = nullptr);
+    LLVM_ABI float weightCalcHelper(LiveInterval &LI,
+                                    SlotIndex *Start = nullptr,
+                                    SlotIndex *End = nullptr);
 
     /// Weight normalization function.
     virtual float normalize(float UseDefFreq, unsigned Size,
diff --git a/llvm/include/llvm/CodeGen/CallBrPrepare.h b/llvm/include/llvm/CodeGen/CallBrPrepare.h
index d44d30b0adc17..867abfbc777e3 100644
--- a/llvm/include/llvm/CodeGen/CallBrPrepare.h
+++ b/llvm/include/llvm/CodeGen/CallBrPrepare.h
@@ -10,12 +10,13 @@
 #define LLVM_CODEGEN_CALLBRPREPARE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class CallBrPreparePass : public PassInfoMixin<CallBrPreparePass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/CodeGenCommonISel.h b/llvm/include/llvm/CodeGen/CodeGenCommonISel.h
index 4c22be9450786..1d6b74e8e4d5b 100644
--- a/llvm/include/llvm/CodeGen/CodeGenCommonISel.h
+++ b/llvm/include/llvm/CodeGen/CodeGenCommonISel.h
@@ -15,6 +15,7 @@
 #define LLVM_CODEGEN_CODEGENCOMMONISEL_H
 
 #include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 namespace llvm {
 
@@ -192,10 +193,9 @@ class StackProtectorDescriptor {
   /// Add a successor machine basic block to ParentMBB. If the successor mbb
   /// has not been created yet (i.e. if SuccMBB = 0), then the machine basic
   /// block will be created. Assign a large weight if IsLikely is true.
-  MachineBasicBlock *addSuccessorMBB(const BasicBlock *BB,
-                                     MachineBasicBlock *ParentMBB,
-                                     bool IsLikely,
-                                     MachineBasicBlock *SuccMBB = nullptr);
+  LLVM_ABI MachineBasicBlock *
+  addSuccessorMBB(const BasicBlock *BB, MachineBasicBlock *ParentMBB,
+                  bool IsLikely, MachineBasicBlock *SuccMBB = nullptr);
 };
 
 /// Find the split point at which to splice the end of BB into its success stack
@@ -211,7 +211,7 @@ class StackProtectorDescriptor {
 /// terminator sequence so that we can ensure that we splice off not just the
 /// terminator, but additionally the copies that move the vregs into the
 /// physical registers.
-MachineBasicBlock::iterator
+LLVM_ABI MachineBasicBlock::iterator
 findSplitPointForStackProtector(MachineBasicBlock *BB,
                                 const TargetInstrInfo &TII);
 
@@ -225,13 +225,13 @@ findSplitPointForStackProtector(MachineBasicBlock *BB,
 ///
 /// \returns The inverted test, or fcNone, if inversion does not produce a
 /// simpler test.
-FPClassTest invertFPClassTestIfSimpler(FPClassTest Test, bool UseFCmp);
+LLVM_ABI FPClassTest invertFPClassTestIfSimpler(FPClassTest Test, bool UseFCmp);
 
 /// Assuming the instruction \p MI is going to be deleted, attempt to salvage
 /// debug users of \p MI by writing the effect of \p MI in a DIExpression.
-void salvageDebugInfoForDbgValue(const MachineRegisterInfo &MRI,
-                                 MachineInstr &MI,
-                                 ArrayRef<MachineOperand *> DbgUsers);
+LLVM_ABI void salvageDebugInfoForDbgValue(const MachineRegisterInfo &MRI,
+                                          MachineInstr &MI,
+                                          ArrayRef<MachineOperand *> DbgUsers);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/CodeGenPrepare.h b/llvm/include/llvm/CodeGen/CodeGenPrepare.h
index e673d0f5831a0..852f98ed05ee9 100644
--- a/llvm/include/llvm/CodeGen/CodeGenPrepare.h
+++ b/llvm/include/llvm/CodeGen/CodeGenPrepare.h
@@ -15,6 +15,7 @@
 #define LLVM_CODEGEN_PREPARE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,7 +28,7 @@ class CodeGenPreparePass : public PassInfoMixin<CodeGenPreparePass> {
 
 public:
   CodeGenPreparePass(const TargetMachine &TM) : TM(&TM) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/ComplexDeinterleavingPass.h b/llvm/include/llvm/CodeGen/ComplexDeinterleavingPass.h
index 7b74f2a8cadc0..b216380b19392 100644
--- a/llvm/include/llvm/CodeGen/ComplexDeinterleavingPass.h
+++ b/llvm/include/llvm/CodeGen/ComplexDeinterleavingPass.h
@@ -15,6 +15,7 @@
 #define LLVM_CODEGEN_COMPLEXDEINTERLEAVING_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -29,7 +30,7 @@ struct ComplexDeinterleavingPass
 public:
   ComplexDeinterleavingPass(const TargetMachine &TM) : TM(&TM) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 enum class ComplexDeinterleavingOperation {
diff --git a/llvm/include/llvm/CodeGen/DFAPacketizer.h b/llvm/include/llvm/CodeGen/DFAPacketizer.h
index a7a2dfdf09506..730bcf625e9c1 100644
--- a/llvm/include/llvm/CodeGen/DFAPacketizer.h
+++ b/llvm/include/llvm/CodeGen/DFAPacketizer.h
@@ -29,6 +29,7 @@
 #include "llvm/CodeGen/ScheduleDAGInstrs.h"
 #include "llvm/CodeGen/ScheduleDAGMutation.h"
 #include "llvm/Support/Automaton.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <map>
 #include <memory>
@@ -48,7 +49,7 @@ class TargetInstrInfo;
 
 // This class extends ScheduleDAGInstrs and overrides the schedule method
 // to build the dependence graph.
-class DefaultVLIWScheduler : public ScheduleDAGInstrs {
+class LLVM_ABI DefaultVLIWScheduler : public ScheduleDAGInstrs {
 private:
   AAResults *AA;
   /// Ordered list of DAG postprocessing steps.
@@ -100,19 +101,19 @@ class DFAPacketizer {
 
   // Check if the resources occupied by a MCInstrDesc are available in
   // the current state.
-  bool canReserveResources(const MCInstrDesc *MID);
+  LLVM_ABI bool canReserveResources(const MCInstrDesc *MID);
 
   // Reserve the resources occupied by a MCInstrDesc and change the current
   // state to reflect that change.
-  void reserveResources(const MCInstrDesc *MID);
+  LLVM_ABI void reserveResources(const MCInstrDesc *MID);
 
   // Check if the resources occupied by a machine instruction are available
   // in the current state.
-  bool canReserveResources(MachineInstr &MI);
+  LLVM_ABI bool canReserveResources(MachineInstr &MI);
 
   // Reserve the resources occupied by a machine instruction and change the
   // current state to reflect that change.
-  void reserveResources(MachineInstr &MI);
+  LLVM_ABI void reserveResources(MachineInstr &MI);
 
   // Return the resources used by the InstIdx'th instruction added to this
   // packet. The resources are returned as a bitvector of functional units.
@@ -121,7 +122,7 @@ class DFAPacketizer {
   // returns one arbitary valid packing.
   //
   // Requires setTrackResources(true) to have been called.
-  unsigned getUsedResources(unsigned InstIdx);
+  LLVM_ABI unsigned getUsedResources(unsigned InstIdx);
 
   const InstrItineraryData *getInstrItins() const { return InstrItins; }
 };
@@ -133,7 +134,7 @@ class DFAPacketizer {
 // in the current packet. If no dependency is found, I is added to current
 // packet and the machine resource is marked as taken. If any dependency is
 // found, a target API call is made to prune the dependence.
-class VLIWPacketizerList {
+class LLVM_ABI VLIWPacketizerList {
 protected:
   MachineFunction &MF;
   const TargetInstrInfo *TII;
diff --git a/llvm/include/llvm/CodeGen/DbgEntityHistoryCalculator.h b/llvm/include/llvm/CodeGen/DbgEntityHistoryCalculator.h
index 7708df725180b..03e300533728a 100644
--- a/llvm/include/llvm/CodeGen/DbgEntityHistoryCalculator.h
+++ b/llvm/include/llvm/CodeGen/DbgEntityHistoryCalculator.h
@@ -13,6 +13,7 @@
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/Support/Compiler.h"
 #include <utility>
 
 namespace llvm {
@@ -29,12 +30,12 @@ class TargetRegisterInfo;
 /// calling initialize.
 class InstructionOrdering {
 public:
-  void initialize(const MachineFunction &MF);
+  LLVM_ABI void initialize(const MachineFunction &MF);
   void clear() { InstNumberMap.clear(); }
 
   /// Check if instruction \p A comes before \p B, where \p A and \p B both
   /// belong to the MachineFunction passed to initialize().
-  bool isBefore(const MachineInstr *A, const MachineInstr *B) const;
+  LLVM_ABI bool isBefore(const MachineInstr *A, const MachineInstr *B) const;
 
 private:
   /// Each instruction is assigned an order number.
@@ -86,7 +87,7 @@ class DbgValueHistoryMap {
     bool isDbgValue() const { return getEntryKind() == DbgValue; }
     bool isClosed() const { return EndIndex != NoEntry; }
 
-    void endEntry(EntryIndex EndIndex);
+    LLVM_ABI void endEntry(EntryIndex EndIndex);
 
   private:
     PointerIntPair<const MachineInstr *, 1, EntryKind> Instr;
@@ -100,9 +101,9 @@ class DbgValueHistoryMap {
   EntriesMap VarEntries;
 
 public:
-  bool startDbgValue(InlinedEntity Var, const MachineInstr &MI,
-                     EntryIndex &NewIndex);
-  EntryIndex startClobber(InlinedEntity Var, const MachineInstr &MI);
+  LLVM_ABI bool startDbgValue(InlinedEntity Var, const MachineInstr &MI,
+                              EntryIndex &NewIndex);
+  LLVM_ABI EntryIndex startClobber(InlinedEntity Var, const MachineInstr &MI);
 
   Entry &getEntry(InlinedEntity Var, EntryIndex Index) {
     auto &Entries = VarEntries[Var];
@@ -111,11 +112,12 @@ class DbgValueHistoryMap {
 
   /// Test whether a vector of entries features any non-empty locations. It
   /// could have no entries, or only DBG_VALUE $noreg entries.
-  bool hasNonEmptyLocation(const Entries &Entries) const;
+  LLVM_ABI bool hasNonEmptyLocation(const Entries &Entries) const;
 
   /// Drop location ranges which exist entirely outside each variable's scope.
-  void trimLocationRanges(const MachineFunction &MF, LexicalScopes &LScopes,
-                          const InstructionOrdering &Ordering);
+  LLVM_ABI void trimLocationRanges(const MachineFunction &MF,
+                                   LexicalScopes &LScopes,
+                                   const InstructionOrdering &Ordering);
   bool empty() const { return VarEntries.empty(); }
   void clear() { VarEntries.clear(); }
   EntriesMap::const_iterator begin() const { return VarEntries.begin(); }
@@ -138,7 +140,7 @@ class DbgLabelInstrMap {
   InstrMap LabelInstr;
 
 public:
-  void  addInstr(InlinedEntity Label, const MachineInstr &MI);
+  LLVM_ABI void addInstr(InlinedEntity Label, const MachineInstr &MI);
 
   bool empty() const { return LabelInstr.empty(); }
   void clear() { LabelInstr.clear(); }
@@ -146,10 +148,10 @@ class DbgLabelInstrMap {
   InstrMap::const_iterator end() const { return LabelInstr.end(); }
 };
 
-void calculateDbgEntityHistory(const MachineFunction *MF,
-                               const TargetRegisterInfo *TRI,
-                               DbgValueHistoryMap &DbgValues,
-                               DbgLabelInstrMap &DbgLabels);
+LLVM_ABI void calculateDbgEntityHistory(const MachineFunction *MF,
+                                        const TargetRegisterInfo *TRI,
+                                        DbgValueHistoryMap &DbgValues,
+                                        DbgLabelInstrMap &DbgLabels);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/DeadMachineInstructionElim.h b/llvm/include/llvm/CodeGen/DeadMachineInstructionElim.h
index 56cfa1e087181..3607e45c6b66a 100644
--- a/llvm/include/llvm/CodeGen/DeadMachineInstructionElim.h
+++ b/llvm/include/llvm/CodeGen/DeadMachineInstructionElim.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_DEADMACHINEINSTRUCTIONELIM_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class DeadMachineInstructionElimPass
     : public PassInfoMixin<DeadMachineInstructionElimPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/DebugHandlerBase.h b/llvm/include/llvm/CodeGen/DebugHandlerBase.h
index e72801b6caf34..0b6c30b2daa4a 100644
--- a/llvm/include/llvm/CodeGen/DebugHandlerBase.h
+++ b/llvm/include/llvm/CodeGen/DebugHandlerBase.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/LexicalScopes.h"
 #include "llvm/IR/DebugInfoMetadata.h"
 #include "llvm/IR/DebugLoc.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
@@ -44,13 +45,13 @@ struct DbgVariableLocation {
   /// and the associated DIExpression is in one of the supported forms.
   /// If these requirements are not met, the returned Optional will not
   /// have a value.
-  static std::optional<DbgVariableLocation>
+  LLVM_ABI static std::optional<DbgVariableLocation>
   extractFromMachineInstruction(const MachineInstr &Instruction);
 };
 
 /// Base class for debug information backends. Common functionality related to
 /// tracking which variables and scopes are alive at a given PC live here.
-class DebugHandlerBase : public AsmPrinterHandler {
+class LLVM_ABI DebugHandlerBase : public AsmPrinterHandler {
 protected:
   DebugHandlerBase(AsmPrinter *A);
 
diff --git a/llvm/include/llvm/CodeGen/DetectDeadLanes.h b/llvm/include/llvm/CodeGen/DetectDeadLanes.h
index 5efe65962cf07..07187f98d53dd 100644
--- a/llvm/include/llvm/CodeGen/DetectDeadLanes.h
+++ b/llvm/include/llvm/CodeGen/DetectDeadLanes.h
@@ -31,6 +31,7 @@
 #include "llvm/ADT/BitVector.h"
 #include "llvm/CodeGen/MachinePassManager.h"
 #include "llvm/MC/LaneBitmask.h"
+#include "llvm/Support/Compiler.h"
 #include <deque>
 
 namespace llvm {
@@ -50,11 +51,11 @@ class DeadLaneDetector {
     LaneBitmask DefinedLanes;
   };
 
-  DeadLaneDetector(const MachineRegisterInfo *MRI,
-                   const TargetRegisterInfo *TRI);
+  LLVM_ABI DeadLaneDetector(const MachineRegisterInfo *MRI,
+                            const TargetRegisterInfo *TRI);
 
   /// Update the \p DefinedLanes and the \p UsedLanes for all virtual registers.
-  void computeSubRegisterLaneBitInfo();
+  LLVM_ABI void computeSubRegisterLaneBitInfo();
 
   const VRegInfo &getVRegInfo(unsigned RegIdx) const {
     return VRegInfos[RegIdx];
@@ -85,13 +86,15 @@ class DeadLaneDetector {
   /// Given a mask \p DefinedLanes of lanes defined at operand \p OpNum
   /// of COPY-like instruction, determine which lanes are defined at the output
   /// operand \p Def.
-  LaneBitmask transferDefinedLanes(const MachineOperand &Def, unsigned OpNum,
-                                   LaneBitmask DefinedLanes) const;
+  LLVM_ABI LaneBitmask transferDefinedLanes(const MachineOperand &Def,
+                                            unsigned OpNum,
+                                            LaneBitmask DefinedLanes) const;
 
   /// Given a mask \p UsedLanes used from the output of instruction \p MI
   /// determine which lanes are used from operand \p MO of this instruction.
-  LaneBitmask transferUsedLanes(const MachineInstr &MI, LaneBitmask UsedLanes,
-                                const MachineOperand &MO) const;
+  LLVM_ABI LaneBitmask transferUsedLanes(const MachineInstr &MI,
+                                         LaneBitmask UsedLanes,
+                                         const MachineOperand &MO) const;
 
 private:
   LaneBitmask determineInitialDefinedLanes(Register Reg);
@@ -118,8 +121,8 @@ class DeadLaneDetector {
 
 class DetectDeadLanesPass : public PassInfoMixin<DetectDeadLanesPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/DwarfEHPrepare.h b/llvm/include/llvm/CodeGen/DwarfEHPrepare.h
index 5b68b8cf83eb4..30cb6a7367210 100644
--- a/llvm/include/llvm/CodeGen/DwarfEHPrepare.h
+++ b/llvm/include/llvm/CodeGen/DwarfEHPrepare.h
@@ -15,6 +15,7 @@
 #define LLVM_CODEGEN_DWARFEHPREPARE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,7 +26,7 @@ class DwarfEHPreparePass : public PassInfoMixin<DwarfEHPreparePass> {
 
 public:
   explicit DwarfEHPreparePass(const TargetMachine &TM_) : TM(&TM_) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/EarlyIfConversion.h b/llvm/include/llvm/CodeGen/EarlyIfConversion.h
index 78bf12ade02c3..f3ecca2fba754 100644
--- a/llvm/include/llvm/CodeGen/EarlyIfConversion.h
+++ b/llvm/include/llvm/CodeGen/EarlyIfConversion.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_EARLYIFCONVERSION_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class EarlyIfConverterPass : public PassInfoMixin<EarlyIfConverterPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/EdgeBundles.h b/llvm/include/llvm/CodeGen/EdgeBundles.h
index 6e0c301a651e3..42803587efc5e 100644
--- a/llvm/include/llvm/CodeGen/EdgeBundles.h
+++ b/llvm/include/llvm/CodeGen/EdgeBundles.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/IntEqClasses.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class EdgeBundlesWrapperLegacy;
@@ -56,14 +57,14 @@ class EdgeBundles {
   const MachineFunction *getMachineFunction() const { return MF; }
 
   /// view - Visualize the annotated bipartite CFG with Graphviz.
-  void view() const;
+  LLVM_ABI void view() const;
 
   // Handle invalidation for the new pass manager
-  bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA,
-                  MachineFunctionAnalysisManager::Invalidator &Inv);
+  LLVM_ABI bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA,
+                           MachineFunctionAnalysisManager::Invalidator &Inv);
 };
 
-class EdgeBundlesWrapperLegacy : public MachineFunctionPass {
+class LLVM_ABI EdgeBundlesWrapperLegacy : public MachineFunctionPass {
 public:
   static char ID;
   EdgeBundlesWrapperLegacy() : MachineFunctionPass(ID) {}
@@ -83,7 +84,8 @@ class EdgeBundlesAnalysis : public AnalysisInfoMixin<EdgeBundlesAnalysis> {
 
 public:
   using Result = EdgeBundles;
-  EdgeBundles run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI EdgeBundles run(MachineFunction &MF,
+                           MachineFunctionAnalysisManager &MFAM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/ExecutionDomainFix.h b/llvm/include/llvm/CodeGen/ExecutionDomainFix.h
index 81994d932cc8a..4c1f62041c7b6 100644
--- a/llvm/include/llvm/CodeGen/ExecutionDomainFix.h
+++ b/llvm/include/llvm/CodeGen/ExecutionDomainFix.h
@@ -27,6 +27,7 @@
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/ReachingDefAnalysis.h"
 #include "llvm/CodeGen/TargetRegisterInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -113,7 +114,7 @@ struct DomainValue {
   }
 };
 
-class ExecutionDomainFix : public MachineFunctionPass {
+class LLVM_ABI ExecutionDomainFix : public MachineFunctionPass {
   SpecificBumpPtrAllocator<DomainValue> Allocator;
   SmallVector<DomainValue *, 16> Avail;
 
diff --git a/llvm/include/llvm/CodeGen/ExpandIRInsts.h b/llvm/include/llvm/CodeGen/ExpandIRInsts.h
index 5d3fcf75cd530..93d3d9e7d01ca 100644
--- a/llvm/include/llvm/CodeGen/ExpandIRInsts.h
+++ b/llvm/include/llvm/CodeGen/ExpandIRInsts.h
@@ -11,6 +11,7 @@
 
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/CodeGen.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,12 +23,14 @@ class ExpandIRInstsPass : public PassInfoMixin<ExpandIRInstsPass> {
   CodeGenOptLevel OptLevel;
 
 public:
-  explicit ExpandIRInstsPass(const TargetMachine &TM, CodeGenOptLevel OptLevel);
+  LLVM_ABI explicit ExpandIRInstsPass(const TargetMachine &TM,
+                                      CodeGenOptLevel OptLevel);
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/ExpandMemCmp.h b/llvm/include/llvm/CodeGen/ExpandMemCmp.h
index 0b845e439fce4..200af0b461aa1 100644
--- a/llvm/include/llvm/CodeGen/ExpandMemCmp.h
+++ b/llvm/include/llvm/CodeGen/ExpandMemCmp.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_EXPANDMEMCMP_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -21,7 +22,7 @@ class ExpandMemCmpPass : public PassInfoMixin<ExpandMemCmpPass> {
 public:
   explicit ExpandMemCmpPass(const TargetMachine &TM_) : TM(&TM_) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/ExpandPostRAPseudos.h b/llvm/include/llvm/CodeGen/ExpandPostRAPseudos.h
index dbdb473a0788f..585c3a107e7c1 100644
--- a/llvm/include/llvm/CodeGen/ExpandPostRAPseudos.h
+++ b/llvm/include/llvm/CodeGen/ExpandPostRAPseudos.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_EXPANDPOSTRAPSEUDOS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class ExpandPostRAPseudosPass : public PassInfoMixin<ExpandPostRAPseudosPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/ExpandReductions.h b/llvm/include/llvm/CodeGen/ExpandReductions.h
index 91c2507a9e395..9ca65032fc105 100644
--- a/llvm/include/llvm/CodeGen/ExpandReductions.h
+++ b/llvm/include/llvm/CodeGen/ExpandReductions.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_EXPANDREDUCTIONS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class ExpandReductionsPass
     : public PassInfoMixin<ExpandReductionsPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/ExpandVectorPredication.h b/llvm/include/llvm/CodeGen/ExpandVectorPredication.h
index 3aafb22eab6be..1ef2e067ef975 100644
--- a/llvm/include/llvm/CodeGen/ExpandVectorPredication.h
+++ b/llvm/include/llvm/CodeGen/ExpandVectorPredication.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_EXPANDVECTORPREDICATION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -28,9 +29,8 @@ enum class VPExpansionDetails {
 
 /// Expand a vector predication intrinsic. Returns the kind of expansion
 /// that was applied to the intrinsic.
-VPExpansionDetails
-expandVectorPredicationIntrinsic(VPIntrinsic &VPI,
-                                 const TargetTransformInfo &TTI);
+LLVM_ABI VPExpansionDetails expandVectorPredicationIntrinsic(
+    VPIntrinsic &VPI, const TargetTransformInfo &TTI);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/FEntryInserter.h b/llvm/include/llvm/CodeGen/FEntryInserter.h
index 4a82975cad879..9534206452e0a 100644
--- a/llvm/include/llvm/CodeGen/FEntryInserter.h
+++ b/llvm/include/llvm/CodeGen/FEntryInserter.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_FENTRYINSERTER_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class FEntryInserterPass : public PassInfoMixin<FEntryInserterPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/FastISel.h b/llvm/include/llvm/CodeGen/FastISel.h
index 9e7ab467f1975..ce4be0a29ce90 100644
--- a/llvm/include/llvm/CodeGen/FastISel.h
+++ b/llvm/include/llvm/CodeGen/FastISel.h
@@ -26,6 +26,7 @@
 #include "llvm/IR/DebugLoc.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/InstrTypes.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <utility>
 
@@ -63,7 +64,7 @@ class Value;
 /// This is a fast-path instruction selection class that generates poor
 /// code and doesn't support illegal types or non-trivial lowering, but runs
 /// quickly.
-class FastISel {
+class LLVM_ABI FastISel {
 public:
   using ArgListEntry = TargetLoweringBase::ArgListEntry;
   using ArgListTy = TargetLoweringBase::ArgListTy;
@@ -158,10 +159,10 @@ class FastISel {
       return *this;
     }
 
-    CallLoweringInfo &setCallee(const DataLayout &DL, MCContext &Ctx,
-                                CallingConv::ID CC, Type *ResultTy,
-                                StringRef Target, ArgListTy &&ArgsList,
-                                unsigned FixedArgs = ~0U);
+    LLVM_ABI CallLoweringInfo &setCallee(const DataLayout &DL, MCContext &Ctx,
+                                         CallingConv::ID CC, Type *ResultTy,
+                                         StringRef Target, ArgListTy &&ArgsList,
+                                         unsigned FixedArgs = ~0U);
 
     CallLoweringInfo &setCallee(CallingConv::ID CC, Type *ResultTy,
                                 MCSymbol *Target, ArgListTy &&ArgsList,
diff --git a/llvm/include/llvm/CodeGen/FaultMaps.h b/llvm/include/llvm/CodeGen/FaultMaps.h
index c228bb895edd0..44f6f97fa8874 100644
--- a/llvm/include/llvm/CodeGen/FaultMaps.h
+++ b/llvm/include/llvm/CodeGen/FaultMaps.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_FAULTMAPS_H
 
 #include "llvm/MC/MCSymbol.h"
+#include "llvm/Support/Compiler.h"
 #include <map>
 #include <vector>
 
@@ -27,13 +28,14 @@ class FaultMaps {
     FaultKindMax
   };
 
-  explicit FaultMaps(AsmPrinter &AP);
+  LLVM_ABI explicit FaultMaps(AsmPrinter &AP);
 
-  static const char *faultTypeToString(FaultKind);
+  LLVM_ABI static const char *faultTypeToString(FaultKind);
 
-  void recordFaultingOp(FaultKind FaultTy, const MCSymbol *FaultingLabel,
-                        const MCSymbol *HandlerLabel);
-  void serializeToFaultMapSection();
+  LLVM_ABI void recordFaultingOp(FaultKind FaultTy,
+                                 const MCSymbol *FaultingLabel,
+                                 const MCSymbol *HandlerLabel);
+  LLVM_ABI void serializeToFaultMapSection();
   void reset() {
     FunctionInfos.clear();
   }
diff --git a/llvm/include/llvm/CodeGen/FinalizeISel.h b/llvm/include/llvm/CodeGen/FinalizeISel.h
index b2c28e330126f..d57b08654918e 100644
--- a/llvm/include/llvm/CodeGen/FinalizeISel.h
+++ b/llvm/include/llvm/CodeGen/FinalizeISel.h
@@ -10,12 +10,14 @@
 #define LLVM_CODEGEN_FINALIZEISEL_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class FinalizeISelPass : public PassInfoMixin<FinalizeISelPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/FixupStatepointCallerSaved.h b/llvm/include/llvm/CodeGen/FixupStatepointCallerSaved.h
index 43c40340032ce..71e42c4c05af0 100644
--- a/llvm/include/llvm/CodeGen/FixupStatepointCallerSaved.h
+++ b/llvm/include/llvm/CodeGen/FixupStatepointCallerSaved.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_FIXUPSTATEPOINTCALLERSAVED_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class FixupStatepointCallerSavedPass
     : public PassInfoMixin<FixupStatepointCallerSavedPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h b/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
index b892a0e222a47..e83959a03dee5 100644
--- a/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
+++ b/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
@@ -25,6 +25,7 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/Type.h"
 #include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/KnownBits.h"
 #include <cassert>
 #include <utility>
@@ -89,7 +90,7 @@ class FunctionLoweringInfo {
 
   /// This method is called from TargetLowerinInfo::isSDNodeSourceOfDivergence
   /// to get the Value corresponding to the live-in virtual register.
-  const Value *getValueFromVirtualReg(Register Vreg);
+  LLVM_ABI const Value *getValueFromVirtualReg(Register Vreg);
 
   /// Track virtual registers created for exception pointers.
   DenseMap<const Value *, Register> CatchPadExceptionPointers;
@@ -197,12 +198,12 @@ class FunctionLoweringInfo {
   /// set - Initialize this FunctionLoweringInfo with the given Function
   /// and its associated MachineFunction.
   ///
-  void set(const Function &Fn, MachineFunction &MF, SelectionDAG *DAG);
+  LLVM_ABI void set(const Function &Fn, MachineFunction &MF, SelectionDAG *DAG);
 
   /// clear - Clear out all the function-specific state. This returns this
   /// FunctionLoweringInfo to an empty state, ready to be used for a
   /// different function.
-  void clear();
+  LLVM_ABI void clear();
 
   /// isExportedInst - Return true if the specified value is an instruction
   /// exported from its block.
@@ -215,13 +216,13 @@ class FunctionLoweringInfo {
     return MBBMap[BB->getNumber()];
   }
 
-  Register CreateReg(MVT VT, bool isDivergent = false);
+  LLVM_ABI Register CreateReg(MVT VT, bool isDivergent = false);
 
-  Register CreateRegs(const Value *V);
+  LLVM_ABI Register CreateRegs(const Value *V);
 
-  Register CreateRegs(Type *Ty, bool isDivergent = false);
+  LLVM_ABI Register CreateRegs(Type *Ty, bool isDivergent = false);
 
-  Register InitializeRegForValue(const Value *V);
+  LLVM_ABI Register InitializeRegForValue(const Value *V);
 
   /// GetLiveOutRegInfo - Gets LiveOutInfo for a register, returning NULL if the
   /// register is a PHI destination and the PHI's LiveOutInfo is not valid.
@@ -241,7 +242,8 @@ class FunctionLoweringInfo {
   /// the register's LiveOutInfo is for a smaller bit width, it is extended to
   /// the larger bit width by zero extension. The bit width must be no smaller
   /// than the LiveOutInfo's existing bit width.
-  const LiveOutInfo *GetLiveOutRegInfo(Register Reg, unsigned BitWidth);
+  LLVM_ABI const LiveOutInfo *GetLiveOutRegInfo(Register Reg,
+                                                unsigned BitWidth);
 
   /// AddLiveOutRegInfo - Adds LiveOutInfo for a register.
   void AddLiveOutRegInfo(Register Reg, unsigned NumSignBits,
@@ -259,7 +261,7 @@ class FunctionLoweringInfo {
 
   /// ComputePHILiveOutRegInfo - Compute LiveOutInfo for a PHI's destination
   /// register based on the LiveOutInfo of its operands.
-  void ComputePHILiveOutRegInfo(const PHINode*);
+  LLVM_ABI void ComputePHILiveOutRegInfo(const PHINode *);
 
   /// InvalidatePHILiveOutRegInfo - Invalidates a PHI's LiveOutInfo, to be
   /// called when a block is visited before all of its predecessors.
@@ -279,13 +281,13 @@ class FunctionLoweringInfo {
 
   /// setArgumentFrameIndex - Record frame index for the byval
   /// argument.
-  void setArgumentFrameIndex(const Argument *A, int FI);
+  LLVM_ABI void setArgumentFrameIndex(const Argument *A, int FI);
 
   /// getArgumentFrameIndex - Get frame index for the byval argument.
-  int getArgumentFrameIndex(const Argument *A);
+  LLVM_ABI int getArgumentFrameIndex(const Argument *A);
 
-  Register getCatchPadExceptionPointerVReg(const Value *CPI,
-                                           const TargetRegisterClass *RC);
+  LLVM_ABI Register getCatchPadExceptionPointerVReg(
+      const Value *CPI, const TargetRegisterClass *RC);
 
   /// Set the call site currently being processed.
   void setCurrentCallSite(unsigned Site) { CurCallSite = Site; }
diff --git a/llvm/include/llvm/CodeGen/GCEmptyBasicBlocks.h b/llvm/include/llvm/CodeGen/GCEmptyBasicBlocks.h
index a795ece07cdf5..cdb153b71fcca 100644
--- a/llvm/include/llvm/CodeGen/GCEmptyBasicBlocks.h
+++ b/llvm/include/llvm/CodeGen/GCEmptyBasicBlocks.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_GCEMPTYBASICBLOCKS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class GCEmptyBasicBlocksPass : public PassInfoMixin<GCEmptyBasicBlocksPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/GCMetadataPrinter.h b/llvm/include/llvm/CodeGen/GCMetadataPrinter.h
index 9d421be8313f0..23ab55e1f7e7d 100644
--- a/llvm/include/llvm/CodeGen/GCMetadataPrinter.h
+++ b/llvm/include/llvm/CodeGen/GCMetadataPrinter.h
@@ -19,6 +19,7 @@
 #ifndef LLVM_CODEGEN_GCMETADATAPRINTER_H
 #define LLVM_CODEGEN_GCMETADATAPRINTER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Registry.h"
 
 namespace llvm {
@@ -38,7 +39,7 @@ extern template class LLVM_TEMPLATE_ABI Registry<GCMetadataPrinter>;
 
 /// GCMetadataPrinter - Emits GC metadata as assembly code.  Instances are
 /// created, managed, and owned by the AsmPrinter.
-class GCMetadataPrinter {
+class LLVM_ABI GCMetadataPrinter {
 private:
   friend class AsmPrinter;
 
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/Combiner.h b/llvm/include/llvm/CodeGen/GlobalISel/Combiner.h
index 7a313f493a6d3..c2d21fd48041e 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/Combiner.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/Combiner.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h"
 #include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h"
 #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class MachineRegisterInfo;
@@ -31,7 +32,7 @@ class MachineIRBuilder;
 /// one of these each time they enter a new function.
 ///
 /// TODO: Is it worth making this module-wide?
-class Combiner : public GIMatchTableExecutor {
+class LLVM_ABI Combiner : public GIMatchTableExecutor {
 private:
   using WorkListTy = GISelWorkList<512>;
 
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
index 5d4347066a40c..ce2a4d5ae5892 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
@@ -24,6 +24,7 @@
 #include "llvm/CodeGen/Register.h"
 #include "llvm/CodeGenTypes/LowLevelType.h"
 #include "llvm/IR/InstrTypes.h"
+#include "llvm/Support/Compiler.h"
 #include <functional>
 
 namespace llvm {
@@ -124,10 +125,10 @@ class CombinerHelper {
   const TargetRegisterInfo *TRI;
 
 public:
-  CombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B,
-                 bool IsPreLegalize, GISelValueTracking *VT = nullptr,
-                 MachineDominatorTree *MDT = nullptr,
-                 const LegalizerInfo *LI = nullptr);
+  LLVM_ABI CombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B,
+                          bool IsPreLegalize, GISelValueTracking *VT = nullptr,
+                          MachineDominatorTree *MDT = nullptr,
+                          const LegalizerInfo *LI = nullptr);
 
   GISelValueTracking *getValueTracking() const { return VT; }
 
@@ -135,66 +136,69 @@ class CombinerHelper {
     return Builder;
   }
 
-  const TargetLowering &getTargetLowering() const;
+  LLVM_ABI const TargetLowering &getTargetLowering() const;
 
-  const MachineFunction &getMachineFunction() const;
+  LLVM_ABI const MachineFunction &getMachineFunction() const;
 
-  const DataLayout &getDataLayout() const;
+  LLVM_ABI const DataLayout &getDataLayout() const;
 
-  LLVMContext &getContext() const;
+  LLVM_ABI LLVMContext &getContext() const;
 
   /// \returns true if the combiner is running pre-legalization.
-  bool isPreLegalize() const;
+  LLVM_ABI bool isPreLegalize() const;
 
   /// \returns true if \p Query is legal on the target.
-  bool isLegal(const LegalityQuery &Query) const;
+  LLVM_ABI bool isLegal(const LegalityQuery &Query) const;
 
   /// \return true if the combine is running prior to legalization, or if \p
   /// Query is legal on the target.
-  bool isLegalOrBeforeLegalizer(const LegalityQuery &Query) const;
+  LLVM_ABI bool isLegalOrBeforeLegalizer(const LegalityQuery &Query) const;
 
   /// \return true if \p Query is legal on the target, or if \p Query will
   /// perform WidenScalar action on the target.
-  bool isLegalOrHasWidenScalar(const LegalityQuery &Query) const;
+  LLVM_ABI bool isLegalOrHasWidenScalar(const LegalityQuery &Query) const;
 
   /// \return true if the combine is running prior to legalization, or if \p Ty
   /// is a legal integer constant type on the target.
-  bool isConstantLegalOrBeforeLegalizer(const LLT Ty) const;
+  LLVM_ABI bool isConstantLegalOrBeforeLegalizer(const LLT Ty) const;
 
   /// MachineRegisterInfo::replaceRegWith() and inform the observer of the changes
-  void replaceRegWith(MachineRegisterInfo &MRI, Register FromReg, Register ToReg) const;
+  LLVM_ABI void replaceRegWith(MachineRegisterInfo &MRI, Register FromReg,
+                               Register ToReg) const;
 
   /// Replace a single register operand with a new register and inform the
   /// observer of the changes.
-  void replaceRegOpWith(MachineRegisterInfo &MRI, MachineOperand &FromRegOp,
-                        Register ToReg) const;
+  LLVM_ABI void replaceRegOpWith(MachineRegisterInfo &MRI,
+                                 MachineOperand &FromRegOp,
+                                 Register ToReg) const;
 
   /// Replace the opcode in instruction with a new opcode and inform the
   /// observer of the changes.
-  void replaceOpcodeWith(MachineInstr &FromMI, unsigned ToOpcode) const;
+  LLVM_ABI void replaceOpcodeWith(MachineInstr &FromMI,
+                                  unsigned ToOpcode) const;
 
   /// Get the register bank of \p Reg.
   /// If Reg has not been assigned a register, a register class,
   /// or a register bank, then this returns nullptr.
   ///
   /// \pre Reg.isValid()
-  const RegisterBank *getRegBank(Register Reg) const;
+  LLVM_ABI const RegisterBank *getRegBank(Register Reg) const;
 
   /// Set the register bank of \p Reg.
   /// Does nothing if the RegBank is null.
   /// This is the counterpart to getRegBank.
-  void setRegBank(Register Reg, const RegisterBank *RegBank) const;
+  LLVM_ABI void setRegBank(Register Reg, const RegisterBank *RegBank) const;
 
   /// If \p MI is COPY, try to combine it.
   /// Returns true if MI changed.
-  bool tryCombineCopy(MachineInstr &MI) const;
-  bool matchCombineCopy(MachineInstr &MI) const;
-  void applyCombineCopy(MachineInstr &MI) const;
+  LLVM_ABI bool tryCombineCopy(MachineInstr &MI) const;
+  LLVM_ABI bool matchCombineCopy(MachineInstr &MI) const;
+  LLVM_ABI void applyCombineCopy(MachineInstr &MI) const;
 
   /// Returns true if \p DefMI precedes \p UseMI or they are the same
   /// instruction. Both must be in the same basic block.
-  bool isPredecessor(const MachineInstr &DefMI,
-                     const MachineInstr &UseMI) const;
+  LLVM_ABI bool isPredecessor(const MachineInstr &DefMI,
+                              const MachineInstr &UseMI) const;
 
   /// Returns true if \p DefMI dominates \p UseMI. By definition an
   /// instruction dominates itself.
@@ -202,50 +206,57 @@ class CombinerHelper {
   /// If we haven't been provided with a MachineDominatorTree during
   /// construction, this function returns a conservative result that tracks just
   /// a single basic block.
-  bool dominates(const MachineInstr &DefMI, const MachineInstr &UseMI) const;
+  LLVM_ABI bool dominates(const MachineInstr &DefMI,
+                          const MachineInstr &UseMI) const;
 
   /// If \p MI is extend that consumes the result of a load, try to combine it.
   /// Returns true if MI changed.
-  bool tryCombineExtendingLoads(MachineInstr &MI) const;
-  bool matchCombineExtendingLoads(MachineInstr &MI,
-                                  PreferredTuple &MatchInfo) const;
-  void applyCombineExtendingLoads(MachineInstr &MI,
-                                  PreferredTuple &MatchInfo) const;
+  LLVM_ABI bool tryCombineExtendingLoads(MachineInstr &MI) const;
+  LLVM_ABI bool matchCombineExtendingLoads(MachineInstr &MI,
+                                           PreferredTuple &MatchInfo) const;
+  LLVM_ABI void applyCombineExtendingLoads(MachineInstr &MI,
+                                           PreferredTuple &MatchInfo) const;
 
   /// Match (and (load x), mask) -> zextload x
-  bool matchCombineLoadWithAndMask(MachineInstr &MI,
-                                   BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCombineLoadWithAndMask(MachineInstr &MI,
+                                            BuildFnTy &MatchInfo) const;
 
   /// Combine a G_EXTRACT_VECTOR_ELT of a load into a narrowed
   /// load.
-  bool matchCombineExtractedVectorLoad(MachineInstr &MI,
-                                       BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCombineExtractedVectorLoad(MachineInstr &MI,
+                                                BuildFnTy &MatchInfo) const;
 
-  bool matchCombineIndexedLoadStore(MachineInstr &MI,
-                                    IndexedLoadStoreMatchInfo &MatchInfo) const;
-  void applyCombineIndexedLoadStore(MachineInstr &MI,
-                                    IndexedLoadStoreMatchInfo &MatchInfo) const;
+  LLVM_ABI bool
+  matchCombineIndexedLoadStore(MachineInstr &MI,
+                               IndexedLoadStoreMatchInfo &MatchInfo) const;
+  LLVM_ABI void
+  applyCombineIndexedLoadStore(MachineInstr &MI,
+                               IndexedLoadStoreMatchInfo &MatchInfo) const;
 
-  bool matchSextTruncSextLoad(MachineInstr &MI) const;
-  void applySextTruncSextLoad(MachineInstr &MI) const;
+  LLVM_ABI bool matchSextTruncSextLoad(MachineInstr &MI) const;
+  LLVM_ABI void applySextTruncSextLoad(MachineInstr &MI) const;
 
   /// Match sext_inreg(load p), imm -> sextload p
-  bool matchSextInRegOfLoad(MachineInstr &MI,
-                            std::tuple<Register, unsigned> &MatchInfo) const;
-  void applySextInRegOfLoad(MachineInstr &MI,
-                            std::tuple<Register, unsigned> &MatchInfo) const;
+  LLVM_ABI bool
+  matchSextInRegOfLoad(MachineInstr &MI,
+                       std::tuple<Register, unsigned> &MatchInfo) const;
+  LLVM_ABI void
+  applySextInRegOfLoad(MachineInstr &MI,
+                       std::tuple<Register, unsigned> &MatchInfo) const;
 
   /// Try to combine G_[SU]DIV and G_[SU]REM into a single G_[SU]DIVREM
   /// when their source operands are identical.
-  bool matchCombineDivRem(MachineInstr &MI, MachineInstr *&OtherMI) const;
-  void applyCombineDivRem(MachineInstr &MI, MachineInstr *&OtherMI) const;
+  LLVM_ABI bool matchCombineDivRem(MachineInstr &MI,
+                                   MachineInstr *&OtherMI) const;
+  LLVM_ABI void applyCombineDivRem(MachineInstr &MI,
+                                   MachineInstr *&OtherMI) const;
 
   /// If a brcond's true block is not the fallthrough, make it so by inverting
   /// the condition and swapping operands.
-  bool matchOptBrCondByInvertingCond(MachineInstr &MI,
-                                     MachineInstr *&BrCond) const;
-  void applyOptBrCondByInvertingCond(MachineInstr &MI,
-                                     MachineInstr *&BrCond) const;
+  LLVM_ABI bool matchOptBrCondByInvertingCond(MachineInstr &MI,
+                                              MachineInstr *&BrCond) const;
+  LLVM_ABI void applyOptBrCondByInvertingCond(MachineInstr &MI,
+                                              MachineInstr *&BrCond) const;
 
   /// If \p MI is G_CONCAT_VECTORS, try to combine it.
   /// Returns true if MI changed.
@@ -261,39 +272,39 @@ class CombinerHelper {
   /// needed to produce the flattened build_vector.
   ///
   /// \pre MI.getOpcode() == G_CONCAT_VECTORS.
-  bool matchCombineConcatVectors(MachineInstr &MI,
-                                 SmallVector<Register> &Ops) const;
+  LLVM_ABI bool matchCombineConcatVectors(MachineInstr &MI,
+                                          SmallVector<Register> &Ops) const;
   /// Replace \p MI with a flattened build_vector with \p Ops
   /// or an implicit_def if \p Ops is empty.
-  void applyCombineConcatVectors(MachineInstr &MI,
-                                 SmallVector<Register> &Ops) const;
+  LLVM_ABI void applyCombineConcatVectors(MachineInstr &MI,
+                                          SmallVector<Register> &Ops) const;
 
-  bool matchCombineShuffleConcat(MachineInstr &MI,
-                                 SmallVector<Register> &Ops) const;
+  LLVM_ABI bool matchCombineShuffleConcat(MachineInstr &MI,
+                                          SmallVector<Register> &Ops) const;
   /// Replace \p MI with a flattened build_vector with \p Ops
   /// or an implicit_def if \p Ops is empty.
-  void applyCombineShuffleConcat(MachineInstr &MI,
-                                 SmallVector<Register> &Ops) const;
+  LLVM_ABI void applyCombineShuffleConcat(MachineInstr &MI,
+                                          SmallVector<Register> &Ops) const;
 
   /// Replace \p MI with a build_vector.
-  void applyCombineShuffleToBuildVector(MachineInstr &MI) const;
+  LLVM_ABI void applyCombineShuffleToBuildVector(MachineInstr &MI) const;
 
   /// Try to combine G_SHUFFLE_VECTOR into G_CONCAT_VECTORS.
   /// Returns true if MI changed.
   ///
   /// \pre MI.getOpcode() == G_SHUFFLE_VECTOR.
-  bool tryCombineShuffleVector(MachineInstr &MI) const;
+  LLVM_ABI bool tryCombineShuffleVector(MachineInstr &MI) const;
   /// Check if the G_SHUFFLE_VECTOR \p MI can be replaced by a
   /// concat_vectors.
   /// \p Ops will contain the operands needed to produce the flattened
   /// concat_vectors.
   ///
   /// \pre MI.getOpcode() == G_SHUFFLE_VECTOR.
-  bool matchCombineShuffleVector(MachineInstr &MI,
-                                 SmallVectorImpl<Register> &Ops) const;
+  LLVM_ABI bool matchCombineShuffleVector(MachineInstr &MI,
+                                          SmallVectorImpl<Register> &Ops) const;
   /// Replace \p MI with a concat_vectors with \p Ops.
-  void applyCombineShuffleVector(MachineInstr &MI,
-                                 ArrayRef<Register> Ops) const;
+  LLVM_ABI void applyCombineShuffleVector(MachineInstr &MI,
+                                          ArrayRef<Register> Ops) const;
 
   /// Optimize memcpy intrinsics et al, e.g. constant len calls.
   /// /p MaxLen if non-zero specifies the max length of a mem libcall to inline.
@@ -325,111 +336,124 @@ class CombinerHelper {
   ///     $addr = G_INDEXED_STORE $val, $base, $offset
   ///     [...]
   ///     $whatever = COPY $addr
-  bool tryCombineMemCpyFamily(MachineInstr &MI, unsigned MaxLen = 0) const;
+  LLVM_ABI bool tryCombineMemCpyFamily(MachineInstr &MI,
+                                       unsigned MaxLen = 0) const;
 
-  bool matchPtrAddImmedChain(MachineInstr &MI, PtrAddChain &MatchInfo) const;
-  void applyPtrAddImmedChain(MachineInstr &MI, PtrAddChain &MatchInfo) const;
+  LLVM_ABI bool matchPtrAddImmedChain(MachineInstr &MI,
+                                      PtrAddChain &MatchInfo) const;
+  LLVM_ABI void applyPtrAddImmedChain(MachineInstr &MI,
+                                      PtrAddChain &MatchInfo) const;
 
   /// Fold (shift (shift base, x), y) -> (shift base (x+y))
-  bool matchShiftImmedChain(MachineInstr &MI, RegisterImmPair &MatchInfo) const;
-  void applyShiftImmedChain(MachineInstr &MI, RegisterImmPair &MatchInfo) const;
+  LLVM_ABI bool matchShiftImmedChain(MachineInstr &MI,
+                                     RegisterImmPair &MatchInfo) const;
+  LLVM_ABI void applyShiftImmedChain(MachineInstr &MI,
+                                     RegisterImmPair &MatchInfo) const;
 
   /// If we have a shift-by-constant of a bitwise logic op that itself has a
   /// shift-by-constant operand with identical opcode, we may be able to convert
   /// that into 2 independent shifts followed by the logic op.
-  bool matchShiftOfShiftedLogic(MachineInstr &MI,
-                                ShiftOfShiftedLogic &MatchInfo) const;
-  void applyShiftOfShiftedLogic(MachineInstr &MI,
-                                ShiftOfShiftedLogic &MatchInfo) const;
+  LLVM_ABI bool matchShiftOfShiftedLogic(MachineInstr &MI,
+                                         ShiftOfShiftedLogic &MatchInfo) const;
+  LLVM_ABI void applyShiftOfShiftedLogic(MachineInstr &MI,
+                                         ShiftOfShiftedLogic &MatchInfo) const;
 
-  bool matchCommuteShift(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCommuteShift(MachineInstr &MI, BuildFnTy &MatchInfo) const;
 
   /// Fold (lshr (trunc (lshr x, C1)), C2) -> trunc (shift x, (C1 + C2))
-  bool matchLshrOfTruncOfLshr(MachineInstr &MI, LshrOfTruncOfLshr &MatchInfo,
-                              MachineInstr &ShiftMI) const;
-  void applyLshrOfTruncOfLshr(MachineInstr &MI,
-                              LshrOfTruncOfLshr &MatchInfo) const;
+  LLVM_ABI bool matchLshrOfTruncOfLshr(MachineInstr &MI,
+                                       LshrOfTruncOfLshr &MatchInfo,
+                                       MachineInstr &ShiftMI) const;
+  LLVM_ABI void applyLshrOfTruncOfLshr(MachineInstr &MI,
+                                       LshrOfTruncOfLshr &MatchInfo) const;
 
   /// Transform a multiply by a power-of-2 value to a left shift.
-  bool matchCombineMulToShl(MachineInstr &MI, unsigned &ShiftVal) const;
-  void applyCombineMulToShl(MachineInstr &MI, unsigned &ShiftVal) const;
+  LLVM_ABI bool matchCombineMulToShl(MachineInstr &MI,
+                                     unsigned &ShiftVal) const;
+  LLVM_ABI void applyCombineMulToShl(MachineInstr &MI,
+                                     unsigned &ShiftVal) const;
 
   // Transform a G_SUB with constant on the RHS to G_ADD.
-  bool matchCombineSubToAdd(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCombineSubToAdd(MachineInstr &MI,
+                                     BuildFnTy &MatchInfo) const;
 
   // Transform a G_SHL with an extended source into a narrower shift if
   // possible.
-  bool matchCombineShlOfExtend(MachineInstr &MI,
-                               RegisterImmPair &MatchData) const;
-  void applyCombineShlOfExtend(MachineInstr &MI,
-                               const RegisterImmPair &MatchData) const;
+  LLVM_ABI bool matchCombineShlOfExtend(MachineInstr &MI,
+                                        RegisterImmPair &MatchData) const;
+  LLVM_ABI void applyCombineShlOfExtend(MachineInstr &MI,
+                                        const RegisterImmPair &MatchData) const;
 
   /// Fold away a merge of an unmerge of the corresponding values.
-  bool matchCombineMergeUnmerge(MachineInstr &MI, Register &MatchInfo) const;
+  LLVM_ABI bool matchCombineMergeUnmerge(MachineInstr &MI,
+                                         Register &MatchInfo) const;
 
   /// Reduce a shift by a constant to an unmerge and a shift on a half sized
   /// type. This will not produce a shift smaller than \p TargetShiftSize.
-  bool matchCombineShiftToUnmerge(MachineInstr &MI, unsigned TargetShiftSize,
-                                  unsigned &ShiftVal) const;
-  void applyCombineShiftToUnmerge(MachineInstr &MI,
-                                  const unsigned &ShiftVal) const;
-  bool tryCombineShiftToUnmerge(MachineInstr &MI,
-                                unsigned TargetShiftAmount) const;
+  LLVM_ABI bool matchCombineShiftToUnmerge(MachineInstr &MI,
+                                           unsigned TargetShiftSize,
+                                           unsigned &ShiftVal) const;
+  LLVM_ABI void applyCombineShiftToUnmerge(MachineInstr &MI,
+                                           const unsigned &ShiftVal) const;
+  LLVM_ABI bool tryCombineShiftToUnmerge(MachineInstr &MI,
+                                         unsigned TargetShiftAmount) const;
 
   /// Transform <ty,...> G_UNMERGE(G_MERGE ty X, Y, Z) -> ty X, Y, Z.
-  bool matchCombineUnmergeMergeToPlainValues(
+  LLVM_ABI bool matchCombineUnmergeMergeToPlainValues(
       MachineInstr &MI, SmallVectorImpl<Register> &Operands) const;
-  void applyCombineUnmergeMergeToPlainValues(
+  LLVM_ABI void applyCombineUnmergeMergeToPlainValues(
       MachineInstr &MI, SmallVectorImpl<Register> &Operands) const;
 
   /// Transform G_UNMERGE Constant -> Constant1, Constant2, ...
-  bool matchCombineUnmergeConstant(MachineInstr &MI,
-                                   SmallVectorImpl<APInt> &Csts) const;
-  void applyCombineUnmergeConstant(MachineInstr &MI,
-                                   SmallVectorImpl<APInt> &Csts) const;
+  LLVM_ABI bool matchCombineUnmergeConstant(MachineInstr &MI,
+                                            SmallVectorImpl<APInt> &Csts) const;
+  LLVM_ABI void applyCombineUnmergeConstant(MachineInstr &MI,
+                                            SmallVectorImpl<APInt> &Csts) const;
 
   /// Transform G_UNMERGE G_IMPLICIT_DEF -> G_IMPLICIT_DEF, G_IMPLICIT_DEF, ...
-  bool matchCombineUnmergeUndef(
+  LLVM_ABI bool matchCombineUnmergeUndef(
       MachineInstr &MI,
       std::function<void(MachineIRBuilder &)> &MatchInfo) const;
 
   /// Transform X, Y<dead> = G_UNMERGE Z -> X = G_TRUNC Z.
-  bool matchCombineUnmergeWithDeadLanesToTrunc(MachineInstr &MI) const;
-  void applyCombineUnmergeWithDeadLanesToTrunc(MachineInstr &MI) const;
+  LLVM_ABI bool matchCombineUnmergeWithDeadLanesToTrunc(MachineInstr &MI) const;
+  LLVM_ABI void applyCombineUnmergeWithDeadLanesToTrunc(MachineInstr &MI) const;
 
   /// Transform X, Y = G_UNMERGE(G_ZEXT(Z)) -> X = G_ZEXT(Z); Y = G_CONSTANT 0
-  bool matchCombineUnmergeZExtToZExt(MachineInstr &MI) const;
-  void applyCombineUnmergeZExtToZExt(MachineInstr &MI) const;
+  LLVM_ABI bool matchCombineUnmergeZExtToZExt(MachineInstr &MI) const;
+  LLVM_ABI void applyCombineUnmergeZExtToZExt(MachineInstr &MI) const;
 
   /// Transform fp_instr(cst) to constant result of the fp operation.
-  void applyCombineConstantFoldFpUnary(MachineInstr &MI,
-                                       const ConstantFP *Cst) const;
+  LLVM_ABI void applyCombineConstantFoldFpUnary(MachineInstr &MI,
+                                                const ConstantFP *Cst) const;
 
   /// Transform IntToPtr(PtrToInt(x)) to x if cast is in the same address space.
-  bool matchCombineI2PToP2I(MachineInstr &MI, Register &Reg) const;
-  void applyCombineI2PToP2I(MachineInstr &MI, Register &Reg) const;
+  LLVM_ABI bool matchCombineI2PToP2I(MachineInstr &MI, Register &Reg) const;
+  LLVM_ABI void applyCombineI2PToP2I(MachineInstr &MI, Register &Reg) const;
 
   /// Transform PtrToInt(IntToPtr(x)) to x.
-  void applyCombineP2IToI2P(MachineInstr &MI, Register &Reg) const;
+  LLVM_ABI void applyCombineP2IToI2P(MachineInstr &MI, Register &Reg) const;
 
   /// Transform G_ADD (G_PTRTOINT x), y -> G_PTRTOINT (G_PTR_ADD x, y)
   /// Transform G_ADD y, (G_PTRTOINT x) -> G_PTRTOINT (G_PTR_ADD x, y)
-  bool
+  LLVM_ABI bool
   matchCombineAddP2IToPtrAdd(MachineInstr &MI,
                              std::pair<Register, bool> &PtrRegAndCommute) const;
-  void
+  LLVM_ABI void
   applyCombineAddP2IToPtrAdd(MachineInstr &MI,
                              std::pair<Register, bool> &PtrRegAndCommute) const;
 
   // Transform G_PTR_ADD (G_PTRTOINT C1), C2 -> C1 + C2
-  bool matchCombineConstPtrAddToI2P(MachineInstr &MI, APInt &NewCst) const;
-  void applyCombineConstPtrAddToI2P(MachineInstr &MI, APInt &NewCst) const;
+  LLVM_ABI bool matchCombineConstPtrAddToI2P(MachineInstr &MI,
+                                             APInt &NewCst) const;
+  LLVM_ABI void applyCombineConstPtrAddToI2P(MachineInstr &MI,
+                                             APInt &NewCst) const;
 
   /// Transform anyext(trunc(x)) to x.
-  bool matchCombineAnyExtTrunc(MachineInstr &MI, Register &Reg) const;
+  LLVM_ABI bool matchCombineAnyExtTrunc(MachineInstr &MI, Register &Reg) const;
 
   /// Transform zext(trunc(x)) to x.
-  bool matchCombineZextTrunc(MachineInstr &MI, Register &Reg) const;
+  LLVM_ABI bool matchCombineZextTrunc(MachineInstr &MI, Register &Reg) const;
 
   /// Transform trunc (shl x, K) to shl (trunc x), K
   ///    if K < VT.getScalarSizeInBits().
@@ -438,121 +462,130 @@ class CombinerHelper {
   ///    if K <= (MidVT.getScalarSizeInBits() - VT.getScalarSizeInBits())
   /// MidVT is obtained by finding a legal type between the trunc's src and dst
   /// types.
-  bool
+  LLVM_ABI bool
   matchCombineTruncOfShift(MachineInstr &MI,
                            std::pair<MachineInstr *, LLT> &MatchInfo) const;
-  void
+  LLVM_ABI void
   applyCombineTruncOfShift(MachineInstr &MI,
                            std::pair<MachineInstr *, LLT> &MatchInfo) const;
 
   /// Return true if any explicit use operand on \p MI is defined by a
   /// G_IMPLICIT_DEF.
-  bool matchAnyExplicitUseIsUndef(MachineInstr &MI) const;
+  LLVM_ABI bool matchAnyExplicitUseIsUndef(MachineInstr &MI) const;
 
   /// Return true if all register explicit use operands on \p MI are defined by
   /// a G_IMPLICIT_DEF.
-  bool matchAllExplicitUsesAreUndef(MachineInstr &MI) const;
+  LLVM_ABI bool matchAllExplicitUsesAreUndef(MachineInstr &MI) const;
 
   /// Return true if a G_SHUFFLE_VECTOR instruction \p MI has an undef mask.
-  bool matchUndefShuffleVectorMask(MachineInstr &MI) const;
+  LLVM_ABI bool matchUndefShuffleVectorMask(MachineInstr &MI) const;
 
   /// Return true if a G_STORE instruction \p MI is storing an undef value.
-  bool matchUndefStore(MachineInstr &MI) const;
+  LLVM_ABI bool matchUndefStore(MachineInstr &MI) const;
 
   /// Return true if a G_SELECT instruction \p MI has an undef comparison.
-  bool matchUndefSelectCmp(MachineInstr &MI) const;
+  LLVM_ABI bool matchUndefSelectCmp(MachineInstr &MI) const;
 
   /// Return true if a G_{EXTRACT,INSERT}_VECTOR_ELT has an out of range index.
-  bool matchInsertExtractVecEltOutOfBounds(MachineInstr &MI) const;
+  LLVM_ABI bool matchInsertExtractVecEltOutOfBounds(MachineInstr &MI) const;
 
   /// Return true if a G_SELECT instruction \p MI has a constant comparison. If
   /// true, \p OpIdx will store the operand index of the known selected value.
-  bool matchConstantSelectCmp(MachineInstr &MI, unsigned &OpIdx) const;
+  LLVM_ABI bool matchConstantSelectCmp(MachineInstr &MI, unsigned &OpIdx) const;
 
   /// Replace an instruction with a G_FCONSTANT with value \p C.
-  void replaceInstWithFConstant(MachineInstr &MI, double C) const;
+  LLVM_ABI void replaceInstWithFConstant(MachineInstr &MI, double C) const;
 
   /// Replace an instruction with an G_FCONSTANT with value \p CFP.
-  void replaceInstWithFConstant(MachineInstr &MI, ConstantFP *CFP) const;
+  LLVM_ABI void replaceInstWithFConstant(MachineInstr &MI,
+                                         ConstantFP *CFP) const;
 
   /// Replace an instruction with a G_CONSTANT with value \p C.
-  void replaceInstWithConstant(MachineInstr &MI, int64_t C) const;
+  LLVM_ABI void replaceInstWithConstant(MachineInstr &MI, int64_t C) const;
 
   /// Replace an instruction with a G_CONSTANT with value \p C.
-  void replaceInstWithConstant(MachineInstr &MI, APInt C) const;
+  LLVM_ABI void replaceInstWithConstant(MachineInstr &MI, APInt C) const;
 
   /// Replace an instruction with a G_IMPLICIT_DEF.
-  void replaceInstWithUndef(MachineInstr &MI) const;
+  LLVM_ABI void replaceInstWithUndef(MachineInstr &MI) const;
 
   /// Delete \p MI and replace all of its uses with its \p OpIdx-th operand.
-  void replaceSingleDefInstWithOperand(MachineInstr &MI, unsigned OpIdx) const;
+  LLVM_ABI void replaceSingleDefInstWithOperand(MachineInstr &MI,
+                                                unsigned OpIdx) const;
 
   /// Delete \p MI and replace all of its uses with \p Replacement.
-  void replaceSingleDefInstWithReg(MachineInstr &MI,
-                                   Register Replacement) const;
+  LLVM_ABI void replaceSingleDefInstWithReg(MachineInstr &MI,
+                                            Register Replacement) const;
 
   /// @brief Replaces the shift amount in \p MI with ShiftAmt % BW
   /// @param MI
-  void applyFunnelShiftConstantModulo(MachineInstr &MI) const;
+  LLVM_ABI void applyFunnelShiftConstantModulo(MachineInstr &MI) const;
 
   /// Return true if \p MOP1 and \p MOP2 are register operands are defined by
   /// equivalent instructions.
-  bool matchEqualDefs(const MachineOperand &MOP1,
-                      const MachineOperand &MOP2) const;
+  LLVM_ABI bool matchEqualDefs(const MachineOperand &MOP1,
+                               const MachineOperand &MOP2) const;
 
   /// Return true if \p MOP is defined by a G_CONSTANT or splat with a value equal to
   /// \p C.
-  bool matchConstantOp(const MachineOperand &MOP, int64_t C) const;
+  LLVM_ABI bool matchConstantOp(const MachineOperand &MOP, int64_t C) const;
 
   /// Return true if \p MOP is defined by a G_FCONSTANT or splat with a value exactly
   /// equal to \p C.
-  bool matchConstantFPOp(const MachineOperand &MOP, double C) const;
+  LLVM_ABI bool matchConstantFPOp(const MachineOperand &MOP, double C) const;
 
   /// @brief Checks if constant at \p ConstIdx is larger than \p MI 's bitwidth
   /// @param ConstIdx Index of the constant
-  bool matchConstantLargerBitWidth(MachineInstr &MI, unsigned ConstIdx) const;
+  LLVM_ABI bool matchConstantLargerBitWidth(MachineInstr &MI,
+                                            unsigned ConstIdx) const;
 
   /// Optimize (cond ? x : x) -> x
-  bool matchSelectSameVal(MachineInstr &MI) const;
+  LLVM_ABI bool matchSelectSameVal(MachineInstr &MI) const;
 
   /// Optimize (x op x) -> x
-  bool matchBinOpSameVal(MachineInstr &MI) const;
+  LLVM_ABI bool matchBinOpSameVal(MachineInstr &MI) const;
 
   /// Check if operand \p OpIdx is zero.
-  bool matchOperandIsZero(MachineInstr &MI, unsigned OpIdx) const;
+  LLVM_ABI bool matchOperandIsZero(MachineInstr &MI, unsigned OpIdx) const;
 
   /// Check if operand \p OpIdx is undef.
-  bool matchOperandIsUndef(MachineInstr &MI, unsigned OpIdx) const;
+  LLVM_ABI bool matchOperandIsUndef(MachineInstr &MI, unsigned OpIdx) const;
 
   /// Check if operand \p OpIdx is known to be a power of 2.
-  bool matchOperandIsKnownToBeAPowerOfTwo(MachineInstr &MI,
-                                          unsigned OpIdx) const;
+  LLVM_ABI bool matchOperandIsKnownToBeAPowerOfTwo(MachineInstr &MI,
+                                                   unsigned OpIdx) const;
 
   /// Erase \p MI
-  void eraseInst(MachineInstr &MI) const;
+  LLVM_ABI void eraseInst(MachineInstr &MI) const;
 
   /// Return true if MI is a G_ADD which can be simplified to a G_SUB.
-  bool matchSimplifyAddToSub(MachineInstr &MI,
-                             std::tuple<Register, Register> &MatchInfo) const;
-  void applySimplifyAddToSub(MachineInstr &MI,
-                             std::tuple<Register, Register> &MatchInfo) const;
+  LLVM_ABI bool
+  matchSimplifyAddToSub(MachineInstr &MI,
+                        std::tuple<Register, Register> &MatchInfo) const;
+  LLVM_ABI void
+  applySimplifyAddToSub(MachineInstr &MI,
+                        std::tuple<Register, Register> &MatchInfo) const;
 
   /// Match (logic_op (op x...), (op y...)) -> (op (logic_op x, y))
-  bool matchHoistLogicOpWithSameOpcodeHands(
+  LLVM_ABI bool matchHoistLogicOpWithSameOpcodeHands(
       MachineInstr &MI, InstructionStepsMatchInfo &MatchInfo) const;
 
   /// Replace \p MI with a series of instructions described in \p MatchInfo.
-  void applyBuildInstructionSteps(MachineInstr &MI,
-                                  InstructionStepsMatchInfo &MatchInfo) const;
+  LLVM_ABI void
+  applyBuildInstructionSteps(MachineInstr &MI,
+                             InstructionStepsMatchInfo &MatchInfo) const;
 
   /// Match ashr (shl x, C), C -> sext_inreg (C)
-  bool matchAshrShlToSextInreg(MachineInstr &MI,
-                               std::tuple<Register, int64_t> &MatchInfo) const;
-  void applyAshShlToSextInreg(MachineInstr &MI,
-                              std::tuple<Register, int64_t> &MatchInfo) const;
+  LLVM_ABI bool
+  matchAshrShlToSextInreg(MachineInstr &MI,
+                          std::tuple<Register, int64_t> &MatchInfo) const;
+  LLVM_ABI void
+  applyAshShlToSextInreg(MachineInstr &MI,
+                         std::tuple<Register, int64_t> &MatchInfo) const;
 
   /// Fold and(and(x, C1), C2) -> C1&C2 ? and(x, C1&C2) : 0
-  bool matchOverlappingAnd(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchOverlappingAnd(MachineInstr &MI,
+                                    BuildFnTy &MatchInfo) const;
 
   /// \return true if \p MI is a G_AND instruction whose operands are x and y
   /// where x & y == x or x & y == y. (E.g., one of operands is all-ones value.)
@@ -560,7 +593,8 @@ class CombinerHelper {
   /// \param [in] MI - The G_AND instruction.
   /// \param [out] Replacement - A register the G_AND should be replaced with on
   /// success.
-  bool matchRedundantAnd(MachineInstr &MI, Register &Replacement) const;
+  LLVM_ABI bool matchRedundantAnd(MachineInstr &MI,
+                                  Register &Replacement) const;
 
   /// \return true if \p MI is a G_OR instruction whose operands are x and y
   /// where x | y == x or x | y == y. (E.g., one of operands is all-zeros
@@ -569,45 +603,50 @@ class CombinerHelper {
   /// \param [in] MI - The G_OR instruction.
   /// \param [out] Replacement - A register the G_OR should be replaced with on
   /// success.
-  bool matchRedundantOr(MachineInstr &MI, Register &Replacement) const;
+  LLVM_ABI bool matchRedundantOr(MachineInstr &MI, Register &Replacement) const;
 
   /// \return true if \p MI is a G_SEXT_INREG that can be erased.
-  bool matchRedundantSExtInReg(MachineInstr &MI) const;
+  LLVM_ABI bool matchRedundantSExtInReg(MachineInstr &MI) const;
 
   /// Combine inverting a result of a compare into the opposite cond code.
-  bool matchNotCmp(MachineInstr &MI,
-                   SmallVectorImpl<Register> &RegsToNegate) const;
-  void applyNotCmp(MachineInstr &MI,
-                   SmallVectorImpl<Register> &RegsToNegate) const;
+  LLVM_ABI bool matchNotCmp(MachineInstr &MI,
+                            SmallVectorImpl<Register> &RegsToNegate) const;
+  LLVM_ABI void applyNotCmp(MachineInstr &MI,
+                            SmallVectorImpl<Register> &RegsToNegate) const;
 
   /// Fold (xor (and x, y), y) -> (and (not x), y)
   ///{
-  bool matchXorOfAndWithSameReg(MachineInstr &MI,
-                                std::pair<Register, Register> &MatchInfo) const;
-  void applyXorOfAndWithSameReg(MachineInstr &MI,
-                                std::pair<Register, Register> &MatchInfo) const;
+  LLVM_ABI bool
+  matchXorOfAndWithSameReg(MachineInstr &MI,
+                           std::pair<Register, Register> &MatchInfo) const;
+  LLVM_ABI void
+  applyXorOfAndWithSameReg(MachineInstr &MI,
+                           std::pair<Register, Register> &MatchInfo) const;
   ///}
 
   /// Combine G_PTR_ADD with nullptr to G_INTTOPTR
-  bool matchPtrAddZero(MachineInstr &MI) const;
-  void applyPtrAddZero(MachineInstr &MI) const;
+  LLVM_ABI bool matchPtrAddZero(MachineInstr &MI) const;
+  LLVM_ABI void applyPtrAddZero(MachineInstr &MI) const;
 
   /// Combine G_UREM x, (known power of 2) to an add and bitmasking.
-  void applySimplifyURemByPow2(MachineInstr &MI) const;
+  LLVM_ABI void applySimplifyURemByPow2(MachineInstr &MI) const;
 
   /// Push a binary operator through a select on constants.
   ///
   /// binop (select cond, K0, K1), K2 ->
   ///   select cond, (binop K0, K2), (binop K1, K2)
-  bool matchFoldBinOpIntoSelect(MachineInstr &MI, unsigned &SelectOpNo) const;
-  void applyFoldBinOpIntoSelect(MachineInstr &MI,
-                                const unsigned &SelectOpNo) const;
+  LLVM_ABI bool matchFoldBinOpIntoSelect(MachineInstr &MI,
+                                         unsigned &SelectOpNo) const;
+  LLVM_ABI void applyFoldBinOpIntoSelect(MachineInstr &MI,
+                                         const unsigned &SelectOpNo) const;
 
-  bool matchCombineInsertVecElts(MachineInstr &MI,
-                                 SmallVectorImpl<Register> &MatchInfo) const;
+  LLVM_ABI bool
+  matchCombineInsertVecElts(MachineInstr &MI,
+                            SmallVectorImpl<Register> &MatchInfo) const;
 
-  void applyCombineInsertVecElts(MachineInstr &MI,
-                                 SmallVectorImpl<Register> &MatchInfo) const;
+  LLVM_ABI void
+  applyCombineInsertVecElts(MachineInstr &MI,
+                            SmallVectorImpl<Register> &MatchInfo) const;
 
   /// Match expression trees of the form
   ///
@@ -618,174 +657,196 @@ class CombinerHelper {
   ///
   /// And check if the tree can be replaced with a M-bit load + possibly a
   /// bswap.
-  bool matchLoadOrCombine(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchLoadOrCombine(MachineInstr &MI,
+                                   BuildFnTy &MatchInfo) const;
 
-  bool matchExtendThroughPhis(MachineInstr &MI, MachineInstr *&ExtMI) const;
-  void applyExtendThroughPhis(MachineInstr &MI, MachineInstr *&ExtMI) const;
+  LLVM_ABI bool matchExtendThroughPhis(MachineInstr &MI,
+                                       MachineInstr *&ExtMI) const;
+  LLVM_ABI void applyExtendThroughPhis(MachineInstr &MI,
+                                       MachineInstr *&ExtMI) const;
 
-  bool matchExtractVecEltBuildVec(MachineInstr &MI, Register &Reg) const;
-  void applyExtractVecEltBuildVec(MachineInstr &MI, Register &Reg) const;
+  LLVM_ABI bool matchExtractVecEltBuildVec(MachineInstr &MI,
+                                           Register &Reg) const;
+  LLVM_ABI void applyExtractVecEltBuildVec(MachineInstr &MI,
+                                           Register &Reg) const;
 
-  bool matchExtractAllEltsFromBuildVector(
+  LLVM_ABI bool matchExtractAllEltsFromBuildVector(
       MachineInstr &MI,
       SmallVectorImpl<std::pair<Register, MachineInstr *>> &MatchInfo) const;
-  void applyExtractAllEltsFromBuildVector(
+  LLVM_ABI void applyExtractAllEltsFromBuildVector(
       MachineInstr &MI,
       SmallVectorImpl<std::pair<Register, MachineInstr *>> &MatchInfo) const;
 
   /// Use a function which takes in a MachineIRBuilder to perform a combine.
   /// By default, it erases the instruction \p MI from the function.
-  void applyBuildFn(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI void applyBuildFn(MachineInstr &MI, BuildFnTy &MatchInfo) const;
   /// Use a function which takes in a MachineIRBuilder to perform a combine.
   /// This variant does not erase \p MI after calling the build function.
-  void applyBuildFnNoErase(MachineInstr &MI, BuildFnTy &MatchInfo) const;
-
-  bool matchOrShiftToFunnelShift(MachineInstr &MI, bool AllowScalarConstants,
-                                 BuildFnTy &MatchInfo) const;
-  bool matchFunnelShiftToRotate(MachineInstr &MI) const;
-  void applyFunnelShiftToRotate(MachineInstr &MI) const;
-  bool matchRotateOutOfRange(MachineInstr &MI) const;
-  void applyRotateOutOfRange(MachineInstr &MI) const;
-
-  bool matchCombineBuildUnmerge(MachineInstr &MI, MachineRegisterInfo &MRI,
-                                Register &UnmergeSrc) const;
-  void applyCombineBuildUnmerge(MachineInstr &MI, MachineRegisterInfo &MRI,
-                                MachineIRBuilder &B,
-                                Register &UnmergeSrc) const;
+  LLVM_ABI void applyBuildFnNoErase(MachineInstr &MI,
+                                    BuildFnTy &MatchInfo) const;
 
-  bool matchUseVectorTruncate(MachineInstr &MI, Register &MatchInfo) const;
-  void applyUseVectorTruncate(MachineInstr &MI, Register &MatchInfo) const;
+  LLVM_ABI bool matchOrShiftToFunnelShift(MachineInstr &MI,
+                                          bool AllowScalarConstants,
+                                          BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchFunnelShiftToRotate(MachineInstr &MI) const;
+  LLVM_ABI void applyFunnelShiftToRotate(MachineInstr &MI) const;
+  LLVM_ABI bool matchRotateOutOfRange(MachineInstr &MI) const;
+  LLVM_ABI void applyRotateOutOfRange(MachineInstr &MI) const;
+
+  LLVM_ABI bool matchCombineBuildUnmerge(MachineInstr &MI,
+                                         MachineRegisterInfo &MRI,
+                                         Register &UnmergeSrc) const;
+  LLVM_ABI void applyCombineBuildUnmerge(MachineInstr &MI,
+                                         MachineRegisterInfo &MRI,
+                                         MachineIRBuilder &B,
+                                         Register &UnmergeSrc) const;
+
+  LLVM_ABI bool matchUseVectorTruncate(MachineInstr &MI,
+                                       Register &MatchInfo) const;
+  LLVM_ABI void applyUseVectorTruncate(MachineInstr &MI,
+                                       Register &MatchInfo) const;
 
   /// \returns true if a G_ICMP instruction \p MI can be replaced with a true
   /// or false constant based off of KnownBits information.
-  bool matchICmpToTrueFalseKnownBits(MachineInstr &MI,
-                                     int64_t &MatchInfo) const;
+  LLVM_ABI bool matchICmpToTrueFalseKnownBits(MachineInstr &MI,
+                                              int64_t &MatchInfo) const;
 
   /// \returns true if a G_ICMP \p MI can be replaced with its LHS based off of
   /// KnownBits information.
-  bool matchICmpToLHSKnownBits(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchICmpToLHSKnownBits(MachineInstr &MI,
+                                        BuildFnTy &MatchInfo) const;
 
   /// \returns true if (and (or x, c1), c2) can be replaced with (and x, c2)
-  bool matchAndOrDisjointMask(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchAndOrDisjointMask(MachineInstr &MI,
+                                       BuildFnTy &MatchInfo) const;
 
-  bool matchBitfieldExtractFromSExtInReg(MachineInstr &MI,
-                                         BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchBitfieldExtractFromSExtInReg(MachineInstr &MI,
+                                                  BuildFnTy &MatchInfo) const;
   /// Match: and (lshr x, cst), mask -> ubfx x, cst, width
-  bool matchBitfieldExtractFromAnd(MachineInstr &MI,
-                                   BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchBitfieldExtractFromAnd(MachineInstr &MI,
+                                            BuildFnTy &MatchInfo) const;
 
   /// Match: shr (shl x, n), k -> sbfx/ubfx x, pos, width
-  bool matchBitfieldExtractFromShr(MachineInstr &MI,
-                                   BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchBitfieldExtractFromShr(MachineInstr &MI,
+                                            BuildFnTy &MatchInfo) const;
 
   /// Match: shr (and x, n), k -> ubfx x, pos, width
-  bool matchBitfieldExtractFromShrAnd(MachineInstr &MI,
-                                      BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchBitfieldExtractFromShrAnd(MachineInstr &MI,
+                                               BuildFnTy &MatchInfo) const;
 
   // Helpers for reassociation:
-  bool matchReassocConstantInnerRHS(GPtrAdd &MI, MachineInstr *RHS,
-                                    BuildFnTy &MatchInfo) const;
-  bool matchReassocFoldConstantsInSubTree(GPtrAdd &MI, MachineInstr *LHS,
-                                          MachineInstr *RHS,
-                                          BuildFnTy &MatchInfo) const;
-  bool matchReassocConstantInnerLHS(GPtrAdd &MI, MachineInstr *LHS,
-                                    MachineInstr *RHS,
-                                    BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchReassocConstantInnerRHS(GPtrAdd &MI, MachineInstr *RHS,
+                                             BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchReassocFoldConstantsInSubTree(GPtrAdd &MI,
+                                                   MachineInstr *LHS,
+                                                   MachineInstr *RHS,
+                                                   BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchReassocConstantInnerLHS(GPtrAdd &MI, MachineInstr *LHS,
+                                             MachineInstr *RHS,
+                                             BuildFnTy &MatchInfo) const;
   /// Reassociate pointer calculations with G_ADD involved, to allow better
   /// addressing mode usage.
-  bool matchReassocPtrAdd(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchReassocPtrAdd(MachineInstr &MI,
+                                   BuildFnTy &MatchInfo) const;
 
   /// Try to reassociate to reassociate operands of a commutative binop.
-  bool tryReassocBinOp(unsigned Opc, Register DstReg, Register Op0,
-                       Register Op1, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool tryReassocBinOp(unsigned Opc, Register DstReg, Register Op0,
+                                Register Op1, BuildFnTy &MatchInfo) const;
   /// Reassociate commutative binary operations like G_ADD.
-  bool matchReassocCommBinOp(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchReassocCommBinOp(MachineInstr &MI,
+                                      BuildFnTy &MatchInfo) const;
 
   /// Do constant folding when opportunities are exposed after MIR building.
-  bool matchConstantFoldCastOp(MachineInstr &MI, APInt &MatchInfo) const;
+  LLVM_ABI bool matchConstantFoldCastOp(MachineInstr &MI,
+                                        APInt &MatchInfo) const;
 
   /// Do constant folding when opportunities are exposed after MIR building.
-  bool matchConstantFoldBinOp(MachineInstr &MI, APInt &MatchInfo) const;
+  LLVM_ABI bool matchConstantFoldBinOp(MachineInstr &MI,
+                                       APInt &MatchInfo) const;
 
   /// Do constant FP folding when opportunities are exposed after MIR building.
-  bool matchConstantFoldFPBinOp(MachineInstr &MI, ConstantFP *&MatchInfo) const;
+  LLVM_ABI bool matchConstantFoldFPBinOp(MachineInstr &MI,
+                                         ConstantFP *&MatchInfo) const;
 
   /// Constant fold G_FMA/G_FMAD.
-  bool matchConstantFoldFMA(MachineInstr &MI, ConstantFP *&MatchInfo) const;
+  LLVM_ABI bool matchConstantFoldFMA(MachineInstr &MI,
+                                     ConstantFP *&MatchInfo) const;
 
   /// \returns true if it is possible to narrow the width of a scalar binop
   /// feeding a G_AND instruction \p MI.
-  bool matchNarrowBinopFeedingAnd(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchNarrowBinopFeedingAnd(MachineInstr &MI,
+                                           BuildFnTy &MatchInfo) const;
 
   /// Given an G_UDIV \p MI or G_UREM \p MI expressing a divide by constant,
   /// return an expression that implements it by multiplying by a magic number.
   /// Ref: "Hacker's Delight" or "The PowerPC Compiler Writer's Guide".
-  MachineInstr *buildUDivOrURemUsingMul(MachineInstr &MI) const;
+  LLVM_ABI MachineInstr *buildUDivOrURemUsingMul(MachineInstr &MI) const;
   /// Combine G_UDIV or G_UREM by constant into a multiply by magic constant.
-  bool matchUDivOrURemByConst(MachineInstr &MI) const;
-  void applyUDivOrURemByConst(MachineInstr &MI) const;
+  LLVM_ABI bool matchUDivOrURemByConst(MachineInstr &MI) const;
+  LLVM_ABI void applyUDivOrURemByConst(MachineInstr &MI) const;
 
   /// Given an G_SDIV \p MI or G_SREM \p MI expressing a signed divide by
   /// constant, return an expression that implements it by multiplying by a
   /// magic number. Ref: "Hacker's Delight" or "The PowerPC Compiler Writer's
   /// Guide".
-  MachineInstr *buildSDivOrSRemUsingMul(MachineInstr &MI) const;
+  LLVM_ABI MachineInstr *buildSDivOrSRemUsingMul(MachineInstr &MI) const;
   /// Combine G_SDIV or G_SREM by constant into a multiply by magic constant.
-  bool matchSDivOrSRemByConst(MachineInstr &MI) const;
-  void applySDivOrSRemByConst(MachineInstr &MI) const;
+  LLVM_ABI bool matchSDivOrSRemByConst(MachineInstr &MI) const;
+  LLVM_ABI void applySDivOrSRemByConst(MachineInstr &MI) const;
 
   /// Given an G_SDIV \p MI expressing a signed divided by a pow2 constant,
   /// return expressions that implements it by shifting.
-  bool matchDivByPow2(MachineInstr &MI, bool IsSigned) const;
-  void applySDivByPow2(MachineInstr &MI) const;
+  LLVM_ABI bool matchDivByPow2(MachineInstr &MI, bool IsSigned) const;
+  LLVM_ABI void applySDivByPow2(MachineInstr &MI) const;
   /// Given an G_UDIV \p MI expressing an unsigned divided by a pow2 constant,
   /// return expressions that implements it by shifting.
-  void applyUDivByPow2(MachineInstr &MI) const;
+  LLVM_ABI void applyUDivByPow2(MachineInstr &MI) const;
 
   // G_UMULH x, (1 << c)) -> x >> (bitwidth - c)
-  bool matchUMulHToLShr(MachineInstr &MI) const;
-  void applyUMulHToLShr(MachineInstr &MI) const;
+  LLVM_ABI bool matchUMulHToLShr(MachineInstr &MI) const;
+  LLVM_ABI void applyUMulHToLShr(MachineInstr &MI) const;
 
   // Combine trunc(smin(smax(x, C1), C2)) -> truncssat_s(x)
   // or      trunc(smax(smin(x, C2), C1)) -> truncssat_s(x).
-  bool matchTruncSSatS(MachineInstr &MI, Register &MatchInfo) const;
-  void applyTruncSSatS(MachineInstr &MI, Register &MatchInfo) const;
+  LLVM_ABI bool matchTruncSSatS(MachineInstr &MI, Register &MatchInfo) const;
+  LLVM_ABI void applyTruncSSatS(MachineInstr &MI, Register &MatchInfo) const;
 
   // Combine trunc(smin(smax(x, 0), C)) -> truncssat_u(x)
   // or      trunc(smax(smin(x, C), 0)) -> truncssat_u(x)
   // or      trunc(umin(smax(x, 0), C)) -> truncssat_u(x)
-  bool matchTruncSSatU(MachineInstr &MI, Register &MatchInfo) const;
-  void applyTruncSSatU(MachineInstr &MI, Register &MatchInfo) const;
+  LLVM_ABI bool matchTruncSSatU(MachineInstr &MI, Register &MatchInfo) const;
+  LLVM_ABI void applyTruncSSatU(MachineInstr &MI, Register &MatchInfo) const;
 
   // Combine trunc(umin(x, C)) -> truncusat_u(x).
-  bool matchTruncUSatU(MachineInstr &MI, MachineInstr &MinMI) const;
+  LLVM_ABI bool matchTruncUSatU(MachineInstr &MI, MachineInstr &MinMI) const;
 
   // Combine truncusat_u(fptoui(x)) -> fptoui_sat(x)
-  bool matchTruncUSatUToFPTOUISat(MachineInstr &MI, MachineInstr &SrcMI) const;
+  LLVM_ABI bool matchTruncUSatUToFPTOUISat(MachineInstr &MI,
+                                           MachineInstr &SrcMI) const;
 
   /// Try to transform \p MI by using all of the above
   /// combine functions. Returns true if changed.
-  bool tryCombine(MachineInstr &MI) const;
+  LLVM_ABI bool tryCombine(MachineInstr &MI) const;
 
   /// Emit loads and stores that perform the given memcpy.
   /// Assumes \p MI is a G_MEMCPY_INLINE
   /// TODO: implement dynamically sized inline memcpy,
   ///       and rename: s/bool tryEmit/void emit/
-  bool tryEmitMemcpyInline(MachineInstr &MI) const;
+  LLVM_ABI bool tryEmitMemcpyInline(MachineInstr &MI) const;
 
   /// Match:
   ///   (G_UMULO x, 2) -> (G_UADDO x, x)
   ///   (G_SMULO x, 2) -> (G_SADDO x, x)
-  bool matchMulOBy2(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchMulOBy2(MachineInstr &MI, BuildFnTy &MatchInfo) const;
 
   /// Match:
   /// (G_*MULO x, 0) -> 0 + no carry out
-  bool matchMulOBy0(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchMulOBy0(MachineInstr &MI, BuildFnTy &MatchInfo) const;
 
   /// Match:
   /// (G_*ADDE x, y, 0) -> (G_*ADDO x, y)
   /// (G_*SUBE x, y, 0) -> (G_*SUBO x, y)
-  bool matchAddEToAddO(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchAddEToAddO(MachineInstr &MI, BuildFnTy &MatchInfo) const;
 
   /// Transform (fadd x, fneg(y)) -> (fsub x, y)
   ///           (fadd fneg(x), y) -> (fsub y, x)
@@ -794,89 +855,97 @@ class CombinerHelper {
   ///           (fdiv fneg(x), fneg(y)) -> (fdiv x, y)
   ///           (fmad fneg(x), fneg(y), z) -> (fmad x, y, z)
   ///           (fma fneg(x), fneg(y), z) -> (fma x, y, z)
-  bool matchRedundantNegOperands(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchRedundantNegOperands(MachineInstr &MI,
+                                          BuildFnTy &MatchInfo) const;
 
-  bool matchFsubToFneg(MachineInstr &MI, Register &MatchInfo) const;
-  void applyFsubToFneg(MachineInstr &MI, Register &MatchInfo) const;
+  LLVM_ABI bool matchFsubToFneg(MachineInstr &MI, Register &MatchInfo) const;
+  LLVM_ABI void applyFsubToFneg(MachineInstr &MI, Register &MatchInfo) const;
 
-  bool canCombineFMadOrFMA(MachineInstr &MI, bool &AllowFusionGlobally,
-                           bool &HasFMAD, bool &Aggressive,
-                           bool CanReassociate = false) const;
+  LLVM_ABI bool canCombineFMadOrFMA(MachineInstr &MI, bool &AllowFusionGlobally,
+                                    bool &HasFMAD, bool &Aggressive,
+                                    bool CanReassociate = false) const;
 
   /// Transform (fadd (fmul x, y), z) -> (fma x, y, z)
   ///           (fadd (fmul x, y), z) -> (fmad x, y, z)
-  bool matchCombineFAddFMulToFMadOrFMA(MachineInstr &MI,
-                                       BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCombineFAddFMulToFMadOrFMA(MachineInstr &MI,
+                                                BuildFnTy &MatchInfo) const;
 
   /// Transform (fadd (fpext (fmul x, y)), z) -> (fma (fpext x), (fpext y), z)
   ///           (fadd (fpext (fmul x, y)), z) -> (fmad (fpext x), (fpext y), z)
-  bool matchCombineFAddFpExtFMulToFMadOrFMA(MachineInstr &MI,
-                                            BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool
+  matchCombineFAddFpExtFMulToFMadOrFMA(MachineInstr &MI,
+                                       BuildFnTy &MatchInfo) const;
 
   /// Transform (fadd (fma x, y, (fmul u, v)), z) -> (fma x, y, (fma u, v, z))
   ///          (fadd (fmad x, y, (fmul u, v)), z) -> (fmad x, y, (fmad u, v, z))
-  bool matchCombineFAddFMAFMulToFMadOrFMA(MachineInstr &MI,
-                                          BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCombineFAddFMAFMulToFMadOrFMA(MachineInstr &MI,
+                                                   BuildFnTy &MatchInfo) const;
 
   // Transform (fadd (fma x, y, (fpext (fmul u, v))), z)
   //            -> (fma x, y, (fma (fpext u), (fpext v), z))
   //           (fadd (fmad x, y, (fpext (fmul u, v))), z)
   //            -> (fmad x, y, (fmad (fpext u), (fpext v), z))
-  bool
+  LLVM_ABI bool
   matchCombineFAddFpExtFMulToFMadOrFMAAggressive(MachineInstr &MI,
                                                  BuildFnTy &MatchInfo) const;
 
   /// Transform (fsub (fmul x, y), z) -> (fma x, y, -z)
   ///           (fsub (fmul x, y), z) -> (fmad x, y, -z)
-  bool matchCombineFSubFMulToFMadOrFMA(MachineInstr &MI,
-                                       BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCombineFSubFMulToFMadOrFMA(MachineInstr &MI,
+                                                BuildFnTy &MatchInfo) const;
 
   /// Transform (fsub (fneg (fmul, x, y)), z) -> (fma (fneg x), y, (fneg z))
   ///           (fsub (fneg (fmul, x, y)), z) -> (fmad (fneg x), y, (fneg z))
-  bool matchCombineFSubFNegFMulToFMadOrFMA(MachineInstr &MI,
-                                           BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCombineFSubFNegFMulToFMadOrFMA(MachineInstr &MI,
+                                                    BuildFnTy &MatchInfo) const;
 
   /// Transform (fsub (fpext (fmul x, y)), z)
   ///           -> (fma (fpext x), (fpext y), (fneg z))
   ///           (fsub (fpext (fmul x, y)), z)
   ///           -> (fmad (fpext x), (fpext y), (fneg z))
-  bool matchCombineFSubFpExtFMulToFMadOrFMA(MachineInstr &MI,
-                                            BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool
+  matchCombineFSubFpExtFMulToFMadOrFMA(MachineInstr &MI,
+                                       BuildFnTy &MatchInfo) const;
 
   /// Transform (fsub (fpext (fneg (fmul x, y))), z)
   ///           -> (fneg (fma (fpext x), (fpext y), z))
   ///           (fsub (fpext (fneg (fmul x, y))), z)
   ///           -> (fneg (fmad (fpext x), (fpext y), z))
-  bool matchCombineFSubFpExtFNegFMulToFMadOrFMA(MachineInstr &MI,
-                                                BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool
+  matchCombineFSubFpExtFNegFMulToFMadOrFMA(MachineInstr &MI,
+                                           BuildFnTy &MatchInfo) const;
 
-  bool matchCombineFMinMaxNaN(MachineInstr &MI, unsigned &Info) const;
+  LLVM_ABI bool matchCombineFMinMaxNaN(MachineInstr &MI, unsigned &Info) const;
 
-  bool matchRepeatedFPDivisor(MachineInstr &MI,
-                              SmallVector<MachineInstr *> &MatchInfo) const;
-  void applyRepeatedFPDivisor(SmallVector<MachineInstr *> &MatchInfo) const;
+  LLVM_ABI bool
+  matchRepeatedFPDivisor(MachineInstr &MI,
+                         SmallVector<MachineInstr *> &MatchInfo) const;
+  LLVM_ABI void
+  applyRepeatedFPDivisor(SmallVector<MachineInstr *> &MatchInfo) const;
 
   /// Transform G_ADD(x, G_SUB(y, x)) to y.
   /// Transform G_ADD(G_SUB(y, x), x) to y.
-  bool matchAddSubSameReg(MachineInstr &MI, Register &Src) const;
+  LLVM_ABI bool matchAddSubSameReg(MachineInstr &MI, Register &Src) const;
 
-  bool matchBuildVectorIdentityFold(MachineInstr &MI,
-                                    Register &MatchInfo) const;
-  bool matchTruncBuildVectorFold(MachineInstr &MI, Register &MatchInfo) const;
-  bool matchTruncLshrBuildVectorFold(MachineInstr &MI,
-                                     Register &MatchInfo) const;
+  LLVM_ABI bool matchBuildVectorIdentityFold(MachineInstr &MI,
+                                             Register &MatchInfo) const;
+  LLVM_ABI bool matchTruncBuildVectorFold(MachineInstr &MI,
+                                          Register &MatchInfo) const;
+  LLVM_ABI bool matchTruncLshrBuildVectorFold(MachineInstr &MI,
+                                              Register &MatchInfo) const;
 
   /// Transform:
   ///   (x + y) - y -> x
   ///   (x + y) - x -> y
   ///   x - (y + x) -> 0 - y
   ///   x - (x + z) -> 0 - z
-  bool matchSubAddSameReg(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchSubAddSameReg(MachineInstr &MI,
+                                   BuildFnTy &MatchInfo) const;
 
   /// \returns true if it is possible to simplify a select instruction \p MI
   /// to a min/max instruction of some sort.
-  bool matchSimplifySelectToMinMax(MachineInstr &MI,
-                                   BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchSimplifySelectToMinMax(MachineInstr &MI,
+                                            BuildFnTy &MatchInfo) const;
 
   /// Transform:
   ///   (X + Y) == X -> Y == 0
@@ -885,170 +954,193 @@ class CombinerHelper {
   ///   (X + Y) != X -> Y != 0
   ///   (X - Y) != X -> Y != 0
   ///   (X ^ Y) != X -> Y != 0
-  bool matchRedundantBinOpInEquality(MachineInstr &MI,
-                                     BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchRedundantBinOpInEquality(MachineInstr &MI,
+                                              BuildFnTy &MatchInfo) const;
 
   /// Match shifts greater or equal to the range (the bitwidth of the result
   /// datatype, or the effective bitwidth of the source value).
-  bool matchShiftsTooBig(MachineInstr &MI,
-                         std::optional<int64_t> &MatchInfo) const;
+  LLVM_ABI bool matchShiftsTooBig(MachineInstr &MI,
+                                  std::optional<int64_t> &MatchInfo) const;
 
   /// Match constant LHS ops that should be commuted.
-  bool matchCommuteConstantToRHS(MachineInstr &MI) const;
+  LLVM_ABI bool matchCommuteConstantToRHS(MachineInstr &MI) const;
 
   /// Combine sext of trunc.
-  bool matchSextOfTrunc(const MachineOperand &MO, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchSextOfTrunc(const MachineOperand &MO,
+                                 BuildFnTy &MatchInfo) const;
 
   /// Combine zext of trunc.
-  bool matchZextOfTrunc(const MachineOperand &MO, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchZextOfTrunc(const MachineOperand &MO,
+                                 BuildFnTy &MatchInfo) const;
 
   /// Combine zext nneg to sext.
-  bool matchNonNegZext(const MachineOperand &MO, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchNonNegZext(const MachineOperand &MO,
+                                BuildFnTy &MatchInfo) const;
 
   /// Match constant LHS FP ops that should be commuted.
-  bool matchCommuteFPConstantToRHS(MachineInstr &MI) const;
+  LLVM_ABI bool matchCommuteFPConstantToRHS(MachineInstr &MI) const;
 
   // Given a binop \p MI, commute operands 1 and 2.
-  void applyCommuteBinOpOperands(MachineInstr &MI) const;
+  LLVM_ABI void applyCommuteBinOpOperands(MachineInstr &MI) const;
 
   /// Combine select to integer min/max.
-  bool matchSelectIMinMax(const MachineOperand &MO, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchSelectIMinMax(const MachineOperand &MO,
+                                   BuildFnTy &MatchInfo) const;
 
   /// Tranform (neg (min/max x, (neg x))) into (max/min x, (neg x)).
-  bool matchSimplifyNegMinMax(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchSimplifyNegMinMax(MachineInstr &MI,
+                                       BuildFnTy &MatchInfo) const;
 
   /// Combine selects.
-  bool matchSelect(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchSelect(MachineInstr &MI, BuildFnTy &MatchInfo) const;
 
   /// Combine ands.
-  bool matchAnd(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchAnd(MachineInstr &MI, BuildFnTy &MatchInfo) const;
 
   /// Combine ors.
-  bool matchOr(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchOr(MachineInstr &MI, BuildFnTy &MatchInfo) const;
 
   /// trunc (binop X, C) --> binop (trunc X, trunc C).
-  bool matchNarrowBinop(const MachineInstr &TruncMI,
-                        const MachineInstr &BinopMI,
-                        BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchNarrowBinop(const MachineInstr &TruncMI,
+                                 const MachineInstr &BinopMI,
+                                 BuildFnTy &MatchInfo) const;
 
-  bool matchCastOfInteger(const MachineInstr &CastMI, APInt &MatchInfo) const;
+  LLVM_ABI bool matchCastOfInteger(const MachineInstr &CastMI,
+                                   APInt &MatchInfo) const;
 
   /// Combine addos.
-  bool matchAddOverflow(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchAddOverflow(MachineInstr &MI, BuildFnTy &MatchInfo) const;
 
   /// Combine extract vector element.
-  bool matchExtractVectorElement(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchExtractVectorElement(MachineInstr &MI,
+                                          BuildFnTy &MatchInfo) const;
 
   /// Combine extract vector element with a build vector on the vector register.
-  bool matchExtractVectorElementWithBuildVector(const MachineInstr &MI,
-                                                const MachineInstr &MI2,
-                                                BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool
+  matchExtractVectorElementWithBuildVector(const MachineInstr &MI,
+                                           const MachineInstr &MI2,
+                                           BuildFnTy &MatchInfo) const;
 
   /// Combine extract vector element with a build vector trunc on the vector
   /// register.
-  bool
+  LLVM_ABI bool
   matchExtractVectorElementWithBuildVectorTrunc(const MachineOperand &MO,
                                                 BuildFnTy &MatchInfo) const;
 
   /// Combine extract vector element with a shuffle vector on the vector
   /// register.
-  bool matchExtractVectorElementWithShuffleVector(const MachineInstr &MI,
-                                                  const MachineInstr &MI2,
-                                                  BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool
+  matchExtractVectorElementWithShuffleVector(const MachineInstr &MI,
+                                             const MachineInstr &MI2,
+                                             BuildFnTy &MatchInfo) const;
 
   /// Combine extract vector element with a insert vector element on the vector
   /// register and different indices.
-  bool
+  LLVM_ABI bool
   matchExtractVectorElementWithDifferentIndices(const MachineOperand &MO,
                                                 BuildFnTy &MatchInfo) const;
 
   /// Remove references to rhs if it is undef
-  bool matchShuffleUndefRHS(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchShuffleUndefRHS(MachineInstr &MI,
+                                     BuildFnTy &MatchInfo) const;
 
   /// Turn shuffle a, b, mask -> shuffle undef, b, mask iff mask does not
   /// reference a.
-  bool matchShuffleDisjointMask(MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchShuffleDisjointMask(MachineInstr &MI,
+                                         BuildFnTy &MatchInfo) const;
 
   /// Use a function which takes in a MachineIRBuilder to perform a combine.
   /// By default, it erases the instruction def'd on \p MO from the function.
-  void applyBuildFnMO(const MachineOperand &MO, BuildFnTy &MatchInfo) const;
+  LLVM_ABI void applyBuildFnMO(const MachineOperand &MO,
+                               BuildFnTy &MatchInfo) const;
 
   /// Match FPOWI if it's safe to extend it into a series of multiplications.
-  bool matchFPowIExpansion(MachineInstr &MI, int64_t Exponent) const;
+  LLVM_ABI bool matchFPowIExpansion(MachineInstr &MI, int64_t Exponent) const;
 
   /// Expands FPOWI into a series of multiplications and a division if the
   /// exponent is negative.
-  void applyExpandFPowI(MachineInstr &MI, int64_t Exponent) const;
+  LLVM_ABI void applyExpandFPowI(MachineInstr &MI, int64_t Exponent) const;
 
   /// Combine insert vector element OOB.
-  bool matchInsertVectorElementOOB(MachineInstr &MI,
-                                   BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchInsertVectorElementOOB(MachineInstr &MI,
+                                            BuildFnTy &MatchInfo) const;
 
-  bool matchFreezeOfSingleMaybePoisonOperand(MachineInstr &MI,
-                                             BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool
+  matchFreezeOfSingleMaybePoisonOperand(MachineInstr &MI,
+                                        BuildFnTy &MatchInfo) const;
 
-  bool matchAddOfVScale(const MachineOperand &MO, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchAddOfVScale(const MachineOperand &MO,
+                                 BuildFnTy &MatchInfo) const;
 
-  bool matchMulOfVScale(const MachineOperand &MO, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchMulOfVScale(const MachineOperand &MO,
+                                 BuildFnTy &MatchInfo) const;
 
-  bool matchSubOfVScale(const MachineOperand &MO, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchSubOfVScale(const MachineOperand &MO,
+                                 BuildFnTy &MatchInfo) const;
 
-  bool matchShlOfVScale(const MachineOperand &MO, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchShlOfVScale(const MachineOperand &MO,
+                                 BuildFnTy &MatchInfo) const;
 
   /// Transform trunc ([asz]ext x) to x or ([asz]ext x) or (trunc x).
-  bool matchTruncateOfExt(const MachineInstr &Root, const MachineInstr &ExtMI,
-                          BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchTruncateOfExt(const MachineInstr &Root,
+                                   const MachineInstr &ExtMI,
+                                   BuildFnTy &MatchInfo) const;
 
-  bool matchCastOfSelect(const MachineInstr &Cast, const MachineInstr &SelectMI,
-                         BuildFnTy &MatchInfo) const;
-  bool matchFoldAPlusC1MinusC2(const MachineInstr &MI,
-                               BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCastOfSelect(const MachineInstr &Cast,
+                                  const MachineInstr &SelectMI,
+                                  BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchFoldAPlusC1MinusC2(const MachineInstr &MI,
+                                        BuildFnTy &MatchInfo) const;
 
-  bool matchFoldC2MinusAPlusC1(const MachineInstr &MI,
-                               BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchFoldC2MinusAPlusC1(const MachineInstr &MI,
+                                        BuildFnTy &MatchInfo) const;
 
-  bool matchFoldAMinusC1MinusC2(const MachineInstr &MI,
-                                BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchFoldAMinusC1MinusC2(const MachineInstr &MI,
+                                         BuildFnTy &MatchInfo) const;
 
-  bool matchFoldC1Minus2MinusC2(const MachineInstr &MI,
-                                BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchFoldC1Minus2MinusC2(const MachineInstr &MI,
+                                         BuildFnTy &MatchInfo) const;
 
   // fold ((A-C1)+C2) -> (A+(C2-C1))
-  bool matchFoldAMinusC1PlusC2(const MachineInstr &MI,
-                               BuildFnTy &MatchInfo) const;
-
-  bool matchExtOfExt(const MachineInstr &FirstMI, const MachineInstr &SecondMI,
-                     BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchFoldAMinusC1PlusC2(const MachineInstr &MI,
+                                        BuildFnTy &MatchInfo) const;
 
-  bool matchCastOfBuildVector(const MachineInstr &CastMI,
-                              const MachineInstr &BVMI,
+  LLVM_ABI bool matchExtOfExt(const MachineInstr &FirstMI,
+                              const MachineInstr &SecondMI,
                               BuildFnTy &MatchInfo) const;
 
-  bool matchCanonicalizeICmp(const MachineInstr &MI,
-                             BuildFnTy &MatchInfo) const;
-  bool matchCanonicalizeFCmp(const MachineInstr &MI,
-                             BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCastOfBuildVector(const MachineInstr &CastMI,
+                                       const MachineInstr &BVMI,
+                                       BuildFnTy &MatchInfo) const;
+
+  LLVM_ABI bool matchCanonicalizeICmp(const MachineInstr &MI,
+                                      BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCanonicalizeFCmp(const MachineInstr &MI,
+                                      BuildFnTy &MatchInfo) const;
 
   // unmerge_values(anyext(build vector)) -> build vector(anyext)
-  bool matchUnmergeValuesAnyExtBuildVector(const MachineInstr &MI,
-                                           BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchUnmergeValuesAnyExtBuildVector(const MachineInstr &MI,
+                                                    BuildFnTy &MatchInfo) const;
 
   // merge_values(_, undef) -> anyext
-  bool matchMergeXAndUndef(const MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchMergeXAndUndef(const MachineInstr &MI,
+                                    BuildFnTy &MatchInfo) const;
 
   // merge_values(_, zero) -> zext
-  bool matchMergeXAndZero(const MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchMergeXAndZero(const MachineInstr &MI,
+                                   BuildFnTy &MatchInfo) const;
 
   // overflow sub
-  bool matchSuboCarryOut(const MachineInstr &MI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchSuboCarryOut(const MachineInstr &MI,
+                                  BuildFnTy &MatchInfo) const;
 
   // (sext_inreg (sext_inreg x, K0), K1)
-  bool matchRedundantSextInReg(MachineInstr &Root, MachineInstr &Other,
-                               BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchRedundantSextInReg(MachineInstr &Root, MachineInstr &Other,
+                                        BuildFnTy &MatchInfo) const;
 
   // (ctlz (xor x, (sra x, bitwidth-1))) -> (add (ctls x), 1) or
   // (ctlz (or (shl (xor x, (sra x, bitwidth-1)), 1), 1) -> (ctls x)
-  bool matchCtls(MachineInstr &CtlzMI, BuildFnTy &MatchInfo) const;
+  LLVM_ABI bool matchCtls(MachineInstr &CtlzMI, BuildFnTy &MatchInfo) const;
 
 private:
   /// Checks for legality of an indexed variant of \p LdSt.
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h b/llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
index 3828d859212cb..8a611fc9ee696 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
@@ -28,6 +28,7 @@
 #include "llvm/CodeGen/SwitchLoweringUtils.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/CodeGen.h"
+#include "llvm/Support/Compiler.h"
 #include <memory>
 #include <utility>
 
@@ -63,7 +64,7 @@ class Value;
 // the information from the LLVM IR.
 // The idea is that ultimately we would be able to free up the memory used
 // by the LLVM IR as soon as the translation is over.
-class IRTranslator : public MachineFunctionPass {
+class LLVM_ABI IRTranslator : public MachineFunctionPass {
 public:
   static char ID;
 
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/InlineAsmLowering.h b/llvm/include/llvm/CodeGen/GlobalISel/InlineAsmLowering.h
index ac6184877b936..040818dac10f1 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/InlineAsmLowering.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/InlineAsmLowering.h
@@ -15,6 +15,7 @@
 #define LLVM_CODEGEN_GLOBALISEL_INLINEASMLOWERING_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Compiler.h"
 #include <functional>
 
 namespace llvm {
@@ -25,7 +26,7 @@ class Register;
 class TargetLowering;
 class Value;
 
-class InlineAsmLowering {
+class LLVM_ABI InlineAsmLowering {
   const TargetLowering *TLI;
 
   virtual void anchor();
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h b/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
index 36744de92128d..522b4464e6071 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
@@ -209,7 +209,8 @@ class LegalizerHelper {
                                             Type *FromType,
                                             LostDebugLocObserver &LocObserver,
                                             bool IsSigned = false) const;
-  LegalizerHelper::LegalizeResult createAtomicLibcall(MachineInstr &MI) const;
+  LLVM_ABI LegalizerHelper::LegalizeResult
+  createAtomicLibcall(MachineInstr &MI) const;
 
   /// Create a libcall to memcpy et al.
   LLVM_ABI LegalizeResult
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/Localizer.h b/llvm/include/llvm/CodeGen/GlobalISel/Localizer.h
index 4c25c9c2a8345..f323b23b07df5 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/Localizer.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/Localizer.h
@@ -23,6 +23,7 @@
 
 #include "llvm/ADT/SetVector.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 // Forward declarations.
@@ -40,7 +41,7 @@ class TargetTransformInfo;
 /// Moreover, it only materializes constants in blocks where they
 /// are used. PHI uses are considered happening at the end of the
 /// related predecessor.
-class Localizer : public MachineFunctionPass {
+class LLVM_ABI Localizer : public MachineFunctionPass {
 public:
   static char ID;
 
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h b/llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h
index 6060bb6144c62..e5e6f86ec8457 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h
@@ -70,6 +70,7 @@
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
 #include "llvm/CodeGen/RegisterBankInfo.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <cstdint>
 #include <memory>
@@ -88,7 +89,7 @@ class TargetRegisterInfo;
 
 /// This pass implements the reg bank selector pass used in the GlobalISel
 /// pipeline. At the end of this pass, all register operands have been assigned
-class RegBankSelect : public MachineFunctionPass {
+class LLVM_ABI RegBankSelect : public MachineFunctionPass {
 public:
   static char ID;
 
@@ -201,7 +202,7 @@ class RegBankSelect : public MachineFunctionPass {
   };
 
   /// Insertion point before or after an instruction.
-  class InstrInsertPoint : public InsertPoint {
+  class LLVM_ABI InstrInsertPoint : public InsertPoint {
   private:
     /// Insertion point.
     MachineInstr &Instr;
@@ -234,7 +235,7 @@ class RegBankSelect : public MachineFunctionPass {
   };
 
   /// Insertion point at the beginning or end of a basic block.
-  class MBBInsertPoint : public InsertPoint {
+  class LLVM_ABI MBBInsertPoint : public InsertPoint {
   private:
     /// Insertion point.
     MachineBasicBlock &MBB;
@@ -270,7 +271,7 @@ class RegBankSelect : public MachineFunctionPass {
   };
 
   /// Insertion point on an edge.
-  class EdgeInsertPoint : public InsertPoint {
+  class LLVM_ABI EdgeInsertPoint : public InsertPoint {
   private:
     /// Source of the edge.
     MachineBasicBlock &Src;
@@ -353,9 +354,9 @@ class RegBankSelect : public MachineFunctionPass {
     /// if the machine operand is a physical register. \p P is used to
     /// to update liveness information and such when materializing the
     /// points.
-    RepairingPlacement(MachineInstr &MI, unsigned OpIdx,
-                       const TargetRegisterInfo &TRI, Pass &P,
-                       RepairingKind Kind = RepairingKind::Insert);
+    LLVM_ABI RepairingPlacement(MachineInstr &MI, unsigned OpIdx,
+                                const TargetRegisterInfo &TRI, Pass &P,
+                                RepairingKind Kind = RepairingKind::Insert);
 
     /// \name Getters.
     /// @{
@@ -368,14 +369,15 @@ class RegBankSelect : public MachineFunctionPass {
     /// \name Overloaded methods to add an insertion point.
     /// @{
     /// Add a MBBInsertionPoint to the list of InsertPoints.
-    void addInsertPoint(MachineBasicBlock &MBB, bool Beginning);
+    LLVM_ABI void addInsertPoint(MachineBasicBlock &MBB, bool Beginning);
     /// Add a InstrInsertionPoint to the list of InsertPoints.
-    void addInsertPoint(MachineInstr &MI, bool Before);
+    LLVM_ABI void addInsertPoint(MachineInstr &MI, bool Before);
     /// Add an EdgeInsertionPoint (\p Src, \p Dst) to the list of InsertPoints.
-    void addInsertPoint(MachineBasicBlock &Src, MachineBasicBlock &Dst);
+    LLVM_ABI void addInsertPoint(MachineBasicBlock &Src,
+                                 MachineBasicBlock &Dst);
     /// Add an InsertPoint to the list of insert points.
     /// This method takes the ownership of &\p Point.
-    void addInsertPoint(InsertPoint &Point);
+    LLVM_ABI void addInsertPoint(InsertPoint &Point);
     /// @}
 
     /// \name Accessors related to the insertion points.
@@ -440,28 +442,28 @@ class RegBankSelect : public MachineFunctionPass {
   public:
     /// Create a MappingCost assuming that most of the instructions
     /// will occur in a basic block with \p LocalFreq frequency.
-    MappingCost(BlockFrequency LocalFreq);
+    LLVM_ABI MappingCost(BlockFrequency LocalFreq);
 
     /// Add \p Cost to the local cost.
     /// \return true if this cost is saturated, false otherwise.
-    bool addLocalCost(uint64_t Cost);
+    LLVM_ABI bool addLocalCost(uint64_t Cost);
 
     /// Add \p Cost to the non-local cost.
     /// Non-local cost should reflect the frequency of their placement.
     /// \return true if this cost is saturated, false otherwise.
-    bool addNonLocalCost(uint64_t Cost);
+    LLVM_ABI bool addNonLocalCost(uint64_t Cost);
 
     /// Saturate the cost to the maximal representable value.
-    void saturate();
+    LLVM_ABI void saturate();
 
     /// Return an instance of MappingCost that represents an
     /// impossible mapping.
-    static MappingCost ImpossibleCost();
+    LLVM_ABI static MappingCost ImpossibleCost();
 
     /// Check if this is less than \p Cost.
-    bool operator<(const MappingCost &Cost) const;
+    LLVM_ABI bool operator<(const MappingCost &Cost) const;
     /// Check if this is equal to \p Cost.
-    bool operator==(const MappingCost &Cost) const;
+    LLVM_ABI bool operator==(const MappingCost &Cost) const;
     /// Check if this is not equal to \p Cost.
     bool operator!=(const MappingCost &Cost) const { return !(*this == Cost); }
     /// Check if this is greater than \p Cost.
@@ -470,10 +472,10 @@ class RegBankSelect : public MachineFunctionPass {
     }
 
     /// Print this on dbgs() stream.
-    void dump() const;
+    LLVM_ABI void dump() const;
 
     /// Print this on \p OS;
-    void print(raw_ostream &OS) const;
+    LLVM_ABI void print(raw_ostream &OS) const;
 
     /// Overload the stream operator for easy debug printing.
     friend raw_ostream &operator<<(raw_ostream &OS, const MappingCost &Cost) {
diff --git a/llvm/include/llvm/CodeGen/GlobalMerge.h b/llvm/include/llvm/CodeGen/GlobalMerge.h
index 2220e5cfff5fb..f7631505625e3 100644
--- a/llvm/include/llvm/CodeGen/GlobalMerge.h
+++ b/llvm/include/llvm/CodeGen/GlobalMerge.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_GLOBALMERGE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -48,7 +49,7 @@ class GlobalMergePass : public PassInfoMixin<GlobalMergePass> {
   GlobalMergePass(const TargetMachine *TM, GlobalMergeOptions Options)
       : TM(TM), Options(Options) {}
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h b/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h
index 54ea68a418846..9a5d932ffb657 100644
--- a/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h
+++ b/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h
@@ -29,6 +29,7 @@
 #include "llvm/IR/Module.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 enum class HashFunctionMode {
   Local,
@@ -62,18 +63,18 @@ class GlobalMergeFunc {
 
   GlobalMergeFunc(const ModuleSummaryIndex *Index) : Index(Index) {};
 
-  void initializeMergerMode(const Module &M);
+  LLVM_ABI void initializeMergerMode(const Module &M);
 
-  bool run(Module &M);
+  LLVM_ABI bool run(Module &M);
 
   /// Analyze module to create stable function into LocalFunctionMap.
-  void analyze(Module &M);
+  LLVM_ABI void analyze(Module &M);
 
   /// Emit LocalFunctionMap into __llvm_merge section.
-  void emitFunctionMap(Module &M);
+  LLVM_ABI void emitFunctionMap(Module &M);
 
   /// Merge functions in the module using the given function map.
-  bool merge(Module &M, const StableFunctionMap *FunctionMap);
+  LLVM_ABI bool merge(Module &M, const StableFunctionMap *FunctionMap);
 };
 
 /// Global function merging pass for new pass manager.
@@ -82,7 +83,7 @@ struct GlobalMergeFuncPass : public PassInfoMixin<GlobalMergeFuncPass> {
   GlobalMergeFuncPass() = default;
   GlobalMergeFuncPass(const ModuleSummaryIndex *ImportSummary)
       : ImportSummary(ImportSummary) {}
-  PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
+  LLVM_ABI PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/HardwareLoops.h b/llvm/include/llvm/CodeGen/HardwareLoops.h
index c7b6e0f5ae567..27dbc9a1fcca2 100644
--- a/llvm/include/llvm/CodeGen/HardwareLoops.h
+++ b/llvm/include/llvm/CodeGen/HardwareLoops.h
@@ -15,6 +15,7 @@
 #define LLVM_CODEGEN_HARDWARELOOPS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -68,7 +69,7 @@ class HardwareLoopsPass : public PassInfoMixin<HardwareLoopsPass> {
   explicit HardwareLoopsPass(HardwareLoopOptions Opts = {})
     : Opts(Opts) { }
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/IndirectBrExpand.h b/llvm/include/llvm/CodeGen/IndirectBrExpand.h
index 572a712fc28fe..202c138acb284 100644
--- a/llvm/include/llvm/CodeGen/IndirectBrExpand.h
+++ b/llvm/include/llvm/CodeGen/IndirectBrExpand.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_INDIRECTBREXPAND_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -20,7 +21,7 @@ class IndirectBrExpandPass : public PassInfoMixin<IndirectBrExpandPass> {
 
 public:
   IndirectBrExpandPass(const TargetMachine &TM) : TM(&TM) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/InitUndef.h b/llvm/include/llvm/CodeGen/InitUndef.h
index c4359afccfa00..50122ec9bbb31 100644
--- a/llvm/include/llvm/CodeGen/InitUndef.h
+++ b/llvm/include/llvm/CodeGen/InitUndef.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_INITUNDEF_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class InitUndefPass : public PassInfoMixin<InitUndefPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/InterleavedAccess.h b/llvm/include/llvm/CodeGen/InterleavedAccess.h
index 42bfa84ddc26d..eda69782d05b7 100644
--- a/llvm/include/llvm/CodeGen/InterleavedAccess.h
+++ b/llvm/include/llvm/CodeGen/InterleavedAccess.h
@@ -16,6 +16,7 @@
 #define LLVM_CODEGEN_INTERLEAVEDACCESS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -26,7 +27,7 @@ class InterleavedAccessPass : public PassInfoMixin<InterleavedAccessPass> {
 
 public:
   explicit InterleavedAccessPass(const TargetMachine &TM) : TM(&TM) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/InterleavedLoadCombine.h b/llvm/include/llvm/CodeGen/InterleavedLoadCombine.h
index 2750fd42bbfc8..9fd9fdc5acfa3 100644
--- a/llvm/include/llvm/CodeGen/InterleavedLoadCombine.h
+++ b/llvm/include/llvm/CodeGen/InterleavedLoadCombine.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_INTERLEAVEDLOADCOMBINE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -21,7 +22,7 @@ class InterleavedLoadCombinePass
 
 public:
   explicit InterleavedLoadCombinePass(const TargetMachine &TM) : TM(&TM) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/IntrinsicLowering.h b/llvm/include/llvm/CodeGen/IntrinsicLowering.h
index 0b327a34ca098..6e25069920418 100644
--- a/llvm/include/llvm/CodeGen/IntrinsicLowering.h
+++ b/llvm/include/llvm/CodeGen/IntrinsicLowering.h
@@ -15,6 +15,8 @@
 #ifndef LLVM_CODEGEN_INTRINSICLOWERING_H
 #define LLVM_CODEGEN_INTRINSICLOWERING_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 class CallInst;
 class DataLayout;
@@ -35,11 +37,11 @@ class IntrinsicLowering {
   /// implement it (often a call to a non-intrinsic function) is inserted
   /// _after_ the call instruction and the call is deleted. The caller must
   /// be capable of handling this kind of change.
-  void LowerIntrinsicCall(CallInst *CI);
+  LLVM_ABI void LowerIntrinsicCall(CallInst *CI);
 
   /// Try to replace a call instruction with a call to a bswap intrinsic. Return
   /// false if the call is not a simple integer bswap.
-  static bool LowerToByteSwap(CallInst *CI);
+  LLVM_ABI static bool LowerToByteSwap(CallInst *CI);
 };
 }
 
diff --git a/llvm/include/llvm/CodeGen/JMCInstrumenter.h b/llvm/include/llvm/CodeGen/JMCInstrumenter.h
index addac1654826c..15da7d2135632 100644
--- a/llvm/include/llvm/CodeGen/JMCInstrumenter.h
+++ b/llvm/include/llvm/CodeGen/JMCInstrumenter.h
@@ -10,12 +10,13 @@
 #define LLVM_CODEGEN_JMCINSTRUMENTER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class JMCInstrumenterPass : public PassInfoMixin<JMCInstrumenterPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/LatencyPriorityQueue.h b/llvm/include/llvm/CodeGen/LatencyPriorityQueue.h
index 556ef3f8cc788..0d514cebb76e1 100644
--- a/llvm/include/llvm/CodeGen/LatencyPriorityQueue.h
+++ b/llvm/include/llvm/CodeGen/LatencyPriorityQueue.h
@@ -17,6 +17,7 @@
 
 #include "llvm/CodeGen/ScheduleDAG.h"
 #include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
   class LatencyPriorityQueue;
@@ -26,10 +27,10 @@ namespace llvm {
     LatencyPriorityQueue *PQ;
     explicit latency_sort(LatencyPriorityQueue *pq) : PQ(pq) {}
 
-    bool operator()(const SUnit* LHS, const SUnit* RHS) const;
+    LLVM_ABI bool operator()(const SUnit *LHS, const SUnit *RHS) const;
   };
 
-  class LatencyPriorityQueue : public SchedulingPriorityQueue {
+  class LLVM_ABI LatencyPriorityQueue : public SchedulingPriorityQueue {
     // SUnits - The SUnits for the current graph.
     std::vector<SUnit> *SUnits = nullptr;
 
diff --git a/llvm/include/llvm/CodeGen/LazyMachineBlockFrequencyInfo.h b/llvm/include/llvm/CodeGen/LazyMachineBlockFrequencyInfo.h
index f7e5b0e4f9d2b..3528ce3a76133 100644
--- a/llvm/include/llvm/CodeGen/LazyMachineBlockFrequencyInfo.h
+++ b/llvm/include/llvm/CodeGen/LazyMachineBlockFrequencyInfo.h
@@ -20,6 +20,7 @@
 #include "llvm/CodeGen/MachineDominators.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineLoopInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 /// This is an alternative analysis pass to MachineBlockFrequencyInfo.
@@ -34,7 +35,7 @@ namespace llvm {
 /// Note that it is expected that we wouldn't need this functionality for the
 /// new PM since with the new PM, analyses are executed on demand.
 
-class LazyMachineBlockFrequencyInfoPass : public MachineFunctionPass {
+class LLVM_ABI LazyMachineBlockFrequencyInfoPass : public MachineFunctionPass {
 private:
   /// If generated on the fly this own the instance.
   mutable std::unique_ptr<MachineBlockFrequencyInfo> OwnedMBFI;
diff --git a/llvm/include/llvm/CodeGen/LibcallLoweringInfo.h b/llvm/include/llvm/CodeGen/LibcallLoweringInfo.h
index c0d72ea4d4d38..136642e10c44d 100644
--- a/llvm/include/llvm/CodeGen/LibcallLoweringInfo.h
+++ b/llvm/include/llvm/CodeGen/LibcallLoweringInfo.h
@@ -37,31 +37,30 @@ class LibcallLoweringInfo {
 
   /// Get the libcall routine name for the specified libcall.
   // FIXME: This should be removed. Only LibcallImpl should have a name.
-  LLVM_ABI const char *getLibcallName(RTLIB::Libcall Call) const {
+  const char *getLibcallName(RTLIB::Libcall Call) const {
     // FIXME: Return StringRef
     return RTLIB::RuntimeLibcallsInfo::getLibcallImplName(LibcallImpls[Call])
         .data();
   }
 
   /// Return the lowering's selection of implementation call for \p Call
-  LLVM_ABI RTLIB::LibcallImpl getLibcallImpl(RTLIB::Libcall Call) const {
+  RTLIB::LibcallImpl getLibcallImpl(RTLIB::Libcall Call) const {
     return LibcallImpls[Call];
   }
 
   /// Rename the default libcall routine name for the specified libcall.
-  LLVM_ABI void setLibcallImpl(RTLIB::Libcall Call, RTLIB::LibcallImpl Impl) {
+  void setLibcallImpl(RTLIB::Libcall Call, RTLIB::LibcallImpl Impl) {
     LibcallImpls[Call] = Impl;
   }
 
   // FIXME: Remove this wrapper in favor of directly using
   // getLibcallImplCallingConv
-  LLVM_ABI CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const {
+  CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const {
     return RTLCI.LibcallImplCallingConvs[LibcallImpls[Call]];
   }
 
   /// Get the CallingConv that should be used for the specified libcall.
-  LLVM_ABI CallingConv::ID
-  getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const {
+  CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const {
     return RTLCI.LibcallImplCallingConvs[Call];
   }
 
diff --git a/llvm/include/llvm/CodeGen/LiveDebugValuesPass.h b/llvm/include/llvm/CodeGen/LiveDebugValuesPass.h
index db8c233f15f64..bde78b7b45312 100644
--- a/llvm/include/llvm/CodeGen/LiveDebugValuesPass.h
+++ b/llvm/include/llvm/CodeGen/LiveDebugValuesPass.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_LIVEDEBUGVALUESPASS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -20,11 +21,12 @@ class LiveDebugValuesPass : public PassInfoMixin<LiveDebugValuesPass> {
   LiveDebugValuesPass(bool ShouldEmitDebugEntryValues)
       : ShouldEmitDebugEntryValues(ShouldEmitDebugEntryValues) {}
 
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/LiveDebugVariables.h b/llvm/include/llvm/CodeGen/LiveDebugVariables.h
index 9d737a8f66c92..ca70e614166fe 100644
--- a/llvm/include/llvm/CodeGen/LiveDebugVariables.h
+++ b/llvm/include/llvm/CodeGen/LiveDebugVariables.h
@@ -36,39 +36,39 @@ class LiveDebugVariables {
 
 public:
   class LDVImpl;
-  LiveDebugVariables();
-  ~LiveDebugVariables();
-  LiveDebugVariables(LiveDebugVariables &&);
+  LLVM_ABI LiveDebugVariables();
+  LLVM_ABI ~LiveDebugVariables();
+  LLVM_ABI LiveDebugVariables(LiveDebugVariables &&);
 
-  void analyze(MachineFunction &MF, LiveIntervals *LIS);
+  LLVM_ABI void analyze(MachineFunction &MF, LiveIntervals *LIS);
   /// splitRegister - Move any user variables in OldReg to the live ranges in
   /// NewRegs where they are live. Mark the values as unavailable where no new
   /// register is live.
-  void splitRegister(Register OldReg, ArrayRef<Register> NewRegs,
-                     LiveIntervals &LIS);
+  LLVM_ABI void splitRegister(Register OldReg, ArrayRef<Register> NewRegs,
+                              LiveIntervals &LIS);
 
   /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes
   /// that happened during register allocation.
   /// @param VRM Rename virtual registers according to map.
-  void emitDebugValues(VirtRegMap *VRM);
+  LLVM_ABI void emitDebugValues(VirtRegMap *VRM);
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   /// dump - Print data structures to dbgs().
   void dump() const;
 #endif
 
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 
-  void releaseMemory();
+  LLVM_ABI void releaseMemory();
 
-  bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA,
-                  MachineFunctionAnalysisManager::Invalidator &Inv);
+  LLVM_ABI bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA,
+                           MachineFunctionAnalysisManager::Invalidator &Inv);
 
 private:
   std::unique_ptr<LDVImpl> PImpl;
 };
 
-class LiveDebugVariablesWrapperLegacy : public MachineFunctionPass {
+class LLVM_ABI LiveDebugVariablesWrapperLegacy : public MachineFunctionPass {
   std::unique_ptr<LiveDebugVariables> Impl;
 
 public:
@@ -104,7 +104,8 @@ class LiveDebugVariablesAnalysis
     return MachineFunctionProperties().setTracksDebugUserValues();
   }
 
-  Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI Result run(MachineFunction &MF,
+                      MachineFunctionAnalysisManager &MFAM);
 };
 
 class LiveDebugVariablesPrinterPass
@@ -114,8 +115,8 @@ class LiveDebugVariablesPrinterPass
 public:
   LiveDebugVariablesPrinterPass(raw_ostream &OS) : OS(OS) {}
 
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/LiveIntervalUnion.h b/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
index 240fa114cf179..2a06ce7d4962e 100644
--- a/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
+++ b/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/CodeGen/LiveInterval.h"
 #include "llvm/CodeGen/SlotIndexes.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <limits>
 
@@ -88,16 +89,16 @@ class LiveIntervalUnion {
   bool changedSince(unsigned tag) const { return tag != Tag; }
 
   // Add a live virtual register to this union and merge its segments.
-  void unify(const LiveInterval &VirtReg, const LiveRange &Range);
+  LLVM_ABI void unify(const LiveInterval &VirtReg, const LiveRange &Range);
 
   // Remove a live virtual register's segments from this union.
-  void extract(const LiveInterval &VirtReg, const LiveRange &Range);
+  LLVM_ABI void extract(const LiveInterval &VirtReg, const LiveRange &Range);
 
   // Remove all inserted virtual registers.
   void clear() { Segments.clear(); ++Tag; }
 
   // Print union, using TRI to translate register names
-  void print(raw_ostream &OS, const TargetRegisterInfo *TRI) const;
+  LLVM_ABI void print(raw_ostream &OS, const TargetRegisterInfo *TRI) const;
 
 #ifndef NDEBUG
   // Verify the live intervals in this union and add them to the visited set.
@@ -105,7 +106,7 @@ class LiveIntervalUnion {
 #endif
 
   // Get any virtual register that is assign to this physical unit
-  const LiveInterval *getOneVReg() const;
+  LLVM_ABI const LiveInterval *getOneVReg() const;
 
   /// Query interferences between a single live virtual register and a live
   /// interval union.
@@ -122,7 +123,7 @@ class LiveIntervalUnion {
 
     // Count the virtual registers in this union that interfere with this
     // query's live virtual register, up to maxInterferingRegs.
-    unsigned collectInterferingVRegs(unsigned MaxInterferingRegs);
+    LLVM_ABI unsigned collectInterferingVRegs(unsigned MaxInterferingRegs);
 
     // Was this virtual register visited during collectInterferingVRegs?
     bool isSeenInterference(const LiveInterval *VirtReg) const;
@@ -185,11 +186,11 @@ class LiveIntervalUnion {
 
     // Initialize the array to have Size entries.
     // Reuse an existing allocation if the size matches.
-    void init(LiveIntervalUnion::Allocator&, unsigned Size);
+    LLVM_ABI void init(LiveIntervalUnion::Allocator &, unsigned Size);
 
     unsigned size() const { return Size; }
 
-    void clear();
+    LLVM_ABI void clear();
 
     LiveIntervalUnion &operator[](MCRegUnit Unit) {
       assert(static_cast<unsigned>(Unit) < Size && "Unit out of bounds");
diff --git a/llvm/include/llvm/CodeGen/LivePhysRegs.h b/llvm/include/llvm/CodeGen/LivePhysRegs.h
index 6a9949ddfde1b..d02c73253b4f4 100644
--- a/llvm/include/llvm/CodeGen/LivePhysRegs.h
+++ b/llvm/include/llvm/CodeGen/LivePhysRegs.h
@@ -34,6 +34,7 @@
 #include "llvm/CodeGen/TargetRegisterInfo.h"
 #include "llvm/MC/MCRegister.h"
 #include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <utility>
 
@@ -100,9 +101,10 @@ class LivePhysRegs {
   }
 
   /// Removes physical registers clobbered by the regmask operand \p MO.
-  void removeRegsInMask(const MachineOperand &MO,
-        SmallVectorImpl<std::pair<MCPhysReg, const MachineOperand*>> *Clobbers =
-        nullptr);
+  LLVM_ABI void removeRegsInMask(
+      const MachineOperand &MO,
+      SmallVectorImpl<std::pair<MCPhysReg, const MachineOperand *>> *Clobbers =
+          nullptr);
 
   /// Returns true if register \p Reg is contained in the set. This also
   /// works if only the super register of \p Reg has been defined, because
@@ -112,18 +114,18 @@ class LivePhysRegs {
   bool contains(MCRegister Reg) const { return LiveRegs.count(Reg.id()); }
 
   /// Returns true if register \p Reg and no aliasing register is in the set.
-  bool available(const MachineRegisterInfo &MRI, MCRegister Reg) const;
+  LLVM_ABI bool available(const MachineRegisterInfo &MRI, MCRegister Reg) const;
 
   /// Remove defined registers and regmask kills from the set.
-  void removeDefs(const MachineInstr &MI);
+  LLVM_ABI void removeDefs(const MachineInstr &MI);
 
   /// Add uses to the set.
-  void addUses(const MachineInstr &MI);
+  LLVM_ABI void addUses(const MachineInstr &MI);
 
   /// Simulates liveness when stepping backwards over an instruction(bundle).
   /// Remove Defs, add uses. This is the recommended way of calculating
   /// liveness.
-  void stepBackward(const MachineInstr &MI);
+  LLVM_ABI void stepBackward(const MachineInstr &MI);
 
   /// Simulates liveness when stepping forward over an instruction(bundle).
   /// Remove killed-uses, add defs. This is the not recommended way, because it
@@ -131,17 +133,18 @@ class LivePhysRegs {
   /// this function. The clobbers set will be the list of registers either
   /// defined or clobbered by a regmask.  The operand will identify whether this
   /// is a regmask or register operand.
-  void stepForward(const MachineInstr &MI,
-        SmallVectorImpl<std::pair<MCPhysReg, const MachineOperand*>> &Clobbers);
+  LLVM_ABI void stepForward(
+      const MachineInstr &MI,
+      SmallVectorImpl<std::pair<MCPhysReg, const MachineOperand *>> &Clobbers);
 
   /// Adds all live-in registers of basic block \p MBB.
   /// Live in registers are the registers in the blocks live-in list and the
   /// pristine registers.
-  void addLiveIns(const MachineBasicBlock &MBB);
+  LLVM_ABI void addLiveIns(const MachineBasicBlock &MBB);
 
   /// Adds all live-in registers of basic block \p MBB but skips pristine
   /// registers.
-  void addLiveInsNoPristines(const MachineBasicBlock &MBB);
+  LLVM_ABI void addLiveInsNoPristines(const MachineBasicBlock &MBB);
 
   /// Adds all live-out registers of basic block \p MBB.
   /// Live out registers are the union of the live-in registers of the successor
@@ -150,11 +153,11 @@ class LivePhysRegs {
   /// If a register is not added by this method, it is guaranteed to not be
   /// live out from MBB, although a sub-register may be. This is true
   /// both before and after regalloc.
-  void addLiveOuts(const MachineBasicBlock &MBB);
+  LLVM_ABI void addLiveOuts(const MachineBasicBlock &MBB);
 
   /// Adds all live-out registers of basic block \p MBB but skips pristine
   /// registers.
-  void addLiveOutsNoPristines(const MachineBasicBlock &MBB);
+  LLVM_ABI void addLiveOutsNoPristines(const MachineBasicBlock &MBB);
 
   using const_iterator = RegisterSet::const_iterator;
 
@@ -162,10 +165,10 @@ class LivePhysRegs {
   const_iterator end() const { return LiveRegs.end(); }
 
   /// Prints the currently live registers to \p OS.
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 
   /// Dumps the currently live registers to the debug output.
-  void dump() const;
+  LLVM_ABI void dump() const;
 
 private:
   /// Adds a register, taking the lane mask into consideration.
@@ -192,21 +195,22 @@ inline raw_ostream &operator<<(raw_ostream &OS, const LivePhysRegs& LR) {
 /// Computes registers live-in to \p MBB assuming all of its successors
 /// live-in lists are up-to-date. Puts the result into the given LivePhysReg
 /// instance \p LiveRegs.
-void computeLiveIns(LivePhysRegs &LiveRegs, const MachineBasicBlock &MBB);
+LLVM_ABI void computeLiveIns(LivePhysRegs &LiveRegs,
+                             const MachineBasicBlock &MBB);
 
 /// Recomputes dead and kill flags in \p MBB.
-void recomputeLivenessFlags(MachineBasicBlock &MBB);
+LLVM_ABI void recomputeLivenessFlags(MachineBasicBlock &MBB);
 
 /// Adds registers contained in \p LiveRegs to the block live-in list of \p MBB.
 /// Does not add reserved registers.
-void addLiveIns(MachineBasicBlock &MBB, const LivePhysRegs &LiveRegs);
+LLVM_ABI void addLiveIns(MachineBasicBlock &MBB, const LivePhysRegs &LiveRegs);
 
 /// Convenience function combining computeLiveIns() and addLiveIns().
-void computeAndAddLiveIns(LivePhysRegs &LiveRegs,
-                          MachineBasicBlock &MBB);
+LLVM_ABI void computeAndAddLiveIns(LivePhysRegs &LiveRegs,
+                                   MachineBasicBlock &MBB);
 
 /// Check if physical register \p Reg is used after \p MBI.
-bool isPhysRegUsedAfter(Register Reg, MachineBasicBlock::iterator MBI);
+LLVM_ABI bool isPhysRegUsedAfter(Register Reg, MachineBasicBlock::iterator MBI);
 
 /// Convenience function for recomputing live-in's for a MBB. Returns true if
 /// any changes were made.
diff --git a/llvm/include/llvm/CodeGen/LiveRangeEdit.h b/llvm/include/llvm/CodeGen/LiveRangeEdit.h
index d0ed3ff660d9b..304240e83bfdb 100644
--- a/llvm/include/llvm/CodeGen/LiveRangeEdit.h
+++ b/llvm/include/llvm/CodeGen/LiveRangeEdit.h
@@ -27,6 +27,7 @@
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/CodeGen/SlotIndexes.h"
 #include "llvm/CodeGen/TargetSubtargetInfo.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 
 namespace llvm {
@@ -39,10 +40,10 @@ class TargetRegisterInfo;
 class VirtRegMap;
 class VirtRegAuxInfo;
 
-class LiveRangeEdit : private MachineRegisterInfo::Delegate {
+class LLVM_ABI LiveRangeEdit : private MachineRegisterInfo::Delegate {
 public:
   /// Callback methods for LiveRangeEdit owners.
-  class Delegate {
+  class LLVM_ABI Delegate {
     virtual void anchor();
 
   public:
diff --git a/llvm/include/llvm/CodeGen/LiveRegMatrix.h b/llvm/include/llvm/CodeGen/LiveRegMatrix.h
index 35add577d071a..0bb3eefe2ca1f 100644
--- a/llvm/include/llvm/CodeGen/LiveRegMatrix.h
+++ b/llvm/include/llvm/CodeGen/LiveRegMatrix.h
@@ -26,6 +26,7 @@
 #include "llvm/ADT/BitVector.h"
 #include "llvm/CodeGen/LiveIntervalUnion.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/Compiler.h"
 #include <memory>
 
 namespace llvm {
@@ -66,7 +67,7 @@ class LiveRegMatrix {
 public:
   LiveRegMatrix(LiveRegMatrix &&Other) = default;
 
-  void init(MachineFunction &MF, LiveIntervals &LIS, VirtRegMap &VRM);
+  LLVM_ABI void init(MachineFunction &MF, LiveIntervals &LIS, VirtRegMap &VRM);
 
   //===--------------------------------------------------------------------===//
   // High-level interface.
@@ -105,15 +106,16 @@ class LiveRegMatrix {
   /// If this function returns IK_Free, it is legal to assign(VirtReg, PhysReg).
   /// When there is more than one kind of interference, the InterferenceKind
   /// with the highest enum value is returned.
-  InterferenceKind checkInterference(const LiveInterval &VirtReg,
-                                     MCRegister PhysReg);
+  LLVM_ABI InterferenceKind checkInterference(const LiveInterval &VirtReg,
+                                              MCRegister PhysReg);
 
   /// Check for interference in the segment [Start, End) that may prevent
   /// assignment to PhysReg. If this function returns true, there is
   /// interference in the segment [Start, End) of some other interval already
   /// assigned to PhysReg. If this function returns false, PhysReg is free at
   /// the segment [Start, End).
-  bool checkInterference(SlotIndex Start, SlotIndex End, MCRegister PhysReg);
+  LLVM_ABI bool checkInterference(SlotIndex Start, SlotIndex End,
+                                  MCRegister PhysReg);
 
   /// Check for interference in the segment [Start, End) that may prevent
   /// assignment to PhysReg, like checkInterference. Returns a lane mask of
@@ -122,21 +124,21 @@ class LiveRegMatrix {
   ///
   /// If this function returns LaneBitmask::getNone(), PhysReg is completely
   /// free at the segment [Start, End).
-  LaneBitmask checkInterferenceLanes(SlotIndex Start, SlotIndex End,
-                                     MCRegister PhysReg);
+  LLVM_ABI LaneBitmask checkInterferenceLanes(SlotIndex Start, SlotIndex End,
+                                              MCRegister PhysReg);
 
   /// Assign VirtReg to PhysReg.
   /// This will mark VirtReg's live range as occupied in the LiveRegMatrix and
   /// update VirtRegMap. The live range is expected to be available in PhysReg.
-  void assign(const LiveInterval &VirtReg, MCRegister PhysReg);
+  LLVM_ABI void assign(const LiveInterval &VirtReg, MCRegister PhysReg);
 
   /// Unassign VirtReg from its PhysReg.
   /// Assuming that VirtReg was previously assigned to a PhysReg, this undoes
   /// the assignment and updates VirtRegMap accordingly.
-  void unassign(const LiveInterval &VirtReg);
+  LLVM_ABI void unassign(const LiveInterval &VirtReg);
 
   /// Returns true if the given \p PhysReg has any live intervals assigned.
-  bool isPhysRegUsed(MCRegister PhysReg) const;
+  LLVM_ABI bool isPhysRegUsed(MCRegister PhysReg) const;
 
   //===--------------------------------------------------------------------===//
   // Low-level interface.
@@ -148,20 +150,22 @@ class LiveRegMatrix {
   /// Check for regmask interference only.
   /// Return true if VirtReg crosses a regmask operand that clobbers PhysReg.
   /// If PhysReg is null, check if VirtReg crosses any regmask operands.
-  bool checkRegMaskInterference(const LiveInterval &VirtReg,
-                                MCRegister PhysReg = MCRegister::NoRegister);
+  LLVM_ABI bool
+  checkRegMaskInterference(const LiveInterval &VirtReg,
+                           MCRegister PhysReg = MCRegister::NoRegister);
 
   /// Check for regunit interference only.
   /// Return true if VirtReg overlaps a fixed assignment of one of PhysRegs's
   /// register units.
-  bool checkRegUnitInterference(const LiveInterval &VirtReg,
-                                MCRegister PhysReg);
+  LLVM_ABI bool checkRegUnitInterference(const LiveInterval &VirtReg,
+                                         MCRegister PhysReg);
 
   /// Query a line of the assigned virtual register matrix directly.
   /// Use MCRegUnitIterator to enumerate all regunits in the desired PhysReg.
   /// This returns a reference to an internal Query data structure that is only
   /// valid until the next query() call.
-  LiveIntervalUnion::Query &query(const LiveRange &LR, MCRegUnit RegUnit);
+  LLVM_ABI LiveIntervalUnion::Query &query(const LiveRange &LR,
+                                           MCRegUnit RegUnit);
 
   /// Directly access the live interval unions per regunit.
   /// This returns an array indexed by the regunit number.
@@ -169,10 +173,10 @@ class LiveRegMatrix {
     return &Matrix[static_cast<MCRegUnit>(0)];
   }
 
-  Register getOneVReg(unsigned PhysReg) const;
+  LLVM_ABI Register getOneVReg(unsigned PhysReg) const;
 };
 
-class LiveRegMatrixWrapperLegacy : public MachineFunctionPass {
+class LLVM_ABI LiveRegMatrixWrapperLegacy : public MachineFunctionPass {
   LiveRegMatrix LRM;
 
 public:
@@ -195,7 +199,8 @@ class LiveRegMatrixAnalysis : public AnalysisInfoMixin<LiveRegMatrixAnalysis> {
 public:
   using Result = LiveRegMatrix;
 
-  LiveRegMatrix run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI LiveRegMatrix run(MachineFunction &MF,
+                             MachineFunctionAnalysisManager &MFAM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/LiveStacks.h b/llvm/include/llvm/CodeGen/LiveStacks.h
index 04ff4584182b8..2320453102089 100644
--- a/llvm/include/llvm/CodeGen/LiveStacks.h
+++ b/llvm/include/llvm/CodeGen/LiveStacks.h
@@ -20,6 +20,7 @@
 #include "llvm/IR/PassManager.h"
 #include "llvm/InitializePasses.h"
 #include "llvm/PassRegistry.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <map>
 #include <unordered_map>
@@ -58,7 +59,8 @@ class LiveStacks {
 
   unsigned getNumIntervals() const { return (unsigned)S2IMap.size(); }
 
-  LiveInterval &getOrCreateInterval(int Slot, const TargetRegisterClass *RC);
+  LLVM_ABI LiveInterval &getOrCreateInterval(int Slot,
+                                             const TargetRegisterClass *RC);
 
   LiveInterval &getInterval(int Slot) {
     assert(Slot >= 0 && "Spill slot indice must be >= 0");
@@ -87,13 +89,13 @@ class LiveStacks {
 
   VNInfo::Allocator &getVNInfoAllocator() { return VNInfoAllocator; }
 
-  void releaseMemory();
+  LLVM_ABI void releaseMemory();
   /// init - analysis entry point
-  void init(MachineFunction &MF);
-  void print(raw_ostream &O, const Module *M = nullptr) const;
+  LLVM_ABI void init(MachineFunction &MF);
+  LLVM_ABI void print(raw_ostream &O, const Module *M = nullptr) const;
 };
 
-class LiveStacksWrapperLegacy : public MachineFunctionPass {
+class LLVM_ABI LiveStacksWrapperLegacy : public MachineFunctionPass {
   LiveStacks Impl;
 
 public:
@@ -121,7 +123,8 @@ class LiveStacksAnalysis : public AnalysisInfoMixin<LiveStacksAnalysis> {
 public:
   using Result = LiveStacks;
 
-  LiveStacks run(MachineFunction &MF, MachineFunctionAnalysisManager &);
+  LLVM_ABI LiveStacks run(MachineFunction &MF,
+                          MachineFunctionAnalysisManager &);
 };
 
 class LiveStacksPrinterPass : public PassInfoMixin<LiveStacksPrinterPass> {
@@ -129,8 +132,8 @@ class LiveStacksPrinterPass : public PassInfoMixin<LiveStacksPrinterPass> {
 
 public:
   LiveStacksPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &AM);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/LocalStackSlotAllocation.h b/llvm/include/llvm/CodeGen/LocalStackSlotAllocation.h
index b02667d5c6699..64d6648c76918 100644
--- a/llvm/include/llvm/CodeGen/LocalStackSlotAllocation.h
+++ b/llvm/include/llvm/CodeGen/LocalStackSlotAllocation.h
@@ -10,13 +10,15 @@
 #define LLVM_CODEGEN_LOCALSTACKSLOTALLOCATION_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class LocalStackSlotAllocationPass
     : public PassInfoMixin<LocalStackSlotAllocationPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/LoopTraversal.h b/llvm/include/llvm/CodeGen/LoopTraversal.h
index 93d140cabd0d7..ca48572814665 100644
--- a/llvm/include/llvm/CodeGen/LoopTraversal.h
+++ b/llvm/include/llvm/CodeGen/LoopTraversal.h
@@ -19,6 +19,7 @@
 #define LLVM_CODEGEN_LOOPTRAVERSAL_H
 
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -103,7 +104,7 @@ class LoopTraversal {
   /// Identifies basic blocks that are part of loops and should to be
   ///  visited twice and returns efficient traversal order for all the blocks.
   typedef SmallVector<TraversedMBBInfo, 4> TraversalOrder;
-  TraversalOrder traverse(MachineFunction &MF);
+  LLVM_ABI TraversalOrder traverse(MachineFunction &MF);
 
 private:
   /// Returens true if the block is ready for its final round of processing.
diff --git a/llvm/include/llvm/CodeGen/LowerEmuTLS.h b/llvm/include/llvm/CodeGen/LowerEmuTLS.h
index ecd1352a89f42..62df8703ba6a4 100644
--- a/llvm/include/llvm/CodeGen/LowerEmuTLS.h
+++ b/llvm/include/llvm/CodeGen/LowerEmuTLS.h
@@ -16,12 +16,13 @@
 #define LLVM_CODEGEN_LOWEREMUTLS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class LowerEmuTLSPass : public PassInfoMixin<LowerEmuTLSPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/MBFIWrapper.h b/llvm/include/llvm/CodeGen/MBFIWrapper.h
index 60917b4e923fc..e4df0f1a17fa9 100644
--- a/llvm/include/llvm/CodeGen/MBFIWrapper.h
+++ b/llvm/include/llvm/CodeGen/MBFIWrapper.h
@@ -16,6 +16,7 @@
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/BlockFrequency.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
@@ -27,13 +28,13 @@ class MBFIWrapper {
  public:
   MBFIWrapper(const MachineBlockFrequencyInfo &I) : MBFI(I) {}
 
-  BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const;
-  void setBlockFreq(const MachineBasicBlock *MBB, BlockFrequency F);
-  std::optional<uint64_t>
+  LLVM_ABI BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const;
+  LLVM_ABI void setBlockFreq(const MachineBasicBlock *MBB, BlockFrequency F);
+  LLVM_ABI std::optional<uint64_t>
   getBlockProfileCount(const MachineBasicBlock *MBB) const;
 
-  void view(const Twine &Name, bool isSimple = true);
-  BlockFrequency getEntryFreq() const;
+  LLVM_ABI void view(const Twine &Name, bool isSimple = true);
+  LLVM_ABI BlockFrequency getEntryFreq() const;
   const MachineBlockFrequencyInfo &getMBFI() const { return MBFI; }
 
 private:
diff --git a/llvm/include/llvm/CodeGen/MIR2Vec.h b/llvm/include/llvm/CodeGen/MIR2Vec.h
index 9e59b0d3da4f4..685b3dbd7a66c 100644
--- a/llvm/include/llvm/CodeGen/MIR2Vec.h
+++ b/llvm/include/llvm/CodeGen/MIR2Vec.h
@@ -51,6 +51,7 @@
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorOr.h"
 #include <map>
@@ -157,7 +158,7 @@ class MIRVocabulary {
   LLVM_ABI unsigned getCanonicalOpcodeIndex(unsigned Opcode) const;
 
   /// Get index for a common (non-register) machine operand
-  unsigned
+  LLVM_ABI unsigned
   getCommonOperandIndex(MachineOperand::MachineOperandType OperandType) const;
 
   /// Get index for a register machine operand
@@ -192,7 +193,7 @@ class MIRVocabulary {
 
   /// Get entity ID (flat index) for a common operand type
   /// This is used for triplet generation
-  LLVM_ABI unsigned getEntityIDForCommonOperand(
+  unsigned getEntityIDForCommonOperand(
       MachineOperand::MachineOperandType OperandType) const {
     return Layout.CommonOperandBase + getCommonOperandIndex(OperandType);
   }
@@ -347,13 +348,13 @@ class MIREmbedder {
 /// Class for computing Symbolic embeddings
 /// Symbolic embeddings are constructed based on the entity-level
 /// representations obtained from the MIR Vocabulary.
-class SymbolicMIREmbedder : public MIREmbedder {
+class LLVM_ABI SymbolicMIREmbedder : public MIREmbedder {
 private:
   Embedding computeEmbeddings(const MachineInstr &MI) const override;
 
 public:
   SymbolicMIREmbedder(const MachineFunction &F, const MIRVocabulary &Vocab);
-  LLVM_ABI_FOR_TEST static std::unique_ptr<SymbolicMIREmbedder>
+  static std::unique_ptr<SymbolicMIREmbedder>
   create(const MachineFunction &MF, const MIRVocabulary &Vocab);
 };
 
@@ -382,7 +383,7 @@ class MIR2VecVocabProvider {
 };
 
 /// Pass to analyze and populate MIR2Vec vocabulary from a module
-class MIR2VecVocabLegacyAnalysis : public ImmutablePass {
+class LLVM_ABI MIR2VecVocabLegacyAnalysis : public ImmutablePass {
   using VocabVector = std::vector<mir2vec::Embedding>;
   using VocabMap = std::map<std::string, mir2vec::Embedding>;
 
@@ -414,7 +415,7 @@ class MIR2VecVocabLegacyAnalysis : public ImmutablePass {
 };
 
 /// This pass prints the embeddings in the MIR2Vec vocabulary
-class MIR2VecVocabPrinterLegacyPass : public MachineFunctionPass {
+class LLVM_ABI MIR2VecVocabPrinterLegacyPass : public MachineFunctionPass {
   raw_ostream &OS;
 
 public:
@@ -437,7 +438,7 @@ class MIR2VecVocabPrinterLegacyPass : public MachineFunctionPass {
 
 /// This pass prints the MIR2Vec embeddings for machine functions, basic blocks,
 /// and instructions
-class MIR2VecPrinterLegacyPass : public MachineFunctionPass {
+class LLVM_ABI MIR2VecPrinterLegacyPass : public MachineFunctionPass {
   raw_ostream &OS;
 
 public:
diff --git a/llvm/include/llvm/CodeGen/MIRFSDiscriminator.h b/llvm/include/llvm/CodeGen/MIRFSDiscriminator.h
index da943268dac87..1266725ca2ab1 100644
--- a/llvm/include/llvm/CodeGen/MIRFSDiscriminator.h
+++ b/llvm/include/llvm/CodeGen/MIRFSDiscriminator.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Discriminator.h"
 
 #include <cassert>
@@ -29,7 +30,7 @@ namespace llvm {
 class MachineFunction;
 
 using namespace sampleprof;
-class MIRAddFSDiscriminators : public MachineFunctionPass {
+class LLVM_ABI MIRAddFSDiscriminators : public MachineFunctionPass {
   MachineFunction *MF = nullptr;
   FSDiscriminatorPass Pass;
   unsigned LowBit;
diff --git a/llvm/include/llvm/CodeGen/MIRFSDiscriminatorOptions.h b/llvm/include/llvm/CodeGen/MIRFSDiscriminatorOptions.h
index 672a6b359333a..38e281b0854cf 100644
--- a/llvm/include/llvm/CodeGen/MIRFSDiscriminatorOptions.h
+++ b/llvm/include/llvm/CodeGen/MIRFSDiscriminatorOptions.h
@@ -14,9 +14,10 @@
 #define LLVM_CODEGEN_MIRFSDISCRIMINATOR_OPTIONS_H
 
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
-extern cl::opt<bool> ImprovedFSDiscriminator;
+extern LLVM_ABI cl::opt<bool> ImprovedFSDiscriminator;
 } // namespace llvm
 
 #endif // LLVM_CODEGEN_MIRFSDISCRIMINATOR_OPTIONS_H
diff --git a/llvm/include/llvm/CodeGen/MIRParser/MIParser.h b/llvm/include/llvm/CodeGen/MIRParser/MIParser.h
index 0f2898d3554d0..0efc405c4224a 100644
--- a/llvm/include/llvm/CodeGen/MIRParser/MIParser.h
+++ b/llvm/include/llvm/CodeGen/MIRParser/MIParser.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/Register.h"
 #include "llvm/IR/TrackingMDRef.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <map>
 #include <utility>
@@ -94,62 +95,63 @@ struct PerTargetMIParsingState {
   void initNames2BitmaskTargetFlags();
   void initNames2MMOTargetFlags();
 
-  void initNames2RegClasses();
-  void initNames2RegBanks();
+  LLVM_ABI void initNames2RegClasses();
+  LLVM_ABI void initNames2RegBanks();
 
 public:
   /// Try to convert an instruction name to an opcode. Return true if the
   /// instruction name is invalid.
-  bool parseInstrName(StringRef InstrName, unsigned &OpCode);
+  LLVM_ABI bool parseInstrName(StringRef InstrName, unsigned &OpCode);
 
   /// Try to convert a register name to a register number. Return true if the
   /// register name is invalid.
-  bool getRegisterByName(StringRef RegName, Register &Reg);
+  LLVM_ABI bool getRegisterByName(StringRef RegName, Register &Reg);
 
   /// Check if the given identifier is a name of a register mask.
   ///
   /// Return null if the identifier isn't a register mask.
-  const uint32_t *getRegMask(StringRef Identifier);
+  LLVM_ABI const uint32_t *getRegMask(StringRef Identifier);
 
   /// Check if the given identifier is a name of a subregister index.
   ///
   /// Return 0 if the name isn't a subregister index class.
-  unsigned getSubRegIndex(StringRef Name);
+  LLVM_ABI unsigned getSubRegIndex(StringRef Name);
 
   /// Try to convert a name of target index to the corresponding target index.
   ///
   /// Return true if the name isn't a name of a target index.
-  bool getTargetIndex(StringRef Name, int &Index);
+  LLVM_ABI bool getTargetIndex(StringRef Name, int &Index);
 
   /// Try to convert a name of a direct target flag to the corresponding
   /// target flag.
   ///
   /// Return true if the name isn't a name of a direct flag.
-  bool getDirectTargetFlag(StringRef Name, unsigned &Flag);
+  LLVM_ABI bool getDirectTargetFlag(StringRef Name, unsigned &Flag);
 
   /// Try to convert a name of a bitmask target flag to the corresponding
   /// target flag.
   ///
   /// Return true if the name isn't a name of a bitmask target flag.
-  bool getBitmaskTargetFlag(StringRef Name, unsigned &Flag);
+  LLVM_ABI bool getBitmaskTargetFlag(StringRef Name, unsigned &Flag);
 
   /// Try to convert a name of a MachineMemOperand target flag to the
   /// corresponding target flag.
   ///
   /// Return true if the name isn't a name of a target MMO flag.
-  bool getMMOTargetFlag(StringRef Name, MachineMemOperand::Flags &Flag);
+  LLVM_ABI bool getMMOTargetFlag(StringRef Name,
+                                 MachineMemOperand::Flags &Flag);
 
   /// Check if the given identifier is a name of a register class.
   ///
   /// Return null if the name isn't a register class.
-  const TargetRegisterClass *getRegClass(StringRef Name);
+  LLVM_ABI const TargetRegisterClass *getRegClass(StringRef Name);
 
   /// Check if the given identifier is a name of a register bank.
   ///
   /// Return null if the name isn't a register bank.
-  const RegisterBank *getRegBank(StringRef Name);
+  LLVM_ABI const RegisterBank *getRegBank(StringRef Name);
 
-  bool getVRegFlagValue(StringRef FlagName, uint8_t &FlagValue) const;
+  LLVM_ABI bool getVRegFlagValue(StringRef FlagName, uint8_t &FlagValue) const;
 
   PerTargetMIParsingState(const TargetSubtargetInfo &STI)
     : Subtarget(STI) {
@@ -159,7 +161,7 @@ struct PerTargetMIParsingState {
 
   ~PerTargetMIParsingState() = default;
 
-  void setTarget(const TargetSubtargetInfo &NewSubtarget);
+  LLVM_ABI void setTarget(const TargetSubtargetInfo &NewSubtarget);
 };
 
 struct PerFunctionMIParsingState {
@@ -183,13 +185,13 @@ struct PerFunctionMIParsingState {
   /// Maps from slot numbers to function's unnamed values.
   DenseMap<unsigned, const Value *> Slots2Values;
 
-  PerFunctionMIParsingState(MachineFunction &MF, SourceMgr &SM,
-                            const SlotMapping &IRSlots,
-                            PerTargetMIParsingState &Target);
+  LLVM_ABI PerFunctionMIParsingState(MachineFunction &MF, SourceMgr &SM,
+                                     const SlotMapping &IRSlots,
+                                     PerTargetMIParsingState &Target);
 
-  VRegInfo &getVRegInfo(Register Num);
-  VRegInfo &getVRegInfoNamed(StringRef RegName);
-  const Value *getIRValue(unsigned Slot);
+  LLVM_ABI VRegInfo &getVRegInfo(Register Num);
+  LLVM_ABI VRegInfo &getVRegInfoNamed(StringRef RegName);
+  LLVM_ABI const Value *getIRValue(unsigned Slot);
 };
 
 /// Parse the machine basic block definitions, and skip the machine
@@ -204,8 +206,9 @@ struct PerFunctionMIParsingState {
 /// resolve the machine basic block references.
 ///
 /// Return true if an error occurred.
-bool parseMachineBasicBlockDefinitions(PerFunctionMIParsingState &PFS,
-                                       StringRef Src, SMDiagnostic &Error);
+LLVM_ABI bool parseMachineBasicBlockDefinitions(PerFunctionMIParsingState &PFS,
+                                                StringRef Src,
+                                                SMDiagnostic &Error);
 
 /// Parse the machine instructions.
 ///
@@ -217,32 +220,34 @@ bool parseMachineBasicBlockDefinitions(PerFunctionMIParsingState &PFS,
 /// on the given source string.
 ///
 /// Return true if an error occurred.
-bool parseMachineInstructions(PerFunctionMIParsingState &PFS, StringRef Src,
-                              SMDiagnostic &Error);
+LLVM_ABI bool parseMachineInstructions(PerFunctionMIParsingState &PFS,
+                                       StringRef Src, SMDiagnostic &Error);
 
-bool parseMBBReference(PerFunctionMIParsingState &PFS,
-                       MachineBasicBlock *&MBB, StringRef Src,
-                       SMDiagnostic &Error);
+LLVM_ABI bool parseMBBReference(PerFunctionMIParsingState &PFS,
+                                MachineBasicBlock *&MBB, StringRef Src,
+                                SMDiagnostic &Error);
 
-bool parseRegisterReference(PerFunctionMIParsingState &PFS,
-                            Register &Reg, StringRef Src,
-                            SMDiagnostic &Error);
+LLVM_ABI bool parseRegisterReference(PerFunctionMIParsingState &PFS,
+                                     Register &Reg, StringRef Src,
+                                     SMDiagnostic &Error);
 
-bool parseNamedRegisterReference(PerFunctionMIParsingState &PFS, Register &Reg,
-                                 StringRef Src, SMDiagnostic &Error);
+LLVM_ABI bool parseNamedRegisterReference(PerFunctionMIParsingState &PFS,
+                                          Register &Reg, StringRef Src,
+                                          SMDiagnostic &Error);
 
-bool parseVirtualRegisterReference(PerFunctionMIParsingState &PFS,
-                                   VRegInfo *&Info, StringRef Src,
-                                   SMDiagnostic &Error);
+LLVM_ABI bool parseVirtualRegisterReference(PerFunctionMIParsingState &PFS,
+                                            VRegInfo *&Info, StringRef Src,
+                                            SMDiagnostic &Error);
 
-bool parseStackObjectReference(PerFunctionMIParsingState &PFS, int &FI,
-                               StringRef Src, SMDiagnostic &Error);
+LLVM_ABI bool parseStackObjectReference(PerFunctionMIParsingState &PFS, int &FI,
+                                        StringRef Src, SMDiagnostic &Error);
 
-bool parseMDNode(PerFunctionMIParsingState &PFS, MDNode *&Node, StringRef Src,
-                 SMDiagnostic &Error);
+LLVM_ABI bool parseMDNode(PerFunctionMIParsingState &PFS, MDNode *&Node,
+                          StringRef Src, SMDiagnostic &Error);
 
-bool parseMachineMetadata(PerFunctionMIParsingState &PFS, StringRef Src,
-                          SMRange SourceRange, SMDiagnostic &Error);
+LLVM_ABI bool parseMachineMetadata(PerFunctionMIParsingState &PFS,
+                                   StringRef Src, SMRange SourceRange,
+                                   SMDiagnostic &Error);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/MIRSampleProfile.h b/llvm/include/llvm/CodeGen/MIRSampleProfile.h
index 221e966e2b9e0..21fe52b408d1e 100644
--- a/llvm/include/llvm/CodeGen/MIRSampleProfile.h
+++ b/llvm/include/llvm/CodeGen/MIRSampleProfile.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Discriminator.h"
 #include <memory>
 #include <string>
@@ -34,7 +35,7 @@ class FileSystem;
 using namespace sampleprof;
 
 class MIRProfileLoader;
-class MIRProfileLoaderPass : public MachineFunctionPass {
+class LLVM_ABI MIRProfileLoaderPass : public MachineFunctionPass {
   MachineFunction *MF;
   std::string ProfileFileName;
   FSDiscriminatorPass P;
diff --git a/llvm/include/llvm/CodeGen/MIRYamlMapping.h b/llvm/include/llvm/CodeGen/MIRYamlMapping.h
index e80c13885805b..a0c6666b6b27d 100644
--- a/llvm/include/llvm/CodeGen/MIRYamlMapping.h
+++ b/llvm/include/llvm/CodeGen/MIRYamlMapping.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/CodeGen/MachineJumpTableInfo.h"
 #include "llvm/CodeGen/TargetFrameLowering.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include "llvm/Support/YAMLTraits.h"
 #include "llvm/Support/raw_ostream.h"
@@ -425,9 +426,9 @@ struct FrameIndex {
   SMRange SourceRange;
 
   FrameIndex() = default;
-  FrameIndex(int FI, const llvm::MachineFrameInfo &MFI);
+  LLVM_ABI FrameIndex(int FI, const llvm::MachineFrameInfo &MFI);
 
-  Expected<int> getFI(const llvm::MachineFrameInfo &MFI) const;
+  LLVM_ABI Expected<int> getFI(const llvm::MachineFrameInfo &MFI) const;
 };
 
 template <> struct ScalarTraits<FrameIndex> {
diff --git a/llvm/include/llvm/CodeGen/MachineBlockHashInfo.h b/llvm/include/llvm/CodeGen/MachineBlockHashInfo.h
index 6f26819d566ae..328c75fd14cb7 100644
--- a/llvm/include/llvm/CodeGen/MachineBlockHashInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineBlockHashInfo.h
@@ -14,6 +14,7 @@
 #define LLVM_CODEGEN_MACHINEBLOCKHASHINFO_H
 
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -95,7 +96,7 @@ struct BlendedBlockHash {
   uint16_t NeighborHash{0};
 };
 
-class MachineBlockHashInfo : public MachineFunctionPass {
+class LLVM_ABI MachineBlockHashInfo : public MachineFunctionPass {
   DenseMap<const MachineBasicBlock *, uint64_t> MBBHashInfo;
 
 public:
diff --git a/llvm/include/llvm/CodeGen/MachineBlockPlacement.h b/llvm/include/llvm/CodeGen/MachineBlockPlacement.h
index f88e72c2a177b..bfe1bdfcd0e78 100644
--- a/llvm/include/llvm/CodeGen/MachineBlockPlacement.h
+++ b/llvm/include/llvm/CodeGen/MachineBlockPlacement.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_MACHINEBLOCKPLACEMENT_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -21,11 +22,11 @@ class MachineBlockPlacementPass
 public:
   MachineBlockPlacementPass(bool AllowTailMerge)
       : AllowTailMerge(AllowTailMerge) {}
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 
-  void
+  LLVM_ABI void
   printPipeline(raw_ostream &OS,
                 function_ref<StringRef(StringRef)> MapClassName2PassName) const;
 };
@@ -34,8 +35,8 @@ class MachineBlockPlacementStatsPass
     : public PassInfoMixin<MachineBlockPlacementStatsPass> {
 
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h b/llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
index 12d33f96edd11..4ff437e8b3896 100644
--- a/llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
@@ -17,6 +17,7 @@
 #include "llvm/CodeGen/MachinePassManager.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/BranchProbability.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -30,29 +31,29 @@ class MachineBranchProbabilityInfo {
   static const uint32_t DEFAULT_WEIGHT = 16;
 
 public:
-  bool invalidate(MachineFunction &, const PreservedAnalyses &PA,
-                  MachineFunctionAnalysisManager::Invalidator &);
+  LLVM_ABI bool invalidate(MachineFunction &, const PreservedAnalyses &PA,
+                           MachineFunctionAnalysisManager::Invalidator &);
 
   // Return edge probability.
-  BranchProbability getEdgeProbability(const MachineBasicBlock *Src,
-                                       const MachineBasicBlock *Dst) const;
+  LLVM_ABI BranchProbability getEdgeProbability(
+      const MachineBasicBlock *Src, const MachineBasicBlock *Dst) const;
 
   // Same as above, but using a const_succ_iterator from Src. This is faster
   // when the iterator is already available.
-  BranchProbability
+  LLVM_ABI BranchProbability
   getEdgeProbability(const MachineBasicBlock *Src,
                      MachineBasicBlock::const_succ_iterator Dst) const;
 
   // A 'Hot' edge is an edge which probability is >= 80%.
-  bool isEdgeHot(const MachineBasicBlock *Src,
-                 const MachineBasicBlock *Dst) const;
+  LLVM_ABI bool isEdgeHot(const MachineBasicBlock *Src,
+                          const MachineBasicBlock *Dst) const;
 
   // Print value between 0 (0% probability) and 1 (100% probability),
   // however the value is never equal to 0, and can be 1 only iff SRC block
   // has only one successor.
-  raw_ostream &printEdgeProbability(raw_ostream &OS,
-                                    const MachineBasicBlock *Src,
-                                    const MachineBasicBlock *Dst) const;
+  LLVM_ABI raw_ostream &
+  printEdgeProbability(raw_ostream &OS, const MachineBasicBlock *Src,
+                       const MachineBasicBlock *Dst) const;
 };
 
 class MachineBranchProbabilityAnalysis
@@ -64,7 +65,7 @@ class MachineBranchProbabilityAnalysis
 public:
   using Result = MachineBranchProbabilityInfo;
 
-  Result run(MachineFunction &, MachineFunctionAnalysisManager &);
+  LLVM_ABI Result run(MachineFunction &, MachineFunctionAnalysisManager &);
 };
 
 class MachineBranchProbabilityPrinterPass
@@ -73,11 +74,11 @@ class MachineBranchProbabilityPrinterPass
 
 public:
   MachineBranchProbabilityPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
-class MachineBranchProbabilityInfoWrapperPass : public ImmutablePass {
+class LLVM_ABI MachineBranchProbabilityInfoWrapperPass : public ImmutablePass {
   virtual void anchor();
 
   MachineBranchProbabilityInfo MBPI;
diff --git a/llvm/include/llvm/CodeGen/MachineCSE.h b/llvm/include/llvm/CodeGen/MachineCSE.h
index b2b0d414ae673..6a9fcf11e3f76 100644
--- a/llvm/include/llvm/CodeGen/MachineCSE.h
+++ b/llvm/include/llvm/CodeGen/MachineCSE.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_MACHINECSE_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class MachineCSEPass : public PassInfoMixin<MachineCSEPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setIsSSA();
diff --git a/llvm/include/llvm/CodeGen/MachineConstantPool.h b/llvm/include/llvm/CodeGen/MachineConstantPool.h
index a9bc0ce300b22..df41e2ef92517 100644
--- a/llvm/include/llvm/CodeGen/MachineConstantPool.h
+++ b/llvm/include/llvm/CodeGen/MachineConstantPool.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/MC/SectionKind.h"
 #include "llvm/Support/Alignment.h"
+#include "llvm/Support/Compiler.h"
 #include <climits>
 #include <vector>
 
@@ -32,7 +33,7 @@ class Type;
 
 /// Abstract base class for all machine specific constantpool value subclasses.
 ///
-class MachineConstantPoolValue {
+class LLVM_ABI MachineConstantPoolValue {
   virtual void anchor();
 
   Type *Ty;
@@ -94,14 +95,14 @@ class MachineConstantPoolEntry {
 
   Align getAlign() const { return Alignment; }
 
-  unsigned getSizeInBytes(const DataLayout &DL) const;
+  LLVM_ABI unsigned getSizeInBytes(const DataLayout &DL) const;
 
   /// This method classifies the entry according to whether or not it may
   /// generate a relocation entry.  This must be conservative, so if it might
   /// codegen to a relocatable entry, it should say so.
-  bool needsRelocation() const;
+  LLVM_ABI bool needsRelocation() const;
 
-  SectionKind getSectionKind(const DataLayout *DL) const;
+  LLVM_ABI SectionKind getSectionKind(const DataLayout *DL) const;
 };
 
 /// The MachineConstantPool class keeps track of constants referenced by a
@@ -127,7 +128,7 @@ class MachineConstantPool {
   /// The only constructor.
   explicit MachineConstantPool(const DataLayout &DL)
       : PoolAlignment(1), DL(DL) {}
-  ~MachineConstantPool();
+  LLVM_ABI ~MachineConstantPool();
 
   /// Return the alignment required by the whole constant pool, of which the
   /// first element must be aligned.
@@ -136,8 +137,9 @@ class MachineConstantPool {
   /// getConstantPoolIndex - Create a new entry in the constant pool or return
   /// an existing one.  User must specify the minimum required alignment for
   /// the object.
-  unsigned getConstantPoolIndex(const Constant *C, Align Alignment);
-  unsigned getConstantPoolIndex(MachineConstantPoolValue *V, Align Alignment);
+  LLVM_ABI unsigned getConstantPoolIndex(const Constant *C, Align Alignment);
+  LLVM_ABI unsigned getConstantPoolIndex(MachineConstantPoolValue *V,
+                                         Align Alignment);
 
   /// isEmpty - Return true if this constant pool contains no constants.
   bool isEmpty() const { return Constants.empty(); }
@@ -148,10 +150,10 @@ class MachineConstantPool {
 
   /// print - Used by the MachineFunction printer to print information about
   /// constant pool objects.  Implemented in MachineFunction.cpp
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 
   /// dump - Call print(cerr) to be called from the debugger.
-  void dump() const;
+  LLVM_ABI void dump() const;
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/MachineCopyPropagation.h b/llvm/include/llvm/CodeGen/MachineCopyPropagation.h
index 8355752e747c0..6c447e32d2b50 100644
--- a/llvm/include/llvm/CodeGen/MachineCopyPropagation.h
+++ b/llvm/include/llvm/CodeGen/MachineCopyPropagation.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_MACHINECOPYPROPAGATION_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -21,8 +22,8 @@ class MachineCopyPropagationPass
   MachineCopyPropagationPass(bool UseCopyInstr = false)
       : UseCopyInstr(UseCopyInstr) {}
 
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setNoVRegs();
diff --git a/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h b/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h
index 7df060a3f5b1a..78c9d262d78be 100644
--- a/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h
+++ b/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h
@@ -13,11 +13,12 @@
 #include "llvm/Analysis/DominanceFrontierImpl.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/GenericDomTree.h"
 
 namespace llvm {
 
-class MachineDominanceFrontier : public MachineFunctionPass {
+class LLVM_ABI MachineDominanceFrontier : public MachineFunctionPass {
   ForwardDominanceFrontierBase<MachineBasicBlock> Base;
 
 public:
diff --git a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
index bea1c7893c136..0c38c0c5fe5c0 100644
--- a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
+++ b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
@@ -36,7 +36,7 @@ class MachineFunctionAnalysis
     std::unique_ptr<MachineFunction> MF;
 
   public:
-    Result(std::unique_ptr<MachineFunction> MF);
+    LLVM_ABI Result(std::unique_ptr<MachineFunction> MF);
     MachineFunction &getMF() { return *MF; };
     LLVM_ABI bool invalidate(Function &, const PreservedAnalyses &PA,
                              FunctionAnalysisManager::Invalidator &);
diff --git a/llvm/include/llvm/CodeGen/MachineLateInstrsCleanup.h b/llvm/include/llvm/CodeGen/MachineLateInstrsCleanup.h
index 8562e1ad38a7e..8e49ef4247ae0 100644
--- a/llvm/include/llvm/CodeGen/MachineLateInstrsCleanup.h
+++ b/llvm/include/llvm/CodeGen/MachineLateInstrsCleanup.h
@@ -9,14 +9,16 @@
 #define LLVM_CODEGEN_MACHINELATEINSTRSCLEANUP_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class MachineLateInstrsCleanupPass
     : public PassInfoMixin<MachineLateInstrsCleanupPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MachineFunction,
-                        MachineFunctionAnalysisManager &MachineFunctionAM);
+  LLVM_ABI PreservedAnalyses
+  run(MachineFunction &MachineFunction,
+      MachineFunctionAnalysisManager &MachineFunctionAM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setNoVRegs();
diff --git a/llvm/include/llvm/CodeGen/MachineLoopUtils.h b/llvm/include/llvm/CodeGen/MachineLoopUtils.h
index b9bf93b71e25c..359efcaec8a35 100644
--- a/llvm/include/llvm/CodeGen/MachineLoopUtils.h
+++ b/llvm/include/llvm/CodeGen/MachineLoopUtils.h
@@ -9,6 +9,8 @@
 #ifndef LLVM_CODEGEN_MACHINELOOPUTILS_H
 #define LLVM_CODEGEN_MACHINELOOPUTILS_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 class MachineBasicBlock;
 class MachineRegisterInfo;
@@ -31,10 +33,10 @@ enum LoopPeelDirection {
 /// clone so as to execute a single iteration.
 ///
 /// The trip count of Loop is not updated.
-MachineBasicBlock *PeelSingleBlockLoop(LoopPeelDirection Direction,
-                                       MachineBasicBlock *Loop,
-                                       MachineRegisterInfo &MRI,
-                                       const TargetInstrInfo *TII);
+LLVM_ABI MachineBasicBlock *PeelSingleBlockLoop(LoopPeelDirection Direction,
+                                                MachineBasicBlock *Loop,
+                                                MachineRegisterInfo &MRI,
+                                                const TargetInstrInfo *TII);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h b/llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h
index f7a028625ee3c..2517e2237c717 100644
--- a/llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h
+++ b/llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 
 namespace llvm {
@@ -25,7 +26,7 @@ class MCSymbol;
 
 /// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
 /// for MachO targets.
-class MachineModuleInfoMachO : public MachineModuleInfoImpl {
+class LLVM_ABI MachineModuleInfoMachO : public MachineModuleInfoImpl {
   /// GVStubs - Darwin '$non_lazy_ptr' stubs.  The key is something like
   /// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
   /// is true if this GV is external.
@@ -74,7 +75,7 @@ class MachineModuleInfoMachO : public MachineModuleInfoImpl {
 
 /// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
 /// for ELF targets.
-class MachineModuleInfoELF : public MachineModuleInfoImpl {
+class LLVM_ABI MachineModuleInfoELF : public MachineModuleInfoImpl {
   /// GVStubs - These stubs are used to materialize global addresses in PIC
   /// mode.
   DenseMap<MCSymbol *, StubValueTy> GVStubs;
@@ -115,7 +116,7 @@ class MachineModuleInfoELF : public MachineModuleInfoImpl {
 
 /// MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation
 /// for COFF targets.
-class MachineModuleInfoCOFF : public MachineModuleInfoImpl {
+class LLVM_ABI MachineModuleInfoCOFF : public MachineModuleInfoImpl {
   /// GVStubs - These stubs are used to materialize global addresses in PIC
   /// mode.
   DenseMap<MCSymbol *, StubValueTy> GVStubs;
@@ -137,7 +138,7 @@ class MachineModuleInfoCOFF : public MachineModuleInfoImpl {
 
 /// MachineModuleInfoWasm - This is a MachineModuleInfoImpl implementation
 /// for Wasm targets.
-class MachineModuleInfoWasm : public MachineModuleInfoImpl {
+class LLVM_ABI MachineModuleInfoWasm : public MachineModuleInfoImpl {
   virtual void anchor(); // Out of line virtual method.
 
 public:
diff --git a/llvm/include/llvm/CodeGen/MachinePipeliner.h b/llvm/include/llvm/CodeGen/MachinePipeliner.h
index 6326fd4862d92..745fd84bb7522 100644
--- a/llvm/include/llvm/CodeGen/MachinePipeliner.h
+++ b/llvm/include/llvm/CodeGen/MachinePipeliner.h
@@ -51,6 +51,7 @@
 #include "llvm/CodeGen/ScheduleDAGMutation.h"
 #include "llvm/CodeGen/TargetInstrInfo.h"
 #include "llvm/CodeGen/WindowScheduler.h"
+#include "llvm/Support/Compiler.h"
 
 #include <deque>
 
@@ -60,12 +61,12 @@ class AAResults;
 class NodeSet;
 class SMSchedule;
 
-extern cl::opt<bool> SwpEnableCopyToPhi;
-extern cl::opt<int> SwpForceIssueWidth;
+extern LLVM_ABI cl::opt<bool> SwpEnableCopyToPhi;
+extern LLVM_ABI cl::opt<int> SwpForceIssueWidth;
 
 /// The main class in the implementation of the target independent
 /// software pipeliner pass.
-class MachinePipeliner : public MachineFunctionPass {
+class LLVM_ABI MachinePipeliner : public MachineFunctionPass {
 public:
   MachineFunction *MF = nullptr;
   MachineOptimizationRemarkEmitter *ORE = nullptr;
@@ -187,7 +188,7 @@ class SwingSchedulerDDGEdge {
   /// Returns true for DDG nodes that we ignore when computing the cost
   /// functions. We ignore the back-edge recurrence in order to avoid unbounded
   /// recursion in the calculation of the ASAP, ALAP, etc functions.
-  bool ignoreDependence(bool IgnoreAnti) const;
+  LLVM_ABI bool ignoreDependence(bool IgnoreAnti) const;
 
   /// Returns true if this edge is intended to be used only for validating the
   /// schedule.
@@ -216,10 +217,11 @@ struct LoopCarriedEdges {
   /// dependencies. Historically, loop-carried edges are represented by using
   /// non-loop-carried edges in the original DAG. This function appends such
   /// edges to preserve the previous behavior.
-  void modifySUnits(std::vector<SUnit> &SUnits, const TargetInstrInfo *TII);
+  LLVM_ABI void modifySUnits(std::vector<SUnit> &SUnits,
+                             const TargetInstrInfo *TII);
 
-  void dump(SUnit *SU, const TargetRegisterInfo *TRI,
-            const MachineRegisterInfo *MRI) const;
+  LLVM_ABI void dump(SUnit *SU, const TargetRegisterInfo *TRI,
+                     const MachineRegisterInfo *MRI) const;
 };
 
 /// This class provides APIs to retrieve edges from/to an SUnit node, with a
@@ -256,19 +258,19 @@ class SwingSchedulerDDG {
   const SwingSchedulerDDGEdges &getEdges(const SUnit *SU) const;
 
 public:
-  SwingSchedulerDDG(std::vector<SUnit> &SUnits, SUnit *EntrySU, SUnit *ExitSU,
-                    const LoopCarriedEdges &LCE);
+  LLVM_ABI SwingSchedulerDDG(std::vector<SUnit> &SUnits, SUnit *EntrySU,
+                             SUnit *ExitSU, const LoopCarriedEdges &LCE);
 
-  const EdgesType &getInEdges(const SUnit *SU) const;
+  LLVM_ABI const EdgesType &getInEdges(const SUnit *SU) const;
 
-  const EdgesType &getOutEdges(const SUnit *SU) const;
+  LLVM_ABI const EdgesType &getOutEdges(const SUnit *SU) const;
 
-  bool isValidSchedule(const SMSchedule &Schedule) const;
+  LLVM_ABI bool isValidSchedule(const SMSchedule &Schedule) const;
 };
 
 /// This class builds the dependence graph for the instructions in a loop,
 /// and attempts to schedule the instructions using the SMS algorithm.
-class SwingSchedulerDAG : public ScheduleDAGInstrs {
+class LLVM_ABI SwingSchedulerDAG : public ScheduleDAGInstrs {
   MachinePipeliner &Pass;
 
   std::unique_ptr<SwingSchedulerDDG> DDG;
@@ -358,13 +360,14 @@ class SwingSchedulerDAG : public ScheduleDAGInstrs {
       NumPaths = 0;
     }
 
-    void createAdjacencyStructure(SwingSchedulerDAG *DAG);
-    bool circuit(int V, int S, NodeSetType &NodeSets,
-                 const SwingSchedulerDAG *DAG, bool HasBackedge = false);
-    void unblock(int U);
+    LLVM_ABI void createAdjacencyStructure(SwingSchedulerDAG *DAG);
+    LLVM_ABI bool circuit(int V, int S, NodeSetType &NodeSets,
+                          const SwingSchedulerDAG *DAG,
+                          bool HasBackedge = false);
+    LLVM_ABI void unblock(int U);
   };
 
-  struct CopyToPhiMutation : public ScheduleDAGMutation {
+  struct LLVM_ABI CopyToPhiMutation : public ScheduleDAGMutation {
     void apply(ScheduleDAGInstrs *DAG) override;
   };
 
@@ -622,7 +625,7 @@ class NodeSet {
 
   iterator begin() { return Nodes.begin(); }
   iterator end() { return Nodes.end(); }
-  void print(raw_ostream &os) const;
+  LLVM_ABI void print(raw_ostream &os) const;
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   LLVM_DUMP_METHOD void dump() const;
@@ -696,21 +699,21 @@ class ResourceManager {
       IssueWidth = SwpForceIssueWidth;
   }
 
-  void initProcResourceVectors(const MCSchedModel &SM,
-                               SmallVectorImpl<uint64_t> &Masks);
+  LLVM_ABI void initProcResourceVectors(const MCSchedModel &SM,
+                                        SmallVectorImpl<uint64_t> &Masks);
 
   /// Check if the resources occupied by a machine instruction are available
   /// in the current state.
-  bool canReserveResources(SUnit &SU, int Cycle);
+  LLVM_ABI bool canReserveResources(SUnit &SU, int Cycle);
 
   /// Reserve the resources occupied by a machine instruction and change the
   /// current state to reflect that change.
-  void reserveResources(SUnit &SU, int Cycle);
+  LLVM_ABI void reserveResources(SUnit &SU, int Cycle);
 
-  int calculateResMII() const;
+  LLVM_ABI int calculateResMII() const;
 
   /// Initialize resources with the initiation interval II.
-  void init(int II);
+  LLVM_ABI void init(int II);
 };
 
 /// This class represents the scheduled code.  The main data structure is a
@@ -778,17 +781,17 @@ class SMSchedule {
 
   /// Return the cycle of the earliest scheduled instruction in the dependence
   /// chain.
-  int earliestCycleInChain(const SwingSchedulerDDGEdge &Dep,
-                           const SwingSchedulerDDG *DDG);
+  LLVM_ABI int earliestCycleInChain(const SwingSchedulerDDGEdge &Dep,
+                                    const SwingSchedulerDDG *DDG);
 
   /// Return the cycle of the latest scheduled instruction in the dependence
   /// chain.
-  int latestCycleInChain(const SwingSchedulerDDGEdge &Dep,
-                         const SwingSchedulerDDG *DDG);
+  LLVM_ABI int latestCycleInChain(const SwingSchedulerDDGEdge &Dep,
+                                  const SwingSchedulerDDG *DDG);
 
-  void computeStart(SUnit *SU, int *MaxEarlyStart, int *MinLateStart, int II,
-                    SwingSchedulerDAG *DAG);
-  bool insert(SUnit *SU, int StartCycle, int EndCycle, int II);
+  LLVM_ABI void computeStart(SUnit *SU, int *MaxEarlyStart, int *MinLateStart,
+                             int II, SwingSchedulerDAG *DAG);
+  LLVM_ABI bool insert(SUnit *SU, int StartCycle, int EndCycle, int II);
 
   /// Iterators for the cycle to instruction map.
   using sched_iterator = DenseMap<int, std::deque<SUnit *>>::iterator;
@@ -827,29 +830,32 @@ class SMSchedule {
     return ScheduledInstrs[cycle];
   }
 
-  SmallPtrSet<SUnit *, 8>
+  LLVM_ABI SmallPtrSet<SUnit *, 8>
   computeUnpipelineableNodes(SwingSchedulerDAG *SSD,
                              TargetInstrInfo::PipelinerLoopInfo *PLI);
 
-  std::deque<SUnit *>
+  LLVM_ABI std::deque<SUnit *>
   reorderInstructions(const SwingSchedulerDAG *SSD,
                       const std::deque<SUnit *> &Instrs) const;
 
-  bool
+  LLVM_ABI bool
   normalizeNonPipelinedInstructions(SwingSchedulerDAG *SSD,
                                     TargetInstrInfo::PipelinerLoopInfo *PLI);
-  bool isValidSchedule(SwingSchedulerDAG *SSD);
-  void finalizeSchedule(SwingSchedulerDAG *SSD);
-  void orderDependence(const SwingSchedulerDAG *SSD, SUnit *SU,
-                       std::deque<SUnit *> &Insts) const;
-  bool isLoopCarried(const SwingSchedulerDAG *SSD, MachineInstr &Phi) const;
-  bool isLoopCarriedDefOfUse(const SwingSchedulerDAG *SSD, MachineInstr *Def,
-                             MachineOperand &MO) const;
-
-  bool onlyHasLoopCarriedOutputOrOrderPreds(SUnit *SU,
-                                            const SwingSchedulerDDG *DDG) const;
-  void print(raw_ostream &os) const;
-  void dump() const;
+  LLVM_ABI bool isValidSchedule(SwingSchedulerDAG *SSD);
+  LLVM_ABI void finalizeSchedule(SwingSchedulerDAG *SSD);
+  LLVM_ABI void orderDependence(const SwingSchedulerDAG *SSD, SUnit *SU,
+                                std::deque<SUnit *> &Insts) const;
+  LLVM_ABI bool isLoopCarried(const SwingSchedulerDAG *SSD,
+                              MachineInstr &Phi) const;
+  LLVM_ABI bool isLoopCarriedDefOfUse(const SwingSchedulerDAG *SSD,
+                                      MachineInstr *Def,
+                                      MachineOperand &MO) const;
+
+  LLVM_ABI bool
+  onlyHasLoopCarriedOutputOrOrderPreds(SUnit *SU,
+                                       const SwingSchedulerDDG *DDG) const;
+  LLVM_ABI void print(raw_ostream &os) const;
+  LLVM_ABI void dump() const;
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/MachineRegionInfo.h b/llvm/include/llvm/CodeGen/MachineRegionInfo.h
index eeb69fef2c6b9..a4f55c28df2de 100644
--- a/llvm/include/llvm/CodeGen/MachineRegionInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineRegionInfo.h
@@ -18,6 +18,7 @@
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineLoopInfo.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 
 namespace llvm {
@@ -60,17 +61,18 @@ class MachineRegionNode : public RegionNodeBase<RegionTraits<MachineFunction>> {
 
 class MachineRegion : public RegionBase<RegionTraits<MachineFunction>> {
 public:
-  MachineRegion(MachineBasicBlock *Entry, MachineBasicBlock *Exit,
-                MachineRegionInfo *RI, MachineDominatorTree *DT,
-                MachineRegion *Parent = nullptr);
-  ~MachineRegion();
+  LLVM_ABI MachineRegion(MachineBasicBlock *Entry, MachineBasicBlock *Exit,
+                         MachineRegionInfo *RI, MachineDominatorTree *DT,
+                         MachineRegion *Parent = nullptr);
+  LLVM_ABI ~MachineRegion();
 
   bool operator==(const MachineRegionNode &RN) const {
     return &RN == reinterpret_cast<const MachineRegionNode *>(this);
   }
 };
 
-class MachineRegionInfo : public RegionInfoBase<RegionTraits<MachineFunction>> {
+class LLVM_ABI MachineRegionInfo
+    : public RegionInfoBase<RegionTraits<MachineFunction>> {
 public:
   explicit MachineRegionInfo();
   ~MachineRegionInfo() override;
@@ -82,7 +84,7 @@ class MachineRegionInfo : public RegionInfoBase<RegionTraits<MachineFunction>> {
                    MachinePostDominatorTree *PDT, MachineDominanceFrontier *DF);
 };
 
-class MachineRegionInfoPass : public MachineFunctionPass {
+class LLVM_ABI MachineRegionInfoPass : public MachineFunctionPass {
   MachineRegionInfo RI;
 
 public:
diff --git a/llvm/include/llvm/CodeGen/MachineSSAUpdater.h b/llvm/include/llvm/CodeGen/MachineSSAUpdater.h
index 3305e90f696d4..df3e80c9beb27 100644
--- a/llvm/include/llvm/CodeGen/MachineSSAUpdater.h
+++ b/llvm/include/llvm/CodeGen/MachineSSAUpdater.h
@@ -15,6 +15,7 @@
 
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/CodeGen/Register.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -54,27 +55,27 @@ class MachineSSAUpdater {
 public:
   /// MachineSSAUpdater constructor.  If InsertedPHIs is specified, it will be
   /// filled in with all PHI Nodes created by rewriting.
-  explicit MachineSSAUpdater(MachineFunction &MF,
-                        SmallVectorImpl<MachineInstr*> *NewPHI = nullptr);
+  LLVM_ABI explicit MachineSSAUpdater(
+      MachineFunction &MF, SmallVectorImpl<MachineInstr *> *NewPHI = nullptr);
   MachineSSAUpdater(const MachineSSAUpdater &) = delete;
   MachineSSAUpdater &operator=(const MachineSSAUpdater &) = delete;
-  ~MachineSSAUpdater();
+  LLVM_ABI ~MachineSSAUpdater();
 
   /// Initialize - Reset this object to get ready for a new set of SSA
   /// updates.
-  void Initialize(Register V);
+  LLVM_ABI void Initialize(Register V);
 
   /// AddAvailableValue - Indicate that a rewritten value is available at the
   /// end of the specified block with the specified value.
-  void AddAvailableValue(MachineBasicBlock *BB, Register V);
+  LLVM_ABI void AddAvailableValue(MachineBasicBlock *BB, Register V);
 
   /// HasValueForBlock - Return true if the MachineSSAUpdater already has a
   /// value for the specified block.
-  bool HasValueForBlock(MachineBasicBlock *BB) const;
+  LLVM_ABI bool HasValueForBlock(MachineBasicBlock *BB) const;
 
   /// GetValueAtEndOfBlock - Construct SSA form, materializing a value that is
   /// live at the end of the specified block.
-  Register GetValueAtEndOfBlock(MachineBasicBlock *BB);
+  LLVM_ABI Register GetValueAtEndOfBlock(MachineBasicBlock *BB);
 
   /// GetValueInMiddleOfBlock - Construct SSA form, materializing a value that
   /// is live in the middle of the specified block. If ExistingValueOnly is
@@ -96,15 +97,15 @@ class MachineSSAUpdater {
   /// their respective blocks.  However, the use of X happens in the *middle* of
   /// a block.  Because of this, we need to insert a new PHI node in SomeBB to
   /// merge the appropriate values, and this value isn't live out of the block.
-  Register GetValueInMiddleOfBlock(MachineBasicBlock *BB,
-                                   bool ExistingValueOnly = false);
+  LLVM_ABI Register GetValueInMiddleOfBlock(MachineBasicBlock *BB,
+                                            bool ExistingValueOnly = false);
 
   /// RewriteUse - Rewrite a use of the symbolic value.  This handles PHI nodes,
   /// which use their value in the corresponding predecessor.  Note that this
   /// will not work if the use is supposed to be rewritten to a value defined in
   /// the same block as the use, but above it.  Any 'AddAvailableValue's added
   /// for the use's block will be considered to be below it.
-  void RewriteUse(MachineOperand &U);
+  LLVM_ABI void RewriteUse(MachineOperand &U);
 
 private:
   // If ExistingValueOnly is true, will not create any new instructions. Used
diff --git a/llvm/include/llvm/CodeGen/MachineSink.h b/llvm/include/llvm/CodeGen/MachineSink.h
index 71bd7229b7598..9dbdae2262c05 100644
--- a/llvm/include/llvm/CodeGen/MachineSink.h
+++ b/llvm/include/llvm/CodeGen/MachineSink.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_MACHINESINK_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -20,10 +21,12 @@ class MachineSinkingPass : public PassInfoMixin<MachineSinkingPass> {
   MachineSinkingPass(bool EnableSinkAndFold = false)
       : EnableSinkAndFold(EnableSinkAndFold) {}
 
-  PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/MachineTraceMetrics.h b/llvm/include/llvm/CodeGen/MachineTraceMetrics.h
index b29984cd95a4b..554179b80d021 100644
--- a/llvm/include/llvm/CodeGen/MachineTraceMetrics.h
+++ b/llvm/include/llvm/CodeGen/MachineTraceMetrics.h
@@ -54,6 +54,7 @@
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachinePassManager.h"
 #include "llvm/CodeGen/TargetSchedule.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -120,10 +121,10 @@ class MachineTraceMetrics {
 
   MachineTraceMetrics(MachineTraceMetrics &&) = default;
 
-  ~MachineTraceMetrics();
+  LLVM_ABI ~MachineTraceMetrics();
 
-  void init(MachineFunction &Func, const MachineLoopInfo &LI);
-  void clear();
+  LLVM_ABI void init(MachineFunction &Func, const MachineLoopInfo &LI);
+  LLVM_ABI void clear();
 
   /// Per-basic block information that doesn't depend on the trace through the
   /// block.
@@ -145,14 +146,14 @@ class MachineTraceMetrics {
   };
 
   /// Get the fixed resource information about MBB. Compute it on demand.
-  const FixedBlockInfo *getResources(const MachineBasicBlock*);
+  LLVM_ABI const FixedBlockInfo *getResources(const MachineBasicBlock *);
 
   /// Get the scaled number of cycles used per processor resource in MBB.
   /// This is an array with SchedModel.getNumProcResourceKinds() entries.
   /// The getResources() function above must have been called first.
   ///
   /// These numbers have already been scaled by SchedModel.getResourceFactor().
-  ArrayRef<unsigned> getProcReleaseAtCycles(unsigned MBBNum) const;
+  LLVM_ABI ArrayRef<unsigned> getProcReleaseAtCycles(unsigned MBBNum) const;
 
   /// A virtual register or regunit required by a basic block or its trace
   /// successors.
@@ -252,7 +253,7 @@ class MachineTraceMetrics {
     /// include PHI uses in deeper blocks.
     SmallVector<LiveInReg, 4> LiveIns;
 
-    void print(raw_ostream&) const;
+    LLVM_ABI void print(raw_ostream &) const;
     void dump() const { print(dbgs()); }
   };
 
@@ -281,7 +282,7 @@ class MachineTraceMetrics {
   public:
     explicit Trace(Ensemble &te, TraceBlockInfo &tbi) : TE(te), TBI(tbi) {}
 
-    void print(raw_ostream&) const;
+    LLVM_ABI void print(raw_ostream &) const;
     void dump() const { print(dbgs()); }
 
     /// Compute the total number of instructions in the trace.
@@ -294,7 +295,7 @@ class MachineTraceMetrics {
     /// the trace head to the trace center block. The resource depth only
     /// considers execution resources, it ignores data dependencies.
     /// When Bottom is set, instructions in the trace center block are included.
-    unsigned getResourceDepth(bool Bottom) const;
+    LLVM_ABI unsigned getResourceDepth(bool Bottom) const;
 
     /// Return the resource length of the trace. This is the number of cycles
     /// required to execute the instructions in the trace if they were all
@@ -304,7 +305,7 @@ class MachineTraceMetrics {
     /// trace. Likewise, extra resources required by the specified scheduling
     /// classes are included. For the caller to account for extra machine
     /// instructions, it must first resolve each instruction's scheduling class.
-    unsigned getResourceLength(
+    LLVM_ABI unsigned getResourceLength(
         ArrayRef<const MachineBasicBlock *> Extrablocks = {},
         ArrayRef<const MCSchedClassDesc *> ExtraInstrs = {},
         ArrayRef<const MCSchedClassDesc *> RemoveInstrs = {}) const;
@@ -323,23 +324,23 @@ class MachineTraceMetrics {
     /// Return the slack of MI. This is the number of cycles MI can be delayed
     /// before the critical path becomes longer.
     /// MI must be an instruction in the trace center block.
-    unsigned getInstrSlack(const MachineInstr &MI) const;
+    LLVM_ABI unsigned getInstrSlack(const MachineInstr &MI) const;
 
     /// Return the Depth of a PHI instruction in a trace center block successor.
     /// The PHI does not have to be part of the trace.
-    unsigned getPHIDepth(const MachineInstr &PHI) const;
+    LLVM_ABI unsigned getPHIDepth(const MachineInstr &PHI) const;
 
     /// A dependence is useful if the basic block of the defining instruction
     /// is part of the trace of the user instruction. It is assumed that DefMI
     /// dominates UseMI (see also isUsefulDominator).
-    bool isDepInTrace(const MachineInstr &DefMI,
-                      const MachineInstr &UseMI) const;
+    LLVM_ABI bool isDepInTrace(const MachineInstr &DefMI,
+                               const MachineInstr &UseMI) const;
   };
 
   /// A trace ensemble is a collection of traces selected using the same
   /// strategy, for example 'minimum resource height'. There is one trace for
   /// every block in the function.
-  class Ensemble {
+  class LLVM_ABI Ensemble {
     friend class Trace;
 
     SmallVector<TraceBlockInfo, 4> BlockInfo;
@@ -397,7 +398,7 @@ class MachineTraceMetrics {
   /// Get the trace ensemble representing the given trace selection strategy.
   /// The returned Ensemble object is owned by the MachineTraceMetrics analysis,
   /// and valid for the lifetime of the analysis pass.
-  Ensemble *getEnsemble(MachineTraceStrategy);
+  LLVM_ABI Ensemble *getEnsemble(MachineTraceStrategy);
 
   /// Invalidate cached information about MBB. This must be called *before* MBB
   /// is erased, or the CFG is otherwise changed.
@@ -407,13 +408,13 @@ class MachineTraceMetrics {
   /// through MBB.
   ///
   /// Call Ensemble::getTrace() again to update any trace handles.
-  void invalidate(const MachineBasicBlock *MBB);
+  LLVM_ABI void invalidate(const MachineBasicBlock *MBB);
 
   /// Handle invalidation explicitly.
-  bool invalidate(MachineFunction &, const PreservedAnalyses &PA,
-                  MachineFunctionAnalysisManager::Invalidator &);
+  LLVM_ABI bool invalidate(MachineFunction &, const PreservedAnalyses &PA,
+                           MachineFunctionAnalysisManager::Invalidator &);
 
-  void verifyAnalysis() const;
+  LLVM_ABI void verifyAnalysis() const;
 
 private:
   // One entry per basic block, indexed by block number.
@@ -457,18 +458,19 @@ class MachineTraceMetricsAnalysis
 
 public:
   using Result = MachineTraceMetrics;
-  Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI Result run(MachineFunction &MF,
+                      MachineFunctionAnalysisManager &MFAM);
 };
 
 /// Verifier pass for \c MachineTraceMetrics.
 struct MachineTraceMetricsVerifierPass
     : PassInfoMixin<MachineTraceMetricsVerifierPass> {
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
-class MachineTraceMetricsWrapperPass : public MachineFunctionPass {
+class LLVM_ABI MachineTraceMetricsWrapperPass : public MachineFunctionPass {
 public:
   static char ID;
   MachineTraceMetrics MTM;
diff --git a/llvm/include/llvm/CodeGen/MachineUniformityAnalysis.h b/llvm/include/llvm/CodeGen/MachineUniformityAnalysis.h
index e8c0dc9b43823..4e39ccb0d6d2f 100644
--- a/llvm/include/llvm/CodeGen/MachineUniformityAnalysis.h
+++ b/llvm/include/llvm/CodeGen/MachineUniformityAnalysis.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/MachineDominators.h"
 #include "llvm/CodeGen/MachinePassManager.h"
 #include "llvm/CodeGen/MachineSSAContext.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -29,12 +30,12 @@ using MachineUniformityInfo = GenericUniformityInfo<MachineSSAContext>;
 ///
 /// If \p HasBranchDivergence is false, produces a dummy result which assumes
 /// everything is uniform.
-MachineUniformityInfo computeMachineUniformityInfo(
+LLVM_ABI MachineUniformityInfo computeMachineUniformityInfo(
     MachineFunction &F, const MachineCycleInfo &cycleInfo,
     const MachineDominatorTree &domTree, bool HasBranchDivergence);
 
 /// Legacy analysis pass which computes a \ref MachineUniformityInfo.
-class MachineUniformityAnalysisPass : public MachineFunctionPass {
+class LLVM_ABI MachineUniformityAnalysisPass : public MachineFunctionPass {
   MachineUniformityInfo UI;
 
 public:
@@ -59,7 +60,8 @@ class MachineUniformityAnalysis
 
 public:
   using Result = MachineUniformityInfo;
-  Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI Result run(MachineFunction &MF,
+                      MachineFunctionAnalysisManager &MFAM);
 };
 
 class MachineUniformityPrinterPass
@@ -68,8 +70,8 @@ class MachineUniformityPrinterPass
 
 public:
   explicit MachineUniformityPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/ModuloSchedule.h b/llvm/include/llvm/CodeGen/ModuloSchedule.h
index 49dc746d3ee35..493fea425e5d3 100644
--- a/llvm/include/llvm/CodeGen/ModuloSchedule.h
+++ b/llvm/include/llvm/CodeGen/ModuloSchedule.h
@@ -64,6 +64,7 @@
 #include "llvm/CodeGen/MachineLoopUtils.h"
 #include "llvm/CodeGen/TargetInstrInfo.h"
 #include "llvm/CodeGen/TargetSubtargetInfo.h"
+#include "llvm/Support/Compiler.h"
 #include <deque>
 #include <map>
 #include <vector>
@@ -153,7 +154,7 @@ class ModuloSchedule {
   ArrayRef<MachineInstr *> getInstructions() { return ScheduledInstrs; }
 
   void dump() { print(dbgs()); }
-  void print(raw_ostream &OS);
+  LLVM_ABI void print(raw_ostream &OS);
 };
 
 /// The ModuloScheduleExpander takes a ModuloSchedule and expands it in-place,
@@ -269,9 +270,9 @@ class ModuloScheduleExpander {
         InstrChanges(std::move(InstrChanges)) {}
 
   /// Performs the actual expansion.
-  void expand();
+  LLVM_ABI void expand();
   /// Performs final cleanup after expansion.
-  void cleanup();
+  LLVM_ABI void cleanup();
 
   /// Returns the newly rewritten kernel block, or nullptr if this was
   /// optimized away.
@@ -287,11 +288,11 @@ class PeelingModuloScheduleExpander {
       : Schedule(S), MF(MF), ST(MF.getSubtarget()), MRI(MF.getRegInfo()),
         TII(ST.getInstrInfo()), LIS(LIS) {}
 
-  void expand();
+  LLVM_ABI void expand();
 
   /// Runs ModuloScheduleExpander and treats it as a golden input to validate
   /// aspects of the code generated by PeelingModuloScheduleExpander.
-  void validateAgainstModuloScheduleExpander();
+  LLVM_ABI void validateAgainstModuloScheduleExpander();
 
 protected:
   ModuloSchedule &Schedule;
@@ -330,33 +331,35 @@ class PeelingModuloScheduleExpander {
 
   /// Converts BB from the original loop body to the rewritten, pipelined
   /// steady-state.
-  void rewriteKernel();
+  LLVM_ABI void rewriteKernel();
 
   /// Peels one iteration of the rewritten kernel (BB) in the specified
   /// direction.
-  MachineBasicBlock *peelKernel(LoopPeelDirection LPD);
+  LLVM_ABI MachineBasicBlock *peelKernel(LoopPeelDirection LPD);
   // Delete instructions whose stage is less than MinStage in the given basic
   // block.
-  void filterInstructions(MachineBasicBlock *MB, int MinStage);
+  LLVM_ABI void filterInstructions(MachineBasicBlock *MB, int MinStage);
   // Move instructions of the given stage from sourceBB to DestBB. Remap the phi
   // instructions to keep a valid IR.
-  void moveStageBetweenBlocks(MachineBasicBlock *DestBB,
-                              MachineBasicBlock *SourceBB, unsigned Stage);
+  LLVM_ABI void moveStageBetweenBlocks(MachineBasicBlock *DestBB,
+                                       MachineBasicBlock *SourceBB,
+                                       unsigned Stage);
   /// Peel the kernel forwards and backwards to produce prologs and epilogs,
   /// and stitch them together.
-  void peelPrologAndEpilogs();
+  LLVM_ABI void peelPrologAndEpilogs();
   /// All prolog and epilog blocks are clones of the kernel, so any produced
   /// register in one block has an corollary in all other blocks.
-  Register getEquivalentRegisterIn(Register Reg, MachineBasicBlock *BB);
+  LLVM_ABI Register getEquivalentRegisterIn(Register Reg,
+                                            MachineBasicBlock *BB);
   /// Change all users of MI, if MI is predicated out
   /// (LiveStages[MI->getParent()] == false).
-  void rewriteUsesOf(MachineInstr *MI);
+  LLVM_ABI void rewriteUsesOf(MachineInstr *MI);
   /// Insert branches between prologs, kernel and epilogs.
-  void fixupBranches();
+  LLVM_ABI void fixupBranches();
   /// Create a poor-man's LCSSA by cloning only the PHIs from the kernel block
   /// to a block dominated by all prologs and epilogs. This allows us to treat
   /// the loop exiting block as any other kernel clone.
-  MachineBasicBlock *CreateLCSSAExitingBlock();
+  LLVM_ABI MachineBasicBlock *CreateLCSSAExitingBlock();
   /// Helper to get the stage of an instruction in the schedule.
   unsigned getStage(MachineInstr *MI) {
     if (auto It = CanonicalMIs.find(MI); It != CanonicalMIs.end())
@@ -365,7 +368,8 @@ class PeelingModuloScheduleExpander {
   }
   /// Helper function to find the right canonical register for a phi instruction
   /// coming from a peeled out prologue.
-  Register getPhiCanonicalReg(MachineInstr* CanonicalPhi, MachineInstr* Phi);
+  LLVM_ABI Register getPhiCanonicalReg(MachineInstr *CanonicalPhi,
+                                       MachineInstr *Phi);
   /// Target loop info before kernel peeling.
   std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo> LoopInfo;
 };
@@ -438,8 +442,8 @@ class ModuloScheduleExpanderMVE {
       : Schedule(S), MF(MF), ST(MF.getSubtarget()), MRI(MF.getRegInfo()),
         TII(ST.getInstrInfo()), LIS(LIS) {}
 
-  void expand();
-  static bool canApply(MachineLoop &L);
+  LLVM_ABI void expand();
+  LLVM_ABI static bool canApply(MachineLoop &L);
 };
 
 /// Expander that simply annotates each scheduled instruction with a post-instr
@@ -457,7 +461,7 @@ class ModuloScheduleTestAnnotater {
       : MF(MF), S(S) {}
 
   /// Performs the annotation.
-  void annotate();
+  LLVM_ABI void annotate();
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/MultiHazardRecognizer.h b/llvm/include/llvm/CodeGen/MultiHazardRecognizer.h
index 9846045ff014b..47feba9035977 100644
--- a/llvm/include/llvm/CodeGen/MultiHazardRecognizer.h
+++ b/llvm/include/llvm/CodeGen/MultiHazardRecognizer.h
@@ -16,13 +16,14 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/CodeGen/ScheduleHazardRecognizer.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class MachineInstr;
 class SUnit;
 
-class MultiHazardRecognizer : public ScheduleHazardRecognizer {
+class LLVM_ABI MultiHazardRecognizer : public ScheduleHazardRecognizer {
   SmallVector<std::unique_ptr<ScheduleHazardRecognizer>, 4> Recognizers;
 
 public:
diff --git a/llvm/include/llvm/CodeGen/OptimizePHIs.h b/llvm/include/llvm/CodeGen/OptimizePHIs.h
index ca64ad98a985b..51fa9ecc2739a 100644
--- a/llvm/include/llvm/CodeGen/OptimizePHIs.h
+++ b/llvm/include/llvm/CodeGen/OptimizePHIs.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_OPTIMIZE_PHIS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class OptimizePHIsPass : public PassInfoMixin<OptimizePHIsPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/PEI.h b/llvm/include/llvm/CodeGen/PEI.h
index 95503b7861b39..3465157eb55d8 100644
--- a/llvm/include/llvm/CodeGen/PEI.h
+++ b/llvm/include/llvm/CodeGen/PEI.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_PEI_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class PrologEpilogInserterPass
     : public PassInfoMixin<PrologEpilogInserterPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   static bool isRequired() { return true; }
 };
diff --git a/llvm/include/llvm/CodeGen/PHIElimination.h b/llvm/include/llvm/CodeGen/PHIElimination.h
index d3c884b8413c7..94fa5047b8a9e 100644
--- a/llvm/include/llvm/CodeGen/PHIElimination.h
+++ b/llvm/include/llvm/CodeGen/PHIElimination.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_PHIELIMINATION_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class PHIEliminationPass : public PassInfoMixin<PHIEliminationPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/PatchableFunction.h b/llvm/include/llvm/CodeGen/PatchableFunction.h
index 095e159010b6c..8ca6bad9b97a5 100644
--- a/llvm/include/llvm/CodeGen/PatchableFunction.h
+++ b/llvm/include/llvm/CodeGen/PatchableFunction.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_PATCHABLEFUNCTION_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class PatchableFunctionPass : public PassInfoMixin<PatchableFunctionPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setNoVRegs();
diff --git a/llvm/include/llvm/CodeGen/PeepholeOptimizer.h b/llvm/include/llvm/CodeGen/PeepholeOptimizer.h
index 7f57e6dc35779..58da6ec8f60ef 100644
--- a/llvm/include/llvm/CodeGen/PeepholeOptimizer.h
+++ b/llvm/include/llvm/CodeGen/PeepholeOptimizer.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_PEEPHOLEOPTIMIZER_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class PeepholeOptimizerPass : public PassInfoMixin<PeepholeOptimizerPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setIsSSA();
diff --git a/llvm/include/llvm/CodeGen/PostRAHazardRecognizer.h b/llvm/include/llvm/CodeGen/PostRAHazardRecognizer.h
index 3e0c04ac5e403..c38809274345a 100644
--- a/llvm/include/llvm/CodeGen/PostRAHazardRecognizer.h
+++ b/llvm/include/llvm/CodeGen/PostRAHazardRecognizer.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_POSTRAHAZARDRECOGNIZER_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class PostRAHazardRecognizerPass
     : public PassInfoMixin<PostRAHazardRecognizerPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/PostRAMachineSink.h b/llvm/include/llvm/CodeGen/PostRAMachineSink.h
index 4ab088f17cafc..f5faddeb297c5 100644
--- a/llvm/include/llvm/CodeGen/PostRAMachineSink.h
+++ b/llvm/include/llvm/CodeGen/PostRAMachineSink.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_POSTRAMACHINESINK_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class PostRAMachineSinkingPass
     : public PassInfoMixin<PostRAMachineSinkingPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setNoVRegs();
diff --git a/llvm/include/llvm/CodeGen/PostRASchedulerList.h b/llvm/include/llvm/CodeGen/PostRASchedulerList.h
index e450dc8101078..9407e6f706d03 100644
--- a/llvm/include/llvm/CodeGen/PostRASchedulerList.h
+++ b/llvm/include/llvm/CodeGen/PostRASchedulerList.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_POSTRASCHEDULERLIST_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -18,8 +19,8 @@ class PostRASchedulerPass : public PassInfoMixin<PostRASchedulerPass> {
 
 public:
   PostRASchedulerPass(const TargetMachine *TM) : TM(TM) {}
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setNoVRegs();
diff --git a/llvm/include/llvm/CodeGen/PreISelIntrinsicLowering.h b/llvm/include/llvm/CodeGen/PreISelIntrinsicLowering.h
index 955a2437cb94c..5561244bbbc53 100644
--- a/llvm/include/llvm/CodeGen/PreISelIntrinsicLowering.h
+++ b/llvm/include/llvm/CodeGen/PreISelIntrinsicLowering.h
@@ -14,6 +14,7 @@
 #define LLVM_CODEGEN_PREISELINTRINSICLOWERING_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,7 +26,7 @@ struct PreISelIntrinsicLoweringPass
   const TargetMachine *TM;
 
   PreISelIntrinsicLoweringPass(const TargetMachine *TM) : TM(TM) {}
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/ProcessImplicitDefs.h b/llvm/include/llvm/CodeGen/ProcessImplicitDefs.h
index 12a97d3efec66..601cb9b93b397 100644
--- a/llvm/include/llvm/CodeGen/ProcessImplicitDefs.h
+++ b/llvm/include/llvm/CodeGen/ProcessImplicitDefs.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_PROCESSIMPLICITDEFS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class ProcessImplicitDefsPass : public PassInfoMixin<ProcessImplicitDefsPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setIsSSA();
   }
diff --git a/llvm/include/llvm/CodeGen/RDFGraph.h b/llvm/include/llvm/CodeGen/RDFGraph.h
index 8363d88f34c37..56576d5774932 100644
--- a/llvm/include/llvm/CodeGen/RDFGraph.h
+++ b/llvm/include/llvm/CodeGen/RDFGraph.h
@@ -229,6 +229,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/LaneBitmask.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/MathExtras.h"
 #include <cassert>
 #include <cstdint>
@@ -425,9 +426,9 @@ struct NodeAllocator {
     return reinterpret_cast<NodeBase *>(Blocks[BlockN] + Offset);
   }
 
-  NodeId id(const NodeBase *P) const;
-  Node New();
-  void clear();
+  LLVM_ABI NodeId id(const NodeBase *P) const;
+  LLVM_ABI Node New();
+  LLVM_ABI void clear();
 
 private:
   void startNewBlock();
@@ -449,7 +450,7 @@ struct NodeAllocator {
 
 using RegisterSet = std::set<RegisterRef, RegisterRefLess>;
 
-struct TargetOperandInfo {
+struct LLVM_ABI TargetOperandInfo {
   TargetOperandInfo(const TargetInstrInfo &tii) : TII(tii) {}
   virtual ~TargetOperandInfo() = default;
 
@@ -499,7 +500,7 @@ struct NodeBase {
   void setFlags(uint16_t F) { setAttrs(NodeAttrs::set_flags(getAttrs(), F)); }
 
   // Insert node NA after "this" in the circular chain.
-  void append(Node NA);
+  LLVM_ABI void append(Node NA);
 
   // Initialize all members to 0.
   void init() { memset(this, 0, sizeof *this); }
@@ -553,15 +554,15 @@ using NodeSet = std::set<NodeId>;
 struct RefNode : public NodeBase {
   RefNode() = default;
 
-  RegisterRef getRegRef(const DataFlowGraph &G) const;
+  LLVM_ABI RegisterRef getRegRef(const DataFlowGraph &G) const;
 
   MachineOperand &getOp() {
     assert(!(getFlags() & NodeAttrs::PhiRef));
     return *RefData.Op;
   }
 
-  void setRegRef(RegisterRef RR, DataFlowGraph &G);
-  void setRegRef(MachineOperand *Op, DataFlowGraph &G);
+  LLVM_ABI void setRegRef(RegisterRef RR, DataFlowGraph &G);
+  LLVM_ABI void setRegRef(MachineOperand *Op, DataFlowGraph &G);
 
   NodeId getReachingDef() const { return RefData.RD; }
   void setReachingDef(NodeId RD) { RefData.RD = RD; }
@@ -582,7 +583,7 @@ struct RefNode : public NodeBase {
   template <typename Predicate>
   Ref getNextRef(RegisterRef RR, Predicate P, bool NextOnly,
                  const DataFlowGraph &G);
-  Node getOwner(const DataFlowGraph &G);
+  LLVM_ABI Node getOwner(const DataFlowGraph &G);
 };
 
 struct DefNode : public RefNode {
@@ -591,11 +592,11 @@ struct DefNode : public RefNode {
   NodeId getReachedUse() const { return RefData.Def.DU; }
   void setReachedUse(NodeId U) { RefData.Def.DU = U; }
 
-  void linkToDef(NodeId Self, Def DA);
+  LLVM_ABI void linkToDef(NodeId Self, Def DA);
 };
 
 struct UseNode : public RefNode {
-  void linkToDef(NodeId Self, Def DA);
+  LLVM_ABI void linkToDef(NodeId Self, Def DA);
 };
 
 struct PhiUseNode : public UseNode {
@@ -615,19 +616,19 @@ struct CodeNode : public NodeBase {
   }
   void setCode(void *C) { CodeData.CP = C; }
 
-  Node getFirstMember(const DataFlowGraph &G) const;
-  Node getLastMember(const DataFlowGraph &G) const;
-  void addMember(Node NA, const DataFlowGraph &G);
-  void addMemberAfter(Node MA, Node NA, const DataFlowGraph &G);
-  void removeMember(Node NA, const DataFlowGraph &G);
+  LLVM_ABI Node getFirstMember(const DataFlowGraph &G) const;
+  LLVM_ABI Node getLastMember(const DataFlowGraph &G) const;
+  LLVM_ABI void addMember(Node NA, const DataFlowGraph &G);
+  LLVM_ABI void addMemberAfter(Node MA, Node NA, const DataFlowGraph &G);
+  LLVM_ABI void removeMember(Node NA, const DataFlowGraph &G);
 
-  NodeList members(const DataFlowGraph &G) const;
+  LLVM_ABI NodeList members(const DataFlowGraph &G) const;
   template <typename Predicate>
   NodeList members_if(Predicate P, const DataFlowGraph &G) const;
 };
 
 struct InstrNode : public CodeNode {
-  Node getOwner(const DataFlowGraph &G);
+  LLVM_ABI Node getOwner(const DataFlowGraph &G);
 };
 
 struct PhiNode : public InstrNode {
@@ -645,7 +646,7 @@ struct BlockNode : public CodeNode {
     return CodeNode::getCode<MachineBasicBlock *>();
   }
 
-  void addPhi(Phi PA, const DataFlowGraph &G);
+  LLVM_ABI void addPhi(Phi PA, const DataFlowGraph &G);
 };
 
 struct FuncNode : public CodeNode {
@@ -653,18 +654,21 @@ struct FuncNode : public CodeNode {
     return CodeNode::getCode<MachineFunction *>();
   }
 
-  Block findBlock(const MachineBasicBlock *BB, const DataFlowGraph &G) const;
-  Block getEntryBlock(const DataFlowGraph &G);
+  LLVM_ABI Block findBlock(const MachineBasicBlock *BB,
+                           const DataFlowGraph &G) const;
+  LLVM_ABI Block getEntryBlock(const DataFlowGraph &G);
 };
 
 struct DataFlowGraph {
-  DataFlowGraph(MachineFunction &mf, const TargetInstrInfo &tii,
-                const TargetRegisterInfo &tri, const MachineDominatorTree &mdt,
-                const MachineDominanceFrontier &mdf);
-  DataFlowGraph(MachineFunction &mf, const TargetInstrInfo &tii,
-                const TargetRegisterInfo &tri, const MachineDominatorTree &mdt,
-                const MachineDominanceFrontier &mdf,
-                const TargetOperandInfo &toi);
+  LLVM_ABI DataFlowGraph(MachineFunction &mf, const TargetInstrInfo &tii,
+                         const TargetRegisterInfo &tri,
+                         const MachineDominatorTree &mdt,
+                         const MachineDominanceFrontier &mdf);
+  LLVM_ABI DataFlowGraph(MachineFunction &mf, const TargetInstrInfo &tii,
+                         const TargetRegisterInfo &tri,
+                         const MachineDominatorTree &mdt,
+                         const MachineDominanceFrontier &mdf,
+                         const TargetOperandInfo &toi);
 
   struct Config {
     Config() = default;
@@ -679,12 +683,12 @@ struct DataFlowGraph {
     std::set<RegisterId> TrackRegs;
   };
 
-  NodeBase *ptr(NodeId N) const;
+  LLVM_ABI NodeBase *ptr(NodeId N) const;
   template <typename T> T ptr(NodeId N) const { //
     return static_cast<T>(ptr(N));
   }
 
-  NodeId id(const NodeBase *P) const;
+  LLVM_ABI NodeId id(const NodeBase *P) const;
 
   template <typename T> NodeAddr<T> addr(NodeId N) const {
     return {ptr<T>(N), N};
@@ -732,7 +736,7 @@ struct DataFlowGraph {
     private:
       friend struct DefStack;
 
-      Iterator(const DefStack &S, bool Top);
+      LLVM_ABI Iterator(const DefStack &S, bool Top);
 
       // Pos-1 is the index in the StorageType object that corresponds to
       // the top of the DefStack.
@@ -745,12 +749,12 @@ struct DataFlowGraph {
 
     iterator top() const { return Iterator(*this, true); }
     iterator bottom() const { return Iterator(*this, false); }
-    unsigned size() const;
+    LLVM_ABI unsigned size() const;
 
     void push(Def DA) { Stack.push_back(DA); }
-    void pop();
-    void start_block(NodeId N);
-    void clear_block(NodeId N);
+    LLVM_ABI void pop();
+    LLVM_ABI void start_block(NodeId N);
+    LLVM_ABI void clear_block(NodeId N);
 
   private:
     friend struct Iterator;
@@ -761,8 +765,8 @@ struct DataFlowGraph {
       return (P.Addr == nullptr) && (N == 0 || P.Id == N);
     }
 
-    unsigned nextUp(unsigned P) const;
-    unsigned nextDown(unsigned P) const;
+    LLVM_ABI unsigned nextUp(unsigned P) const;
+    LLVM_ABI unsigned nextDown(unsigned P) const;
 
     StorageType Stack;
   };
@@ -771,12 +775,12 @@ struct DataFlowGraph {
   // Map: Register (physical or virtual) -> DefStack
   using DefStackMap = std::unordered_map<RegisterId, DefStack>;
 
-  void build(const Config &config);
+  LLVM_ABI void build(const Config &config);
   void build() { build(Config()); }
 
-  void pushAllDefs(Instr IA, DefStackMap &DM);
-  void markBlock(NodeId B, DefStackMap &DefM);
-  void releaseBlock(NodeId B, DefStackMap &DefM);
+  LLVM_ABI void pushAllDefs(Instr IA, DefStackMap &DM);
+  LLVM_ABI void markBlock(NodeId B, DefStackMap &DefM);
+  LLVM_ABI void releaseBlock(NodeId B, DefStackMap &DefM);
 
   PackedRegisterRef pack(RegisterRef RR) {
     return {RR.Id, LMI.getIndexForLaneMask(RR.Mask)};
@@ -788,13 +792,13 @@ struct DataFlowGraph {
     return RegisterRef(PR.Id, LMI.getLaneMaskForIndex(PR.MaskId));
   }
 
-  RegisterRef makeRegRef(unsigned Reg, unsigned Sub) const;
-  RegisterRef makeRegRef(const MachineOperand &Op) const;
+  LLVM_ABI RegisterRef makeRegRef(unsigned Reg, unsigned Sub) const;
+  LLVM_ABI RegisterRef makeRegRef(const MachineOperand &Op) const;
 
-  Ref getNextRelated(Instr IA, Ref RA) const;
-  Ref getNextShadow(Instr IA, Ref RA, bool Create);
+  LLVM_ABI Ref getNextRelated(Instr IA, Ref RA) const;
+  LLVM_ABI Ref getNextShadow(Instr IA, Ref RA, bool Create);
 
-  NodeList getRelatedRefs(Instr IA, Ref RA) const;
+  LLVM_ABI NodeList getRelatedRefs(Instr IA, Ref RA) const;
 
   Block findBlock(MachineBasicBlock *BB) const { return BlockNodes.at(BB); }
 
@@ -810,8 +814,8 @@ struct DataFlowGraph {
       removeFromOwner(DA);
   }
 
-  bool isTracked(RegisterRef RR) const;
-  bool hasUntrackedRef(Stmt S, bool IgnoreReserved = true) const;
+  LLVM_ABI bool isTracked(RegisterRef RR) const;
+  LLVM_ABI bool hasUntrackedRef(Stmt S, bool IgnoreReserved = true) const;
 
   // Some useful filters.
   template <uint16_t Kind> static bool IsRef(const Node BA) {
@@ -877,8 +881,8 @@ struct DataFlowGraph {
   void linkStmtRefs(DefStackMap &DefM, Stmt SA, Predicate P);
   void linkBlockRefs(DefStackMap &DefM, BlockRefsMap &PhiClobberM, Block BA);
 
-  void unlinkUseDF(Use UA);
-  void unlinkDefDF(Def DA);
+  LLVM_ABI void unlinkUseDF(Use UA);
+  LLVM_ABI void unlinkDefDF(Def DA);
 
   void removeFromOwner(Ref RA) {
     Instr IA = RA.Addr->getOwner(*this);
@@ -972,23 +976,23 @@ template <typename T> struct PrintNode : Print<NodeAddr<T>> {
       : Print<NodeAddr<T>>(x, g) {}
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterRef> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<NodeId> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<Def> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<Use> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<PhiUse> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<Ref> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<NodeList> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<NodeSet> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<Phi> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<Stmt> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<Instr> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<Block> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<Func> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterSet> &P);
-raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterAggr> &P);
-raw_ostream &operator<<(raw_ostream &OS,
-                        const Print<DataFlowGraph::DefStack> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterRef> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<NodeId> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<Def> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<Use> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<PhiUse> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<Ref> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<NodeList> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<NodeSet> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<Phi> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<Stmt> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<Instr> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<Block> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<Func> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterSet> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterAggr> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS,
+                                 const Print<DataFlowGraph::DefStack> &P);
 
 } // end namespace rdf
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/RDFLiveness.h b/llvm/include/llvm/CodeGen/RDFLiveness.h
index fe1034f9b6f8e..edf876b7afd10 100644
--- a/llvm/include/llvm/CodeGen/RDFLiveness.h
+++ b/llvm/include/llvm/CodeGen/RDFLiveness.h
@@ -16,6 +16,7 @@
 #include "RDFRegisters.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/MC/LaneBitmask.h"
+#include "llvm/Support/Compiler.h"
 #include <map>
 #include <set>
 #include <unordered_map>
@@ -63,9 +64,10 @@ struct Liveness {
       : DFG(g), TRI(g.getTRI()), PRI(g.getPRI()), MDT(g.getDT()),
         MDF(g.getDF()), LiveMap(g.getPRI()), Empty(), NoRegs(g.getPRI()) {}
 
-  NodeList getAllReachingDefs(RegisterRef RefRR, NodeAddr<RefNode *> RefA,
-                              bool TopShadows, bool FullChain,
-                              const RegisterAggr &DefRRs);
+  LLVM_ABI NodeList getAllReachingDefs(RegisterRef RefRR,
+                                       NodeAddr<RefNode *> RefA,
+                                       bool TopShadows, bool FullChain,
+                                       const RegisterAggr &DefRRs);
 
   NodeList getAllReachingDefs(NodeAddr<RefNode *> RefA) {
     return getAllReachingDefs(RefA.Addr->getRegRef(DFG), RefA, false, false,
@@ -76,20 +78,20 @@ struct Liveness {
     return getAllReachingDefs(RefRR, RefA, false, false, NoRegs);
   }
 
-  NodeSet getAllReachedUses(RegisterRef RefRR, NodeAddr<DefNode *> DefA,
-                            const RegisterAggr &DefRRs);
+  LLVM_ABI NodeSet getAllReachedUses(RegisterRef RefRR,
+                                     NodeAddr<DefNode *> DefA,
+                                     const RegisterAggr &DefRRs);
 
   NodeSet getAllReachedUses(RegisterRef RefRR, NodeAddr<DefNode *> DefA) {
     return getAllReachedUses(RefRR, DefA, NoRegs);
   }
 
-  std::pair<NodeSet, bool> getAllReachingDefsRec(RegisterRef RefRR,
-                                                 NodeAddr<RefNode *> RefA,
-                                                 NodeSet &Visited,
-                                                 const NodeSet &Defs);
+  LLVM_ABI std::pair<NodeSet, bool>
+  getAllReachingDefsRec(RegisterRef RefRR, NodeAddr<RefNode *> RefA,
+                        NodeSet &Visited, const NodeSet &Defs);
 
-  NodeAddr<RefNode *> getNearestAliasedRef(RegisterRef RefRR,
-                                           NodeAddr<InstrNode *> IA);
+  LLVM_ABI NodeAddr<RefNode *> getNearestAliasedRef(RegisterRef RefRR,
+                                                    NodeAddr<InstrNode *> IA);
 
   LiveMapType &getLiveMap() { return LiveMap; }
   const LiveMapType &getLiveMap() const { return LiveMap; }
@@ -99,11 +101,11 @@ struct Liveness {
     return F == RealUseMap.end() ? Empty : F->second;
   }
 
-  void computePhiInfo();
-  void computeLiveIns();
-  void resetLiveIns();
-  void resetKills();
-  void resetKills(MachineBasicBlock *B);
+  LLVM_ABI void computePhiInfo();
+  LLVM_ABI void computeLiveIns();
+  LLVM_ABI void resetLiveIns();
+  LLVM_ABI void resetKills();
+  LLVM_ABI void resetKills(MachineBasicBlock *B);
 
   void trace(bool T) { Trace = T; }
 
@@ -153,7 +155,8 @@ struct Liveness {
                             unsigned Nest, unsigned MaxNest);
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const Print<Liveness::RefMap> &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS,
+                                 const Print<Liveness::RefMap> &P);
 
 } // end namespace llvm::rdf
 
diff --git a/llvm/include/llvm/CodeGen/RDFRegisters.h b/llvm/include/llvm/CodeGen/RDFRegisters.h
index 48e1e3487f11f..48510e8c05e06 100644
--- a/llvm/include/llvm/CodeGen/RDFRegisters.h
+++ b/llvm/include/llvm/CodeGen/RDFRegisters.h
@@ -16,6 +16,7 @@
 #include "llvm/CodeGen/TargetRegisterInfo.h"
 #include "llvm/MC/LaneBitmask.h"
 #include "llvm/MC/MCRegister.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <cstdint>
 #include <map>
@@ -145,8 +146,8 @@ struct RegisterRef {
 };
 
 struct PhysicalRegisterInfo {
-  PhysicalRegisterInfo(const TargetRegisterInfo &tri,
-                       const MachineFunction &mf);
+  LLVM_ABI PhysicalRegisterInfo(const TargetRegisterInfo &tri,
+                                const MachineFunction &mf);
 
   RegisterId getRegMaskId(const uint32_t *RM) const {
     return RegisterRef::toMaskId(RegMasks.find(RM));
@@ -156,10 +157,10 @@ struct PhysicalRegisterInfo {
     return RegMasks.get(RR.asMaskIdx());
   }
 
-  bool alias(RegisterRef RA, RegisterRef RB) const;
+  LLVM_ABI bool alias(RegisterRef RA, RegisterRef RB) const;
 
   // Returns the set of aliased physical registers.
-  std::set<RegisterId> getAliasSet(RegisterRef RR) const;
+  LLVM_ABI std::set<RegisterId> getAliasSet(RegisterRef RR) const;
 
   RegisterRef getRefForUnit(MCRegUnit U) const {
     return RegisterRef(UnitInfos[U].Reg, UnitInfos[U].Mask);
@@ -169,20 +170,20 @@ struct PhysicalRegisterInfo {
     return MaskInfos[RR.asMaskIdx()].Units;
   }
 
-  std::set<RegisterId> getUnits(RegisterRef RR) const;
+  LLVM_ABI std::set<RegisterId> getUnits(RegisterRef RR) const;
 
   const BitVector &getUnitAliases(MCRegUnit U) const {
     return AliasInfos[U].Regs;
   }
 
-  RegisterRef mapTo(RegisterRef RR, RegisterId R) const;
+  LLVM_ABI RegisterRef mapTo(RegisterRef RR, RegisterId R) const;
   const TargetRegisterInfo &getTRI() const { return TRI; }
 
-  bool equal_to(RegisterRef A, RegisterRef B) const;
-  bool less(RegisterRef A, RegisterRef B) const;
+  LLVM_ABI bool equal_to(RegisterRef A, RegisterRef B) const;
+  LLVM_ABI bool less(RegisterRef A, RegisterRef B) const;
 
-  void print(raw_ostream &OS, RegisterRef A) const;
-  void print(raw_ostream &OS, const RegisterAggr &A) const;
+  LLVM_ABI void print(raw_ostream &OS, RegisterRef A) const;
+  LLVM_ABI void print(raw_ostream &OS, const RegisterAggr &A) const;
 
 private:
   struct RegInfo {
@@ -241,8 +242,8 @@ struct RegisterAggr {
 
   unsigned size() const { return Units.count(); }
   bool empty() const { return Units.none(); }
-  bool hasAliasOf(RegisterRef RR) const;
-  bool hasCoverOf(RegisterRef RR) const;
+  LLVM_ABI bool hasAliasOf(RegisterRef RR) const;
+  LLVM_ABI bool hasCoverOf(RegisterRef RR) const;
 
   const PhysicalRegisterInfo &getPRI() const { return PRI; }
 
@@ -255,16 +256,16 @@ struct RegisterAggr {
     return RegisterAggr(PRI).insert(RA).hasCoverOf(RB);
   }
 
-  RegisterAggr &insert(RegisterRef RR);
-  RegisterAggr &insert(const RegisterAggr &RG);
-  RegisterAggr &intersect(RegisterRef RR);
-  RegisterAggr &intersect(const RegisterAggr &RG);
-  RegisterAggr &clear(RegisterRef RR);
-  RegisterAggr &clear(const RegisterAggr &RG);
+  LLVM_ABI RegisterAggr &insert(RegisterRef RR);
+  LLVM_ABI RegisterAggr &insert(const RegisterAggr &RG);
+  LLVM_ABI RegisterAggr &intersect(RegisterRef RR);
+  LLVM_ABI RegisterAggr &intersect(const RegisterAggr &RG);
+  LLVM_ABI RegisterAggr &clear(RegisterRef RR);
+  LLVM_ABI RegisterAggr &clear(const RegisterAggr &RG);
 
-  RegisterRef intersectWith(RegisterRef RR) const;
-  RegisterRef clearIn(RegisterRef RR) const;
-  RegisterRef makeRegRef() const;
+  LLVM_ABI RegisterRef intersectWith(RegisterRef RR) const;
+  LLVM_ABI RegisterRef clearIn(RegisterRef RR) const;
+  LLVM_ABI RegisterRef makeRegRef() const;
 
   size_t hash() const { return DenseMapInfo<BitVector>::getHashValue(Units); }
 
@@ -278,7 +279,7 @@ struct RegisterAggr {
     const RegisterAggr *Owner;
 
   public:
-    ref_iterator(const RegisterAggr &RG, bool End);
+    LLVM_ABI ref_iterator(const RegisterAggr &RG, bool End);
 
     RegisterRef operator*() const {
       return RegisterRef(Pos->first, Pos->second);
@@ -343,14 +344,14 @@ template <typename KeyType> struct RegisterAggrMap {
   using value_type = typename decltype(Map)::value_type;
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const RegisterAggr &A);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const RegisterAggr &A);
 
 // Print the lane mask in a short form (or not at all if all bits are set).
 struct PrintLaneMaskShort {
   PrintLaneMaskShort(LaneBitmask M) : Mask(M) {}
   LaneBitmask Mask;
 };
-raw_ostream &operator<<(raw_ostream &OS, const PrintLaneMaskShort &P);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PrintLaneMaskShort &P);
 
 } // end namespace rdf
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/ReachingDefAnalysis.h b/llvm/include/llvm/CodeGen/ReachingDefAnalysis.h
index b6ca1d6e9b328..f7af47d482da0 100644
--- a/llvm/include/llvm/CodeGen/ReachingDefAnalysis.h
+++ b/llvm/include/llvm/CodeGen/ReachingDefAnalysis.h
@@ -28,6 +28,7 @@
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachinePassManager.h"
 #include "llvm/InitializePasses.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -159,123 +160,132 @@ class ReachingDefInfo {
   using BlockSet = SmallPtrSetImpl<MachineBasicBlock*>;
 
 public:
-  ReachingDefInfo();
-  ReachingDefInfo(ReachingDefInfo &&);
-  ~ReachingDefInfo();
+  LLVM_ABI ReachingDefInfo();
+  LLVM_ABI ReachingDefInfo(ReachingDefInfo &&);
+  LLVM_ABI ~ReachingDefInfo();
   /// Handle invalidation explicitly.
-  bool invalidate(MachineFunction &F, const PreservedAnalyses &PA,
-                  MachineFunctionAnalysisManager::Invalidator &);
+  LLVM_ABI bool invalidate(MachineFunction &F, const PreservedAnalyses &PA,
+                           MachineFunctionAnalysisManager::Invalidator &);
 
-  void run(MachineFunction &mf);
-  void print(raw_ostream &OS);
-  void releaseMemory();
+  LLVM_ABI void run(MachineFunction &mf);
+  LLVM_ABI void print(raw_ostream &OS);
+  LLVM_ABI void releaseMemory();
 
   /// Re-run the analysis.
-  void reset();
+  LLVM_ABI void reset();
 
   /// Initialize data structures.
-  void init();
+  LLVM_ABI void init();
 
   /// Traverse the machine function, mapping definitions.
-  void traverse();
+  LLVM_ABI void traverse();
 
   /// Provides the instruction id of the closest reaching def instruction of
   /// Reg that reaches MI, relative to the begining of MI's basic block.
   /// Note that Reg may represent a stack slot.
-  int getReachingDef(MachineInstr *MI, Register Reg) const;
+  LLVM_ABI int getReachingDef(MachineInstr *MI, Register Reg) const;
 
   /// Return whether A and B use the same def of Reg.
-  bool hasSameReachingDef(MachineInstr *A, MachineInstr *B, Register Reg) const;
+  LLVM_ABI bool hasSameReachingDef(MachineInstr *A, MachineInstr *B,
+                                   Register Reg) const;
 
   /// Return whether the reaching def for MI also is live out of its parent
   /// block.
-  bool isReachingDefLiveOut(MachineInstr *MI, Register Reg) const;
+  LLVM_ABI bool isReachingDefLiveOut(MachineInstr *MI, Register Reg) const;
 
   /// Return the local MI that produces the live out value for Reg, or
   /// nullptr for a non-live out or non-local def.
-  MachineInstr *getLocalLiveOutMIDef(MachineBasicBlock *MBB,
-                                     Register Reg) const;
+  LLVM_ABI MachineInstr *getLocalLiveOutMIDef(MachineBasicBlock *MBB,
+                                              Register Reg) const;
 
   /// If a single MachineInstr creates the reaching definition, then return it.
   /// Otherwise return null.
-  MachineInstr *getUniqueReachingMIDef(MachineInstr *MI, Register Reg) const;
+  LLVM_ABI MachineInstr *getUniqueReachingMIDef(MachineInstr *MI,
+                                                Register Reg) const;
 
   /// If a single MachineInstr creates the reaching definition, for MIs operand
   /// at Idx, then return it. Otherwise return null.
-  MachineInstr *getMIOperand(MachineInstr *MI, unsigned Idx) const;
+  LLVM_ABI MachineInstr *getMIOperand(MachineInstr *MI, unsigned Idx) const;
 
   /// If a single MachineInstr creates the reaching definition, for MIs MO,
   /// then return it. Otherwise return null.
-  MachineInstr *getMIOperand(MachineInstr *MI, MachineOperand &MO) const;
+  LLVM_ABI MachineInstr *getMIOperand(MachineInstr *MI,
+                                      MachineOperand &MO) const;
 
   /// Provide whether the register has been defined in the same basic block as,
   /// and before, MI.
-  bool hasLocalDefBefore(MachineInstr *MI, Register Reg) const;
+  LLVM_ABI bool hasLocalDefBefore(MachineInstr *MI, Register Reg) const;
 
   /// Return whether the given register is used after MI, whether it's a local
   /// use or a live out.
-  bool isRegUsedAfter(MachineInstr *MI, Register Reg) const;
+  LLVM_ABI bool isRegUsedAfter(MachineInstr *MI, Register Reg) const;
 
   /// Return whether the given register is defined after MI.
-  bool isRegDefinedAfter(MachineInstr *MI, Register Reg) const;
+  LLVM_ABI bool isRegDefinedAfter(MachineInstr *MI, Register Reg) const;
 
   /// Provides the clearance - the number of instructions since the closest
   /// reaching def instuction of Reg that reaches MI.
-  int getClearance(MachineInstr *MI, Register Reg) const;
+  LLVM_ABI int getClearance(MachineInstr *MI, Register Reg) const;
 
   /// Provides the uses, in the same block as MI, of register that MI defines.
   /// This does not consider live-outs.
-  void getReachingLocalUses(MachineInstr *MI, Register Reg,
-                            InstSet &Uses) const;
+  LLVM_ABI void getReachingLocalUses(MachineInstr *MI, Register Reg,
+                                     InstSet &Uses) const;
 
   /// Search MBB for a definition of Reg and insert it into Defs. If no
   /// definition is found, recursively search the predecessor blocks for them.
-  void getLiveOuts(MachineBasicBlock *MBB, Register Reg, InstSet &Defs,
-                   BlockSet &VisitedBBs) const;
-  void getLiveOuts(MachineBasicBlock *MBB, Register Reg, InstSet &Defs) const;
+  LLVM_ABI void getLiveOuts(MachineBasicBlock *MBB, Register Reg, InstSet &Defs,
+                            BlockSet &VisitedBBs) const;
+  LLVM_ABI void getLiveOuts(MachineBasicBlock *MBB, Register Reg,
+                            InstSet &Defs) const;
 
   /// For the given block, collect the instructions that use the live-in
   /// value of the provided register. Return whether the value is still
   /// live on exit.
-  bool getLiveInUses(MachineBasicBlock *MBB, Register Reg, InstSet &Uses) const;
+  LLVM_ABI bool getLiveInUses(MachineBasicBlock *MBB, Register Reg,
+                              InstSet &Uses) const;
 
   /// Collect the users of the value stored in Reg, which is defined
   /// by MI.
-  void getGlobalUses(MachineInstr *MI, Register Reg, InstSet &Uses) const;
+  LLVM_ABI void getGlobalUses(MachineInstr *MI, Register Reg,
+                              InstSet &Uses) const;
 
   /// Collect all possible definitions of the value stored in Reg, which is
   /// used by MI.
-  void getGlobalReachingDefs(MachineInstr *MI, Register Reg,
-                             InstSet &Defs) const;
+  LLVM_ABI void getGlobalReachingDefs(MachineInstr *MI, Register Reg,
+                                      InstSet &Defs) const;
 
   /// Return whether From can be moved forwards to just before To.
-  bool isSafeToMoveForwards(MachineInstr *From, MachineInstr *To) const;
+  LLVM_ABI bool isSafeToMoveForwards(MachineInstr *From,
+                                     MachineInstr *To) const;
 
   /// Return whether From can be moved backwards to just after To.
-  bool isSafeToMoveBackwards(MachineInstr *From, MachineInstr *To) const;
+  LLVM_ABI bool isSafeToMoveBackwards(MachineInstr *From,
+                                      MachineInstr *To) const;
 
   /// Assuming MI is dead, recursively search the incoming operands which are
   /// killed by MI and collect those that would become dead.
-  void collectKilledOperands(MachineInstr *MI, InstSet &Dead) const;
+  LLVM_ABI void collectKilledOperands(MachineInstr *MI, InstSet &Dead) const;
 
   /// Return whether removing this instruction will have no effect on the
   /// program, returning the redundant use-def chain.
-  bool isSafeToRemove(MachineInstr *MI, InstSet &ToRemove) const;
+  LLVM_ABI bool isSafeToRemove(MachineInstr *MI, InstSet &ToRemove) const;
 
   /// Return whether removing this instruction will have no effect on the
   /// program, ignoring the possible effects on some instructions, returning
   /// the redundant use-def chain.
-  bool isSafeToRemove(MachineInstr *MI, InstSet &ToRemove,
-                      InstSet &Ignore) const;
+  LLVM_ABI bool isSafeToRemove(MachineInstr *MI, InstSet &ToRemove,
+                               InstSet &Ignore) const;
 
   /// Return whether a MachineInstr could be inserted at MI and safely define
   /// the given register without affecting the program.
-  bool isSafeToDefRegAt(MachineInstr *MI, Register Reg) const;
+  LLVM_ABI bool isSafeToDefRegAt(MachineInstr *MI, Register Reg) const;
 
   /// Return whether a MachineInstr could be inserted at MI and safely define
   /// the given register without affecting the program, ignoring any effects
   /// on the provided instructions.
-  bool isSafeToDefRegAt(MachineInstr *MI, Register Reg, InstSet &Ignore) const;
+  LLVM_ABI bool isSafeToDefRegAt(MachineInstr *MI, Register Reg,
+                                 InstSet &Ignore) const;
 
 private:
   /// Set up LiveRegs by merging predecessor live-out values.
@@ -321,7 +331,8 @@ class ReachingDefAnalysis : public AnalysisInfoMixin<ReachingDefAnalysis> {
 public:
   using Result = ReachingDefInfo;
 
-  Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI Result run(MachineFunction &MF,
+                      MachineFunctionAnalysisManager &MFAM);
 };
 
 /// Printer pass for the \c ReachingDefInfo results.
@@ -331,13 +342,13 @@ class ReachingDefPrinterPass : public PassInfoMixin<ReachingDefPrinterPass> {
 public:
   explicit ReachingDefPrinterPass(raw_ostream &OS) : OS(OS) {}
 
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   static bool isRequired() { return true; }
 };
 
-class ReachingDefInfoWrapperPass : public MachineFunctionPass {
+class LLVM_ABI ReachingDefInfoWrapperPass : public MachineFunctionPass {
   ReachingDefInfo RDI;
 
 public:
diff --git a/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h b/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h
index 1020c5f97dd31..c50a7598a5f04 100644
--- a/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h
+++ b/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h
@@ -119,23 +119,26 @@ class RegAllocEvictionAdvisor {
 
   /// Returns true if the given \p PhysReg is a callee saved register and has
   /// not been used for allocation yet.
-  bool isUnusedCalleeSavedReg(MCRegister PhysReg) const;
+  LLVM_ABI bool isUnusedCalleeSavedReg(MCRegister PhysReg) const;
 
 protected:
-  RegAllocEvictionAdvisor(const MachineFunction &MF, const RAGreedy &RA);
+  LLVM_ABI RegAllocEvictionAdvisor(const MachineFunction &MF,
+                                   const RAGreedy &RA);
 
-  bool canReassign(const LiveInterval &VirtReg, MCRegister FromReg) const;
+  LLVM_ABI bool canReassign(const LiveInterval &VirtReg,
+                            MCRegister FromReg) const;
 
   // Get the upper limit of elements in the given Order we need to analize.
   // TODO: is this heuristic,  we could consider learning it.
-  std::optional<unsigned> getOrderLimit(const LiveInterval &VirtReg,
-                                        const AllocationOrder &Order,
-                                        unsigned CostPerUseLimit) const;
+  LLVM_ABI std::optional<unsigned>
+  getOrderLimit(const LiveInterval &VirtReg, const AllocationOrder &Order,
+                unsigned CostPerUseLimit) const;
 
   // Determine if it's worth trying to allocate this reg, given the
   // CostPerUseLimit
   // TODO: this is a heuristic component we could consider learning, too.
-  bool canAllocatePhysReg(unsigned CostPerUseLimit, MCRegister PhysReg) const;
+  LLVM_ABI bool canAllocatePhysReg(unsigned CostPerUseLimit,
+                                   MCRegister PhysReg) const;
 
   const MachineFunction &MF;
   const RAGreedy &RA;
@@ -196,7 +199,7 @@ class RegAllocEvictionAdvisorProvider {
 ///
 /// Because we need to offer additional services in 'development' mode, the
 /// implementations of this analysis need to implement RTTI support.
-class RegAllocEvictionAdvisorAnalysisLegacy : public ImmutablePass {
+class LLVM_ABI RegAllocEvictionAdvisorAnalysisLegacy : public ImmutablePass {
 public:
   enum class AdvisorMode : int { Default, Release, Development };
 
@@ -252,7 +255,7 @@ class RegAllocEvictionAdvisorAnalysis
     }
   };
 
-  Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MAM);
+  LLVM_ABI Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MAM);
 
 private:
   void
@@ -264,22 +267,24 @@ class RegAllocEvictionAdvisorAnalysis
 
 /// Specialization for the API used by the analysis infrastructure to create
 /// an instance of the eviction advisor.
-template <> Pass *callDefaultCtor<RegAllocEvictionAdvisorAnalysisLegacy>();
+template <>
+LLVM_ABI Pass *callDefaultCtor<RegAllocEvictionAdvisorAnalysisLegacy>();
 
-RegAllocEvictionAdvisorAnalysisLegacy *createReleaseModeAdvisorAnalysisLegacy();
+LLVM_ABI RegAllocEvictionAdvisorAnalysisLegacy *
+createReleaseModeAdvisorAnalysisLegacy();
 
-RegAllocEvictionAdvisorAnalysisLegacy *
+LLVM_ABI RegAllocEvictionAdvisorAnalysisLegacy *
 createDevelopmentModeAdvisorAnalysisLegacy();
 
-LLVM_ATTRIBUTE_RETURNS_NONNULL RegAllocEvictionAdvisorProvider *
+LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ABI RegAllocEvictionAdvisorProvider *
 createReleaseModeAdvisorProvider(LLVMContext &Ctx);
 
-RegAllocEvictionAdvisorProvider *
+LLVM_ABI RegAllocEvictionAdvisorProvider *
 createDevelopmentModeAdvisorProvider(LLVMContext &Ctx);
 
 // TODO: move to RegAllocEvictionAdvisor.cpp when we move implementation
 // out of RegAllocGreedy.cpp
-class DefaultEvictionAdvisor : public RegAllocEvictionAdvisor {
+class LLVM_ABI DefaultEvictionAdvisor : public RegAllocEvictionAdvisor {
 public:
   DefaultEvictionAdvisor(const MachineFunction &MF, const RAGreedy &RA)
       : RegAllocEvictionAdvisor(MF, RA) {}
diff --git a/llvm/include/llvm/CodeGen/RegAllocFast.h b/llvm/include/llvm/CodeGen/RegAllocFast.h
index d3a13e22fc8b1..5d476a6d03e1f 100644
--- a/llvm/include/llvm/CodeGen/RegAllocFast.h
+++ b/llvm/include/llvm/CodeGen/RegAllocFast.h
@@ -11,6 +11,7 @@
 
 #include "llvm/CodeGen/MachinePassManager.h"
 #include "llvm/CodeGen/RegAllocCommon.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -43,10 +44,12 @@ class RegAllocFastPass : public PassInfoMixin<RegAllocFastPass> {
     return MachineFunctionProperties().setIsSSA();
   }
 
-  PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 
   static bool isRequired() { return true; }
 
diff --git a/llvm/include/llvm/CodeGen/RegAllocGreedyPass.h b/llvm/include/llvm/CodeGen/RegAllocGreedyPass.h
index 6b34ee3ff2543..3d4b1fe74110e 100644
--- a/llvm/include/llvm/CodeGen/RegAllocGreedyPass.h
+++ b/llvm/include/llvm/CodeGen/RegAllocGreedyPass.h
@@ -12,6 +12,7 @@
 #include "llvm/CodeGen/RegAllocCommon.h"
 #include "llvm/CodeGen/RegAllocFast.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 using namespace llvm;
 
@@ -25,7 +26,8 @@ class RAGreedyPass : public PassInfoMixin<RAGreedyPass> {
   };
 
   RAGreedyPass(Options Opts = Options()) : Opts(std::move(Opts)) {}
-  PreservedAnalyses run(MachineFunction &F, MachineFunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &F,
+                                 MachineFunctionAnalysisManager &AM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setNoPHIs();
@@ -35,7 +37,7 @@ class RAGreedyPass : public PassInfoMixin<RAGreedyPass> {
     return MachineFunctionProperties().setIsSSA();
   }
 
-  void
+  LLVM_ABI void
   printPipeline(raw_ostream &OS,
                 function_ref<StringRef(StringRef)> MapClassName2PassName) const;
   static bool isRequired() { return true; }
diff --git a/llvm/include/llvm/CodeGen/RegAllocPBQP.h b/llvm/include/llvm/CodeGen/RegAllocPBQP.h
index 625c40ed8f8d2..06622abb904eb 100644
--- a/llvm/include/llvm/CodeGen/RegAllocPBQP.h
+++ b/llvm/include/llvm/CodeGen/RegAllocPBQP.h
@@ -24,6 +24,7 @@
 #include "llvm/CodeGen/PBQP/Solution.h"
 #include "llvm/CodeGen/Register.h"
 #include "llvm/MC/MCRegister.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <algorithm>
 #include <cassert>
@@ -506,15 +507,15 @@ class PBQPRAGraph : public PBQP::Graph<RegAllocSolverImpl> {
   PBQPRAGraph(GraphMetadata Metadata) : BaseT(std::move(Metadata)) {}
 
   /// Dump this graph to dbgs().
-  void dump() const;
+  LLVM_ABI void dump() const;
 
   /// Dump this graph to an output stream.
   /// @param OS Output stream to print on.
-  void dump(raw_ostream &OS) const;
+  LLVM_ABI void dump(raw_ostream &OS) const;
 
   /// Print a representation of this graph in DOT format.
   /// @param OS Output stream to print on.
-  void printDot(raw_ostream &OS) const;
+  LLVM_ABI void printDot(raw_ostream &OS) const;
 };
 
 inline Solution solve(PBQPRAGraph& G) {
@@ -528,7 +529,7 @@ inline Solution solve(PBQPRAGraph& G) {
 } // end namespace PBQP
 
 /// Create a PBQP register allocator instance.
-FunctionPass *
+LLVM_ABI FunctionPass *
 createPBQPRegisterAllocator(char *customPassID = nullptr);
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/RegAllocPriorityAdvisor.h b/llvm/include/llvm/CodeGen/RegAllocPriorityAdvisor.h
index b0355795370d8..d07824ebee94b 100644
--- a/llvm/include/llvm/CodeGen/RegAllocPriorityAdvisor.h
+++ b/llvm/include/llvm/CodeGen/RegAllocPriorityAdvisor.h
@@ -14,6 +14,7 @@
 #include "llvm/CodeGen/SlotIndexes.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -33,8 +34,9 @@ class RegAllocPriorityAdvisor {
   /// prefers it.
   virtual unsigned getPriority(const LiveInterval &LI) const = 0;
 
-  RegAllocPriorityAdvisor(const MachineFunction &MF, const RAGreedy &RA,
-                          SlotIndexes *const Indexes);
+  LLVM_ABI RegAllocPriorityAdvisor(const MachineFunction &MF,
+                                   const RAGreedy &RA,
+                                   SlotIndexes *const Indexes);
 
 protected:
   const RAGreedy &RA;
@@ -48,7 +50,7 @@ class RegAllocPriorityAdvisor {
   const bool ReverseLocalAssignment;
 };
 
-class DefaultPriorityAdvisor : public RegAllocPriorityAdvisor {
+class LLVM_ABI DefaultPriorityAdvisor : public RegAllocPriorityAdvisor {
 public:
   DefaultPriorityAdvisor(const MachineFunction &MF, const RAGreedy &RA,
                          SlotIndexes *const Indexes)
@@ -60,7 +62,7 @@ class DefaultPriorityAdvisor : public RegAllocPriorityAdvisor {
 
 /// Stupid priority advisor which just enqueues in virtual register number
 /// order, for debug purposes only.
-class DummyPriorityAdvisor : public RegAllocPriorityAdvisor {
+class LLVM_ABI DummyPriorityAdvisor : public RegAllocPriorityAdvisor {
 public:
   DummyPriorityAdvisor(const MachineFunction &MF, const RAGreedy &RA,
                        SlotIndexes *const Indexes)
@@ -115,7 +117,8 @@ class RegAllocPriorityAdvisorAnalysis
     }
   };
 
-  Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI Result run(MachineFunction &MF,
+                      MachineFunctionAnalysisManager &MFAM);
 
 private:
   void initializeProvider(LLVMContext &Ctx);
@@ -124,7 +127,7 @@ class RegAllocPriorityAdvisorAnalysis
   std::unique_ptr<RegAllocPriorityAdvisorProvider> Provider;
 };
 
-class RegAllocPriorityAdvisorAnalysisLegacy : public ImmutablePass {
+class LLVM_ABI RegAllocPriorityAdvisorAnalysisLegacy : public ImmutablePass {
 public:
   using AdvisorMode = RegAllocPriorityAdvisorProvider::AdvisorMode;
   RegAllocPriorityAdvisorAnalysisLegacy(AdvisorMode Mode)
@@ -153,18 +156,19 @@ class RegAllocPriorityAdvisorAnalysisLegacy : public ImmutablePass {
 
 /// Specialization for the API used by the analysis infrastructure to create
 /// an instance of the priority advisor.
-template <> Pass *callDefaultCtor<RegAllocPriorityAdvisorAnalysisLegacy>();
+template <>
+LLVM_ABI Pass *callDefaultCtor<RegAllocPriorityAdvisorAnalysisLegacy>();
 
-RegAllocPriorityAdvisorAnalysisLegacy *
+LLVM_ABI RegAllocPriorityAdvisorAnalysisLegacy *
 createReleaseModePriorityAdvisorAnalysis();
 
-RegAllocPriorityAdvisorAnalysisLegacy *
+LLVM_ABI RegAllocPriorityAdvisorAnalysisLegacy *
 createDevelopmentModePriorityAdvisorAnalysis();
 
-LLVM_ATTRIBUTE_RETURNS_NONNULL RegAllocPriorityAdvisorProvider *
+LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ABI RegAllocPriorityAdvisorProvider *
 createReleaseModePriorityAdvisorProvider();
 
-LLVM_ATTRIBUTE_RETURNS_NONNULL RegAllocPriorityAdvisorProvider *
+LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ABI RegAllocPriorityAdvisorProvider *
 createDevelopmentModePriorityAdvisorProvider(LLVMContext &Ctx);
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/RegUsageInfoCollector.h b/llvm/include/llvm/CodeGen/RegUsageInfoCollector.h
index 6b88cc4f99089..711b8606aa2ff 100644
--- a/llvm/include/llvm/CodeGen/RegUsageInfoCollector.h
+++ b/llvm/include/llvm/CodeGen/RegUsageInfoCollector.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_REGUSAGEINFOCOLLECTOR_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class RegUsageInfoCollectorPass
     : public AnalysisInfoMixin<RegUsageInfoCollectorPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/RegUsageInfoPropagate.h b/llvm/include/llvm/CodeGen/RegUsageInfoPropagate.h
index 73624015e37d9..1cf9b982a7e03 100644
--- a/llvm/include/llvm/CodeGen/RegUsageInfoPropagate.h
+++ b/llvm/include/llvm/CodeGen/RegUsageInfoPropagate.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_REGUSAGEINFOPROPAGATE_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class RegUsageInfoPropagationPass
     : public PassInfoMixin<RegUsageInfoPropagationPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/RegisterBankInfo.h b/llvm/include/llvm/CodeGen/RegisterBankInfo.h
index a4f3052b5bca7..98131e1df1a04 100644
--- a/llvm/include/llvm/CodeGen/RegisterBankInfo.h
+++ b/llvm/include/llvm/CodeGen/RegisterBankInfo.h
@@ -21,6 +21,7 @@
 #include "llvm/CodeGen/Register.h"
 #include "llvm/CodeGen/RegisterBank.h"
 #include "llvm/CodeGenTypes/LowLevelType.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <cassert>
 #include <initializer_list>
@@ -37,7 +38,7 @@ class TargetRegisterClass;
 class TargetRegisterInfo;
 
 /// Holds all the information related to register banks.
-class RegisterBankInfo {
+class LLVM_ABI RegisterBankInfo {
 public:
   /// Helper struct that represents how a value is partially mapped
   /// into a register.
@@ -72,10 +73,10 @@ class RegisterBankInfo {
     unsigned getHighBitIdx() const { return StartIdx + Length - 1; }
 
     /// Print this partial mapping on dbgs() stream.
-    void dump() const;
+    LLVM_ABI void dump() const;
 
     /// Print this partial mapping on \p OS;
-    void print(raw_ostream &OS) const;
+    LLVM_ABI void print(raw_ostream &OS) const;
 
     /// Check that the Mask is compatible with the RegBank.
     /// Indeed, if the RegBank cannot accomadate the "active bits" of the mask,
@@ -84,7 +85,7 @@ class RegisterBankInfo {
     /// \note This method does not check anything when assertions are disabled.
     ///
     /// \return True is the check was successful.
-    bool verify(const RegisterBankInfo &RBI) const;
+    LLVM_ABI bool verify(const RegisterBankInfo &RBI) const;
   };
 
   /// Helper struct that represents how a value is mapped through
@@ -167,7 +168,7 @@ class RegisterBankInfo {
 
     /// \return true if all partial mappings are the same size and register
     /// bank.
-    bool partsAllUniform() const;
+    LLVM_ABI bool partsAllUniform() const;
 
     /// Check if this ValueMapping is valid.
     bool isValid() const { return BreakDown && NumBreakDowns; }
@@ -177,13 +178,14 @@ class RegisterBankInfo {
     /// \note This method does not check anything when assertions are disabled.
     ///
     /// \return True is the check was successful.
-    bool verify(const RegisterBankInfo &RBI, TypeSize MeaningfulBitWidth) const;
+    LLVM_ABI bool verify(const RegisterBankInfo &RBI,
+                         TypeSize MeaningfulBitWidth) const;
 
     /// Print this on dbgs() stream.
-    void dump() const;
+    LLVM_ABI void dump() const;
 
     /// Print this on \p OS;
-    void print(raw_ostream &OS) const;
+    LLVM_ABI void print(raw_ostream &OS) const;
   };
 
   /// Helper class that represents how the value of an instruction may be
@@ -262,13 +264,13 @@ class RegisterBankInfo {
     /// \note This method does not check anything when assertions are disabled.
     ///
     /// \return True is the check was successful.
-    bool verify(const MachineInstr &MI) const;
+    LLVM_ABI bool verify(const MachineInstr &MI) const;
 
     /// Print this on dbgs() stream.
-    void dump() const;
+    LLVM_ABI void dump() const;
 
     /// Print this on \p OS;
-    void print(raw_ostream &OS) const;
+    LLVM_ABI void print(raw_ostream &OS) const;
   };
 
   /// Convenient type to represent the alternatives for mapping an
@@ -321,8 +323,9 @@ class RegisterBankInfo {
     /// Create an OperandsMapper that will hold the information to apply \p
     /// InstrMapping to \p MI.
     /// \pre InstrMapping.verify(MI)
-    OperandsMapper(MachineInstr &MI, const InstructionMapping &InstrMapping,
-                   MachineRegisterInfo &MRI);
+    LLVM_ABI OperandsMapper(MachineInstr &MI,
+                            const InstructionMapping &InstrMapping,
+                            MachineRegisterInfo &MRI);
 
     /// \name Getters.
     /// @{
@@ -348,7 +351,7 @@ class RegisterBankInfo {
     ///
     /// \post All the partial mapping of the \p OpIdx-th operand have been
     /// assigned a new virtual register.
-    void createVRegs(unsigned OpIdx);
+    LLVM_ABI void createVRegs(unsigned OpIdx);
 
     /// Set the virtual register of the \p PartialMapIdx-th partial mapping of
     /// the OpIdx-th operand to \p NewVReg.
@@ -360,7 +363,8 @@ class RegisterBankInfo {
     ///
     /// \post the \p PartialMapIdx-th register of the value mapping of the \p
     /// OpIdx-th operand has been set.
-    void setVRegs(unsigned OpIdx, unsigned PartialMapIdx, Register NewVReg);
+    LLVM_ABI void setVRegs(unsigned OpIdx, unsigned PartialMapIdx,
+                           Register NewVReg);
 
     /// Get all the virtual registers required to map the \p OpIdx-th operand of
     /// the instruction.
@@ -374,14 +378,14 @@ class RegisterBankInfo {
     ///
     /// \pre getMI().getOperand(OpIdx).isReg()
     /// \pre ForDebug || All partial mappings have been set a register
-    iterator_range<SmallVectorImpl<Register>::const_iterator>
+    LLVM_ABI iterator_range<SmallVectorImpl<Register>::const_iterator>
     getVRegs(unsigned OpIdx, bool ForDebug = false) const;
 
     /// Print this operands mapper on dbgs() stream.
-    void dump() const;
+    LLVM_ABI void dump() const;
 
     /// Print this operands mapper on \p OS stream.
-    void print(raw_ostream &OS, bool ForDebug = false) const;
+    LLVM_ABI void print(raw_ostream &OS, bool ForDebug = false) const;
   };
 
 protected:
@@ -789,7 +793,8 @@ operator<<(raw_ostream &OS, const RegisterBankInfo::OperandsMapper &OpdMapper) {
 
 /// Hashing function for PartialMapping.
 /// It is required for the hashing of ValueMapping.
-hash_code hash_value(const RegisterBankInfo::PartialMapping &PartMapping);
+LLVM_ABI hash_code
+hash_value(const RegisterBankInfo::PartialMapping &PartMapping);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/RegisterCoalescerPass.h b/llvm/include/llvm/CodeGen/RegisterCoalescerPass.h
index 7211d1e79306e..64c058160e8c8 100644
--- a/llvm/include/llvm/CodeGen/RegisterCoalescerPass.h
+++ b/llvm/include/llvm/CodeGen/RegisterCoalescerPass.h
@@ -10,12 +10,13 @@
 #define LLVM_CODEGEN_REGISTER_COALESCERPASS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class RegisterCoalescerPass : public PassInfoMixin<RegisterCoalescerPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   MachineFunctionProperties getClearedProperties() const {
     return MachineFunctionProperties().setIsSSA();
diff --git a/llvm/include/llvm/CodeGen/RegisterScavenging.h b/llvm/include/llvm/CodeGen/RegisterScavenging.h
index d19ad277ef680..b3690dc57bf8f 100644
--- a/llvm/include/llvm/CodeGen/RegisterScavenging.h
+++ b/llvm/include/llvm/CodeGen/RegisterScavenging.h
@@ -23,6 +23,7 @@
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/MC/LaneBitmask.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -82,15 +83,15 @@ class RegScavenger {
   }
 
   /// Start tracking liveness from the begin of basic block \p MBB.
-  void enterBasicBlock(MachineBasicBlock &MBB);
+  LLVM_ABI void enterBasicBlock(MachineBasicBlock &MBB);
 
   /// Start tracking liveness from the end of basic block \p MBB.
   /// Use backward() to move towards the beginning of the block.
-  void enterBasicBlockEnd(MachineBasicBlock &MBB);
+  LLVM_ABI void enterBasicBlockEnd(MachineBasicBlock &MBB);
 
   /// Update internal register state and move MBB iterator backwards. This
   /// method gives precise results even in the absence of kill flags.
-  void backward();
+  LLVM_ABI void backward();
 
   /// Call backward() to update internal register state to just before \p *I.
   void backward(MachineBasicBlock::iterator I) {
@@ -99,14 +100,14 @@ class RegScavenger {
   }
 
   /// Return if a specific register is currently used.
-  bool isRegUsed(Register Reg, bool includeReserved = true) const;
+  LLVM_ABI bool isRegUsed(Register Reg, bool includeReserved = true) const;
 
   /// Return all available registers in the register class in Mask.
-  BitVector getRegsAvailable(const TargetRegisterClass *RC);
+  LLVM_ABI BitVector getRegsAvailable(const TargetRegisterClass *RC);
 
   /// Find an unused register of the specified register class.
   /// Return 0 if none is found.
-  Register FindUnusedReg(const TargetRegisterClass *RC) const;
+  LLVM_ABI Register FindUnusedReg(const TargetRegisterClass *RC) const;
 
   /// Add a scavenging frame index.
   void addScavengingFrameIndex(int FI) {
@@ -138,13 +139,14 @@ class RegScavenger {
   ///
   /// If \p AllowSpill is false, fail if a spill is required to make the
   /// register available, and return NoRegister.
-  Register scavengeRegisterBackwards(const TargetRegisterClass &RC,
-                                     MachineBasicBlock::iterator To,
-                                     bool RestoreAfter, int SPAdj,
-                                     bool AllowSpill = true);
+  LLVM_ABI Register scavengeRegisterBackwards(const TargetRegisterClass &RC,
+                                              MachineBasicBlock::iterator To,
+                                              bool RestoreAfter, int SPAdj,
+                                              bool AllowSpill = true);
 
   /// Tell the scavenger a register is used.
-  void setRegUsed(Register Reg, LaneBitmask LaneMask = LaneBitmask::getAll());
+  LLVM_ABI void setRegUsed(Register Reg,
+                           LaneBitmask LaneMask = LaneBitmask::getAll());
 
 private:
   /// Returns true if a register is reserved. It is never "unused".
@@ -162,7 +164,7 @@ class RegScavenger {
 
 /// Replaces all frame index virtual registers with physical registers. Uses the
 /// register scavenger to find an appropriate register to use.
-void scavengeFrameVirtualRegs(MachineFunction &MF, RegScavenger &RS);
+LLVM_ABI void scavengeFrameVirtualRegs(MachineFunction &MF, RegScavenger &RS);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/RegisterUsageInfo.h b/llvm/include/llvm/CodeGen/RegisterUsageInfo.h
index 9a1d9a4a47120..1ecb7a7675370 100644
--- a/llvm/include/llvm/CodeGen/RegisterUsageInfo.h
+++ b/llvm/include/llvm/CodeGen/RegisterUsageInfo.h
@@ -23,6 +23,7 @@
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
 #include "llvm/PassRegistry.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <vector>
 
@@ -34,24 +35,24 @@ class TargetMachine;
 class PhysicalRegisterUsageInfo {
 public:
   /// Set TargetMachine which is used to print analysis.
-  void setTargetMachine(const TargetMachine &TM);
+  LLVM_ABI void setTargetMachine(const TargetMachine &TM);
 
-  bool doInitialization(Module &M);
+  LLVM_ABI bool doInitialization(Module &M);
 
-  bool doFinalization(Module &M);
+  LLVM_ABI bool doFinalization(Module &M);
 
   /// To store RegMask for given Function *.
-  void storeUpdateRegUsageInfo(const Function &FP,
-                               ArrayRef<uint32_t> RegMask);
+  LLVM_ABI void storeUpdateRegUsageInfo(const Function &FP,
+                                        ArrayRef<uint32_t> RegMask);
 
   /// To query stored RegMask for given Function *, it will returns ane empty
   /// array if function is not known.
-  ArrayRef<uint32_t> getRegUsageInfo(const Function &FP);
+  LLVM_ABI ArrayRef<uint32_t> getRegUsageInfo(const Function &FP);
 
-  void print(raw_ostream &OS, const Module *M = nullptr) const;
+  LLVM_ABI void print(raw_ostream &OS, const Module *M = nullptr) const;
 
-  bool invalidate(Module &M, const PreservedAnalyses &PA,
-                  ModuleAnalysisManager::Invalidator &Inv);
+  LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
+                           ModuleAnalysisManager::Invalidator &Inv);
 
 private:
   /// A Dense map from Function * to RegMask.
@@ -66,7 +67,7 @@ class PhysicalRegisterUsageInfoWrapperLegacy : public ImmutablePass {
   std::unique_ptr<PhysicalRegisterUsageInfo> PRUI;
 
 public:
-  static char ID;
+  LLVM_ABI static char ID;
   PhysicalRegisterUsageInfoWrapperLegacy() : ImmutablePass(ID) {}
 
   PhysicalRegisterUsageInfo &getPRUI() { return *PRUI; }
@@ -92,7 +93,7 @@ class PhysicalRegisterUsageAnalysis
 public:
   using Result = PhysicalRegisterUsageInfo;
 
-  PhysicalRegisterUsageInfo run(Module &M, ModuleAnalysisManager &);
+  LLVM_ABI PhysicalRegisterUsageInfo run(Module &M, ModuleAnalysisManager &);
 };
 
 class PhysicalRegisterUsageInfoPrinterPass
@@ -101,7 +102,7 @@ class PhysicalRegisterUsageInfoPrinterPass
 
 public:
   explicit PhysicalRegisterUsageInfoPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/RemoveLoadsIntoFakeUses.h b/llvm/include/llvm/CodeGen/RemoveLoadsIntoFakeUses.h
index 70cd2fe0c3cc4..26f72df58f74a 100644
--- a/llvm/include/llvm/CodeGen/RemoveLoadsIntoFakeUses.h
+++ b/llvm/include/llvm/CodeGen/RemoveLoadsIntoFakeUses.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_REMOVELOADSINTOFAKEUSES_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class RemoveLoadsIntoFakeUsesPass
     : public PassInfoMixin<RemoveLoadsIntoFakeUsesPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setNoVRegs();
diff --git a/llvm/include/llvm/CodeGen/RemoveRedundantDebugValues.h b/llvm/include/llvm/CodeGen/RemoveRedundantDebugValues.h
index 7d6dfa9bb830d..c49140351d87f 100644
--- a/llvm/include/llvm/CodeGen/RemoveRedundantDebugValues.h
+++ b/llvm/include/llvm/CodeGen/RemoveRedundantDebugValues.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_REMOVEREDUNDANTDEBUGVALUES_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class RemoveRedundantDebugValuesPass
     : public PassInfoMixin<RemoveRedundantDebugValuesPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/RenameIndependentSubregs.h b/llvm/include/llvm/CodeGen/RenameIndependentSubregs.h
index 2f6afe6bea620..4d2f6d8ac561d 100644
--- a/llvm/include/llvm/CodeGen/RenameIndependentSubregs.h
+++ b/llvm/include/llvm/CodeGen/RenameIndependentSubregs.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_RENAME_INDEPENDENT_SUBREGS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class RenameIndependentSubregsPass
     : public PassInfoMixin<RenameIndependentSubregsPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/ResourcePriorityQueue.h b/llvm/include/llvm/CodeGen/ResourcePriorityQueue.h
index 0af4f4720212b..08f4d1ccfcd2f 100644
--- a/llvm/include/llvm/CodeGen/ResourcePriorityQueue.h
+++ b/llvm/include/llvm/CodeGen/ResourcePriorityQueue.h
@@ -17,6 +17,7 @@
 #define LLVM_CODEGEN_RESOURCEPRIORITYQUEUE_H
 
 #include "llvm/CodeGen/ScheduleDAG.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
   class DFAPacketizer;
@@ -31,10 +32,10 @@ namespace llvm {
     ResourcePriorityQueue *PQ;
     explicit resource_sort(ResourcePriorityQueue *pq) : PQ(pq) {}
 
-    bool operator()(const SUnit* LHS, const SUnit* RHS) const;
+    LLVM_ABI bool operator()(const SUnit *LHS, const SUnit *RHS) const;
   };
 
-  class ResourcePriorityQueue : public SchedulingPriorityQueue {
+  class LLVM_ABI ResourcePriorityQueue : public SchedulingPriorityQueue {
     /// SUnits - The SUnits for the current graph.
     std::vector<SUnit> *SUnits;
 
diff --git a/llvm/include/llvm/CodeGen/SDNodeInfo.h b/llvm/include/llvm/CodeGen/SDNodeInfo.h
index 07909f226630f..9833e95168e08 100644
--- a/llvm/include/llvm/CodeGen/SDNodeInfo.h
+++ b/llvm/include/llvm/CodeGen/SDNodeInfo.h
@@ -13,6 +13,7 @@
 #include "llvm/ADT/StringTable.h"
 #include "llvm/CodeGen/ISDOpcodes.h"
 #include "llvm/CodeGenTypes/MachineValueType.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -121,7 +122,7 @@ class SDNodeInfo final {
     return Names[getDesc(Opcode).NameOffset];
   }
 
-  void verifyNode(const SelectionDAG &DAG, const SDNode *N) const;
+  LLVM_ABI void verifyNode(const SelectionDAG &DAG, const SDNode *N) const;
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/SafeStack.h b/llvm/include/llvm/CodeGen/SafeStack.h
index 05ad40e6c68c5..5998cf6fb0492 100644
--- a/llvm/include/llvm/CodeGen/SafeStack.h
+++ b/llvm/include/llvm/CodeGen/SafeStack.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_SAFESTACK_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -20,7 +21,7 @@ class SafeStackPass : public PassInfoMixin<SafeStackPass> {
 
 public:
   explicit SafeStackPass(const TargetMachine &TM_) : TM(&TM_) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/SanitizerBinaryMetadata.h b/llvm/include/llvm/CodeGen/SanitizerBinaryMetadata.h
index 6cf2e11aa911e..35eaabe2b4ff4 100644
--- a/llvm/include/llvm/CodeGen/SanitizerBinaryMetadata.h
+++ b/llvm/include/llvm/CodeGen/SanitizerBinaryMetadata.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_SANITIZERBINARYMETADATA_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class MachineSanitizerBinaryMetadataPass
     : public PassInfoMixin<MachineSanitizerBinaryMetadataPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/ScheduleDFS.h b/llvm/include/llvm/CodeGen/ScheduleDFS.h
index 2e0a30cc56e3c..6c2930121addf 100644
--- a/llvm/include/llvm/CodeGen/ScheduleDFS.h
+++ b/llvm/include/llvm/CodeGen/ScheduleDFS.h
@@ -15,6 +15,7 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/CodeGen/ScheduleDAG.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <cstdint>
 #include <vector>
@@ -56,9 +57,9 @@ struct ILPValue {
     return RHS <= *this;
   }
 
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 
-  void dump() const;
+  LLVM_ABI void dump() const;
 };
 
 /// Compute the values of each DAG node for various metrics during DFS.
@@ -138,7 +139,7 @@ class SchedDFSResult {
   }
 
   /// Compute various metrics for the DAG with given roots.
-  void compute(ArrayRef<SUnit> SUnits);
+  LLVM_ABI void compute(ArrayRef<SUnit> SUnits);
 
   /// Get the number of instructions in the given subtree and its
   /// children.
@@ -183,10 +184,10 @@ class SchedDFSResult {
 
   /// Scheduler callback to update SubtreeConnectLevels when a tree is
   /// initially scheduled.
-  void scheduleTree(unsigned SubtreeID);
+  LLVM_ABI void scheduleTree(unsigned SubtreeID);
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const ILPValue &Val);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const ILPValue &Val);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/ScheduleHazardRecognizer.h b/llvm/include/llvm/CodeGen/ScheduleHazardRecognizer.h
index 9f1101b658d04..d7957de28bf50 100644
--- a/llvm/include/llvm/CodeGen/ScheduleHazardRecognizer.h
+++ b/llvm/include/llvm/CodeGen/ScheduleHazardRecognizer.h
@@ -14,6 +14,8 @@
 #ifndef LLVM_CODEGEN_SCHEDULEHAZARDRECOGNIZER_H
 #define LLVM_CODEGEN_SCHEDULEHAZARDRECOGNIZER_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 
 class MachineInstr;
@@ -22,7 +24,7 @@ class SUnit;
 /// HazardRecognizer - This determines whether or not an instruction can be
 /// issued this cycle, and whether or not a noop needs to be inserted to handle
 /// the hazard.
-class ScheduleHazardRecognizer {
+class LLVM_ABI ScheduleHazardRecognizer {
 protected:
   /// MaxLookAhead - Indicate the number of cycles in the scoreboard
   /// state. Important to restore the state after backtracking. Additionally,
diff --git a/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h b/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h
index 727cd9abf9272..71b2e24c064c3 100644
--- a/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h
+++ b/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h
@@ -17,6 +17,7 @@
 
 #include "llvm/CodeGen/ScheduleHazardRecognizer.h"
 #include "llvm/MC/MCInstrItineraries.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <cstddef>
 #include <cstring>
@@ -26,7 +27,7 @@ namespace llvm {
 class ScheduleDAG;
 class SUnit;
 
-class ScoreboardHazardRecognizer : public ScheduleHazardRecognizer {
+class LLVM_ABI ScoreboardHazardRecognizer : public ScheduleHazardRecognizer {
   // Scoreboard to track function unit usage. Scoreboard[0] is a
   // mask of the FUs in use in the cycle currently being
   // schedule. Scoreboard[1] is a mask for the next cycle. The
@@ -84,7 +85,7 @@ class ScoreboardHazardRecognizer : public ScheduleHazardRecognizer {
     }
 
     // Print the scoreboard.
-    void dump() const;
+    LLVM_ABI void dump() const;
   };
 
   // Support for tracing ScoreboardHazardRecognizer as a component within
diff --git a/llvm/include/llvm/CodeGen/SelectOptimize.h b/llvm/include/llvm/CodeGen/SelectOptimize.h
index 33f66bb16c4de..c0dae349d90ca 100644
--- a/llvm/include/llvm/CodeGen/SelectOptimize.h
+++ b/llvm/include/llvm/CodeGen/SelectOptimize.h
@@ -16,6 +16,7 @@
 #define LLVM_CODEGEN_SELECTOPTIMIZE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -26,7 +27,7 @@ class SelectOptimizePass : public PassInfoMixin<SelectOptimizePass> {
 
 public:
   explicit SelectOptimizePass(const TargetMachine &TM) : TM(&TM) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGISel.h b/llvm/include/llvm/CodeGen/SelectionDAGISel.h
index c94dc4241368e..0adc60145ea92 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGISel.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/MachinePassManager.h"
 #include "llvm/CodeGen/SelectionDAG.h"
 #include "llvm/IR/BasicBlock.h"
+#include "llvm/Support/Compiler.h"
 #include <memory>
 
 namespace llvm {
@@ -42,7 +43,7 @@ class ScheduleDAGSDNodes;
 
 /// SelectionDAGISel - This is the common base class used for SelectionDAG-based
 /// pattern-matching instruction selectors.
-class SelectionDAGISel {
+class LLVM_ABI SelectionDAGISel {
 public:
   TargetMachine &TM;
   const TargetLibraryInfo *LibInfo;
@@ -556,7 +557,7 @@ class SelectionDAGISel {
                     bool isMorphNodeTo);
 };
 
-class SelectionDAGISelLegacy : public MachineFunctionPass {
+class LLVM_ABI SelectionDAGISelLegacy : public MachineFunctionPass {
   std::unique_ptr<SelectionDAGISel> Selector;
 
 public:
@@ -577,8 +578,8 @@ class SelectionDAGISelPass : public PassInfoMixin<SelectionDAGISelPass> {
       : Selector(std::move(Selector)) {}
 
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 }
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h b/llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h
index 0b137a92fce19..2e6a064dc43dc 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/SDNodeInfo.h"
 #include "llvm/CodeGen/SelectionDAGNodes.h"
 #include "llvm/Support/CodeGen.h"
+#include "llvm/Support/Compiler.h"
 #include <utility>
 
 namespace llvm {
@@ -30,7 +31,7 @@ class SelectionDAG;
 /// Targets can subclass this to parameterize the
 /// SelectionDAG lowering and instruction selection process.
 ///
-class SelectionDAGTargetInfo {
+class LLVM_ABI SelectionDAGTargetInfo {
 public:
   explicit SelectionDAGTargetInfo() = default;
   SelectionDAGTargetInfo(const SelectionDAGTargetInfo &) = delete;
@@ -198,7 +199,7 @@ class SelectionDAGTargetInfo {
 
 /// Proxy class that targets should inherit from if they wish to use
 /// the generated node descriptions.
-class SelectionDAGGenTargetInfo : public SelectionDAGTargetInfo {
+class LLVM_ABI SelectionDAGGenTargetInfo : public SelectionDAGTargetInfo {
 protected:
   const SDNodeInfo &GenNodeInfo;
 
diff --git a/llvm/include/llvm/CodeGen/ShadowStackGCLowering.h b/llvm/include/llvm/CodeGen/ShadowStackGCLowering.h
index 1586c6cf545bf..7dbecf52472ca 100644
--- a/llvm/include/llvm/CodeGen/ShadowStackGCLowering.h
+++ b/llvm/include/llvm/CodeGen/ShadowStackGCLowering.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_SHADOWSTACKGCLOWERING_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class ShadowStackGCLoweringPass
     : public PassInfoMixin<ShadowStackGCLoweringPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/ShrinkWrap.h b/llvm/include/llvm/CodeGen/ShrinkWrap.h
index 805924be306e8..4d64fa91c13bb 100644
--- a/llvm/include/llvm/CodeGen/ShrinkWrap.h
+++ b/llvm/include/llvm/CodeGen/ShrinkWrap.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_SHRINKWRAP_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class ShrinkWrapPass : public PassInfoMixin<ShrinkWrapPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().setNoVRegs();
diff --git a/llvm/include/llvm/CodeGen/SjLjEHPrepare.h b/llvm/include/llvm/CodeGen/SjLjEHPrepare.h
index c1fd680ff8afa..29f260b682af7 100644
--- a/llvm/include/llvm/CodeGen/SjLjEHPrepare.h
+++ b/llvm/include/llvm/CodeGen/SjLjEHPrepare.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_SJLJEHPREPARE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -20,7 +21,7 @@ class SjLjEHPreparePass : public PassInfoMixin<SjLjEHPreparePass> {
 
 public:
   explicit SjLjEHPreparePass(const TargetMachine *TM) : TM(TM) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/SpillPlacement.h b/llvm/include/llvm/CodeGen/SpillPlacement.h
index 1ef37f2718a65..13c3414bebc7c 100644
--- a/llvm/include/llvm/CodeGen/SpillPlacement.h
+++ b/llvm/include/llvm/CodeGen/SpillPlacement.h
@@ -32,6 +32,7 @@
 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/Support/BlockFrequency.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -97,8 +98,8 @@ class SpillPlacement {
     /// the stack can be live-out on the stack without inserting a spill.
     bool ChangesValue;
 
-    void print(raw_ostream &OS) const;
-    void dump() const;
+    LLVM_ABI void print(raw_ostream &OS) const;
+    LLVM_ABI void dump() const;
   };
 
   /// prepare - Reset state and prepare for a new spill placement computation.
@@ -108,13 +109,13 @@ class SpillPlacement {
   ///                   variable should be kept in a register through the
   ///                   bundle. A clear bit means the variable should be
   ///                   spilled. This vector is retained.
-  void prepare(BitVector &RegBundles);
+  LLVM_ABI void prepare(BitVector &RegBundles);
 
   /// addConstraints - Add constraints and biases. This method may be called
   /// more than once to accumulate constraints.
   /// @param LiveBlocks Constraints for blocks that have the variable live in or
   ///                   live out.
-  void addConstraints(ArrayRef<BlockConstraint> LiveBlocks);
+  LLVM_ABI void addConstraints(ArrayRef<BlockConstraint> LiveBlocks);
 
   /// addPrefSpill - Add PrefSpill constraints to all blocks listed.  This is
   /// equivalent to calling addConstraint with identical BlockConstraints with
@@ -122,21 +123,21 @@ class SpillPlacement {
   ///
   /// @param Blocks Array of block numbers that prefer to spill in and out.
   /// @param Strong When true, double the negative bias for these blocks.
-  void addPrefSpill(ArrayRef<unsigned> Blocks, bool Strong);
+  LLVM_ABI void addPrefSpill(ArrayRef<unsigned> Blocks, bool Strong);
 
   /// addLinks - Add transparent blocks with the given numbers.
-  void addLinks(ArrayRef<unsigned> Links);
+  LLVM_ABI void addLinks(ArrayRef<unsigned> Links);
 
   /// scanActiveBundles - Perform an initial scan of all bundles activated by
   /// addConstraints and addLinks, updating their state. Add all the bundles
   /// that now prefer a register to RecentPositive.
   /// Prepare internal data structures for iterate.
   /// Return true is there are any positive nodes.
-  bool scanActiveBundles();
+  LLVM_ABI bool scanActiveBundles();
 
   /// iterate - Update the network iteratively until convergence, or new bundles
   /// are found.
-  void iterate();
+  LLVM_ABI void iterate();
 
   /// getRecentPositive - Return an array of bundles that became positive during
   /// the previous call to scanActiveBundles or iterate.
@@ -149,7 +150,7 @@ class SpillPlacement {
   /// The selected bundles are returned in the bitvector passed to prepare().
   /// @return True if a perfect solution was found, allowing the variable to be
   ///         in a register through all relevant bundles.
-  bool finish();
+  LLVM_ABI bool finish();
 
   /// getBlockFrequency - Return the estimated block execution frequency per
   /// function invocation.
@@ -157,16 +158,16 @@ class SpillPlacement {
     return BlockFrequencies[Number];
   }
 
-  bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA,
-                  MachineFunctionAnalysisManager::Invalidator &Inv);
+  LLVM_ABI bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA,
+                           MachineFunctionAnalysisManager::Invalidator &Inv);
 
-  SpillPlacement(SpillPlacement &&);
-  ~SpillPlacement();
+  LLVM_ABI SpillPlacement(SpillPlacement &&);
+  LLVM_ABI ~SpillPlacement();
 
 private:
   SpillPlacement();
 
-  void releaseMemory();
+  LLVM_ABI void releaseMemory();
 
   void run(MachineFunction &MF, EdgeBundles *Bundles,
            MachineBlockFrequencyInfo *MBFI);
@@ -176,7 +177,7 @@ class SpillPlacement {
   bool update(unsigned n);
 };
 
-class SpillPlacementWrapperLegacy : public MachineFunctionPass {
+class LLVM_ABI SpillPlacementWrapperLegacy : public MachineFunctionPass {
 public:
   static char ID;
   SpillPlacementWrapperLegacy() : MachineFunctionPass(ID) {}
@@ -198,7 +199,8 @@ class SpillPlacementAnalysis
 
 public:
   using Result = SpillPlacement;
-  SpillPlacement run(MachineFunction &, MachineFunctionAnalysisManager &);
+  LLVM_ABI SpillPlacement run(MachineFunction &,
+                              MachineFunctionAnalysisManager &);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/Spiller.h b/llvm/include/llvm/CodeGen/Spiller.h
index 4271bbe5612e8..26b27f08bf515 100644
--- a/llvm/include/llvm/CodeGen/Spiller.h
+++ b/llvm/include/llvm/CodeGen/Spiller.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/CodeGen/Register.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -30,7 +31,7 @@ class AllocationOrder;
 ///
 /// Implementations are utility classes which insert spill or remat code on
 /// demand.
-class Spiller {
+class LLVM_ABI Spiller {
   virtual void anchor();
 
 public:
@@ -58,10 +59,10 @@ class Spiller {
 
 /// Create and return a spiller that will insert spill code directly instead
 /// of deferring though VirtRegMap.
-Spiller *createInlineSpiller(const Spiller::RequiredAnalyses &Analyses,
-                             MachineFunction &MF, VirtRegMap &VRM,
-                             VirtRegAuxInfo &VRAI,
-                             LiveRegMatrix *Matrix = nullptr);
+LLVM_ABI Spiller *createInlineSpiller(const Spiller::RequiredAnalyses &Analyses,
+                                      MachineFunction &MF, VirtRegMap &VRM,
+                                      VirtRegAuxInfo &VRAI,
+                                      LiveRegMatrix *Matrix = nullptr);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/StackColoring.h b/llvm/include/llvm/CodeGen/StackColoring.h
index 65f8916f42a91..8fb2856243dc0 100644
--- a/llvm/include/llvm/CodeGen/StackColoring.h
+++ b/llvm/include/llvm/CodeGen/StackColoring.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_STACKCOLORINGPASS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class StackColoringPass : public PassInfoMixin<StackColoringPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/StackFrameLayoutAnalysisPass.h b/llvm/include/llvm/CodeGen/StackFrameLayoutAnalysisPass.h
index 5283cda30da12..aacd046c59419 100644
--- a/llvm/include/llvm/CodeGen/StackFrameLayoutAnalysisPass.h
+++ b/llvm/include/llvm/CodeGen/StackFrameLayoutAnalysisPass.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_STACKFRAMELAYOUTANALYSISPASS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class StackFrameLayoutAnalysisPass
     : public PassInfoMixin<StackFrameLayoutAnalysisPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/CodeGen/StackProtector.h b/llvm/include/llvm/CodeGen/StackProtector.h
index fbe79353b9c33..e456a428b7e3f 100644
--- a/llvm/include/llvm/CodeGen/StackProtector.h
+++ b/llvm/include/llvm/CodeGen/StackProtector.h
@@ -21,6 +21,7 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/TargetParser/Triple.h"
 
 namespace llvm {
@@ -60,9 +61,9 @@ class SSPLayoutInfo {
 
 public:
   // Return true if StackProtector is supposed to be handled by SelectionDAG.
-  bool shouldEmitSDCheck(const BasicBlock &BB) const;
+  LLVM_ABI bool shouldEmitSDCheck(const BasicBlock &BB) const;
 
-  void copyToMachineFrameInfo(MachineFrameInfo &MFI) const;
+  LLVM_ABI void copyToMachineFrameInfo(MachineFrameInfo &MFI) const;
 };
 
 class SSPLayoutAnalysis : public AnalysisInfoMixin<SSPLayoutAnalysis> {
@@ -74,12 +75,12 @@ class SSPLayoutAnalysis : public AnalysisInfoMixin<SSPLayoutAnalysis> {
 public:
   using Result = SSPLayoutInfo;
 
-  Result run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI Result run(Function &F, FunctionAnalysisManager &FAM);
 
   /// Check whether or not \p F needs a stack protector based upon the stack
   /// protector level.
-  static bool requiresStackProtector(Function *F,
-                                     SSPLayoutMap *Layout = nullptr);
+  LLVM_ABI static bool requiresStackProtector(Function *F,
+                                              SSPLayoutMap *Layout = nullptr);
 };
 
 class StackProtectorPass : public PassInfoMixin<StackProtectorPass> {
@@ -87,10 +88,10 @@ class StackProtectorPass : public PassInfoMixin<StackProtectorPass> {
 
 public:
   explicit StackProtectorPass(const TargetMachine &TM) : TM(&TM) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
-class StackProtector : public FunctionPass {
+class LLVM_ABI StackProtector : public FunctionPass {
 private:
   /// A mapping of AllocaInsts to their required SSP layout.
   using SSPLayoutMap = SSPLayoutInfo::SSPLayoutMap;
diff --git a/llvm/include/llvm/CodeGen/StackSlotColoring.h b/llvm/include/llvm/CodeGen/StackSlotColoring.h
index 8db59a339280d..709dac5ce9a1a 100644
--- a/llvm/include/llvm/CodeGen/StackSlotColoring.h
+++ b/llvm/include/llvm/CodeGen/StackSlotColoring.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_STACKSLOTCOLORING_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class StackSlotColoringPass : public PassInfoMixin<StackSlotColoringPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/SwiftErrorValueTracking.h b/llvm/include/llvm/CodeGen/SwiftErrorValueTracking.h
index a374736347f6d..f7af013761612 100644
--- a/llvm/include/llvm/CodeGen/SwiftErrorValueTracking.h
+++ b/llvm/include/llvm/CodeGen/SwiftErrorValueTracking.h
@@ -20,9 +20,9 @@
 #include "llvm/CodeGen/Register.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/DebugLoc.h"
+#include "llvm/Support/Compiler.h"
 #include <utility>
 
-
 namespace llvm {
   class Function;
   class MachineBasicBlock;
@@ -65,7 +65,7 @@ class SwiftErrorValueTracking {
 
 public:
   /// Initialize data structures for specified new function.
-  void setFunction(MachineFunction &MF);
+  LLVM_ABI void setFunction(MachineFunction &MF);
 
   /// Get the (unique) function argument that was marked swifterror, or nullptr
   /// if this function has no swifterror args.
@@ -75,32 +75,36 @@ class SwiftErrorValueTracking {
 
   /// Get or create the swifterror value virtual register in
   /// VRegDefMap for this basic block.
-  Register getOrCreateVReg(const MachineBasicBlock *, const Value *);
+  LLVM_ABI Register getOrCreateVReg(const MachineBasicBlock *, const Value *);
 
   /// Set the swifterror virtual register in the VRegDefMap for this
   /// basic block.
-  void setCurrentVReg(const MachineBasicBlock *MBB, const Value *, Register);
+  LLVM_ABI void setCurrentVReg(const MachineBasicBlock *MBB, const Value *,
+                               Register);
 
   /// Get or create the swifterror value virtual register for a def of a
   /// swifterror by an instruction.
-  Register getOrCreateVRegDefAt(const Instruction *, const MachineBasicBlock *,
-                                const Value *);
+  LLVM_ABI Register getOrCreateVRegDefAt(const Instruction *,
+                                         const MachineBasicBlock *,
+                                         const Value *);
 
   /// Get or create the swifterror value virtual register for a use of a
   /// swifterror by an instruction.
-  Register getOrCreateVRegUseAt(const Instruction *, const MachineBasicBlock *,
-                                const Value *);
+  LLVM_ABI Register getOrCreateVRegUseAt(const Instruction *,
+                                         const MachineBasicBlock *,
+                                         const Value *);
 
   /// Create initial definitions of swifterror values in the entry block of the
   /// current function.
-  bool createEntriesInEntryBlock(DebugLoc DbgLoc);
+  LLVM_ABI bool createEntriesInEntryBlock(DebugLoc DbgLoc);
 
   /// Propagate assigned swifterror vregs through a function, synthesizing PHI
   /// nodes when needed to maintain consistency.
-  void propagateVRegs();
+  LLVM_ABI void propagateVRegs();
 
-  void preassignVRegs(MachineBasicBlock *MBB, BasicBlock::const_iterator Begin,
-                      BasicBlock::const_iterator End);
+  LLVM_ABI void preassignVRegs(MachineBasicBlock *MBB,
+                               BasicBlock::const_iterator Begin,
+                               BasicBlock::const_iterator End);
 };
 
 }
diff --git a/llvm/include/llvm/CodeGen/SwitchLoweringUtils.h b/llvm/include/llvm/CodeGen/SwitchLoweringUtils.h
index 9f1d6f7b4f952..0f6d13317ef3c 100644
--- a/llvm/include/llvm/CodeGen/SwitchLoweringUtils.h
+++ b/llvm/include/llvm/CodeGen/SwitchLoweringUtils.h
@@ -14,6 +14,7 @@
 #include "llvm/CodeGen/SelectionDAGNodes.h"
 #include "llvm/IR/InstrTypes.h"
 #include "llvm/Support/BranchProbability.h"
+#include "llvm/Support/Compiler.h"
 #include <vector>
 
 namespace llvm {
@@ -87,7 +88,7 @@ using CaseClusterVector = std::vector<CaseCluster>;
 using CaseClusterIt = CaseClusterVector::iterator;
 
 /// Sort Clusters and merge adjacent cases.
-void sortAndRangeify(CaseClusterVector &Clusters);
+LLVM_ABI void sortAndRangeify(CaseClusterVector &Clusters);
 
 struct CaseBits {
   uint64_t Mask = 0;
@@ -238,12 +239,12 @@ struct BitTestBlock {
 };
 
 /// Return the range of values within a range.
-uint64_t getJumpTableRange(const CaseClusterVector &Clusters, unsigned First,
-                           unsigned Last);
+LLVM_ABI uint64_t getJumpTableRange(const CaseClusterVector &Clusters,
+                                    unsigned First, unsigned Last);
 
 /// Return the number of cases within a range.
-uint64_t getJumpTableNumCases(const SmallVectorImpl<unsigned> &TotalCases,
-                              unsigned First, unsigned Last);
+LLVM_ABI uint64_t getJumpTableNumCases(
+    const SmallVectorImpl<unsigned> &TotalCases, unsigned First, unsigned Last);
 
 struct SwitchWorkListItem {
   MachineBasicBlock *MBB = nullptr;
@@ -278,21 +279,27 @@ class SwitchLowering {
   /// generation information.
   std::vector<BitTestBlock> BitTestCases;
 
-  void findJumpTables(CaseClusterVector &Clusters, const SwitchInst *SI,
-                      std::optional<SDLoc> SL, MachineBasicBlock *DefaultMBB,
-                      ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI);
+  LLVM_ABI void findJumpTables(CaseClusterVector &Clusters,
+                               const SwitchInst *SI, std::optional<SDLoc> SL,
+                               MachineBasicBlock *DefaultMBB,
+                               ProfileSummaryInfo *PSI,
+                               BlockFrequencyInfo *BFI);
 
-  bool buildJumpTable(const CaseClusterVector &Clusters, unsigned First,
-                      unsigned Last, const SwitchInst *SI,
-                      const std::optional<SDLoc> &SL,
-                      MachineBasicBlock *DefaultMBB, CaseCluster &JTCluster);
+  LLVM_ABI bool buildJumpTable(const CaseClusterVector &Clusters,
+                               unsigned First, unsigned Last,
+                               const SwitchInst *SI,
+                               const std::optional<SDLoc> &SL,
+                               MachineBasicBlock *DefaultMBB,
+                               CaseCluster &JTCluster);
 
-  void findBitTestClusters(CaseClusterVector &Clusters, const SwitchInst *SI);
+  LLVM_ABI void findBitTestClusters(CaseClusterVector &Clusters,
+                                    const SwitchInst *SI);
 
   /// Build a bit test cluster from Clusters[First..Last]. Returns false if it
   /// decides it's not a good idea.
-  bool buildBitTests(CaseClusterVector &Clusters, unsigned First, unsigned Last,
-                     const SwitchInst *SI, CaseCluster &BTCluster);
+  LLVM_ABI bool buildBitTests(CaseClusterVector &Clusters, unsigned First,
+                              unsigned Last, const SwitchInst *SI,
+                              CaseCluster &BTCluster);
 
   virtual void addSuccessorWithProb(
       MachineBasicBlock *Src, MachineBasicBlock *Dst,
@@ -300,8 +307,8 @@ class SwitchLowering {
 
   /// Determine the rank by weight of CC in [First,Last]. If CC has more weight
   /// than each cluster in the range, its rank is 0.
-  unsigned caseClusterRank(const CaseCluster &CC, CaseClusterIt First,
-                           CaseClusterIt Last);
+  LLVM_ABI unsigned caseClusterRank(const CaseCluster &CC, CaseClusterIt First,
+                                    CaseClusterIt Last);
 
   struct SplitWorkItemInfo {
     CaseClusterIt LastLeft;
@@ -313,7 +320,8 @@ class SwitchLowering {
   /// create a near-optimal (in terms of search time given key frequency) binary
   /// search tree. See e.g. Kurt Mehlhorn "Nearly Optimal Binary Search Trees"
   /// (1975).
-  SplitWorkItemInfo computeSplitWorkItemInfo(const SwitchWorkListItem &W);
+  LLVM_ABI SplitWorkItemInfo
+  computeSplitWorkItemInfo(const SwitchWorkListItem &W);
   virtual ~SwitchLowering() = default;
 
 private:
diff --git a/llvm/include/llvm/CodeGen/TailDuplicator.h b/llvm/include/llvm/CodeGen/TailDuplicator.h
index 8b1f67c416c22..2e65a7e61f0b1 100644
--- a/llvm/include/llvm/CodeGen/TailDuplicator.h
+++ b/llvm/include/llvm/CodeGen/TailDuplicator.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/CodeGen/TargetInstrInfo.h"
+#include "llvm/Support/Compiler.h"
 #include <utility>
 #include <vector>
 
@@ -67,18 +68,18 @@ class TailDuplicator {
   ///     decisions.
   /// @param TailDupSize - Maxmimum size of blocks to tail-duplicate. Zero
   ///     default implies using the command line value TailDupSize.
-  void initMF(MachineFunction &MF, bool PreRegAlloc,
-              const MachineBranchProbabilityInfo *MBPI,
-              MBFIWrapper *MBFI,
-              ProfileSummaryInfo *PSI,
-              bool LayoutMode, unsigned TailDupSize = 0);
+  LLVM_ABI void initMF(MachineFunction &MF, bool PreRegAlloc,
+                       const MachineBranchProbabilityInfo *MBPI,
+                       MBFIWrapper *MBFI, ProfileSummaryInfo *PSI,
+                       bool LayoutMode, unsigned TailDupSize = 0);
 
-  bool tailDuplicateBlocks();
-  static bool isSimpleBB(MachineBasicBlock *TailBB);
-  bool shouldTailDuplicate(bool IsSimple, MachineBasicBlock &TailBB);
+  LLVM_ABI bool tailDuplicateBlocks();
+  LLVM_ABI static bool isSimpleBB(MachineBasicBlock *TailBB);
+  LLVM_ABI bool shouldTailDuplicate(bool IsSimple, MachineBasicBlock &TailBB);
 
   /// Returns true if TailBB can successfully be duplicated into PredBB
-  bool canTailDuplicate(MachineBasicBlock *TailBB, MachineBasicBlock *PredBB);
+  LLVM_ABI bool canTailDuplicate(MachineBasicBlock *TailBB,
+                                 MachineBasicBlock *PredBB);
 
   /// Tail duplicate a single basic block into its predecessors, and then clean
   /// up.
@@ -87,10 +88,10 @@ class TailDuplicator {
   /// If \p RemovalCallback is non-null. It will be called before MBB is
   /// deleted.
   /// If \p CandidatePtr is not null, duplicate into these blocks only.
-  bool tailDuplicateAndUpdate(
+  LLVM_ABI bool tailDuplicateAndUpdate(
       bool IsSimple, MachineBasicBlock *MBB,
       MachineBasicBlock *ForcedLayoutPred,
-      SmallVectorImpl<MachineBasicBlock*> *DuplicatedPreds = nullptr,
+      SmallVectorImpl<MachineBasicBlock *> *DuplicatedPreds = nullptr,
       function_ref<void(MachineBasicBlock *)> *RemovalCallback = nullptr,
       SmallVectorImpl<MachineBasicBlock *> *CandidatePtr = nullptr);
 
diff --git a/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
index 9f271dd502b24..4b15e5610897d 100644
--- a/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
+++ b/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/BinaryFormat/XCOFF.h"
 #include "llvm/MC/MCExpr.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 
 namespace llvm {
@@ -31,7 +32,7 @@ class MCSymbol;
 class Module;
 class TargetMachine;
 
-class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
+class LLVM_ABI TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
   bool UseInitArray = false;
   mutable unsigned NextUniqueID = 1;  // ID 0 is reserved for execute-only sections
   SmallPtrSet<GlobalObject *, 2> Used;
@@ -130,7 +131,7 @@ class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
   MCSection *getSectionForCommandLines() const override;
 };
 
-class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
+class LLVM_ABI TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
 public:
   TargetLoweringObjectFileMachO();
   ~TargetLoweringObjectFileMachO() override = default;
@@ -180,7 +181,7 @@ class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
   MCSection *getSectionForCommandLines() const override;
 };
 
-class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
+class LLVM_ABI TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
   mutable unsigned NextUniqueID = 0;
   const TargetMachine *TM = nullptr;
 
@@ -225,7 +226,7 @@ class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
                                    Align &Alignment) const override;
 };
 
-class TargetLoweringObjectFileWasm : public TargetLoweringObjectFile {
+class LLVM_ABI TargetLoweringObjectFileWasm : public TargetLoweringObjectFile {
   mutable unsigned NextUniqueID = 0;
   SmallPtrSet<GlobalObject *, 2> Used;
 
@@ -251,7 +252,7 @@ class TargetLoweringObjectFileWasm : public TargetLoweringObjectFile {
                                   const MCSymbol *KeySym) const override;
 };
 
-class TargetLoweringObjectFileXCOFF : public TargetLoweringObjectFile {
+class LLVM_ABI TargetLoweringObjectFileXCOFF : public TargetLoweringObjectFile {
 public:
   TargetLoweringObjectFileXCOFF() = default;
   ~TargetLoweringObjectFileXCOFF() override = default;
@@ -315,7 +316,7 @@ class TargetLoweringObjectFileXCOFF : public TargetLoweringObjectFile {
                                const TargetMachine &TM) const override;
 };
 
-class TargetLoweringObjectFileGOFF : public TargetLoweringObjectFile {
+class LLVM_ABI TargetLoweringObjectFileGOFF : public TargetLoweringObjectFile {
   std::string DefaultRootSDName;
   std::string DefaultADAPRName;
 
diff --git a/llvm/include/llvm/CodeGen/TwoAddressInstructionPass.h b/llvm/include/llvm/CodeGen/TwoAddressInstructionPass.h
index a51c7c99d9bb3..dce4ec3ede5a3 100644
--- a/llvm/include/llvm/CodeGen/TwoAddressInstructionPass.h
+++ b/llvm/include/llvm/CodeGen/TwoAddressInstructionPass.h
@@ -10,14 +10,15 @@
 #define LLVM_CODEGEN_TWOADDRESSINSTRUCTIONPASS_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class TwoAddressInstructionPass
     : public PassInfoMixin<TwoAddressInstructionPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   MachineFunctionProperties getSetProperties() const {
     return MachineFunctionProperties().setTiedOpsRewritten();
   }
diff --git a/llvm/include/llvm/CodeGen/TypePromotion.h b/llvm/include/llvm/CodeGen/TypePromotion.h
index ba32a21066257..bd2e465e960eb 100644
--- a/llvm/include/llvm/CodeGen/TypePromotion.h
+++ b/llvm/include/llvm/CodeGen/TypePromotion.h
@@ -15,6 +15,7 @@
 #define LLVM_CODEGEN_TYPEPROMOTION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,7 +28,7 @@ class TypePromotionPass : public PassInfoMixin<TypePromotionPass> {
 
 public:
   TypePromotionPass(const TargetMachine &TM) : TM(&TM) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/UnreachableBlockElim.h b/llvm/include/llvm/CodeGen/UnreachableBlockElim.h
index 3c2b701512df6..b044bab677558 100644
--- a/llvm/include/llvm/CodeGen/UnreachableBlockElim.h
+++ b/llvm/include/llvm/CodeGen/UnreachableBlockElim.h
@@ -24,19 +24,21 @@
 
 #include "llvm/CodeGen/MachinePassManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class UnreachableBlockElimPass
     : public PassInfoMixin<UnreachableBlockElimPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 class UnreachableMachineBlockElimPass
     : public PassInfoMixin<UnreachableMachineBlockElimPass> {
 public:
-  PreservedAnalyses run(MachineFunction &F, MachineFunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &F,
+                                 MachineFunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/CodeGen/VLIWMachineScheduler.h b/llvm/include/llvm/CodeGen/VLIWMachineScheduler.h
index 65ff1ebe9bd8a..4f610fdffdfde 100644
--- a/llvm/include/llvm/CodeGen/VLIWMachineScheduler.h
+++ b/llvm/include/llvm/CodeGen/VLIWMachineScheduler.h
@@ -15,6 +15,7 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/CodeGen/MachineScheduler.h"
 #include "llvm/CodeGen/TargetSchedule.h"
+#include "llvm/Support/Compiler.h"
 #include <limits>
 #include <memory>
 #include <utility>
@@ -28,7 +29,7 @@ class SUnit;
 class TargetInstrInfo;
 class TargetSubtargetInfo;
 
-class VLIWResourceModel {
+class LLVM_ABI VLIWResourceModel {
 protected:
   const TargetInstrInfo *TII;
 
@@ -67,7 +68,7 @@ class VLIWResourceModel {
 
 /// Extend the standard ScheduleDAGMILive to provide more context and override
 /// the top-level schedule() driver.
-class VLIWMachineScheduler : public ScheduleDAGMILive {
+class LLVM_ABI VLIWMachineScheduler : public ScheduleDAGMILive {
 public:
   VLIWMachineScheduler(MachineSchedContext *C,
                        std::unique_ptr<MachineSchedStrategy> S)
@@ -86,7 +87,7 @@ class VLIWMachineScheduler : public ScheduleDAGMILive {
 // MachineSchedStrategy.
 //===----------------------------------------------------------------------===//
 
-class ConvergingVLIWScheduler : public MachineSchedStrategy {
+class LLVM_ABI ConvergingVLIWScheduler : public MachineSchedStrategy {
 protected:
   /// Store the state used by ConvergingVLIWScheduler heuristics, required
   ///  for the lifetime of one invocation of pickNode().
@@ -151,7 +152,7 @@ class ConvergingVLIWScheduler : public MachineSchedStrategy {
         : Available(ID, Name + ".A"),
           Pending(ID << ConvergingVLIWScheduler::LogMaxQID, Name + ".P") {}
 
-    ~VLIWSchedBoundary();
+    LLVM_ABI ~VLIWSchedBoundary();
     VLIWSchedBoundary &operator=(const VLIWSchedBoundary &other) = delete;
     VLIWSchedBoundary(const VLIWSchedBoundary &other) = delete;
 
@@ -186,19 +187,19 @@ class ConvergingVLIWScheduler : public MachineSchedStrategy {
       return Available.getID() == ConvergingVLIWScheduler::TopQID;
     }
 
-    bool checkHazard(SUnit *SU);
+    LLVM_ABI bool checkHazard(SUnit *SU);
 
-    void releaseNode(SUnit *SU, unsigned ReadyCycle);
+    LLVM_ABI void releaseNode(SUnit *SU, unsigned ReadyCycle);
 
-    void bumpCycle();
+    LLVM_ABI void bumpCycle();
 
-    void bumpNode(SUnit *SU);
+    LLVM_ABI void bumpNode(SUnit *SU);
 
-    void releasePending();
+    LLVM_ABI void releasePending();
 
-    void removeReady(SUnit *SU);
+    LLVM_ABI void removeReady(SUnit *SU);
 
-    SUnit *pickOnlyChoice();
+    LLVM_ABI SUnit *pickOnlyChoice();
 
     bool isLatencyBound(SUnit *SU) {
       if (CurrCycle >= CriticalPathLength)
diff --git a/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h b/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
index ab6b897e9f999..6432479f4688c 100644
--- a/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
+++ b/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
@@ -16,6 +16,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -85,7 +86,7 @@ struct WasmEHFuncInfo {
 };
 
 // Analyze the IR in the given function to build WasmEHFuncInfo.
-void calculateWasmEHInfo(const Function *F, WasmEHFuncInfo &EHInfo);
+LLVM_ABI void calculateWasmEHInfo(const Function *F, WasmEHFuncInfo &EHInfo);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/WasmEHPrepare.h b/llvm/include/llvm/CodeGen/WasmEHPrepare.h
index 8b3c07573a0d3..c42da82ff0e3d 100644
--- a/llvm/include/llvm/CodeGen/WasmEHPrepare.h
+++ b/llvm/include/llvm/CodeGen/WasmEHPrepare.h
@@ -10,12 +10,13 @@
 #define LLVM_CODEGEN_WASMEHPREPARE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class WasmEHPreparePass : public PassInfoMixin<WasmEHPreparePass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/WinEHFuncInfo.h b/llvm/include/llvm/CodeGen/WinEHFuncInfo.h
index c007d462e0709..884103c84a15f 100644
--- a/llvm/include/llvm/CodeGen/WinEHFuncInfo.h
+++ b/llvm/include/llvm/CodeGen/WinEHFuncInfo.h
@@ -16,6 +16,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <limits>
 #include <utility>
@@ -102,35 +103,37 @@ struct WinEHFuncInfo {
 
   int getLastStateNumber() const { return CxxUnwindMap.size() - 1; }
 
-  void addIPToStateRange(const InvokeInst *II, MCSymbol *InvokeBegin,
-                         MCSymbol *InvokeEnd);
+  LLVM_ABI void addIPToStateRange(const InvokeInst *II, MCSymbol *InvokeBegin,
+                                  MCSymbol *InvokeEnd);
 
-  void addIPToStateRange(int State, MCSymbol *InvokeBegin, MCSymbol *InvokeEnd);
+  LLVM_ABI void addIPToStateRange(int State, MCSymbol *InvokeBegin,
+                                  MCSymbol *InvokeEnd);
 
   int EHRegNodeFrameIndex = std::numeric_limits<int>::max();
   int EHRegNodeEndOffset = std::numeric_limits<int>::max();
   int EHGuardFrameIndex = std::numeric_limits<int>::max();
   int SEHSetFrameOffset = std::numeric_limits<int>::max();
 
-  WinEHFuncInfo();
+  LLVM_ABI WinEHFuncInfo();
 };
 
 /// Analyze the IR in ParentFn and it's handlers to build WinEHFuncInfo, which
 /// describes the state numbers and tables used by __CxxFrameHandler3. This
 /// analysis assumes that WinEHPrepare has already been run.
-void calculateWinCXXEHStateNumbers(const Function *ParentFn,
-                                   WinEHFuncInfo &FuncInfo);
+LLVM_ABI void calculateWinCXXEHStateNumbers(const Function *ParentFn,
+                                            WinEHFuncInfo &FuncInfo);
 
-void calculateSEHStateNumbers(const Function *ParentFn,
-                              WinEHFuncInfo &FuncInfo);
+LLVM_ABI void calculateSEHStateNumbers(const Function *ParentFn,
+                                       WinEHFuncInfo &FuncInfo);
 
-void calculateClrEHStateNumbers(const Function *Fn, WinEHFuncInfo &FuncInfo);
+LLVM_ABI void calculateClrEHStateNumbers(const Function *Fn,
+                                         WinEHFuncInfo &FuncInfo);
 
 // For AsynchEH (VC++ option -EHa)
-void calculateCXXStateForAsynchEH(const BasicBlock *BB, int State,
-                                  WinEHFuncInfo &FuncInfo);
-void calculateSEHStateForAsynchEH(const BasicBlock *BB, int State,
-                                  WinEHFuncInfo &FuncInfo);
+LLVM_ABI void calculateCXXStateForAsynchEH(const BasicBlock *BB, int State,
+                                           WinEHFuncInfo &FuncInfo);
+LLVM_ABI void calculateSEHStateForAsynchEH(const BasicBlock *BB, int State,
+                                           WinEHFuncInfo &FuncInfo);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/CodeGen/WinEHPrepare.h b/llvm/include/llvm/CodeGen/WinEHPrepare.h
index 0a47934d6126b..856d3076d341a 100644
--- a/llvm/include/llvm/CodeGen/WinEHPrepare.h
+++ b/llvm/include/llvm/CodeGen/WinEHPrepare.h
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_WINEHPREPARE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -19,7 +20,7 @@ class WinEHPreparePass : public PassInfoMixin<WinEHPreparePass> {
 public:
   WinEHPreparePass(bool DemoteCatchSwitchPHIOnly_ = false)
       : DemoteCatchSwitchPHIOnly(DemoteCatchSwitchPHIOnly_) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/WindowScheduler.h b/llvm/include/llvm/CodeGen/WindowScheduler.h
index 97776de353e3f..477d0dd133ff4 100644
--- a/llvm/include/llvm/CodeGen/WindowScheduler.h
+++ b/llvm/include/llvm/CodeGen/WindowScheduler.h
@@ -47,6 +47,7 @@
 #include "llvm/CodeGen/MachineScheduler.h"
 #include "llvm/CodeGen/ScheduleDAGInstrs.h"
 #include "llvm/CodeGen/TargetSubtargetInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -58,7 +59,7 @@ enum WindowSchedulingFlag {
 
 /// The main class in the implementation of the target independent window
 /// scheduler.
-class WindowScheduler {
+class LLVM_ABI WindowScheduler {
 protected:
   MachineSchedContext *Context = nullptr;
   MachineFunction *MF = nullptr;
diff --git a/llvm/include/llvm/CodeGen/XRayInstrumentation.h b/llvm/include/llvm/CodeGen/XRayInstrumentation.h
index cc65d61627fc0..ba974eddcbf05 100644
--- a/llvm/include/llvm/CodeGen/XRayInstrumentation.h
+++ b/llvm/include/llvm/CodeGen/XRayInstrumentation.h
@@ -10,13 +10,14 @@
 #define LLVM_CODEGEN_XRAYINSTRUMENTATION_H
 
 #include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class XRayInstrumentationPass : public PassInfoMixin<XRayInstrumentationPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/DTLTO/DTLTO.h b/llvm/include/llvm/DTLTO/DTLTO.h
index 02b098a68aec5..6ef92cc61d891 100644
--- a/llvm/include/llvm/DTLTO/DTLTO.h
+++ b/llvm/include/llvm/DTLTO/DTLTO.h
@@ -10,12 +10,13 @@
 #define LLVM_DTLTO_H
 
 #include "llvm/LTO/LTO.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/MemoryBuffer.h"
 
 namespace llvm {
 namespace lto {
 
-class DTLTO : public LTO {
+class LLVM_ABI DTLTO : public LTO {
   using Base = LTO;
 
 public:
@@ -29,13 +30,13 @@ class DTLTO : public LTO {
   }
 
   // Add an input file and prepare it for distribution.
-  LLVM_ABI Expected<std::shared_ptr<InputFile>>
+  Expected<std::shared_ptr<InputFile>>
   addInput(std::unique_ptr<InputFile> InputPtr) override;
 
 protected:
-  LLVM_ABI llvm::Error handleArchiveInputs() override;
+  llvm::Error handleArchiveInputs() override;
 
-  LLVM_ABI void cleanup() override;
+  void cleanup() override;
 
 private:
   // Bump allocator for a purpose of saving updated module IDs.
diff --git a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h
index 5ced6d05cc231..8fc847172fc5a 100644
--- a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h
+++ b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h
@@ -16,6 +16,7 @@
 #include "llvm/CodeGen/NonRelocatableStringpool.h"
 #include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
 #include "llvm/DebugInfo/DWARF/DWARFDie.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include <atomic>
@@ -94,7 +95,7 @@ class DeclContext {
 
   uint32_t getQualifiedNameHash() const { return QualifiedNameHash; }
 
-  bool setLastSeenDIE(CompileUnit &U, const DWARFDie &Die);
+  LLVM_ABI bool setLastSeenDIE(CompileUnit &U, const DWARFDie &Die);
 
   void setHasCanonicalDIE() { HasCanonicalDIE = true; }
 
@@ -143,10 +144,9 @@ class DeclContextTree {
   ///
   /// FIXME: The invalid bit along the return value is to emulate some
   /// dsymutil-classic functionality.
-  PointerIntPair<DeclContext *, 1> getChildDeclContext(DeclContext &Context,
-                                                       const DWARFDie &DIE,
-                                                       CompileUnit &Unit,
-                                                       bool InClangModule);
+  LLVM_ABI PointerIntPair<DeclContext *, 1>
+  getChildDeclContext(DeclContext &Context, const DWARFDie &DIE,
+                      CompileUnit &Unit, bool InClangModule);
 
   DeclContext &getRoot() { return Root; }
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h b/llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
index fdca2ad063a14..bb09d2b30f92b 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
@@ -10,6 +10,7 @@
 #define LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONVISITOR_H
 
 #include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
@@ -60,9 +61,9 @@ class DebugSubsectionVisitor {
                                     const StringsAndChecksumsRef &State) = 0;
 };
 
-Error visitDebugSubsection(const DebugSubsectionRecord &R,
-                           DebugSubsectionVisitor &V,
-                           const StringsAndChecksumsRef &State);
+LLVM_ABI Error visitDebugSubsection(const DebugSubsectionRecord &R,
+                                    DebugSubsectionVisitor &V,
+                                    const StringsAndChecksumsRef &State);
 
 namespace detail {
 template <typename T>
diff --git a/llvm/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h b/llvm/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h
index 91b740ce6b9ae..173f4673a5d25 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h
@@ -12,6 +12,7 @@
 #include "llvm/DebugInfo/CodeView/CodeView.h"
 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
 #include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Error.h"
 #include <cstdint>
@@ -27,7 +28,7 @@ class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef {
 public:
   using ArrayType = FixedStreamArray<support::ulittle32_t>;
 
-  DebugSymbolRVASubsectionRef();
+  LLVM_ABI DebugSymbolRVASubsectionRef();
 
   static bool classof(const DebugSubsectionRef *S) {
     return S->kind() == DebugSubsectionKind::CoffSymbolRVA;
@@ -36,13 +37,13 @@ class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef {
   ArrayType::Iterator begin() const { return RVAs.begin(); }
   ArrayType::Iterator end() const { return RVAs.end(); }
 
-  Error initialize(BinaryStreamReader &Reader);
+  LLVM_ABI Error initialize(BinaryStreamReader &Reader);
 
 private:
   ArrayType RVAs;
 };
 
-class DebugSymbolRVASubsection final : public DebugSubsection {
+class LLVM_ABI DebugSymbolRVASubsection final : public DebugSubsection {
 public:
   DebugSymbolRVASubsection();
 
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
index ae2a4e2276da0..82005bd4a8e13 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
@@ -11,6 +11,7 @@
 
 #include "llvm/BinaryFormat/Dwarf.h"
 #include "llvm/DebugInfo/DIContext.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <cstdint>
 #include <vector>
@@ -49,28 +50,30 @@ class DWARFDebugAddrTable {
 public:
 
   /// Extract the entire table, including all addresses.
-  Error extract(const DWARFDataExtractor &Data, uint64_t *OffsetPtr,
-                uint16_t CUVersion, uint8_t CUAddrSize,
-                std::function<void(Error)> WarnCallback);
+  LLVM_ABI Error extract(const DWARFDataExtractor &Data, uint64_t *OffsetPtr,
+                         uint16_t CUVersion, uint8_t CUAddrSize,
+                         std::function<void(Error)> WarnCallback);
 
   /// Extract a DWARFv5 address table.
-  Error extractV5(const DWARFDataExtractor &Data, uint64_t *OffsetPtr,
-                  uint8_t CUAddrSize, std::function<void(Error)> WarnCallback);
+  LLVM_ABI Error extractV5(const DWARFDataExtractor &Data, uint64_t *OffsetPtr,
+                           uint8_t CUAddrSize,
+                           std::function<void(Error)> WarnCallback);
 
   /// Extract a pre-DWARFv5 address table. Such tables do not have a header
   /// and consist only of a series of addresses.
   /// See https://gcc.gnu.org/wiki/DebugFission for details.
-  Error extractPreStandard(const DWARFDataExtractor &Data, uint64_t *OffsetPtr,
-                           uint16_t CUVersion, uint8_t CUAddrSize);
+  LLVM_ABI Error extractPreStandard(const DWARFDataExtractor &Data,
+                                    uint64_t *OffsetPtr, uint16_t CUVersion,
+                                    uint8_t CUAddrSize);
 
-  void dump(raw_ostream &OS, DIDumpOptions DumpOpts = {}) const;
+  LLVM_ABI void dump(raw_ostream &OS, DIDumpOptions DumpOpts = {}) const;
 
   /// Return the address based on a given index.
-  Expected<uint64_t> getAddrEntry(uint32_t Index) const;
+  LLVM_ABI Expected<uint64_t> getAddrEntry(uint32_t Index) const;
 
   /// Return the full length of this table, including the length field.
   /// Return std::nullopt if the length cannot be identified reliably.
-  std::optional<uint64_t> getFullLength() const;
+  LLVM_ABI std::optional<uint64_t> getFullLength() const;
 
   /// Return the DWARF format of this table.
   dwarf::DwarfFormat getFormat() const { return Format; }
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
index 068674cfae5c5..c1077c629d09d 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <vector>
 
@@ -22,8 +23,8 @@ class DWARFContext;
 
 class DWARFDebugAranges {
 public:
-  void generate(DWARFContext *CTX);
-  uint64_t findAddress(uint64_t Address) const;
+  LLVM_ABI void generate(DWARFContext *CTX);
+  LLVM_ABI uint64_t findAddress(uint64_t Address) const;
 
 private:
   void clear();
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
index df862f60cb2f1..a7ec756c58a32 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
 #include "llvm/DebugInfo/DWARF/DWARFUnit.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <cstdint>
 
@@ -62,16 +63,16 @@ class DWARFDebugMacro {
     uint64_t DebugLineOffset;
 
     /// Print the macro header from the debug_macro section.
-    void dumpMacroHeader(raw_ostream &OS) const;
+    LLVM_ABI void dumpMacroHeader(raw_ostream &OS) const;
 
     /// Parse the debug_macro header.
-    Error parseMacroHeader(DWARFDataExtractor Data, uint64_t *Offset);
+    LLVM_ABI Error parseMacroHeader(DWARFDataExtractor Data, uint64_t *Offset);
 
     /// Get the DWARF format according to the flags.
-    dwarf::DwarfFormat getDwarfFormat() const;
+    LLVM_ABI dwarf::DwarfFormat getDwarfFormat() const;
 
     /// Get the size of a reference according to the DWARF format.
-    uint8_t getOffsetByteSize() const;
+    LLVM_ABI uint8_t getOffsetByteSize() const;
   };
 
   /// A single macro entry within a macro list.
@@ -116,7 +117,7 @@ class DWARFDebugMacro {
   DWARFDebugMacro() = default;
 
   /// Print the macro list found within the debug_macinfo/debug_macro section.
-  void dump(raw_ostream &OS) const;
+  LLVM_ABI void dump(raw_ostream &OS) const;
 
   Error parseMacro(DWARFUnitVector::compile_unit_range Units,
                    DataExtractor StringExtractor,
@@ -142,9 +143,10 @@ class DWARFDebugMacro {
 private:
   /// Parse the debug_macinfo/debug_macro section accessible via the 'MacroData'
   /// parameter.
-  Error parseImpl(std::optional<DWARFUnitVector::compile_unit_range> Units,
-                  std::optional<DataExtractor> StringExtractor,
-                  DWARFDataExtractor Data, bool IsMacro);
+  LLVM_ABI Error
+  parseImpl(std::optional<DWARFUnitVector::compile_unit_range> Units,
+            std::optional<DataExtractor> StringExtractor,
+            DWARFDataExtractor Data, bool IsMacro);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
index 6b23c4e57d950..6714962392117 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <utility>
 
@@ -70,8 +71,8 @@ class DWARFGdbIndex {
   bool parseImpl(DataExtractor Data);
 
 public:
-  void dump(raw_ostream &OS);
-  void parse(DataExtractor Data);
+  LLVM_ABI void dump(raw_ostream &OS);
+  LLVM_ABI void parse(DataExtractor Data);
 
   bool HasContent = false;
   bool HasError = false;
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
index 85ec6fd86ade6..33c1b048a10e4 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/DebugInfo/DWARF/DWARFUnit.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 
 namespace llvm {
@@ -21,7 +22,7 @@ class DWARFDebugAbbrev;
 struct DWARFSection;
 class raw_ostream;
 
-class DWARFTypeUnit : public DWARFUnit {
+class LLVM_ABI DWARFTypeUnit : public DWARFUnit {
 public:
   DWARFTypeUnit(DWARFContext &Context, const DWARFSection &Section,
                 const DWARFUnitHeader &Header, const DWARFDebugAbbrev *DA,
diff --git a/llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h b/llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h
index ffe0b50b036ac..c2ae77272894d 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h
@@ -182,9 +182,9 @@ class DWARFDataExtractorSimple
 public:
   using DWARFDataExtractorBase::DWARFDataExtractorBase;
 
-  LLVM_ABI uint64_t getRelocatedValueImpl(uint32_t Size, uint64_t *Off,
-                                          uint64_t *SectionIndex = nullptr,
-                                          Error *Err = nullptr) const {
+  uint64_t getRelocatedValueImpl(uint32_t Size, uint64_t *Off,
+                                 uint64_t *SectionIndex = nullptr,
+                                 Error *Err = nullptr) const {
     assert(SectionIndex == nullptr &&
            "DWARFDATAExtractorSimple cannot take section indices.");
     return getUnsigned(Off, Size, Err);
diff --git a/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h b/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h
index f9382fa8d9577..21d7b2e8c5057 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h
@@ -10,6 +10,7 @@
 #define LLVM_DEBUGINFO_GSYM_GSYMCONTEXT_H
 
 #include "llvm/DebugInfo/DIContext.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <memory>
 
@@ -26,7 +27,7 @@ class GsymReader;
 /// interface to different symbolication formats (e.g. GSYM, PDB and DWARF).
 /// More control and power over the debug information access can be had by using
 /// the GSYM interfaces directly.
-class GsymContext : public DIContext {
+class LLVM_ABI GsymContext : public DIContext {
 public:
   GsymContext(std::unique_ptr<GsymReader> Reader);
   ~GsymContext() override;
diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h
index cc8dda2f82bee..bf637945ee84a 100644
--- a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h
+++ b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h
@@ -26,6 +26,7 @@
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace logicalview {
@@ -53,17 +54,18 @@ class LVSymbolTable final {
 public:
   LVSymbolTable() = default;
 
-  void add(StringRef Name, LVScope *Function, LVSectionIndex SectionIndex = 0);
-  void add(StringRef Name, LVAddress Address, LVSectionIndex SectionIndex,
-           bool IsComdat);
-  LVSectionIndex update(LVScope *Function);
+  LLVM_ABI void add(StringRef Name, LVScope *Function,
+                    LVSectionIndex SectionIndex = 0);
+  LLVM_ABI void add(StringRef Name, LVAddress Address,
+                    LVSectionIndex SectionIndex, bool IsComdat);
+  LLVM_ABI LVSectionIndex update(LVScope *Function);
 
-  const LVSymbolTableEntry &getEntry(StringRef Name);
-  LVAddress getAddress(StringRef Name);
-  LVSectionIndex getIndex(StringRef Name);
-  bool getIsComdat(StringRef Name);
+  LLVM_ABI const LVSymbolTableEntry &getEntry(StringRef Name);
+  LLVM_ABI LVAddress getAddress(StringRef Name);
+  LLVM_ABI LVSectionIndex getIndex(StringRef Name);
+  LLVM_ABI bool getIsComdat(StringRef Name);
 
-  void print(raw_ostream &OS);
+  LLVM_ABI void print(raw_ostream &OS);
 };
 
 class LVBinaryReader : public LVReader {
@@ -159,8 +161,8 @@ class LVBinaryReader : public LVReader {
   LVAddress WasmCodeSectionOffset = 0;
 
   // Loads all info for the architecture of the provided object file.
-  Error loadGenericTargetInfo(StringRef TheTriple, StringRef TheFeatures,
-                              StringRef TheCPU);
+  LLVM_ABI Error loadGenericTargetInfo(StringRef TheTriple,
+                                       StringRef TheFeatures, StringRef TheCPU);
 
   virtual void mapRangeAddress(const object::ObjectFile &Obj) {}
   virtual void mapRangeAddress(const object::ObjectFile &Obj,
@@ -168,22 +170,25 @@ class LVBinaryReader : public LVReader {
                                bool IsComdat) {}
 
   // Create a mapping from virtual address to section.
-  void mapVirtualAddress(const object::ObjectFile &Obj);
-  void mapVirtualAddress(const object::COFFObjectFile &COFFObj);
+  LLVM_ABI void mapVirtualAddress(const object::ObjectFile &Obj);
+  LLVM_ABI void mapVirtualAddress(const object::COFFObjectFile &COFFObj);
 
-  Expected<std::pair<LVSectionIndex, object::SectionRef>>
+  LLVM_ABI Expected<std::pair<LVSectionIndex, object::SectionRef>>
   getSection(LVScope *Scope, LVAddress Address, LVSectionIndex SectionIndex);
 
-  void includeInlineeLines(LVSectionIndex SectionIndex, LVScope *Function);
+  LLVM_ABI void includeInlineeLines(LVSectionIndex SectionIndex,
+                                    LVScope *Function);
 
-  Error createInstructions();
-  Error createInstructions(LVScope *Function, LVSectionIndex SectionIndex);
-  Error createInstructions(LVScope *Function, LVSectionIndex SectionIndex,
-                           const LVNameInfo &NameInfo);
+  LLVM_ABI Error createInstructions();
+  LLVM_ABI Error createInstructions(LVScope *Function,
+                                    LVSectionIndex SectionIndex);
+  LLVM_ABI Error createInstructions(LVScope *Function,
+                                    LVSectionIndex SectionIndex,
+                                    const LVNameInfo &NameInfo);
 
-  void processLines(LVLines *DebugLines, LVSectionIndex SectionIndex);
-  void processLines(LVLines *DebugLines, LVSectionIndex SectionIndex,
-                    LVScope *Function);
+  LLVM_ABI void processLines(LVLines *DebugLines, LVSectionIndex SectionIndex);
+  LLVM_ABI void processLines(LVLines *DebugLines, LVSectionIndex SectionIndex,
+                             LVScope *Function);
 
 public:
   LVBinaryReader() = delete;
@@ -204,23 +209,23 @@ class LVBinaryReader : public LVReader {
     return ImageBaseAddress + (Segment * VirtualAddress) + Offset + Addendum;
   }
 
-  void addToSymbolTable(StringRef Name, LVScope *Function,
-                        LVSectionIndex SectionIndex = 0);
-  void addToSymbolTable(StringRef Name, LVAddress Address,
-                        LVSectionIndex SectionIndex, bool IsComdat);
-  LVSectionIndex updateSymbolTable(LVScope *Function);
+  LLVM_ABI void addToSymbolTable(StringRef Name, LVScope *Function,
+                                 LVSectionIndex SectionIndex = 0);
+  LLVM_ABI void addToSymbolTable(StringRef Name, LVAddress Address,
+                                 LVSectionIndex SectionIndex, bool IsComdat);
+  LLVM_ABI LVSectionIndex updateSymbolTable(LVScope *Function);
 
-  const LVSymbolTableEntry &getSymbolTableEntry(StringRef Name);
-  LVAddress getSymbolTableAddress(StringRef Name);
-  LVSectionIndex getSymbolTableIndex(StringRef Name);
-  bool getSymbolTableIsComdat(StringRef Name);
+  LLVM_ABI const LVSymbolTableEntry &getSymbolTableEntry(StringRef Name);
+  LLVM_ABI LVAddress getSymbolTableAddress(StringRef Name);
+  LLVM_ABI LVSectionIndex getSymbolTableIndex(StringRef Name);
+  LLVM_ABI bool getSymbolTableIsComdat(StringRef Name);
 
   LVSectionIndex getSectionIndex(LVScope *Scope) override {
     return Scope ? getSymbolTableIndex(Scope->getLinkageName())
                  : DotTextSectionIndex;
   }
 
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   void dump() const { print(dbgs()); }
diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h
index 9f6fd553221db..94f026ea36217 100644
--- a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h
+++ b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h
@@ -26,6 +26,7 @@
 #include "llvm/Support/BinaryByteStream.h"
 #include "llvm/Support/BinaryItemStream.h"
 #include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 template <> struct BinaryItemTraits<codeview::CVType> {
@@ -64,7 +65,7 @@ using LVNames = SmallVector<StringRef, 16>;
 // As the CodeView constants are different to the DWARF constants, the
 // CodeView reader will map them to the DWARF ones.
 
-class LVCodeViewReader final : public LVBinaryReader {
+class LLVM_ABI LVCodeViewReader final : public LVBinaryReader {
   friend class LVTypeVisitor;
   friend class LVSymbolVisitor;
   friend class LVSymbolVisitorDelegate;
diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.h b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.h
index eb6371e911be4..26376698cdc00 100644
--- a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.h
+++ b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.h
@@ -23,6 +23,7 @@
 #include "llvm/DebugInfo/PDB/Native/InputFile.h"
 #include "llvm/Object/Binary.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <stack>
 #include <utility>
@@ -36,7 +37,7 @@ class LVCodeViewReader;
 class LVLogicalVisitor;
 struct LVShared;
 
-class LVTypeVisitor final : public TypeVisitorCallbacks {
+class LLVM_ABI LVTypeVisitor final : public TypeVisitorCallbacks {
   ScopedPrinter &W;
   LVLogicalVisitor *LogicalVisitor;
   LazyRandomTypeCollection &Types;
@@ -82,7 +83,7 @@ class LVTypeVisitor final : public TypeVisitorCallbacks {
   Error visitUnknownType(CVType &Record) override;
 };
 
-class LVSymbolVisitorDelegate final : public SymbolVisitorDelegate {
+class LLVM_ABI LVSymbolVisitorDelegate final : public SymbolVisitorDelegate {
   LVCodeViewReader *Reader;
   const llvm::object::coff_section *CoffSection;
   StringRef SectionContents;
@@ -121,7 +122,7 @@ class LVSymbol;
 class LVType;
 
 // Visitor for CodeView symbol streams found in COFF object files and PDB files.
-class LVSymbolVisitor final : public SymbolVisitorCallbacks {
+class LLVM_ABI LVSymbolVisitor final : public SymbolVisitorCallbacks {
   LVCodeViewReader *Reader;
   ScopedPrinter &W;
   LVLogicalVisitor *LogicalVisitor;
@@ -281,8 +282,8 @@ class LVLogicalVisitor final {
   void createParents(StringRef ScopedName, LVElement *Element);
 
 public:
-  LVLogicalVisitor(LVCodeViewReader *Reader, ScopedPrinter &W,
-                   llvm::pdb::InputFile &Input);
+  LLVM_ABI LVLogicalVisitor(LVCodeViewReader *Reader, ScopedPrinter &W,
+                            llvm::pdb::InputFile &Input);
 
   // Current elements during the processing of a RecordType or RecordSymbol.
   // They are shared with the SymbolVisitor.
@@ -304,19 +305,20 @@ class LVLogicalVisitor final {
                         std::forward_as_tuple(LineNumber, Filename));
   }
 
-  void printTypeIndex(StringRef FieldName, TypeIndex TI, uint32_t StreamIdx);
-  void printMemberAttributes(MemberAttributes Attrs);
-  void printMemberAttributes(MemberAccess Access, MethodKind Kind,
-                             MethodOptions Options);
+  LLVM_ABI void printTypeIndex(StringRef FieldName, TypeIndex TI,
+                               uint32_t StreamIdx);
+  LLVM_ABI void printMemberAttributes(MemberAttributes Attrs);
+  LLVM_ABI void printMemberAttributes(MemberAccess Access, MethodKind Kind,
+                                      MethodOptions Options);
 
-  LVElement *createElement(TypeLeafKind Kind);
-  LVElement *createElement(SymbolKind Kind);
-  LVElement *createElement(TypeIndex TI, TypeLeafKind Kind);
+  LLVM_ABI LVElement *createElement(TypeLeafKind Kind);
+  LLVM_ABI LVElement *createElement(SymbolKind Kind);
+  LLVM_ABI LVElement *createElement(TypeIndex TI, TypeLeafKind Kind);
 
   // Break down the annotation byte code and calculate code and line offsets.
-  Error inlineSiteAnnotation(LVScope *AbstractFunction,
-                             LVScope *InlinedFunction,
-                             InlineSiteSym &InlineSite);
+  LLVM_ABI Error inlineSiteAnnotation(LVScope *AbstractFunction,
+                                      LVScope *InlinedFunction,
+                                      InlineSiteSym &InlineSite);
 
   void pushScope(LVScope *Scope) {
     ScopeStack.push(ReaderParent);
@@ -336,110 +338,121 @@ class LVLogicalVisitor final {
   }
   void setRoot(LVScope *Root) { ReaderScope = Root; }
 
-  void addElement(LVScope *Scope, bool IsCompileUnit);
-  void addElement(LVSymbol *Symbol);
-  void addElement(LVType *Type);
+  LLVM_ABI void addElement(LVScope *Scope, bool IsCompileUnit);
+  LLVM_ABI void addElement(LVSymbol *Symbol);
+  LLVM_ABI void addElement(LVType *Type);
 
   std::string getCompileUnitName() { return CompileUnitName; }
   void setCompileUnitName(std::string Name) {
     CompileUnitName = std::move(Name);
   }
 
-  LVElement *getElement(uint32_t StreamIdx, TypeIndex TI,
-                        LVScope *Parent = nullptr);
+  LLVM_ABI LVElement *getElement(uint32_t StreamIdx, TypeIndex TI,
+                                 LVScope *Parent = nullptr);
   LVShared *getShared() { return Shared.get(); }
 
   LVScope *getReaderScope() const { return ReaderScope; }
 
-  void printTypeBegin(CVType &Record, TypeIndex TI, LVElement *Element,
-                      uint32_t StreamIdx);
-  void printTypeEnd(CVType &Record);
-  void printMemberBegin(CVMemberRecord &Record, TypeIndex TI,
-                        LVElement *Element, uint32_t StreamIdx);
-  void printMemberEnd(CVMemberRecord &Record);
+  LLVM_ABI void printTypeBegin(CVType &Record, TypeIndex TI, LVElement *Element,
+                               uint32_t StreamIdx);
+  LLVM_ABI void printTypeEnd(CVType &Record);
+  LLVM_ABI void printMemberBegin(CVMemberRecord &Record, TypeIndex TI,
+                                 LVElement *Element, uint32_t StreamIdx);
+  LLVM_ABI void printMemberEnd(CVMemberRecord &Record);
 
   void startProcessArgumentList() { ProcessArgumentList = true; }
   void stopProcessArgumentList() { ProcessArgumentList = false; }
 
-  void processFiles();
-  void processLines();
-  void processNamespaces();
-
-  void printRecords(raw_ostream &OS) const;
-
-  Error visitUnknownType(CVType &Record, TypeIndex TI);
-  Error visitKnownRecord(CVType &Record, ArgListRecord &Args, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, ArrayRecord &AT, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, BitFieldRecord &BF, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, BuildInfoRecord &BI, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, ClassRecord &Class, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, EnumRecord &Enum, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, FieldListRecord &FieldList,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownRecord(CVType &Record, FuncIdRecord &Func, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, LabelRecord &LR, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, ModifierRecord &Mod, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, MemberFuncIdRecord &Id, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, MemberFunctionRecord &MF, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, MethodOverloadListRecord &Overloads,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownRecord(CVType &Record, PointerRecord &Ptr, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, ProcedureRecord &Proc, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, UnionRecord &Union, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, TypeServer2Record &TS, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, VFTableRecord &VFT, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, VFTableShapeRecord &Shape,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownRecord(CVType &Record, StringListRecord &Strings,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownRecord(CVType &Record, StringIdRecord &String, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, UdtSourceLineRecord &SourceLine,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownRecord(CVType &Record, UdtModSourceLineRecord &ModSourceLine,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownRecord(CVType &Record, PrecompRecord &Precomp, TypeIndex TI,
-                         LVElement *Element);
-  Error visitKnownRecord(CVType &Record, EndPrecompRecord &EndPrecomp,
-                         TypeIndex TI, LVElement *Element);
-
-  Error visitUnknownMember(CVMemberRecord &Record, TypeIndex TI);
-  Error visitKnownMember(CVMemberRecord &Record, BaseClassRecord &Base,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownMember(CVMemberRecord &Record, DataMemberRecord &Field,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownMember(CVMemberRecord &Record, EnumeratorRecord &Enum,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownMember(CVMemberRecord &Record, ListContinuationRecord &Cont,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownMember(CVMemberRecord &Record, NestedTypeRecord &Nested,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownMember(CVMemberRecord &Record, OneMethodRecord &Method,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownMember(CVMemberRecord &Record, OverloadedMethodRecord &Method,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownMember(CVMemberRecord &Record, StaticDataMemberRecord &Field,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownMember(CVMemberRecord &Record, VFPtrRecord &VFTable,
-                         TypeIndex TI, LVElement *Element);
-  Error visitKnownMember(CVMemberRecord &Record, VirtualBaseClassRecord &Base,
-                         TypeIndex TI, LVElement *Element);
+  LLVM_ABI void processFiles();
+  LLVM_ABI void processLines();
+  LLVM_ABI void processNamespaces();
+
+  LLVM_ABI void printRecords(raw_ostream &OS) const;
+
+  LLVM_ABI Error visitUnknownType(CVType &Record, TypeIndex TI);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, ArgListRecord &Args,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, ArrayRecord &AT, TypeIndex TI,
+                                  LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, BitFieldRecord &BF,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, BuildInfoRecord &BI,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, ClassRecord &Class,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, EnumRecord &Enum,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, FieldListRecord &FieldList,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, FuncIdRecord &Func,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, LabelRecord &LR, TypeIndex TI,
+                                  LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, ModifierRecord &Mod,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, MemberFuncIdRecord &Id,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, MemberFunctionRecord &MF,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record,
+                                  MethodOverloadListRecord &Overloads,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, PointerRecord &Ptr,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, ProcedureRecord &Proc,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, UnionRecord &Union,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, TypeServer2Record &TS,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, VFTableRecord &VFT,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, VFTableShapeRecord &Shape,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, StringListRecord &Strings,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, StringIdRecord &String,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record,
+                                  UdtSourceLineRecord &SourceLine, TypeIndex TI,
+                                  LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record,
+                                  UdtModSourceLineRecord &ModSourceLine,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, PrecompRecord &Precomp,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownRecord(CVType &Record, EndPrecompRecord &EndPrecomp,
+                                  TypeIndex TI, LVElement *Element);
+
+  LLVM_ABI Error visitUnknownMember(CVMemberRecord &Record, TypeIndex TI);
+  LLVM_ABI Error visitKnownMember(CVMemberRecord &Record, BaseClassRecord &Base,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownMember(CVMemberRecord &Record,
+                                  DataMemberRecord &Field, TypeIndex TI,
+                                  LVElement *Element);
+  LLVM_ABI Error visitKnownMember(CVMemberRecord &Record,
+                                  EnumeratorRecord &Enum, TypeIndex TI,
+                                  LVElement *Element);
+  LLVM_ABI Error visitKnownMember(CVMemberRecord &Record,
+                                  ListContinuationRecord &Cont, TypeIndex TI,
+                                  LVElement *Element);
+  LLVM_ABI Error visitKnownMember(CVMemberRecord &Record,
+                                  NestedTypeRecord &Nested, TypeIndex TI,
+                                  LVElement *Element);
+  LLVM_ABI Error visitKnownMember(CVMemberRecord &Record,
+                                  OneMethodRecord &Method, TypeIndex TI,
+                                  LVElement *Element);
+  LLVM_ABI Error visitKnownMember(CVMemberRecord &Record,
+                                  OverloadedMethodRecord &Method, TypeIndex TI,
+                                  LVElement *Element);
+  LLVM_ABI Error visitKnownMember(CVMemberRecord &Record,
+                                  StaticDataMemberRecord &Field, TypeIndex TI,
+                                  LVElement *Element);
+  LLVM_ABI Error visitKnownMember(CVMemberRecord &Record, VFPtrRecord &VFTable,
+                                  TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitKnownMember(CVMemberRecord &Record,
+                                  VirtualBaseClassRecord &Base, TypeIndex TI,
+                                  LVElement *Element);
 
   template <typename T>
   Error visitKnownMember(CVMemberRecord &Record,
@@ -466,10 +479,11 @@ class LVLogicalVisitor final {
     return Error::success();
   }
 
-  Error visitMemberRecord(CVMemberRecord &Record,
-                          TypeVisitorCallbacks &Callbacks, TypeIndex TI,
-                          LVElement *Element);
-  Error finishVisitation(CVType &Record, TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error visitMemberRecord(CVMemberRecord &Record,
+                                   TypeVisitorCallbacks &Callbacks,
+                                   TypeIndex TI, LVElement *Element);
+  LLVM_ABI Error finishVisitation(CVType &Record, TypeIndex TI,
+                                  LVElement *Element);
 };
 
 } // namespace logicalview
diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVDWARFReader.h b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVDWARFReader.h
index 1cf29147fe2a1..2b17d90c8c181 100644
--- a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVDWARFReader.h
+++ b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVDWARFReader.h
@@ -17,6 +17,7 @@
 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h"
+#include "llvm/Support/Compiler.h"
 #include <unordered_set>
 
 namespace llvm {
@@ -30,7 +31,7 @@ class LVType;
 
 using AttributeSpec = DWARFAbbreviationDeclaration::AttributeSpec;
 
-class LVDWARFReader final : public LVBinaryReader {
+class LLVM_ABI LVDWARFReader final : public LVBinaryReader {
   object::ObjectFile &Obj;
 
   // Indicates if ranges data are available; in the case of split DWARF any
diff --git a/llvm/include/llvm/DebugInfo/PDB/DIA/DIAError.h b/llvm/include/llvm/DebugInfo/PDB/DIA/DIAError.h
index 96d960599f7ef..3f500cec25151 100644
--- a/llvm/include/llvm/DebugInfo/PDB/DIA/DIAError.h
+++ b/llvm/include/llvm/DebugInfo/PDB/DIA/DIAError.h
@@ -10,6 +10,7 @@
 #define LLVM_DEBUGINFO_PDB_DIA_DIAERROR_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
@@ -32,7 +33,7 @@ struct is_error_code_enum<llvm::pdb::dia_error_code> : std::true_type {};
 
 namespace llvm {
 namespace pdb {
-const std::error_category &DIAErrCategory();
+LLVM_ABI const std::error_category &DIAErrCategory();
 
 inline std::error_code make_error_code(dia_error_code E) {
   return std::error_code(static_cast<int>(E), DIAErrCategory());
@@ -43,7 +44,7 @@ class DIAError : public ErrorInfo<DIAError, StringError> {
 public:
   using ErrorInfo<DIAError, StringError>::ErrorInfo;
   DIAError(const Twine &S) : ErrorInfo(S, dia_error_code::unspecified) {}
-  static char ID;
+  LLVM_ABI static char ID;
 };
 } // namespace pdb
 } // namespace llvm
diff --git a/llvm/include/llvm/DebugInfo/PDB/IPDBDataStream.h b/llvm/include/llvm/DebugInfo/PDB/IPDBDataStream.h
index fb18396cafe31..58ac4fb5dc8e2 100644
--- a/llvm/include/llvm/DebugInfo/PDB/IPDBDataStream.h
+++ b/llvm/include/llvm/DebugInfo/PDB/IPDBDataStream.h
@@ -10,6 +10,7 @@
 #define LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
 
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <optional>
 #include <string>
@@ -20,7 +21,7 @@ namespace pdb {
 /// IPDBDataStream defines an interface used to represent a stream consisting
 /// of a name and a series of records whose formats depend on the particular
 /// stream type.
-class IPDBDataStream {
+class LLVM_ABI IPDBDataStream {
 public:
   using RecordType = SmallVector<uint8_t, 32>;
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/IPDBSectionContrib.h b/llvm/include/llvm/DebugInfo/PDB/IPDBSectionContrib.h
index c5cf4bbe55600..ba8b12a42a208 100644
--- a/llvm/include/llvm/DebugInfo/PDB/IPDBSectionContrib.h
+++ b/llvm/include/llvm/DebugInfo/PDB/IPDBSectionContrib.h
@@ -10,13 +10,14 @@
 #define LLVM_DEBUGINFO_PDB_IPDBSECTIONCONTRIB_H
 
 #include "PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace pdb {
 
 /// IPDBSectionContrib defines an interface used to represent section
 /// contributions whose information are stored in the PDB.
-class IPDBSectionContrib {
+class LLVM_ABI IPDBSectionContrib {
 public:
   virtual ~IPDBSectionContrib();
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/IPDBTable.h b/llvm/include/llvm/DebugInfo/PDB/IPDBTable.h
index 55ca230d58c41..7dc4d659ebc95 100644
--- a/llvm/include/llvm/DebugInfo/PDB/IPDBTable.h
+++ b/llvm/include/llvm/DebugInfo/PDB/IPDBTable.h
@@ -10,10 +10,11 @@
 #define LLVM_DEBUGINFO_PDB_IPDBTABLE_H
 
 #include "PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace pdb {
-class IPDBTable {
+class LLVM_ABI IPDBTable {
 public:
   virtual ~IPDBTable();
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/EnumTables.h b/llvm/include/llvm/DebugInfo/PDB/Native/EnumTables.h
index dcc67f1e4a8cd..df5e0d6a94b77 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/EnumTables.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/EnumTables.h
@@ -10,11 +10,12 @@
 #define LLVM_DEBUGINFO_PDB_NATIVE_ENUMTABLES_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 template <typename T> struct EnumEntry;
 namespace pdb {
-ArrayRef<EnumEntry<uint16_t>> getOMFSegMapDescFlagNames();
+LLVM_ABI ArrayRef<EnumEntry<uint16_t>> getOMFSegMapDescFlagNames();
 }
 }
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/InjectedSourceStream.h b/llvm/include/llvm/DebugInfo/PDB/Native/InjectedSourceStream.h
index 259c924d9d7c6..6d12fe845d9c2 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/InjectedSourceStream.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/InjectedSourceStream.h
@@ -11,6 +11,7 @@
 
 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
 #include "llvm/DebugInfo/PDB/Native/HashTable.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
@@ -21,8 +22,8 @@ class PDBStringTable;
 
 class InjectedSourceStream {
 public:
-  InjectedSourceStream(std::unique_ptr<msf::MappedBlockStream> Stream);
-  Error reload(const PDBStringTable &Strings);
+  LLVM_ABI InjectedSourceStream(std::unique_ptr<msf::MappedBlockStream> Stream);
+  LLVM_ABI Error reload(const PDBStringTable &Strings);
 
   using const_iterator = HashTable<SrcHeaderBlockEntry>::const_iterator;
   const_iterator begin() const { return InjectedSourceTable.begin(); }
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h b/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h
index 71df1d59c2177..b704ccc0c6726 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h
@@ -55,9 +55,9 @@ class InputFile {
   getOrCreateTypeCollection(TypeCollectionKind Kind);
 
 public:
-  InputFile(PDBFile *Pdb);
-  InputFile(object::COFFObjectFile *Obj);
-  InputFile(MemoryBuffer *Buffer);
+  LLVM_ABI InputFile(PDBFile *Pdb);
+  LLVM_ABI InputFile(object::COFFObjectFile *Obj);
+  LLVM_ABI InputFile(MemoryBuffer *Buffer);
   LLVM_ABI ~InputFile();
   InputFile(InputFile &&Other) = default;
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h
index 50d437642d0f7..12ff147933cd3 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h
@@ -11,11 +11,12 @@
 
 #include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace pdb {
 
-class NativeCompilandSymbol : public NativeRawSymbol {
+class LLVM_ABI NativeCompilandSymbol : public NativeRawSymbol {
 public:
   NativeCompilandSymbol(NativeSession &Session, SymIndexId SymbolId,
                         DbiModuleDescriptor MI);
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h
index c10e652efa8d2..52a738d51a91c 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h
@@ -12,6 +12,7 @@
 #include "llvm/DebugInfo/CodeView/CodeView.h"
 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/Support/Compiler.h"
 
 #include <vector>
 
@@ -20,7 +21,7 @@ namespace pdb {
 
 class NativeSession;
 
-class NativeEnumGlobals : public IPDBEnumChildren<PDBSymbol> {
+class LLVM_ABI NativeEnumGlobals : public IPDBEnumChildren<PDBSymbol> {
 public:
   NativeEnumGlobals(NativeSession &Session,
                     std::vector<codeview::SymbolKind> Kinds);
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumInjectedSources.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumInjectedSources.h
index 50d4c2db3c2aa..2e2faf7356671 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumInjectedSources.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumInjectedSources.h
@@ -12,6 +12,7 @@
 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
 #include "llvm/DebugInfo/PDB/IPDBInjectedSource.h"
 #include "llvm/DebugInfo/PDB/Native/InjectedSourceStream.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace pdb {
@@ -20,7 +21,8 @@ class InjectedSourceStream;
 class PDBFile;
 class PDBStringTable;
 
-class NativeEnumInjectedSources : public IPDBEnumChildren<IPDBInjectedSource> {
+class LLVM_ABI NativeEnumInjectedSources
+    : public IPDBEnumChildren<IPDBInjectedSource> {
 public:
   NativeEnumInjectedSources(PDBFile &File, const InjectedSourceStream &IJS,
                             const PDBStringTable &Strings);
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h
index a936b769d688c..8b6f0f135d5aa 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h
@@ -12,12 +12,13 @@
 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
 #include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
 #include "llvm/DebugInfo/PDB/Native/NativeLineNumber.h"
+#include "llvm/Support/Compiler.h"
 #include <vector>
 
 namespace llvm {
 namespace pdb {
 
-class NativeEnumLineNumbers : public IPDBEnumChildren<IPDBLineNumber> {
+class LLVM_ABI NativeEnumLineNumbers : public IPDBEnumChildren<IPDBLineNumber> {
 public:
   explicit NativeEnumLineNumbers(std::vector<NativeLineNumber> LineNums);
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h
index 94f1ee18ed9f4..7289c70491b76 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h
@@ -11,12 +11,13 @@
 
 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/Support/Compiler.h"
 namespace llvm {
 namespace pdb {
 
 class NativeSession;
 
-class NativeEnumModules : public IPDBEnumChildren<PDBSymbol> {
+class LLVM_ABI NativeEnumModules : public IPDBEnumChildren<PDBSymbol> {
 public:
   NativeEnumModules(NativeSession &Session, uint32_t Index = 0);
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h
index 5fc91675f2092..b9b1ae00615e8 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h
@@ -12,6 +12,7 @@
 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 #include <vector>
 
@@ -20,7 +21,7 @@ namespace pdb {
 
 class NativeSession;
 
-class NativeEnumSymbols : public IPDBEnumChildren<PDBSymbol> {
+class LLVM_ABI NativeEnumSymbols : public IPDBEnumChildren<PDBSymbol> {
 public:
   NativeEnumSymbols(NativeSession &Session, std::vector<SymIndexId> Symbols);
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumTypes.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumTypes.h
index 2ca000c1c0fe6..c99e882ee5165 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumTypes.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumTypes.h
@@ -13,6 +13,7 @@
 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/Support/Compiler.h"
 
 #include <vector>
 
@@ -24,7 +25,7 @@ namespace pdb {
 
 class NativeSession;
 
-class NativeEnumTypes : public IPDBEnumChildren<PDBSymbol> {
+class LLVM_ABI NativeEnumTypes : public IPDBEnumChildren<PDBSymbol> {
 public:
   NativeEnumTypes(NativeSession &Session,
                   codeview::LazyRandomTypeCollection &TypeCollection,
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h
index 82fdff130c4f7..8f2f32786d07e 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h
@@ -12,6 +12,7 @@
 #include "llvm/DebugInfo/CodeView/GUID.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace pdb {
@@ -20,7 +21,7 @@ class NativeSession;
 
 class DbiStream;
 
-class NativeExeSymbol : public NativeRawSymbol {
+class LLVM_ABI NativeExeSymbol : public NativeRawSymbol {
   // EXE symbol is the authority on the various symbol types.
   DbiStream *Dbi = nullptr;
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h
index c15e22f61077a..e3286156bdf26 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h
@@ -13,6 +13,7 @@
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class raw_ostream;
@@ -20,7 +21,7 @@ namespace pdb {
 
 class NativeSession;
 
-class NativeFunctionSymbol : public NativeRawSymbol {
+class LLVM_ABI NativeFunctionSymbol : public NativeRawSymbol {
 public:
   NativeFunctionSymbol(NativeSession &Session, SymIndexId Id,
                        const codeview::ProcSym &Sym, uint32_t RecordOffset);
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h
index 3467ac912162e..96c4463564f50 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h
@@ -13,13 +13,14 @@
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace pdb {
 
 class NativeSession;
 
-class NativeInlineSiteSymbol : public NativeRawSymbol {
+class LLVM_ABI NativeInlineSiteSymbol : public NativeRawSymbol {
 public:
   NativeInlineSiteSymbol(NativeSession &Session, SymIndexId Id,
                          const codeview::InlineSiteSym &Sym,
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeLineNumber.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeLineNumber.h
index 53f2985833fd9..853ba12552fca 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeLineNumber.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeLineNumber.h
@@ -11,13 +11,14 @@
 
 #include "llvm/DebugInfo/CodeView/Line.h"
 #include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace pdb {
 
 class NativeSession;
 
-class NativeLineNumber : public IPDBLineNumber {
+class LLVM_ABI NativeLineNumber : public IPDBLineNumber {
 public:
   explicit NativeLineNumber(const NativeSession &Session,
                             const codeview::LineInfo Line,
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativePublicSymbol.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativePublicSymbol.h
index 43de80507d023..fc6d09074e995 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativePublicSymbol.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativePublicSymbol.h
@@ -11,6 +11,7 @@
 
 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -18,7 +19,7 @@ class raw_ostream;
 namespace pdb {
 class NativeSession;
 
-class NativePublicSymbol : public NativeRawSymbol {
+class LLVM_ABI NativePublicSymbol : public NativeRawSymbol {
 public:
   NativePublicSymbol(NativeSession &Session, SymIndexId Id,
                      const codeview::PublicSym32 &Sym);
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h
index ab4abc4d3c2cc..6b6fc6c374d96 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h
@@ -13,6 +13,7 @@
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -21,7 +22,7 @@ namespace pdb {
 class NativeSession;
 class NativeTypeEnum;
 
-class NativeSymbolEnumerator : public NativeRawSymbol {
+class LLVM_ABI NativeSymbolEnumerator : public NativeRawSymbol {
 public:
   NativeSymbolEnumerator(NativeSession &Session, SymIndexId Id,
                          const NativeTypeEnum &Parent,
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeArray.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeArray.h
index 262864fd709fa..55a50576ad777 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeArray.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeArray.h
@@ -10,6 +10,7 @@
 #define LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEARRAY_H
 
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
+#include "llvm/Support/Compiler.h"
 
 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
@@ -19,7 +20,7 @@ namespace pdb {
 
 class NativeSession;
 
-class NativeTypeArray : public NativeRawSymbol {
+class LLVM_ABI NativeTypeArray : public NativeRawSymbol {
 public:
   NativeTypeArray(NativeSession &Session, SymIndexId Id, codeview::TypeIndex TI,
                   codeview::ArrayRecord Record);
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h
index 8bb09f05d0bc6..ebc751b713fd1 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h
@@ -10,6 +10,7 @@
 #define LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEBUILTIN_H
 
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
+#include "llvm/Support/Compiler.h"
 
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
 
@@ -18,7 +19,7 @@ namespace pdb {
 
 class NativeSession;
 
-class NativeTypeBuiltin : public NativeRawSymbol {
+class LLVM_ABI NativeTypeBuiltin : public NativeRawSymbol {
 public:
   NativeTypeBuiltin(NativeSession &PDBSession, SymIndexId Id,
                     codeview::ModifierOptions Mods, PDB_BuiltinType T,
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
index 01f13ce1073e1..4c72546ad0288 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
@@ -14,6 +14,7 @@
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class raw_ostream;
@@ -21,7 +22,7 @@ namespace pdb {
 
 class NativeTypeBuiltin;
 
-class NativeTypeEnum : public NativeRawSymbol {
+class LLVM_ABI NativeTypeEnum : public NativeRawSymbol {
 public:
   NativeTypeEnum(NativeSession &Session, SymIndexId Id, codeview::TypeIndex TI,
                  codeview::EnumRecord Record);
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
index 47ea722313c36..4b1c450ec2d1c 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
@@ -14,11 +14,12 @@
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace pdb {
 
-class NativeTypeFunctionSig : public NativeRawSymbol {
+class LLVM_ABI NativeTypeFunctionSig : public NativeRawSymbol {
 protected:
   void initialize() override;
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
index 184e00086849c..e135f26ecff7a 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
@@ -14,11 +14,12 @@
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace pdb {
 
-class NativeTypePointer : public NativeRawSymbol {
+class LLVM_ABI NativeTypePointer : public NativeRawSymbol {
 public:
   // Create a pointer record for a simple type.
   NativeTypePointer(NativeSession &Session, SymIndexId Id,
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h
index ce4ebcd00c4a8..bae21ff3c7e96 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h
@@ -13,6 +13,7 @@
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,7 +23,7 @@ namespace pdb {
 
 class NativeSession;
 
-class NativeTypeTypedef : public NativeRawSymbol {
+class LLVM_ABI NativeTypeTypedef : public NativeRawSymbol {
 public:
   // Create a pointer record for a non-simple type.
   NativeTypeTypedef(NativeSession &Session, SymIndexId Id,
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeUDT.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeUDT.h
index 79924a78cd218..db4917a351c2f 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeUDT.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeUDT.h
@@ -14,6 +14,7 @@
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -21,7 +22,7 @@ class raw_ostream;
 namespace pdb {
 class NativeSession;
 
-class NativeTypeUDT : public NativeRawSymbol {
+class LLVM_ABI NativeTypeUDT : public NativeRawSymbol {
 public:
   NativeTypeUDT(NativeSession &Session, SymIndexId Id, codeview::TypeIndex TI,
                 codeview::ClassRecord Class);
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h
index 92d51706c1dac..d7da1cc2f1eb7 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h
@@ -14,12 +14,13 @@
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace pdb {
 class NativeSession;
 
-class NativeTypeVTShape : public NativeRawSymbol {
+class LLVM_ABI NativeTypeVTShape : public NativeRawSymbol {
 public:
   // Create a pointer record for a non-simple type.
   NativeTypeVTShape(NativeSession &Session, SymIndexId Id,
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBContext.h b/llvm/include/llvm/DebugInfo/PDB/PDBContext.h
index fedfcd483dcc3..ff1227e655bcf 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBContext.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBContext.h
@@ -11,6 +11,7 @@
 
 #include "llvm/DebugInfo/DIContext.h"
 #include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <memory>
 #include <string>
@@ -29,38 +30,38 @@ namespace pdb {
   /// need for a transparent interface to different debug information formats
   /// (e.g. PDB and DWARF).  More control and power over the debug information
   /// access can be had by using the PDB interfaces directly.
-  class PDBContext : public DIContext {
-  public:
-    PDBContext(const object::COFFObjectFile &Object,
-               std::unique_ptr<IPDBSession> PDBSession);
-    PDBContext(PDBContext &) = delete;
-    PDBContext &operator=(PDBContext &) = delete;
+class LLVM_ABI PDBContext : public DIContext {
+public:
+  PDBContext(const object::COFFObjectFile &Object,
+             std::unique_ptr<IPDBSession> PDBSession);
+  PDBContext(PDBContext &) = delete;
+  PDBContext &operator=(PDBContext &) = delete;
 
-    static bool classof(const DIContext *DICtx) {
-      return DICtx->getKind() == CK_PDB;
-    }
+  static bool classof(const DIContext *DICtx) {
+    return DICtx->getKind() == CK_PDB;
+  }
 
-    void dump(raw_ostream &OS, DIDumpOptions DIDumpOpts) override;
+  void dump(raw_ostream &OS, DIDumpOptions DIDumpOpts) override;
 
-    std::optional<DILineInfo> getLineInfoForAddress(
-        object::SectionedAddress Address,
-        DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
-    std::optional<DILineInfo>
-    getLineInfoForDataAddress(object::SectionedAddress Address) override;
-    DILineInfoTable getLineInfoForAddressRange(
-        object::SectionedAddress Address, uint64_t Size,
-        DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
-    DIInliningInfo getInliningInfoForAddress(
-        object::SectionedAddress Address,
-        DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
+  std::optional<DILineInfo> getLineInfoForAddress(
+      object::SectionedAddress Address,
+      DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
+  std::optional<DILineInfo>
+  getLineInfoForDataAddress(object::SectionedAddress Address) override;
+  DILineInfoTable getLineInfoForAddressRange(
+      object::SectionedAddress Address, uint64_t Size,
+      DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
+  DIInliningInfo getInliningInfoForAddress(
+      object::SectionedAddress Address,
+      DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
 
-    std::vector<DILocal>
-    getLocalsForAddress(object::SectionedAddress Address) override;
+  std::vector<DILocal>
+  getLocalsForAddress(object::SectionedAddress Address) override;
 
-  private:
-    std::string getFunctionName(uint64_t Address, DINameKind NameKind) const;
-    std::unique_ptr<IPDBSession> Session;
-  };
+private:
+  std::string getFunctionName(uint64_t Address, DINameKind NameKind) const;
+  std::unique_ptr<IPDBSession> Session;
+};
 
 } // end namespace pdb
 
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h
index c8d3d0b7bb963..abcc8293cbd31 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h
@@ -10,12 +10,13 @@
 
 #include "PDBSymbol.h"
 #include "PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 namespace pdb {
 
-class PDBSymbolAnnotation : public PDBSymbol {
+class LLVM_ABI PDBSymbolAnnotation : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Annotation)
 
 public:
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolBlock.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolBlock.h
index 09142227b0176..16eb9c9ac3ba8 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolBlock.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolBlock.h
@@ -10,12 +10,13 @@
 
 #include "PDBSymbol.h"
 #include "PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 namespace pdb {
 
-class PDBSymbolBlock : public PDBSymbol {
+class LLVM_ABI PDBSymbolBlock : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Block)
 public:
   void dump(PDBSymDumper &Dumper) const override;
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h
index 46c1592685338..15d26525d4af4 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h
@@ -11,12 +11,13 @@
 
 #include "PDBSymbol.h"
 #include "PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 namespace pdb {
 
-class PDBSymbolCompilandDetails : public PDBSymbol {
+class LLVM_ABI PDBSymbolCompilandDetails : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::CompilandDetails)
 public:
   void dump(PDBSymDumper &Dumper) const override;
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h
index cba082f2ff196..a86c8fa2cd255 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h
@@ -11,11 +11,12 @@
 
 #include "PDBSymbol.h"
 #include "PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 namespace pdb {
-class PDBSymbolCompilandEnv : public PDBSymbol {
+class LLVM_ABI PDBSymbolCompilandEnv : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::CompilandEnv)
 public:
   void dump(PDBSymDumper &Dumper) const override;
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h
index c78b47ce99248..84bc45ec50d58 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h
@@ -12,6 +12,7 @@
 #include "PDBSymbol.h"
 #include "PDBTypes.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -19,7 +20,7 @@ namespace pdb {
 /// PDBSymbolCustom represents symbols that are compiler-specific and do not
 /// fit anywhere else in the lexical hierarchy.
 /// https://msdn.microsoft.com/en-us/library/d88sf09h.aspx
-class PDBSymbolCustom : public PDBSymbol {
+class LLVM_ABI PDBSymbolCustom : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Custom)
 public:
   void dump(PDBSymDumper &Dumper) const override;
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h
index b15abf7bedfd7..754f24e339944 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h
@@ -11,12 +11,13 @@
 
 #include "PDBSymbol.h"
 #include "PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 namespace pdb {
 
-class PDBSymbolTypeCustom : public PDBSymbol {
+class LLVM_ABI PDBSymbolTypeCustom : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::CustomType)
 public:
   void dump(PDBSymDumper &Dumper) const override;
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h
index e7570b41dd21b..e833d1622e252 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h
@@ -11,12 +11,13 @@
 
 #include "PDBSymbol.h"
 #include "PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 namespace pdb {
 
-class PDBSymbolTypeDimension : public PDBSymbol {
+class LLVM_ABI PDBSymbolTypeDimension : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Dimension)
 public:
   void dump(PDBSymDumper &Dumper) const override;
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h
index 9fde421162614..5631cc8ab080c 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h
@@ -11,12 +11,13 @@
 
 #include "PDBSymbol.h"
 #include "PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 namespace pdb {
 
-class PDBSymbolTypeFriend : public PDBSymbol {
+class LLVM_ABI PDBSymbolTypeFriend : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Friend)
 public:
   void dump(PDBSymDumper &Dumper) const override;
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h
index 866bf520a3b26..9e0a27ba719db 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h
@@ -11,12 +11,13 @@
 
 #include "PDBSymbol.h"
 #include "PDBTypes.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 namespace pdb {
 
-class PDBSymbolTypeManaged : public PDBSymbol {
+class LLVM_ABI PDBSymbolTypeManaged : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::ManagedType)
 public:
   void dump(PDBSymDumper &Dumper) const override;
diff --git a/llvm/include/llvm/DebugInfo/Symbolize/SymbolizableObjectFile.h b/llvm/include/llvm/DebugInfo/Symbolize/SymbolizableObjectFile.h
index 5ef513f570b03..f0a0d65537347 100644
--- a/llvm/include/llvm/DebugInfo/Symbolize/SymbolizableObjectFile.h
+++ b/llvm/include/llvm/DebugInfo/Symbolize/SymbolizableObjectFile.h
@@ -15,6 +15,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/DebugInfo/DIContext.h"
 #include "llvm/DebugInfo/Symbolize/SymbolizableModule.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <cstdint>
 #include <memory>
@@ -28,7 +29,7 @@ class DataExtractor;
 
 namespace symbolize {
 
-class SymbolizableObjectFile : public SymbolizableModule {
+class LLVM_ABI SymbolizableObjectFile : public SymbolizableModule {
 public:
   static Expected<std::unique_ptr<SymbolizableObjectFile>>
   create(const object::ObjectFile *Obj, std::unique_ptr<DIContext> DICtx,
diff --git a/llvm/include/llvm/Demangle/Utility.h b/llvm/include/llvm/Demangle/Utility.h
index afdc1a397ca6f..56c052e6a2cf8 100644
--- a/llvm/include/llvm/Demangle/Utility.h
+++ b/llvm/include/llvm/Demangle/Utility.h
@@ -31,7 +31,7 @@ class Node;
 
 // Stream that AST nodes write their string representation into after the AST
 // has been parsed.
-class OutputBuffer {
+class DEMANGLE_ABI OutputBuffer {
   char *Buffer = nullptr;
   size_t CurrentPosition = 0;
   size_t BufferCapacity = 0;
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/COFF.h b/llvm/include/llvm/ExecutionEngine/JITLink/COFF.h
index 33b661933ace8..c6da0a6d61f92 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/COFF.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/COFF.h
@@ -14,6 +14,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_COFF_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -23,7 +24,7 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>>
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
 createLinkGraphFromCOFFObject(MemoryBufferRef ObjectBuffer,
                               std::shared_ptr<orc::SymbolStringPool> SSP);
 
@@ -31,8 +32,8 @@ createLinkGraphFromCOFFObject(MemoryBufferRef ObjectBuffer,
 ///
 /// Uses conservative defaults for GOT and stub handling based on the target
 /// platform.
-void link_COFF(std::unique_ptr<LinkGraph> G,
-               std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_COFF(std::unique_ptr<LinkGraph> G,
+                        std::unique_ptr<JITLinkContext> Ctx);
 
 } // end namespace jitlink
 } // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/COFF_x86_64.h b/llvm/include/llvm/ExecutionEngine/JITLink/COFF_x86_64.h
index 2072ae9dfdbe7..337d7f83c25aa 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/COFF_x86_64.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/COFF_x86_64.h
@@ -14,6 +14,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_COFF_X86_64_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -23,15 +24,16 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>> createLinkGraphFromCOFFObject_x86_64(
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
+createLinkGraphFromCOFFObject_x86_64(
     MemoryBufferRef ObjectBuffer, std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// jit-link the given object buffer, which must be a COFF x86-64 object file.
-void link_COFF_x86_64(std::unique_ptr<LinkGraph> G,
-                      std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_COFF_x86_64(std::unique_ptr<LinkGraph> G,
+                               std::unique_ptr<JITLinkContext> Ctx);
 
 /// Return the string name of the given COFF x86-64 edge kind.
-const char *getCOFFX86RelocationKindName(Edge::Kind R);
+LLVM_ABI const char *getCOFFX86RelocationKindName(Edge::Kind R);
 } // end namespace jitlink
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/DWARFRecordSectionSplitter.h b/llvm/include/llvm/ExecutionEngine/JITLink/DWARFRecordSectionSplitter.h
index d748d4b0fa592..4142b04c04b05 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/DWARFRecordSectionSplitter.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/DWARFRecordSectionSplitter.h
@@ -10,6 +10,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_DWARFRECORDSECTIONSPLITTER_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -20,8 +21,8 @@ namespace jitlink {
 /// without EHFrameEdgeFixer, which is responsible for adding FDE-to-CIE edges.
 class DWARFRecordSectionSplitter {
 public:
-  DWARFRecordSectionSplitter(StringRef SectionName);
-  Error operator()(LinkGraph &G);
+  LLVM_ABI DWARFRecordSectionSplitter(StringRef SectionName);
+  LLVM_ABI Error operator()(LinkGraph &G);
 
 private:
   Error processBlock(LinkGraph &G, Block &B, LinkGraph::SplitBlockCache &Cache);
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF.h
index 3decba65f380c..fe3eecbe79b7e 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF.h
@@ -14,6 +14,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_ELF_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -23,7 +24,7 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>>
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
 createLinkGraphFromELFObject(MemoryBufferRef ObjectBuffer,
                              std::shared_ptr<orc::SymbolStringPool> SSP);
 
@@ -31,8 +32,8 @@ createLinkGraphFromELFObject(MemoryBufferRef ObjectBuffer,
 ///
 /// Uses conservative defaults for GOT and stub handling based on the target
 /// platform.
-void link_ELF(std::unique_ptr<LinkGraph> G,
-              std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_ELF(std::unique_ptr<LinkGraph> G,
+                       std::unique_ptr<JITLinkContext> Ctx);
 
 } // end namespace jitlink
 } // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch32.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch32.h
index b865414e520c2..ca4020779ee2d 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch32.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch32.h
@@ -15,6 +15,7 @@
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
 #include "llvm/ExecutionEngine/JITLink/aarch32.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -24,13 +25,14 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>> createLinkGraphFromELFObject_aarch32(
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
+createLinkGraphFromELFObject_aarch32(
     MemoryBufferRef ObjectBuffer, std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// jit-link the given object buffer, which must be an ELF arm/thumb object
 /// file.
-void link_ELF_aarch32(std::unique_ptr<LinkGraph> G,
-                      std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_ELF_aarch32(std::unique_ptr<LinkGraph> G,
+                               std::unique_ptr<JITLinkContext> Ctx);
 
 } // end namespace jitlink
 } // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch64.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch64.h
index 45a7a0100593f..04ed98ba23f2c 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch64.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch64.h
@@ -16,6 +16,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_ELF_AARCH64_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -25,13 +26,14 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>> createLinkGraphFromELFObject_aarch64(
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
+createLinkGraphFromELFObject_aarch64(
     MemoryBufferRef ObjectBuffer, std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// jit-link the given object buffer, which must be a ELF aarch64 relocatable
 /// object file.
-void link_ELF_aarch64(std::unique_ptr<LinkGraph> G,
-                      std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_ELF_aarch64(std::unique_ptr<LinkGraph> G,
+                               std::unique_ptr<JITLinkContext> Ctx);
 
 } // end namespace jitlink
 } // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_loongarch.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_loongarch.h
index a8655dc6f14e3..b916c0159a12a 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_loongarch.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_loongarch.h
@@ -16,6 +16,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_ELF_LOONGARCH_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -25,17 +26,18 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>> createLinkGraphFromELFObject_loongarch(
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
+createLinkGraphFromELFObject_loongarch(
     MemoryBufferRef ObjectBuffer, std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// jit-link the given object buffer, which must be an ELF loongarch object
 /// file.
-void link_ELF_loongarch(std::unique_ptr<LinkGraph> G,
-                        std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_ELF_loongarch(std::unique_ptr<LinkGraph> G,
+                                 std::unique_ptr<JITLinkContext> Ctx);
 
 /// Returns a pass that performs linker relaxation. Should be added to
 /// PostAllocationPasses.
-LinkGraphPassFunction createRelaxationPass_ELF_loongarch();
+LLVM_ABI LinkGraphPassFunction createRelaxationPass_ELF_loongarch();
 
 } // end namespace jitlink
 } // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_ppc64.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_ppc64.h
index c5049a54cdf1d..2210614540e91 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_ppc64.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_ppc64.h
@@ -14,6 +14,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_ELF_PPC64_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm::jitlink {
 
@@ -24,7 +25,7 @@ namespace llvm::jitlink {
 /// outlives the graph.
 ///
 /// WARNING: The big-endian backend has not been tested yet.
-Expected<std::unique_ptr<LinkGraph>>
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
 createLinkGraphFromELFObject_ppc64(MemoryBufferRef ObjectBuffer,
                                    std::shared_ptr<orc::SymbolStringPool> SSP);
 
@@ -33,18 +34,19 @@ createLinkGraphFromELFObject_ppc64(MemoryBufferRef ObjectBuffer,
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>> createLinkGraphFromELFObject_ppc64le(
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
+createLinkGraphFromELFObject_ppc64le(
     MemoryBufferRef ObjectBuffer, std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// jit-link the given object buffer, which must be a ELF ppc64le object file.
 ///
 /// WARNING: The big-endian backend has not been tested yet.
-void link_ELF_ppc64(std::unique_ptr<LinkGraph> G,
-                    std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_ELF_ppc64(std::unique_ptr<LinkGraph> G,
+                             std::unique_ptr<JITLinkContext> Ctx);
 
 /// jit-link the given object buffer, which must be a ELF ppc64le object file.
-void link_ELF_ppc64le(std::unique_ptr<LinkGraph> G,
-                      std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_ELF_ppc64le(std::unique_ptr<LinkGraph> G,
+                               std::unique_ptr<JITLinkContext> Ctx);
 
 } // end namespace llvm::jitlink
 
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h
index d00b5c2868baf..88f2b11b8da8a 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h
@@ -16,6 +16,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_ELF_RISCV_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -25,17 +26,17 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>>
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
 createLinkGraphFromELFObject_riscv(MemoryBufferRef ObjectBuffer,
                                    std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// jit-link the given object buffer, which must be a ELF riscv object file.
-void link_ELF_riscv(std::unique_ptr<LinkGraph> G,
-                    std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_ELF_riscv(std::unique_ptr<LinkGraph> G,
+                             std::unique_ptr<JITLinkContext> Ctx);
 
 /// Returns a pass that performs linker relaxation. Should be added to
 /// PostAllocationPasses.
-LinkGraphPassFunction createRelaxationPass_ELF_riscv();
+LLVM_ABI LinkGraphPassFunction createRelaxationPass_ELF_riscv();
 
 } // end namespace jitlink
 } // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_systemz.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_systemz.h
index a996dfd9543df..744e4c7daecc7 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_systemz.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_systemz.h
@@ -16,6 +16,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_ELF_SYSTEMZ_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -25,13 +26,14 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>> createLinkGraphFromELFObject_systemz(
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
+createLinkGraphFromELFObject_systemz(
     MemoryBufferRef ObjectBuffer, std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// jit-link the given object buffer, which must be a ELF systemz relocatable
 /// object file.
-void link_ELF_systemz(std::unique_ptr<LinkGraph> G,
-                      std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_ELF_systemz(std::unique_ptr<LinkGraph> G,
+                               std::unique_ptr<JITLinkContext> Ctx);
 
 } // end namespace jitlink
 } // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86.h
index 82151f93a00bc..768ac7508e4f6 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86.h
@@ -16,6 +16,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_ELF_X86_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -25,14 +26,14 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>>
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
 createLinkGraphFromELFObject_x86(MemoryBufferRef ObjectBuffer,
                                  std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// jit-link the given object buffer, which must be a ELF x86 relocatable
 /// object file.
-void link_ELF_x86(std::unique_ptr<LinkGraph> G,
-                  std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_ELF_x86(std::unique_ptr<LinkGraph> G,
+                           std::unique_ptr<JITLinkContext> Ctx);
 
 } // end namespace jitlink
 } // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h
index c4f2c532de745..8460942bdbca2 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h
@@ -14,6 +14,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_ELF_X86_64_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -23,13 +24,13 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>>
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
 createLinkGraphFromELFObject_x86_64(MemoryBufferRef ObjectBuffer,
                                     std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// jit-link the given object buffer, which must be a ELF x86-64 object file.
-void link_ELF_x86_64(std::unique_ptr<LinkGraph> G,
-                     std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_ELF_x86_64(std::unique_ptr<LinkGraph> G,
+                              std::unique_ptr<JITLinkContext> Ctx);
 
 } // end namespace jitlink
 } // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/XCOFF.h b/llvm/include/llvm/ExecutionEngine/JITLink/XCOFF.h
index 3d181d0786eb7..53c3561ceeecd 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/XCOFF.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/XCOFF.h
@@ -14,6 +14,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_XCOFF_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace jitlink {
@@ -23,13 +24,13 @@ namespace jitlink {
 /// Note: The graph does not take ownership of the underlying buffer, nor copy
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
-Expected<std::unique_ptr<LinkGraph>>
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
 createLinkGraphFromXCOFFObject(MemoryBufferRef ObjectBuffer,
                                std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// Link the given graph.
-void link_XCOFF(std::unique_ptr<LinkGraph> G,
-                std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_XCOFF(std::unique_ptr<LinkGraph> G,
+                         std::unique_ptr<JITLinkContext> Ctx);
 
 } // namespace jitlink
 } // namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/XCOFF_ppc64.h b/llvm/include/llvm/ExecutionEngine/JITLink/XCOFF_ppc64.h
index ec5c8a37bda27..2f29a926e937f 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/XCOFF_ppc64.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/XCOFF_ppc64.h
@@ -15,6 +15,7 @@
 #define LLVM_EXECUTIONENGINE_JITLINK_XCOFF_PPC64_H
 
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm::jitlink {
 
@@ -24,13 +25,14 @@ namespace llvm::jitlink {
 /// its contents. The caller is responsible for ensuring that the object buffer
 /// outlives the graph.
 ///
-Expected<std::unique_ptr<LinkGraph>> createLinkGraphFromXCOFFObject_ppc64(
+LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
+createLinkGraphFromXCOFFObject_ppc64(
     MemoryBufferRef ObjectBuffer, std::shared_ptr<orc::SymbolStringPool> SSP);
 
 /// jit-link the given object buffer, which must be a XCOFF ppc64 object file.
 ///
-void link_XCOFF_ppc64(std::unique_ptr<LinkGraph> G,
-                      std::unique_ptr<JITLinkContext> Ctx);
+LLVM_ABI void link_XCOFF_ppc64(std::unique_ptr<LinkGraph> G,
+                               std::unique_ptr<JITLinkContext> Ctx);
 
 } // end namespace llvm::jitlink
 
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/systemz.h b/llvm/include/llvm/ExecutionEngine/JITLink/systemz.h
index 8804981775fa8..c2d4ba05e4124 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/systemz.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/systemz.h
@@ -15,6 +15,7 @@
 
 #include "TableManager.h"
 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
+#include "llvm/Support/Compiler.h"
 
 using namespace llvm::support::endian;
 
@@ -554,7 +555,7 @@ enum EdgeKind_systemz : Edge::Kind {
 
 /// Returns a string name for the given systemz edge. For debugging purposes
 /// only
-const char *getEdgeKindName(Edge::Kind K);
+LLVM_ABI const char *getEdgeKindName(Edge::Kind K);
 
 /// Apply fixup expression for edge to block content.
 inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
@@ -764,7 +765,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
 }
 
 /// SystemZ null pointer content.
-extern const char NullPointerContent[8];
+extern const LLVM_ABI char NullPointerContent[8];
 inline ArrayRef<char> getGOTEntryBlockContent(LinkGraph &G) {
   return {reinterpret_cast<const char *>(NullPointerContent),
           G.getPointerSize()};
@@ -777,7 +778,7 @@ inline ArrayRef<char> getGOTEntryBlockContent(LinkGraph &G) {
 ///   lgrl %r1, ptr
 ///   j    %r1
 constexpr size_t StubEntrySize = 8;
-extern const char Pointer64JumpStubContent[StubEntrySize];
+extern const LLVM_ABI char Pointer64JumpStubContent[StubEntrySize];
 inline ArrayRef<char> getStubBlockContent(LinkGraph &G) {
   auto StubContent = Pointer64JumpStubContent;
   return {reinterpret_cast<const char *>(StubContent), StubEntrySize};
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/ExecutorResolutionGenerator.h b/llvm/include/llvm/ExecutionEngine/Orc/ExecutorResolutionGenerator.h
index 9b972edf3e18c..0e6ef5df9523e 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/ExecutorResolutionGenerator.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/ExecutorResolutionGenerator.h
@@ -18,10 +18,11 @@
 #include "llvm/ADT/FunctionExtras.h"
 #include "llvm/ExecutionEngine/Orc/AbsoluteSymbols.h"
 #include "llvm/ExecutionEngine/Orc/Core.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm::orc {
 
-class ExecutorResolutionGenerator : public DefinitionGenerator {
+class LLVM_ABI ExecutorResolutionGenerator : public DefinitionGenerator {
 public:
   using SymbolPredicate = unique_function<bool(const SymbolStringPtr &)>;
   using AbsoluteSymbolsFn =
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorResolver.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorResolver.h
index 2c5e98c7312b9..d64249a6517f3 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorResolver.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorResolver.h
@@ -14,6 +14,7 @@
 #define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_EXECUTORRESOLVER_H
 
 #include "llvm/ADT/FunctionExtras.h"
+#include "llvm/Support/Compiler.h"
 
 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h"
 #include "llvm/ExecutionEngine/Orc/Shared/SimpleRemoteEPCUtils.h"
@@ -32,7 +33,7 @@ class ExecutorResolver {
                             YieldResolveResultFn &&OnResolve) = 0;
 };
 
-class DylibSymbolResolver : public ExecutorResolver {
+class LLVM_ABI DylibSymbolResolver : public ExecutorResolver {
 public:
   DylibSymbolResolver(tpctypes::DylibHandle H) : Handle(H) {}
 
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryResolver.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryResolver.h
index 045d259d4ecbb..0b7a67cac2ec9 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryResolver.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryResolver.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/FunctionExtras.h"
 #include "llvm/ExecutionEngine/Orc/Shared/SymbolFilter.h"
 #include "llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Path.h"
 
 #include <atomic>
@@ -386,10 +387,11 @@ class LibraryResolver {
 
     using OnEachSymbolFn = std::function<EnumerateResult(StringRef Sym)>;
 
-    static bool enumerateSymbols(object::ObjectFile *Obj, OnEachSymbolFn OnEach,
-                                 const SymbolEnumeratorOptions &Opts);
-    static bool enumerateSymbols(StringRef Path, OnEachSymbolFn OnEach,
-                                 const SymbolEnumeratorOptions &Opts);
+    LLVM_ABI static bool enumerateSymbols(object::ObjectFile *Obj,
+                                          OnEachSymbolFn OnEach,
+                                          const SymbolEnumeratorOptions &Opts);
+    LLVM_ABI static bool enumerateSymbols(StringRef Path, OnEachSymbolFn OnEach,
+                                          const SymbolEnumeratorOptions &Opts);
   };
 
   /// Tracks a set of symbols and the libraries where they are resolved.
@@ -515,7 +517,7 @@ class LibraryResolver {
   };
 
   LibraryResolver() = delete;
-  explicit LibraryResolver(const Setup &S);
+  LLVM_ABI explicit LibraryResolver(const Setup &S);
   ~LibraryResolver() = default;
 
   using OnSearchComplete = unique_function<void(SymbolQuery &)>;
@@ -533,12 +535,13 @@ class LibraryResolver {
     });
   }
 
-  void searchSymbolsInLibraries(ArrayRef<StringRef> SymList,
-                                OnSearchComplete OnComplete,
-                                const SearchConfig &Config = SearchConfig());
+  LLVM_ABI void
+  searchSymbolsInLibraries(ArrayRef<StringRef> SymList,
+                           OnSearchComplete OnComplete,
+                           const SearchConfig &Config = SearchConfig());
 
 private:
-  bool scanLibrariesIfNeeded(PathType K, size_t BatchSize = 0);
+  LLVM_ABI bool scanLibrariesIfNeeded(PathType K, size_t BatchSize = 0);
   bool scanForNewLibraries(PathType K, LibraryCursor &Cur);
   void resolveSymbolsInLibrary(LibraryInfo *Lib, SymbolQuery &Q,
                                const SymbolEnumeratorOptions &Opts);
@@ -558,12 +561,12 @@ using EnumerateResult = SymbolEnumerator::EnumerateResult;
 
 class LibraryResolutionDriver {
 public:
-  static std::unique_ptr<LibraryResolutionDriver>
+  LLVM_ABI static std::unique_ptr<LibraryResolutionDriver>
   create(const LibraryResolver::Setup &S);
 
-  void addScanPath(const std::string &Path, PathType Kind);
-  void markLibraryLoaded(StringRef Path);
-  void markLibraryUnLoaded(StringRef Path);
+  LLVM_ABI void addScanPath(const std::string &Path, PathType Kind);
+  LLVM_ABI void markLibraryLoaded(StringRef Path);
+  LLVM_ABI void markLibraryUnLoaded(StringRef Path);
   bool isLibraryLoaded(StringRef Path) const {
     return LR->LibMgr.isLoaded(Path);
   }
@@ -583,9 +586,9 @@ class LibraryResolutionDriver {
     LR->scanLibrariesIfNeeded(PK, BatchSize);
   }
 
-  void resolveSymbols(ArrayRef<StringRef> Symbols,
-                      LibraryResolver::OnSearchComplete OnCompletion,
-                      const SearchConfig &Config = SearchConfig());
+  LLVM_ABI void resolveSymbols(ArrayRef<StringRef> Symbols,
+                               LibraryResolver::OnSearchComplete OnCompletion,
+                               const SearchConfig &Config = SearchConfig());
 
   ~LibraryResolutionDriver() = default;
 
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h
index abfcbee1d2e5c..37a424709f2b9 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Object/ObjectFile.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/StringSaver.h"
 
@@ -152,13 +153,12 @@ class PathResolver {
     return realpathCached(Path, ec);
   }
 #ifndef _WIN32
-  mode_t lstatCached(StringRef Path);
-  std::optional<std::string> readlinkCached(StringRef Path);
+  LLVM_ABI mode_t lstatCached(StringRef Path);
+  LLVM_ABI std::optional<std::string> readlinkCached(StringRef Path);
 #endif
-  std::optional<std::string> realpathCached(StringRef Path, std::error_code &ec,
-                                            StringRef base = "",
-                                            bool baseIsResolved = false,
-                                            long symloopLevel = 40);
+  LLVM_ABI std::optional<std::string>
+  realpathCached(StringRef Path, std::error_code &ec, StringRef base = "",
+                 bool baseIsResolved = false, long symloopLevel = 40);
 };
 
 /// Performs placeholder substitution in dynamic library paths.
@@ -167,7 +167,7 @@ class PathResolver {
 /// in input paths with their resolved values.
 class DylibSubstitutor {
 public:
-  void configure(StringRef loaderPath);
+  LLVM_ABI void configure(StringRef loaderPath);
 
   std::string substitute(StringRef input) const {
     for (const auto &[ph, value] : Placeholders) {
@@ -219,14 +219,14 @@ class ObjectFileLoader {
     return *Obj.getBinary();
   }
 
-  static bool isArchitectureCompatible(const object::ObjectFile &Obj);
+  LLVM_ABI static bool isArchitectureCompatible(const object::ObjectFile &Obj);
 
 private:
   object::OwningBinary<object::ObjectFile> Obj;
   Error Err = Error::success();
   bool ErrorTaken = false;
 
-  static Expected<object::OwningBinary<object::ObjectFile>>
+  LLVM_ABI static Expected<object::OwningBinary<object::ObjectFile>>
   loadObjectFileWithOwnership(StringRef FilePath);
 };
 
@@ -265,7 +265,7 @@ class DylibPathValidator {
                      ObjFileCache *ObjCache = nullptr)
       : LibPathResolver(PR), LibPathCache(LC), ObjCache(ObjCache) {}
 
-  bool isSharedLibrary(StringRef Path) const;
+  LLVM_ABI bool isSharedLibrary(StringRef Path) const;
   bool isSharedLibraryCached(StringRef Path) const {
     if (LibPathCache.hasSeen(Path))
       return true;
@@ -322,9 +322,9 @@ class SearchPathResolver {
       Paths.emplace_back(path.str());
   }
 
-  std::optional<std::string> resolve(StringRef libStem,
-                                     const DylibSubstitutor &Subst,
-                                     DylibPathValidator &Validator) const;
+  LLVM_ABI std::optional<std::string>
+  resolve(StringRef libStem, const DylibSubstitutor &Subst,
+          DylibPathValidator &Validator) const;
   SearchPathType searchPathType() const { return Kind; }
 
 private:
@@ -340,8 +340,8 @@ class DylibResolverImpl {
       : Substitutor(std::move(Substitutor)), Validator(Validator),
         Resolvers(std::move(Resolvers)) {}
 
-  std::optional<std::string> resolve(StringRef Stem,
-                                     bool VariateLibStem = false) const;
+  LLVM_ABI std::optional<std::string>
+  resolve(StringRef Stem, bool VariateLibStem = false) const;
 
 private:
   std::optional<std::string> tryWithExtensions(StringRef libstem) const;
@@ -420,18 +420,18 @@ class LibraryScanHelper {
       addBasePath(p);
   }
 
-  void
+  LLVM_ABI void
   addBasePath(const std::string &P,
               PathType Kind =
                   PathType::Unknown); // Add a canonical directory for scanning
 
-  void getNextBatch(PathType Kind, size_t batchSize,
-                    SmallVectorImpl<const LibrarySearchPath *> &Out);
+  LLVM_ABI void getNextBatch(PathType Kind, size_t batchSize,
+                             SmallVectorImpl<const LibrarySearchPath *> &Out);
 
-  bool leftToScan(PathType K) const;
-  void resetToScan();
+  LLVM_ABI bool leftToScan(PathType K) const;
+  LLVM_ABI void resetToScan();
 
-  bool isTrackedBasePath(StringRef P) const;
+  LLVM_ABI bool isTrackedBasePath(StringRef P) const;
   bool hasSearchPath() const { return !LibSearchPaths.empty(); }
 
   SmallVector<StringRef> getSearchPaths() const {
@@ -480,7 +480,7 @@ class LibraryScanner {
                   &ObjCache),
         ShouldScanCall(std::move(ShouldScanCall)) {}
 
-  void scanNext(PathType Kind, size_t batchSize = 1);
+  LLVM_ABI void scanNext(PathType Kind, size_t batchSize = 1);
 
   /// Dependency info for a library.
   struct LibraryDepsInfo {
diff --git a/llvm/include/llvm/Frontend/HLSL/CBuffer.h b/llvm/include/llvm/Frontend/HLSL/CBuffer.h
index f4e232ffe1745..f46ec46557410 100644
--- a/llvm/include/llvm/Frontend/HLSL/CBuffer.h
+++ b/llvm/include/llvm/Frontend/HLSL/CBuffer.h
@@ -16,6 +16,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/DerivedTypes.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
@@ -46,14 +47,14 @@ class CBufferMetadata {
   CBufferMetadata(NamedMDNode *MD) : MD(MD) {}
 
 public:
-  static std::optional<CBufferMetadata>
+  LLVM_ABI static std::optional<CBufferMetadata>
   get(Module &M, llvm::function_ref<bool(Type *)> IsPadding);
 
   using iterator = SmallVector<CBufferMapping>::iterator;
   iterator begin() { return Mappings.begin(); }
   iterator end() { return Mappings.end(); }
 
-  void eraseFromModule();
+  LLVM_ABI void eraseFromModule();
 };
 
 } // namespace hlsl
diff --git a/llvm/include/llvm/Frontend/HLSL/HLSLBinding.h b/llvm/include/llvm/Frontend/HLSL/HLSLBinding.h
index 8afa7687a17c6..8386deaad469a 100644
--- a/llvm/include/llvm/Frontend/HLSL/HLSLBinding.h
+++ b/llvm/include/llvm/Frontend/HLSL/HLSLBinding.h
@@ -174,7 +174,7 @@ class BindingInfoBuilder {
         [&HasOverlap](auto, auto) { HasOverlap = true; });
   }
 
-  LLVM_ABI BoundRegs takeBoundRegs() {
+  BoundRegs takeBoundRegs() {
     assert(std::is_sorted(Bindings.begin(), Bindings.end()) &&
            "takeBoundRegs should only be called after calculateBindingInfo");
     return BoundRegs(std::move(Bindings));
diff --git a/llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h b/llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h
index 7ef6667a5437d..509c0b816f79e 100644
--- a/llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h
+++ b/llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h
@@ -30,7 +30,7 @@ namespace rootsig {
 class RootSignatureValidationError
     : public ErrorInfo<RootSignatureValidationError> {
 public:
-  static char ID;
+  LLVM_ABI static char ID;
   std::string Msg;
 
   RootSignatureValidationError(const Twine &Msg) : Msg(Msg.str()) {}
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.h b/llvm/include/llvm/Frontend/OpenMP/OMP.h
index d5d08aed76e12..1b18a426e8d63 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.h
@@ -73,7 +73,7 @@ LLVM_ABI ArrayRef<unsigned> getOpenMPVersions();
 
 /// Can directive D, under some circumstances, create a private copy
 /// of a variable in given OpenMP version?
-bool isPrivatizingConstruct(Directive D, unsigned Version);
+LLVM_ABI bool isPrivatizingConstruct(Directive D, unsigned Version);
 
 /// Create a nicer version of a function name for humans to look at.
 LLVM_ABI std::string prettifyFunctionName(StringRef FunctionName);
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index 037fcaa863fe7..a9075e320e187 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -592,12 +592,13 @@ class OpenMPIRBuilder {
     /// The basic block to which control should be transferred to
     /// implement the FiniCB. Memoized to avoid generating finalization
     /// multiple times.
-    Expected<BasicBlock *> getFiniBB(IRBuilderBase &Builder);
+    LLVM_ABI Expected<BasicBlock *> getFiniBB(IRBuilderBase &Builder);
 
     /// For cases where there is an unavoidable existing finalization block
     /// (e.g. loop finialization after omp sections). The existing finalization
     /// block must not contain any non-finalization code.
-    Error mergeFiniBB(IRBuilderBase &Builder, BasicBlock *ExistingFiniBB);
+    LLVM_ABI Error mergeFiniBB(IRBuilderBase &Builder,
+                               BasicBlock *ExistingFiniBB);
 
   private:
     /// Access via getFiniBB.
@@ -2309,9 +2310,9 @@ class OpenMPIRBuilder {
 
   LLVM_ABI Function *getOrCreateRuntimeFunctionPtr(omp::RuntimeFunction FnID);
 
-  CallInst *createRuntimeFunctionCall(FunctionCallee Callee,
-                                      ArrayRef<Value *> Args,
-                                      StringRef Name = "");
+  LLVM_ABI CallInst *createRuntimeFunctionCall(FunctionCallee Callee,
+                                               ArrayRef<Value *> Args,
+                                               StringRef Name = "");
 
   /// Return the (LLVM-IR) string describing the source location \p LocStr.
   LLVM_ABI Constant *getOrCreateSrcLocStr(StringRef LocStr,
diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index 534d96d2c46e5..e2fc7241328bf 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -442,7 +442,8 @@ class AttributeSet {
 
   /// Add attributes to the attribute set. Returns a new set because attribute
   /// sets are immutable.
-  AttributeSet addAttributes(LLVMContext &C, const AttrBuilder &B) const;
+  LLVM_ABI AttributeSet addAttributes(LLVMContext &C,
+                                      const AttrBuilder &B) const;
 
   /// Remove the specified attribute from this set. Returns a new set because
   /// attribute sets are immutable.
diff --git a/llvm/include/llvm/IR/AutoUpgrade.h b/llvm/include/llvm/IR/AutoUpgrade.h
index 540d60afc5a01..e60514d86d0ea 100644
--- a/llvm/include/llvm/IR/AutoUpgrade.h
+++ b/llvm/include/llvm/IR/AutoUpgrade.h
@@ -104,7 +104,7 @@ namespace llvm {
   ///  - guarded-control-stack
   ///  - sign-return-address
   ///  - sign-return-address-with-bkey
-  void copyModuleAttrToFunctions(Module &M);
+  LLVM_ABI void copyModuleAttrToFunctions(Module &M);
 
   /// Check whether a string looks like an old loop attachment tag.
   inline bool mayBeOldLoopAttachmentTag(StringRef Name) {
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index a41379b974069..9bea5d9f1cb45 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -2521,9 +2521,9 @@ class DISubprogram : public DILocalScope {
   }
 
   /// Returns the scope of subprogram's retainedNodes.
-  static const DILocalScope *getRetainedNodeScope(const MDNode *N);
+  LLVM_ABI static const DILocalScope *getRetainedNodeScope(const MDNode *N);
   // For use in Verifier.
-  static const DIScope *getRawRetainedNodeScope(const MDNode *N);
+  LLVM_ABI static const DIScope *getRawRetainedNodeScope(const MDNode *N);
 
   /// For each retained node, applies one of the given functions depending
   /// on the type of a node.
diff --git a/llvm/include/llvm/IR/GVMaterializer.h b/llvm/include/llvm/IR/GVMaterializer.h
index d62da41ebc296..b535671c2b81a 100644
--- a/llvm/include/llvm/IR/GVMaterializer.h
+++ b/llvm/include/llvm/IR/GVMaterializer.h
@@ -17,6 +17,7 @@
 #ifndef LLVM_IR_GVMATERIALIZER_H
 #define LLVM_IR_GVMATERIALIZER_H
 
+#include "llvm/Support/Compiler.h"
 #include <vector>
 
 namespace llvm {
@@ -25,7 +26,7 @@ class Error;
 class GlobalValue;
 class StructType;
 
-class GVMaterializer {
+class LLVM_ABI GVMaterializer {
 protected:
   GVMaterializer() = default;
 
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index d4ea74c05ae62..278ceb2454919 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -4972,10 +4972,11 @@ class PtrToAddrInst : public CastInst {
   friend class Instruction;
 
   /// Clone an identical PtrToAddrInst.
-  PtrToAddrInst *cloneImpl() const;
+  LLVM_ABI PtrToAddrInst *cloneImpl() const;
 
 public:
   /// Constructor with insert-before-instruction semantics
+  LLVM_ABI
   PtrToAddrInst(Value *S,                  ///< The value to be converted
                 Type *Ty,                  ///< The type to convert to
                 const Twine &NameStr = "", ///< A name for the new instruction
diff --git a/llvm/include/llvm/IR/NVVMIntrinsicUtils.h b/llvm/include/llvm/IR/NVVMIntrinsicUtils.h
index 067290e57245a..5d5f5a6fe9f27 100644
--- a/llvm/include/llvm/IR/NVVMIntrinsicUtils.h
+++ b/llvm/include/llvm/IR/NVVMIntrinsicUtils.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_IR_NVVMINTRINSICUTILS_H
 #define LLVM_IR_NVVMINTRINSICUTILS_H
 
+#include "llvm/Support/Compiler.h"
 #include <stdint.h>
 
 #include "llvm/ADT/APFloat.h"
@@ -104,15 +105,21 @@ enum class TensormapFillMode : uint8_t {
   OOB_NAN_FILL = 1,
 };
 
-void printTcgen05MMAKind(raw_ostream &OS, const Constant *ImmArgVal);
-
-void printTcgen05CollectorUsageOp(raw_ostream &OS, const Constant *ImmArgVal);
-
-void printTensormapElemType(raw_ostream &OS, const Constant *ImmArgVal);
-void printTensormapInterleaveLayout(raw_ostream &OS, const Constant *ImmArgVal);
-void printTensormapSwizzleMode(raw_ostream &OS, const Constant *ImmArgVal);
-void printTensormapSwizzleAtomicity(raw_ostream &OS, const Constant *ImmArgVal);
-void printTensormapFillMode(raw_ostream &OS, const Constant *ImmArgVal);
+LLVM_ABI void printTcgen05MMAKind(raw_ostream &OS, const Constant *ImmArgVal);
+
+LLVM_ABI void printTcgen05CollectorUsageOp(raw_ostream &OS,
+                                           const Constant *ImmArgVal);
+
+LLVM_ABI void printTensormapElemType(raw_ostream &OS,
+                                     const Constant *ImmArgVal);
+LLVM_ABI void printTensormapInterleaveLayout(raw_ostream &OS,
+                                             const Constant *ImmArgVal);
+LLVM_ABI void printTensormapSwizzleMode(raw_ostream &OS,
+                                        const Constant *ImmArgVal);
+LLVM_ABI void printTensormapSwizzleAtomicity(raw_ostream &OS,
+                                             const Constant *ImmArgVal);
+LLVM_ABI void printTensormapFillMode(raw_ostream &OS,
+                                     const Constant *ImmArgVal);
 
 inline bool FPToIntegerIntrinsicShouldFTZ(Intrinsic::ID IntrinsicID) {
   switch (IntrinsicID) {
diff --git a/llvm/include/llvm/IR/PrintPasses.h b/llvm/include/llvm/IR/PrintPasses.h
index 0aa1b379c35cf..4624324e2dc47 100644
--- a/llvm/include/llvm/IR/PrintPasses.h
+++ b/llvm/include/llvm/IR/PrintPasses.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 #include <vector>
 
 namespace llvm {
@@ -27,59 +28,61 @@ enum class ChangePrinter {
   DotCfgQuiet
 };
 
-extern cl::opt<ChangePrinter> PrintChanged;
+extern LLVM_ABI cl::opt<ChangePrinter> PrintChanged;
 
 // Returns true if printing before/after some pass is enabled, whether all
 // passes or a specific pass.
-bool shouldPrintBeforeSomePass();
-bool shouldPrintAfterSomePass();
+LLVM_ABI bool shouldPrintBeforeSomePass();
+LLVM_ABI bool shouldPrintAfterSomePass();
 
 // Returns true if we should print before/after a specific pass. The argument
 // should be the pass ID, e.g. "instcombine".
-bool shouldPrintBeforePass(StringRef PassID);
-bool shouldPrintAfterPass(StringRef PassID);
+LLVM_ABI bool shouldPrintBeforePass(StringRef PassID);
+LLVM_ABI bool shouldPrintAfterPass(StringRef PassID);
 
 // Returns true if we should print before/after all passes.
-bool shouldPrintBeforeAll();
-bool shouldPrintAfterAll();
+LLVM_ABI bool shouldPrintBeforeAll();
+LLVM_ABI bool shouldPrintAfterAll();
 
 // The list of passes to print before/after, if we only want to print
 // before/after specific passes.
-std::vector<std::string> printBeforePasses();
-std::vector<std::string> printAfterPasses();
+LLVM_ABI std::vector<std::string> printBeforePasses();
+LLVM_ABI std::vector<std::string> printAfterPasses();
 
 // Returns true if we should always print the entire module.
-bool forcePrintModuleIR();
+LLVM_ABI bool forcePrintModuleIR();
 
 // Returns true if we should print the entire function for loop passes.
-bool forcePrintFuncIR();
+LLVM_ABI bool forcePrintFuncIR();
 
 // Return true if -filter-passes is empty or contains the pass name.
-bool isPassInPrintList(StringRef PassName);
-bool isFilterPassesEmpty();
+LLVM_ABI bool isPassInPrintList(StringRef PassName);
+LLVM_ABI bool isFilterPassesEmpty();
 
 // Returns true if we should print the function.
-bool isFunctionInPrintList(StringRef FunctionName);
+LLVM_ABI bool isFunctionInPrintList(StringRef FunctionName);
 
 // Ensure temporary files exist, creating or re-using them.  \p FD contains
 // file descriptors (-1 indicates that the file should be created) and
 // \p SR contains the corresponding initial content.  \p FileName will have
 // the filenames filled in when creating files.  Return first error code (if
 // any) and stop.
-std::error_code prepareTempFiles(SmallVector<int> &FD, ArrayRef<StringRef> SR,
-                                 SmallVector<std::string> &FileName);
+LLVM_ABI std::error_code prepareTempFiles(SmallVector<int> &FD,
+                                          ArrayRef<StringRef> SR,
+                                          SmallVector<std::string> &FileName);
 
 // Remove the temporary files in \p FileName.  Typically used in conjunction
 // with prepareTempFiles.  Return first error code (if any) and stop..
-std::error_code cleanUpTempFiles(ArrayRef<std::string> FileName);
+LLVM_ABI std::error_code cleanUpTempFiles(ArrayRef<std::string> FileName);
 
 // Perform a system based diff between \p Before and \p After, using \p
 // OldLineFormat, \p NewLineFormat, and \p UnchangedLineFormat to control the
 // formatting of the output. Return an error message for any failures instead
 // of the diff.
-std::string doSystemDiff(StringRef Before, StringRef After,
-                         StringRef OldLineFormat, StringRef NewLineFormat,
-                         StringRef UnchangedLineFormat);
+LLVM_ABI std::string doSystemDiff(StringRef Before, StringRef After,
+                                  StringRef OldLineFormat,
+                                  StringRef NewLineFormat,
+                                  StringRef UnchangedLineFormat);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index fa092909d630d..8f053dfb93d99 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -87,7 +87,7 @@ struct RuntimeLibcallsInfo {
       EABI EABIVersion = EABI::Default, StringRef ABIName = "",
       VectorLibrary VecLib = VectorLibrary::NoLibrary);
 
-  explicit RuntimeLibcallsInfo(const Module &M);
+  LLVM_ABI explicit RuntimeLibcallsInfo(const Module &M);
 
   LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
                            ModuleAnalysisManager::Invalidator &);
@@ -136,18 +136,17 @@ struct RuntimeLibcallsInfo {
   /// name may exist but differ in interpretation based on the target context.
   ///
   /// Generated by tablegen.
-  LLVM_ABI static inline iota_range<RTLIB::LibcallImpl>
-  lookupLibcallImplName(StringRef Name){
-  // Inlining the early exit on the string name appears to be worthwhile when
-  // querying a real set of symbols
+  static inline iota_range<RTLIB::LibcallImpl>
+  lookupLibcallImplName(StringRef Name) {
+    // Inlining the early exit on the string name appears to be worthwhile when
+    // querying a real set of symbols
 #define GET_LOOKUP_LIBCALL_IMPL_NAME_BODY
 #include "llvm/IR/RuntimeLibcalls.inc"
   }
 
   /// Check if this is valid libcall for the current module, otherwise
   /// RTLIB::Unsupported.
-  LLVM_ABI RTLIB::LibcallImpl
-      getSupportedLibcallImpl(StringRef FuncName) const {
+  RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const {
     for (RTLIB::LibcallImpl Impl : lookupLibcallImplName(FuncName)) {
       if (isAvailable(Impl))
         return Impl;
@@ -159,13 +158,13 @@ struct RuntimeLibcallsInfo {
   /// \returns the function type and attributes for the \p LibcallImpl,
   /// depending on the target \p TT. If the function has incomplete type
   /// information, return nullptr for the function type.
-  std::pair<FunctionType *, AttributeList>
+  LLVM_ABI std::pair<FunctionType *, AttributeList>
   getFunctionTy(LLVMContext &Ctx, const Triple &TT, const DataLayout &DL,
                 RTLIB::LibcallImpl LibcallImpl) const;
 
   /// Returns true if the function has a vector mask argument, which is assumed
   /// to be the last argument.
-  static bool hasVectorMaskArgument(RTLIB::LibcallImpl Impl);
+  LLVM_ABI static bool hasVectorMaskArgument(RTLIB::LibcallImpl Impl);
 
 private:
   LLVM_ABI static iota_range<RTLIB::LibcallImpl>
diff --git a/llvm/include/llvm/IR/SafepointIRVerifier.h b/llvm/include/llvm/IR/SafepointIRVerifier.h
index 2ee998e4c68ff..c59fac284382c 100644
--- a/llvm/include/llvm/IR/SafepointIRVerifier.h
+++ b/llvm/include/llvm/IR/SafepointIRVerifier.h
@@ -19,6 +19,7 @@
 #define LLVM_IR_SAFEPOINTIRVERIFIER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -26,11 +27,11 @@ class Function;
 class FunctionPass;
 
 /// Run the safepoint verifier over a single function.  Crashes on failure.
-void verifySafepointIR(Function &F);
+LLVM_ABI void verifySafepointIR(Function &F);
 
 /// Create an instance of the safepoint verifier pass which can be added to
 /// a pass pipeline to check for relocation bugs.
-FunctionPass *createSafepointIRVerifierPass();
+LLVM_ABI FunctionPass *createSafepointIRVerifierPass();
 
 /// Create an instance of the safepoint verifier pass which can be added to
 /// a pass pipeline to check for relocation bugs.
@@ -39,7 +40,7 @@ class SafepointIRVerifierPass : public PassInfoMixin<SafepointIRVerifierPass> {
 public:
   explicit SafepointIRVerifierPass() = default;
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   static bool isRequired() { return true; }
 };
diff --git a/llvm/include/llvm/IR/Statepoint.h b/llvm/include/llvm/IR/Statepoint.h
index 8c508492f704a..af1c8de45b7c6 100644
--- a/llvm/include/llvm/IR/Statepoint.h
+++ b/llvm/include/llvm/IR/Statepoint.h
@@ -25,6 +25,7 @@
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Intrinsics.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/MathExtras.h"
 #include <cassert>
 #include <cstddef>
@@ -242,11 +243,12 @@ struct StatepointDirectives {
 
 /// Parse out statepoint directives from the function attributes present in \p
 /// AS.
-StatepointDirectives parseStatepointDirectivesFromAttrs(AttributeList AS);
+LLVM_ABI StatepointDirectives
+parseStatepointDirectivesFromAttrs(AttributeList AS);
 
 /// Return \c true if the \p Attr is an attribute that is a statepoint
 /// directive.
-bool isStatepointDirectiveAttr(Attribute Attr);
+LLVM_ABI bool isStatepointDirectiveAttr(Attribute Attr);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/IR/TypeFinder.h b/llvm/include/llvm/IR/TypeFinder.h
index dd2b70c65c2d2..b324200925ef9 100644
--- a/llvm/include/llvm/IR/TypeFinder.h
+++ b/llvm/include/llvm/IR/TypeFinder.h
@@ -15,6 +15,7 @@
 
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/IR/Attributes.h"
+#include "llvm/Support/Compiler.h"
 #include <cstddef>
 #include <vector>
 
@@ -42,8 +43,8 @@ class TypeFinder {
 public:
   TypeFinder() = default;
 
-  void run(const Module &M, bool onlyNamed);
-  void clear();
+  LLVM_ABI void run(const Module &M, bool onlyNamed);
+  LLVM_ABI void clear();
 
   using iterator = std::vector<StructType*>::iterator;
   using const_iterator = std::vector<StructType*>::const_iterator;
diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index 4011065ec37a6..a5a3ccd8562b8 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -173,7 +173,7 @@ class InputFile {
     // may emit references to. Such symbols must be considered external, as
     // removing them or modifying their interfaces would invalidate the code
     // generator's knowledge about them.
-    bool isLibcall(const RTLIB::RuntimeLibcallsInfo &Libcalls) const;
+    LLVM_ABI bool isLibcall(const RTLIB::RuntimeLibcallsInfo &Libcalls) const;
   };
 
   /// A range over the symbols in this InputFile.
@@ -400,7 +400,7 @@ LLVM_ABI ThinBackend createWriteIndexesThinBackend(
 /// - Call the run() function. This function will use the supplied AddStream
 ///   and Cache functions to add up to getMaxTasks() native object files to
 ///   the link.
-class LTO {
+class LLVM_ABI LTO {
   friend InputFile;
 
 public:
@@ -421,21 +421,20 @@ class LTO {
   /// this constructor.
   /// FIXME: We do currently require the DiagHandler field to be set in Conf.
   /// Until that is fixed, a Config argument is required.
-  LLVM_ABI LTO(Config Conf, ThinBackend Backend = {},
-               unsigned ParallelCodeGenParallelismLevel = 1,
-               LTOKind LTOMode = LTOK_Default);
-  LLVM_ABI virtual ~LTO();
+  LTO(Config Conf, ThinBackend Backend = {},
+      unsigned ParallelCodeGenParallelismLevel = 1,
+      LTOKind LTOMode = LTOK_Default);
+  virtual ~LTO();
 
   /// Add an input file to the LTO link, using the provided symbol resolutions.
   /// The symbol resolutions must appear in the enumeration order given by
   /// InputFile::symbols().
-  LLVM_ABI Error add(std::unique_ptr<InputFile> Obj,
-                     ArrayRef<SymbolResolution> Res);
+  Error add(std::unique_ptr<InputFile> Obj, ArrayRef<SymbolResolution> Res);
 
   /// Returns an upper bound on the number of tasks that the client may expect.
   /// This may only be called after all IR object files have been added. For a
   /// full description of tasks see LTOBackend.h.
-  LLVM_ABI unsigned getMaxTasks() const;
+  unsigned getMaxTasks() const;
 
   /// Runs the LTO pipeline. This function calls the supplied AddStream
   /// function to add native object files to the link.
@@ -445,12 +444,11 @@ class LTO {
   ///
   /// The client will receive at most one callback (via either AddStream or
   /// Cache) for each task identifier.
-  LLVM_ABI Error run(AddStreamFn AddStream, FileCache Cache = {});
+  Error run(AddStreamFn AddStream, FileCache Cache = {});
 
   /// Static method that returns a list of libcall symbols that can be generated
   /// by LTO but might not be visible from bitcode symbol table.
-  LLVM_ABI static SmallVector<const char *>
-  getRuntimeLibcallSymbols(const Triple &TT);
+  static SmallVector<const char *> getRuntimeLibcallSymbols(const Triple &TT);
 
 protected:
   // Called at the start of run().
diff --git a/llvm/include/llvm/LTO/legacy/UpdateCompilerUsed.h b/llvm/include/llvm/LTO/legacy/UpdateCompilerUsed.h
index 25a8c553ccb8c..66a27da8497cd 100644
--- a/llvm/include/llvm/LTO/legacy/UpdateCompilerUsed.h
+++ b/llvm/include/llvm/LTO/legacy/UpdateCompilerUsed.h
@@ -15,6 +15,7 @@
 
 #include "llvm/ADT/StringSet.h"
 #include "llvm/IR/GlobalValue.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Module;
@@ -24,8 +25,8 @@ class TargetMachine;
 /// \p AsmUndefinedRefs, as well as the user-supplied functions definitions that
 /// are also libcalls, and create or update the magic "llvm.compiler_used"
 /// global in \p TheModule.
-void updateCompilerUsed(Module &TheModule, const TargetMachine &TM,
-                        const StringSet<> &AsmUndefinedRefs);
+LLVM_ABI void updateCompilerUsed(Module &TheModule, const TargetMachine &TM,
+                                 const StringSet<> &AsmUndefinedRefs);
 }
 
 #endif // LLVM_LTO_LEGACY_UPDATECOMPILERUSED_H
diff --git a/llvm/include/llvm/MC/ConstantPools.h b/llvm/include/llvm/MC/ConstantPools.h
index ff21ccda07a83..1247f481955e5 100644
--- a/llvm/include/llvm/MC/ConstantPools.h
+++ b/llvm/include/llvm/MC/ConstantPools.h
@@ -15,6 +15,7 @@
 
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <cstdint>
 #include <map>
@@ -60,16 +61,16 @@ class ConstantPool {
   // \param Size is the size in bytes of the entry
   //
   // \returns a MCExpr that references the newly inserted value
-  const MCExpr *addEntry(const MCExpr *Value, MCContext &Context,
-                         unsigned Size, SMLoc Loc);
+  LLVM_ABI const MCExpr *addEntry(const MCExpr *Value, MCContext &Context,
+                                  unsigned Size, SMLoc Loc);
 
   // Emit the contents of the constant pool using the provided streamer.
-  void emitEntries(MCStreamer &Streamer);
+  LLVM_ABI void emitEntries(MCStreamer &Streamer);
 
   // Return true if the constant pool is empty
-  bool empty();
+  LLVM_ABI bool empty();
 
-  void clearCache();
+  LLVM_ABI void clearCache();
 };
 
 class AssemblerConstantPools {
@@ -91,11 +92,11 @@ class AssemblerConstantPools {
   ConstantPoolMapTy ConstantPools;
 
 public:
-  void emitAll(MCStreamer &Streamer);
-  void emitForCurrentSection(MCStreamer &Streamer);
-  void clearCacheForCurrentSection(MCStreamer &Streamer);
-  const MCExpr *addEntry(MCStreamer &Streamer, const MCExpr *Expr,
-                         unsigned Size, SMLoc Loc);
+  LLVM_ABI void emitAll(MCStreamer &Streamer);
+  LLVM_ABI void emitForCurrentSection(MCStreamer &Streamer);
+  LLVM_ABI void clearCacheForCurrentSection(MCStreamer &Streamer);
+  LLVM_ABI const MCExpr *addEntry(MCStreamer &Streamer, const MCExpr *Expr,
+                                  unsigned Size, SMLoc Loc);
 
 private:
   ConstantPool *getConstantPool(MCSection *Section);
diff --git a/llvm/include/llvm/MC/DXContainerPSVInfo.h b/llvm/include/llvm/MC/DXContainerPSVInfo.h
index eb6d9e14d92c3..6d1077b72bbec 100644
--- a/llvm/include/llvm/MC/DXContainerPSVInfo.h
+++ b/llvm/include/llvm/MC/DXContainerPSVInfo.h
@@ -14,6 +14,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/DXContainer.h"
 #include "llvm/MC/StringTableBuilder.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/TargetParser/Triple.h"
 
 #include <array>
@@ -73,10 +74,11 @@ struct PSVRuntimeInfo {
   // Serialize PSVInfo into the provided raw_ostream. The version field
   // specifies the data version to encode, the default value specifies encoding
   // the highest supported version.
-  void write(raw_ostream &OS,
-             uint32_t Version = std::numeric_limits<uint32_t>::max()) const;
+  LLVM_ABI void
+  write(raw_ostream &OS,
+        uint32_t Version = std::numeric_limits<uint32_t>::max()) const;
 
-  void finalize(Triple::EnvironmentType Stage);
+  LLVM_ABI void finalize(Triple::EnvironmentType Stage);
 
 private:
   SmallVector<uint32_t, 64> IndexBuffer;
@@ -109,7 +111,7 @@ class Signature {
                                Register, Mask, ExclusiveMask, MinPrecision});
   }
 
-  void write(raw_ostream &OS);
+  LLVM_ABI void write(raw_ostream &OS);
 };
 
 } // namespace mcdxbc
diff --git a/llvm/include/llvm/MC/MCAsmInfoCOFF.h b/llvm/include/llvm/MC/MCAsmInfoCOFF.h
index dc7832c2f9e0b..c9762226f5221 100644
--- a/llvm/include/llvm/MC/MCAsmInfoCOFF.h
+++ b/llvm/include/llvm/MC/MCAsmInfoCOFF.h
@@ -10,10 +10,11 @@
 #define LLVM_MC_MCASMINFOCOFF_H
 
 #include "llvm/MC/MCAsmInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
-class MCAsmInfoCOFF : public MCAsmInfo {
+class LLVM_ABI MCAsmInfoCOFF : public MCAsmInfo {
   virtual void anchor();
   void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
                             raw_ostream &) const final;
@@ -23,14 +24,14 @@ class MCAsmInfoCOFF : public MCAsmInfo {
   explicit MCAsmInfoCOFF();
 };
 
-class MCAsmInfoMicrosoft : public MCAsmInfoCOFF {
+class LLVM_ABI MCAsmInfoMicrosoft : public MCAsmInfoCOFF {
   void anchor() override;
 
 protected:
   explicit MCAsmInfoMicrosoft();
 };
 
-class MCAsmInfoGNUCOFF : public MCAsmInfoCOFF {
+class LLVM_ABI MCAsmInfoGNUCOFF : public MCAsmInfoCOFF {
   void anchor() override;
 
 protected:
diff --git a/llvm/include/llvm/MC/MCAsmInfoDarwin.h b/llvm/include/llvm/MC/MCAsmInfoDarwin.h
index 12bc3e97cdae1..4f06f6dce29d6 100644
--- a/llvm/include/llvm/MC/MCAsmInfoDarwin.h
+++ b/llvm/include/llvm/MC/MCAsmInfoDarwin.h
@@ -15,10 +15,11 @@
 #define LLVM_MC_MCASMINFODARWIN_H
 
 #include "llvm/MC/MCAsmInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
-class MCAsmInfoDarwin : public MCAsmInfo {
+class LLVM_ABI MCAsmInfoDarwin : public MCAsmInfo {
 public:
   explicit MCAsmInfoDarwin();
   void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
diff --git a/llvm/include/llvm/MC/MCAsmInfoELF.h b/llvm/include/llvm/MC/MCAsmInfoELF.h
index 095ee4dabca14..ff5be7f56a8ca 100644
--- a/llvm/include/llvm/MC/MCAsmInfoELF.h
+++ b/llvm/include/llvm/MC/MCAsmInfoELF.h
@@ -10,10 +10,11 @@
 #define LLVM_MC_MCASMINFOELF_H
 
 #include "llvm/MC/MCAsmInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
-class MCAsmInfoELF : public MCAsmInfo {
+class LLVM_ABI MCAsmInfoELF : public MCAsmInfo {
   virtual void anchor();
   MCSection *getStackSection(MCContext &Ctx, bool Exec) const override;
   void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
diff --git a/llvm/include/llvm/MC/MCAsmInfoGOFF.h b/llvm/include/llvm/MC/MCAsmInfoGOFF.h
index e62d2ae31ed71..fd31634a2fc5f 100644
--- a/llvm/include/llvm/MC/MCAsmInfoGOFF.h
+++ b/llvm/include/llvm/MC/MCAsmInfoGOFF.h
@@ -16,9 +16,10 @@
 #define LLVM_MC_MCASMINFOGOFF_H
 
 #include "llvm/MC/MCAsmInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
-class MCAsmInfoGOFF : public MCAsmInfo {
+class LLVM_ABI MCAsmInfoGOFF : public MCAsmInfo {
   void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
                             raw_ostream &) const final;
 
diff --git a/llvm/include/llvm/MC/MCAsmInfoWasm.h b/llvm/include/llvm/MC/MCAsmInfoWasm.h
index d98de6c30d9cf..fa0a835d9a1f6 100644
--- a/llvm/include/llvm/MC/MCAsmInfoWasm.h
+++ b/llvm/include/llvm/MC/MCAsmInfoWasm.h
@@ -10,9 +10,10 @@
 #define LLVM_MC_MCASMINFOWASM_H
 
 #include "llvm/MC/MCAsmInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
-class MCAsmInfoWasm : public MCAsmInfo {
+class LLVM_ABI MCAsmInfoWasm : public MCAsmInfo {
   void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
                             raw_ostream &) const final;
 
diff --git a/llvm/include/llvm/MC/MCAsmInfoXCOFF.h b/llvm/include/llvm/MC/MCAsmInfoXCOFF.h
index fd1ae82095659..7b9b0f1070d61 100644
--- a/llvm/include/llvm/MC/MCAsmInfoXCOFF.h
+++ b/llvm/include/llvm/MC/MCAsmInfoXCOFF.h
@@ -10,10 +10,11 @@
 #define LLVM_MC_MCASMINFOXCOFF_H
 
 #include "llvm/MC/MCAsmInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
-class MCAsmInfoXCOFF : public MCAsmInfo {
+class LLVM_ABI MCAsmInfoXCOFF : public MCAsmInfo {
 protected:
   MCAsmInfoXCOFF();
   void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
diff --git a/llvm/include/llvm/MC/MCCodeView.h b/llvm/include/llvm/MC/MCCodeView.h
index 76e15b8518439..b459fe3927853 100644
--- a/llvm/include/llvm/MC/MCCodeView.h
+++ b/llvm/include/llvm/MC/MCCodeView.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include <deque>
 #include <map>
 #include <vector>
@@ -148,80 +149,81 @@ class CodeViewContext {
   CodeViewContext &operator=(const CodeViewContext &other) = delete;
   CodeViewContext(const CodeViewContext &other) = delete;
 
-  void finish();
+  LLVM_ABI void finish();
 
-  bool isValidFileNumber(unsigned FileNumber) const;
-  bool addFile(MCStreamer &OS, unsigned FileNumber, StringRef Filename,
-               ArrayRef<uint8_t> ChecksumBytes, uint8_t ChecksumKind);
+  LLVM_ABI bool isValidFileNumber(unsigned FileNumber) const;
+  LLVM_ABI bool addFile(MCStreamer &OS, unsigned FileNumber, StringRef Filename,
+                        ArrayRef<uint8_t> ChecksumBytes, uint8_t ChecksumKind);
 
   /// Records the function id of a normal function. Returns false if the
   /// function id has already been used, and true otherwise.
-  bool recordFunctionId(unsigned FuncId);
+  LLVM_ABI bool recordFunctionId(unsigned FuncId);
 
   /// Records the function id of an inlined call site. Records the "inlined at"
   /// location info of the call site, including what function or inlined call
   /// site it was inlined into. Returns false if the function id has already
   /// been used, and true otherwise.
-  bool recordInlinedCallSiteId(unsigned FuncId, unsigned IAFunc,
-                               unsigned IAFile, unsigned IALine,
-                               unsigned IACol);
+  LLVM_ABI bool recordInlinedCallSiteId(unsigned FuncId, unsigned IAFunc,
+                                        unsigned IAFile, unsigned IALine,
+                                        unsigned IACol);
 
   /// Retreive the function info if this is a valid function id, or nullptr.
-  MCCVFunctionInfo *getCVFunctionInfo(unsigned FuncId);
+  LLVM_ABI MCCVFunctionInfo *getCVFunctionInfo(unsigned FuncId);
 
   /// Saves the information from the currently parsed .cv_loc directive
   /// and sets CVLocSeen.  When the next instruction is assembled an entry
   /// in the line number table with this information and the address of the
   /// instruction will be created.
-  void recordCVLoc(MCContext &Ctx, const MCSymbol *Label, unsigned FunctionId,
-                   unsigned FileNo, unsigned Line, unsigned Column,
-                   bool PrologueEnd, bool IsStmt);
+  LLVM_ABI void recordCVLoc(MCContext &Ctx, const MCSymbol *Label,
+                            unsigned FunctionId, unsigned FileNo, unsigned Line,
+                            unsigned Column, bool PrologueEnd, bool IsStmt);
 
   /// Add a line entry.
-  void addLineEntry(const MCCVLoc &LineEntry);
+  LLVM_ABI void addLineEntry(const MCCVLoc &LineEntry);
 
-  std::vector<MCCVLoc> getFunctionLineEntries(unsigned FuncId);
+  LLVM_ABI std::vector<MCCVLoc> getFunctionLineEntries(unsigned FuncId);
 
-  std::pair<size_t, size_t> getLineExtent(unsigned FuncId);
-  std::pair<size_t, size_t> getLineExtentIncludingInlinees(unsigned FuncId);
+  LLVM_ABI std::pair<size_t, size_t> getLineExtent(unsigned FuncId);
+  LLVM_ABI std::pair<size_t, size_t>
+  getLineExtentIncludingInlinees(unsigned FuncId);
 
-  ArrayRef<MCCVLoc> getLinesForExtent(size_t L, size_t R);
+  LLVM_ABI ArrayRef<MCCVLoc> getLinesForExtent(size_t L, size_t R);
 
   /// Emits a line table substream.
-  void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId,
-                                const MCSymbol *FuncBegin,
-                                const MCSymbol *FuncEnd);
+  LLVM_ABI void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId,
+                                         const MCSymbol *FuncBegin,
+                                         const MCSymbol *FuncEnd);
 
-  void emitInlineLineTableForFunction(MCObjectStreamer &OS,
-                                      unsigned PrimaryFunctionId,
-                                      unsigned SourceFileId,
-                                      unsigned SourceLineNum,
-                                      const MCSymbol *FnStartSym,
-                                      const MCSymbol *FnEndSym);
+  LLVM_ABI void emitInlineLineTableForFunction(MCObjectStreamer &OS,
+                                               unsigned PrimaryFunctionId,
+                                               unsigned SourceFileId,
+                                               unsigned SourceLineNum,
+                                               const MCSymbol *FnStartSym,
+                                               const MCSymbol *FnEndSym);
 
   /// Encodes the binary annotations once we have a layout.
-  void encodeInlineLineTable(const MCAssembler &Asm,
-                             MCCVInlineLineTableFragment &F);
+  LLVM_ABI void encodeInlineLineTable(const MCAssembler &Asm,
+                                      MCCVInlineLineTableFragment &F);
 
-  void
+  LLVM_ABI void
   emitDefRange(MCObjectStreamer &OS,
                ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
                StringRef FixedSizePortion);
 
-  void encodeDefRange(const MCAssembler &Asm, MCCVDefRangeFragment &F);
+  LLVM_ABI void encodeDefRange(const MCAssembler &Asm, MCCVDefRangeFragment &F);
 
   /// Emits the string table substream.
-  void emitStringTable(MCObjectStreamer &OS);
+  LLVM_ABI void emitStringTable(MCObjectStreamer &OS);
 
   /// Emits the file checksum substream.
-  void emitFileChecksums(MCObjectStreamer &OS);
+  LLVM_ABI void emitFileChecksums(MCObjectStreamer &OS);
 
   /// Emits the offset into the checksum table of the given file number.
-  void emitFileChecksumOffset(MCObjectStreamer &OS, unsigned FileNo);
+  LLVM_ABI void emitFileChecksumOffset(MCObjectStreamer &OS, unsigned FileNo);
 
   /// Add something to the string table.  Returns the final string as well as
   /// offset into the string table.
-  std::pair<StringRef, unsigned> addToStringTable(StringRef S);
+  LLVM_ABI std::pair<StringRef, unsigned> addToStringTable(StringRef S);
 
 private:
   MCContext *MCCtx;
diff --git a/llvm/include/llvm/MC/MCDXContainerWriter.h b/llvm/include/llvm/MC/MCDXContainerWriter.h
index 9b6ba896a5f09..a9b0794e84eb3 100644
--- a/llvm/include/llvm/MC/MCDXContainerWriter.h
+++ b/llvm/include/llvm/MC/MCDXContainerWriter.h
@@ -11,6 +11,7 @@
 
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/MC/MCValue.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/EndianStream.h"
 #include "llvm/TargetParser/Triple.h"
 
@@ -18,7 +19,7 @@ namespace llvm {
 
 class raw_pwrite_stream;
 
-class MCDXContainerTargetWriter : public MCObjectTargetWriter {
+class LLVM_ABI MCDXContainerTargetWriter : public MCObjectTargetWriter {
 protected:
   MCDXContainerTargetWriter() {}
 
@@ -33,7 +34,7 @@ class MCDXContainerTargetWriter : public MCObjectTargetWriter {
   }
 };
 
-class DXContainerObjectWriter final : public MCObjectWriter {
+class LLVM_ABI DXContainerObjectWriter final : public MCObjectWriter {
   support::endian::Writer W;
   std::unique_ptr<MCDXContainerTargetWriter> TargetObjectWriter;
 
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCExternalSymbolizer.h b/llvm/include/llvm/MC/MCDisassembler/MCExternalSymbolizer.h
index 8af3bb2296ec1..d0e1623bd6975 100644
--- a/llvm/include/llvm/MC/MCDisassembler/MCExternalSymbolizer.h
+++ b/llvm/include/llvm/MC/MCDisassembler/MCExternalSymbolizer.h
@@ -17,6 +17,7 @@
 
 #include "llvm-c/DisassemblerTypes.h"
 #include "llvm/MC/MCDisassembler/MCSymbolizer.h"
+#include "llvm/Support/Compiler.h"
 #include <memory>
 
 namespace llvm {
@@ -24,7 +25,7 @@ namespace llvm {
 /// Symbolize using user-provided, C API, callbacks.
 ///
 /// See llvm-c/Disassembler.h.
-class MCExternalSymbolizer : public MCSymbolizer {
+class LLVM_ABI MCExternalSymbolizer : public MCSymbolizer {
 protected:
   /// \name Hooks for symbolic disassembly via the public 'C' interface.
   /// @{
@@ -52,7 +53,6 @@ class MCExternalSymbolizer : public MCSymbolizer {
                                        int64_t Value,
                                        uint64_t Address) override;
 };
-
 }
 
 #endif
diff --git a/llvm/include/llvm/MC/MCELFObjectWriter.h b/llvm/include/llvm/MC/MCELFObjectWriter.h
index 35614cb9c9117..c5e04dc20b7bf 100644
--- a/llvm/include/llvm/MC/MCELFObjectWriter.h
+++ b/llvm/include/llvm/MC/MCELFObjectWriter.h
@@ -15,6 +15,7 @@
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/MC/MCSectionELF.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/TargetParser/Triple.h"
 #include <cstdint>
@@ -50,7 +51,7 @@ struct ELFRelocationEntry {
   LLVM_DUMP_METHOD void dump() const { print(errs()); }
 };
 
-class MCELFObjectTargetWriter : public MCObjectTargetWriter {
+class LLVM_ABI MCELFObjectTargetWriter : public MCObjectTargetWriter {
   const uint8_t OSABI;
   const uint8_t ABIVersion;
   const uint16_t EMachine;
@@ -139,7 +140,7 @@ class MCELFObjectTargetWriter : public MCObjectTargetWriter {
   }
 };
 
-class ELFObjectWriter final : public MCObjectWriter {
+class LLVM_ABI ELFObjectWriter final : public MCObjectWriter {
   unsigned ELFHeaderEFlags = 0;
 
 public:
diff --git a/llvm/include/llvm/MC/MCELFStreamer.h b/llvm/include/llvm/MC/MCELFStreamer.h
index 144f6bc3bd91c..f8f752328d421 100644
--- a/llvm/include/llvm/MC/MCELFStreamer.h
+++ b/llvm/include/llvm/MC/MCELFStreamer.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCDirectives.h"
 #include "llvm/MC/MCObjectStreamer.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -28,7 +29,7 @@ class MCCodeEmitter;
 class MCExpr;
 class MCInst;
 
-class MCELFStreamer : public MCObjectStreamer {
+class LLVM_ABI MCELFStreamer : public MCObjectStreamer {
 public:
   MCELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
                 std::unique_ptr<MCObjectWriter> OW,
@@ -148,11 +149,11 @@ class MCELFStreamer : public MCObjectStreamer {
   bool SeenIdent = false;
 };
 
-MCELFStreamer *createARMELFStreamer(MCContext &Context,
-                                    std::unique_ptr<MCAsmBackend> TAB,
-                                    std::unique_ptr<MCObjectWriter> OW,
-                                    std::unique_ptr<MCCodeEmitter> Emitter,
-                                    bool IsThumb, bool IsAndroid);
+LLVM_ABI MCELFStreamer *
+createARMELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
+                     std::unique_ptr<MCObjectWriter> OW,
+                     std::unique_ptr<MCCodeEmitter> Emitter, bool IsThumb,
+                     bool IsAndroid);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/MC/MCGOFFObjectWriter.h b/llvm/include/llvm/MC/MCGOFFObjectWriter.h
index 57e152f6a61dc..c7351b6af39a1 100644
--- a/llvm/include/llvm/MC/MCGOFFObjectWriter.h
+++ b/llvm/include/llvm/MC/MCGOFFObjectWriter.h
@@ -12,6 +12,7 @@
 #include "llvm/BinaryFormat/GOFF.h"
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/MC/MCValue.h"
+#include "llvm/Support/Compiler.h"
 #include <memory>
 #include <vector>
 
@@ -73,7 +74,7 @@ struct GOFFRelocationEntry {
         Action(Action), FetchStore(FetchStore) {}
 };
 
-class GOFFObjectWriter : public MCObjectWriter {
+class LLVM_ABI GOFFObjectWriter : public MCObjectWriter {
   // The target specific GOFF writer instance.
   std::unique_ptr<MCGOFFObjectTargetWriter> TargetObjectWriter;
 
@@ -105,7 +106,7 @@ class GOFFObjectWriter : public MCObjectWriter {
 /// \param MOTW - The target-specific GOFF writer subclass.
 /// \param OS - The stream to write to.
 /// \returns The constructed object writer.
-std::unique_ptr<MCObjectWriter>
+LLVM_ABI std::unique_ptr<MCObjectWriter>
 createGOFFObjectWriter(std::unique_ptr<MCGOFFObjectTargetWriter> MOTW,
                        raw_pwrite_stream &OS);
 } // namespace llvm
diff --git a/llvm/include/llvm/MC/MCLabel.h b/llvm/include/llvm/MC/MCLabel.h
index 0b8afac8f7548..28246e667947d 100644
--- a/llvm/include/llvm/MC/MCLabel.h
+++ b/llvm/include/llvm/MC/MCLabel.h
@@ -13,6 +13,8 @@
 #ifndef LLVM_MC_MCLABEL_H
 #define LLVM_MC_MCLABEL_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 
 class raw_ostream;
@@ -40,10 +42,10 @@ class MCLabel {
   unsigned incInstance() { return ++Instance; }
 
   /// Print the value to the stream \p OS.
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 
   /// Print the value to stderr.
-  void dump() const;
+  LLVM_ABI void dump() const;
 };
 
 inline raw_ostream &operator<<(raw_ostream &OS, const MCLabel &Label) {
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h b/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
index 66fd28827065b..fb4c9e79eade5 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
@@ -120,13 +120,13 @@ class LLVM_ABI MCAsmParserExtension {
   /// @}
 };
 
-MCAsmParserExtension *createDarwinAsmParser();
-MCAsmParserExtension *createELFAsmParser();
-MCAsmParserExtension *createCOFFAsmParser();
-MCAsmParserExtension *createCOFFMasmParser();
-MCAsmParserExtension *createGOFFAsmParser();
-MCAsmParserExtension *createXCOFFAsmParser();
-MCAsmParserExtension *createWasmAsmParser();
+LLVM_ABI MCAsmParserExtension *createDarwinAsmParser();
+LLVM_ABI MCAsmParserExtension *createELFAsmParser();
+LLVM_ABI MCAsmParserExtension *createCOFFAsmParser();
+LLVM_ABI MCAsmParserExtension *createCOFFMasmParser();
+LLVM_ABI MCAsmParserExtension *createGOFFAsmParser();
+LLVM_ABI MCAsmParserExtension *createXCOFFAsmParser();
+LLVM_ABI MCAsmParserExtension *createWasmAsmParser();
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParserUtils.h b/llvm/include/llvm/MC/MCParser/MCAsmParserUtils.h
index d692da7402fef..c2454f48edd68 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParserUtils.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParserUtils.h
@@ -22,9 +22,9 @@ namespace MCParserUtils {
 /// with the given name.
 ///
 /// On success, returns false and sets the Symbol and Value output parameters.
-bool parseAssignmentExpression(StringRef Name, bool allow_redef,
-                               MCAsmParser &Parser, MCSymbol *&Symbol,
-                               const MCExpr *&Value);
+LLVM_ABI bool parseAssignmentExpression(StringRef Name, bool allow_redef,
+                                        MCAsmParser &Parser, MCSymbol *&Symbol,
+                                        const MCExpr *&Value);
 
 } // namespace MCParserUtils
 
diff --git a/llvm/include/llvm/MC/MCSFrame.h b/llvm/include/llvm/MC/MCSFrame.h
index 694aec55aefeb..3904edf250243 100644
--- a/llvm/include/llvm/MC/MCSFrame.h
+++ b/llvm/include/llvm/MC/MCSFrame.h
@@ -17,6 +17,7 @@
 #define LLVM_MC_MCSFRAME_H
 
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 
 namespace llvm {
@@ -30,7 +31,7 @@ class MCSFrameEmitter {
   // Emit the sframe section.
   //
   // \param Streamer - Emit into this stream.
-  static void emit(MCObjectStreamer &Streamer);
+  LLVM_ABI static void emit(MCObjectStreamer &Streamer);
 
   // Encode the FRE's function offset.
   //
@@ -38,8 +39,9 @@ class MCSFrameEmitter {
   // \param Offset - Offset to encode.
   // \param Out - Destination of the encoding.
   // \param FDEFrag - Frag that specifies the encoding format.
-  static void encodeFuncOffset(MCContext &C, uint64_t Offset,
-                               SmallVectorImpl<char> &Out, MCFragment *FDEFrag);
+  LLVM_ABI static void encodeFuncOffset(MCContext &C, uint64_t Offset,
+                                        SmallVectorImpl<char> &Out,
+                                        MCFragment *FDEFrag);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/MC/MCSPIRVObjectWriter.h b/llvm/include/llvm/MC/MCSPIRVObjectWriter.h
index 3cbca4c46c5de..5b4f999fae3e1 100644
--- a/llvm/include/llvm/MC/MCSPIRVObjectWriter.h
+++ b/llvm/include/llvm/MC/MCSPIRVObjectWriter.h
@@ -11,6 +11,7 @@
 
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/MC/MCValue.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/EndianStream.h"
 #include "llvm/Support/raw_ostream.h"
 #include <memory>
@@ -25,7 +26,7 @@ class MCSPIRVObjectTargetWriter : public MCObjectTargetWriter {
   }
 };
 
-class SPIRVObjectWriter final : public MCObjectWriter {
+class LLVM_ABI SPIRVObjectWriter final : public MCObjectWriter {
   support::endian::Writer W;
   std::unique_ptr<MCSPIRVObjectTargetWriter> TargetObjectWriter;
 
@@ -52,7 +53,7 @@ class SPIRVObjectWriter final : public MCObjectWriter {
 /// \param MOTW - The target specific SPIR-V writer subclass.
 /// \param OS - The stream to write to.
 /// \returns The constructed object writer.
-std::unique_ptr<MCObjectWriter>
+LLVM_ABI std::unique_ptr<MCObjectWriter>
 createSPIRVObjectWriter(std::unique_ptr<MCSPIRVObjectTargetWriter> MOTW,
                         raw_pwrite_stream &OS);
 
diff --git a/llvm/include/llvm/MC/MCSectionCOFF.h b/llvm/include/llvm/MC/MCSectionCOFF.h
index 71efc4191c286..0934abced204f 100644
--- a/llvm/include/llvm/MC/MCSectionCOFF.h
+++ b/llvm/include/llvm/MC/MCSectionCOFF.h
@@ -17,6 +17,7 @@
 #include "llvm/BinaryFormat/COFF.h"
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/SectionKind.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 
 namespace llvm {
@@ -68,13 +69,13 @@ class MCSectionCOFF final : public MCSection {
 public:
   /// Decides whether a '.section' directive should be printed before the
   /// section name
-  bool shouldOmitSectionDirective(StringRef Name) const;
+  LLVM_ABI bool shouldOmitSectionDirective(StringRef Name) const;
 
   unsigned getCharacteristics() const { return Characteristics; }
   MCSymbol *getCOMDATSymbol() const { return COMDATSymbol; }
   int getSelection() const { return Selection; }
 
-  void setSelection(int Selection) const;
+  LLVM_ABI void setSelection(int Selection) const;
 
   bool isUnique() const { return UniqueID != NonUniqueID; }
   unsigned getUniqueID() const { return UniqueID; }
diff --git a/llvm/include/llvm/MC/MCSectionXCOFF.h b/llvm/include/llvm/MC/MCSectionXCOFF.h
index 0571f95d9be21..db5c38b8b7a9a 100644
--- a/llvm/include/llvm/MC/MCSectionXCOFF.h
+++ b/llvm/include/llvm/MC/MCSectionXCOFF.h
@@ -16,6 +16,7 @@
 #include "llvm/BinaryFormat/XCOFF.h"
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCSymbolXCOFF.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -94,7 +95,7 @@ class MCSectionXCOFF final : public MCSection {
   void printCsectDirective(raw_ostream &OS) const;
 
 public:
-  ~MCSectionXCOFF();
+  LLVM_ABI ~MCSectionXCOFF();
 
   XCOFF::StorageMappingClass getMappingClass() const {
     assert(isCsect() && "Only csect section has mapping class property!");
diff --git a/llvm/include/llvm/MC/MCSymbol.h b/llvm/include/llvm/MC/MCSymbol.h
index eef248354b70f..b6e9110d00424 100644
--- a/llvm/include/llvm/MC/MCSymbol.h
+++ b/llvm/include/llvm/MC/MCSymbol.h
@@ -383,7 +383,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const MCSymbol &Sym) {
   return OS;
 }
 
-bool isRangeRelaxable(const MCSymbol *Begin, const MCSymbol *End);
+LLVM_ABI bool isRangeRelaxable(const MCSymbol *Begin, const MCSymbol *End);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/MC/MCSymbolELF.h b/llvm/include/llvm/MC/MCSymbolELF.h
index 1af175a18e8ec..8d4e81339cb39 100644
--- a/llvm/include/llvm/MC/MCSymbolELF.h
+++ b/llvm/include/llvm/MC/MCSymbolELF.h
@@ -10,6 +10,7 @@
 
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/MCSymbolTableEntry.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class MCSymbolELF : public MCSymbol {
@@ -25,28 +26,28 @@ class MCSymbolELF : public MCSymbol {
 
   const MCExpr *getSize() const { return SymbolSize; }
 
-  void setVisibility(unsigned Visibility);
-  unsigned getVisibility() const;
+  LLVM_ABI void setVisibility(unsigned Visibility);
+  LLVM_ABI unsigned getVisibility() const;
 
-  void setOther(unsigned Other);
-  unsigned getOther() const;
+  LLVM_ABI void setOther(unsigned Other);
+  LLVM_ABI unsigned getOther() const;
 
-  void setType(unsigned Type) const;
-  unsigned getType() const;
+  LLVM_ABI void setType(unsigned Type) const;
+  LLVM_ABI unsigned getType() const;
 
-  void setBinding(unsigned Binding) const;
-  unsigned getBinding() const;
+  LLVM_ABI void setBinding(unsigned Binding) const;
+  LLVM_ABI unsigned getBinding() const;
 
-  bool isBindingSet() const;
+  LLVM_ABI bool isBindingSet() const;
 
-  void setIsWeakref() const;
-  bool isWeakref() const;
+  LLVM_ABI void setIsWeakref() const;
+  LLVM_ABI bool isWeakref() const;
 
-  void setIsSignature() const;
-  bool isSignature() const;
+  LLVM_ABI void setIsSignature() const;
+  LLVM_ABI bool isSignature() const;
 
-  void setMemtag(bool Tagged);
-  bool isMemtag() const;
+  LLVM_ABI void setMemtag(bool Tagged);
+  LLVM_ABI bool isMemtag() const;
 
 private:
   void setIsBindingSet() const;
diff --git a/llvm/include/llvm/MC/MCSymbolGOFF.h b/llvm/include/llvm/MC/MCSymbolGOFF.h
index 310cc4db9a7e2..2c0d0567d06b2 100644
--- a/llvm/include/llvm/MC/MCSymbolGOFF.h
+++ b/llvm/include/llvm/MC/MCSymbolGOFF.h
@@ -19,6 +19,7 @@
 #include "llvm/MC/MCSectionGOFF.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/MCSymbolTableEntry.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -74,7 +75,7 @@ class MCSymbolGOFF : public MCSymbol {
                     : GOFF::ESDBindingStrength::ESD_BST_Strong;
   }
 
-  bool setSymbolAttribute(MCSymbolAttr Attribute);
+  LLVM_ABI bool setSymbolAttribute(MCSymbolAttr Attribute);
 
   bool isInEDSection() const {
     return isInSection() && static_cast<MCSectionGOFF &>(getSection()).isED();
diff --git a/llvm/include/llvm/MC/MCSymbolXCOFF.h b/llvm/include/llvm/MC/MCSymbolXCOFF.h
index e1d61e2bb76fb..31b720b7a3d76 100644
--- a/llvm/include/llvm/MC/MCSymbolXCOFF.h
+++ b/llvm/include/llvm/MC/MCSymbolXCOFF.h
@@ -12,6 +12,7 @@
 #include "llvm/BinaryFormat/XCOFF.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/MCSymbolTableEntry.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -50,9 +51,9 @@ class MCSymbolXCOFF : public MCSymbol {
 
   StringRef getUnqualifiedName() const { return getUnqualifiedName(getName()); }
 
-  MCSectionXCOFF *getRepresentedCsect() const;
+  LLVM_ABI MCSectionXCOFF *getRepresentedCsect() const;
 
-  void setRepresentedCsect(MCSectionXCOFF *C);
+  LLVM_ABI void setRepresentedCsect(MCSectionXCOFF *C);
 
   void setVisibilityType(XCOFF::VisibilityType SVT) { VisibilityType = SVT; };
 
diff --git a/llvm/include/llvm/MC/MCWasmObjectWriter.h b/llvm/include/llvm/MC/MCWasmObjectWriter.h
index 9dd588d0a15b9..9b004ecfc9953 100644
--- a/llvm/include/llvm/MC/MCWasmObjectWriter.h
+++ b/llvm/include/llvm/MC/MCWasmObjectWriter.h
@@ -10,6 +10,7 @@
 #define LLVM_MC_MCWASMOBJECTWRITER_H
 
 #include "llvm/MC/MCObjectWriter.h"
+#include "llvm/Support/Compiler.h"
 #include <memory>
 
 namespace llvm {
@@ -19,7 +20,7 @@ class MCSectionWasm;
 class MCValue;
 class raw_pwrite_stream;
 
-class MCWasmObjectTargetWriter : public MCObjectTargetWriter {
+class LLVM_ABI MCWasmObjectTargetWriter : public MCObjectTargetWriter {
   const unsigned Is64Bit : 1;
   const unsigned IsEmscripten : 1;
 
@@ -50,11 +51,11 @@ class MCWasmObjectTargetWriter : public MCObjectTargetWriter {
 /// \param MOTW - The target specific Wasm writer subclass.
 /// \param OS - The stream to write to.
 /// \returns The constructed object writer.
-std::unique_ptr<MCObjectWriter>
+LLVM_ABI std::unique_ptr<MCObjectWriter>
 createWasmObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW,
                        raw_pwrite_stream &OS);
 
-std::unique_ptr<MCObjectWriter>
+LLVM_ABI std::unique_ptr<MCObjectWriter>
 createWasmDwoObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW,
                           raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS);
 
diff --git a/llvm/include/llvm/MC/MCWasmStreamer.h b/llvm/include/llvm/MC/MCWasmStreamer.h
index e8a71975c5d62..0cf95a8b321d2 100644
--- a/llvm/include/llvm/MC/MCWasmStreamer.h
+++ b/llvm/include/llvm/MC/MCWasmStreamer.h
@@ -14,13 +14,14 @@
 #include "llvm/MC/MCDirectives.h"
 #include "llvm/MC/MCObjectStreamer.h"
 #include "llvm/MC/MCObjectWriter.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DataTypes.h"
 
 namespace llvm {
 class MCExpr;
 class MCInst;
 
-class MCWasmStreamer : public MCObjectStreamer {
+class LLVM_ABI MCWasmStreamer : public MCObjectStreamer {
 public:
   MCWasmStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
                  std::unique_ptr<MCObjectWriter> OW,
diff --git a/llvm/include/llvm/MC/MCWin64EH.h b/llvm/include/llvm/MC/MCWin64EH.h
index f9af9857d6867..f54b2589c1ffe 100644
--- a/llvm/include/llvm/MC/MCWin64EH.h
+++ b/llvm/include/llvm/MC/MCWin64EH.h
@@ -15,6 +15,7 @@
 #define LLVM_MC_MCWIN64EH_H
 
 #include "llvm/MC/MCWinEH.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Win64EH.h"
 
 namespace llvm {
@@ -50,21 +51,21 @@ struct Instruction {
   }
 };
 
-class UnwindEmitter : public WinEH::UnwindEmitter {
+class LLVM_ABI UnwindEmitter : public WinEH::UnwindEmitter {
 public:
   void Emit(MCStreamer &Streamer) const override;
   void EmitUnwindInfo(MCStreamer &Streamer, WinEH::FrameInfo *FI,
                       bool HandlerData) const override;
 };
 
-class ARMUnwindEmitter : public WinEH::UnwindEmitter {
+class LLVM_ABI ARMUnwindEmitter : public WinEH::UnwindEmitter {
 public:
   void Emit(MCStreamer &Streamer) const override;
   void EmitUnwindInfo(MCStreamer &Streamer, WinEH::FrameInfo *FI,
                       bool HandlerData) const override;
 };
 
-class ARM64UnwindEmitter : public WinEH::UnwindEmitter {
+class LLVM_ABI ARM64UnwindEmitter : public WinEH::UnwindEmitter {
 public:
   void Emit(MCStreamer &Streamer) const override;
   void EmitUnwindInfo(MCStreamer &Streamer, WinEH::FrameInfo *FI,
diff --git a/llvm/include/llvm/MC/MCWinCOFFObjectWriter.h b/llvm/include/llvm/MC/MCWinCOFFObjectWriter.h
index 4a9cf9c56ff01..21daed8a4a219 100644
--- a/llvm/include/llvm/MC/MCWinCOFFObjectWriter.h
+++ b/llvm/include/llvm/MC/MCWinCOFFObjectWriter.h
@@ -10,6 +10,7 @@
 #define LLVM_MC_MCWINCOFFOBJECTWRITER_H
 
 #include "llvm/MC/MCObjectWriter.h"
+#include "llvm/Support/Compiler.h"
 #include <memory>
 
 namespace llvm {
@@ -20,7 +21,7 @@ class MCFixup;
 class MCValue;
 class raw_pwrite_stream;
 
-class MCWinCOFFObjectTargetWriter : public MCObjectTargetWriter {
+class LLVM_ABI MCWinCOFFObjectTargetWriter : public MCObjectTargetWriter {
   virtual void anchor();
 
   const unsigned Machine;
@@ -45,7 +46,7 @@ class MCWinCOFFObjectTargetWriter : public MCObjectTargetWriter {
 
 class WinCOFFWriter;
 
-class WinCOFFObjectWriter final : public MCObjectWriter {
+class LLVM_ABI WinCOFFObjectWriter final : public MCObjectWriter {
   friend class WinCOFFWriter;
 
   std::unique_ptr<MCWinCOFFObjectTargetWriter> TargetObjectWriter;
@@ -79,11 +80,11 @@ class WinCOFFObjectWriter final : public MCObjectWriter {
 /// \param MOTW - The target specific WinCOFF writer subclass.
 /// \param OS - The stream to write to.
 /// \returns The constructed object writer.
-std::unique_ptr<MCObjectWriter>
+LLVM_ABI std::unique_ptr<MCObjectWriter>
 createWinCOFFObjectWriter(std::unique_ptr<MCWinCOFFObjectTargetWriter> MOTW,
                           raw_pwrite_stream &OS);
 
-std::unique_ptr<MCObjectWriter>
+LLVM_ABI std::unique_ptr<MCObjectWriter>
 createWinCOFFDwoObjectWriter(std::unique_ptr<MCWinCOFFObjectTargetWriter> MOTW,
                              raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS);
 } // end namespace llvm
diff --git a/llvm/include/llvm/MC/MCWinCOFFStreamer.h b/llvm/include/llvm/MC/MCWinCOFFStreamer.h
index 45849b99de36a..2f1d2f3095e47 100644
--- a/llvm/include/llvm/MC/MCWinCOFFStreamer.h
+++ b/llvm/include/llvm/MC/MCWinCOFFStreamer.h
@@ -11,6 +11,7 @@
 
 #include "llvm/MC/MCDirectives.h"
 #include "llvm/MC/MCObjectStreamer.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,7 +26,7 @@ class StringRef;
 class WinCOFFObjectWriter;
 class raw_pwrite_stream;
 
-class MCWinCOFFStreamer : public MCObjectStreamer {
+class LLVM_ABI MCWinCOFFStreamer : public MCObjectStreamer {
 public:
   MCWinCOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
                     std::unique_ptr<MCCodeEmitter> CE,
diff --git a/llvm/include/llvm/MC/MCXCOFFObjectWriter.h b/llvm/include/llvm/MC/MCXCOFFObjectWriter.h
index 04172286ca770..13811529518cf 100644
--- a/llvm/include/llvm/MC/MCXCOFFObjectWriter.h
+++ b/llvm/include/llvm/MC/MCXCOFFObjectWriter.h
@@ -10,12 +10,13 @@
 #define LLVM_MC_MCXCOFFOBJECTWRITER_H
 
 #include "llvm/MC/MCObjectWriter.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class raw_pwrite_stream;
 
-class MCXCOFFObjectTargetWriter : public MCObjectTargetWriter {
+class LLVM_ABI MCXCOFFObjectTargetWriter : public MCObjectTargetWriter {
 protected:
   MCXCOFFObjectTargetWriter(bool Is64Bit);
 
@@ -52,7 +53,7 @@ class XCOFFObjectWriter : public MCObjectWriter {
   void setCPU(StringRef TargetCPU) { CPUType = TargetCPU; }
 };
 
-std::unique_ptr<MCObjectWriter>
+LLVM_ABI std::unique_ptr<MCObjectWriter>
 createXCOFFObjectWriter(std::unique_ptr<MCXCOFFObjectTargetWriter> MOTW,
                         raw_pwrite_stream &OS);
 
diff --git a/llvm/include/llvm/MC/MCXCOFFStreamer.h b/llvm/include/llvm/MC/MCXCOFFStreamer.h
index c3bc2ca94f711..852cb818abcef 100644
--- a/llvm/include/llvm/MC/MCXCOFFStreamer.h
+++ b/llvm/include/llvm/MC/MCXCOFFStreamer.h
@@ -10,11 +10,12 @@
 #define LLVM_MC_MCXCOFFSTREAMER_H
 
 #include "llvm/MC/MCObjectStreamer.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class XCOFFObjectWriter;
 
-class MCXCOFFStreamer : public MCObjectStreamer {
+class LLVM_ABI MCXCOFFStreamer : public MCObjectStreamer {
 public:
   MCXCOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
                   std::unique_ptr<MCObjectWriter> OW,
diff --git a/llvm/include/llvm/MCA/CustomBehaviour.h b/llvm/include/llvm/MCA/CustomBehaviour.h
index 8ad674c4ecf13..73d960497e66a 100644
--- a/llvm/include/llvm/MCA/CustomBehaviour.h
+++ b/llvm/include/llvm/MCA/CustomBehaviour.h
@@ -137,7 +137,7 @@ class LatencyInstrument : public Instrument {
   std::optional<unsigned> Latency;
 
 public:
-  static const StringRef DESC_NAME;
+  LLVM_ABI static const StringRef DESC_NAME;
   LatencyInstrument(StringRef Data) : Instrument(DESC_NAME, Data) {
     // Skip spaces and tabs.
     Data = Data.trim();
diff --git a/llvm/include/llvm/MCA/HardwareUnits/RegisterFile.h b/llvm/include/llvm/MCA/HardwareUnits/RegisterFile.h
index 5bd74ad5fe788..bb62acd0937d9 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/RegisterFile.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/RegisterFile.h
@@ -22,6 +22,7 @@
 #include "llvm/MC/MCSchedule.h"
 #include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/MCA/HardwareUnits/HardwareUnit.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
@@ -42,27 +43,27 @@ class WriteRef {
   MCPhysReg RegisterID;
   WriteState *Write;
 
-  static const unsigned INVALID_IID;
+  LLVM_ABI static const unsigned INVALID_IID;
 
 public:
   WriteRef()
       : IID(INVALID_IID), WriteBackCycle(), WriteResID(), RegisterID(),
         Write() {}
-  WriteRef(unsigned SourceIndex, WriteState *WS);
+  LLVM_ABI WriteRef(unsigned SourceIndex, WriteState *WS);
 
   unsigned getSourceIndex() const { return IID; }
-  unsigned getWriteBackCycle() const;
+  LLVM_ABI unsigned getWriteBackCycle() const;
 
   const WriteState *getWriteState() const { return Write; }
   WriteState *getWriteState() { return Write; }
-  unsigned getWriteResourceID() const;
-  MCPhysReg getRegisterID() const;
+  LLVM_ABI unsigned getWriteResourceID() const;
+  LLVM_ABI MCPhysReg getRegisterID() const;
 
-  void commit();
-  void notifyExecuted(unsigned Cycle);
+  LLVM_ABI void commit();
+  LLVM_ABI void notifyExecuted(unsigned Cycle);
 
-  bool hasKnownWriteBackCycle() const;
-  bool isWriteZero() const;
+  LLVM_ABI bool hasKnownWriteBackCycle() const;
+  LLVM_ABI bool isWriteZero() const;
   bool isValid() const { return getSourceIndex() != INVALID_IID; }
 
   /// Returns true if this register write has been executed, and the new
@@ -229,13 +230,13 @@ class RegisterFile : public HardwareUnit {
   void initialize(const MCSchedModel &SM, unsigned NumRegs);
 
 public:
-  RegisterFile(const MCSchedModel &SM, const MCRegisterInfo &mri,
-               unsigned NumRegs = 0);
+  LLVM_ABI RegisterFile(const MCSchedModel &SM, const MCRegisterInfo &mri,
+                        unsigned NumRegs = 0);
 
   // Collects writes that are in a RAW dependency with RS.
-  void collectWrites(const MCSubtargetInfo &STI, const ReadState &RS,
-                     SmallVectorImpl<WriteRef> &Writes,
-                     SmallVectorImpl<WriteRef> &CommittedWrites) const;
+  LLVM_ABI void collectWrites(const MCSubtargetInfo &STI, const ReadState &RS,
+                              SmallVectorImpl<WriteRef> &Writes,
+                              SmallVectorImpl<WriteRef> &CommittedWrites) const;
   struct RAWHazard {
     MCPhysReg RegisterID = 0;
     int CyclesLeft = 0;
@@ -245,29 +246,31 @@ class RegisterFile : public HardwareUnit {
     bool hasUnknownCycles() const { return CyclesLeft < 0; }
   };
 
-  RAWHazard checkRAWHazards(const MCSubtargetInfo &STI,
-                            const ReadState &RS) const;
+  LLVM_ABI RAWHazard checkRAWHazards(const MCSubtargetInfo &STI,
+                                     const ReadState &RS) const;
 
   // This method updates the register mappings inserting a new register
   // definition. This method is also responsible for updating the number of
   // allocated physical registers in each register file modified by the write.
   // No physical regiser is allocated if this write is from a zero-idiom.
-  void addRegisterWrite(WriteRef Write, MutableArrayRef<unsigned> UsedPhysRegs);
+  LLVM_ABI void addRegisterWrite(WriteRef Write,
+                                 MutableArrayRef<unsigned> UsedPhysRegs);
 
   // Collect writes that are in a data dependency with RS, and update RS
   // internal state.
-  void addRegisterRead(ReadState &RS, const MCSubtargetInfo &STI) const;
+  LLVM_ABI void addRegisterRead(ReadState &RS,
+                                const MCSubtargetInfo &STI) const;
 
   // Removes write \param WS from the register mappings.
   // Physical registers may be released to reflect this update.
   // No registers are released if this write is from a zero-idiom.
-  void removeRegisterWrite(const WriteState &WS,
-                           MutableArrayRef<unsigned> FreedPhysRegs);
+  LLVM_ABI void removeRegisterWrite(const WriteState &WS,
+                                    MutableArrayRef<unsigned> FreedPhysRegs);
 
   // Returns true if the PRF at index `PRFIndex` can eliminate a move from RS to
   // WS.
-  bool canEliminateMove(const WriteState &WS, const ReadState &RS,
-                        unsigned PRFIndex) const;
+  LLVM_ABI bool canEliminateMove(const WriteState &WS, const ReadState &RS,
+                                 unsigned PRFIndex) const;
 
   // Returns true if this instruction can be fully eliminated at register
   // renaming stage. On success, this method updates the internal state of each
@@ -275,8 +278,8 @@ class RegisterFile : public HardwareUnit {
   // flag for known zero registers. It internally uses `canEliminateMove` to
   // determine if a read/write pair can be eliminated. By default, it assumes a
   // register swap if there is more than one register definition.
-  bool tryEliminateMoveOrSwap(MutableArrayRef<WriteState> Writes,
-                              MutableArrayRef<ReadState> Reads);
+  LLVM_ABI bool tryEliminateMoveOrSwap(MutableArrayRef<WriteState> Writes,
+                                       MutableArrayRef<ReadState> Reads);
 
   // Checks if there are enough physical registers in the register files.
   // Returns a "response mask" where each bit represents the response from a
@@ -287,17 +290,17 @@ class RegisterFile : public HardwareUnit {
   //
   // Current implementation can simulate up to 32 register files (including the
   // special register file at index #0).
-  unsigned isAvailable(ArrayRef<MCPhysReg> Regs) const;
+  LLVM_ABI unsigned isAvailable(ArrayRef<MCPhysReg> Regs) const;
 
   // Returns the number of PRFs implemented by this processor.
   unsigned getNumRegisterFiles() const { return RegisterFiles.size(); }
 
-  unsigned getElapsedCyclesFromWriteBack(const WriteRef &WR) const;
+  LLVM_ABI unsigned getElapsedCyclesFromWriteBack(const WriteRef &WR) const;
 
-  void onInstructionExecuted(Instruction *IS);
+  LLVM_ABI void onInstructionExecuted(Instruction *IS);
 
   // Notify each PRF that a new cycle just started.
-  void cycleStart();
+  LLVM_ABI void cycleStart();
 
   void cycleEnd() { ++CurrentCycle; }
 
diff --git a/llvm/include/llvm/MCA/HardwareUnits/RetireControlUnit.h b/llvm/include/llvm/MCA/HardwareUnits/RetireControlUnit.h
index 4342a3e72fa8c..09c4fe6eac136 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/RetireControlUnit.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/RetireControlUnit.h
@@ -17,6 +17,7 @@
 #include "llvm/MC/MCSchedule.h"
 #include "llvm/MCA/HardwareUnits/HardwareUnit.h"
 #include "llvm/MCA/Instruction.h"
+#include "llvm/Support/Compiler.h"
 #include <vector>
 
 namespace llvm {
@@ -77,7 +78,7 @@ struct RetireControlUnit : public HardwareUnit {
   unsigned computeNextSlotIdx() const;
 
 public:
-  RetireControlUnit(const MCSchedModel &SM);
+  LLVM_ABI RetireControlUnit(const MCSchedModel &SM);
 
   bool isEmpty() const { return AvailableEntries == NumROBEntries; }
 
@@ -88,18 +89,18 @@ struct RetireControlUnit : public HardwareUnit {
   unsigned getMaxRetirePerCycle() const { return MaxRetirePerCycle; }
 
   // Reserves a number of slots, and returns a new token reference.
-  unsigned dispatch(const InstRef &IS);
+  LLVM_ABI unsigned dispatch(const InstRef &IS);
 
   // Return the current token from the RCU's circular token queue.
-  const RUToken &getCurrentToken() const;
+  LLVM_ABI const RUToken &getCurrentToken() const;
 
-  const RUToken &peekNextToken() const;
+  LLVM_ABI const RUToken &peekNextToken() const;
 
   // Advance the pointer to the next token in the circular token queue.
-  void consumeCurrentToken();
+  LLVM_ABI void consumeCurrentToken();
 
   // Update the RCU token to represent the executed state.
-  void onInstructionExecuted(unsigned TokenID);
+  LLVM_ABI void onInstructionExecuted(unsigned TokenID);
 
 #ifndef NDEBUG
   void dump() const;
diff --git a/llvm/include/llvm/MCA/Stages/DispatchStage.h b/llvm/include/llvm/MCA/Stages/DispatchStage.h
index c2b521993c2fb..65ecb5d08f3d0 100644
--- a/llvm/include/llvm/MCA/Stages/DispatchStage.h
+++ b/llvm/include/llvm/MCA/Stages/DispatchStage.h
@@ -24,6 +24,7 @@
 #include "llvm/MCA/HardwareUnits/RetireControlUnit.h"
 #include "llvm/MCA/Instruction.h"
 #include "llvm/MCA/Stages/Stage.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
@@ -46,7 +47,7 @@ namespace mca {
 //
 // If the number of micro opcodes exceedes DispatchWidth, then the instruction
 // is dispatched in multiple cycles.
-class DispatchStage final : public Stage {
+class LLVM_ABI DispatchStage final : public Stage {
   unsigned DispatchWidth;
   unsigned AvailableEntries;
   unsigned CarryOver;
diff --git a/llvm/include/llvm/MCA/Stages/ExecuteStage.h b/llvm/include/llvm/MCA/Stages/ExecuteStage.h
index 03a78a8b6b85b..e7f8553b05c44 100644
--- a/llvm/include/llvm/MCA/Stages/ExecuteStage.h
+++ b/llvm/include/llvm/MCA/Stages/ExecuteStage.h
@@ -21,11 +21,12 @@
 #include "llvm/MCA/HardwareUnits/Scheduler.h"
 #include "llvm/MCA/Instruction.h"
 #include "llvm/MCA/Stages/Stage.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
 
-class ExecuteStage final : public Stage {
+class LLVM_ABI ExecuteStage final : public Stage {
   Scheduler &HWS;
 
   unsigned NumDispatchedOpcodes;
diff --git a/llvm/include/llvm/MCA/Stages/InOrderIssueStage.h b/llvm/include/llvm/MCA/Stages/InOrderIssueStage.h
index 7fa7c89ad394e..6cd216ca9cc42 100644
--- a/llvm/include/llvm/MCA/Stages/InOrderIssueStage.h
+++ b/llvm/include/llvm/MCA/Stages/InOrderIssueStage.h
@@ -18,6 +18,7 @@
 #include "llvm/MCA/HardwareUnits/ResourceManager.h"
 #include "llvm/MCA/SourceMgr.h"
 #include "llvm/MCA/Stages/Stage.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
@@ -46,12 +47,12 @@ struct StallInfo {
   InstRef &getInstruction() { return IR; }
 
   bool isValid() const { return (bool)IR; }
-  void clear();
-  void update(const InstRef &Inst, unsigned Cycles, StallKind SK);
-  void cycleEnd();
+  LLVM_ABI void clear();
+  LLVM_ABI void update(const InstRef &Inst, unsigned Cycles, StallKind SK);
+  LLVM_ABI void cycleEnd();
 };
 
-class InOrderIssueStage final : public Stage {
+class LLVM_ABI InOrderIssueStage final : public Stage {
   const MCSubtargetInfo &STI;
   RegisterFile &PRF;
   ResourceManager RM;
diff --git a/llvm/include/llvm/MCA/Stages/MicroOpQueueStage.h b/llvm/include/llvm/MCA/Stages/MicroOpQueueStage.h
index d9e3264c5951f..0dfddde81b529 100644
--- a/llvm/include/llvm/MCA/Stages/MicroOpQueueStage.h
+++ b/llvm/include/llvm/MCA/Stages/MicroOpQueueStage.h
@@ -18,12 +18,13 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MCA/Stages/Stage.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
 
 /// A stage that simulates a queue of instruction opcodes.
-class MicroOpQueueStage : public Stage {
+class LLVM_ABI MicroOpQueueStage : public Stage {
   SmallVector<InstRef, 8> Buffer;
   unsigned NextAvailableSlotIdx;
   unsigned CurrentInstructionSlotIdx;
diff --git a/llvm/include/llvm/MCA/Stages/RetireStage.h b/llvm/include/llvm/MCA/Stages/RetireStage.h
index aafe2815df150..403ac21fee51e 100644
--- a/llvm/include/llvm/MCA/Stages/RetireStage.h
+++ b/llvm/include/llvm/MCA/Stages/RetireStage.h
@@ -21,11 +21,12 @@
 #include "llvm/MCA/HardwareUnits/RegisterFile.h"
 #include "llvm/MCA/HardwareUnits/RetireControlUnit.h"
 #include "llvm/MCA/Stages/Stage.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
 
-class RetireStage final : public Stage {
+class LLVM_ABI RetireStage final : public Stage {
   // Owner will go away when we move listeners/eventing to the stages.
   RetireControlUnit &RCU;
   RegisterFile &PRF;
diff --git a/llvm/include/llvm/ObjCopy/DXContainer/DXContainerObjcopy.h b/llvm/include/llvm/ObjCopy/DXContainer/DXContainerObjcopy.h
index a410cfec18ea4..98e66fdaa7680 100644
--- a/llvm/include/llvm/ObjCopy/DXContainer/DXContainerObjcopy.h
+++ b/llvm/include/llvm/ObjCopy/DXContainer/DXContainerObjcopy.h
@@ -9,6 +9,8 @@
 #ifndef LLVM_OBJCOPY_DXCONTAINER_DXCONTAINEROBJCOPY_H
 #define LLVM_OBJCOPY_DXCONTAINER_DXCONTAINEROBJCOPY_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 class Error;
 class raw_ostream;
@@ -25,10 +27,10 @@ namespace dxbc {
 /// Apply the transformations described by \p Config and \p DXContainerConfig
 /// to \p In and writes the result into \p Out.
 /// \returns any Error encountered whilst performing the operation.
-Error executeObjcopyOnBinary(const CommonConfig &Config,
-                             const DXContainerConfig &,
-                             object::DXContainerObjectFile &In,
-                             raw_ostream &Out);
+LLVM_ABI Error executeObjcopyOnBinary(const CommonConfig &Config,
+                                      const DXContainerConfig &,
+                                      object::DXContainerObjectFile &In,
+                                      raw_ostream &Out);
 } // end namespace dxbc
 } // end namespace objcopy
 } // end namespace llvm
diff --git a/llvm/include/llvm/ObjCopy/XCOFF/XCOFFObjcopy.h b/llvm/include/llvm/ObjCopy/XCOFF/XCOFFObjcopy.h
index 9fc85cb39fa5b..d13472b182268 100644
--- a/llvm/include/llvm/ObjCopy/XCOFF/XCOFFObjcopy.h
+++ b/llvm/include/llvm/ObjCopy/XCOFF/XCOFFObjcopy.h
@@ -9,6 +9,8 @@
 #ifndef LLVM_OBJCOPY_XCOFF_XCOFFOBJCOPY_H
 #define LLVM_OBJCOPY_XCOFF_XCOFFOBJCOPY_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 class Error;
 class raw_ostream;
@@ -25,8 +27,10 @@ namespace xcoff {
 /// Apply the transformations described by \p Config and \p XCOFFConfig
 /// to \p In and writes the result into \p Out.
 /// \returns any Error encountered whilst performing the operation.
-Error executeObjcopyOnBinary(const CommonConfig &Config, const XCOFFConfig &,
-                             object::XCOFFObjectFile &In, raw_ostream &Out);
+LLVM_ABI Error executeObjcopyOnBinary(const CommonConfig &Config,
+                                      const XCOFFConfig &,
+                                      object::XCOFFObjectFile &In,
+                                      raw_ostream &Out);
 
 } // end namespace xcoff
 } // end namespace objcopy
diff --git a/llvm/include/llvm/Object/GOFF.h b/llvm/include/llvm/Object/GOFF.h
index 9fb8876e893d5..07f7bfeee27e7 100644
--- a/llvm/include/llvm/Object/GOFF.h
+++ b/llvm/include/llvm/Object/GOFF.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/BinaryFormat/GOFF.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/raw_ostream.h"
@@ -30,8 +31,9 @@ namespace object {
 /// be called from deriving classes to change values as that record specifies.
 class Record {
 public:
-  static Error getContinuousData(const uint8_t *Record, uint16_t DataLength,
-                                 int DataIndex, SmallString<256> &CompleteData);
+  LLVM_ABI static Error getContinuousData(const uint8_t *Record,
+                                          uint16_t DataLength, int DataIndex,
+                                          SmallString<256> &CompleteData);
 
   static bool isContinued(const uint8_t *Record) {
     uint8_t IsContinued;
@@ -78,7 +80,8 @@ class TXTRecord : public Record {
   /// \brief Maximum length of data; any more must go in continuation.
   static const uint8_t TXTMaxDataLength = 56;
 
-  static Error getData(const uint8_t *Record, SmallString<256> &CompleteData);
+  LLVM_ABI static Error getData(const uint8_t *Record,
+                                SmallString<256> &CompleteData);
 
   static void getElementEsdId(const uint8_t *Record, uint32_t &EsdId) {
     get<uint32_t>(Record, 4, EsdId);
@@ -95,7 +98,8 @@ class TXTRecord : public Record {
 
 class HDRRecord : public Record {
 public:
-  static Error getData(const uint8_t *Record, SmallString<256> &CompleteData);
+  LLVM_ABI static Error getData(const uint8_t *Record,
+                                SmallString<256> &CompleteData);
 
   static uint16_t getPropertyModuleLength(const uint8_t *Record) {
     uint16_t Length;
@@ -118,7 +122,8 @@ class ESDRecord : public Record {
   static const uint16_t MaxNameLength = 32 * 1024;
 
 public:
-  static Error getData(const uint8_t *Record, SmallString<256> &CompleteData);
+  LLVM_ABI static Error getData(const uint8_t *Record,
+                                SmallString<256> &CompleteData);
 
   // ESD Get routines.
   static void getSymbolType(const uint8_t *Record,
@@ -288,7 +293,8 @@ class ESDRecord : public Record {
 
 class ENDRecord : public Record {
 public:
-  static Error getData(const uint8_t *Record, SmallString<256> &CompleteData);
+  LLVM_ABI static Error getData(const uint8_t *Record,
+                                SmallString<256> &CompleteData);
 
   static uint16_t getNameLength(const uint8_t *Record) {
     uint16_t Length;
diff --git a/llvm/include/llvm/Object/OffloadBundle.h b/llvm/include/llvm/Object/OffloadBundle.h
index bbb313c06c441..339d0ebec010e 100644
--- a/llvm/include/llvm/Object/OffloadBundle.h
+++ b/llvm/include/llvm/Object/OffloadBundle.h
@@ -56,15 +56,16 @@ class CompressedOffloadBundle {
     size_t UncompressedFileSize;
     uint64_t Hash;
 
-    static llvm::Expected<CompressedBundleHeader> tryParse(llvm::StringRef);
+    LLVM_ABI static llvm::Expected<CompressedBundleHeader>
+        tryParse(llvm::StringRef);
   };
 
   static inline const uint16_t DefaultVersion = 3;
 
-  static llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
+  LLVM_ABI static llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
   compress(llvm::compression::Params P, const llvm::MemoryBuffer &Input,
            uint16_t Version, raw_ostream *VerboseStream = nullptr);
-  static llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
+  LLVM_ABI static llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
   decompress(const llvm::MemoryBuffer &Input,
              raw_ostream *VerboseStream = nullptr);
 };
diff --git a/llvm/include/llvm/ObjectYAML/ArchiveYAML.h b/llvm/include/llvm/ObjectYAML/ArchiveYAML.h
index c83c7ee56f1f9..c9f7445a0d835 100644
--- a/llvm/include/llvm/ObjectYAML/ArchiveYAML.h
+++ b/llvm/include/llvm/ObjectYAML/ArchiveYAML.h
@@ -14,9 +14,10 @@
 #ifndef LLVM_OBJECTYAML_ARCHIVEYAML_H
 #define LLVM_OBJECTYAML_ARCHIVEYAML_H
 
-#include "llvm/Support/YAMLTraits.h"
-#include "llvm/ObjectYAML/YAML.h"
 #include "llvm/ADT/MapVector.h"
+#include "llvm/ObjectYAML/YAML.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/YAMLTraits.h"
 #include <optional>
 
 namespace llvm {
@@ -63,13 +64,13 @@ namespace llvm {
 namespace yaml {
 
 template <> struct MappingTraits<ArchYAML::Archive> {
-  static void mapping(IO &IO, ArchYAML::Archive &A);
-  static std::string validate(IO &, ArchYAML::Archive &A);
+  LLVM_ABI static void mapping(IO &IO, ArchYAML::Archive &A);
+  LLVM_ABI static std::string validate(IO &, ArchYAML::Archive &A);
 };
 
 template <> struct MappingTraits<ArchYAML::Archive::Child> {
-  static void mapping(IO &IO, ArchYAML::Archive::Child &C);
-  static std::string validate(IO &, ArchYAML::Archive::Child &C);
+  LLVM_ABI static void mapping(IO &IO, ArchYAML::Archive::Child &C);
+  LLVM_ABI static std::string validate(IO &, ArchYAML::Archive::Child &C);
 };
 
 } // end namespace yaml
diff --git a/llvm/include/llvm/ObjectYAML/COFFYAML.h b/llvm/include/llvm/ObjectYAML/COFFYAML.h
index c22d4e7f0b29d..21c80ea58d636 100644
--- a/llvm/include/llvm/ObjectYAML/COFFYAML.h
+++ b/llvm/include/llvm/ObjectYAML/COFFYAML.h
@@ -20,6 +20,7 @@
 #include "llvm/ObjectYAML/CodeViewYAMLTypeHashing.h"
 #include "llvm/ObjectYAML/CodeViewYAMLTypes.h"
 #include "llvm/ObjectYAML/YAML.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <optional>
 #include <vector>
@@ -73,8 +74,8 @@ struct SectionDataEntry {
   std::optional<object::coff_load_configuration32> LoadConfig32;
   std::optional<object::coff_load_configuration64> LoadConfig64;
 
-  size_t size() const;
-  void writeAsBinary(raw_ostream &OS) const;
+  LLVM_ABI size_t size() const;
+  LLVM_ABI void writeAsBinary(raw_ostream &OS) const;
 };
 
 struct Section {
@@ -89,7 +90,7 @@ struct Section {
   std::vector<Relocation> Relocations;
   StringRef Name;
 
-  Section();
+  LLVM_ABI Section();
 };
 
 struct Symbol {
@@ -104,7 +105,7 @@ struct Symbol {
   std::optional<COFF::AuxiliaryCLRToken> CLRToken;
   StringRef Name;
 
-  Symbol();
+  LLVM_ABI Symbol();
 };
 
 struct PEHeader {
@@ -119,7 +120,7 @@ struct Object {
   std::vector<Section> Sections;
   std::vector<Symbol> Symbols;
 
-  Object();
+  LLVM_ABI Object();
 };
 
 } // end namespace COFFYAML
@@ -136,152 +137,154 @@ namespace yaml {
 
 template <>
 struct ScalarEnumerationTraits<COFFYAML::WeakExternalCharacteristics> {
-  static void enumeration(IO &IO, COFFYAML::WeakExternalCharacteristics &Value);
+  LLVM_ABI static void
+  enumeration(IO &IO, COFFYAML::WeakExternalCharacteristics &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFFYAML::AuxSymbolType> {
-  static void enumeration(IO &IO, COFFYAML::AuxSymbolType &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFFYAML::AuxSymbolType &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFFYAML::COMDATType> {
-  static void enumeration(IO &IO, COFFYAML::COMDATType &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFFYAML::COMDATType &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFF::MachineTypes> {
-  static void enumeration(IO &IO, COFF::MachineTypes &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFF::MachineTypes &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFF::SymbolBaseType> {
-  static void enumeration(IO &IO, COFF::SymbolBaseType &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFF::SymbolBaseType &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFF::SymbolStorageClass> {
-  static void enumeration(IO &IO, COFF::SymbolStorageClass &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFF::SymbolStorageClass &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFF::SymbolComplexType> {
-  static void enumeration(IO &IO, COFF::SymbolComplexType &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFF::SymbolComplexType &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFF::RelocationTypeI386> {
-  static void enumeration(IO &IO, COFF::RelocationTypeI386 &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFF::RelocationTypeI386 &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFF::RelocationTypeAMD64> {
-  static void enumeration(IO &IO, COFF::RelocationTypeAMD64 &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFF::RelocationTypeAMD64 &Value);
 };
 
 template <> struct ScalarEnumerationTraits<COFF::RelocationTypesMips> {
-  static void enumeration(IO &IO, COFF::RelocationTypesMips &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFF::RelocationTypesMips &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFF::RelocationTypesARM> {
-  static void enumeration(IO &IO, COFF::RelocationTypesARM &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFF::RelocationTypesARM &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFF::RelocationTypesARM64> {
-  static void enumeration(IO &IO, COFF::RelocationTypesARM64 &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFF::RelocationTypesARM64 &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<COFF::WindowsSubsystem> {
-  static void enumeration(IO &IO, COFF::WindowsSubsystem &Value);
+  LLVM_ABI static void enumeration(IO &IO, COFF::WindowsSubsystem &Value);
 };
 
 template <>
 struct ScalarBitSetTraits<COFF::Characteristics> {
-  static void bitset(IO &IO, COFF::Characteristics &Value);
+  LLVM_ABI static void bitset(IO &IO, COFF::Characteristics &Value);
 };
 
 template <>
 struct ScalarBitSetTraits<COFF::SectionCharacteristics> {
-  static void bitset(IO &IO, COFF::SectionCharacteristics &Value);
+  LLVM_ABI static void bitset(IO &IO, COFF::SectionCharacteristics &Value);
 };
 
 template <>
 struct ScalarBitSetTraits<COFF::DLLCharacteristics> {
-  static void bitset(IO &IO, COFF::DLLCharacteristics &Value);
+  LLVM_ABI static void bitset(IO &IO, COFF::DLLCharacteristics &Value);
 };
 
 template <>
 struct MappingTraits<COFFYAML::Relocation> {
-  static void mapping(IO &IO, COFFYAML::Relocation &Rel);
+  LLVM_ABI static void mapping(IO &IO, COFFYAML::Relocation &Rel);
 };
 
 template <>
 struct MappingTraits<COFFYAML::PEHeader> {
-  static void mapping(IO &IO, COFFYAML::PEHeader &PH);
+  LLVM_ABI static void mapping(IO &IO, COFFYAML::PEHeader &PH);
 };
 
 template <>
 struct MappingTraits<COFF::DataDirectory> {
-  static void mapping(IO &IO, COFF::DataDirectory &DD);
+  LLVM_ABI static void mapping(IO &IO, COFF::DataDirectory &DD);
 };
 
 template <>
 struct MappingTraits<COFF::header> {
-  static void mapping(IO &IO, COFF::header &H);
+  LLVM_ABI static void mapping(IO &IO, COFF::header &H);
 };
 
 template <> struct MappingTraits<COFF::AuxiliaryFunctionDefinition> {
-  static void mapping(IO &IO, COFF::AuxiliaryFunctionDefinition &AFD);
+  LLVM_ABI static void mapping(IO &IO, COFF::AuxiliaryFunctionDefinition &AFD);
 };
 
 template <> struct MappingTraits<COFF::AuxiliarybfAndefSymbol> {
-  static void mapping(IO &IO, COFF::AuxiliarybfAndefSymbol &AAS);
+  LLVM_ABI static void mapping(IO &IO, COFF::AuxiliarybfAndefSymbol &AAS);
 };
 
 template <> struct MappingTraits<COFF::AuxiliaryWeakExternal> {
-  static void mapping(IO &IO, COFF::AuxiliaryWeakExternal &AWE);
+  LLVM_ABI static void mapping(IO &IO, COFF::AuxiliaryWeakExternal &AWE);
 };
 
 template <> struct MappingTraits<COFF::AuxiliarySectionDefinition> {
-  static void mapping(IO &IO, COFF::AuxiliarySectionDefinition &ASD);
+  LLVM_ABI static void mapping(IO &IO, COFF::AuxiliarySectionDefinition &ASD);
 };
 
 template <> struct MappingTraits<COFF::AuxiliaryCLRToken> {
-  static void mapping(IO &IO, COFF::AuxiliaryCLRToken &ACT);
+  LLVM_ABI static void mapping(IO &IO, COFF::AuxiliaryCLRToken &ACT);
 };
 
 template <> struct MappingTraits<object::coff_load_configuration32> {
-  static void mapping(IO &IO, object::coff_load_configuration32 &ACT);
+  LLVM_ABI static void mapping(IO &IO, object::coff_load_configuration32 &ACT);
 };
 
 template <> struct MappingTraits<object::coff_load_configuration64> {
-  static void mapping(IO &IO, object::coff_load_configuration64 &ACT);
+  LLVM_ABI static void mapping(IO &IO, object::coff_load_configuration64 &ACT);
 };
 
 template <> struct MappingTraits<object::coff_load_config_code_integrity> {
-  static void mapping(IO &IO, object::coff_load_config_code_integrity &ACT);
+  LLVM_ABI static void mapping(IO &IO,
+                               object::coff_load_config_code_integrity &ACT);
 };
 
 template <>
 struct MappingTraits<COFFYAML::Symbol> {
-  static void mapping(IO &IO, COFFYAML::Symbol &S);
+  LLVM_ABI static void mapping(IO &IO, COFFYAML::Symbol &S);
 };
 
 template <> struct MappingTraits<COFFYAML::SectionDataEntry> {
-  static void mapping(IO &IO, COFFYAML::SectionDataEntry &Sec);
+  LLVM_ABI static void mapping(IO &IO, COFFYAML::SectionDataEntry &Sec);
 };
 
 template <>
 struct MappingTraits<COFFYAML::Section> {
-  static void mapping(IO &IO, COFFYAML::Section &Sec);
+  LLVM_ABI static void mapping(IO &IO, COFFYAML::Section &Sec);
 };
 
 template <>
 struct MappingTraits<COFFYAML::Object> {
-  static void mapping(IO &IO, COFFYAML::Object &Obj);
+  LLVM_ABI static void mapping(IO &IO, COFFYAML::Object &Obj);
 };
 
 } // end namespace yaml
diff --git a/llvm/include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h b/llvm/include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h
index a70c2388c5168..2d78fc2319e37 100644
--- a/llvm/include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h
+++ b/llvm/include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h
@@ -18,6 +18,7 @@
 #include "llvm/DebugInfo/CodeView/TypeHashing.h"
 #include "llvm/ObjectYAML/YAML.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/YAMLTraits.h"
 #include <cstdint>
@@ -45,9 +46,9 @@ struct DebugHSection {
   std::vector<GlobalHash> Hashes;
 };
 
-DebugHSection fromDebugH(ArrayRef<uint8_t> DebugH);
-ArrayRef<uint8_t> toDebugH(const DebugHSection &DebugH,
-                           BumpPtrAllocator &Alloc);
+LLVM_ABI DebugHSection fromDebugH(ArrayRef<uint8_t> DebugH);
+LLVM_ABI ArrayRef<uint8_t> toDebugH(const DebugHSection &DebugH,
+                                    BumpPtrAllocator &Alloc);
 
 } // end namespace CodeViewYAML
 
diff --git a/llvm/include/llvm/ObjectYAML/ELFYAML.h b/llvm/include/llvm/ObjectYAML/ELFYAML.h
index a8236ca37b5ed..8bf92d8b364b5 100644
--- a/llvm/include/llvm/ObjectYAML/ELFYAML.h
+++ b/llvm/include/llvm/ObjectYAML/ELFYAML.h
@@ -20,6 +20,7 @@
 #include "llvm/Object/ELFTypes.h"
 #include "llvm/ObjectYAML/DWARFYAML.h"
 #include "llvm/ObjectYAML/YAML.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/YAMLTraits.h"
 #include <cstdint>
 #include <memory>
@@ -29,8 +30,8 @@
 namespace llvm {
 namespace ELFYAML {
 
-StringRef dropUniqueSuffix(StringRef S);
-std::string appendUniqueSuffix(StringRef Name, const Twine& Msg);
+LLVM_ABI StringRef dropUniqueSuffix(StringRef S);
+LLVM_ABI std::string appendUniqueSuffix(StringRef Name, const Twine &Msg);
 
 // These types are invariant across 32/64-bit ELF, so for simplicity just
 // directly give them their exact sizes. We don't need to worry about
@@ -224,7 +225,7 @@ struct NoteEntry {
   ELF_NT Type;
 };
 
-struct Chunk {
+struct LLVM_ABI Chunk {
   enum class ChunkKind {
     Dynamic,
     Group,
@@ -769,12 +770,12 @@ struct Object {
     llvm_unreachable("the section header table chunk must always be present");
   }
 
-  ELF_ELFOSABI getOSAbi() const;
-  unsigned getMachine() const;
+  LLVM_ABI ELF_ELFOSABI getOSAbi() const;
+  LLVM_ABI unsigned getMachine() const;
 };
 
-bool shouldAllocateFileSpace(ArrayRef<ProgramHeader> Phdrs,
-                             const NoBitsSection &S);
+LLVM_ABI bool shouldAllocateFileSpace(ArrayRef<ProgramHeader> Phdrs,
+                                      const NoBitsSection &S);
 
 } // end namespace ELFYAML
 } // end namespace llvm
@@ -806,226 +807,229 @@ namespace llvm {
 namespace yaml {
 
 template <> struct ScalarTraits<ELFYAML::YAMLIntUInt> {
-  static void output(const ELFYAML::YAMLIntUInt &Val, void *Ctx,
-                     raw_ostream &Out);
-  static StringRef input(StringRef Scalar, void *Ctx,
-                         ELFYAML::YAMLIntUInt &Val);
+  LLVM_ABI static void output(const ELFYAML::YAMLIntUInt &Val, void *Ctx,
+                              raw_ostream &Out);
+  LLVM_ABI static StringRef input(StringRef Scalar, void *Ctx,
+                                  ELFYAML::YAMLIntUInt &Val);
   static QuotingType mustQuote(StringRef) { return QuotingType::None; }
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::ELF_ET> {
-  static void enumeration(IO &IO, ELFYAML::ELF_ET &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_ET &Value);
 };
 
 template <> struct ScalarEnumerationTraits<ELFYAML::ELF_PT> {
-  static void enumeration(IO &IO, ELFYAML::ELF_PT &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_PT &Value);
 };
 
 template <> struct ScalarEnumerationTraits<ELFYAML::ELF_NT> {
-  static void enumeration(IO &IO, ELFYAML::ELF_NT &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_NT &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::ELF_EM> {
-  static void enumeration(IO &IO, ELFYAML::ELF_EM &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_EM &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::ELF_ELFCLASS> {
-  static void enumeration(IO &IO, ELFYAML::ELF_ELFCLASS &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_ELFCLASS &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::ELF_ELFDATA> {
-  static void enumeration(IO &IO, ELFYAML::ELF_ELFDATA &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_ELFDATA &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI> {
-  static void enumeration(IO &IO, ELFYAML::ELF_ELFOSABI &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_ELFOSABI &Value);
 };
 
 template <>
 struct ScalarBitSetTraits<ELFYAML::ELF_EF> {
-  static void bitset(IO &IO, ELFYAML::ELF_EF &Value);
+  LLVM_ABI static void bitset(IO &IO, ELFYAML::ELF_EF &Value);
 };
 
 template <> struct ScalarBitSetTraits<ELFYAML::ELF_PF> {
-  static void bitset(IO &IO, ELFYAML::ELF_PF &Value);
+  LLVM_ABI static void bitset(IO &IO, ELFYAML::ELF_PF &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::ELF_SHT> {
-  static void enumeration(IO &IO, ELFYAML::ELF_SHT &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_SHT &Value);
 };
 
 template <>
 struct ScalarBitSetTraits<ELFYAML::ELF_SHF> {
-  static void bitset(IO &IO, ELFYAML::ELF_SHF &Value);
+  LLVM_ABI static void bitset(IO &IO, ELFYAML::ELF_SHF &Value);
 };
 
 template <> struct ScalarEnumerationTraits<ELFYAML::ELF_SHN> {
-  static void enumeration(IO &IO, ELFYAML::ELF_SHN &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_SHN &Value);
 };
 
 template <> struct ScalarEnumerationTraits<ELFYAML::ELF_STB> {
-  static void enumeration(IO &IO, ELFYAML::ELF_STB &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_STB &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::ELF_STT> {
-  static void enumeration(IO &IO, ELFYAML::ELF_STT &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_STT &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::ELF_REL> {
-  static void enumeration(IO &IO, ELFYAML::ELF_REL &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_REL &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::ELF_DYNTAG> {
-  static void enumeration(IO &IO, ELFYAML::ELF_DYNTAG &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_DYNTAG &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::ELF_RSS> {
-  static void enumeration(IO &IO, ELFYAML::ELF_RSS &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::ELF_RSS &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::MIPS_AFL_REG> {
-  static void enumeration(IO &IO, ELFYAML::MIPS_AFL_REG &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::MIPS_AFL_REG &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::MIPS_ABI_FP> {
-  static void enumeration(IO &IO, ELFYAML::MIPS_ABI_FP &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::MIPS_ABI_FP &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::MIPS_AFL_EXT> {
-  static void enumeration(IO &IO, ELFYAML::MIPS_AFL_EXT &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::MIPS_AFL_EXT &Value);
 };
 
 template <>
 struct ScalarEnumerationTraits<ELFYAML::MIPS_ISA> {
-  static void enumeration(IO &IO, ELFYAML::MIPS_ISA &Value);
+  LLVM_ABI static void enumeration(IO &IO, ELFYAML::MIPS_ISA &Value);
 };
 
 template <>
 struct ScalarBitSetTraits<ELFYAML::MIPS_AFL_ASE> {
-  static void bitset(IO &IO, ELFYAML::MIPS_AFL_ASE &Value);
+  LLVM_ABI static void bitset(IO &IO, ELFYAML::MIPS_AFL_ASE &Value);
 };
 
 template <>
 struct ScalarBitSetTraits<ELFYAML::MIPS_AFL_FLAGS1> {
-  static void bitset(IO &IO, ELFYAML::MIPS_AFL_FLAGS1 &Value);
+  LLVM_ABI static void bitset(IO &IO, ELFYAML::MIPS_AFL_FLAGS1 &Value);
 };
 
 template <>
 struct MappingTraits<ELFYAML::FileHeader> {
-  static void mapping(IO &IO, ELFYAML::FileHeader &FileHdr);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::FileHeader &FileHdr);
 };
 
 template <> struct MappingTraits<ELFYAML::SectionHeader> {
-  static void mapping(IO &IO, ELFYAML::SectionHeader &SHdr);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::SectionHeader &SHdr);
 };
 
 template <> struct MappingTraits<ELFYAML::ProgramHeader> {
-  static void mapping(IO &IO, ELFYAML::ProgramHeader &FileHdr);
-  static std::string validate(IO &IO, ELFYAML::ProgramHeader &FileHdr);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::ProgramHeader &FileHdr);
+  LLVM_ABI static std::string validate(IO &IO, ELFYAML::ProgramHeader &FileHdr);
 };
 
 template <>
 struct MappingTraits<ELFYAML::Symbol> {
-  static void mapping(IO &IO, ELFYAML::Symbol &Symbol);
-  static std::string validate(IO &IO, ELFYAML::Symbol &Symbol);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::Symbol &Symbol);
+  LLVM_ABI static std::string validate(IO &IO, ELFYAML::Symbol &Symbol);
 };
 
 template <> struct MappingTraits<ELFYAML::StackSizeEntry> {
-  static void mapping(IO &IO, ELFYAML::StackSizeEntry &Rel);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::StackSizeEntry &Rel);
 };
 
 template <> struct MappingTraits<ELFYAML::BBAddrMapEntry> {
-  static void mapping(IO &IO, ELFYAML::BBAddrMapEntry &E);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::BBAddrMapEntry &E);
 };
 
 template <> struct MappingTraits<ELFYAML::BBAddrMapEntry::BBRangeEntry> {
-  static void mapping(IO &IO, ELFYAML::BBAddrMapEntry::BBRangeEntry &E);
+  LLVM_ABI static void mapping(IO &IO,
+                               ELFYAML::BBAddrMapEntry::BBRangeEntry &E);
 };
 
 template <> struct MappingTraits<ELFYAML::BBAddrMapEntry::BBEntry> {
-  static void mapping(IO &IO, ELFYAML::BBAddrMapEntry::BBEntry &E);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::BBAddrMapEntry::BBEntry &E);
 };
 
 template <> struct MappingTraits<ELFYAML::PGOAnalysisMapEntry> {
-  static void mapping(IO &IO, ELFYAML::PGOAnalysisMapEntry &Rel);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::PGOAnalysisMapEntry &Rel);
 };
 
 template <> struct MappingTraits<ELFYAML::PGOAnalysisMapEntry::PGOBBEntry> {
-  static void mapping(IO &IO, ELFYAML::PGOAnalysisMapEntry::PGOBBEntry &Rel);
+  LLVM_ABI static void mapping(IO &IO,
+                               ELFYAML::PGOAnalysisMapEntry::PGOBBEntry &Rel);
 };
 
 template <>
 struct MappingTraits<ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry> {
-  static void
+  LLVM_ABI static void
   mapping(IO &IO,
           ELFYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry &Rel);
 };
 
 template <> struct MappingTraits<ELFYAML::GnuHashHeader> {
-  static void mapping(IO &IO, ELFYAML::GnuHashHeader &Rel);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::GnuHashHeader &Rel);
 };
 
 template <> struct MappingTraits<ELFYAML::DynamicEntry> {
-  static void mapping(IO &IO, ELFYAML::DynamicEntry &Rel);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::DynamicEntry &Rel);
 };
 
 template <> struct MappingTraits<ELFYAML::NoteEntry> {
-  static void mapping(IO &IO, ELFYAML::NoteEntry &N);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::NoteEntry &N);
 };
 
 template <> struct MappingTraits<ELFYAML::VerdefEntry> {
-  static void mapping(IO &IO, ELFYAML::VerdefEntry &E);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::VerdefEntry &E);
 };
 
 template <> struct MappingTraits<ELFYAML::VerneedEntry> {
-  static void mapping(IO &IO, ELFYAML::VerneedEntry &E);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::VerneedEntry &E);
 };
 
 template <> struct MappingTraits<ELFYAML::VernauxEntry> {
-  static void mapping(IO &IO, ELFYAML::VernauxEntry &E);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::VernauxEntry &E);
 };
 
 template <> struct MappingTraits<ELFYAML::LinkerOption> {
-  static void mapping(IO &IO, ELFYAML::LinkerOption &Sym);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::LinkerOption &Sym);
 };
 
 template <> struct MappingTraits<ELFYAML::CallGraphEntryWeight> {
-  static void mapping(IO &IO, ELFYAML::CallGraphEntryWeight &E);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::CallGraphEntryWeight &E);
 };
 
 template <> struct MappingTraits<ELFYAML::Relocation> {
-  static void mapping(IO &IO, ELFYAML::Relocation &Rel);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::Relocation &Rel);
 };
 
 template <> struct MappingTraits<ELFYAML::ARMIndexTableEntry> {
-  static void mapping(IO &IO, ELFYAML::ARMIndexTableEntry &E);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::ARMIndexTableEntry &E);
 };
 
 template <> struct MappingTraits<std::unique_ptr<ELFYAML::Chunk>> {
-  static void mapping(IO &IO, std::unique_ptr<ELFYAML::Chunk> &C);
-  static std::string validate(IO &io, std::unique_ptr<ELFYAML::Chunk> &C);
+  LLVM_ABI static void mapping(IO &IO, std::unique_ptr<ELFYAML::Chunk> &C);
+  LLVM_ABI static std::string validate(IO &io,
+                                       std::unique_ptr<ELFYAML::Chunk> &C);
 };
 
 template <>
 struct MappingTraits<ELFYAML::Object> {
-  static void mapping(IO &IO, ELFYAML::Object &Object);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::Object &Object);
 };
 
 template <> struct MappingTraits<ELFYAML::SectionOrType> {
-  static void mapping(IO &IO, ELFYAML::SectionOrType &sectionOrType);
+  LLVM_ABI static void mapping(IO &IO, ELFYAML::SectionOrType &sectionOrType);
 };
 
 } // end namespace yaml
diff --git a/llvm/include/llvm/ObjectYAML/GOFFYAML.h b/llvm/include/llvm/ObjectYAML/GOFFYAML.h
index 74aeade54b8f9..a3a9479ae1624 100644
--- a/llvm/include/llvm/ObjectYAML/GOFFYAML.h
+++ b/llvm/include/llvm/ObjectYAML/GOFFYAML.h
@@ -16,6 +16,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/GOFF.h"
 #include "llvm/ObjectYAML/YAML.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 
 namespace llvm {
@@ -37,7 +38,7 @@ struct FileHeader {
 
 struct Object {
   FileHeader Header;
-  Object();
+  LLVM_ABI Object();
 };
 } // end namespace GOFFYAML
 } // end namespace llvm
diff --git a/llvm/include/llvm/ObjectYAML/MachOYAML.h b/llvm/include/llvm/ObjectYAML/MachOYAML.h
index ccb81f5702d0e..165679d07781f 100644
--- a/llvm/include/llvm/ObjectYAML/MachOYAML.h
+++ b/llvm/include/llvm/ObjectYAML/MachOYAML.h
@@ -19,6 +19,7 @@
 #include "llvm/BinaryFormat/MachO.h"
 #include "llvm/ObjectYAML/DWARFYAML.h"
 #include "llvm/ObjectYAML/YAML.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/YAMLTraits.h"
 #include <cstdint>
 #include <optional>
@@ -70,7 +71,7 @@ struct FileHeader {
   llvm::yaml::Hex32 reserved;
 };
 
-struct LoadCommand {
+struct LLVM_ABI LoadCommand {
   virtual ~LoadCommand();
 
   llvm::MachO::macho_load_command Data;
@@ -133,7 +134,7 @@ struct LinkEditData {
   std::vector<DataInCodeEntry> DataInCode;
   std::vector<yaml::Hex8> ChainedFixups;
 
-  bool isEmpty() const;
+  LLVM_ABI bool isEmpty() const;
 };
 
 struct Object {
@@ -188,64 +189,66 @@ class raw_ostream;
 namespace yaml {
 
 template <> struct MappingTraits<MachOYAML::FileHeader> {
-  static void mapping(IO &IO, MachOYAML::FileHeader &FileHeader);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::FileHeader &FileHeader);
 };
 
 template <> struct MappingTraits<MachOYAML::Object> {
-  static void mapping(IO &IO, MachOYAML::Object &Object);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::Object &Object);
 };
 
 template <> struct MappingTraits<MachOYAML::FatHeader> {
-  static void mapping(IO &IO, MachOYAML::FatHeader &FatHeader);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::FatHeader &FatHeader);
 };
 
 template <> struct MappingTraits<MachOYAML::FatArch> {
-  static void mapping(IO &IO, MachOYAML::FatArch &FatArch);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::FatArch &FatArch);
 };
 
 template <> struct MappingTraits<MachOYAML::UniversalBinary> {
-  static void mapping(IO &IO, MachOYAML::UniversalBinary &UniversalBinary);
+  LLVM_ABI static void mapping(IO &IO,
+                               MachOYAML::UniversalBinary &UniversalBinary);
 };
 
 template <> struct MappingTraits<MachOYAML::LoadCommand> {
-  static void mapping(IO &IO, MachOYAML::LoadCommand &LoadCommand);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::LoadCommand &LoadCommand);
 };
 
 template <> struct MappingTraits<MachOYAML::LinkEditData> {
-  static void mapping(IO &IO, MachOYAML::LinkEditData &LinkEditData);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::LinkEditData &LinkEditData);
 };
 
 template <> struct MappingTraits<MachOYAML::RebaseOpcode> {
-  static void mapping(IO &IO, MachOYAML::RebaseOpcode &RebaseOpcode);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::RebaseOpcode &RebaseOpcode);
 };
 
 template <> struct MappingTraits<MachOYAML::BindOpcode> {
-  static void mapping(IO &IO, MachOYAML::BindOpcode &BindOpcode);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::BindOpcode &BindOpcode);
 };
 
 template <> struct MappingTraits<MachOYAML::ExportEntry> {
-  static void mapping(IO &IO, MachOYAML::ExportEntry &ExportEntry);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::ExportEntry &ExportEntry);
 };
 
 template <> struct MappingTraits<MachOYAML::Relocation> {
-  static void mapping(IO &IO, MachOYAML::Relocation &R);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::Relocation &R);
 };
 
 template <> struct MappingTraits<MachOYAML::Section> {
-  static void mapping(IO &IO, MachOYAML::Section &Section);
-  static std::string validate(IO &io, MachOYAML::Section &Section);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::Section &Section);
+  LLVM_ABI static std::string validate(IO &io, MachOYAML::Section &Section);
 };
 
 template <> struct MappingTraits<MachOYAML::NListEntry> {
-  static void mapping(IO &IO, MachOYAML::NListEntry &NListEntry);
+  LLVM_ABI static void mapping(IO &IO, MachOYAML::NListEntry &NListEntry);
 };
 
 template <> struct MappingTraits<MachO::build_tool_version> {
-  static void mapping(IO &IO, MachO::build_tool_version &tool);
+  LLVM_ABI static void mapping(IO &IO, MachO::build_tool_version &tool);
 };
 
 template <> struct MappingTraits<MachOYAML::DataInCodeEntry> {
-  static void mapping(IO &IO, MachOYAML::DataInCodeEntry &DataInCodeEntry);
+  LLVM_ABI static void mapping(IO &IO,
+                               MachOYAML::DataInCodeEntry &DataInCodeEntry);
 };
 
 #define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct)                         \
@@ -298,9 +301,9 @@ template <> struct ScalarEnumerationTraits<MachO::BindOpcode> {
 using char_16 = char[16];
 
 template <> struct ScalarTraits<char_16> {
-  static void output(const char_16 &Val, void *, raw_ostream &Out);
-  static StringRef input(StringRef Scalar, void *, char_16 &Val);
-  static QuotingType mustQuote(StringRef S);
+  LLVM_ABI static void output(const char_16 &Val, void *, raw_ostream &Out);
+  LLVM_ABI static StringRef input(StringRef Scalar, void *, char_16 &Val);
+  LLVM_ABI static QuotingType mustQuote(StringRef S);
 };
 
 // This trait is used for UUIDs. It reads and writes them matching otool's
@@ -308,9 +311,9 @@ template <> struct ScalarTraits<char_16> {
 using uuid_t = raw_ostream::uuid_t;
 
 template <> struct ScalarTraits<uuid_t> {
-  static void output(const uuid_t &Val, void *, raw_ostream &Out);
-  static StringRef input(StringRef Scalar, void *, uuid_t &Val);
-  static QuotingType mustQuote(StringRef S);
+  LLVM_ABI static void output(const uuid_t &Val, void *, raw_ostream &Out);
+  LLVM_ABI static StringRef input(StringRef Scalar, void *, uuid_t &Val);
+  LLVM_ABI static QuotingType mustQuote(StringRef S);
 };
 
 // Load Command struct mapping traits
@@ -324,19 +327,19 @@ template <> struct ScalarTraits<uuid_t> {
 
 // Extra structures used by load commands
 template <> struct MappingTraits<MachO::dylib> {
-  static void mapping(IO &IO, MachO::dylib &LoadCommand);
+  LLVM_ABI static void mapping(IO &IO, MachO::dylib &LoadCommand);
 };
 
 template <> struct MappingTraits<MachO::fvmlib> {
-  static void mapping(IO &IO, MachO::fvmlib &LoadCommand);
+  LLVM_ABI static void mapping(IO &IO, MachO::fvmlib &LoadCommand);
 };
 
 template <> struct MappingTraits<MachO::section> {
-  static void mapping(IO &IO, MachO::section &LoadCommand);
+  LLVM_ABI static void mapping(IO &IO, MachO::section &LoadCommand);
 };
 
 template <> struct MappingTraits<MachO::section_64> {
-  static void mapping(IO &IO, MachO::section_64 &LoadCommand);
+  LLVM_ABI static void mapping(IO &IO, MachO::section_64 &LoadCommand);
 };
 
 } // end namespace yaml
diff --git a/llvm/include/llvm/ObjectYAML/MinidumpYAML.h b/llvm/include/llvm/ObjectYAML/MinidumpYAML.h
index 02371e6d86720..497d190adbc09 100644
--- a/llvm/include/llvm/ObjectYAML/MinidumpYAML.h
+++ b/llvm/include/llvm/ObjectYAML/MinidumpYAML.h
@@ -12,6 +12,7 @@
 #include "llvm/BinaryFormat/Minidump.h"
 #include "llvm/Object/Minidump.h"
 #include "llvm/ObjectYAML/YAML.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/YAMLTraits.h"
 
 namespace llvm {
@@ -24,7 +25,7 @@ namespace MinidumpYAML {
 /// one stream Kind can be used to represent multiple stream Types (e.g. any
 /// unrecognised stream Type will be handled via RawContentStream). The mapping
 /// from Types to Kinds is fixed and given by the static getKind function.
-struct Stream {
+struct LLVM_ABI Stream {
   enum class StreamKind {
     Exception,
     MemoryInfoList,
@@ -234,7 +235,7 @@ struct Object {
   /// The list of streams in this minidump object.
   std::vector<std::unique_ptr<Stream>> Streams;
 
-  static Expected<Object> create(const object::MinidumpFile &File);
+  LLVM_ABI static Expected<Object> create(const object::MinidumpFile &File);
 };
 
 } // namespace MinidumpYAML
@@ -254,19 +255,21 @@ template <> struct BlockScalarTraits<MinidumpYAML::BlockStringRef> {
 };
 
 template <> struct MappingTraits<std::unique_ptr<MinidumpYAML::Stream>> {
-  static void mapping(IO &IO, std::unique_ptr<MinidumpYAML::Stream> &S);
-  static std::string validate(IO &IO, std::unique_ptr<MinidumpYAML::Stream> &S);
+  LLVM_ABI static void mapping(IO &IO,
+                               std::unique_ptr<MinidumpYAML::Stream> &S);
+  LLVM_ABI static std::string
+  validate(IO &IO, std::unique_ptr<MinidumpYAML::Stream> &S);
 };
 
 template <> struct MappingContextTraits<minidump::MemoryDescriptor, BinaryRef> {
-  static void mapping(IO &IO, minidump::MemoryDescriptor &Memory,
-                      BinaryRef &Content);
+  LLVM_ABI static void mapping(IO &IO, minidump::MemoryDescriptor &Memory,
+                               BinaryRef &Content);
 };
 
 template <>
 struct MappingContextTraits<minidump::MemoryDescriptor_64, BinaryRef> {
-  static void mapping(IO &IO, minidump::MemoryDescriptor_64 &Memory,
-                      BinaryRef &Content);
+  LLVM_ABI static void mapping(IO &IO, minidump::MemoryDescriptor_64 &Memory,
+                               BinaryRef &Content);
 };
 
 } // namespace yaml
diff --git a/llvm/include/llvm/ObjectYAML/ObjectYAML.h b/llvm/include/llvm/ObjectYAML/ObjectYAML.h
index 7fd15cf290f4a..88373b8080682 100644
--- a/llvm/include/llvm/ObjectYAML/ObjectYAML.h
+++ b/llvm/include/llvm/ObjectYAML/ObjectYAML.h
@@ -19,6 +19,7 @@
 #include "llvm/ObjectYAML/OffloadYAML.h"
 #include "llvm/ObjectYAML/WasmYAML.h"
 #include "llvm/ObjectYAML/XCOFFYAML.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/YAMLTraits.h"
 #include <memory>
 
@@ -42,7 +43,7 @@ struct YamlObjectFile {
 };
 
 template <> struct MappingTraits<YamlObjectFile> {
-  static void mapping(IO &IO, YamlObjectFile &ObjectFile);
+  LLVM_ABI static void mapping(IO &IO, YamlObjectFile &ObjectFile);
 };
 
 } // end namespace yaml
diff --git a/llvm/include/llvm/ObjectYAML/OffloadYAML.h b/llvm/include/llvm/ObjectYAML/OffloadYAML.h
index f897b52aa8b0e..764972dbe7e06 100644
--- a/llvm/include/llvm/ObjectYAML/OffloadYAML.h
+++ b/llvm/include/llvm/ObjectYAML/OffloadYAML.h
@@ -17,6 +17,7 @@
 
 #include "llvm/Object/OffloadBinary.h"
 #include "llvm/ObjectYAML/YAML.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/YAMLTraits.h"
 #include <optional>
 
@@ -54,23 +55,23 @@ namespace llvm {
 namespace yaml {
 
 template <> struct ScalarEnumerationTraits<object::ImageKind> {
-  static void enumeration(IO &IO, object::ImageKind &Value);
+  LLVM_ABI static void enumeration(IO &IO, object::ImageKind &Value);
 };
 
 template <> struct ScalarEnumerationTraits<object::OffloadKind> {
-  static void enumeration(IO &IO, object::OffloadKind &Value);
+  LLVM_ABI static void enumeration(IO &IO, object::OffloadKind &Value);
 };
 
 template <> struct MappingTraits<OffloadYAML::Binary> {
-  static void mapping(IO &IO, OffloadYAML::Binary &O);
+  LLVM_ABI static void mapping(IO &IO, OffloadYAML::Binary &O);
 };
 
 template <> struct MappingTraits<OffloadYAML::Binary::StringEntry> {
-  static void mapping(IO &IO, OffloadYAML::Binary::StringEntry &M);
+  LLVM_ABI static void mapping(IO &IO, OffloadYAML::Binary::StringEntry &M);
 };
 
 template <> struct MappingTraits<OffloadYAML::Binary::Member> {
-  static void mapping(IO &IO, OffloadYAML::Binary::Member &M);
+  LLVM_ABI static void mapping(IO &IO, OffloadYAML::Binary::Member &M);
 };
 
 } // end namespace yaml
diff --git a/llvm/include/llvm/ObjectYAML/WasmYAML.h b/llvm/include/llvm/ObjectYAML/WasmYAML.h
index b0ab04d1d8ac3..45f3ca0c46da9 100644
--- a/llvm/include/llvm/ObjectYAML/WasmYAML.h
+++ b/llvm/include/llvm/ObjectYAML/WasmYAML.h
@@ -19,6 +19,7 @@
 #include "llvm/BinaryFormat/Wasm.h"
 #include "llvm/ObjectYAML/YAML.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <memory>
 #include <vector>
@@ -184,7 +185,7 @@ struct Comdat {
   std::vector<ComdatEntry> Entries;
 };
 
-struct Section {
+struct LLVM_ABI Section {
   explicit Section(SectionType SecType) : Type(SecType) {}
   virtual ~Section();
 
@@ -452,151 +453,153 @@ namespace llvm {
 namespace yaml {
 
 template <> struct MappingTraits<WasmYAML::FileHeader> {
-  static void mapping(IO &IO, WasmYAML::FileHeader &FileHdr);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::FileHeader &FileHdr);
 };
 
 template <> struct MappingTraits<std::unique_ptr<WasmYAML::Section>> {
-  static void mapping(IO &IO, std::unique_ptr<WasmYAML::Section> &Section);
+  LLVM_ABI static void mapping(IO &IO,
+                               std::unique_ptr<WasmYAML::Section> &Section);
 };
 
 template <> struct MappingTraits<WasmYAML::Object> {
-  static void mapping(IO &IO, WasmYAML::Object &Object);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::Object &Object);
 };
 
 template <> struct MappingTraits<WasmYAML::Import> {
-  static void mapping(IO &IO, WasmYAML::Import &Import);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::Import &Import);
 };
 
 template <> struct MappingTraits<WasmYAML::Export> {
-  static void mapping(IO &IO, WasmYAML::Export &Export);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::Export &Export);
 };
 
 template <> struct MappingTraits<WasmYAML::Global> {
-  static void mapping(IO &IO, WasmYAML::Global &Global);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::Global &Global);
 };
 
 template <> struct ScalarBitSetTraits<WasmYAML::LimitFlags> {
-  static void bitset(IO &IO, WasmYAML::LimitFlags &Value);
+  LLVM_ABI static void bitset(IO &IO, WasmYAML::LimitFlags &Value);
 };
 
 template <> struct ScalarBitSetTraits<WasmYAML::SymbolFlags> {
-  static void bitset(IO &IO, WasmYAML::SymbolFlags &Value);
+  LLVM_ABI static void bitset(IO &IO, WasmYAML::SymbolFlags &Value);
 };
 
 template <> struct ScalarEnumerationTraits<WasmYAML::SymbolKind> {
-  static void enumeration(IO &IO, WasmYAML::SymbolKind &Kind);
+  LLVM_ABI static void enumeration(IO &IO, WasmYAML::SymbolKind &Kind);
 };
 
 template <> struct ScalarBitSetTraits<WasmYAML::SegmentFlags> {
-  static void bitset(IO &IO, WasmYAML::SegmentFlags &Value);
+  LLVM_ABI static void bitset(IO &IO, WasmYAML::SegmentFlags &Value);
 };
 
 template <> struct ScalarEnumerationTraits<WasmYAML::SectionType> {
-  static void enumeration(IO &IO, WasmYAML::SectionType &Type);
+  LLVM_ABI static void enumeration(IO &IO, WasmYAML::SectionType &Type);
 };
 
 template <> struct MappingTraits<WasmYAML::Signature> {
-  static void mapping(IO &IO, WasmYAML::Signature &Signature);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::Signature &Signature);
 };
 
 template <> struct MappingTraits<WasmYAML::Table> {
-  static void mapping(IO &IO, WasmYAML::Table &Table);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::Table &Table);
 };
 
 template <> struct MappingTraits<WasmYAML::Limits> {
-  static void mapping(IO &IO, WasmYAML::Limits &Limits);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::Limits &Limits);
 };
 
 template <> struct MappingTraits<WasmYAML::Function> {
-  static void mapping(IO &IO, WasmYAML::Function &Function);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::Function &Function);
 };
 
 template <> struct MappingTraits<WasmYAML::Relocation> {
-  static void mapping(IO &IO, WasmYAML::Relocation &Relocation);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::Relocation &Relocation);
 };
 
 template <> struct MappingTraits<WasmYAML::NameEntry> {
-  static void mapping(IO &IO, WasmYAML::NameEntry &NameEntry);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::NameEntry &NameEntry);
 };
 
 template <> struct MappingTraits<WasmYAML::ProducerEntry> {
-  static void mapping(IO &IO, WasmYAML::ProducerEntry &ProducerEntry);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::ProducerEntry &ProducerEntry);
 };
 
 template <> struct ScalarEnumerationTraits<WasmYAML::FeaturePolicyPrefix> {
-  static void enumeration(IO &IO, WasmYAML::FeaturePolicyPrefix &Prefix);
+  LLVM_ABI static void enumeration(IO &IO,
+                                   WasmYAML::FeaturePolicyPrefix &Prefix);
 };
 
 template <> struct MappingTraits<WasmYAML::FeatureEntry> {
-  static void mapping(IO &IO, WasmYAML::FeatureEntry &FeatureEntry);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::FeatureEntry &FeatureEntry);
 };
 
 template <> struct MappingTraits<WasmYAML::SegmentInfo> {
-  static void mapping(IO &IO, WasmYAML::SegmentInfo &SegmentInfo);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::SegmentInfo &SegmentInfo);
 };
 
 template <> struct MappingTraits<WasmYAML::LocalDecl> {
-  static void mapping(IO &IO, WasmYAML::LocalDecl &LocalDecl);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::LocalDecl &LocalDecl);
 };
 
 template <> struct MappingTraits<WasmYAML::InitExpr> {
-  static void mapping(IO &IO, WasmYAML::InitExpr &Expr);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::InitExpr &Expr);
 };
 
 template <> struct MappingTraits<WasmYAML::DataSegment> {
-  static void mapping(IO &IO, WasmYAML::DataSegment &Segment);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::DataSegment &Segment);
 };
 
 template <> struct MappingTraits<WasmYAML::ElemSegment> {
-  static void mapping(IO &IO, WasmYAML::ElemSegment &Segment);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::ElemSegment &Segment);
 };
 
 template <> struct MappingTraits<WasmYAML::SymbolInfo> {
-  static void mapping(IO &IO, WasmYAML::SymbolInfo &Info);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::SymbolInfo &Info);
 };
 
 template <> struct MappingTraits<WasmYAML::InitFunction> {
-  static void mapping(IO &IO, WasmYAML::InitFunction &Init);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::InitFunction &Init);
 };
 
 template <> struct ScalarEnumerationTraits<WasmYAML::ComdatKind> {
-  static void enumeration(IO &IO, WasmYAML::ComdatKind &Kind);
+  LLVM_ABI static void enumeration(IO &IO, WasmYAML::ComdatKind &Kind);
 };
 
 template <> struct MappingTraits<WasmYAML::ComdatEntry> {
-  static void mapping(IO &IO, WasmYAML::ComdatEntry &ComdatEntry);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::ComdatEntry &ComdatEntry);
 };
 
 template <> struct MappingTraits<WasmYAML::Comdat> {
-  static void mapping(IO &IO, WasmYAML::Comdat &Comdat);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::Comdat &Comdat);
 };
 
 template <> struct ScalarEnumerationTraits<WasmYAML::ValueType> {
-  static void enumeration(IO &IO, WasmYAML::ValueType &Type);
+  LLVM_ABI static void enumeration(IO &IO, WasmYAML::ValueType &Type);
 };
 
 template <> struct ScalarEnumerationTraits<WasmYAML::ExportKind> {
-  static void enumeration(IO &IO, WasmYAML::ExportKind &Kind);
+  LLVM_ABI static void enumeration(IO &IO, WasmYAML::ExportKind &Kind);
 };
 
 template <> struct ScalarEnumerationTraits<WasmYAML::TableType> {
-  static void enumeration(IO &IO, WasmYAML::TableType &Type);
+  LLVM_ABI static void enumeration(IO &IO, WasmYAML::TableType &Type);
 };
 
 template <> struct ScalarEnumerationTraits<WasmYAML::Opcode> {
-  static void enumeration(IO &IO, WasmYAML::Opcode &Opcode);
+  LLVM_ABI static void enumeration(IO &IO, WasmYAML::Opcode &Opcode);
 };
 
 template <> struct ScalarEnumerationTraits<WasmYAML::RelocType> {
-  static void enumeration(IO &IO, WasmYAML::RelocType &Kind);
+  LLVM_ABI static void enumeration(IO &IO, WasmYAML::RelocType &Kind);
 };
 
 template <> struct MappingTraits<WasmYAML::DylinkImportInfo> {
-  static void mapping(IO &IO, WasmYAML::DylinkImportInfo &Info);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::DylinkImportInfo &Info);
 };
 
 template <> struct MappingTraits<WasmYAML::DylinkExportInfo> {
-  static void mapping(IO &IO, WasmYAML::DylinkExportInfo &Info);
+  LLVM_ABI static void mapping(IO &IO, WasmYAML::DylinkExportInfo &Info);
 };
 
 } // end namespace yaml
diff --git a/llvm/include/llvm/ObjectYAML/XCOFFYAML.h b/llvm/include/llvm/ObjectYAML/XCOFFYAML.h
index 2874c998d6903..f15bd8459bcc6 100644
--- a/llvm/include/llvm/ObjectYAML/XCOFFYAML.h
+++ b/llvm/include/llvm/ObjectYAML/XCOFFYAML.h
@@ -14,6 +14,7 @@
 
 #include "llvm/BinaryFormat/XCOFF.h"
 #include "llvm/ObjectYAML/YAML.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 #include <vector>
 
@@ -94,7 +95,7 @@ enum AuxSymbolType : uint8_t {
   AUX_STAT = 249
 };
 
-struct AuxSymbolEnt {
+struct LLVM_ABI AuxSymbolEnt {
   AuxSymbolType Type;
 
   explicit AuxSymbolEnt(AuxSymbolType T) : Type(T) {}
@@ -216,7 +217,7 @@ struct Object {
   std::vector<Section> Sections;
   std::vector<Symbol> Symbols;
   StringTable StrTbl;
-  Object();
+  LLVM_ABI Object();
 };
 } // namespace XCOFFYAML
 } // namespace llvm
@@ -230,63 +231,65 @@ namespace llvm {
 namespace yaml {
 
 template <> struct ScalarBitSetTraits<XCOFF::SectionTypeFlags> {
-  static void bitset(IO &IO, XCOFF::SectionTypeFlags &Value);
+  LLVM_ABI static void bitset(IO &IO, XCOFF::SectionTypeFlags &Value);
 };
 
 template <> struct ScalarEnumerationTraits<XCOFF::DwarfSectionSubtypeFlags> {
-  static void enumeration(IO &IO, XCOFF::DwarfSectionSubtypeFlags &Value);
+  LLVM_ABI static void enumeration(IO &IO,
+                                   XCOFF::DwarfSectionSubtypeFlags &Value);
 };
 
 template <> struct ScalarEnumerationTraits<XCOFF::StorageClass> {
-  static void enumeration(IO &IO, XCOFF::StorageClass &Value);
+  LLVM_ABI static void enumeration(IO &IO, XCOFF::StorageClass &Value);
 };
 
 template <> struct ScalarEnumerationTraits<XCOFF::StorageMappingClass> {
-  static void enumeration(IO &IO, XCOFF::StorageMappingClass &Value);
+  LLVM_ABI static void enumeration(IO &IO, XCOFF::StorageMappingClass &Value);
 };
 
 template <> struct ScalarEnumerationTraits<XCOFF::SymbolType> {
-  static void enumeration(IO &IO, XCOFF::SymbolType &Value);
+  LLVM_ABI static void enumeration(IO &IO, XCOFF::SymbolType &Value);
 };
 
 template <> struct ScalarEnumerationTraits<XCOFF::CFileStringType> {
-  static void enumeration(IO &IO, XCOFF::CFileStringType &Type);
+  LLVM_ABI static void enumeration(IO &IO, XCOFF::CFileStringType &Type);
 };
 
 template <> struct ScalarEnumerationTraits<XCOFFYAML::AuxSymbolType> {
-  static void enumeration(IO &IO, XCOFFYAML::AuxSymbolType &Type);
+  LLVM_ABI static void enumeration(IO &IO, XCOFFYAML::AuxSymbolType &Type);
 };
 
 template <> struct MappingTraits<XCOFFYAML::FileHeader> {
-  static void mapping(IO &IO, XCOFFYAML::FileHeader &H);
+  LLVM_ABI static void mapping(IO &IO, XCOFFYAML::FileHeader &H);
 };
 
 template <> struct MappingTraits<XCOFFYAML::AuxiliaryHeader> {
-  static void mapping(IO &IO, XCOFFYAML::AuxiliaryHeader &AuxHdr);
+  LLVM_ABI static void mapping(IO &IO, XCOFFYAML::AuxiliaryHeader &AuxHdr);
 };
 
 template <> struct MappingTraits<std::unique_ptr<XCOFFYAML::AuxSymbolEnt>> {
-  static void mapping(IO &IO, std::unique_ptr<XCOFFYAML::AuxSymbolEnt> &AuxSym);
+  LLVM_ABI static void
+  mapping(IO &IO, std::unique_ptr<XCOFFYAML::AuxSymbolEnt> &AuxSym);
 };
 
 template <> struct MappingTraits<XCOFFYAML::Symbol> {
-  static void mapping(IO &IO, XCOFFYAML::Symbol &S);
+  LLVM_ABI static void mapping(IO &IO, XCOFFYAML::Symbol &S);
 };
 
 template <> struct MappingTraits<XCOFFYAML::Relocation> {
-  static void mapping(IO &IO, XCOFFYAML::Relocation &R);
+  LLVM_ABI static void mapping(IO &IO, XCOFFYAML::Relocation &R);
 };
 
 template <> struct MappingTraits<XCOFFYAML::Section> {
-  static void mapping(IO &IO, XCOFFYAML::Section &Sec);
+  LLVM_ABI static void mapping(IO &IO, XCOFFYAML::Section &Sec);
 };
 
 template <> struct MappingTraits<XCOFFYAML::StringTable> {
-  static void mapping(IO &IO, XCOFFYAML::StringTable &Str);
+  LLVM_ABI static void mapping(IO &IO, XCOFFYAML::StringTable &Str);
 };
 
 template <> struct MappingTraits<XCOFFYAML::Object> {
-  static void mapping(IO &IO, XCOFFYAML::Object &Obj);
+  LLVM_ABI static void mapping(IO &IO, XCOFFYAML::Object &Obj);
 };
 
 } // namespace yaml
diff --git a/llvm/include/llvm/Option/Option.h b/llvm/include/llvm/Option/Option.h
index 192cb3c96700a..eac964159dc42 100644
--- a/llvm/include/llvm/Option/Option.h
+++ b/llvm/include/llvm/Option/Option.h
@@ -216,7 +216,7 @@ class Option {
   /// always be false.
   LLVM_ABI bool matches(OptSpecifier ID) const;
 
-  LLVM_ABI bool isRegisteredSC(StringRef SubCommand) const {
+  bool isRegisteredSC(StringRef SubCommand) const {
     assert(Info && "Must have a valid info!");
     assert(Owner && "Must have a valid owner!");
     return Owner->isValidForSubCommand(Info, SubCommand);
diff --git a/llvm/include/llvm/Plugins/PassPlugin.h b/llvm/include/llvm/Plugins/PassPlugin.h
index 6ca53b4407f25..285a2289e0216 100644
--- a/llvm/include/llvm/Plugins/PassPlugin.h
+++ b/llvm/include/llvm/Plugins/PassPlugin.h
@@ -133,7 +133,7 @@ class PassPlugin {
 ///   };
 /// }
 /// ```
-extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
+extern "C" LLVM_ABI ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
 llvmGetPassPluginInfo();
 #ifdef __clang__
 #pragma clang diagnostic pop
diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h
index 134195059f9e6..bccbc2006b898 100644
--- a/llvm/include/llvm/ProfileData/InstrProfReader.h
+++ b/llvm/include/llvm/ProfileData/InstrProfReader.h
@@ -730,7 +730,7 @@ class IndexedMemProfReader {
   getMemProfCallerCalleePairs() const;
 
   // Returns non-owned pointer to data access profile data.
-  LLVM_ABI memprof::DataAccessProfData *getDataAccessProfileData() const {
+  memprof::DataAccessProfData *getDataAccessProfileData() const {
     return DataAccessProfileData.get();
   }
 
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index b75dffaff19f7..c34eedbae649a 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -331,7 +331,7 @@ using TypeCountMap = std::map<FunctionId, uint64_t>;
 
 /// Write \p Map to the output stream. Keys are linearized using \p NameTable
 /// and written as ULEB128. Values are written as ULEB128 as well.
-std::error_code
+LLVM_ABI std::error_code
 serializeTypeMap(const TypeCountMap &Map,
                  const MapVector<FunctionId, uint32_t> &NameTable,
                  raw_ostream &OS);
diff --git a/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h b/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h
index 76e2d5b4fd3bc..cbdc76b9fed9d 100644
--- a/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h
+++ b/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h
@@ -17,6 +17,7 @@
 #include "llvm/Bitstream/BitstreamWriter.h"
 #include "llvm/Remarks/BitstreamRemarkContainer.h"
 #include "llvm/Remarks/RemarkSerializer.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
@@ -49,6 +50,7 @@ struct BitstreamRemarkSerializerHelper {
   uint64_t RecordRemarkArgWithDebugLocAbbrevID = 0;
   uint64_t RecordRemarkArgWithoutDebugLocAbbrevID = 0;
 
+  LLVM_ABI
   BitstreamRemarkSerializerHelper(BitstreamRemarkContainerType ContainerType,
                                   raw_ostream &OS);
 
@@ -64,36 +66,36 @@ struct BitstreamRemarkSerializerHelper {
   operator=(BitstreamRemarkSerializerHelper &&) = delete;
 
   /// Set up the necessary block info entries according to the container type.
-  void setupBlockInfo();
+  LLVM_ABI void setupBlockInfo();
 
   /// Set up the block info for the metadata block.
-  void setupMetaBlockInfo();
+  LLVM_ABI void setupMetaBlockInfo();
   /// The remark version in the metadata block.
-  void setupMetaRemarkVersion();
-  void emitMetaRemarkVersion(uint64_t RemarkVersion);
+  LLVM_ABI void setupMetaRemarkVersion();
+  LLVM_ABI void emitMetaRemarkVersion(uint64_t RemarkVersion);
   /// The strtab in the metadata block.
-  void setupMetaStrTab();
-  void emitMetaStrTab(const StringTable &StrTab);
+  LLVM_ABI void setupMetaStrTab();
+  LLVM_ABI void emitMetaStrTab(const StringTable &StrTab);
   /// The external file in the metadata block.
-  void setupMetaExternalFile();
-  void emitMetaExternalFile(StringRef Filename);
+  LLVM_ABI void setupMetaExternalFile();
+  LLVM_ABI void emitMetaExternalFile(StringRef Filename);
 
   /// The block info for the remarks block.
-  void setupRemarkBlockInfo();
+  LLVM_ABI void setupRemarkBlockInfo();
 
   /// Emit the main metadata at the beginning of the file
-  void emitMetaBlock(std::optional<StringRef> Filename = std::nullopt);
+  LLVM_ABI void emitMetaBlock(std::optional<StringRef> Filename = std::nullopt);
 
   /// Emit the remaining metadata at the end of the file. Here we emit metadata
   /// that is only known once all remarks were emitted.
-  void emitLateMetaBlock(const StringTable &StrTab);
+  LLVM_ABI void emitLateMetaBlock(const StringTable &StrTab);
 
   /// Emit a remark block. The string table is required.
-  void emitRemark(const Remark &Remark, StringTable &StrTab);
+  LLVM_ABI void emitRemark(const Remark &Remark, StringTable &StrTab);
 };
 
 /// Implementation of the remark serializer using LLVM bitstream.
-struct BitstreamRemarkSerializer : public RemarkSerializer {
+struct LLVM_ABI BitstreamRemarkSerializer : public RemarkSerializer {
   /// The file should contain:
   /// 1) The block info block that describes how to read the blocks.
   /// 2) The metadata block that contains various information about the remarks
@@ -137,7 +139,7 @@ struct BitstreamRemarkSerializer : public RemarkSerializer {
 };
 
 /// Serializer of metadata for bitstream remarks.
-struct BitstreamMetaSerializer : public MetaSerializer {
+struct LLVM_ABI BitstreamMetaSerializer : public MetaSerializer {
   std::optional<BitstreamRemarkSerializerHelper> Helper;
 
   StringRef ExternalFilename;
diff --git a/llvm/include/llvm/Remarks/RemarkStreamer.h b/llvm/include/llvm/Remarks/RemarkStreamer.h
index dd5bfcbc7ff99..ee2597347d14c 100644
--- a/llvm/include/llvm/Remarks/RemarkStreamer.h
+++ b/llvm/include/llvm/Remarks/RemarkStreamer.h
@@ -31,6 +31,7 @@
 #define LLVM_REMARKS_REMARKSTREAMER_H
 
 #include "llvm/Remarks/RemarkSerializer.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Regex.h"
 #include <memory>
@@ -50,9 +51,10 @@ class RemarkStreamer final {
   const std::optional<std::string> Filename;
 
 public:
+  LLVM_ABI
   RemarkStreamer(std::unique_ptr<remarks::RemarkSerializer> RemarkSerializer,
                  std::optional<StringRef> Filename = std::nullopt);
-  ~RemarkStreamer();
+  LLVM_ABI ~RemarkStreamer();
 
   /// Return the filename that the remark diagnostics are emitted to.
   std::optional<StringRef> getFilename() const {
@@ -72,11 +74,11 @@ class RemarkStreamer final {
 
   /// Set a pass filter based on a regex \p Filter.
   /// Returns an error if the regex is invalid.
-  Error setFilter(StringRef Filter);
+  LLVM_ABI Error setFilter(StringRef Filter);
   /// Check wether the string matches the filter.
-  bool matchesFilter(StringRef Str);
+  LLVM_ABI bool matchesFilter(StringRef Str);
   /// Check if the remarks also need to have associated metadata in a section.
-  bool needsSection() const;
+  LLVM_ABI bool needsSection() const;
 };
 } // end namespace remarks
 } // end namespace llvm
diff --git a/llvm/include/llvm/Support/AArch64BuildAttributes.h b/llvm/include/llvm/Support/AArch64BuildAttributes.h
index 477c7f4f7efee..e067799b79c53 100644
--- a/llvm/include/llvm/Support/AArch64BuildAttributes.h
+++ b/llvm/include/llvm/Support/AArch64BuildAttributes.h
@@ -19,6 +19,7 @@
 #define LLVM_SUPPORT_AARCH64BUILDATTRIBUTES_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -30,30 +31,30 @@ enum VendorID : unsigned {
   AEABI_PAUTHABI = 1,
   VENDOR_UNKNOWN = 404 // Treated as a private subsection name
 };
-StringRef getVendorName(unsigned const Vendor);
-VendorID getVendorID(StringRef const Vendor);
+LLVM_ABI StringRef getVendorName(unsigned const Vendor);
+LLVM_ABI VendorID getVendorID(StringRef const Vendor);
 
 enum SubsectionOptional : unsigned {
   REQUIRED = 0,
   OPTIONAL = 1,
   OPTIONAL_NOT_FOUND = 404
 };
-StringRef getOptionalStr(unsigned Optional);
-SubsectionOptional getOptionalID(StringRef Optional);
-StringRef getSubsectionOptionalUnknownError();
+LLVM_ABI StringRef getOptionalStr(unsigned Optional);
+LLVM_ABI SubsectionOptional getOptionalID(StringRef Optional);
+LLVM_ABI StringRef getSubsectionOptionalUnknownError();
 
 enum SubsectionType : unsigned { ULEB128 = 0, NTBS = 1, TYPE_NOT_FOUND = 404 };
-StringRef getTypeStr(unsigned Type);
-SubsectionType getTypeID(StringRef Type);
-StringRef getSubsectionTypeUnknownError();
+LLVM_ABI StringRef getTypeStr(unsigned Type);
+LLVM_ABI SubsectionType getTypeID(StringRef Type);
+LLVM_ABI StringRef getSubsectionTypeUnknownError();
 
 enum PauthABITags : unsigned {
   TAG_PAUTH_PLATFORM = 1,
   TAG_PAUTH_SCHEMA = 2,
   PAUTHABI_TAG_NOT_FOUND = 404
 };
-StringRef getPauthABITagsStr(unsigned PauthABITag);
-PauthABITags getPauthABITagsID(StringRef PauthABITag);
+LLVM_ABI StringRef getPauthABITagsStr(unsigned PauthABITag);
+LLVM_ABI PauthABITags getPauthABITagsID(StringRef PauthABITag);
 
 enum FeatureAndBitsTags : unsigned {
   TAG_FEATURE_BTI = 0,
@@ -61,8 +62,9 @@ enum FeatureAndBitsTags : unsigned {
   TAG_FEATURE_GCS = 2,
   FEATURE_AND_BITS_TAG_NOT_FOUND = 404
 };
-StringRef getFeatureAndBitsTagsStr(unsigned FeatureAndBitsTag);
-FeatureAndBitsTags getFeatureAndBitsTagsID(StringRef FeatureAndBitsTag);
+LLVM_ABI StringRef getFeatureAndBitsTagsStr(unsigned FeatureAndBitsTag);
+LLVM_ABI FeatureAndBitsTags
+getFeatureAndBitsTagsID(StringRef FeatureAndBitsTag);
 
 enum FeatureAndBitsFlag : unsigned {
   Feature_BTI_Flag = 1 << 0,
diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h
index 61a03281327cc..0b0d4343a9fcb 100644
--- a/llvm/include/llvm/Support/BranchProbability.h
+++ b/llvm/include/llvm/Support/BranchProbability.h
@@ -101,7 +101,7 @@ class BranchProbability {
   LLVM_ABI uint64_t scaleByInverse(uint64_t Num) const;
 
   /// Compute pow(Probability, N).
-  BranchProbability pow(unsigned N) const;
+  LLVM_ABI BranchProbability pow(unsigned N) const;
 
   BranchProbability &operator+=(BranchProbability RHS) {
     assert(N != UnknownN && RHS.N != UnknownN &&
diff --git a/llvm/include/llvm/Support/CodeGenCoverage.h b/llvm/include/llvm/Support/CodeGenCoverage.h
index 2acdd6a36a514..750e8686e06b8 100644
--- a/llvm/include/llvm/Support/CodeGenCoverage.h
+++ b/llvm/include/llvm/Support/CodeGenCoverage.h
@@ -12,6 +12,7 @@
 #define LLVM_SUPPORT_CODEGENCOVERAGE_H
 
 #include "llvm/ADT/BitVector.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class MemoryBuffer;
@@ -23,15 +24,15 @@ class CodeGenCoverage {
 public:
   using const_covered_iterator = BitVector::const_set_bits_iterator;
 
-  CodeGenCoverage();
+  LLVM_ABI CodeGenCoverage();
 
-  void setCovered(uint64_t RuleID);
-  bool isCovered(uint64_t RuleID) const;
-  iterator_range<const_covered_iterator> covered() const;
+  LLVM_ABI void setCovered(uint64_t RuleID);
+  LLVM_ABI bool isCovered(uint64_t RuleID) const;
+  LLVM_ABI iterator_range<const_covered_iterator> covered() const;
 
-  bool parse(MemoryBuffer &Buffer, StringRef BackendName);
-  bool emit(StringRef FilePrefix, StringRef BackendName) const;
-  void reset();
+  LLVM_ABI bool parse(MemoryBuffer &Buffer, StringRef BackendName);
+  LLVM_ABI bool emit(StringRef FilePrefix, StringRef BackendName) const;
+  LLVM_ABI void reset();
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index 7e83fc8ff8767..81b6647f2f006 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -167,7 +167,7 @@ class DebugCounter {
 
 protected:
   void addCounter(CounterInfo *Info) { Counters[Info->Name] = Info; }
-  bool handleCounterIncrement(CounterInfo &Info);
+  LLVM_ABI bool handleCounterIncrement(CounterInfo &Info);
 
   MapVector<StringRef, CounterInfo *> Counters;
 
diff --git a/llvm/include/llvm/Support/Jobserver.h b/llvm/include/llvm/Support/Jobserver.h
index de32cc07d473e..c90bfeb37a55c 100644
--- a/llvm/include/llvm/Support/Jobserver.h
+++ b/llvm/include/llvm/Support/Jobserver.h
@@ -67,6 +67,7 @@
 #define LLVM_SUPPORT_JOBSERVER_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -105,7 +106,7 @@ class JobSlot {
 
   static JobSlot createImplicit() { return JobSlot(kImplicitValue); }
 
-  uint8_t getExplicitValue() const;
+  LLVM_ABI uint8_t getExplicitValue() const;
   bool isExplicit() const { return isValid() && !isImplicit(); }
 
 private:
@@ -130,7 +131,7 @@ class JobSlot {
 
 /// The public interface for a jobserver client.
 /// This client is a lazy-initialized singleton that is created on first use.
-class JobserverClient {
+class LLVM_ABI JobserverClient {
 public:
   virtual ~JobserverClient();
 
@@ -149,10 +150,10 @@ class JobserverClient {
   /// Returns the singleton instance of the JobserverClient.
   /// The instance is created on the first call to this function.
   /// Returns a nullptr if no jobserver is configured or an error occurs.
-  LLVM_ABI_FOR_TEST static JobserverClient *getInstance();
+  static JobserverClient *getInstance();
 
   /// Resets the singleton instance. For testing purposes only.
-  LLVM_ABI_FOR_TEST static void resetForTesting();
+  static void resetForTesting();
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Support/LSP/Protocol.h b/llvm/include/llvm/Support/LSP/Protocol.h
index a75ac291d1bcc..7ec29e27d84f0 100644
--- a/llvm/include/llvm/Support/LSP/Protocol.h
+++ b/llvm/include/llvm/Support/LSP/Protocol.h
@@ -104,12 +104,12 @@ class URIForFile {
   URIForFile() = default;
 
   /// Try to build a URIForFile from the given URI string.
-  static llvm::Expected<URIForFile> fromURI(StringRef uri);
+  LLVM_ABI static llvm::Expected<URIForFile> fromURI(StringRef uri);
 
   /// Try to build a URIForFile from the given absolute file path and optional
   /// scheme.
-  static llvm::Expected<URIForFile> fromFile(StringRef absoluteFilepath,
-                                             StringRef scheme = "file");
+  LLVM_ABI static llvm::Expected<URIForFile>
+  fromFile(StringRef absoluteFilepath, StringRef scheme = "file");
 
   /// Returns the absolute path to the file.
   StringRef file() const { return filePath; }
@@ -118,7 +118,7 @@ class URIForFile {
   StringRef uri() const { return uriStr; }
 
   /// Return the scheme of the uri.
-  StringRef scheme() const;
+  LLVM_ABI StringRef scheme() const;
 
   explicit operator bool() const { return !filePath.empty(); }
 
@@ -135,7 +135,7 @@ class URIForFile {
   /// Register a supported URI scheme. The protocol supports `file` by default,
   /// so this is only necessary for any additional schemes that a server wants
   /// to support.
-  static void registerSupportedScheme(StringRef scheme);
+  LLVM_ABI static void registerSupportedScheme(StringRef scheme);
 
 private:
   explicit URIForFile(std::string &&filePath, std::string &&uriStr)
@@ -149,7 +149,7 @@ class URIForFile {
 LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const URIForFile &value);
 LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &value,
                                 URIForFile &result, llvm::json::Path path);
-raw_ostream &operator<<(raw_ostream &os, const URIForFile &value);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &os, const URIForFile &value);
 
 //===----------------------------------------------------------------------===//
 // ClientCapabilities
@@ -337,7 +337,7 @@ struct Position {
 LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &value,
                                 Position &result, llvm::json::Path path);
 LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const Position &value);
-raw_ostream &operator<<(raw_ostream &os, const Position &value);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &os, const Position &value);
 
 //===----------------------------------------------------------------------===//
 // Range
@@ -390,7 +390,7 @@ struct Range {
 LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &value, Range &result,
                                 llvm::json::Path path);
 LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const Range &value);
-raw_ostream &operator<<(raw_ostream &os, const Range &value);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &os, const Range &value);
 
 //===----------------------------------------------------------------------===//
 // Location
@@ -425,7 +425,7 @@ struct Location {
 LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &value,
                                 Location &result, llvm::json::Path path);
 LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const Location &value);
-raw_ostream &operator<<(raw_ostream &os, const Location &value);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &os, const Location &value);
 
 //===----------------------------------------------------------------------===//
 // TextDocumentPositionParams
@@ -512,10 +512,11 @@ LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &,
 
 struct TextDocumentContentChangeEvent {
   /// Try to apply this change to the given contents string.
-  LogicalResult applyTo(std::string &contents) const;
+  LLVM_ABI LogicalResult applyTo(std::string &contents) const;
   /// Try to apply a set of changes to the given contents string.
-  static LogicalResult applyTo(ArrayRef<TextDocumentContentChangeEvent> changes,
-                               std::string &contents);
+  LLVM_ABI static LogicalResult
+  applyTo(ArrayRef<TextDocumentContentChangeEvent> changes,
+          std::string &contents);
 
   /// The range of the document that changed.
   std::optional<Range> range;
@@ -555,7 +556,7 @@ enum class MarkupKind {
   PlainText,
   Markdown,
 };
-raw_ostream &operator<<(raw_ostream &os, MarkupKind kind);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &os, MarkupKind kind);
 
 struct MarkupContent {
   MarkupKind kind = MarkupKind::PlainText;
@@ -797,7 +798,7 @@ inline bool operator==(const TextEdit &lhs, const TextEdit &rhs) {
 LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &value,
                                 TextEdit &result, llvm::json::Path path);
 LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const TextEdit &value);
-raw_ostream &operator<<(raw_ostream &os, const TextEdit &value);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &os, const TextEdit &value);
 
 //===----------------------------------------------------------------------===//
 // CompletionItemKind
@@ -845,7 +846,7 @@ LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &value,
                                 CompletionItemKindBitset &result,
                                 llvm::json::Path path);
 
-CompletionItemKind
+LLVM_ABI CompletionItemKind
 adjustKindToCapability(CompletionItemKind kind,
                        CompletionItemKindBitset &supportedCompletionItemKinds);
 
@@ -927,8 +928,8 @@ struct CompletionItem {
 
 /// Add support for JSON serialization.
 LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const CompletionItem &value);
-raw_ostream &operator<<(raw_ostream &os, const CompletionItem &value);
-bool operator<(const CompletionItem &lhs, const CompletionItem &rhs);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &os, const CompletionItem &value);
+LLVM_ABI bool operator<(const CompletionItem &lhs, const CompletionItem &rhs);
 
 //===----------------------------------------------------------------------===//
 // CompletionList
@@ -1029,7 +1030,8 @@ struct SignatureInformation {
 
 /// Add support for JSON serialization.
 LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const SignatureInformation &value);
-raw_ostream &operator<<(raw_ostream &os, const SignatureInformation &value);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &os,
+                                 const SignatureInformation &value);
 
 //===----------------------------------------------------------------------===//
 // SignatureHelp
@@ -1178,9 +1180,10 @@ struct InlayHint {
 
 /// Add support for JSON serialization.
 LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const InlayHint &);
-bool operator==(const InlayHint &lhs, const InlayHint &rhs);
-bool operator<(const InlayHint &lhs, const InlayHint &rhs);
-llvm::raw_ostream &operator<<(llvm::raw_ostream &os, InlayHintKind value);
+LLVM_ABI bool operator==(const InlayHint &lhs, const InlayHint &rhs);
+LLVM_ABI bool operator<(const InlayHint &lhs, const InlayHint &rhs);
+LLVM_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
+                                       InlayHintKind value);
 
 //===----------------------------------------------------------------------===//
 // CodeActionContext
@@ -1260,9 +1263,9 @@ struct CodeAction {
   /// The kind of the code action.
   /// Used to filter code actions.
   std::optional<std::string> kind;
-  const static llvm::StringLiteral kQuickFix;
-  const static llvm::StringLiteral kRefactor;
-  const static llvm::StringLiteral kInfo;
+  LLVM_ABI const static llvm::StringLiteral kQuickFix;
+  LLVM_ABI const static llvm::StringLiteral kRefactor;
+  LLVM_ABI const static llvm::StringLiteral kInfo;
 
   /// The diagnostics that this code action resolves.
   std::optional<std::vector<Diagnostic>> diagnostics;
@@ -1303,10 +1306,10 @@ struct ShowMessageParams {
 };
 
 /// Add support for JSON serialization.
-llvm::json::Value toJSON(const MessageActionItem &Params);
+LLVM_ABI llvm::json::Value toJSON(const MessageActionItem &Params);
 
 /// Add support for JSON serialization.
-llvm::json::Value toJSON(const ShowMessageParams &Params);
+LLVM_ABI llvm::json::Value toJSON(const ShowMessageParams &Params);
 
 } // namespace lsp
 } // namespace llvm
diff --git a/llvm/include/llvm/Support/LSP/Transport.h b/llvm/include/llvm/Support/LSP/Transport.h
index 28ce8c4552f74..5f8ea237e9654 100644
--- a/llvm/include/llvm/Support/LSP/Transport.h
+++ b/llvm/include/llvm/Support/LSP/Transport.h
@@ -73,7 +73,7 @@ class JSONTransportInput {
 };
 
 /// Concrete implementation of the JSONTransportInput that reads from a file.
-class JSONTransportInputOverFile : public JSONTransportInput {
+class LLVM_ABI JSONTransportInputOverFile : public JSONTransportInput {
 public:
   explicit JSONTransportInputOverFile(
       std::FILE *In, JSONStreamStyle Style = JSONStreamStyle::Standard)
@@ -82,8 +82,8 @@ class JSONTransportInputOverFile : public JSONTransportInput {
   bool hasError() const final { return ferror(In); }
   bool isEndOfInput() const final { return feof(In); }
 
-  LLVM_ABI_FOR_TEST LogicalResult readDelimitedMessage(std::string &Json) final;
-  LLVM_ABI_FOR_TEST LogicalResult readStandardMessage(std::string &Json) final;
+  LogicalResult readDelimitedMessage(std::string &Json) final;
+  LogicalResult readStandardMessage(std::string &Json) final;
 
 private:
   std::FILE *In;
@@ -161,9 +161,11 @@ class MessageHandler {
 public:
   MessageHandler(JSONTransport &Transport) : Transport(Transport) {}
 
-  bool onNotify(StringRef Method, llvm::json::Value Value);
-  bool onCall(StringRef Method, llvm::json::Value Params, llvm::json::Value Id);
-  bool onReply(llvm::json::Value Id, llvm::Expected<llvm::json::Value> Result);
+  LLVM_ABI bool onNotify(StringRef Method, llvm::json::Value Value);
+  LLVM_ABI bool onCall(StringRef Method, llvm::json::Value Params,
+                       llvm::json::Value Id);
+  LLVM_ABI bool onReply(llvm::json::Value Id,
+                        llvm::Expected<llvm::json::Value> Result);
 
   template <typename T>
   static llvm::Expected<T> parse(const llvm::json::Value &Raw,
diff --git a/llvm/include/llvm/Support/OptionStrCmp.h b/llvm/include/llvm/Support/OptionStrCmp.h
index f3d3c2adb902f..4ac2452d4405b 100644
--- a/llvm/include/llvm/Support/OptionStrCmp.h
+++ b/llvm/include/llvm/Support/OptionStrCmp.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -20,12 +21,12 @@ namespace llvm {
 // precede any other options which prefix them). Additionally, if two options
 // are identical ignoring case, they are ordered according to case sensitive
 // ordering if `FallbackCaseSensitive` is true.
-int StrCmpOptionName(StringRef A, StringRef B,
-                     bool FallbackCaseSensitive = true);
+LLVM_ABI int StrCmpOptionName(StringRef A, StringRef B,
+                              bool FallbackCaseSensitive = true);
 
 // Comparison function for Option prefixes.
-int StrCmpOptionPrefixes(ArrayRef<StringRef> APrefixes,
-                         ArrayRef<StringRef> BPrefixes);
+LLVM_ABI int StrCmpOptionPrefixes(ArrayRef<StringRef> APrefixes,
+                                  ArrayRef<StringRef> BPrefixes);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Support/SourceMgr.h b/llvm/include/llvm/Support/SourceMgr.h
index 43f7e27c26ba1..02e694cad8697 100644
--- a/llvm/include/llvm/Support/SourceMgr.h
+++ b/llvm/include/llvm/Support/SourceMgr.h
@@ -106,14 +106,14 @@ class SourceMgr {
   LLVM_ABI SourceMgr();
   /// Create new source manager with the capability of finding include files
   /// via the provided file system.
-  explicit SourceMgr(IntrusiveRefCntPtr<vfs::FileSystem> FS);
+  LLVM_ABI explicit SourceMgr(IntrusiveRefCntPtr<vfs::FileSystem> FS);
   SourceMgr(const SourceMgr &) = delete;
   SourceMgr &operator=(const SourceMgr &) = delete;
-  SourceMgr(SourceMgr &&);
-  SourceMgr &operator=(SourceMgr &&);
+  LLVM_ABI SourceMgr(SourceMgr &&);
+  LLVM_ABI SourceMgr &operator=(SourceMgr &&);
   LLVM_ABI ~SourceMgr();
 
-  IntrusiveRefCntPtr<vfs::FileSystem> getVirtualFileSystem() const;
+  LLVM_ABI IntrusiveRefCntPtr<vfs::FileSystem> getVirtualFileSystem() const;
   LLVM_ABI void setVirtualFileSystem(IntrusiveRefCntPtr<vfs::FileSystem> FS);
 
   /// Return the include directories of this source manager.
diff --git a/llvm/include/llvm/Support/SystemZ/zos_wrappers/string.h b/llvm/include/llvm/Support/SystemZ/zos_wrappers/string.h
index 865eb8800397f..a1e40a5dde5ac 100644
--- a/llvm/include/llvm/Support/SystemZ/zos_wrappers/string.h
+++ b/llvm/include/llvm/Support/SystemZ/zos_wrappers/string.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_SUPPORT_ZOSWRAPPERS_STRING_H
 #define LLVM_SUPPORT_ZOSWRAPPERS_STRING_H
 
+#include "llvm/Support/Compiler.h"
 #include_next <string.h>
 
 #ifdef __cplusplus
@@ -24,9 +25,9 @@ extern "C" {
 // - strnlen()
 // Implementations are provided for z/OS.
 
-char *strsignal(int sig) asm("llvm_zos_strsignal");
+LLVM_ABI char *strsignal(int sig) asm("llvm_zos_strsignal");
 
-size_t strnlen(const char *S, size_t MaxLen) asm("llvm_zos_strnlen");
+LLVM_ABI size_t strnlen(const char *S, size_t MaxLen) asm("llvm_zos_strnlen");
 
 #ifdef __cplusplus
 }
diff --git a/llvm/include/llvm/Support/VirtualOutputBackend.h b/llvm/include/llvm/Support/VirtualOutputBackend.h
index 78ed4b9b66607..0fe65e4ddb349 100644
--- a/llvm/include/llvm/Support/VirtualOutputBackend.h
+++ b/llvm/include/llvm/Support/VirtualOutputBackend.h
@@ -21,6 +21,7 @@
 #define LLVM_SUPPORT_VIRTUALOUTPUTBACKEND_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/VirtualOutputConfig.h"
 #include "llvm/Support/VirtualOutputFile.h"
@@ -31,7 +32,7 @@ namespace llvm::vfs {
 ///
 /// If virtual functions are added here, also add them to \a
 /// ProxyOutputBackend.
-class OutputBackend : public RefCountedBase<OutputBackend> {
+class LLVM_ABI OutputBackend : public RefCountedBase<OutputBackend> {
   LLVM_ABI virtual void anchor();
 
 public:
@@ -47,7 +48,7 @@ class OutputBackend : public RefCountedBase<OutputBackend> {
   /// have been customized).
   ///
   /// Thread-safe.
-  LLVM_ABI Expected<OutputFile>
+  Expected<OutputFile>
   createFile(const Twine &Path,
              std::optional<OutputConfig> Config = std::nullopt);
 
diff --git a/llvm/include/llvm/Support/VirtualOutputBackends.h b/llvm/include/llvm/Support/VirtualOutputBackends.h
index 57ac38ca93d90..08f0891888e90 100644
--- a/llvm/include/llvm/Support/VirtualOutputBackends.h
+++ b/llvm/include/llvm/Support/VirtualOutputBackends.h
@@ -23,6 +23,7 @@
 #define LLVM_SUPPORT_VIRTUALOUTPUTBACKENDS_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/VirtualOutputBackend.h"
 #include "llvm/Support/VirtualOutputConfig.h"
 
@@ -47,7 +48,7 @@ makeMirroringOutputBackend(IntrusiveRefCntPtr<OutputBackend> Backend1,
 
 /// A helper class for proxying another backend, with the default
 /// implementation to forward to the underlying backend.
-class ProxyOutputBackend : public OutputBackend {
+class LLVM_ABI ProxyOutputBackend : public OutputBackend {
   LLVM_ABI void anchor() override;
 
 protected:
@@ -76,7 +77,7 @@ class ProxyOutputBackend : public OutputBackend {
 };
 
 /// An output backend that creates files on disk, wrapping APIs in sys::fs.
-class OnDiskOutputBackend : public OutputBackend {
+class LLVM_ABI OnDiskOutputBackend : public OutputBackend {
   LLVM_ABI void anchor() override;
 
 protected:
@@ -84,7 +85,7 @@ class OnDiskOutputBackend : public OutputBackend {
     return clone();
   }
 
-  LLVM_ABI Expected<std::unique_ptr<OutputFileImpl>>
+  Expected<std::unique_ptr<OutputFileImpl>>
   createFileImpl(StringRef Path, std::optional<OutputConfig> Config) override;
 
 public:
diff --git a/llvm/include/llvm/Support/VirtualOutputConfig.h b/llvm/include/llvm/Support/VirtualOutputConfig.h
index f3cb36b5fbe12..5c5ddd6fb628f 100644
--- a/llvm/include/llvm/Support/VirtualOutputConfig.h
+++ b/llvm/include/llvm/Support/VirtualOutputConfig.h
@@ -37,7 +37,7 @@ struct EmptyBaseClass {};
 struct OutputConfig : detail::EmptyBaseClass {
 public:
   LLVM_ABI_FOR_TEST void print(raw_ostream &OS) const;
-  void dump() const;
+  LLVM_ABI void dump() const;
 
 #define HANDLE_OUTPUT_CONFIG_FLAG(NAME, DEFAULT)                               \
   constexpr bool get##NAME() const { return NAME; }                            \
diff --git a/llvm/include/llvm/Support/VirtualOutputError.h b/llvm/include/llvm/Support/VirtualOutputError.h
index 44590a1fb5ed0..681232744ebbb 100644
--- a/llvm/include/llvm/Support/VirtualOutputError.h
+++ b/llvm/include/llvm/Support/VirtualOutputError.h
@@ -14,12 +14,13 @@
 #ifndef LLVM_SUPPORT_VIRTUALOUTPUTERROR_H
 #define LLVM_SUPPORT_VIRTUALOUTPUTERROR_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/VirtualOutputConfig.h"
 
 namespace llvm::vfs {
 
-const std::error_category &output_category();
+LLVM_ABI const std::error_category &output_category();
 
 enum class OutputErrorCode {
   // Error code 0 is absent. Use std::error_code() instead.
@@ -35,7 +36,7 @@ inline std::error_code make_error_code(OutputErrorCode EV) {
 
 /// Error related to an \a OutputFile. Derives from \a ECError and adds \a
 /// getOutputPath().
-class OutputError : public ErrorInfo<OutputError, ECError> {
+class LLVM_ABI OutputError : public ErrorInfo<OutputError, ECError> {
   void anchor() override;
 
 public:
@@ -43,7 +44,7 @@ class OutputError : public ErrorInfo<OutputError, ECError> {
   void log(raw_ostream &OS) const override;
 
   // Used by ErrorInfo::classID.
-  LLVM_ABI static char ID;
+  static char ID;
 
   OutputError(const Twine &OutputPath, std::error_code EC)
       : ErrorInfo<OutputError, ECError>(EC), OutputPath(OutputPath.str()) {
@@ -70,7 +71,8 @@ inline Error convertToOutputError(const Twine &OutputPath, std::error_code EC) {
 
 /// Error related to an OutputConfig for an \a OutputFile. Derives from \a
 /// OutputError and adds \a getConfig().
-class OutputConfigError : public ErrorInfo<OutputConfigError, OutputError> {
+class LLVM_ABI OutputConfigError
+    : public ErrorInfo<OutputConfigError, OutputError> {
   void anchor() override;
 
 public:
@@ -91,7 +93,8 @@ class OutputConfigError : public ErrorInfo<OutputConfigError, OutputError> {
 
 /// Error related to a temporary file for an \a OutputFile. Derives from \a
 /// OutputError and adds \a getTempPath().
-class TempFileOutputError : public ErrorInfo<TempFileOutputError, OutputError> {
+class LLVM_ABI TempFileOutputError
+    : public ErrorInfo<TempFileOutputError, OutputError> {
   void anchor() override;
 
 public:
@@ -99,7 +102,7 @@ class TempFileOutputError : public ErrorInfo<TempFileOutputError, OutputError> {
   void log(raw_ostream &OS) const override;
 
   // Used by ErrorInfo::classID.
-  LLVM_ABI static char ID;
+  static char ID;
 
   TempFileOutputError(const Twine &TempPath, const Twine &OutputPath,
                       std::error_code EC)
diff --git a/llvm/include/llvm/Support/VirtualOutputFile.h b/llvm/include/llvm/Support/VirtualOutputFile.h
index a4a9c9cc16598..cf611edbe1dc5 100644
--- a/llvm/include/llvm/Support/VirtualOutputFile.h
+++ b/llvm/include/llvm/Support/VirtualOutputFile.h
@@ -20,17 +20,18 @@
 #include "llvm/ADT/FunctionExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ExtensibleRTTI.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace llvm::vfs {
 
-class OutputFileImpl : public RTTIExtends<OutputFileImpl, RTTIRoot> {
+class LLVM_ABI OutputFileImpl : public RTTIExtends<OutputFileImpl, RTTIRoot> {
   LLVM_ABI void anchor() override;
 
 public:
-  LLVM_ABI static char ID;
+  static char ID;
   ~OutputFileImpl() override = default;
 
   virtual Error keep() = 0;
@@ -38,12 +39,12 @@ class OutputFileImpl : public RTTIExtends<OutputFileImpl, RTTIRoot> {
   virtual raw_pwrite_stream &getOS() = 0;
 };
 
-class NullOutputFileImpl final
+class LLVM_ABI NullOutputFileImpl final
     : public RTTIExtends<NullOutputFileImpl, OutputFileImpl> {
   LLVM_ABI void anchor() override;
 
 public:
-  LLVM_ABI static char ID;
+  static char ID;
   Error keep() final { return Error::success(); }
   Error discard() final { return Error::success(); }
   raw_pwrite_stream &getOS() final { return OS; }
diff --git a/llvm/include/llvm/Support/Watchdog.h b/llvm/include/llvm/Support/Watchdog.h
index 281595e8f2722..653560ab9403d 100644
--- a/llvm/include/llvm/Support/Watchdog.h
+++ b/llvm/include/llvm/Support/Watchdog.h
@@ -24,8 +24,9 @@ namespace llvm {
     /// to handle it are provided.
     class Watchdog {
     public:
-      Watchdog(unsigned int seconds);
-      ~Watchdog();
+      LLVM_ABI Watchdog(unsigned int seconds);
+      LLVM_ABI ~Watchdog();
+
     private:
       // Noncopyable.
       Watchdog(const Watchdog &other) = delete;
diff --git a/llvm/include/llvm/Support/circular_raw_ostream.h b/llvm/include/llvm/Support/circular_raw_ostream.h
index 17fb8fa0e476f..80155b3fbdba7 100644
--- a/llvm/include/llvm/Support/circular_raw_ostream.h
+++ b/llvm/include/llvm/Support/circular_raw_ostream.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_SUPPORT_CIRCULAR_RAW_OSTREAM_H
 #define LLVM_SUPPORT_CIRCULAR_RAW_OSTREAM_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace llvm {
@@ -21,138 +22,136 @@ namespace llvm {
   /// to a circular buffer, or can pass it through directly to an
   /// underlying stream if specified with a buffer of zero.
   ///
-  class circular_raw_ostream : public raw_ostream {
-  public:
-    /// TAKE_OWNERSHIP - Tell this stream that it owns the underlying
-    /// stream and is responsible for cleanup, memory management
-    /// issues, etc.
-    ///
-    static constexpr bool TAKE_OWNERSHIP = true;
-
-    /// REFERENCE_ONLY - Tell this stream it should not manage the
-    /// held stream.
-    ///
-    static constexpr bool REFERENCE_ONLY = false;
-
-  private:
-    /// TheStream - The real stream we output to. We set it to be
-    /// unbuffered, since we're already doing our own buffering.
-    ///
-    raw_ostream *TheStream = nullptr;
-
-    /// OwnsStream - Are we responsible for managing the underlying
-    /// stream?
-    ///
-    bool OwnsStream;
-
-    /// BufferSize - The size of the buffer in bytes.
-    ///
-    size_t BufferSize;
-
-    /// BufferArray - The actual buffer storage.
-    ///
-    char *BufferArray = nullptr;
-
-    /// Cur - Pointer to the current output point in BufferArray.
-    ///
-    char *Cur;
-
-    /// Filled - Indicate whether the buffer has been completely
-    /// filled.  This helps avoid garbage output.
-    ///
-    bool Filled = false;
-
-    /// Banner - A pointer to a banner to print before dumping the
-    /// log.
-    ///
-    const char *Banner;
-
-    /// flushBuffer - Dump the contents of the buffer to Stream.
-    ///
-    void flushBuffer() {
-      if (Filled)
-        // Write the older portion of the buffer.
-        TheStream->write(Cur, BufferArray + BufferSize - Cur);
-      // Write the newer portion of the buffer.
-      TheStream->write(BufferArray, Cur - BufferArray);
-      Cur = BufferArray;
-      Filled = false;
-    }
-
-    void write_impl(const char *Ptr, size_t Size) override;
-
-    /// current_pos - Return the current position within the stream,
-    /// not counting the bytes currently in the buffer.
-    ///
-    uint64_t current_pos() const override {
-      // This has the same effect as calling TheStream.current_pos(),
-      // but that interface is private.
-      return TheStream->tell() - TheStream->GetNumBytesInBuffer();
-    }
-
-  public:
-    /// circular_raw_ostream - Construct an optionally
-    /// circular-buffered stream, handing it an underlying stream to
-    /// do the "real" output.
-    ///
-    /// As a side effect, if BuffSize is nonzero, the given Stream is
-    /// set to be Unbuffered.  This is because circular_raw_ostream
-    /// does its own buffering, so it doesn't want another layer of
-    /// buffering to be happening underneath it.
-    ///
-    /// "Owns" tells the circular_raw_ostream whether it is
-    /// responsible for managing the held stream, doing memory
-    /// management of it, etc.
-    ///
-    circular_raw_ostream(raw_ostream &Stream, const char *Header,
-                         size_t BuffSize = 0, bool Owns = REFERENCE_ONLY)
-        : raw_ostream(/*unbuffered*/ true), OwnsStream(Owns),
-          BufferSize(BuffSize), Banner(Header) {
-      if (BufferSize != 0)
-        BufferArray = new char[BufferSize];
-      Cur = BufferArray;
-      setStream(Stream, Owns);
-    }
-
-    ~circular_raw_ostream() override {
-      flush();
-      flushBufferWithBanner();
-      releaseStream();
-      delete[] BufferArray;
-    }
-
-    bool is_displayed() const override {
-      return TheStream->is_displayed();
-    }
-
-    /// setStream - Tell the circular_raw_ostream to output a
-    /// different stream.  "Owns" tells circular_raw_ostream whether
-    /// it should take responsibility for managing the underlying
-    /// stream.
-    ///
-    void setStream(raw_ostream &Stream, bool Owns = REFERENCE_ONLY) {
-      releaseStream();
-      TheStream = &Stream;
-      OwnsStream = Owns;
-    }
-
-    /// flushBufferWithBanner - Force output of the buffer along with
-    /// a small header.
-    ///
-    void flushBufferWithBanner();
-
-  private:
-    /// releaseStream - Delete the held stream if needed. Otherwise,
-    /// transfer the buffer settings from this circular_raw_ostream
-    /// back to the underlying stream.
-    ///
-    void releaseStream() {
-      if (!TheStream)
-        return;
-      if (OwnsStream)
-        delete TheStream;
-    }
-  };
+class LLVM_ABI circular_raw_ostream : public raw_ostream {
+public:
+  /// TAKE_OWNERSHIP - Tell this stream that it owns the underlying
+  /// stream and is responsible for cleanup, memory management
+  /// issues, etc.
+  ///
+  static constexpr bool TAKE_OWNERSHIP = true;
+
+  /// REFERENCE_ONLY - Tell this stream it should not manage the
+  /// held stream.
+  ///
+  static constexpr bool REFERENCE_ONLY = false;
+
+private:
+  /// TheStream - The real stream we output to. We set it to be
+  /// unbuffered, since we're already doing our own buffering.
+  ///
+  raw_ostream *TheStream = nullptr;
+
+  /// OwnsStream - Are we responsible for managing the underlying
+  /// stream?
+  ///
+  bool OwnsStream;
+
+  /// BufferSize - The size of the buffer in bytes.
+  ///
+  size_t BufferSize;
+
+  /// BufferArray - The actual buffer storage.
+  ///
+  char *BufferArray = nullptr;
+
+  /// Cur - Pointer to the current output point in BufferArray.
+  ///
+  char *Cur;
+
+  /// Filled - Indicate whether the buffer has been completely
+  /// filled.  This helps avoid garbage output.
+  ///
+  bool Filled = false;
+
+  /// Banner - A pointer to a banner to print before dumping the
+  /// log.
+  ///
+  const char *Banner;
+
+  /// flushBuffer - Dump the contents of the buffer to Stream.
+  ///
+  void flushBuffer() {
+    if (Filled)
+      // Write the older portion of the buffer.
+      TheStream->write(Cur, BufferArray + BufferSize - Cur);
+    // Write the newer portion of the buffer.
+    TheStream->write(BufferArray, Cur - BufferArray);
+    Cur = BufferArray;
+    Filled = false;
+  }
+
+  void write_impl(const char *Ptr, size_t Size) override;
+
+  /// current_pos - Return the current position within the stream,
+  /// not counting the bytes currently in the buffer.
+  ///
+  uint64_t current_pos() const override {
+    // This has the same effect as calling TheStream.current_pos(),
+    // but that interface is private.
+    return TheStream->tell() - TheStream->GetNumBytesInBuffer();
+  }
+
+public:
+  /// circular_raw_ostream - Construct an optionally
+  /// circular-buffered stream, handing it an underlying stream to
+  /// do the "real" output.
+  ///
+  /// As a side effect, if BuffSize is nonzero, the given Stream is
+  /// set to be Unbuffered.  This is because circular_raw_ostream
+  /// does its own buffering, so it doesn't want another layer of
+  /// buffering to be happening underneath it.
+  ///
+  /// "Owns" tells the circular_raw_ostream whether it is
+  /// responsible for managing the held stream, doing memory
+  /// management of it, etc.
+  ///
+  circular_raw_ostream(raw_ostream &Stream, const char *Header,
+                       size_t BuffSize = 0, bool Owns = REFERENCE_ONLY)
+      : raw_ostream(/*unbuffered*/ true), OwnsStream(Owns),
+        BufferSize(BuffSize), Banner(Header) {
+    if (BufferSize != 0)
+      BufferArray = new char[BufferSize];
+    Cur = BufferArray;
+    setStream(Stream, Owns);
+  }
+
+  ~circular_raw_ostream() override {
+    flush();
+    flushBufferWithBanner();
+    releaseStream();
+    delete[] BufferArray;
+  }
+
+  bool is_displayed() const override { return TheStream->is_displayed(); }
+
+  /// setStream - Tell the circular_raw_ostream to output a
+  /// different stream.  "Owns" tells circular_raw_ostream whether
+  /// it should take responsibility for managing the underlying
+  /// stream.
+  ///
+  void setStream(raw_ostream &Stream, bool Owns = REFERENCE_ONLY) {
+    releaseStream();
+    TheStream = &Stream;
+    OwnsStream = Owns;
+  }
+
+  /// flushBufferWithBanner - Force output of the buffer along with
+  /// a small header.
+  ///
+  void flushBufferWithBanner();
+
+private:
+  /// releaseStream - Delete the held stream if needed. Otherwise,
+  /// transfer the buffer settings from this circular_raw_ostream
+  /// back to the underlying stream.
+  ///
+  void releaseStream() {
+    if (!TheStream)
+      return;
+    if (OwnsStream)
+      delete TheStream;
+  }
+};
 } // end llvm namespace
 
 #endif
diff --git a/llvm/include/llvm/Support/raw_ostream_proxy.h b/llvm/include/llvm/Support/raw_ostream_proxy.h
index a6791f558620b..3285c26116ef0 100644
--- a/llvm/include/llvm/Support/raw_ostream_proxy.h
+++ b/llvm/include/llvm/Support/raw_ostream_proxy.h
@@ -111,7 +111,7 @@ class raw_pwrite_stream_proxy_adaptor
 
 /// Non-owning proxy for a \a raw_ostream. Enables passing a stream into an
 /// API that takes ownership.
-class raw_ostream_proxy : public raw_ostream_proxy_adaptor<> {
+class LLVM_ABI raw_ostream_proxy : public raw_ostream_proxy_adaptor<> {
   LLVM_ABI_FOR_TEST void anchor() override;
 
 public:
@@ -120,7 +120,8 @@ class raw_ostream_proxy : public raw_ostream_proxy_adaptor<> {
 
 /// Non-owning proxy for a \a raw_pwrite_stream. Enables passing a stream
 /// into an API that takes ownership.
-class raw_pwrite_stream_proxy : public raw_pwrite_stream_proxy_adaptor<> {
+class LLVM_ABI raw_pwrite_stream_proxy
+    : public raw_pwrite_stream_proxy_adaptor<> {
   LLVM_ABI_FOR_TEST void anchor() override;
 
 public:
diff --git a/llvm/include/llvm/TableGen/DirectiveEmitter.h b/llvm/include/llvm/TableGen/DirectiveEmitter.h
index 2080f75eb8cfc..4bc45391f2b42 100644
--- a/llvm/include/llvm/TableGen/DirectiveEmitter.h
+++ b/llvm/include/llvm/TableGen/DirectiveEmitter.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Frontend/Directive/Spelling.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/TableGen/Record.h"
 #include <string>
@@ -84,7 +85,7 @@ class DirectiveLanguage {
     return Records.getAllDerivedDefinitions("Clause");
   }
 
-  bool HasValidityErrors() const;
+  LLVM_ABI bool HasValidityErrors() const;
 
 private:
   const Record *Def;
diff --git a/llvm/include/llvm/TableGen/Error.h b/llvm/include/llvm/TableGen/Error.h
index b963dcba9869f..35dc86ea3feca 100644
--- a/llvm/include/llvm/TableGen/Error.h
+++ b/llvm/include/llvm/TableGen/Error.h
@@ -15,6 +15,7 @@
 #define LLVM_TABLEGEN_ERROR_H
 
 #include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SourceMgr.h"
 
 namespace llvm {
@@ -22,38 +23,44 @@ class Record;
 class RecordVal;
 class Init;
 
-void PrintNote(const Twine &Msg);
-void PrintNote(function_ref<void(raw_ostream &OS)> PrintMsg);
-void PrintNote(ArrayRef<SMLoc> NoteLoc, const Twine &Msg);
+LLVM_ABI void PrintNote(const Twine &Msg);
+LLVM_ABI void PrintNote(function_ref<void(raw_ostream &OS)> PrintMsg);
+LLVM_ABI void PrintNote(ArrayRef<SMLoc> NoteLoc, const Twine &Msg);
 
-[[noreturn]] void PrintFatalNote(const Twine &Msg);
-[[noreturn]] void PrintFatalNote(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
-[[noreturn]] void PrintFatalNote(const Record *Rec, const Twine &Msg);
-[[noreturn]] void PrintFatalNote(const RecordVal *RecVal, const Twine &Msg);
+[[noreturn]] LLVM_ABI void PrintFatalNote(const Twine &Msg);
+[[noreturn]] LLVM_ABI void PrintFatalNote(ArrayRef<SMLoc> ErrorLoc,
+                                          const Twine &Msg);
+[[noreturn]] LLVM_ABI void PrintFatalNote(const Record *Rec, const Twine &Msg);
+[[noreturn]] LLVM_ABI void PrintFatalNote(const RecordVal *RecVal,
+                                          const Twine &Msg);
 
-void PrintWarning(const Twine &Msg);
-void PrintWarning(ArrayRef<SMLoc> WarningLoc, const Twine &Msg);
-void PrintWarning(const char *Loc, const Twine &Msg);
+LLVM_ABI void PrintWarning(const Twine &Msg);
+LLVM_ABI void PrintWarning(ArrayRef<SMLoc> WarningLoc, const Twine &Msg);
+LLVM_ABI void PrintWarning(const char *Loc, const Twine &Msg);
 
-void PrintError(const Twine &Msg);
-void PrintError(function_ref<void(raw_ostream &OS)> PrintMsg);
-void PrintError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
-void PrintError(const char *Loc, const Twine &Msg);
-void PrintError(const Record *Rec, const Twine &Msg);
-void PrintError(const RecordVal *RecVal, const Twine &Msg);
+LLVM_ABI void PrintError(const Twine &Msg);
+LLVM_ABI void PrintError(function_ref<void(raw_ostream &OS)> PrintMsg);
+LLVM_ABI void PrintError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
+LLVM_ABI void PrintError(const char *Loc, const Twine &Msg);
+LLVM_ABI void PrintError(const Record *Rec, const Twine &Msg);
+LLVM_ABI void PrintError(const RecordVal *RecVal, const Twine &Msg);
 
-[[noreturn]] void PrintFatalError(const Twine &Msg);
-[[noreturn]] void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
-[[noreturn]] void PrintFatalError(const Record *Rec, const Twine &Msg);
-[[noreturn]] void PrintFatalError(const RecordVal *RecVal, const Twine &Msg);
-[[noreturn]] void PrintFatalError(function_ref<void(raw_ostream &OS)> PrintMsg);
+[[noreturn]] LLVM_ABI void PrintFatalError(const Twine &Msg);
+[[noreturn]] LLVM_ABI void PrintFatalError(ArrayRef<SMLoc> ErrorLoc,
+                                           const Twine &Msg);
+[[noreturn]] LLVM_ABI void PrintFatalError(const Record *Rec, const Twine &Msg);
+[[noreturn]] LLVM_ABI void PrintFatalError(const RecordVal *RecVal,
+                                           const Twine &Msg);
+[[noreturn]] LLVM_ABI void
+PrintFatalError(function_ref<void(raw_ostream &OS)> PrintMsg);
 
 // Returns true if the assert failed.
-bool CheckAssert(SMLoc Loc, const Init *Condition, const Init *Message);
-void dumpMessage(SMLoc Loc, const Init *Message);
+LLVM_ABI bool CheckAssert(SMLoc Loc, const Init *Condition,
+                          const Init *Message);
+LLVM_ABI void dumpMessage(SMLoc Loc, const Init *Message);
 
-extern SourceMgr SrcMgr;
-extern unsigned ErrorsPrinted;
+extern LLVM_ABI SourceMgr SrcMgr;
+extern LLVM_ABI unsigned ErrorsPrinted;
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/TableGen/Main.h b/llvm/include/llvm/TableGen/Main.h
index daede9f5a46f0..5a7b378949779 100644
--- a/llvm/include/llvm/TableGen/Main.h
+++ b/llvm/include/llvm/TableGen/Main.h
@@ -14,6 +14,7 @@
 #define LLVM_TABLEGEN_MAIN_H
 
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 #include <map>
 
 namespace llvm {
@@ -37,13 +38,14 @@ using TableGenMainFn =
 using MultiFileTableGenMainFn = function_ref<bool(TableGenOutputFiles &OutFiles,
                                                   const RecordKeeper &Records)>;
 
-int TableGenMain(const char *argv0, TableGenMainFn MainFn = nullptr);
+LLVM_ABI int TableGenMain(const char *argv0, TableGenMainFn MainFn = nullptr);
 
-int TableGenMain(const char *argv0, MultiFileTableGenMainFn MainFn = nullptr);
+LLVM_ABI int TableGenMain(const char *argv0,
+                          MultiFileTableGenMainFn MainFn = nullptr);
 
 /// Controls emitting large character arrays as strings or character arrays.
 /// Typically set to false when building with MSVC.
-extern cl::opt<bool> EmitLongStrLiterals;
+extern LLVM_ABI cl::opt<bool> EmitLongStrLiterals;
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/TableGen/Parser.h b/llvm/include/llvm/TableGen/Parser.h
index d4130412d9560..5bbfdc486e92a 100644
--- a/llvm/include/llvm/TableGen/Parser.h
+++ b/llvm/include/llvm/TableGen/Parser.h
@@ -13,6 +13,8 @@
 #ifndef LLVM_TABLEGEN_PARSER_H
 #define LLVM_TABLEGEN_PARSER_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 class RecordKeeper;
 class SourceMgr;
@@ -23,7 +25,7 @@ class SourceMgr;
 ///
 /// NOTE: TableGen currently relies on global state within a given parser
 ///       invocation, so this function is not thread-safe.
-bool TableGenParseFile(SourceMgr &InputSrcMgr, RecordKeeper &Records);
+LLVM_ABI bool TableGenParseFile(SourceMgr &InputSrcMgr, RecordKeeper &Records);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h
index cb2721aba4f25..9b579cc56e624 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -24,6 +24,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/SMLoc.h"
 #include "llvm/Support/Timer.h"
@@ -58,7 +59,7 @@ class TGTimer;
 //  Type Classes
 //===----------------------------------------------------------------------===//
 
-class RecTy {
+class LLVM_ABI RecTy {
 public:
   /// Subclass discriminator (for dyn_cast<> et al.)
   enum RecTyKind {
@@ -110,7 +111,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const RecTy &Ty) {
 }
 
 /// 'bit' - Represent a single bit
-class BitRecTy : public RecTy {
+class LLVM_ABI BitRecTy : public RecTy {
   friend detail::RecordKeeperImpl;
 
   BitRecTy(RecordKeeper &RK) : RecTy(BitRecTyKind, RK) {}
@@ -128,7 +129,7 @@ class BitRecTy : public RecTy {
 };
 
 /// 'bits<n>' - Represent a fixed number of bits
-class BitsRecTy : public RecTy {
+class LLVM_ABI BitsRecTy : public RecTy {
   unsigned Size;
 
   explicit BitsRecTy(RecordKeeper &RK, unsigned Sz)
@@ -149,7 +150,7 @@ class BitsRecTy : public RecTy {
 };
 
 /// 'int' - Represent an integer value of no particular size
-class IntRecTy : public RecTy {
+class LLVM_ABI IntRecTy : public RecTy {
   friend detail::RecordKeeperImpl;
 
   IntRecTy(RecordKeeper &RK) : RecTy(IntRecTyKind, RK) {}
@@ -167,7 +168,7 @@ class IntRecTy : public RecTy {
 };
 
 /// 'string' - Represent an string value
-class StringRecTy : public RecTy {
+class LLVM_ABI StringRecTy : public RecTy {
   friend detail::RecordKeeperImpl;
 
   StringRecTy(RecordKeeper &RK) : RecTy(StringRecTyKind, RK) {}
@@ -186,7 +187,7 @@ class StringRecTy : public RecTy {
 
 /// 'list<Ty>' - Represent a list of element values, all of which must be of
 /// the specified type. The type is stored in ElementTy.
-class ListRecTy : public RecTy {
+class LLVM_ABI ListRecTy : public RecTy {
   friend const ListRecTy *RecTy::getListTy() const;
 
   const RecTy *ElementTy;
@@ -210,7 +211,7 @@ class ListRecTy : public RecTy {
 };
 
 /// 'dag' - Represent a dag fragment
-class DagRecTy : public RecTy {
+class LLVM_ABI DagRecTy : public RecTy {
   friend detail::RecordKeeperImpl;
 
   DagRecTy(RecordKeeper &RK) : RecTy(DagRecTyKind, RK) {}
@@ -229,9 +230,10 @@ class DagRecTy : public RecTy {
 ///
 /// The list of superclasses is non-redundant, i.e. only contains classes that
 /// are not the superclass of some other listed class.
-class RecordRecTy final : public RecTy,
-                          public FoldingSetNode,
-                          private TrailingObjects<RecordRecTy, const Record *> {
+class LLVM_ABI RecordRecTy final
+    : public RecTy,
+      public FoldingSetNode,
+      private TrailingObjects<RecordRecTy, const Record *> {
   friend TrailingObjects;
   friend class Record;
   friend detail::RecordKeeperImpl;
@@ -277,13 +279,13 @@ class RecordRecTy final : public RecTy,
 
 /// Find a common type that T1 and T2 convert to.
 /// Return 0 if no such type exists.
-const RecTy *resolveTypes(const RecTy *T1, const RecTy *T2);
+LLVM_ABI const RecTy *resolveTypes(const RecTy *T1, const RecTy *T2);
 
 //===----------------------------------------------------------------------===//
 //  Initializer Classes
 //===----------------------------------------------------------------------===//
 
-class Init {
+class LLVM_ABI Init {
 protected:
   /// Discriminator enum (for isa<>, dyn_cast<>, et al.)
   ///
@@ -415,7 +417,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const Init &I) {
 
 /// This is the common superclass of types that have a specific,
 /// explicit type, stored in ValueTy.
-class TypedInit : public Init {
+class LLVM_ABI TypedInit : public Init {
   const RecTy *ValueTy;
 
 protected:
@@ -450,7 +452,7 @@ class TypedInit : public Init {
 };
 
 /// '?' - Represents an uninitialized value.
-class UnsetInit final : public Init {
+class LLVM_ABI UnsetInit final : public Init {
   friend detail::RecordKeeperImpl;
 
   /// The record keeper that initialized this Init.
@@ -488,7 +490,7 @@ class UnsetInit final : public Init {
 
 // Represent an argument.
 using ArgAuxType = std::variant<unsigned, const Init *>;
-class ArgumentInit final : public Init, public FoldingSetNode {
+class LLVM_ABI ArgumentInit final : public Init, public FoldingSetNode {
 public:
   enum Kind {
     Positional,
@@ -553,7 +555,7 @@ class ArgumentInit final : public Init, public FoldingSetNode {
 };
 
 /// 'true'/'false' - Represent a concrete initializer for a bit.
-class BitInit final : public TypedInit {
+class LLVM_ABI BitInit final : public TypedInit {
   friend detail::RecordKeeperImpl;
 
   bool Value;
@@ -586,9 +588,10 @@ class BitInit final : public TypedInit {
 
 /// '{ a, b, c }' - Represents an initializer for a BitsRecTy value.
 /// It contains a vector of bits, whose size is determined by the type.
-class BitsInit final : public TypedInit,
-                       public FoldingSetNode,
-                       private TrailingObjects<BitsInit, const Init *> {
+class LLVM_ABI BitsInit final
+    : public TypedInit,
+      public FoldingSetNode,
+      private TrailingObjects<BitsInit, const Init *> {
   friend TrailingObjects;
   unsigned NumBits;
 
@@ -632,7 +635,7 @@ class BitsInit final : public TypedInit,
 };
 
 /// '7' - Represent an initialization by a literal integer value.
-class IntInit final : public TypedInit {
+class LLVM_ABI IntInit final : public TypedInit {
   int64_t Value;
 
   explicit IntInit(RecordKeeper &RK, int64_t V)
@@ -663,7 +666,7 @@ class IntInit final : public TypedInit {
 };
 
 /// "anonymous_n" - Represent an anonymous record name
-class AnonymousNameInit final : public TypedInit {
+class LLVM_ABI AnonymousNameInit final : public TypedInit {
   unsigned Value;
 
   explicit AnonymousNameInit(RecordKeeper &RK, unsigned V)
@@ -693,7 +696,7 @@ class AnonymousNameInit final : public TypedInit {
 };
 
 /// "foo" - Represent an initialization by a string value.
-class StringInit final : public TypedInit {
+class LLVM_ABI StringInit final : public TypedInit {
 public:
   enum StringFormat {
     SF_String, // Format as "text"
@@ -746,9 +749,10 @@ class StringInit final : public TypedInit {
 
 /// [AL, AH, CL] - Represent a list of defs
 ///
-class ListInit final : public TypedInit,
-                       public FoldingSetNode,
-                       private TrailingObjects<ListInit, const Init *> {
+class LLVM_ABI ListInit final
+    : public TypedInit,
+      public FoldingSetNode,
+      private TrailingObjects<ListInit, const Init *> {
   friend TrailingObjects;
   unsigned NumElements;
 
@@ -813,7 +817,7 @@ class ListInit final : public TypedInit,
 
 /// Base class for operators
 ///
-class OpInit : public TypedInit {
+class LLVM_ABI OpInit : public TypedInit {
 protected:
   explicit OpInit(InitKind K, const RecTy *Type, uint8_t Opc)
       : TypedInit(K, Type, Opc) {}
@@ -832,7 +836,7 @@ class OpInit : public TypedInit {
 
 /// !op (X) - Transform an init.
 ///
-class UnOpInit final : public OpInit, public FoldingSetNode {
+class LLVM_ABI UnOpInit final : public OpInit, public FoldingSetNode {
 public:
   enum UnaryOp : uint8_t {
     TOLOWER,
@@ -882,7 +886,7 @@ class UnOpInit final : public OpInit, public FoldingSetNode {
 };
 
 /// !op (X, Y) - Combine two inits.
-class BinOpInit final : public OpInit, public FoldingSetNode {
+class LLVM_ABI BinOpInit final : public OpInit, public FoldingSetNode {
 public:
   enum BinaryOp : uint8_t {
     ADD,
@@ -955,7 +959,7 @@ class BinOpInit final : public OpInit, public FoldingSetNode {
 };
 
 /// !op (X, Y, Z) - Combine two inits.
-class TernOpInit final : public OpInit, public FoldingSetNode {
+class LLVM_ABI TernOpInit final : public OpInit, public FoldingSetNode {
 public:
   enum TernaryOp : uint8_t {
     SUBST,
@@ -1011,9 +1015,10 @@ class TernOpInit final : public OpInit, public FoldingSetNode {
 /// !cond(condition_1: value1, ... , condition_n: value)
 /// Selects the first value for which condition is true.
 /// Otherwise reports an error.
-class CondOpInit final : public TypedInit,
-                         public FoldingSetNode,
-                         private TrailingObjects<CondOpInit, const Init *> {
+class LLVM_ABI CondOpInit final
+    : public TypedInit,
+      public FoldingSetNode,
+      private TrailingObjects<CondOpInit, const Init *> {
   friend TrailingObjects;
   unsigned NumConds;
   const RecTy *ValType;
@@ -1080,7 +1085,7 @@ class CondOpInit final : public TypedInit,
 };
 
 /// !foldl (a, b, expr, start, lst) - Fold over a list.
-class FoldOpInit final : public TypedInit, public FoldingSetNode {
+class LLVM_ABI FoldOpInit final : public TypedInit, public FoldingSetNode {
 private:
   const Init *Start, *List, *A, *B, *Expr;
 
@@ -1115,7 +1120,7 @@ class FoldOpInit final : public TypedInit, public FoldingSetNode {
 };
 
 /// !isa<type>(expr) - Dynamically determine the type of an expression.
-class IsAOpInit final : public TypedInit, public FoldingSetNode {
+class LLVM_ABI IsAOpInit final : public TypedInit, public FoldingSetNode {
 private:
   const RecTy *CheckType;
   const Init *Expr;
@@ -1149,7 +1154,7 @@ class IsAOpInit final : public TypedInit, public FoldingSetNode {
 
 /// !exists<type>(expr) - Dynamically determine if a record of `type` named
 /// `expr` exists.
-class ExistsOpInit final : public TypedInit, public FoldingSetNode {
+class LLVM_ABI ExistsOpInit final : public TypedInit, public FoldingSetNode {
 private:
   const RecTy *CheckType;
   const Init *Expr;
@@ -1184,7 +1189,7 @@ class ExistsOpInit final : public TypedInit, public FoldingSetNode {
 /// !instances<type>([regex]) - Produces a list of records whose type is `type`.
 /// If `regex` is provided, only records whose name matches the regular
 /// expression `regex` will be included.
-class InstancesOpInit final : public TypedInit, public FoldingSetNode {
+class LLVM_ABI InstancesOpInit final : public TypedInit, public FoldingSetNode {
 private:
   const RecTy *Type;
   const Init *Regex;
@@ -1217,7 +1222,7 @@ class InstancesOpInit final : public TypedInit, public FoldingSetNode {
 };
 
 /// 'Opcode' - Represent a reference to an entire variable object.
-class VarInit final : public TypedInit {
+class LLVM_ABI VarInit final : public TypedInit {
   const Init *VarName;
 
   explicit VarInit(const Init *VN, const RecTy *T)
@@ -1254,7 +1259,7 @@ class VarInit final : public TypedInit {
 };
 
 /// Opcode{0} - Represent access to one bit of a variable or field.
-class VarBitInit final : public TypedInit {
+class LLVM_ABI VarBitInit final : public TypedInit {
   const TypedInit *TI;
   unsigned Bit;
 
@@ -1291,7 +1296,7 @@ class VarBitInit final : public TypedInit {
 };
 
 /// AL - Represent a reference to a 'def' in the description
-class DefInit final : public TypedInit {
+class LLVM_ABI DefInit final : public TypedInit {
   friend class Record;
 
   const Record *Def;
@@ -1322,7 +1327,7 @@ class DefInit final : public TypedInit {
 
 /// classname<targs...> - Represent an uninstantiated anonymous class
 /// instantiation.
-class VarDefInit final
+class LLVM_ABI VarDefInit final
     : public TypedInit,
       public FoldingSetNode,
       private TrailingObjects<VarDefInit, const ArgumentInit *> {
@@ -1377,7 +1382,7 @@ class VarDefInit final
 };
 
 /// X.Y - Represent a reference to a subfield of a variable
-class FieldInit final : public TypedInit {
+class LLVM_ABI FieldInit final : public TypedInit {
   const Init *Rec;             // Record we are referring to
   const StringInit *FieldName; // Field we are accessing
 
@@ -1420,7 +1425,7 @@ class FieldInit final : public TypedInit {
 /// (v a, b) - Represent a DAG tree value. DAG inits are required
 /// to have at least one value then a (possibly empty) list of arguments. Each
 /// argument can have a name associated with it.
-class DagInit final
+class LLVM_ABI DagInit final
     : public TypedInit,
       public FoldingSetNode,
       private TrailingObjects<DagInit, const Init *, const StringInit *> {
@@ -1559,14 +1564,14 @@ class RecordVal {
   SmallVector<SMRange, 0> ReferenceLocs;
 
 public:
-  RecordVal(const Init *N, const RecTy *T, FieldKind K);
-  RecordVal(const Init *N, SMLoc Loc, const RecTy *T, FieldKind K);
+  LLVM_ABI RecordVal(const Init *N, const RecTy *T, FieldKind K);
+  LLVM_ABI RecordVal(const Init *N, SMLoc Loc, const RecTy *T, FieldKind K);
 
   /// Get the record keeper used to unique this value.
   RecordKeeper &getRecordKeeper() const { return Name->getRecordKeeper(); }
 
   /// Get the name of the field as a StringRef.
-  StringRef getName() const;
+  LLVM_ABI StringRef getName() const;
 
   /// Get the name of the field as an Init.
   const Init *getNameInit() const { return Name; }
@@ -1593,16 +1598,16 @@ class RecordVal {
   const RecTy *getType() const { return TyAndKind.getPointer(); }
 
   /// Get the type of the field for printing purposes.
-  std::string getPrintType() const;
+  LLVM_ABI std::string getPrintType() const;
 
   /// Get the value of the field as an Init.
   const Init *getValue() const { return Value; }
 
   /// Set the value of the field from an Init.
-  bool setValue(const Init *V);
+  LLVM_ABI bool setValue(const Init *V);
 
   /// Set the value and source location of the field.
-  bool setValue(const Init *V, SMLoc NewLoc);
+  LLVM_ABI bool setValue(const Init *V, SMLoc NewLoc);
 
   /// Add a reference to this record value.
   void addReferenceLoc(SMRange Loc) { ReferenceLocs.push_back(Loc); }
@@ -1615,10 +1620,10 @@ class RecordVal {
   void setUsed(bool Used) { IsUsed = Used; }
   bool isUsed() const { return IsUsed; }
 
-  void dump() const;
+  LLVM_ABI void dump() const;
 
   /// Print the value to an output stream, possibly with a semicolon.
-  void print(raw_ostream &OS, bool PrintSem = true) const;
+  LLVM_ABI void print(raw_ostream &OS, bool PrintSem = true) const;
 };
 
 inline raw_ostream &operator<<(raw_ostream &OS, const RecordVal &RV) {
@@ -1678,7 +1683,7 @@ class Record {
 
   RecordKind Kind;
 
-  void checkName();
+  LLVM_ABI void checkName();
 
 public:
   // Constructs a record.
@@ -1703,7 +1708,7 @@ class Record {
         TrackedRecords(O.TrackedRecords), ID(getNewUID(O.getRecords())),
         Kind(O.Kind) {}
 
-  static unsigned getNewUID(RecordKeeper &RK);
+  LLVM_ABI static unsigned getNewUID(RecordKeeper &RK);
 
   unsigned getID() const { return ID; }
 
@@ -1715,7 +1720,7 @@ class Record {
     return getNameInit()->getAsUnquotedString();
   }
 
-  void setName(const Init *Name); // Also updates RecordKeeper.
+  LLVM_ABI void setName(const Init *Name); // Also updates RecordKeeper.
 
   ArrayRef<SMLoc> getLoc() const { return Locs; }
   void appendLoc(SMLoc Loc) { Locs.push_back(Loc); }
@@ -1731,13 +1736,13 @@ class Record {
   ArrayRef<SMRange> getReferenceLocs() const { return ReferenceLocs; }
 
   // Update a class location when encountering a (re-)definition.
-  void updateClassLoc(SMLoc Loc);
+  LLVM_ABI void updateClassLoc(SMLoc Loc);
 
   // Make the type that this record should have based on its superclasses.
-  const RecordRecTy *getType() const;
+  LLVM_ABI const RecordRecTy *getType() const;
 
   /// get the corresponding DefInit.
-  DefInit *getDefInit() const;
+  LLVM_ABI DefInit *getDefInit() const;
 
   bool isClass() const { return Kind == RK_Class; }
 
@@ -1837,9 +1842,9 @@ class Record {
 
   void appendDumps(const Record *Rec) { Dumps.append(Rec->Dumps); }
 
-  void checkRecordAssertions();
-  void emitRecordDumps();
-  void checkUnusedTemplateArgs();
+  LLVM_ABI void checkRecordAssertions();
+  LLVM_ABI void emitRecordDumps();
+  LLVM_ABI void checkUnusedTemplateArgs();
 
   bool isSubClassOf(const Record *R) const {
     for (const Record *SC : make_first_range(DirectSuperClasses)) {
@@ -1875,31 +1880,32 @@ class Record {
   ///
   /// This is a final resolve: any error messages, e.g. due to undefined !cast
   /// references, are generated now.
-  void resolveReferences(const Init *NewName = nullptr);
+  LLVM_ABI void resolveReferences(const Init *NewName = nullptr);
 
   /// Apply the resolver to the name of the record as well as to the
   /// initializers of all fields of the record except SkipVal.
   ///
   /// The resolver should not resolve any of the fields itself, to avoid
   /// recursion / infinite loops.
-  void resolveReferences(Resolver &R, const RecordVal *SkipVal = nullptr);
+  LLVM_ABI void resolveReferences(Resolver &R,
+                                  const RecordVal *SkipVal = nullptr);
 
   RecordKeeper &getRecords() const {
     return TrackedRecords;
   }
 
-  void dump() const;
+  LLVM_ABI void dump() const;
 
   //===--------------------------------------------------------------------===//
   // High-level methods useful to tablegen back-ends
   //
 
   /// Return the source location for the named field.
-  SMLoc getFieldLoc(StringRef FieldName) const;
+  LLVM_ABI SMLoc getFieldLoc(StringRef FieldName) const;
 
   /// Return the initializer for a value with the specified name, or throw an
   /// exception if the field does not exist.
-  const Init *getValueInit(StringRef FieldName) const;
+  LLVM_ABI const Init *getValueInit(StringRef FieldName) const;
 
   /// Return true if the named field is unset.
   bool isValueUnset(StringRef FieldName) const {
@@ -1909,78 +1915,81 @@ class Record {
   /// This method looks up the specified field and returns its value as a
   /// string, throwing an exception if the field does not exist or if the value
   /// is not a string.
-  StringRef getValueAsString(StringRef FieldName) const;
+  LLVM_ABI StringRef getValueAsString(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as a
   /// string, throwing an exception if the value is not a string and
   /// std::nullopt if the field does not exist.
-  std::optional<StringRef> getValueAsOptionalString(StringRef FieldName) const;
+  LLVM_ABI std::optional<StringRef>
+  getValueAsOptionalString(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as a
   /// BitsInit, throwing an exception if the field does not exist or if the
   /// value is not the right type.
-  const BitsInit *getValueAsBitsInit(StringRef FieldName) const;
+  LLVM_ABI const BitsInit *getValueAsBitsInit(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as a
   /// ListInit, throwing an exception if the field does not exist or if the
   /// value is not the right type.
-  const ListInit *getValueAsListInit(StringRef FieldName) const;
+  LLVM_ABI const ListInit *getValueAsListInit(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as a
   /// vector of records, throwing an exception if the field does not exist or
   /// if the value is not the right type.
-  std::vector<const Record *> getValueAsListOfDefs(StringRef FieldName) const;
+  LLVM_ABI std::vector<const Record *>
+  getValueAsListOfDefs(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as a
   /// vector of integers, throwing an exception if the field does not exist or
   /// if the value is not the right type.
-  std::vector<int64_t> getValueAsListOfInts(StringRef FieldName) const;
+  LLVM_ABI std::vector<int64_t> getValueAsListOfInts(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as a
   /// vector of strings, throwing an exception if the field does not exist or
   /// if the value is not the right type.
-  std::vector<StringRef> getValueAsListOfStrings(StringRef FieldName) const;
+  LLVM_ABI std::vector<StringRef>
+  getValueAsListOfStrings(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as a
   /// Record, throwing an exception if the field does not exist or if the value
   /// is not the right type.
-  const Record *getValueAsDef(StringRef FieldName) const;
+  LLVM_ABI const Record *getValueAsDef(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as a
   /// Record, returning null if the field exists but is "uninitialized" (i.e.
   /// set to `?`), and throwing an exception if the field does not exist or if
   /// its value is not the right type.
-  const Record *getValueAsOptionalDef(StringRef FieldName) const;
+  LLVM_ABI const Record *getValueAsOptionalDef(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as a bit,
   /// throwing an exception if the field does not exist or if the value is not
   /// the right type.
-  bool getValueAsBit(StringRef FieldName) const;
+  LLVM_ABI bool getValueAsBit(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as a bit.
   /// If the field is unset, sets Unset to true and returns false.
-  bool getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const;
+  LLVM_ABI bool getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const;
 
   /// This method looks up the specified field and returns its value as an
   /// int64_t, throwing an exception if the field does not exist or if the
   /// value is not the right type.
-  int64_t getValueAsInt(StringRef FieldName) const;
+  LLVM_ABI int64_t getValueAsInt(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its value as an Dag,
   /// throwing an exception if the field does not exist or if the value is not
   /// the right type.
-  const DagInit *getValueAsDag(StringRef FieldName) const;
+  LLVM_ABI const DagInit *getValueAsDag(StringRef FieldName) const;
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const Record &R);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Record &R);
 
 class RecordKeeper {
   using RecordMap = std::map<std::string, std::unique_ptr<Record>, std::less<>>;
   using GlobalMap = std::map<std::string, const Init *, std::less<>>;
 
 public:
-  RecordKeeper();
-  ~RecordKeeper();
+  LLVM_ABI RecordKeeper();
+  LLVM_ABI ~RecordKeeper();
 
   /// Return the internal implementation of the RecordKeeper.
   detail::RecordKeeperImpl &getImpl() { return *Impl; }
@@ -2044,7 +2053,7 @@ class RecordKeeper {
     assert(Ins && "Global already exists");
   }
 
-  const Init *getNewAnonymousName();
+  LLVM_ABI const Init *getNewAnonymousName();
 
   TGTimer &getTimer() const { return *Timer; }
 
@@ -2053,21 +2062,22 @@ class RecordKeeper {
 
   /// Get all the concrete records that inherit from the one specified
   /// class. The class must be defined.
-  ArrayRef<const Record *> getAllDerivedDefinitions(StringRef ClassName) const;
+  LLVM_ABI ArrayRef<const Record *>
+  getAllDerivedDefinitions(StringRef ClassName) const;
 
   /// Get all the concrete records that inherit from all the specified
   /// classes. The classes must be defined.
-  std::vector<const Record *>
+  LLVM_ABI std::vector<const Record *>
   getAllDerivedDefinitions(ArrayRef<StringRef> ClassNames) const;
 
   /// Get all the concrete records that inherit from specified class, if the
   /// class is defined. Returns an empty vector if the class is not defined.
-  ArrayRef<const Record *>
+  LLVM_ABI ArrayRef<const Record *>
   getAllDerivedDefinitionsIfDefined(StringRef ClassName) const;
 
-  void dump() const;
+  LLVM_ABI void dump() const;
 
-  void dumpAllocationStats(raw_ostream &OS) const;
+  LLVM_ABI void dumpAllocationStats(raw_ostream &OS) const;
 
 private:
   RecordKeeper(RecordKeeper &&) = delete;
@@ -2188,7 +2198,7 @@ struct LessRecordRegister {
   }
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const RecordKeeper &RK);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const RecordKeeper &RK);
 
 //===----------------------------------------------------------------------===//
 //  Resolvers
@@ -2224,7 +2234,7 @@ class Resolver {
 };
 
 /// Resolve arbitrary mappings.
-class MapResolver final : public Resolver {
+class LLVM_ABI MapResolver final : public Resolver {
   struct MappedValue {
     const Init *V;
     bool Resolved;
@@ -2250,7 +2260,7 @@ class MapResolver final : public Resolver {
 };
 
 /// Resolve all variables from a record except for unset variables.
-class RecordResolver final : public Resolver {
+class LLVM_ABI RecordResolver final : public Resolver {
   DenseMap<const Init *, const Init *> Cache;
   SmallVector<const Init *, 4> Stack;
   const Init *Name = nullptr;
@@ -2287,7 +2297,7 @@ class ShadowResolver final : public Resolver {
 
 /// (Optionally) delegate resolving to a sub-resolver, and keep track whether
 /// there were unresolved references.
-class TrackUnresolvedResolver final : public Resolver {
+class LLVM_ABI TrackUnresolvedResolver final : public Resolver {
   Resolver *R;
   bool FoundUnresolved = false;
 
@@ -2302,7 +2312,7 @@ class TrackUnresolvedResolver final : public Resolver {
 
 /// Do not resolve anything, but keep track of whether a given variable was
 /// referenced.
-class HasReferenceResolver final : public Resolver {
+class LLVM_ABI HasReferenceResolver final : public Resolver {
   const Init *VarNameToTrack;
   bool Found = false;
 
@@ -2315,8 +2325,8 @@ class HasReferenceResolver final : public Resolver {
   const Init *resolve(const Init *VarName) override;
 };
 
-void EmitDetailedRecords(const RecordKeeper &RK, raw_ostream &OS);
-void EmitJSON(const RecordKeeper &RK, raw_ostream &OS);
+LLVM_ABI void EmitDetailedRecords(const RecordKeeper &RK, raw_ostream &OS);
+LLVM_ABI void EmitJSON(const RecordKeeper &RK, raw_ostream &OS);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/TableGen/SetTheory.h b/llvm/include/llvm/TableGen/SetTheory.h
index 53c78e4572927..33c286eb37b0f 100644
--- a/llvm/include/llvm/TableGen/SetTheory.h
+++ b/llvm/include/llvm/TableGen/SetTheory.h
@@ -51,6 +51,7 @@
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <map>
 #include <memory>
@@ -68,7 +69,7 @@ class SetTheory {
   using RecSet = SmallSetVector<const Record *, 16>;
 
   /// Operator - A callback representing a DAG operator.
-  class Operator {
+  class LLVM_ABI Operator {
     virtual void anchor();
 
   public:
@@ -83,7 +84,7 @@ class SetTheory {
   /// Expander - A callback function that can transform a Record representing a
   /// set into a fully expanded list of elements. Expanders provide a way for
   /// users to define named sets that can be used in DAG expressions.
-  class Expander {
+  class LLVM_ABI Expander {
     virtual void anchor();
 
   public:
@@ -106,10 +107,10 @@ class SetTheory {
 
 public:
   /// Create a SetTheory instance with only the standard operators.
-  SetTheory();
+  LLVM_ABI SetTheory();
 
   /// addExpander - Add an expander for Records with the named super class.
-  void addExpander(StringRef ClassName, std::unique_ptr<Expander>);
+  LLVM_ABI void addExpander(StringRef ClassName, std::unique_ptr<Expander>);
 
   /// addFieldExpander - Add an expander for ClassName that simply evaluates
   /// FieldName in the Record to get the set elements. That is all that is
@@ -119,13 +120,13 @@ class SetTheory {
   ///     dag Elts = d;
   ///   }
   ///
-  void addFieldExpander(StringRef ClassName, StringRef FieldName);
+  LLVM_ABI void addFieldExpander(StringRef ClassName, StringRef FieldName);
 
   /// addOperator - Add a DAG operator.
-  void addOperator(StringRef Name, std::unique_ptr<Operator>);
+  LLVM_ABI void addOperator(StringRef Name, std::unique_ptr<Operator>);
 
   /// evaluate - Evaluate Expr and append the resulting set to Elts.
-  void evaluate(const Init *Expr, RecSet &Elts, ArrayRef<SMLoc> Loc);
+  LLVM_ABI void evaluate(const Init *Expr, RecSet &Elts, ArrayRef<SMLoc> Loc);
 
   /// evaluate - Evaluate a sequence of Inits and append to Elts.
   template<typename Iter>
@@ -137,7 +138,7 @@ class SetTheory {
   /// expand - Expand a record into a set of elements if possible. Return a
   /// pointer to the expanded elements, or NULL if Set cannot be expanded
   /// further.
-  const RecVec *expand(const Record *Set);
+  LLVM_ABI const RecVec *expand(const Record *Set);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/TableGen/StringMatcher.h b/llvm/include/llvm/TableGen/StringMatcher.h
index 70554de1a6f17..bd419c6562dfa 100644
--- a/llvm/include/llvm/TableGen/StringMatcher.h
+++ b/llvm/include/llvm/TableGen/StringMatcher.h
@@ -15,6 +15,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include <string>
 #include <utility>
 
@@ -41,7 +42,7 @@ class StringMatcher {
                 raw_ostream &OS)
       : StrVariableName(StrVariableName), Matches(Matches), OS(OS) {}
 
-  void Emit(unsigned Indent = 0, bool IgnoreDuplicates = false) const;
+  LLVM_ABI void Emit(unsigned Indent = 0, bool IgnoreDuplicates = false) const;
 
 private:
   bool EmitStringMatcherForChar(ArrayRef<const StringPair *> Matches,
diff --git a/llvm/include/llvm/TableGen/StringToOffsetTable.h b/llvm/include/llvm/TableGen/StringToOffsetTable.h
index 5ee5fb538f3eb..c957d405309e2 100644
--- a/llvm/include/llvm/TableGen/StringToOffsetTable.h
+++ b/llvm/include/llvm/TableGen/StringToOffsetTable.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
@@ -43,7 +44,7 @@ class StringToOffsetTable {
   bool empty() const { return StringOffset.empty(); }
   size_t size() const { return AggregateString.size(); }
 
-  unsigned GetOrAddStringOffset(StringRef Str);
+  LLVM_ABI unsigned GetOrAddStringOffset(StringRef Str);
 
   // Returns the offset of `Str` in the table if its preset, else return
   // std::nullopt.
@@ -65,10 +66,10 @@ class StringToOffsetTable {
   // The string table, and its input string contents, are always emitted as both
   // `static` and `constexpr`. Both `Name` and (`Name` + "Storage") must be
   // valid identifiers to declare.
-  void EmitStringTableDef(raw_ostream &OS, const Twine &Name) const;
+  LLVM_ABI void EmitStringTableDef(raw_ostream &OS, const Twine &Name) const;
 
   // Emit the string as one single string.
-  void EmitString(raw_ostream &O) const;
+  LLVM_ABI void EmitString(raw_ostream &O) const;
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/TableGen/TGTimer.h b/llvm/include/llvm/TableGen/TGTimer.h
index 31753f54028cb..22020694fa0cf 100644
--- a/llvm/include/llvm/TableGen/TGTimer.h
+++ b/llvm/include/llvm/TableGen/TGTimer.h
@@ -15,6 +15,7 @@
 #define LLVM_TABLEGEN_TGTIMER_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Timer.h"
 #include <memory>
 
@@ -38,17 +39,17 @@ class TGTimer {
   }
 
   /// Start timing a phase. Automatically stops any previous phase timer.
-  void startTimer(StringRef Name);
+  LLVM_ABI void startTimer(StringRef Name);
 
   /// Stop timing a phase.
-  void stopTimer();
+  LLVM_ABI void stopTimer();
 
   /// Start timing the overall backend. If the backend itself starts a timer,
   /// then this timer is cleared.
-  void startBackendTimer(StringRef Name);
+  LLVM_ABI void startBackendTimer(StringRef Name);
 
   /// Stop timing the overall backend.
-  void stopBackendTimer();
+  LLVM_ABI void stopBackendTimer();
 
   /// Stop phase timing and print the report.
   void stopPhaseTiming() { TimingGroup.reset(); }
diff --git a/llvm/include/llvm/TableGen/TableGenBackend.h b/llvm/include/llvm/TableGen/TableGenBackend.h
index 8450a02eb19e7..d3f3f64e57f78 100644
--- a/llvm/include/llvm/TableGen/TableGenBackend.h
+++ b/llvm/include/llvm/TableGen/TableGenBackend.h
@@ -15,6 +15,7 @@
 
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/TableGen/Main.h"
 #include "llvm/TableGen/Record.h"
 
@@ -51,7 +52,7 @@ struct FnT {
 /// \p ByDefault is true, then that callback is applied by default if no
 /// command line option was specified.
 struct Opt {
-  Opt(StringRef Name, FnT CB, StringRef Desc, bool ByDefault = false);
+  LLVM_ABI Opt(StringRef Name, FnT CB, StringRef Desc, bool ByDefault = false);
 };
 
 /// Convienence wrapper around `Opt` that registers `EmitterClass::run` as the
@@ -82,15 +83,16 @@ template <class EmitterC> class MultiFileOptClass : Opt {
 
 /// Apply callback for any command line option registered above. Returns false
 /// is no callback was applied.
-bool ApplyCallback(const RecordKeeper &Records, TableGenOutputFiles &OutFiles,
-                   StringRef FilenamePrefix);
+LLVM_ABI bool ApplyCallback(const RecordKeeper &Records,
+                            TableGenOutputFiles &OutFiles,
+                            StringRef FilenamePrefix);
 
 } // namespace TableGen::Emitter
 
 /// emitSourceFileHeader - Output an LLVM style file header to the specified
 /// raw_ostream.
-void emitSourceFileHeader(StringRef Desc, raw_ostream &OS,
-                          const RecordKeeper &Record = RecordKeeper());
+LLVM_ABI void emitSourceFileHeader(StringRef Desc, raw_ostream &OS,
+                                   const RecordKeeper &Record = RecordKeeper());
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/TargetParser/XtensaTargetParser.h b/llvm/include/llvm/TargetParser/XtensaTargetParser.h
index 41369b1d64499..363738c7dab41 100644
--- a/llvm/include/llvm/TargetParser/XtensaTargetParser.h
+++ b/llvm/include/llvm/TargetParser/XtensaTargetParser.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_TARGETPARSER_XTENSATARGETPARSER_H
 #define LLVM_TARGETPARSER_XTENSATARGETPARSER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/TargetParser/Triple.h"
 
 namespace llvm {
@@ -67,10 +68,11 @@ enum XtensaFeatureKind : uint64_t {
   XF_MISCSR = 1ULL << 36
 };
 
-CPUKind parseCPUKind(StringRef CPU);
-StringRef getBaseName(StringRef CPU);
-void getCPUFeatures(StringRef CPU, SmallVectorImpl<StringRef> &Features);
-void fillValidCPUList(SmallVectorImpl<StringRef> &Values);
+LLVM_ABI CPUKind parseCPUKind(StringRef CPU);
+LLVM_ABI StringRef getBaseName(StringRef CPU);
+LLVM_ABI void getCPUFeatures(StringRef CPU,
+                             SmallVectorImpl<StringRef> &Features);
+LLVM_ABI void fillValidCPUList(SmallVectorImpl<StringRef> &Values);
 
 } // namespace Xtensa
 } // namespace llvm
diff --git a/llvm/include/llvm/Testing/Annotations/Annotations.h b/llvm/include/llvm/Testing/Annotations/Annotations.h
index 4d38002f029de..0f126ccae5b0b 100644
--- a/llvm/include/llvm/Testing/Annotations/Annotations.h
+++ b/llvm/include/llvm/Testing/Annotations/Annotations.h
@@ -11,6 +11,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include <tuple>
 #include <vector>
 
@@ -65,7 +66,7 @@ class Annotations {
   };
 
   /// Parses the annotations from Text. Crashes if it's malformed.
-  Annotations(llvm::StringRef Text);
+  LLVM_ABI Annotations(llvm::StringRef Text);
 
   /// The input text with all annotations stripped.
   /// All points and ranges are relative to this stripped text.
@@ -73,41 +74,41 @@ class Annotations {
 
   /// Returns the position of the point marked by ^ (or $name^) in the text.
   /// Crashes if there isn't exactly one.
-  size_t point(llvm::StringRef Name = "") const;
+  LLVM_ABI size_t point(llvm::StringRef Name = "") const;
   /// Returns the position of the point with \p Name and its payload (if any).
-  std::pair<size_t, llvm::StringRef>
+  LLVM_ABI std::pair<size_t, llvm::StringRef>
   pointWithPayload(llvm::StringRef Name = "") const;
   /// Returns the position of all points marked by ^ (or $name^) in the text.
   /// Order matches the order within the text.
-  std::vector<size_t> points(llvm::StringRef Name = "") const;
+  LLVM_ABI std::vector<size_t> points(llvm::StringRef Name = "") const;
   /// Returns the positions and payloads (if any) of all points named \p Name
-  std::vector<std::pair<size_t, llvm::StringRef>>
+  LLVM_ABI std::vector<std::pair<size_t, llvm::StringRef>>
   pointsWithPayload(llvm::StringRef Name = "") const;
   /// Returns the mapping of all names of points marked in the text to their
   /// position. Unnamed points are mapped to the empty string. The positions are
   /// sorted.
   /// FIXME Remove this and expose `All` directly (currently used out-of-tree)
-  llvm::StringMap<llvm::SmallVector<size_t, 1>> all_points() const;
+  LLVM_ABI llvm::StringMap<llvm::SmallVector<size_t, 1>> all_points() const;
 
   /// Returns the location of the range marked by [[ ]] (or $name[[ ]]).
   /// Crashes if there isn't exactly one.
-  Range range(llvm::StringRef Name = "") const;
+  LLVM_ABI Range range(llvm::StringRef Name = "") const;
   /// Returns the location and payload of the range marked by [[ ]]
   /// (or $name(payload)[[ ]]). Crashes if there isn't exactly one.
-  std::pair<Range, llvm::StringRef>
+  LLVM_ABI std::pair<Range, llvm::StringRef>
   rangeWithPayload(llvm::StringRef Name = "") const;
   /// Returns the location of all ranges marked by [[ ]] (or $name[[ ]]).
   /// They are ordered by start position within the text.
-  std::vector<Range> ranges(llvm::StringRef Name = "") const;
+  LLVM_ABI std::vector<Range> ranges(llvm::StringRef Name = "") const;
   /// Returns the location of all ranges marked by [[ ]]
   /// (or $name(payload)[[ ]]).
   /// They are ordered by start position within the text.
-  std::vector<std::pair<Range, llvm::StringRef>>
+  LLVM_ABI std::vector<std::pair<Range, llvm::StringRef>>
   rangesWithPayload(llvm::StringRef Name = "") const;
   /// Returns the mapping of all names of ranges marked in the text to their
   /// location. Unnamed ranges are mapped to the empty string. The ranges are
   /// sorted by their start position.
-  llvm::StringMap<llvm::SmallVector<Range, 1>> all_ranges() const;
+  LLVM_ABI llvm::StringMap<llvm::SmallVector<Range, 1>> all_ranges() const;
 
 private:
   std::string Code;
@@ -125,8 +126,8 @@ class Annotations {
   llvm::StringMap<llvm::SmallVector<size_t, 1>> Ranges;
 };
 
-llvm::raw_ostream &operator<<(llvm::raw_ostream &O,
-                              const llvm::Annotations::Range &R);
+LLVM_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream &O,
+                                       const llvm::Annotations::Range &R);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Testing/Support/Error.h b/llvm/include/llvm/Testing/Support/Error.h
index 5ed8f11e6189b..95b32bc82f09a 100644
--- a/llvm/include/llvm/Testing/Support/Error.h
+++ b/llvm/include/llvm/Testing/Support/Error.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_TESTING_SUPPORT_ERROR_H
 #define LLVM_TESTING_SUPPORT_ERROR_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Testing/Support/SupportHelpers.h"
 
@@ -17,7 +18,7 @@
 
 namespace llvm {
 namespace detail {
-ErrorHolder TakeError(Error Err);
+LLVM_ABI ErrorHolder TakeError(Error Err);
 
 template <typename T> ExpectedHolder<T> TakeExpected(Expected<T> &Exp) {
   return {TakeError(Exp.takeError()), Exp};
diff --git a/llvm/include/llvm/Testing/Support/SupportHelpers.h b/llvm/include/llvm/Testing/Support/SupportHelpers.h
index 95c2765027ba0..0d1beed769564 100644
--- a/llvm/include/llvm/Testing/Support/SupportHelpers.h
+++ b/llvm/include/llvm/Testing/Support/SupportHelpers.h
@@ -10,6 +10,7 @@
 #define LLVM_TESTING_SUPPORT_SUPPORTHELPERS_H
 
 #include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
@@ -106,7 +107,7 @@ detail::ValueIsMatcher<InnerMatcher> ValueIs(const InnerMatcher &ValueMatcher) {
 }
 namespace unittest {
 
-SmallString<128> getInputFileDirectory(const char *Argv0);
+LLVM_ABI SmallString<128> getInputFileDirectory(const char *Argv0);
 
 /// A RAII object that creates a temporary directory upon initialization and
 /// removes it upon destruction.
diff --git a/llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h b/llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h
index 3568417510f10..ae8f05be79fec 100644
--- a/llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h
+++ b/llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h
@@ -16,13 +16,14 @@
 #define LLVM_TRANSFORMS_AGGRESSIVEINSTCOMBINE_AGGRESSIVEINSTCOMBINE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class AggressiveInstCombinePass
     : public PassInfoMixin<AggressiveInstCombinePass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroAnnotationElide.h b/llvm/include/llvm/Transforms/Coroutines/CoroAnnotationElide.h
index 2061098b6ea6a..f235dd298d3a4 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroAnnotationElide.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroAnnotationElide.h
@@ -20,14 +20,16 @@
 #include "llvm/Analysis/CGSCCPassManager.h"
 #include "llvm/Analysis/LazyCallGraph.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 struct CoroAnnotationElidePass : PassInfoMixin<CoroAnnotationElidePass> {
   CoroAnnotationElidePass() = default;
 
-  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
-                        LazyCallGraph &CG, CGSCCUpdateResult &UR);
+  LLVM_ABI PreservedAnalyses run(LazyCallGraph::SCC &C,
+                                 CGSCCAnalysisManager &AM, LazyCallGraph &CG,
+                                 CGSCCUpdateResult &UR);
 
   static bool isRequired() { return false; }
 };
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h b/llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h
index 3000a38258f4f..1cc725c6440d6 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h
@@ -15,13 +15,14 @@
 #define LLVM_TRANSFORMS_COROUTINES_COROCLEANUP_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class Module;
 
 struct CoroCleanupPass : PassInfoMixin<CoroCleanupPass> {
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
   static bool isRequired() { return true; }
 };
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroConditionalWrapper.h b/llvm/include/llvm/Transforms/Coroutines/CoroConditionalWrapper.h
index 86b0449b8713d..597b2e06df59c 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroConditionalWrapper.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroConditionalWrapper.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_COROUTINES_COROCONDITIONALWRAPPER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -18,11 +19,12 @@ class Module;
 // Only runs passes in the contained pass manager if the module contains any
 // coroutine intrinsic declarations.
 struct CoroConditionalWrapper : PassInfoMixin<CoroConditionalWrapper> {
-  CoroConditionalWrapper(ModulePassManager &&);
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI CoroConditionalWrapper(ModulePassManager &&);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
   static bool isRequired() { return true; }
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 
 private:
   ModulePassManager PM;
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroEarly.h b/llvm/include/llvm/Transforms/Coroutines/CoroEarly.h
index d55dcc6dfa6db..891b3f2ad3f18 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroEarly.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroEarly.h
@@ -18,13 +18,14 @@
 #define LLVM_TRANSFORMS_COROUTINES_COROEARLY_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class Module;
 
 struct CoroEarlyPass : PassInfoMixin<CoroEarlyPass> {
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroElide.h b/llvm/include/llvm/Transforms/Coroutines/CoroElide.h
index ff73cf20c5bf2..bdd0053f98072 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroElide.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroElide.h
@@ -17,13 +17,14 @@
 #define LLVM_TRANSFORMS_COROUTINES_COROELIDE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class Function;
 
 struct CoroElidePass : PassInfoMixin<CoroElidePass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Coroutines/SpillUtils.h b/llvm/include/llvm/Transforms/Coroutines/SpillUtils.h
index 356f9ca070881..0e17b881e0e0c 100644
--- a/llvm/include/llvm/Transforms/Coroutines/SpillUtils.h
+++ b/llvm/include/llvm/Transforms/Coroutines/SpillUtils.h
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/IR/Dominators.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/CoroShape.h"
 #include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h"
 
@@ -28,28 +29,28 @@ struct AllocaInfo {
         MayWriteBeforeCoroBegin(MayWriteBeforeCoroBegin) {}
 };
 
-void collectSpillsFromArgs(SpillInfo &Spills, Function &F,
-                           const SuspendCrossingInfo &Checker);
-void collectSpillsAndAllocasFromInsts(
+LLVM_ABI void collectSpillsFromArgs(SpillInfo &Spills, Function &F,
+                                    const SuspendCrossingInfo &Checker);
+LLVM_ABI void collectSpillsAndAllocasFromInsts(
     SpillInfo &Spills, SmallVector<AllocaInfo, 8> &Allocas,
     SmallVector<Instruction *, 4> &DeadInstructions,
     SmallVector<CoroAllocaAllocInst *, 4> &LocalAllocas, Function &F,
     const SuspendCrossingInfo &Checker, const DominatorTree &DT,
     const coro::Shape &Shape);
 
-void collectSpillsFromDbgInfo(SpillInfo &Spills, Function &F,
-                              const SuspendCrossingInfo &Checker);
+LLVM_ABI void collectSpillsFromDbgInfo(SpillInfo &Spills, Function &F,
+                                       const SuspendCrossingInfo &Checker);
 
 /// Async and Retcon{Once} conventions assume that all spill uses can be sunk
 /// after the coro.begin intrinsic.
-void sinkSpillUsesAfterCoroBegin(const DominatorTree &DT,
-                                 CoroBeginInst *CoroBegin,
-                                 coro::SpillInfo &Spills,
-                                 SmallVectorImpl<coro::AllocaInfo> &Allocas);
+LLVM_ABI void
+sinkSpillUsesAfterCoroBegin(const DominatorTree &DT, CoroBeginInst *CoroBegin,
+                            coro::SpillInfo &Spills,
+                            SmallVectorImpl<coro::AllocaInfo> &Allocas);
 
 // Get the insertion point for a spill after a Def.
-BasicBlock::iterator getSpillInsertionPt(const coro::Shape &, Value *Def,
-                                         const DominatorTree &DT);
+LLVM_ABI BasicBlock::iterator
+getSpillInsertionPt(const coro::Shape &, Value *Def, const DominatorTree &DT);
 
 } // namespace llvm::coro
 
diff --git a/llvm/include/llvm/Transforms/IPO/Annotation2Metadata.h b/llvm/include/llvm/Transforms/IPO/Annotation2Metadata.h
index dee2759d854f7..6c63e7e9eca4b 100644
--- a/llvm/include/llvm/Transforms/IPO/Annotation2Metadata.h
+++ b/llvm/include/llvm/Transforms/IPO/Annotation2Metadata.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_IPO_ANNOTATION2METADATA_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,7 +23,7 @@ class Module;
 
 /// Pass to convert @llvm.global.annotations to !annotation metadata.
 struct Annotation2MetadataPass : public PassInfoMixin<Annotation2MetadataPass> {
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h b/llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h
index 3865f098b8de0..706ce0c584faa 100644
--- a/llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h
+++ b/llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h
@@ -12,6 +12,7 @@
 #include "llvm/Analysis/CGSCCPassManager.h"
 #include "llvm/Analysis/LazyCallGraph.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -26,8 +27,9 @@ class ArgumentPromotionPass : public PassInfoMixin<ArgumentPromotionPass> {
 public:
   ArgumentPromotionPass(unsigned MaxElements = 2u) : MaxElements(MaxElements) {}
 
-  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
-                        LazyCallGraph &CG, CGSCCUpdateResult &UR);
+  LLVM_ABI PreservedAnalyses run(LazyCallGraph::SCC &C,
+                                 CGSCCAnalysisManager &AM, LazyCallGraph &CG,
+                                 CGSCCUpdateResult &UR);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/CalledValuePropagation.h b/llvm/include/llvm/Transforms/IPO/CalledValuePropagation.h
index 782633799ede6..75b756e25a5a4 100644
--- a/llvm/include/llvm/Transforms/IPO/CalledValuePropagation.h
+++ b/llvm/include/llvm/Transforms/IPO/CalledValuePropagation.h
@@ -20,13 +20,14 @@
 #define LLVM_TRANSFORMS_IPO_CALLEDVALUEPROPAGATION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class CalledValuePropagationPass
     : public PassInfoMixin<CalledValuePropagationPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/IPO/ConstantMerge.h b/llvm/include/llvm/Transforms/IPO/ConstantMerge.h
index 12d38b5f58fa0..b5d8db1ca8e61 100644
--- a/llvm/include/llvm/Transforms/IPO/ConstantMerge.h
+++ b/llvm/include/llvm/Transforms/IPO/ConstantMerge.h
@@ -20,6 +20,7 @@
 #define LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -28,7 +29,7 @@ class Module;
 /// A pass that merges duplicate global constants into a single constant.
 class ConstantMergePass : public PassInfoMixin<ConstantMergePass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/CrossDSOCFI.h b/llvm/include/llvm/Transforms/IPO/CrossDSOCFI.h
index d34a510811018..1c3d562b87bb5 100644
--- a/llvm/include/llvm/Transforms/IPO/CrossDSOCFI.h
+++ b/llvm/include/llvm/Transforms/IPO/CrossDSOCFI.h
@@ -15,11 +15,12 @@
 #define LLVM_TRANSFORMS_IPO_CROSSDSOCFI_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class CrossDSOCFIPass : public PassInfoMixin<CrossDSOCFIPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 }
 #endif // LLVM_TRANSFORMS_IPO_CROSSDSOCFI_H
diff --git a/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h b/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
index efa9c4bdc496e..888343b8c58b3 100644
--- a/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
+++ b/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
@@ -23,6 +23,7 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include <map>
 #include <set>
 #include <string>
@@ -75,7 +76,7 @@ class DeadArgumentEliminationPass
   DeadArgumentEliminationPass(bool ShouldHackArguments = false)
       : ShouldHackArguments(ShouldHackArguments) {}
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 
   /// Convenience wrapper
   RetOrArg createRet(const Function *F, unsigned Idx) {
diff --git a/llvm/include/llvm/Transforms/IPO/ElimAvailExtern.h b/llvm/include/llvm/Transforms/IPO/ElimAvailExtern.h
index 92c319b3cce30..f98c901d47522 100644
--- a/llvm/include/llvm/Transforms/IPO/ElimAvailExtern.h
+++ b/llvm/include/llvm/Transforms/IPO/ElimAvailExtern.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_IPO_ELIMAVAILEXTERN_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -24,7 +25,7 @@ class Module;
 class EliminateAvailableExternallyPass
     : public PassInfoMixin<EliminateAvailableExternallyPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/ExpandVariadics.h b/llvm/include/llvm/Transforms/IPO/ExpandVariadics.h
index 4c5a1b61e2d44..1b097ae25160e 100644
--- a/llvm/include/llvm/Transforms/IPO/ExpandVariadics.h
+++ b/llvm/include/llvm/Transforms/IPO/ExpandVariadics.h
@@ -9,6 +9,7 @@
 #define LLVM_TRANSFORMS_IPO_EXPANDVARIADICS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -28,12 +29,12 @@ class ExpandVariadicsPass : public PassInfoMixin<ExpandVariadicsPass> {
 
 public:
   // Operates under passed mode unless overridden on commandline
-  ExpandVariadicsPass(ExpandVariadicsMode Mode);
+  LLVM_ABI ExpandVariadicsPass(ExpandVariadicsMode Mode);
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
-ModulePass *createExpandVariadicsPass(ExpandVariadicsMode);
+LLVM_ABI ModulePass *createExpandVariadicsPass(ExpandVariadicsMode);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/IPO/FatLTOCleanup.h b/llvm/include/llvm/Transforms/IPO/FatLTOCleanup.h
index 6fc1b2623e163..c98706c6d0662 100644
--- a/llvm/include/llvm/Transforms/IPO/FatLTOCleanup.h
+++ b/llvm/include/llvm/Transforms/IPO/FatLTOCleanup.h
@@ -18,6 +18,7 @@
 #define LLVM_TRANSFORMS_IPO_FATLTOCLEANUP_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,7 +28,7 @@ class ModuleSummaryIndex;
 class FatLtoCleanup : public PassInfoMixin<FatLtoCleanup> {
 public:
   FatLtoCleanup() = default;
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h b/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
index 52667e19bc88b..1a5dba7a49018 100644
--- a/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
+++ b/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_IPO_FORCEFUNCTIONATTRS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Module;
@@ -21,7 +22,7 @@ class Module;
 /// Pass which forces specific function attributes into the IR, primarily as
 /// a debugging tool.
 struct ForceFunctionAttrsPass : PassInfoMixin<ForceFunctionAttrsPass> {
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 };
 
 }
diff --git a/llvm/include/llvm/Transforms/IPO/GlobalOpt.h b/llvm/include/llvm/Transforms/IPO/GlobalOpt.h
index 48a861ff2cf8f..43f04c6ddacad 100644
--- a/llvm/include/llvm/Transforms/IPO/GlobalOpt.h
+++ b/llvm/include/llvm/Transforms/IPO/GlobalOpt.h
@@ -16,6 +16,7 @@
 #define LLVM_TRANSFORMS_IPO_GLOBALOPT_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -24,7 +25,7 @@ class Module;
 /// Optimize globals that never have their address taken.
 class GlobalOptPass : public PassInfoMixin<GlobalOptPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/GlobalSplit.h b/llvm/include/llvm/Transforms/IPO/GlobalSplit.h
index 690b23a2d7853..ccecdee39d7fe 100644
--- a/llvm/include/llvm/Transforms/IPO/GlobalSplit.h
+++ b/llvm/include/llvm/Transforms/IPO/GlobalSplit.h
@@ -17,6 +17,7 @@
 #define LLVM_TRANSFORMS_IPO_GLOBALSPLIT_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,7 +26,7 @@ class Module;
 /// Pass to perform split of global variables.
 class GlobalSplitPass : public PassInfoMixin<GlobalSplitPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/HotColdSplitting.h b/llvm/include/llvm/Transforms/IPO/HotColdSplitting.h
index 4308c0879dbcd..d886827a1be91 100644
--- a/llvm/include/llvm/Transforms/IPO/HotColdSplitting.h
+++ b/llvm/include/llvm/Transforms/IPO/HotColdSplitting.h
@@ -14,6 +14,7 @@
 
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/BranchProbability.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -41,7 +42,7 @@ class HotColdSplitting {
                    std::function<OptimizationRemarkEmitter &(Function &)> *GORE,
                    function_ref<AssumptionCache *(Function &)> LAC)
       : PSI(ProfSI), GetBFI(GBFI), GetTTI(GTTI), GetORE(GORE), LookupAC(LAC) {}
-  bool run(Module &M);
+  LLVM_ABI bool run(Module &M);
 
 private:
   bool isFunctionCold(const Function &F) const;
@@ -66,7 +67,7 @@ class HotColdSplitting {
 /// Pass to outline cold regions.
 class HotColdSplittingPass : public PassInfoMixin<HotColdSplittingPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/IROutliner.h b/llvm/include/llvm/Transforms/IPO/IROutliner.h
index e8275b2d20ade..37296b63f3eab 100644
--- a/llvm/include/llvm/Transforms/IPO/IROutliner.h
+++ b/llvm/include/llvm/Transforms/IPO/IROutliner.h
@@ -43,6 +43,7 @@
 
 #include "llvm/Analysis/IRSimilarityIdentifier.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/InstructionCost.h"
 #include "llvm/Transforms/Utils/CodeExtractor.h"
 
@@ -158,13 +159,13 @@ struct OutlinableRegion {
 
   /// For the contained region, split the parent BasicBlock at the starting and
   /// ending instructions of the contained IRSimilarityCandidate.
-  void splitCandidate();
+  LLVM_ABI void splitCandidate();
 
   /// For the contained region, reattach the BasicBlock at the starting and
   /// ending instructions of the contained IRSimilarityCandidate, or if the
   /// function has been extracted, the start and end of the BasicBlock
   /// containing the called function.
-  void reattachCandidate();
+  LLVM_ABI void reattachCandidate();
 
   /// Find a corresponding value for \p V in similar OutlinableRegion \p Other.
   ///
@@ -172,7 +173,8 @@ struct OutlinableRegion {
   /// in.
   /// \param V [in] - The Value to look for in the other region.
   /// \return The corresponding Value to \p V if it exists, otherwise nullptr.
-  Value *findCorrespondingValueIn(const OutlinableRegion &Other, Value *V);
+  LLVM_ABI Value *findCorrespondingValueIn(const OutlinableRegion &Other,
+                                           Value *V);
 
   /// Find a corresponding BasicBlock for \p BB in similar OutlinableRegion \p Other.
   ///
@@ -180,14 +182,14 @@ struct OutlinableRegion {
   /// BasicBlock in.
   /// \param BB [in] - The BasicBlock to look for in the other region.
   /// \return The corresponding Value to \p V if it exists, otherwise nullptr.
-  BasicBlock *findCorrespondingBlockIn(const OutlinableRegion &Other,
-                                       BasicBlock *BB);
+  LLVM_ABI BasicBlock *findCorrespondingBlockIn(const OutlinableRegion &Other,
+                                                BasicBlock *BB);
 
   /// Get the size of the code removed from the region.
   ///
   /// \param [in] TTI - The TargetTransformInfo for the parent function.
   /// \returns the code size of the region
-  InstructionCost getBenefit(TargetTransformInfo &TTI);
+  LLVM_ABI InstructionCost getBenefit(TargetTransformInfo &TTI);
 };
 
 /// This class is a pass that identifies similarity in a Module, extracts
@@ -209,7 +211,7 @@ class IROutliner {
     static_assert(DenseMapInfo<unsigned>::getTombstoneKey() ==
                   static_cast<unsigned>(-2));
   }
-  bool run(Module &M);
+  LLVM_ABI bool run(Module &M);
 
 private:
   /// Find repeated similar code sequences in \p M and outline them into new
@@ -443,7 +445,7 @@ class IROutliner {
 /// Pass to outline similar regions.
 class IROutlinerPass : public PassInfoMixin<IROutlinerPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/LoopExtractor.h b/llvm/include/llvm/Transforms/IPO/LoopExtractor.h
index aa697484d0e95..fb94c73218760 100644
--- a/llvm/include/llvm/Transforms/IPO/LoopExtractor.h
+++ b/llvm/include/llvm/Transforms/IPO/LoopExtractor.h
@@ -17,14 +17,16 @@
 #define LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 struct LoopExtractorPass : public PassInfoMixin<LoopExtractorPass> {
   LoopExtractorPass(unsigned NumLoops = ~0) : NumLoops(NumLoops) {}
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 
 private:
   unsigned NumLoops;
diff --git a/llvm/include/llvm/Transforms/IPO/MemProfContextDisambiguation.h b/llvm/include/llvm/Transforms/IPO/MemProfContextDisambiguation.h
index 576f1eb09953a..6e6b538a2bf0b 100644
--- a/llvm/include/llvm/Transforms/IPO/MemProfContextDisambiguation.h
+++ b/llvm/include/llvm/Transforms/IPO/MemProfContextDisambiguation.h
@@ -19,6 +19,7 @@
 #include "llvm/IR/GlobalValue.h"
 #include "llvm/IR/ModuleSummaryIndex.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 #include <functional>
 
@@ -86,14 +87,16 @@ class MemProfContextDisambiguation
   std::unique_ptr<ICallPromotionAnalysis> ICallAnalysis;
 
 public:
+  LLVM_ABI
   MemProfContextDisambiguation(const ModuleSummaryIndex *Summary = nullptr,
                                bool isSamplePGO = false);
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
-  void run(ModuleSummaryIndex &Index,
-           function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
-               isPrevailing);
+  LLVM_ABI void
+  run(ModuleSummaryIndex &Index,
+      function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
+          isPrevailing);
 };
 
 /// Strips MemProf attributes and metadata. Can be invoked by the pass pipeline
@@ -102,7 +105,7 @@ class MemProfContextDisambiguation
 /// transformations.
 class MemProfRemoveInfo : public PassInfoMixin<MemProfRemoveInfo> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/OpenMPOpt.h b/llvm/include/llvm/Transforms/IPO/OpenMPOpt.h
index 2499c2bbccf45..c664deb4f694e 100644
--- a/llvm/include/llvm/Transforms/IPO/OpenMPOpt.h
+++ b/llvm/include/llvm/Transforms/IPO/OpenMPOpt.h
@@ -12,6 +12,7 @@
 #include "llvm/Analysis/CGSCCPassManager.h"
 #include "llvm/Analysis/LazyCallGraph.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -24,17 +25,17 @@ using Kernel = Function *;
 using KernelSet = SetVector<Kernel>;
 
 /// Helper to determine if \p M contains OpenMP.
-bool containsOpenMP(Module &M);
+LLVM_ABI bool containsOpenMP(Module &M);
 
 /// Helper to determine if \p M is a OpenMP target offloading device module.
-bool isOpenMPDevice(Module &M);
+LLVM_ABI bool isOpenMPDevice(Module &M);
 
 /// Return true iff \p Fn is an OpenMP GPU kernel; \p Fn has the "kernel"
 /// attribute.
-bool isOpenMPKernel(Function &Fn);
+LLVM_ABI bool isOpenMPKernel(Function &Fn);
 
 /// Get OpenMP device kernels in \p M.
-KernelSet getDeviceKernels(Module &M);
+LLVM_ABI KernelSet getDeviceKernels(Module &M);
 
 } // namespace omp
 
@@ -44,7 +45,7 @@ class OpenMPOptPass : public PassInfoMixin<OpenMPOptPass> {
   OpenMPOptPass() = default;
   OpenMPOptPass(ThinOrFullLTOPhase LTOPhase) : LTOPhase(LTOPhase) {}
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
 private:
   const ThinOrFullLTOPhase LTOPhase = ThinOrFullLTOPhase::None;
@@ -55,8 +56,9 @@ class OpenMPOptCGSCCPass : public PassInfoMixin<OpenMPOptCGSCCPass> {
   OpenMPOptCGSCCPass() = default;
   OpenMPOptCGSCCPass(ThinOrFullLTOPhase LTOPhase) : LTOPhase(LTOPhase) {}
 
-  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
-                        LazyCallGraph &CG, CGSCCUpdateResult &UR);
+  LLVM_ABI PreservedAnalyses run(LazyCallGraph::SCC &C,
+                                 CGSCCAnalysisManager &AM, LazyCallGraph &CG,
+                                 CGSCCUpdateResult &UR);
 
 private:
   const ThinOrFullLTOPhase LTOPhase = ThinOrFullLTOPhase::None;
diff --git a/llvm/include/llvm/Transforms/IPO/PartialInlining.h b/llvm/include/llvm/Transforms/IPO/PartialInlining.h
index 3b8297d659875..f113b64245d0d 100644
--- a/llvm/include/llvm/Transforms/IPO/PartialInlining.h
+++ b/llvm/include/llvm/Transforms/IPO/PartialInlining.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_IPO_PARTIALINLINING_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -23,7 +24,7 @@ class Module;
 /// Pass to remove unused function declarations.
 class PartialInlinerPass : public PassInfoMixin<PartialInlinerPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/SCCP.h b/llvm/include/llvm/Transforms/IPO/SCCP.h
index 980737253eef5..74d88f295f580 100644
--- a/llvm/include/llvm/Transforms/IPO/SCCP.h
+++ b/llvm/include/llvm/Transforms/IPO/SCCP.h
@@ -21,6 +21,7 @@
 #define LLVM_TRANSFORMS_IPO_SCCP_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -53,7 +54,7 @@ class IPSCCPPass : public PassInfoMixin<IPSCCPPass> {
 
   IPSCCPPass(IPSCCPOptions Options) : Options(Options) {}
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
   bool isFuncSpecEnabled() const { return Options.AllowFuncSpec; }
 };
diff --git a/llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h b/llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h
index c695784641b4e..5f65d6519c5ef 100644
--- a/llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h
+++ b/llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_IPO_SAMPLEPROFILEMATCHER_H
 
 #include "llvm/ADT/StringSet.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h"
 
 #include <unordered_set>
@@ -129,7 +130,7 @@ class SampleProfileMatcher {
       : M(M), Reader(Reader), CG(CG), ProbeManager(ProbeManager),
         LTOPhase(LTOPhase), FuncNameToProfNameMap(&FuncNameToProfNameMap),
         SymbolMap(&SymMap), PSL(PSL) {};
-  void runOnModule();
+  LLVM_ABI void runOnModule();
   void clearMatchingData() {
     // Do not clear FuncMappings, it stores IRLoc to ProfLoc remappings which
     // will be used for sample loader.
diff --git a/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h b/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
index d6c2d7fc48bda..9f807fc2e6058 100644
--- a/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
+++ b/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
@@ -25,6 +25,7 @@
 #include "llvm/Analysis/ValueTracking.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/PatternMatch.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/KnownBits.h"
 #include <cassert>
@@ -204,9 +205,9 @@ class LLVM_LIBRARY_VISIBILITY InstCombiner {
   /// dereferenceable).
   /// If the inversion will consume instructions, `DoesConsume` will be set to
   /// true. Otherwise it will be false.
-  Value *getFreelyInvertedImpl(Value *V, bool WillInvertAllUses,
-                                      BuilderTy *Builder, bool &DoesConsume,
-                                      unsigned Depth);
+  LLVM_ABI Value *getFreelyInvertedImpl(Value *V, bool WillInvertAllUses,
+                                        BuilderTy *Builder, bool &DoesConsume,
+                                        unsigned Depth);
 
   Value *getFreelyInverted(Value *V, bool WillInvertAllUses,
                                   BuilderTy *Builder, bool &DoesConsume) {
@@ -345,18 +346,19 @@ class LLVM_LIBRARY_VISIBILITY InstCombiner {
   ProfileSummaryInfo *getProfileSummaryInfo() const { return PSI; }
 
   // Call target specific combiners
-  std::optional<Instruction *> targetInstCombineIntrinsic(IntrinsicInst &II);
-  std::optional<Value *>
+  LLVM_ABI std::optional<Instruction *>
+  targetInstCombineIntrinsic(IntrinsicInst &II);
+  LLVM_ABI std::optional<Value *>
   targetSimplifyDemandedUseBitsIntrinsic(IntrinsicInst &II, APInt DemandedMask,
                                          KnownBits &Known,
                                          bool &KnownBitsComputed);
-  std::optional<Value *> targetSimplifyDemandedVectorEltsIntrinsic(
+  LLVM_ABI std::optional<Value *> targetSimplifyDemandedVectorEltsIntrinsic(
       IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts,
       APInt &UndefElts2, APInt &UndefElts3,
       std::function<void(Instruction *, unsigned, APInt, APInt &)>
           SimplifyAndSetOp);
 
-  void computeBackEdges();
+  LLVM_ABI void computeBackEdges();
   bool isBackEdge(const BasicBlock *From, const BasicBlock *To) {
     if (!ComputedBackEdges)
       computeBackEdges();
@@ -526,7 +528,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombiner {
                              unsigned Depth = 0,
                              bool AllowMultipleUsers = false) = 0;
 
-  bool isValidAddrSpaceCast(unsigned FromAS, unsigned ToAS) const;
+  LLVM_ABI bool isValidAddrSpaceCast(unsigned FromAS, unsigned ToAS) const;
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h b/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h
index 6d2def3d2b72d..f8635154e486b 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h
@@ -20,18 +20,20 @@
 #include "llvm/IR/Instruction.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Module.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 // Get AddressSanitizer parameters.
-void getAddressSanitizerParams(const Triple &TargetTriple, int LongSize,
-                               bool IsKasan, uint64_t *ShadowBase,
-                               int *MappingScale, bool *OrShadowOffset);
+LLVM_ABI void getAddressSanitizerParams(const Triple &TargetTriple,
+                                        int LongSize, bool IsKasan,
+                                        uint64_t *ShadowBase, int *MappingScale,
+                                        bool *OrShadowOffset);
 
 /// Remove memory attributes that are incompatible with the instrumentation
 /// added by AddressSanitizer and HWAddressSanitizer.
 /// \p ReadsArgMem - indicates whether function arguments may be read by
 /// instrumentation and require removing `writeonly` attributes.
-void removeASanIncompatibleFnAttributes(Function &F, bool ReadsArgMem);
+LLVM_ABI void removeASanIncompatibleFnAttributes(Function &F, bool ReadsArgMem);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Instrumentation/BlockCoverageInference.h b/llvm/include/llvm/Transforms/Instrumentation/BlockCoverageInference.h
index 12f236481b251..113f0b9c16742 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/BlockCoverageInference.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/BlockCoverageInference.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SetVector.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace llvm {
@@ -32,27 +33,27 @@ class BlockCoverageInference {
 public:
   using BlockSet = SmallSetVector<const BasicBlock *, 4>;
 
-  BlockCoverageInference(const Function &F, bool ForceInstrumentEntry);
+  LLVM_ABI BlockCoverageInference(const Function &F, bool ForceInstrumentEntry);
 
   /// \return true if \p BB should be instrumented for coverage.
-  bool shouldInstrumentBlock(const BasicBlock &BB) const;
+  LLVM_ABI bool shouldInstrumentBlock(const BasicBlock &BB) const;
 
   /// \return the set of blocks \p Deps such that \p BB is covered iff any
   /// blocks in \p Deps are covered.
-  BlockSet getDependencies(const BasicBlock &BB) const;
+  LLVM_ABI BlockSet getDependencies(const BasicBlock &BB) const;
 
   /// \return a hash that depends on the set of instrumented blocks.
-  uint64_t getInstrumentedBlocksHash() const;
+  LLVM_ABI uint64_t getInstrumentedBlocksHash() const;
 
   /// Dump the inference graph.
-  void dump(raw_ostream &OS) const;
+  LLVM_ABI void dump(raw_ostream &OS) const;
 
   /// View the inferred block coverage as a dot file.
   /// Filled gray blocks are instrumented, red outlined blocks are found to be
   /// covered, red edges show that a block's coverage can be inferred from its
   /// successors, and blue edges show that a block's coverage can be inferred
   /// from its predecessors.
-  void viewBlockCoverageGraph(
+  LLVM_ABI void viewBlockCoverageGraph(
       const DenseMap<const BasicBlock *, bool> *Coverage = nullptr) const;
 
 private:
@@ -75,7 +76,7 @@ class BlockCoverageInference {
   void getReachableAvoiding(const BasicBlock &Start, const BasicBlock &Avoid,
                             bool IsForward, BlockSet &Reachable) const;
 
-  static std::string getBlockNames(ArrayRef<const BasicBlock *> BBs);
+  LLVM_ABI static std::string getBlockNames(ArrayRef<const BasicBlock *> BBs);
   static std::string getBlockNames(BlockSet BBs) {
     return getBlockNames(ArrayRef<const BasicBlock *>(BBs.begin(), BBs.end()));
   }
diff --git a/llvm/include/llvm/Transforms/Instrumentation/CGProfile.h b/llvm/include/llvm/Transforms/Instrumentation/CGProfile.h
index 0011b7b8b36c7..60dcb7273b4d9 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/CGProfile.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/CGProfile.h
@@ -13,13 +13,14 @@
 #define LLVM_TRANSFORMS_INSTRUMENTATION_CGPROFILE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Module;
 class CGProfilePass : public PassInfoMixin<CGProfilePass> {
 public:
   CGProfilePass(bool InLTO) : InLTO(InLTO) {}
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
 private:
   bool InLTO = false;
diff --git a/llvm/include/llvm/Transforms/Instrumentation/ControlHeightReduction.h b/llvm/include/llvm/Transforms/Instrumentation/ControlHeightReduction.h
index 0bace514c3619..03ff3d9fc1d53 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/ControlHeightReduction.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/ControlHeightReduction.h
@@ -15,14 +15,15 @@
 #define LLVM_TRANSFORMS_INSTRUMENTATION_CONTROLHEIGHTREDUCTION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class ControlHeightReductionPass :
       public PassInfoMixin<ControlHeightReductionPass> {
 public:
-  ControlHeightReductionPass();
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI ControlHeightReductionPass();
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h b/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h
index 96ff265af4371..cbea5a5c55ec2 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h
@@ -13,6 +13,7 @@
 #define LLVM_TRANSFORMS_INSTRUMENTATION_PGOCTXPROFFLATTENING_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 namespace llvm {
 
 class PGOCtxProfFlatteningPass
@@ -22,7 +23,7 @@ class PGOCtxProfFlatteningPass
 public:
   explicit PGOCtxProfFlatteningPass(bool IsPreThinlink)
       : IsPreThinlink(IsPreThinlink) {}
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 };
 } // namespace llvm
 #endif
diff --git a/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfLowering.h b/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfLowering.h
index 8010c1c091e40..61dbfdacbbbeb 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfLowering.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfLowering.h
@@ -13,6 +13,7 @@
 #define LLVM_TRANSFORMS_INSTRUMENTATION_PGOCTXPROFLOWERING_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 namespace llvm {
 class Type;
 
@@ -20,9 +21,9 @@ class PGOCtxProfLoweringPass : public PassInfoMixin<PGOCtxProfLoweringPass> {
 public:
   explicit PGOCtxProfLoweringPass() = default;
   // True if contextual instrumentation is enabled.
-  static bool isCtxIRPGOInstrEnabled();
+  LLVM_ABI static bool isCtxIRPGOInstrEnabled();
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 };
 
 // Utility pass blocking inlining for any function that may be overridden during
@@ -36,7 +37,7 @@ class NoinlineNonPrevailing : public PassInfoMixin<NoinlineNonPrevailing> {
 public:
   explicit NoinlineNonPrevailing() = default;
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Instrumentation/PGOForceFunctionAttrs.h b/llvm/include/llvm/Transforms/Instrumentation/PGOForceFunctionAttrs.h
index 785448e0dec4d..cabc30904d6c9 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/PGOForceFunctionAttrs.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/PGOForceFunctionAttrs.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_INSTRUMENTATION_PGOFORCEFUNCTIONATTRS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/PGOOptions.h"
 
 namespace llvm {
@@ -18,7 +19,7 @@ struct PGOForceFunctionAttrsPass
     : public PassInfoMixin<PGOForceFunctionAttrsPass> {
   PGOForceFunctionAttrsPass(PGOOptions::ColdFuncOpt ColdType)
       : ColdType(ColdType) {}
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
 private:
   PGOOptions::ColdFuncOpt ColdType;
diff --git a/llvm/include/llvm/Transforms/Scalar/ADCE.h b/llvm/include/llvm/Transforms/Scalar/ADCE.h
index 7d8b7ae68c004..c0a470fddbe68 100644
--- a/llvm/include/llvm/Transforms/Scalar/ADCE.h
+++ b/llvm/include/llvm/Transforms/Scalar/ADCE.h
@@ -17,6 +17,7 @@
 #define LLVM_TRANSFORMS_SCALAR_ADCE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -29,7 +30,7 @@ class Function;
 /// dead computations that other DCE passes do not catch, particularly involving
 /// loop computations.
 struct ADCEPass : PassInfoMixin<ADCEPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h b/llvm/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h
index ab2bb2e4cf1e4..d0641ecd27373 100644
--- a/llvm/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h
+++ b/llvm/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h
@@ -18,6 +18,7 @@
 #define LLVM_TRANSFORMS_SCALAR_ALIGNMENTFROMASSUMPTIONS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -30,18 +31,19 @@ class Value;
 
 struct AlignmentFromAssumptionsPass
     : public PassInfoMixin<AlignmentFromAssumptionsPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   // Glue for old PM.
-  bool runImpl(Function &F, AssumptionCache &AC, ScalarEvolution *SE_,
-               DominatorTree *DT_);
+  LLVM_ABI bool runImpl(Function &F, AssumptionCache &AC, ScalarEvolution *SE_,
+                        DominatorTree *DT_);
 
   ScalarEvolution *SE = nullptr;
   DominatorTree *DT = nullptr;
 
-  bool extractAlignmentInfo(CallInst *I, unsigned Idx, Value *&AAPtr,
-                            const SCEV *&AlignSCEV, const SCEV *&OffSCEV);
-  bool processAssumption(CallInst *I, unsigned Idx);
+  LLVM_ABI bool extractAlignmentInfo(CallInst *I, unsigned Idx, Value *&AAPtr,
+                                     const SCEV *&AlignSCEV,
+                                     const SCEV *&OffSCEV);
+  LLVM_ABI bool processAssumption(CallInst *I, unsigned Idx);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Scalar/AnnotationRemarks.h b/llvm/include/llvm/Transforms/Scalar/AnnotationRemarks.h
index 45983ad9d5716..4e558d3e61fcc 100644
--- a/llvm/include/llvm/Transforms/Scalar/AnnotationRemarks.h
+++ b/llvm/include/llvm/Transforms/Scalar/AnnotationRemarks.h
@@ -15,13 +15,14 @@
 #define LLVM_TRANSFORMS_SCALAR_ANNOTATIONREMARKS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class Function;
 
 struct AnnotationRemarksPass : public PassInfoMixin<AnnotationRemarksPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/BDCE.h b/llvm/include/llvm/Transforms/Scalar/BDCE.h
index 0763f31dfad45..70c1f00621c3b 100644
--- a/llvm/include/llvm/Transforms/Scalar/BDCE.h
+++ b/llvm/include/llvm/Transforms/Scalar/BDCE.h
@@ -17,6 +17,7 @@
 #define LLVM_TRANSFORMS_SCALAR_BDCE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -24,7 +25,7 @@ class Function;
 
 // The Bit-Tracking Dead Code Elimination pass.
 struct BDCEPass : PassInfoMixin<BDCEPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Scalar/CallSiteSplitting.h b/llvm/include/llvm/Transforms/Scalar/CallSiteSplitting.h
index 661340f4598f1..ae4e9fdb5d9f1 100644
--- a/llvm/include/llvm/Transforms/Scalar/CallSiteSplitting.h
+++ b/llvm/include/llvm/Transforms/Scalar/CallSiteSplitting.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_SCALAR_CALLSITESPLITTING_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -17,7 +18,7 @@ class Function;
 
 struct CallSiteSplittingPass : PassInfoMixin<CallSiteSplittingPass> {
   /// Run the pass over the function.
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h b/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
index e597665661e34..be81aec951ff6 100644
--- a/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
+++ b/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
@@ -44,6 +44,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include <algorithm>
 #include <vector>
 
@@ -125,12 +126,12 @@ struct ConstantInfo {
 
 class ConstantHoistingPass : public PassInfoMixin<ConstantHoistingPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   // Glue for old PM.
-  bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT,
-               BlockFrequencyInfo *BFI, BasicBlock &Entry,
-               ProfileSummaryInfo *PSI);
+  LLVM_ABI bool runImpl(Function &F, TargetTransformInfo &TTI,
+                        DominatorTree &DT, BlockFrequencyInfo *BFI,
+                        BasicBlock &Entry, ProfileSummaryInfo *PSI);
 
   void cleanup() {
     ClonedCastMap.clear();
diff --git a/llvm/include/llvm/Transforms/Scalar/ConstraintElimination.h b/llvm/include/llvm/Transforms/Scalar/ConstraintElimination.h
index 544a6c2eae552..7d43c547de8e5 100644
--- a/llvm/include/llvm/Transforms/Scalar/ConstraintElimination.h
+++ b/llvm/include/llvm/Transforms/Scalar/ConstraintElimination.h
@@ -10,13 +10,14 @@
 #define LLVM_TRANSFORMS_SCALAR_CONSTRAINTELIMINATION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class ConstraintEliminationPass
     : public PassInfoMixin<ConstraintEliminationPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/CorrelatedValuePropagation.h b/llvm/include/llvm/Transforms/Scalar/CorrelatedValuePropagation.h
index 25795de5d951f..fab6427d163b9 100644
--- a/llvm/include/llvm/Transforms/Scalar/CorrelatedValuePropagation.h
+++ b/llvm/include/llvm/Transforms/Scalar/CorrelatedValuePropagation.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_SCALAR_CORRELATEDVALUEPROPAGATION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -17,7 +18,7 @@ class Function;
 
 struct CorrelatedValuePropagationPass
     : PassInfoMixin<CorrelatedValuePropagationPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/DCE.h b/llvm/include/llvm/Transforms/Scalar/DCE.h
index 8d1616a7b75db..b9de3e6923b73 100644
--- a/llvm/include/llvm/Transforms/Scalar/DCE.h
+++ b/llvm/include/llvm/Transforms/Scalar/DCE.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_SCALAR_DCE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,13 +23,13 @@ class Function;
 /// Basic Dead Code Elimination pass.
 class DCEPass : public PassInfoMixin<DCEPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 class RedundantDbgInstEliminationPass
     : public PassInfoMixin<RedundantDbgInstEliminationPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Scalar/DFAJumpThreading.h b/llvm/include/llvm/Transforms/Scalar/DFAJumpThreading.h
index 4e9fbf65e1636..d23da1fdfe135 100644
--- a/llvm/include/llvm/Transforms/Scalar/DFAJumpThreading.h
+++ b/llvm/include/llvm/Transforms/Scalar/DFAJumpThreading.h
@@ -14,13 +14,14 @@
 #define LLVM_TRANSFORMS_SCALAR_DFAJUMPTHREADING_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class Function;
 
 struct DFAJumpThreadingPass : PassInfoMixin<DFAJumpThreadingPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/DeadStoreElimination.h b/llvm/include/llvm/Transforms/Scalar/DeadStoreElimination.h
index b66b0de90c790..ac926ca867f62 100644
--- a/llvm/include/llvm/Transforms/Scalar/DeadStoreElimination.h
+++ b/llvm/include/llvm/Transforms/Scalar/DeadStoreElimination.h
@@ -18,6 +18,7 @@
 #define LLVM_TRANSFORMS_SCALAR_DEADSTOREELIMINATION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,7 +28,7 @@ class Function;
 /// only the redundant stores that are local to a single Basic Block.
 class DSEPass : public PassInfoMixin<DSEPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/DivRemPairs.h b/llvm/include/llvm/Transforms/Scalar/DivRemPairs.h
index 7401e02cb4ab4..bca3645a36e50 100644
--- a/llvm/include/llvm/Transforms/Scalar/DivRemPairs.h
+++ b/llvm/include/llvm/Transforms/Scalar/DivRemPairs.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_SCALAR_DIVREMPAIRS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,7 +23,7 @@ namespace llvm {
 /// improvements and better codegen.
 struct DivRemPairsPass : public PassInfoMixin<DivRemPairsPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };
 
 }
diff --git a/llvm/include/llvm/Transforms/Scalar/DropUnnecessaryAssumes.h b/llvm/include/llvm/Transforms/Scalar/DropUnnecessaryAssumes.h
index 54ddcc09f7204..c487e1343aac6 100644
--- a/llvm/include/llvm/Transforms/Scalar/DropUnnecessaryAssumes.h
+++ b/llvm/include/llvm/Transforms/Scalar/DropUnnecessaryAssumes.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_SCALAR_DROPUNNECESSARYASSUMES_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,7 +23,7 @@ struct DropUnnecessaryAssumesPass
   DropUnnecessaryAssumesPass(bool DropDereferenceable = false)
       : DropDereferenceable(DropDereferenceable) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
 private:
   bool DropDereferenceable;
diff --git a/llvm/include/llvm/Transforms/Scalar/FlattenCFG.h b/llvm/include/llvm/Transforms/Scalar/FlattenCFG.h
index ff49a4ab7ceb1..d295eee8d4230 100644
--- a/llvm/include/llvm/Transforms/Scalar/FlattenCFG.h
+++ b/llvm/include/llvm/Transforms/Scalar/FlattenCFG.h
@@ -15,10 +15,11 @@
 #define LLVM_TRANSFORMS_SCALAR_FLATTENCFG_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 struct FlattenCFGPass : PassInfoMixin<FlattenCFGPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Scalar/Float2Int.h b/llvm/include/llvm/Transforms/Scalar/Float2Int.h
index 337e229efcf37..5a490738fc217 100644
--- a/llvm/include/llvm/Transforms/Scalar/Float2Int.h
+++ b/llvm/include/llvm/Transforms/Scalar/Float2Int.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/SetVector.h"
 #include "llvm/IR/ConstantRange.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class DominatorTree;
@@ -30,10 +31,10 @@ class Value;
 
 class Float2IntPass : public PassInfoMixin<Float2IntPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   // Glue for old PM.
-  bool runImpl(Function &F, const DominatorTree &DT);
+  LLVM_ABI bool runImpl(Function &F, const DominatorTree &DT);
 
 private:
   void findRoots(Function &F, const DominatorTree &DT);
diff --git a/llvm/include/llvm/Transforms/Scalar/GVNExpression.h b/llvm/include/llvm/Transforms/Scalar/GVNExpression.h
index 1629aacbae45c..95d5de0d56911 100644
--- a/llvm/include/llvm/Transforms/Scalar/GVNExpression.h
+++ b/llvm/include/llvm/Transforms/Scalar/GVNExpression.h
@@ -57,7 +57,7 @@ enum ExpressionType {
   ET_BasicEnd
 };
 
-class Expression {
+class LLVM_ABI Expression {
 private:
   ExpressionType EType;
   unsigned Opcode;
@@ -133,7 +133,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const Expression &E) {
   return OS;
 }
 
-class BasicExpression : public Expression {
+class LLVM_ABI BasicExpression : public Expression {
 private:
   using RecyclerType = ArrayRecycler<Value *>;
   using RecyclerCapacity = RecyclerType::Capacity;
@@ -298,7 +298,7 @@ class MemoryExpression : public BasicExpression {
   void setMemoryLeader(const MemoryAccess *ML) { MemoryLeader = ML; }
 };
 
-class CallExpression final : public MemoryExpression {
+class LLVM_ABI CallExpression final : public MemoryExpression {
 private:
   CallInst *Call;
 
@@ -331,7 +331,7 @@ class CallExpression final : public MemoryExpression {
   }
 };
 
-class LoadExpression final : public MemoryExpression {
+class LLVM_ABI LoadExpression final : public MemoryExpression {
 private:
   LoadInst *Load;
 
@@ -373,7 +373,7 @@ class LoadExpression final : public MemoryExpression {
   }
 };
 
-class StoreExpression final : public MemoryExpression {
+class LLVM_ABI StoreExpression final : public MemoryExpression {
 private:
   StoreInst *Store;
   Value *StoredValue;
@@ -414,7 +414,7 @@ class StoreExpression final : public MemoryExpression {
   }
 };
 
-class AggregateValueExpression final : public BasicExpression {
+class LLVM_ABI AggregateValueExpression final : public BasicExpression {
 private:
   unsigned MaxIntOperands;
   unsigned NumIntOperands = 0;
@@ -508,7 +508,7 @@ class int_op_inserter {
   int_op_inserter &operator++(int) { return *this; }
 };
 
-class PHIExpression final : public BasicExpression {
+class LLVM_ABI PHIExpression final : public BasicExpression {
 private:
   BasicBlock *BB;
 
diff --git a/llvm/include/llvm/Transforms/Scalar/GuardWidening.h b/llvm/include/llvm/Transforms/Scalar/GuardWidening.h
index fa03d5f678fd4..931eabbf62f8c 100644
--- a/llvm/include/llvm/Transforms/Scalar/GuardWidening.h
+++ b/llvm/include/llvm/Transforms/Scalar/GuardWidening.h
@@ -17,6 +17,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,9 +26,10 @@ class Loop;
 class Function;
 
 struct GuardWideningPass : public PassInfoMixin<GuardWideningPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Scalar/IVUsersPrinter.h b/llvm/include/llvm/Transforms/Scalar/IVUsersPrinter.h
index 6bc01ececcf33..0a8195af55797 100644
--- a/llvm/include/llvm/Transforms/Scalar/IVUsersPrinter.h
+++ b/llvm/include/llvm/Transforms/Scalar/IVUsersPrinter.h
@@ -11,6 +11,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class LPMUpdater;
@@ -23,8 +24,9 @@ class IVUsersPrinterPass : public PassInfoMixin<IVUsersPrinterPass> {
 
 public:
   explicit IVUsersPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
   static bool isRequired() { return true; }
 };
 }
diff --git a/llvm/include/llvm/Transforms/Scalar/IndVarSimplify.h b/llvm/include/llvm/Transforms/Scalar/IndVarSimplify.h
index b5d544f1149c6..897ec6bb9783f 100644
--- a/llvm/include/llvm/Transforms/Scalar/IndVarSimplify.h
+++ b/llvm/include/llvm/Transforms/Scalar/IndVarSimplify.h
@@ -16,6 +16,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -28,8 +29,9 @@ class IndVarSimplifyPass : public PassInfoMixin<IndVarSimplifyPass> {
 
 public:
   IndVarSimplifyPass(bool WidenIndVars = true) : WidenIndVars(WidenIndVars) {}
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/InductiveRangeCheckElimination.h b/llvm/include/llvm/Transforms/Scalar/InductiveRangeCheckElimination.h
index 11fb80e494867..ca2231a479fef 100644
--- a/llvm/include/llvm/Transforms/Scalar/InductiveRangeCheckElimination.h
+++ b/llvm/include/llvm/Transforms/Scalar/InductiveRangeCheckElimination.h
@@ -15,12 +15,13 @@
 #define LLVM_TRANSFORMS_SCALAR_INDUCTIVERANGECHECKELIMINATION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class IRCEPass : public PassInfoMixin<IRCEPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/InferAddressSpaces.h b/llvm/include/llvm/Transforms/Scalar/InferAddressSpaces.h
index 9a56b073f1c6b..29ab6e3b4d4f2 100644
--- a/llvm/include/llvm/Transforms/Scalar/InferAddressSpaces.h
+++ b/llvm/include/llvm/Transforms/Scalar/InferAddressSpaces.h
@@ -10,13 +10,14 @@
 #define LLVM_TRANSFORMS_SCALAR_INFERADDRESSSPACES_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 struct InferAddressSpacesPass : PassInfoMixin<InferAddressSpacesPass> {
-  InferAddressSpacesPass();
-  InferAddressSpacesPass(unsigned AddressSpace);
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI InferAddressSpacesPass();
+  LLVM_ABI InferAddressSpacesPass(unsigned AddressSpace);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
 private:
   unsigned FlatAddrSpace = 0;
diff --git a/llvm/include/llvm/Transforms/Scalar/InferAlignment.h b/llvm/include/llvm/Transforms/Scalar/InferAlignment.h
index f6fc5f3b8d987..6aac501557faf 100644
--- a/llvm/include/llvm/Transforms/Scalar/InferAlignment.h
+++ b/llvm/include/llvm/Transforms/Scalar/InferAlignment.h
@@ -15,11 +15,12 @@
 #define LLVM_TRANSFORMS_SCALAR_INFERALIGNMENT_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 struct InferAlignmentPass : public PassInfoMixin<InferAlignmentPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/InstSimplifyPass.h b/llvm/include/llvm/Transforms/Scalar/InstSimplifyPass.h
index 09a4a95401d84..c22ffa328c86a 100644
--- a/llvm/include/llvm/Transforms/Scalar/InstSimplifyPass.h
+++ b/llvm/include/llvm/Transforms/Scalar/InstSimplifyPass.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_SCALAR_INSTSIMPLIFYPASS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -31,7 +32,7 @@ namespace llvm {
 /// `instcombine` pass instead.
 class InstSimplifyPass : public PassInfoMixin<InstSimplifyPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/JumpTableToSwitch.h b/llvm/include/llvm/Transforms/Scalar/JumpTableToSwitch.h
index dfd6e2f3d03ae..1c15274242665 100644
--- a/llvm/include/llvm/Transforms/Scalar/JumpTableToSwitch.h
+++ b/llvm/include/llvm/Transforms/Scalar/JumpTableToSwitch.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_SCALAR_JUMP_TABLE_TO_SWITCH_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,7 +23,7 @@ class JumpTableToSwitchPass : public PassInfoMixin<JumpTableToSwitchPass> {
 public:
   explicit JumpTableToSwitchPass(bool InLTO = false) : InLTO(InLTO) {}
   /// Run the pass over the function.
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Scalar/LICM.h b/llvm/include/llvm/Transforms/Scalar/LICM.h
index f7dd40be47e58..3bdfc18dd9aaa 100644
--- a/llvm/include/llvm/Transforms/Scalar/LICM.h
+++ b/llvm/include/llvm/Transforms/Scalar/LICM.h
@@ -35,6 +35,7 @@
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -42,8 +43,8 @@ class LPMUpdater;
 class Loop;
 class LoopNest;
 
-extern cl::opt<unsigned> SetLicmMssaOptCap;
-extern cl::opt<unsigned> SetLicmMssaNoAccForPromotionCap;
+extern LLVM_ABI cl::opt<unsigned> SetLicmMssaOptCap;
+extern LLVM_ABI cl::opt<unsigned> SetLicmMssaNoAccForPromotionCap;
 
 struct LICMOptions {
   unsigned MssaOptCap;
@@ -73,11 +74,13 @@ class LICMPass : public PassInfoMixin<LICMPass> {
                              AllowSpeculation)) {}
   LICMPass(LICMOptions Opts) : Opts(Opts) {}
 
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 /// Performs LoopNest Invariant Code Motion Pass.
@@ -91,11 +94,13 @@ class LNICMPass : public PassInfoMixin<LNICMPass> {
                               AllowSpeculation)) {}
   LNICMPass(LICMOptions Opts) : Opts(Opts) {}
 
-  PreservedAnalyses run(LoopNest &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(LoopNest &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h b/llvm/include/llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h
index 44ba3c24f6afb..21c3130dd0f79 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_SCALAR_LOOPACCESSANALYSISPRINTER_H
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,7 +26,7 @@ class LoopAccessInfoPrinterPass
 public:
   explicit LoopAccessInfoPrinterPass(raw_ostream &OS, bool AllowPartial)
       : OS(OS), AllowPartial(AllowPartial) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopBoundSplit.h b/llvm/include/llvm/Transforms/Scalar/LoopBoundSplit.h
index 0c597bf295b2e..5fb79b2d2ede7 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopBoundSplit.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopBoundSplit.h
@@ -11,6 +11,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class LPMUpdater;
@@ -33,8 +34,9 @@ class Loop;
 ///                              }
 class LoopBoundSplitPass : public PassInfoMixin<LoopBoundSplitPass> {
 public:
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopDataPrefetch.h b/llvm/include/llvm/Transforms/Scalar/LoopDataPrefetch.h
index d5e15ffff0750..6994c8337af73 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopDataPrefetch.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopDataPrefetch.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_SCALAR_LOOPDATAPREFETCH_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,7 +26,7 @@ class LoopDataPrefetchPass : public PassInfoMixin<LoopDataPrefetchPass> {
   LoopDataPrefetchPass() = default;
 
   /// Run the pass over the function.
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopDeletion.h b/llvm/include/llvm/Transforms/Scalar/LoopDeletion.h
index 459a5cd3ece48..5f44c4b3f58d0 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopDeletion.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopDeletion.h
@@ -15,6 +15,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,8 +26,9 @@ class LoopDeletionPass : public PassInfoMixin<LoopDeletionPass> {
 public:
   LoopDeletionPass() = default;
 
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopDistribute.h b/llvm/include/llvm/Transforms/Scalar/LoopDistribute.h
index 1a82176490c50..9ce7087acdb79 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopDistribute.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopDistribute.h
@@ -17,6 +17,7 @@
 #define LLVM_TRANSFORMS_SCALAR_LOOPDISTRIBUTE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -24,7 +25,7 @@ class Function;
 
 class LoopDistributePass : public PassInfoMixin<LoopDistributePass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopFlatten.h b/llvm/include/llvm/Transforms/Scalar/LoopFlatten.h
index 311b843e83b51..4f482c4043c6b 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopFlatten.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopFlatten.h
@@ -15,6 +15,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class LPMUpdater;
@@ -24,8 +25,9 @@ class LoopFlattenPass : public PassInfoMixin<LoopFlattenPass> {
 public:
   LoopFlattenPass() = default;
 
-  PreservedAnalyses run(LoopNest &LN, LoopAnalysisManager &LAM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(LoopNest &LN, LoopAnalysisManager &LAM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopFuse.h b/llvm/include/llvm/Transforms/Scalar/LoopFuse.h
index d3a02db6bd28d..138df41403a36 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopFuse.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopFuse.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_SCALAR_LOOPFUSE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,7 +23,7 @@ class Function;
 
 class LoopFusePass : public PassInfoMixin<LoopFusePass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopIdiomRecognize.h b/llvm/include/llvm/Transforms/Scalar/LoopIdiomRecognize.h
index 109b4520878cb..a176ad0e0f7f5 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopIdiomRecognize.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopIdiomRecognize.h
@@ -17,6 +17,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,29 +28,30 @@ class LPMUpdater;
 /// passes.
 struct DisableLIRP {
   /// When true, the entire pass is disabled.
-  static bool All;
+  LLVM_ABI static bool All;
 
   /// When true, Memset is disabled.
-  static bool Memset;
+  LLVM_ABI static bool Memset;
 
   /// When true, Memcpy is disabled.
-  static bool Memcpy;
+  LLVM_ABI static bool Memcpy;
 
   /// When true, Strlen is disabled.
-  static bool Strlen;
+  LLVM_ABI static bool Strlen;
 
   /// When true, Wcslen is disabled.
-  static bool Wcslen;
+  LLVM_ABI static bool Wcslen;
 
   /// When true, HashRecognize is disabled.
-  static bool HashRecognize;
+  LLVM_ABI static bool HashRecognize;
 };
 
 /// Performs Loop Idiom Recognize Pass.
 class LoopIdiomRecognizePass : public PassInfoMixin<LoopIdiomRecognizePass> {
 public:
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopInstSimplify.h b/llvm/include/llvm/Transforms/Scalar/LoopInstSimplify.h
index f6e86d11ed956..cef6834224f40 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopInstSimplify.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopInstSimplify.h
@@ -15,6 +15,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -24,8 +25,9 @@ class LPMUpdater;
 /// Performs Loop Inst Simplify Pass.
 class LoopInstSimplifyPass : public PassInfoMixin<LoopInstSimplifyPass> {
 public:
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopInterchange.h b/llvm/include/llvm/Transforms/Scalar/LoopInterchange.h
index 8fa14d747f5c0..fcd49675e269f 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopInterchange.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopInterchange.h
@@ -11,6 +11,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -18,8 +19,9 @@ class LPMUpdater;
 class LoopNest;
 
 struct LoopInterchangePass : public PassInfoMixin<LoopInterchangePass> {
-  PreservedAnalyses run(LoopNest &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(LoopNest &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopLoadElimination.h b/llvm/include/llvm/Transforms/Scalar/LoopLoadElimination.h
index 65b9aabb8f518..db946e80e98ea 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopLoadElimination.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopLoadElimination.h
@@ -17,6 +17,7 @@
 #define LLVM_TRANSFORMS_SCALAR_LOOPLOADELIMINATION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,7 +26,7 @@ class Function;
 /// Pass to forward loads in a loop around the backedge to subsequent
 /// iterations.
 struct LoopLoadEliminationPass : public PassInfoMixin<LoopLoadEliminationPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopPredication.h b/llvm/include/llvm/Transforms/Scalar/LoopPredication.h
index 83f5336034192..15805ffea71bb 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopPredication.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopPredication.h
@@ -16,6 +16,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -24,8 +25,9 @@ class Loop;
 /// Performs Loop Predication Pass.
 class LoopPredicationPass : public PassInfoMixin<LoopPredicationPass> {
 public:
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopRotation.h b/llvm/include/llvm/Transforms/Scalar/LoopRotation.h
index cd108f7383e4c..4edcdc20ce910 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopRotation.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopRotation.h
@@ -15,6 +15,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class LPMUpdater;
@@ -23,13 +24,15 @@ class Loop;
 /// A simple loop rotation transformation.
 class LoopRotatePass : public PassInfoMixin<LoopRotatePass> {
 public:
-  LoopRotatePass(bool EnableHeaderDuplication = true,
-                 bool PrepareForLTO = false);
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI LoopRotatePass(bool EnableHeaderDuplication = true,
+                          bool PrepareForLTO = false);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 
 private:
   const bool EnableHeaderDuplication;
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopSimplifyCFG.h b/llvm/include/llvm/Transforms/Scalar/LoopSimplifyCFG.h
index 82c8a4406d00a..25bd06ad34155 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopSimplifyCFG.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopSimplifyCFG.h
@@ -18,6 +18,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,8 +28,9 @@ class Loop;
 /// Performs basic CFG simplifications to assist other loop passes.
 class LoopSimplifyCFGPass : public PassInfoMixin<LoopSimplifyCFGPass> {
 public:
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopSink.h b/llvm/include/llvm/Transforms/Scalar/LoopSink.h
index 26e50590a6257..1a2f2e1fd1620 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopSink.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopSink.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_SCALAR_LOOPSINK_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -32,7 +33,7 @@ class Function;
 /// fundamental analyses and transforms of the loop.
 class LoopSinkPass : public PassInfoMixin<LoopSinkPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopStrengthReduce.h b/llvm/include/llvm/Transforms/Scalar/LoopStrengthReduce.h
index 5cf805bc49393..091432d8194f7 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopStrengthReduce.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopStrengthReduce.h
@@ -23,6 +23,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -32,8 +33,9 @@ class LPMUpdater;
 /// Performs Loop Strength Reduce Pass.
 class LoopStrengthReducePass : public PassInfoMixin<LoopStrengthReducePass> {
 public:
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopTermFold.h b/llvm/include/llvm/Transforms/Scalar/LoopTermFold.h
index 974024c586aa8..6f6fd5605d6ac 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopTermFold.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopTermFold.h
@@ -13,6 +13,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -21,8 +22,9 @@ class LPMUpdater;
 
 class LoopTermFoldPass : public PassInfoMixin<LoopTermFoldPass> {
 public:
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopUnrollAndJamPass.h b/llvm/include/llvm/Transforms/Scalar/LoopUnrollAndJamPass.h
index 54f70d7ed4b39..ee32b7a659ebb 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopUnrollAndJamPass.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopUnrollAndJamPass.h
@@ -11,6 +11,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class LPMUpdater;
@@ -22,8 +23,9 @@ class LoopUnrollAndJamPass : public PassInfoMixin<LoopUnrollAndJamPass> {
 
 public:
   explicit LoopUnrollAndJamPass(int OptLevel = 2) : OptLevel(OptLevel) {}
-  PreservedAnalyses run(LoopNest &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(LoopNest &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopUnrollPass.h b/llvm/include/llvm/Transforms/Scalar/LoopUnrollPass.h
index 8d8c2f254f02f..305eb547e3a99 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopUnrollPass.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopUnrollPass.h
@@ -12,11 +12,12 @@
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
 
-extern cl::opt<bool> ForgetSCEVInLoopUnroll;
+extern LLVM_ABI cl::opt<bool> ForgetSCEVInLoopUnroll;
 
 class Function;
 class Loop;
@@ -42,8 +43,9 @@ class LoopFullUnrollPass : public PassInfoMixin<LoopFullUnrollPass> {
       : OptLevel(OptLevel), OnlyWhenForced(OnlyWhenForced),
         ForgetSCEV(ForgetSCEV) {}
 
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 /// A set of parameters used to control various transforms performed by the
@@ -139,9 +141,10 @@ class LoopUnrollPass : public PassInfoMixin<LoopUnrollPass> {
   explicit LoopUnrollPass(LoopUnrollOptions UnrollOpts = {})
       : UnrollOpts(UnrollOpts) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopVersioningLICM.h b/llvm/include/llvm/Transforms/Scalar/LoopVersioningLICM.h
index 04e0012330da7..b9b4483973b35 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopVersioningLICM.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopVersioningLICM.h
@@ -11,6 +11,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class LPMUpdater;
@@ -18,8 +19,9 @@ class Loop;
 
 class LoopVersioningLICMPass : public PassInfoMixin<LoopVersioningLICMPass> {
 public:
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &LAR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &LAR,
+                                 LPMUpdater &U);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LowerAtomicPass.h b/llvm/include/llvm/Transforms/Scalar/LowerAtomicPass.h
index 60bbf916fced4..1e85a053d295a 100644
--- a/llvm/include/llvm/Transforms/Scalar/LowerAtomicPass.h
+++ b/llvm/include/llvm/Transforms/Scalar/LowerAtomicPass.h
@@ -15,13 +15,14 @@
 #define LLVM_TRANSFORMS_SCALAR_LOWERATOMICPASS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 /// A pass that lowers atomic intrinsic into non-atomic intrinsics.
 class LowerAtomicPass : public PassInfoMixin<LowerAtomicPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/Transforms/Scalar/LowerConstantIntrinsics.h b/llvm/include/llvm/Transforms/Scalar/LowerConstantIntrinsics.h
index 3d4d1034c0b24..fe67cc00d3dfc 100644
--- a/llvm/include/llvm/Transforms/Scalar/LowerConstantIntrinsics.h
+++ b/llvm/include/llvm/Transforms/Scalar/LowerConstantIntrinsics.h
@@ -16,6 +16,7 @@
 #define LLVM_TRANSFORMS_SCALAR_LOWERCONSTANTINTRINSICS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -23,8 +24,8 @@ class DominatorTree;
 class Function;
 class TargetLibraryInfo;
 
-bool lowerConstantIntrinsics(Function &F, const TargetLibraryInfo &TLI,
-                             DominatorTree *DT);
+LLVM_ABI bool lowerConstantIntrinsics(Function &F, const TargetLibraryInfo &TLI,
+                                      DominatorTree *DT);
 
 struct LowerConstantIntrinsicsPass :
     PassInfoMixin<LowerConstantIntrinsicsPass> {
@@ -39,7 +40,7 @@ struct LowerConstantIntrinsicsPass :
   /// propagated and conditional branches are resolved where possible.
   /// This complements the Instruction Simplification and
   /// Instruction Combination passes of the optimized pass chain.
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };
 
 }
diff --git a/llvm/include/llvm/Transforms/Scalar/LowerGuardIntrinsic.h b/llvm/include/llvm/Transforms/Scalar/LowerGuardIntrinsic.h
index 0c885b957b0fb..abaa2bb9bccba 100644
--- a/llvm/include/llvm/Transforms/Scalar/LowerGuardIntrinsic.h
+++ b/llvm/include/llvm/Transforms/Scalar/LowerGuardIntrinsic.h
@@ -15,11 +15,12 @@
 #define LLVM_TRANSFORMS_SCALAR_LOWERGUARDINTRINSIC_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 struct LowerGuardIntrinsicPass : PassInfoMixin<LowerGuardIntrinsicPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 }
diff --git a/llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h b/llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
index d44d297dd4ffc..4cc31658359ab 100644
--- a/llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
+++ b/llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_SCALAR_LOWERMATRIXINTRINSICS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class LowerMatrixIntrinsicsPass
@@ -22,9 +23,10 @@ class LowerMatrixIntrinsicsPass
 
 public:
   LowerMatrixIntrinsicsPass(bool Minimal = false) : Minimal(Minimal) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
   static bool isRequired() { return true; }
 };
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/LowerWidenableCondition.h b/llvm/include/llvm/Transforms/Scalar/LowerWidenableCondition.h
index 81c6f00e27fdf..4a3611972c163 100644
--- a/llvm/include/llvm/Transforms/Scalar/LowerWidenableCondition.h
+++ b/llvm/include/llvm/Transforms/Scalar/LowerWidenableCondition.h
@@ -14,11 +14,12 @@
 #define LLVM_TRANSFORMS_SCALAR_LOWERWIDENABLECONDITION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 struct LowerWidenableConditionPass : PassInfoMixin<LowerWidenableConditionPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 }
diff --git a/llvm/include/llvm/Transforms/Scalar/MakeGuardsExplicit.h b/llvm/include/llvm/Transforms/Scalar/MakeGuardsExplicit.h
index a20b31f3ab5e8..df829c87a2995 100644
--- a/llvm/include/llvm/Transforms/Scalar/MakeGuardsExplicit.h
+++ b/llvm/include/llvm/Transforms/Scalar/MakeGuardsExplicit.h
@@ -34,11 +34,12 @@
 #define LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 struct MakeGuardsExplicitPass : public PassInfoMixin<MakeGuardsExplicitPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/MergeICmps.h b/llvm/include/llvm/Transforms/Scalar/MergeICmps.h
index 63bdbf8f4d095..968e9d727a732 100644
--- a/llvm/include/llvm/Transforms/Scalar/MergeICmps.h
+++ b/llvm/include/llvm/Transforms/Scalar/MergeICmps.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_SCALAR_MERGEICMPS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -17,7 +18,7 @@ class Function;
 
 struct MergeICmpsPass
     : PassInfoMixin<MergeICmpsPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/MergedLoadStoreMotion.h b/llvm/include/llvm/Transforms/Scalar/MergedLoadStoreMotion.h
index 71e11e59a4712..5808277ae3c65 100644
--- a/llvm/include/llvm/Transforms/Scalar/MergedLoadStoreMotion.h
+++ b/llvm/include/llvm/Transforms/Scalar/MergedLoadStoreMotion.h
@@ -25,6 +25,7 @@
 
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Function;
@@ -48,9 +49,10 @@ class MergedLoadStoreMotionPass
       : MergedLoadStoreMotionPass(MergedLoadStoreMotionOptions()) {}
   MergedLoadStoreMotionPass(const MergedLoadStoreMotionOptions &PassOptions)
       : Options(PassOptions) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Scalar/NaryReassociate.h b/llvm/include/llvm/Transforms/Scalar/NaryReassociate.h
index f0474bc4352e3..b0c288c3f1a34 100644
--- a/llvm/include/llvm/Transforms/Scalar/NaryReassociate.h
+++ b/llvm/include/llvm/Transforms/Scalar/NaryReassociate.h
@@ -82,6 +82,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -101,12 +102,12 @@ class Value;
 
 class NaryReassociatePass : public PassInfoMixin<NaryReassociatePass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   // Glue for old PM.
-  bool runImpl(Function &F, AssumptionCache *AC_, DominatorTree *DT_,
-               ScalarEvolution *SE_, TargetLibraryInfo *TLI_,
-               TargetTransformInfo *TTI_);
+  LLVM_ABI bool runImpl(Function &F, AssumptionCache *AC_, DominatorTree *DT_,
+                        ScalarEvolution *SE_, TargetLibraryInfo *TLI_,
+                        TargetTransformInfo *TTI_);
 
 private:
   // Runs only one iteration of the dominator-based algorithm. See the header
diff --git a/llvm/include/llvm/Transforms/Scalar/NewGVN.h b/llvm/include/llvm/Transforms/Scalar/NewGVN.h
index 1f3680fec79cf..0f6f6552bef2b 100644
--- a/llvm/include/llvm/Transforms/Scalar/NewGVN.h
+++ b/llvm/include/llvm/Transforms/Scalar/NewGVN.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_SCALAR_NEWGVN_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -23,7 +24,7 @@ class Function;
 class NewGVNPass : public PassInfoMixin<NewGVNPass> {
 public:
   /// Run the pass over the function.
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/PartiallyInlineLibCalls.h b/llvm/include/llvm/Transforms/Scalar/PartiallyInlineLibCalls.h
index b8a8fcc71e57c..f839850092b48 100644
--- a/llvm/include/llvm/Transforms/Scalar/PartiallyInlineLibCalls.h
+++ b/llvm/include/llvm/Transforms/Scalar/PartiallyInlineLibCalls.h
@@ -16,13 +16,14 @@
 #define LLVM_TRANSFORMS_SCALAR_PARTIALLYINLINELIBCALLS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Function;
 class PartiallyInlineLibCallsPass
     : public PassInfoMixin<PartiallyInlineLibCallsPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Scalar/PlaceSafepoints.h b/llvm/include/llvm/Transforms/Scalar/PlaceSafepoints.h
index 60ffe6e58b11b..f145928a15504 100644
--- a/llvm/include/llvm/Transforms/Scalar/PlaceSafepoints.h
+++ b/llvm/include/llvm/Transforms/Scalar/PlaceSafepoints.h
@@ -51,6 +51,7 @@
 #define LLVM_TRANSFORMS_SCALAR_PLACESAFEPOINTS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -58,9 +59,9 @@ class TargetLibraryInfo;
 
 class PlaceSafepointsPass : public PassInfoMixin<PlaceSafepointsPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
-  bool runImpl(Function &F, const TargetLibraryInfo &TLI);
+  LLVM_ABI bool runImpl(Function &F, const TargetLibraryInfo &TLI);
 
   void cleanup() {}
 
diff --git a/llvm/include/llvm/Transforms/Scalar/Reg2Mem.h b/llvm/include/llvm/Transforms/Scalar/Reg2Mem.h
index 25f6563d7dcfc..eae20d0ce194c 100644
--- a/llvm/include/llvm/Transforms/Scalar/Reg2Mem.h
+++ b/llvm/include/llvm/Transforms/Scalar/Reg2Mem.h
@@ -14,12 +14,13 @@
 #define LLVM_TRANSFORMS_SCALAR_REG2MEM_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class RegToMemPass : public PassInfoMixin<RegToMemPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/RewriteStatepointsForGC.h b/llvm/include/llvm/Transforms/Scalar/RewriteStatepointsForGC.h
index 29845ce3b62da..f73f9860df122 100644
--- a/llvm/include/llvm/Transforms/Scalar/RewriteStatepointsForGC.h
+++ b/llvm/include/llvm/Transforms/Scalar/RewriteStatepointsForGC.h
@@ -17,6 +17,7 @@
 #define LLVM_TRANSFORMS_SCALAR_REWRITESTATEPOINTSFORGC_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,10 +28,10 @@ class TargetTransformInfo;
 class TargetLibraryInfo;
 
 struct RewriteStatepointsForGC : public PassInfoMixin<RewriteStatepointsForGC> {
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
-  bool runOnFunction(Function &F, DominatorTree &, TargetTransformInfo &,
-                     const TargetLibraryInfo &);
+  LLVM_ABI bool runOnFunction(Function &F, DominatorTree &,
+                              TargetTransformInfo &, const TargetLibraryInfo &);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/SROA.h b/llvm/include/llvm/Transforms/Scalar/SROA.h
index 8bb65bf7225e0..9ef92f63d1720 100644
--- a/llvm/include/llvm/Transforms/Scalar/SROA.h
+++ b/llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -16,6 +16,7 @@
 #define LLVM_TRANSFORMS_SCALAR_SROA_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -29,13 +30,14 @@ class SROAPass : public PassInfoMixin<SROAPass> {
 public:
   /// If \p PreserveCFG is set, then the pass is not allowed to modify CFG
   /// in any way, even if it would update CFG analyses.
-  SROAPass(SROAOptions PreserveCFG);
+  LLVM_ABI SROAPass(SROAOptions PreserveCFG);
 
   /// Run the pass over the function.
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/ScalarizeMaskedMemIntrin.h b/llvm/include/llvm/Transforms/Scalar/ScalarizeMaskedMemIntrin.h
index 5e876fc82ac17..7944e2be1580d 100644
--- a/llvm/include/llvm/Transforms/Scalar/ScalarizeMaskedMemIntrin.h
+++ b/llvm/include/llvm/Transforms/Scalar/ScalarizeMaskedMemIntrin.h
@@ -17,12 +17,13 @@
 #define LLVM_TRANSFORMS_SCALAR_SCALARIZEMASKEDMEMINTRIN_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 struct ScalarizeMaskedMemIntrinPass
     : public PassInfoMixin<ScalarizeMaskedMemIntrinPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Scalar/SeparateConstOffsetFromGEP.h b/llvm/include/llvm/Transforms/Scalar/SeparateConstOffsetFromGEP.h
index 7b37eb7118a04..a1dd20fc2d58b 100644
--- a/llvm/include/llvm/Transforms/Scalar/SeparateConstOffsetFromGEP.h
+++ b/llvm/include/llvm/Transforms/Scalar/SeparateConstOffsetFromGEP.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_SCALAR_SEPARATECONSTOFFSETFROMGEP_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -19,9 +20,10 @@ class SeparateConstOffsetFromGEPPass
 
 public:
   SeparateConstOffsetFromGEPPass(bool LowerGEP = false) : LowerGEP(LowerGEP) {}
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/SimpleLoopUnswitch.h b/llvm/include/llvm/Transforms/Scalar/SimpleLoopUnswitch.h
index 0cc49e4755257..067f2c7fcd476 100644
--- a/llvm/include/llvm/Transforms/Scalar/SimpleLoopUnswitch.h
+++ b/llvm/include/llvm/Transforms/Scalar/SimpleLoopUnswitch.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Scalar/LoopPassManager.h"
 #include "llvm/Transforms/Utils/ExtraPassManager.h"
 
@@ -73,11 +74,13 @@ class SimpleLoopUnswitchPass : public PassInfoMixin<SimpleLoopUnswitchPass> {
   SimpleLoopUnswitchPass(bool NonTrivial = false, bool Trivial = true)
       : NonTrivial(NonTrivial), Trivial(Trivial) {}
 
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 /// A marker analysis to determine if SimpleLoopUnswitch should run again on a
@@ -85,7 +88,7 @@ class SimpleLoopUnswitchPass : public PassInfoMixin<SimpleLoopUnswitchPass> {
 struct ShouldRunExtraSimpleLoopUnswitch
     : public ShouldRunExtraPasses<ShouldRunExtraSimpleLoopUnswitch>,
       public AnalysisInfoMixin<ShouldRunExtraSimpleLoopUnswitch> {
-  static AnalysisKey Key;
+  LLVM_ABI static AnalysisKey Key;
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/Sink.h b/llvm/include/llvm/Transforms/Scalar/Sink.h
index 759153f22853d..daf84194706e3 100644
--- a/llvm/include/llvm/Transforms/Scalar/Sink.h
+++ b/llvm/include/llvm/Transforms/Scalar/Sink.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_SCALAR_SINK_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -23,7 +24,7 @@ class Function;
 /// Move instructions into successor blocks when possible.
 class SinkingPass : public PassInfoMixin<SinkingPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Scalar/SpeculativeExecution.h b/llvm/include/llvm/Transforms/Scalar/SpeculativeExecution.h
index 168e0c3bb9521..c3eab4a2fddbe 100644
--- a/llvm/include/llvm/Transforms/Scalar/SpeculativeExecution.h
+++ b/llvm/include/llvm/Transforms/Scalar/SpeculativeExecution.h
@@ -63,6 +63,7 @@
 #define LLVM_TRANSFORMS_SCALAR_SPECULATIVEEXECUTION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class BasicBlock;
@@ -71,15 +72,16 @@ class TargetTransformInfo;
 class SpeculativeExecutionPass
     : public PassInfoMixin<SpeculativeExecutionPass> {
 public:
-  SpeculativeExecutionPass(bool OnlyIfDivergentTarget = false);
+  LLVM_ABI SpeculativeExecutionPass(bool OnlyIfDivergentTarget = false);
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 
   // Glue for old PM
-  bool runImpl(Function &F, TargetTransformInfo *TTI);
+  LLVM_ABI bool runImpl(Function &F, TargetTransformInfo *TTI);
 
 private:
   bool runOnBasicBlock(BasicBlock &B);
diff --git a/llvm/include/llvm/Transforms/Scalar/StraightLineStrengthReduce.h b/llvm/include/llvm/Transforms/Scalar/StraightLineStrengthReduce.h
index 11233cc65efac..0cfba50c3a676 100644
--- a/llvm/include/llvm/Transforms/Scalar/StraightLineStrengthReduce.h
+++ b/llvm/include/llvm/Transforms/Scalar/StraightLineStrengthReduce.h
@@ -10,13 +10,14 @@
 #define LLVM_TRANSFORMS_SCALAR_STRAIGHTLINESTRENGTHREDUCE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class StraightLineStrengthReducePass
     : public PassInfoMixin<StraightLineStrengthReducePass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/StructurizeCFG.h b/llvm/include/llvm/Transforms/Scalar/StructurizeCFG.h
index f68067d935458..cacadfc0dec15 100644
--- a/llvm/include/llvm/Transforms/Scalar/StructurizeCFG.h
+++ b/llvm/include/llvm/Transforms/Scalar/StructurizeCFG.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_SCALAR_STRUCTURIZECFG_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 struct StructurizeCFGPass : PassInfoMixin<StructurizeCFGPass> {
@@ -17,12 +18,13 @@ struct StructurizeCFGPass : PassInfoMixin<StructurizeCFGPass> {
   bool SkipUniformRegions;
 
 public:
-  StructurizeCFGPass(bool SkipUniformRegions = false);
+  LLVM_ABI StructurizeCFGPass(bool SkipUniformRegions = false);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Scalar/TailRecursionElimination.h b/llvm/include/llvm/Transforms/Scalar/TailRecursionElimination.h
index 22a70cd66865a..29162ddcfeb59 100644
--- a/llvm/include/llvm/Transforms/Scalar/TailRecursionElimination.h
+++ b/llvm/include/llvm/Transforms/Scalar/TailRecursionElimination.h
@@ -53,6 +53,7 @@
 #define LLVM_TRANSFORMS_SCALAR_TAILRECURSIONELIMINATION_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -64,7 +65,7 @@ class TailCallElimPass : public PassInfoMixin<TailCallElimPass> {
 public:
   TailCallElimPass(bool UpdateFunctionEntryCount = true)
       : UpdateFunctionEntryCount(UpdateFunctionEntryCount) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h b/llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h
index 8f8cad0aab6de..5c25e6f06bdfe 100644
--- a/llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h
+++ b/llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_SCALAR_WARNMISSEDTRANSFORMS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 // New pass manager boilerplate.
@@ -22,7 +23,7 @@ class WarnMissedTransformationsPass
 public:
   explicit WarnMissedTransformationsPass() = default;
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/AddDiscriminators.h b/llvm/include/llvm/Transforms/Utils/AddDiscriminators.h
index 0aee2fe95cad3..ee5b61615044c 100644
--- a/llvm/include/llvm/Transforms/Utils/AddDiscriminators.h
+++ b/llvm/include/llvm/Transforms/Utils/AddDiscriminators.h
@@ -16,6 +16,7 @@
 #define LLVM_TRANSFORMS_UTILS_ADDDISCRIMINATORS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -23,7 +24,7 @@ class Function;
 
 class AddDiscriminatorsPass : public PassInfoMixin<AddDiscriminatorsPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
 };
 
diff --git a/llvm/include/llvm/Transforms/Utils/BreakCriticalEdges.h b/llvm/include/llvm/Transforms/Utils/BreakCriticalEdges.h
index 6de080ce31281..8c3bc695ead78 100644
--- a/llvm/include/llvm/Transforms/Utils/BreakCriticalEdges.h
+++ b/llvm/include/llvm/Transforms/Utils/BreakCriticalEdges.h
@@ -18,12 +18,13 @@
 #define LLVM_TRANSFORMS_UTILS_BREAKCRITICALEDGES_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class Function;
 struct BreakCriticalEdgesPass : public PassInfoMixin<BreakCriticalEdgesPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // namespace llvm
 #endif // LLVM_TRANSFORMS_UTILS_BREAKCRITICALEDGES_H
diff --git a/llvm/include/llvm/Transforms/Utils/BypassSlowDivision.h b/llvm/include/llvm/Transforms/Utils/BypassSlowDivision.h
index bd98c902d1ab4..40188f63726de 100644
--- a/llvm/include/llvm/Transforms/Utils/BypassSlowDivision.h
+++ b/llvm/include/llvm/Transforms/Utils/BypassSlowDivision.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/IR/ValueHandle.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 
 namespace llvm {
@@ -66,8 +67,9 @@ template <> struct DenseMapInfo<DivRemMapKey> {
 ///
 /// This optimization may add basic blocks immediately after BB; for obvious
 /// reasons, you shouldn't pass those blocks to bypassSlowDivision.
-bool bypassSlowDivision(
-    BasicBlock *BB, const DenseMap<unsigned int, unsigned int> &BypassWidth);
+LLVM_ABI bool
+bypassSlowDivision(BasicBlock *BB,
+                   const DenseMap<unsigned int, unsigned int> &BypassWidth);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/CanonicalizeAliases.h b/llvm/include/llvm/Transforms/Utils/CanonicalizeAliases.h
index 0bdc1a12d1fb0..b17a392cbfdc6 100644
--- a/llvm/include/llvm/Transforms/Utils/CanonicalizeAliases.h
+++ b/llvm/include/llvm/Transforms/Utils/CanonicalizeAliases.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_UTILS_CANONICALIZEALIASES_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -24,7 +25,7 @@ class CanonicalizeAliasesPass : public PassInfoMixin<CanonicalizeAliasesPass> {
 public:
   CanonicalizeAliasesPass() = default;
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/CanonicalizeFreezeInLoops.h b/llvm/include/llvm/Transforms/Utils/CanonicalizeFreezeInLoops.h
index 924b6cdf7ca0b..a6f2615d26b9c 100644
--- a/llvm/include/llvm/Transforms/Utils/CanonicalizeFreezeInLoops.h
+++ b/llvm/include/llvm/Transforms/Utils/CanonicalizeFreezeInLoops.h
@@ -15,6 +15,7 @@
 
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Loop;
@@ -24,8 +25,9 @@ class LPMUpdater;
 class CanonicalizeFreezeInLoopsPass
     : public PassInfoMixin<CanonicalizeFreezeInLoopsPass> {
 public:
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/ControlFlowUtils.h b/llvm/include/llvm/Transforms/Utils/ControlFlowUtils.h
index 17cde82b084d8..4e09334615d3b 100644
--- a/llvm/include/llvm/Transforms/Utils/ControlFlowUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/ControlFlowUtils.h
@@ -16,6 +16,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/IR/CycleInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -116,7 +117,7 @@ struct ControlFlowHub {
 
   /// Return the unified loop exit block and a flag indicating if the CFG was
   /// changed at all.
-  std::pair<BasicBlock *, bool>
+  LLVM_ABI std::pair<BasicBlock *, bool>
   finalize(DomTreeUpdater *DTU, SmallVectorImpl<BasicBlock *> &GuardBlocks,
            const StringRef Prefix,
            std::optional<unsigned> MaxControlFlowBooleans = std::nullopt);
diff --git a/llvm/include/llvm/Transforms/Utils/CountVisits.h b/llvm/include/llvm/Transforms/Utils/CountVisits.h
index 7000afbc4985b..d7c32b082d9b4 100644
--- a/llvm/include/llvm/Transforms/Utils/CountVisits.h
+++ b/llvm/include/llvm/Transforms/Utils/CountVisits.h
@@ -11,13 +11,14 @@
 
 #include "llvm/ADT/StringMap.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class Function;
 
 struct CountVisitsPass : PassInfoMixin<CountVisitsPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 
 private:
   StringMap<uint32_t> Counts;
diff --git a/llvm/include/llvm/Transforms/Utils/CtorUtils.h b/llvm/include/llvm/Transforms/Utils/CtorUtils.h
index 40b290a5a6f4e..d06f7db055469 100644
--- a/llvm/include/llvm/Transforms/Utils/CtorUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/CtorUtils.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_UTILS_CTORUTILS_H
 
 #include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,8 +23,9 @@ class Module;
 
 /// Call "ShouldRemove" for every entry in M's global_ctor list and remove the
 /// entries for which it returns true.  Return true if anything changed.
-bool optimizeGlobalCtorsList(
-    Module &M, function_ref<bool(uint32_t, Function *)> ShouldRemove);
+LLVM_ABI bool
+optimizeGlobalCtorsList(Module &M,
+                        function_ref<bool(uint32_t, Function *)> ShouldRemove);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/DXILUpgrade.h b/llvm/include/llvm/Transforms/Utils/DXILUpgrade.h
index 4c74976093f1f..e6223270d64cc 100644
--- a/llvm/include/llvm/Transforms/Utils/DXILUpgrade.h
+++ b/llvm/include/llvm/Transforms/Utils/DXILUpgrade.h
@@ -10,13 +10,14 @@
 #define LLVM_TRANSFORMS_UTILS_DXILUPGRADE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 /// Upgrade DXIL-style metadata into their LLVM representations
 class DXILUpgradePass : public PassInfoMixin<DXILUpgradePass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h b/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h
index 3d88df91c2da5..a17432da29e5a 100644
--- a/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h
+++ b/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h
@@ -83,7 +83,7 @@ struct DbgValueDef {
   bool operator==(DbgValueDef Other) const { return agreesWith(Other); }
   bool operator!=(DbgValueDef Other) const { return !agreesWith(Other); }
 
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 };
 
 class DbgSSABlock;
@@ -109,7 +109,7 @@ class DbgSSAPhi {
     IncomingValues.push_back({BB, DV});
   }
 
-  void print(raw_ostream &OS) const;
+  LLVM_ABI void print(raw_ostream &OS) const;
 };
 
 inline raw_ostream &operator<<(raw_ostream &OS, const DbgValueDef &DV) {
@@ -139,7 +139,7 @@ class DbgSSABlockSuccIterator {
     return *this;
   }
 
-  DbgSSABlock *operator*();
+  LLVM_ABI DbgSSABlock *operator*();
 };
 
 /// Thin wrapper around a block successor iterator.
@@ -160,7 +160,7 @@ class DbgSSABlockPredIterator {
     return *this;
   }
 
-  DbgSSABlock *operator*();
+  LLVM_ABI DbgSSABlock *operator*();
 };
 
 class DbgSSABlock {
@@ -231,7 +231,7 @@ class DebugSSAUpdater {
 public:
   /// If InsertedPHIs is specified, it will be filled
   /// in with all PHI Nodes created by rewriting.
-  explicit DebugSSAUpdater(
+  LLVM_ABI explicit DebugSSAUpdater(
       SmallVectorImpl<DbgSSAPhi *> *InsertedPHIs = nullptr);
   DebugSSAUpdater(const DebugSSAUpdater &) = delete;
   DebugSSAUpdater &operator=(const DebugSSAUpdater &) = delete;
@@ -250,7 +250,7 @@ class DebugSSAUpdater {
     BlockMap.clear();
   }
 
-  void initialize();
+  LLVM_ABI void initialize();
 
   /// For a given BB, create a wrapper block for it. Stores it in the
   /// DebugSSAUpdater block map.
@@ -265,19 +265,19 @@ class DebugSSAUpdater {
 
   /// Indicate that a rewritten value is available in the specified block
   /// with the specified value.
-  void addAvailableValue(DbgSSABlock *BB, DbgValueDef DV);
+  LLVM_ABI void addAvailableValue(DbgSSABlock *BB, DbgValueDef DV);
 
   /// Return true if the DebugSSAUpdater already has a value for the specified
   /// block.
-  bool hasValueForBlock(DbgSSABlock *BB) const;
+  LLVM_ABI bool hasValueForBlock(DbgSSABlock *BB) const;
 
   /// Return the value for the specified block if the DebugSSAUpdater has one,
   /// otherwise return nullptr.
-  DbgValueDef findValueForBlock(DbgSSABlock *BB) const;
+  LLVM_ABI DbgValueDef findValueForBlock(DbgSSABlock *BB) const;
 
   /// Construct SSA form, materializing a value that is live at the end
   /// of the specified block.
-  DbgValueDef getValueAtEndOfBlock(DbgSSABlock *BB);
+  LLVM_ABI DbgValueDef getValueAtEndOfBlock(DbgSSABlock *BB);
 
   /// Construct SSA form, materializing a value that is live in the
   /// middle of the specified block.
@@ -299,7 +299,7 @@ class DebugSSAUpdater {
   /// their respective blocks.  However, the use of X happens in the *middle* of
   /// a block.  Because of this, we need to insert a new PHI node in SomeBB to
   /// merge the appropriate values, and this value isn't live out of the block.
-  DbgValueDef getValueInMiddleOfBlock(DbgSSABlock *BB);
+  LLVM_ABI DbgValueDef getValueInMiddleOfBlock(DbgSSABlock *BB);
 
 private:
   DbgValueDef getValueAtEndOfBlockInternal(DbgSSABlock *BB);
@@ -324,7 +324,7 @@ class SSAValueNameMap {
 
 public:
   using ValueID = uint64_t;
-  ValueID addValue(Value *V);
+  LLVM_ABI ValueID addValue(Value *V);
   std::string getName(ValueID ID) { return ValueIDToNameMap[ID]; }
 
 private:
@@ -358,7 +358,7 @@ class DbgValueRangeTable {
     return OrigSingleLocVariableValueTable[DVA];
   }
 
-  void printValues(DebugVariableAggregate DVA, raw_ostream &OS);
+  LLVM_ABI void printValues(DebugVariableAggregate DVA, raw_ostream &OS);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/DeclareRuntimeLibcalls.h b/llvm/include/llvm/Transforms/Utils/DeclareRuntimeLibcalls.h
index 295e3dec31415..e70e7dc3c94a2 100644
--- a/llvm/include/llvm/Transforms/Utils/DeclareRuntimeLibcalls.h
+++ b/llvm/include/llvm/Transforms/Utils/DeclareRuntimeLibcalls.h
@@ -10,12 +10,13 @@
 #define LLVM_TRANSFORMS_UTILS_DECLARERUNTIMELIBCALLS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class DeclareRuntimeLibcallsPass
     : public PassInfoMixin<DeclareRuntimeLibcallsPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h b/llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
index f2b038494a5db..12482b1d0413d 100644
--- a/llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
+++ b/llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
@@ -16,6 +16,7 @@
 #define LLVM_TRANSFORMS_UTILS_ENTRYEXITINSTRUMENTER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,10 +26,11 @@ struct EntryExitInstrumenterPass
     : public PassInfoMixin<EntryExitInstrumenterPass> {
   EntryExitInstrumenterPass(bool PostInlining) : PostInlining(PostInlining) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
-  void printPipeline(raw_ostream &OS,
-                     function_ref<StringRef(StringRef)> MapClassName2PassName);
+  LLVM_ABI void
+  printPipeline(raw_ostream &OS,
+                function_ref<StringRef(StringRef)> MapClassName2PassName);
 
   bool PostInlining;
 
diff --git a/llvm/include/llvm/Transforms/Utils/EscapeEnumerator.h b/llvm/include/llvm/Transforms/Utils/EscapeEnumerator.h
index 3d8447e9bf233..c5e57ad2514c7 100644
--- a/llvm/include/llvm/Transforms/Utils/EscapeEnumerator.h
+++ b/llvm/include/llvm/Transforms/Utils/EscapeEnumerator.h
@@ -16,6 +16,7 @@
 
 #include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuilder.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -43,7 +44,7 @@ class EscapeEnumerator {
       : F(F), CleanupBBName(N), StateBB(F.begin()), StateE(F.end()),
         Builder(F.getContext()), HandleExceptions(HandleExceptions), DTU(DTU) {}
 
-  IRBuilder<> *Next();
+  LLVM_ABI IRBuilder<> *Next();
 };
 
 }
diff --git a/llvm/include/llvm/Transforms/Utils/Evaluator.h b/llvm/include/llvm/Transforms/Utils/Evaluator.h
index 118037625421a..ae239a6121fb1 100644
--- a/llvm/include/llvm/Transforms/Utils/Evaluator.h
+++ b/llvm/include/llvm/Transforms/Utils/Evaluator.h
@@ -19,6 +19,7 @@
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/GlobalVariable.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <deque>
 #include <memory>
@@ -42,7 +43,7 @@ class Evaluator {
   /// without creating a new interned Constant.
   class MutableValue {
     PointerUnion<Constant *, MutableAggregate *> Val;
-    void clear();
+    LLVM_ABI void clear();
     bool makeMutable();
 
   public:
@@ -66,8 +67,8 @@ class Evaluator {
       return cast<MutableAggregate *>(Val)->toConstant();
     }
 
-    Constant *read(Type *Ty, APInt Offset, const DataLayout &DL) const;
-    bool write(Constant *V, APInt Offset, const DataLayout &DL);
+    LLVM_ABI Constant *read(Type *Ty, APInt Offset, const DataLayout &DL) const;
+    LLVM_ABI bool write(Constant *V, APInt Offset, const DataLayout &DL);
   };
 
   struct MutableAggregate {
@@ -75,7 +76,7 @@ class Evaluator {
     SmallVector<MutableValue> Elements;
 
     MutableAggregate(Type *Ty) : Ty(Ty) {}
-    Constant *toConstant() const;
+    LLVM_ABI Constant *toConstant() const;
   };
 
 public:
@@ -96,8 +97,8 @@ class Evaluator {
   /// Evaluate a call to function F, returning true if successful, false if we
   /// can't evaluate it.  ActualArgs contains the formal arguments for the
   /// function.
-  bool EvaluateFunction(Function *F, Constant *&RetVal,
-                        const SmallVectorImpl<Constant*> &ActualArgs);
+  LLVM_ABI bool EvaluateFunction(Function *F, Constant *&RetVal,
+                                 const SmallVectorImpl<Constant *> &ActualArgs);
 
   DenseMap<GlobalVariable *, Constant *> getMutatedInitializers() const {
     DenseMap<GlobalVariable *, Constant *> Result;
diff --git a/llvm/include/llvm/Transforms/Utils/FixIrreducible.h b/llvm/include/llvm/Transforms/Utils/FixIrreducible.h
index 0c00b7bdbaf9a..5c49ff2193e91 100644
--- a/llvm/include/llvm/Transforms/Utils/FixIrreducible.h
+++ b/llvm/include/llvm/Transforms/Utils/FixIrreducible.h
@@ -10,10 +10,11 @@
 #define LLVM_TRANSFORMS_UTILS_FIXIRREDUCIBLE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 struct FixIrreduciblePass : PassInfoMixin<FixIrreduciblePass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/GlobalStatus.h b/llvm/include/llvm/Transforms/Utils/GlobalStatus.h
index c001e587313c5..073731256f651 100644
--- a/llvm/include/llvm/Transforms/Utils/GlobalStatus.h
+++ b/llvm/include/llvm/Transforms/Utils/GlobalStatus.h
@@ -11,6 +11,7 @@
 
 #include "llvm/IR/Instructions.h"
 #include "llvm/Support/AtomicOrdering.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -22,7 +23,7 @@ class Value;
 /// Note that constants cannot be cyclic, so this test is pretty easy to
 /// implement recursively.
 ///
-bool isSafeToDestroyConstant(const Constant *C);
+LLVM_ABI bool isSafeToDestroyConstant(const Constant *C);
 
 /// As we analyze each global or thread-local variable, keep track of some
 /// information about it.  If we find out that the address of the global is
@@ -79,12 +80,12 @@ struct GlobalStatus {
   /// Set to the strongest atomic ordering requirement.
   AtomicOrdering Ordering = AtomicOrdering::NotAtomic;
 
-  GlobalStatus();
+  LLVM_ABI GlobalStatus();
 
   /// Look at all uses of the global and fill in the GlobalStatus structure.  If
   /// the global has its address taken, return true to indicate we can't do
   /// anything with it.
-  static bool analyzeGlobal(const Value *V, GlobalStatus &GS);
+  LLVM_ABI static bool analyzeGlobal(const Value *V, GlobalStatus &GS);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/GuardUtils.h b/llvm/include/llvm/Transforms/Utils/GuardUtils.h
index 7ab5d9ef4f238..0de47c3095892 100644
--- a/llvm/include/llvm/Transforms/Utils/GuardUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/GuardUtils.h
@@ -12,6 +12,8 @@
 #ifndef LLVM_TRANSFORMS_UTILS_GUARDUTILS_H
 #define LLVM_TRANSFORMS_UTILS_GUARDUTILS_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 
 class BranchInst;
@@ -26,18 +28,18 @@ class Value;
 /// deoptimize function \p DeoptIntrinsic.  If 'UseWC' is set, preserve the
 /// widenable nature of the guard by lowering to equivelent form.  If not set,
 /// lower to a form without widenable semantics.
-void makeGuardControlFlowExplicit(Function *DeoptIntrinsic, CallInst *Guard,
-                                  bool UseWC);
+LLVM_ABI void makeGuardControlFlowExplicit(Function *DeoptIntrinsic,
+                                           CallInst *Guard, bool UseWC);
 
 /// Given a branch we know is widenable (defined per Analysis/GuardUtils.h),
 /// widen it such that condition 'NewCond' is also known to hold on the taken
 /// path.  Branch remains widenable after transform.
-void widenWidenableBranch(BranchInst *WidenableBR, Value *NewCond);
+LLVM_ABI void widenWidenableBranch(BranchInst *WidenableBR, Value *NewCond);
 
 /// Given a branch we know is widenable (defined per Analysis/GuardUtils.h),
 /// *set* it's condition such that (only) 'Cond' is known to hold on the taken
 /// path and that the branch remains widenable after transform.
-void setWidenableBranchCond(BranchInst *WidenableBR, Value *Cond);
+LLVM_ABI void setWidenableBranchCond(BranchInst *WidenableBR, Value *Cond);
 
 } // llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/HelloWorld.h b/llvm/include/llvm/Transforms/Utils/HelloWorld.h
index e29dda54586e7..6c5ef03877a93 100644
--- a/llvm/include/llvm/Transforms/Utils/HelloWorld.h
+++ b/llvm/include/llvm/Transforms/Utils/HelloWorld.h
@@ -10,12 +10,13 @@
 #define LLVM_TRANSFORMS_UTILS_HELLOWORLD_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class HelloWorldPass : public PassInfoMixin<HelloWorldPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/IRNormalizer.h b/llvm/include/llvm/Transforms/Utils/IRNormalizer.h
index 65f03240f316a..6e15ff5dbc403 100644
--- a/llvm/include/llvm/Transforms/Utils/IRNormalizer.h
+++ b/llvm/include/llvm/Transforms/Utils/IRNormalizer.h
@@ -2,6 +2,7 @@
 #define LLVM_TRANSFORMS_UTILS_IRNORMALIZER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -28,7 +29,8 @@ struct IRNormalizerPass : public PassInfoMixin<IRNormalizerPass> {
   IRNormalizerPass(IRNormalizerOptions Options = IRNormalizerOptions())
       : Options(Options) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) const;
+  LLVM_ABI PreservedAnalyses run(Function &F,
+                                 FunctionAnalysisManager &AM) const;
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h b/llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h
index b6c402402b17a..28f5ab1f190b9 100644
--- a/llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h
+++ b/llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h
@@ -14,12 +14,13 @@
 #define LLVM_TRANSFORMS_UTILS_INJECTTLIMAPPINGS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Function;
 class InjectTLIMappings : public PassInfoMixin<InjectTLIMappings> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // End namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/InstructionNamer.h b/llvm/include/llvm/Transforms/Utils/InstructionNamer.h
index 4f4cc2666f106..939b058346ae6 100644
--- a/llvm/include/llvm/Transforms/Utils/InstructionNamer.h
+++ b/llvm/include/llvm/Transforms/Utils/InstructionNamer.h
@@ -10,10 +10,11 @@
 #define LLVM_TRANSFORMS_UTILS_INSTRUCTIONNAMER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 struct InstructionNamerPass : PassInfoMixin<InstructionNamerPass> {
-  PreservedAnalyses run(Function &, FunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Function &, FunctionAnalysisManager &);
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/LibCallsShrinkWrap.h b/llvm/include/llvm/Transforms/Utils/LibCallsShrinkWrap.h
index ff1537ace329e..8928753256d9c 100644
--- a/llvm/include/llvm/Transforms/Utils/LibCallsShrinkWrap.h
+++ b/llvm/include/llvm/Transforms/Utils/LibCallsShrinkWrap.h
@@ -12,6 +12,7 @@
 #define LLVM_TRANSFORMS_UTILS_LIBCALLSSHRINKWRAP_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -19,7 +20,7 @@ class LibCallsShrinkWrapPass : public PassInfoMixin<LibCallsShrinkWrapPass> {
 public:
   static StringRef name() { return "LibCallsShrinkWrapPass"; }
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/LoopConstrainer.h b/llvm/include/llvm/Transforms/Utils/LoopConstrainer.h
index 64db907e9a0f4..90e657aed6187 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopConstrainer.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopConstrainer.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_UTILS_LOOP_CONSTRAINER_H
 
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 #include <optional>
 
@@ -80,7 +81,7 @@ struct LoopStructure {
     return Result;
   }
 
-  static std::optional<LoopStructure>
+  LLVM_ABI static std::optional<LoopStructure>
   parseLoopStructure(ScalarEvolution &, Loop &, bool, const char *&);
 };
 
@@ -213,13 +214,13 @@ class LoopConstrainer {
   SubRanges SR;
 
 public:
-  LoopConstrainer(Loop &L, LoopInfo &LI,
-                  function_ref<void(Loop *, bool)> LPMAddNewLoop,
-                  const LoopStructure &LS, ScalarEvolution &SE,
-                  DominatorTree &DT, Type *T, SubRanges SR);
+  LLVM_ABI LoopConstrainer(Loop &L, LoopInfo &LI,
+                           function_ref<void(Loop *, bool)> LPMAddNewLoop,
+                           const LoopStructure &LS, ScalarEvolution &SE,
+                           DominatorTree &DT, Type *T, SubRanges SR);
 
   // Entry point for the algorithm.  Returns true on success.
-  bool run();
+  LLVM_ABI bool run();
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/LoopPeel.h b/llvm/include/llvm/Transforms/Utils/LoopPeel.h
index 5502da0ce0d09..c938afaac3383 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopPeel.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopPeel.h
@@ -15,38 +15,41 @@
 #define LLVM_TRANSFORMS_UTILS_LOOPPEEL_H
 
 #include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 
 namespace llvm {
 
-bool canPeel(const Loop *L);
+LLVM_ABI bool canPeel(const Loop *L);
 
 /// Returns true if the last iteration of \p L can be peeled off. It makes sure
 /// the loop exit condition can be adjusted when peeling and that the loop
 /// executes at least 2 iterations.
-bool canPeelLastIteration(const Loop &L, ScalarEvolution &SE);
+LLVM_ABI bool canPeelLastIteration(const Loop &L, ScalarEvolution &SE);
 
 /// VMap is the value-map that maps instructions from the original loop to
 /// instructions in the last peeled-off iteration. If \p PeelLast is true, peel
 /// off the last \p PeelCount iterations from \p L (canPeelLastIteration must be
 /// true for \p L), otherwise peel off the first \p PeelCount iterations.
-void peelLoop(Loop *L, unsigned PeelCount, bool PeelLast, LoopInfo *LI,
-              ScalarEvolution *SE, DominatorTree &DT, AssumptionCache *AC,
-              bool PreserveLCSSA, ValueToValueMapTy &VMap);
+LLVM_ABI void peelLoop(Loop *L, unsigned PeelCount, bool PeelLast, LoopInfo *LI,
+                       ScalarEvolution *SE, DominatorTree &DT,
+                       AssumptionCache *AC, bool PreserveLCSSA,
+                       ValueToValueMapTy &VMap);
 
-TargetTransformInfo::PeelingPreferences
+LLVM_ABI TargetTransformInfo::PeelingPreferences
 gatherPeelingPreferences(Loop *L, ScalarEvolution &SE,
                          const TargetTransformInfo &TTI,
                          std::optional<bool> UserAllowPeeling,
                          std::optional<bool> UserAllowProfileBasedPeeling,
                          bool UnrollingSpecficValues = false);
 
-void computePeelCount(Loop *L, unsigned LoopSize,
-                      TargetTransformInfo::PeelingPreferences &PP,
-                      unsigned TripCount, DominatorTree &DT,
-                      ScalarEvolution &SE, const TargetTransformInfo &TTI,
-                      AssumptionCache *AC = nullptr,
-                      unsigned Threshold = UINT_MAX);
+LLVM_ABI void computePeelCount(Loop *L, unsigned LoopSize,
+                               TargetTransformInfo::PeelingPreferences &PP,
+                               unsigned TripCount, DominatorTree &DT,
+                               ScalarEvolution &SE,
+                               const TargetTransformInfo &TTI,
+                               AssumptionCache *AC = nullptr,
+                               unsigned Threshold = UINT_MAX);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
index 0f7ee82a6ff64..827dec01abdf8 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
@@ -375,14 +375,14 @@ LLVM_ABI bool setLoopEstimatedTripCount(
 /// - The probability \c P that, at the end of any iteration, the latch of \p L
 ///   will start another iteration such that `1 - P` is the probability of
 ///   exiting the loop.
-BranchProbability getLoopProbability(Loop *L);
+LLVM_ABI BranchProbability getLoopProbability(Loop *L);
 
 /// Set branch weight metadata for the latch of \p L to indicate that, at the
 /// end of any iteration, \p P and `1 - P` are the probabilities of starting
 /// another iteration and exiting the loop, respectively.  Return false if the
 /// implementation is unable to handle the loop form of \p L (e.g., \p L must
 /// have a latch block that controls the loop exit).  Otherwise, return true.
-bool setLoopProbability(Loop *L, BranchProbability P);
+LLVM_ABI bool setLoopProbability(Loop *L, BranchProbability P);
 
 /// Based on branch weight metadata, return either:
 /// - An unknown probability if the implementation cannot extract the
@@ -391,7 +391,8 @@ bool setLoopProbability(Loop *L, BranchProbability P);
 /// - The probability \c P that control flows from \p B to its first target
 ///   label such that `1 - P` is the probability of control flowing to its
 ///   second target label, or vice-versa if \p ForFirstTarget is false.
-BranchProbability getBranchProbability(BranchInst *B, bool ForFirstTarget);
+LLVM_ABI BranchProbability getBranchProbability(BranchInst *B,
+                                                bool ForFirstTarget);
 
 /// Set branch weight metadata for \p B to indicate that \p P and `1 - P` are
 /// the probabilities of control flowing to its first and second target labels,
@@ -399,8 +400,8 @@ BranchProbability getBranchProbability(BranchInst *B, bool ForFirstTarget);
 /// the implementation cannot set the probability (e.g., \p B must have exactly
 /// two target labels, so it must be a conditional branch).  Otherwise, return
 /// true.
-bool setBranchProbability(BranchInst *B, BranchProbability P,
-                          bool ForFirstTarget);
+LLVM_ABI bool setBranchProbability(BranchInst *B, BranchProbability P,
+                                   bool ForFirstTarget);
 
 /// Check inner loop (L) backedge count is known to be invariant on all
 /// iterations of its outer loop. If the loop has no parent, this is trivially
diff --git a/llvm/include/llvm/Transforms/Utils/LoopVersioning.h b/llvm/include/llvm/Transforms/Utils/LoopVersioning.h
index ea4fe27c90f5c..b70771b359a72 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopVersioning.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopVersioning.h
@@ -16,6 +16,7 @@
 #define LLVM_TRANSFORMS_UTILS_LOOPVERSIONING_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Utils/LoopUtils.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 
@@ -44,9 +45,9 @@ class LoopVersioning {
   /// It uses runtime check provided by the user. If \p UseLAIChecks is true,
   /// we will retain the default checks made by LAI. Otherwise, construct an
   /// object having no checks and we expect the user to add them.
-  LoopVersioning(const LoopAccessInfo &LAI,
-                 ArrayRef<RuntimePointerCheck> Checks, Loop *L, LoopInfo *LI,
-                 DominatorTree *DT, ScalarEvolution *SE);
+  LLVM_ABI LoopVersioning(const LoopAccessInfo &LAI,
+                          ArrayRef<RuntimePointerCheck> Checks, Loop *L,
+                          LoopInfo *LI, DominatorTree *DT, ScalarEvolution *SE);
 
   /// Performs the CFG manipulation part of versioning the loop including
   /// the DominatorTree and LoopInfo updates.
@@ -65,7 +66,8 @@ class LoopVersioning {
 
   /// Same but if the client has already precomputed the set of values
   /// used outside the loop, this API will allows passing that.
-  void versionLoop(const SmallVectorImpl<Instruction *> &DefsUsedOutside);
+  LLVM_ABI void
+  versionLoop(const SmallVectorImpl<Instruction *> &DefsUsedOutside);
 
   /// Returns the versioned loop.  Control flows here if pointers in the
   /// loop don't alias (i.e. all memchecks passed).  (This loop is actually the
@@ -81,24 +83,24 @@ class LoopVersioning {
   ///
   /// This is just wrapper that calls prepareNoAliasMetadata and
   /// annotateInstWithNoAlias on the instructions of the versioned loop.
-  void annotateLoopWithNoAlias();
+  LLVM_ABI void annotateLoopWithNoAlias();
 
   /// Returns a pair containing the alias_scope and noalias metadata nodes for
   /// \p OrigInst, if they exists.
-  std::pair<MDNode *, MDNode *>
+  LLVM_ABI std::pair<MDNode *, MDNode *>
   getNoAliasMetadataFor(const Instruction *OrigInst) const;
 
   /// Set up the aliasing scopes based on the memchecks.  This needs to
   /// be called before the first call to annotateInstWithNoAlias.
-  void prepareNoAliasMetadata();
+  LLVM_ABI void prepareNoAliasMetadata();
 
   /// Add the noalias annotations to \p VersionedInst.
   ///
   /// \p OrigInst is the instruction corresponding to \p VersionedInst in the
   /// original loop.  Initialize the aliasing scopes with
   /// prepareNoAliasMetadata once before this can be called.
-  void annotateInstWithNoAlias(Instruction *VersionedInst,
-                               const Instruction *OrigInst);
+  LLVM_ABI void annotateInstWithNoAlias(Instruction *VersionedInst,
+                                        const Instruction *OrigInst);
 
 private:
   /// Adds the necessary PHI nodes for the versioned loops based on the
@@ -154,7 +156,7 @@ class LoopVersioning {
 /// array accesses from the loop.
 class LoopVersioningPass : public PassInfoMixin<LoopVersioningPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
 };
 }
 
diff --git a/llvm/include/llvm/Transforms/Utils/LowerAtomic.h b/llvm/include/llvm/Transforms/Utils/LowerAtomic.h
index d34f8c7fd8882..2bd331039f764 100644
--- a/llvm/include/llvm/Transforms/Utils/LowerAtomic.h
+++ b/llvm/include/llvm/Transforms/Utils/LowerAtomic.h
@@ -15,29 +15,32 @@
 #define LLVM_TRANSFORMS_UTILS_LOWERATOMIC_H
 
 #include "llvm/IR/Instructions.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class IRBuilderBase;
 
 /// Convert the given Cmpxchg into primitive load and compare.
-bool lowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI);
+LLVM_ABI bool lowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI);
 
 /// Emit IR to implement the given cmpxchg operation on values in registers,
 /// returning the new value.
-std::pair<Value *, Value *> buildCmpXchgValue(IRBuilderBase &Builder,
-                                              Value *Ptr, Value *Cmp,
-                                              Value *Val, Align Alignment);
+LLVM_ABI std::pair<Value *, Value *> buildCmpXchgValue(IRBuilderBase &Builder,
+                                                       Value *Ptr, Value *Cmp,
+                                                       Value *Val,
+                                                       Align Alignment);
 
 /// Convert the given RMWI into primitive load and stores,
 /// assuming that doing so is legal. Return true if the lowering
 /// succeeds.
-bool lowerAtomicRMWInst(AtomicRMWInst *RMWI);
+LLVM_ABI bool lowerAtomicRMWInst(AtomicRMWInst *RMWI);
 
 /// Emit IR to implement the given atomicrmw operation on values in registers,
 /// returning the new value.
-Value *buildAtomicRMWValue(AtomicRMWInst::BinOp Op, IRBuilderBase &Builder,
-                           Value *Loaded, Value *Val);
+LLVM_ABI Value *buildAtomicRMWValue(AtomicRMWInst::BinOp Op,
+                                    IRBuilderBase &Builder, Value *Loaded,
+                                    Value *Val);
 }
 
 #endif // LLVM_TRANSFORMS_UTILS_LOWERATOMIC_H
diff --git a/llvm/include/llvm/Transforms/Utils/LowerGlobalDtors.h b/llvm/include/llvm/Transforms/Utils/LowerGlobalDtors.h
index 993a6f57361cc..fd91eb15dd61c 100644
--- a/llvm/include/llvm/Transforms/Utils/LowerGlobalDtors.h
+++ b/llvm/include/llvm/Transforms/Utils/LowerGlobalDtors.h
@@ -15,12 +15,13 @@
 #define LLVM_TRANSFORMS_UTILS_LOWERGLOBALDTORS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class LowerGlobalDtorsPass : public PassInfoMixin<LowerGlobalDtorsPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/LowerIFunc.h b/llvm/include/llvm/Transforms/Utils/LowerIFunc.h
index 87ddc18d7c063..afc824ed20643 100644
--- a/llvm/include/llvm/Transforms/Utils/LowerIFunc.h
+++ b/llvm/include/llvm/Transforms/Utils/LowerIFunc.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_UTILS_LOWERIFUNC_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -20,7 +21,7 @@ class LowerIFuncPass : public PassInfoMixin<LowerIFuncPass> {
 public:
   LowerIFuncPass() = default;
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/LowerInvoke.h b/llvm/include/llvm/Transforms/Utils/LowerInvoke.h
index c1198b08d3ded..2189a4dfbfe78 100644
--- a/llvm/include/llvm/Transforms/Utils/LowerInvoke.h
+++ b/llvm/include/llvm/Transforms/Utils/LowerInvoke.h
@@ -16,12 +16,13 @@
 #define LLVM_TRANSFORMS_UTILS_LOWERINVOKE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class LowerInvokePass : public PassInfoMixin<LowerInvokePass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 }
diff --git a/llvm/include/llvm/Transforms/Utils/LowerSwitch.h b/llvm/include/llvm/Transforms/Utils/LowerSwitch.h
index 97086987ffcbd..c13a5a0ed60fb 100644
--- a/llvm/include/llvm/Transforms/Utils/LowerSwitch.h
+++ b/llvm/include/llvm/Transforms/Utils/LowerSwitch.h
@@ -16,10 +16,11 @@
 #define LLVM_TRANSFORMS_UTILS_LOWERSWITCH_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 struct LowerSwitchPass : public PassInfoMixin<LowerSwitchPass> {
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/LowerVectorIntrinsics.h b/llvm/include/llvm/Transforms/Utils/LowerVectorIntrinsics.h
index 19b573d6546a0..44c70a99b4306 100644
--- a/llvm/include/llvm/Transforms/Utils/LowerVectorIntrinsics.h
+++ b/llvm/include/llvm/Transforms/Utils/LowerVectorIntrinsics.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_TRANSFORMS_UTILS_LOWERVECTORINTRINSICS_H
 #define LLVM_TRANSFORMS_UTILS_LOWERVECTORINTRINSICS_H
 
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 
 namespace llvm {
@@ -22,7 +23,7 @@ class Module;
 
 /// Lower \p CI as a loop. \p CI is a unary intrinsic with a vector argument and
 /// is deleted and replaced with a loop.
-bool lowerUnaryVectorIntrinsicAsLoop(Module &M, CallInst *CI);
+LLVM_ABI bool lowerUnaryVectorIntrinsicAsLoop(Module &M, CallInst *CI);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/MatrixUtils.h b/llvm/include/llvm/Transforms/Utils/MatrixUtils.h
index ffad57002935e..395b8451557ba 100644
--- a/llvm/include/llvm/Transforms/Utils/MatrixUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/MatrixUtils.h
@@ -14,6 +14,7 @@
 #define LLVM_TRANSFORMS_UTILS_MATRIXUTILS_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class DomTreeUpdater;
@@ -70,9 +71,9 @@ struct TileInfo {
   /// for ColumnLoop.Index = 0..NumColumns
   ///   for RowLoop.Index = 0..NumRows
   ///     for InnerLoop.Index = 0..NumInner
-  BasicBlock *CreateTiledLoops(BasicBlock *Start, BasicBlock *End,
-                               IRBuilderBase &B, DomTreeUpdater &DTU,
-                               LoopInfo &LI);
+  LLVM_ABI BasicBlock *CreateTiledLoops(BasicBlock *Start, BasicBlock *End,
+                                        IRBuilderBase &B, DomTreeUpdater &DTU,
+                                        LoopInfo &LI);
 
 private:
   /// Creates a new loop with header, body and latch blocks that iterates from
diff --git a/llvm/include/llvm/Transforms/Utils/MemoryOpRemark.h b/llvm/include/llvm/Transforms/Utils/MemoryOpRemark.h
index fdb586e153ff9..3f68e2f7428ec 100644
--- a/llvm/include/llvm/Transforms/Utils/MemoryOpRemark.h
+++ b/llvm/include/llvm/Transforms/Utils/MemoryOpRemark.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
@@ -32,7 +33,7 @@ class StoreInst;
 
 // FIXME: Once we get to more remarks like this one, we need to re-evaluate how
 // much of this logic should actually go into the remark emitter.
-struct MemoryOpRemark {
+struct LLVM_ABI MemoryOpRemark {
   OptimizationRemarkEmitter &ORE;
   StringRef RemarkPass;
   const DataLayout &DL;
@@ -94,7 +95,7 @@ struct MemoryOpRemark {
 };
 
 /// Special case for -ftrivial-auto-var-init remarks.
-struct AutoInitRemark : public MemoryOpRemark {
+struct LLVM_ABI AutoInitRemark : public MemoryOpRemark {
   AutoInitRemark(OptimizationRemarkEmitter &ORE, StringRef RemarkPass,
                  const DataLayout &DL, const TargetLibraryInfo &TLI)
       : MemoryOpRemark(ORE, RemarkPass, DL, TLI) {}
diff --git a/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h b/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
index e0cdcf84012e8..38e40b487e926 100644
--- a/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
+++ b/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
@@ -20,6 +20,7 @@
 #include "llvm/Analysis/StackSafetyAnalysis.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/Support/Alignment.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class DominatorTree;
@@ -35,18 +36,20 @@ namespace memtag {
 // Returns whether Ends covered all possible exits. If they did not,
 // the caller should remove Ends to ensure that work done at the other
 // exits does not happen outside of the lifetime.
-bool forAllReachableExits(const DominatorTree &DT, const PostDominatorTree &PDT,
-                          const LoopInfo &LI, const Instruction *Start,
-                          const SmallVectorImpl<IntrinsicInst *> &Ends,
-                          const SmallVectorImpl<Instruction *> &RetVec,
-                          llvm::function_ref<void(Instruction *)> Callback);
+LLVM_ABI bool
+forAllReachableExits(const DominatorTree &DT, const PostDominatorTree &PDT,
+                     const LoopInfo &LI, const Instruction *Start,
+                     const SmallVectorImpl<IntrinsicInst *> &Ends,
+                     const SmallVectorImpl<Instruction *> &RetVec,
+                     llvm::function_ref<void(Instruction *)> Callback);
 
-bool isStandardLifetime(const SmallVectorImpl<IntrinsicInst *> &LifetimeStart,
-                        const SmallVectorImpl<IntrinsicInst *> &LifetimeEnd,
-                        const DominatorTree *DT, const LoopInfo *LI,
-                        size_t MaxLifetimes);
+LLVM_ABI bool
+isStandardLifetime(const SmallVectorImpl<IntrinsicInst *> &LifetimeStart,
+                   const SmallVectorImpl<IntrinsicInst *> &LifetimeEnd,
+                   const DominatorTree *DT, const LoopInfo *LI,
+                   size_t MaxLifetimes);
 
-Instruction *getUntagLocationIfFunctionExit(Instruction &Inst);
+LLVM_ABI Instruction *getUntagLocationIfFunctionExit(Instruction &Inst);
 
 struct AllocaInfo {
   AllocaInst *AI;
@@ -75,8 +78,8 @@ class StackInfoBuilder {
   StackInfoBuilder(const StackSafetyGlobalInfo *SSI, const char *DebugType)
       : SSI(SSI), DebugType(DebugType) {}
 
-  void visit(OptimizationRemarkEmitter &ORE, Instruction &Inst);
-  AllocaInterestingness getAllocaInterestingness(const AllocaInst &AI);
+  LLVM_ABI void visit(OptimizationRemarkEmitter &ORE, Instruction &Inst);
+  LLVM_ABI AllocaInterestingness getAllocaInterestingness(const AllocaInst &AI);
   StackInfo &get() { return Info; };
 
 private:
@@ -85,17 +88,17 @@ class StackInfoBuilder {
   const char *DebugType;
 };
 
-uint64_t getAllocaSizeInBytes(const AllocaInst &AI);
-void alignAndPadAlloca(memtag::AllocaInfo &Info, llvm::Align Align);
+LLVM_ABI uint64_t getAllocaSizeInBytes(const AllocaInst &AI);
+LLVM_ABI void alignAndPadAlloca(memtag::AllocaInfo &Info, llvm::Align Align);
 
-Value *readRegister(IRBuilder<> &IRB, StringRef Name);
-Value *getFP(IRBuilder<> &IRB);
-Value *getPC(const Triple &TargetTriple, IRBuilder<> &IRB);
-Value *getAndroidSlotPtr(IRBuilder<> &IRB, int Slot);
+LLVM_ABI Value *readRegister(IRBuilder<> &IRB, StringRef Name);
+LLVM_ABI Value *getFP(IRBuilder<> &IRB);
+LLVM_ABI Value *getPC(const Triple &TargetTriple, IRBuilder<> &IRB);
+LLVM_ABI Value *getAndroidSlotPtr(IRBuilder<> &IRB, int Slot);
 
-void annotateDebugRecords(AllocaInfo &Info, unsigned int Tag);
-Value *incrementThreadLong(IRBuilder<> &IRB, Value *ThreadLong,
-                           unsigned int Inc);
+LLVM_ABI void annotateDebugRecords(AllocaInfo &Info, unsigned int Tag);
+LLVM_ABI Value *incrementThreadLong(IRBuilder<> &IRB, Value *ThreadLong,
+                                    unsigned int Inc);
 
 } // namespace memtag
 } // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/MetaRenamer.h b/llvm/include/llvm/Transforms/Utils/MetaRenamer.h
index fff3dff75837e..2f75e6bd8b67b 100644
--- a/llvm/include/llvm/Transforms/Utils/MetaRenamer.h
+++ b/llvm/include/llvm/Transforms/Utils/MetaRenamer.h
@@ -16,10 +16,11 @@
 #define LLVM_TRANSFORMS_UTILS_METARENAMER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 struct MetaRenamerPass : PassInfoMixin<MetaRenamerPass> {
-  PreservedAnalyses run(Module &, ModuleAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Module &, ModuleAnalysisManager &);
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/MisExpect.h b/llvm/include/llvm/Transforms/Utils/MisExpect.h
index 2d35d92d6b199..da273196dd562 100644
--- a/llvm/include/llvm/Transforms/Utils/MisExpect.h
+++ b/llvm/include/llvm/Transforms/Utils/MisExpect.h
@@ -21,6 +21,7 @@
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/LLVMContext.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm::misexpect {
 
@@ -33,8 +34,8 @@ namespace llvm::misexpect {
 ///
 /// \param I The Instruction being checked
 /// \param RealWeights A vector of profile weights for each target block
-void checkBackendInstrumentation(const Instruction &I,
-                                 ArrayRef<uint32_t> RealWeights);
+LLVM_ABI void checkBackendInstrumentation(const Instruction &I,
+                                          ArrayRef<uint32_t> RealWeights);
 
 /// checkFrontendInstrumentation - compares PGO counters to the thresholds used
 /// for llvm.expect and warns if the PGO counters are outside of the expected
@@ -47,8 +48,8 @@ void checkBackendInstrumentation(const Instruction &I,
 /// \param I The Instruction being checked
 /// \param ExpectedWeights A vector of the expected weights for each target
 /// block, this determines the threshold values used when emitting diagnostics
-void checkFrontendInstrumentation(const Instruction &I,
-                                  ArrayRef<uint32_t> ExpectedWeights);
+LLVM_ABI void checkFrontendInstrumentation(const Instruction &I,
+                                           ArrayRef<uint32_t> ExpectedWeights);
 
 /// veryifyMisExpect - compares RealWeights to the thresholds used
 /// for llvm.expect and warns if the PGO counters are outside of the expected
@@ -57,8 +58,9 @@ void checkFrontendInstrumentation(const Instruction &I,
 /// \param I The Instruction being checked
 /// \param RealWeights A vector of profile weights from the profile data
 /// \param ExpectedWeights A vector of the weights attatch by llvm.expect
-void verifyMisExpect(const Instruction &I, ArrayRef<uint32_t> RealWeights,
-                     ArrayRef<uint32_t> ExpectedWeights);
+LLVM_ABI void verifyMisExpect(const Instruction &I,
+                              ArrayRef<uint32_t> RealWeights,
+                              ArrayRef<uint32_t> ExpectedWeights);
 
 /// checkExpectAnnotations - compares PGO counters to the thresholds used
 /// for llvm.expect and warns if the PGO counters are outside of the expected
@@ -71,9 +73,9 @@ void verifyMisExpect(const Instruction &I, ArrayRef<uint32_t> RealWeights,
 /// \param I The Instruction being checked
 /// \param ExistingWeights A vector of profile weights for each target block
 /// \param IsFrontend A boolean describing if this is Frontend instrumentation
-void checkExpectAnnotations(const Instruction &I,
-                            ArrayRef<uint32_t> ExistingWeights,
-                            bool IsFrontend);
+LLVM_ABI void checkExpectAnnotations(const Instruction &I,
+                                     ArrayRef<uint32_t> ExistingWeights,
+                                     bool IsFrontend);
 
 } // namespace llvm::misexpect
 
diff --git a/llvm/include/llvm/Transforms/Utils/MoveAutoInit.h b/llvm/include/llvm/Transforms/Utils/MoveAutoInit.h
index 980b55f46f114..1ca032ab8dd73 100644
--- a/llvm/include/llvm/Transforms/Utils/MoveAutoInit.h
+++ b/llvm/include/llvm/Transforms/Utils/MoveAutoInit.h
@@ -17,12 +17,13 @@
 #define LLVM_TRANSFORMS_UTILS_MOVEAUTOINIT_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class MoveAutoInitPass : public PassInfoMixin<MoveAutoInitPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/NameAnonGlobals.h b/llvm/include/llvm/Transforms/Utils/NameAnonGlobals.h
index b1c181c1211b4..46dfba71aabd3 100644
--- a/llvm/include/llvm/Transforms/Utils/NameAnonGlobals.h
+++ b/llvm/include/llvm/Transforms/Utils/NameAnonGlobals.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_UTILS_NAMEANONGLOBALS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -23,7 +24,7 @@ class NameAnonGlobalPass : public PassInfoMixin<NameAnonGlobalPass> {
 public:
   NameAnonGlobalPass() = default;
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
   static bool isRequired() { return true; }
 };
diff --git a/llvm/include/llvm/Transforms/Utils/RelLookupTableConverter.h b/llvm/include/llvm/Transforms/Utils/RelLookupTableConverter.h
index 0992a4456c9d0..44d48cf9d764d 100644
--- a/llvm/include/llvm/Transforms/Utils/RelLookupTableConverter.h
+++ b/llvm/include/llvm/Transforms/Utils/RelLookupTableConverter.h
@@ -52,6 +52,7 @@
 #define LLVM_TRANSFORMS_UTILS_RELLOOKUPTABLECONVERTER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -63,7 +64,7 @@ class RelLookupTableConverterPass
 public:
   RelLookupTableConverterPass() = default;
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/SSAUpdater.h b/llvm/include/llvm/Transforms/Utils/SSAUpdater.h
index 9500b1f160ea9..6c985f9c1fa5d 100644
--- a/llvm/include/llvm/Transforms/Utils/SSAUpdater.h
+++ b/llvm/include/llvm/Transforms/Utils/SSAUpdater.h
@@ -15,6 +15,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include <string>
 
 namespace llvm {
@@ -57,32 +58,33 @@ class SSAUpdater {
 public:
   /// If InsertedPHIs is specified, it will be filled
   /// in with all PHI Nodes created by rewriting.
-  explicit SSAUpdater(SmallVectorImpl<PHINode *> *InsertedPHIs = nullptr);
+  LLVM_ABI explicit SSAUpdater(
+      SmallVectorImpl<PHINode *> *InsertedPHIs = nullptr);
   SSAUpdater(const SSAUpdater &) = delete;
   SSAUpdater &operator=(const SSAUpdater &) = delete;
-  ~SSAUpdater();
+  LLVM_ABI ~SSAUpdater();
 
   /// Reset this object to get ready for a new set of SSA updates with
   /// type 'Ty'.
   ///
   /// PHI nodes get a name based on 'Name'.
-  void Initialize(Type *Ty, StringRef Name);
+  LLVM_ABI void Initialize(Type *Ty, StringRef Name);
 
   /// Indicate that a rewritten value is available in the specified block
   /// with the specified value.
-  void AddAvailableValue(BasicBlock *BB, Value *V);
+  LLVM_ABI void AddAvailableValue(BasicBlock *BB, Value *V);
 
   /// Return true if the SSAUpdater already has a value for the specified
   /// block.
-  bool HasValueForBlock(BasicBlock *BB) const;
+  LLVM_ABI bool HasValueForBlock(BasicBlock *BB) const;
 
   /// Return the value for the specified block if the SSAUpdater has one,
   /// otherwise return nullptr.
-  Value *FindValueForBlock(BasicBlock *BB) const;
+  LLVM_ABI Value *FindValueForBlock(BasicBlock *BB) const;
 
   /// Construct SSA form, materializing a value that is live at the end
   /// of the specified block.
-  Value *GetValueAtEndOfBlock(BasicBlock *BB);
+  LLVM_ABI Value *GetValueAtEndOfBlock(BasicBlock *BB);
 
   /// Construct SSA form, materializing a value that is live in the
   /// middle of the specified block.
@@ -104,7 +106,7 @@ class SSAUpdater {
   /// their respective blocks.  However, the use of X happens in the *middle* of
   /// a block.  Because of this, we need to insert a new PHI node in SomeBB to
   /// merge the appropriate values, and this value isn't live out of the block.
-  Value *GetValueInMiddleOfBlock(BasicBlock *BB);
+  LLVM_ABI Value *GetValueInMiddleOfBlock(BasicBlock *BB);
 
   /// Rewrite a use of the symbolic value.
   ///
@@ -113,23 +115,24 @@ class SSAUpdater {
   /// rewritten to a value defined in the same block as the use, but above it.
   /// Any 'AddAvailableValue's added for the use's block will be considered to
   /// be below it.
-  void RewriteUse(Use &U);
+  LLVM_ABI void RewriteUse(Use &U);
 
   /// Rewrite debug value intrinsics to conform to a new SSA form.
   ///
   /// This will scout out all the debug value intrinsics associated with
   /// the instruction. Anything outside of its block will have its
   /// value set to the new SSA value if available, and undef if not.
-  void UpdateDebugValues(Instruction *I);
-  void UpdateDebugValues(Instruction *I,
-                         SmallVectorImpl<DbgVariableRecord *> &DbgValues);
+  LLVM_ABI void UpdateDebugValues(Instruction *I);
+  LLVM_ABI void
+  UpdateDebugValues(Instruction *I,
+                    SmallVectorImpl<DbgVariableRecord *> &DbgValues);
 
   /// Rewrite a use like \c RewriteUse but handling in-block definitions.
   ///
   /// This version of the method can rewrite uses in the same block as
   /// a definition, because it assumes that all uses of a value are below any
   /// inserted values.
-  void RewriteUseAfterInsertions(Use &U);
+  LLVM_ABI void RewriteUseAfterInsertions(Use &U);
 
 private:
   Value *GetValueAtEndOfBlockInternal(BasicBlock *BB);
@@ -149,8 +152,8 @@ class LoadAndStorePromoter {
   SSAUpdater &SSA;
 
 public:
-  LoadAndStorePromoter(ArrayRef<const Instruction *> Insts,
-                       SSAUpdater &S, StringRef Name = StringRef());
+  LLVM_ABI LoadAndStorePromoter(ArrayRef<const Instruction *> Insts,
+                                SSAUpdater &S, StringRef Name = StringRef());
   virtual ~LoadAndStorePromoter() = default;
 
   /// This does the promotion.
@@ -158,7 +161,7 @@ class LoadAndStorePromoter {
   /// Insts is a list of loads and stores to promote, and Name is the basename
   /// for the PHIs to insert. After this is complete, the loads and stores are
   /// removed from the code.
-  void run(const SmallVectorImpl<Instruction *> &Insts);
+  LLVM_ABI void run(const SmallVectorImpl<Instruction *> &Insts);
 
   /// This hook is invoked after all the stores are found and inserted as
   /// available values.
diff --git a/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h b/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h
index e1663d29c1e3c..243b8419b257d 100644
--- a/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h
+++ b/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -112,8 +113,8 @@ struct ProfiParams {
   const int64_t CostUnlikely = ((int64_t)1) << 30;
 };
 
-void applyFlowInference(const ProfiParams &Params, FlowFunction &Func);
-void applyFlowInference(FlowFunction &Func);
+LLVM_ABI void applyFlowInference(const ProfiParams &Params, FlowFunction &Func);
+LLVM_ABI void applyFlowInference(FlowFunction &Func);
 
 /// Sample profile inference pass.
 template <typename FT> class SampleProfileInference {
diff --git a/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h b/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
index fc2b13356350d..88471a74866fc 100644
--- a/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
+++ b/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
@@ -39,6 +39,7 @@
 #include "llvm/ProfileData/SampleProf.h"
 #include "llvm/ProfileData/SampleProfReader.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/GenericDomTree.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Utils/SampleProfileInference.h"
@@ -149,9 +150,7 @@ class PseudoProbeManager {
   }
 };
 
-
-
-extern cl::opt<bool> SampleProfileUseProfi;
+extern LLVM_ABI cl::opt<bool> SampleProfileUseProfi;
 
 static inline bool skipProfileForFunction(const Function &F) {
   return F.isDeclaration() || !F.hasFnAttribute("use-sample-profile");
diff --git a/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseUtil.h b/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseUtil.h
index bd7175aa96ffe..2c041074178b4 100644
--- a/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseUtil.h
+++ b/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseUtil.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ProfileData/SampleProf.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 using namespace sampleprof;
@@ -25,25 +26,25 @@ using namespace sampleprof;
 class ProfileSummaryInfo;
 class Module;
 
-extern cl::opt<unsigned> SampleProfileMaxPropagateIterations;
-extern cl::opt<unsigned> SampleProfileRecordCoverage;
-extern cl::opt<unsigned> SampleProfileSampleCoverage;
-extern cl::opt<bool> NoWarnSampleUnused;
+extern LLVM_ABI cl::opt<unsigned> SampleProfileMaxPropagateIterations;
+extern LLVM_ABI cl::opt<unsigned> SampleProfileRecordCoverage;
+extern LLVM_ABI cl::opt<unsigned> SampleProfileSampleCoverage;
+extern LLVM_ABI cl::opt<bool> NoWarnSampleUnused;
 
 namespace sampleprofutil {
 
 class SampleCoverageTracker {
 public:
-  bool markSamplesUsed(const FunctionSamples *FS, uint32_t LineOffset,
-                       uint32_t Discriminator, uint64_t Samples);
-  unsigned computeCoverage(unsigned Used, unsigned Total) const;
-  unsigned countUsedRecords(const FunctionSamples *FS,
-                            ProfileSummaryInfo *PSI) const;
-  unsigned countBodyRecords(const FunctionSamples *FS,
-                            ProfileSummaryInfo *PSI) const;
+  LLVM_ABI bool markSamplesUsed(const FunctionSamples *FS, uint32_t LineOffset,
+                                uint32_t Discriminator, uint64_t Samples);
+  LLVM_ABI unsigned computeCoverage(unsigned Used, unsigned Total) const;
+  LLVM_ABI unsigned countUsedRecords(const FunctionSamples *FS,
+                                     ProfileSummaryInfo *PSI) const;
+  LLVM_ABI unsigned countBodyRecords(const FunctionSamples *FS,
+                                     ProfileSummaryInfo *PSI) const;
   uint64_t getTotalUsedSamples() const { return TotalUsedSamples; }
-  uint64_t countBodySamples(const FunctionSamples *FS,
-                            ProfileSummaryInfo *PSI) const;
+  LLVM_ABI uint64_t countBodySamples(const FunctionSamples *FS,
+                                     ProfileSummaryInfo *PSI) const;
 
   void clear() {
     SampleCoverage.clear();
@@ -86,11 +87,11 @@ class SampleCoverageTracker {
 };
 
 /// Return true if the given callsite is hot wrt to hot cutoff threshold.
-bool callsiteIsHot(const FunctionSamples *CallsiteFS, ProfileSummaryInfo *PSI,
-                   bool ProfAccForSymsInList);
+LLVM_ABI bool callsiteIsHot(const FunctionSamples *CallsiteFS,
+                            ProfileSummaryInfo *PSI, bool ProfAccForSymsInList);
 
 /// Create a global variable to flag FSDiscriminators are used.
-void createFSDiscriminatorVariable(Module *M);
+LLVM_ABI void createFSDiscriminatorVariable(Module *M);
 
 } // end of namespace sampleprofutil
 } // end of namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
index 2559d7b89b020..fd4619dc61fad 100644
--- a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
+++ b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
@@ -435,7 +435,7 @@ class SCEVExpander : public SCEVVisitor<SCEVExpander, Value *> {
 
   /// Remove inserted instructions that are dead, e.g. due to InstSimplifyFolder
   /// simplifications. \p Root is assumed to be used and won't be removed.
-  void eraseDeadInstructions(Value *Root);
+  LLVM_ABI void eraseDeadInstructions(Value *Root);
 
 private:
   LLVMContext &getContext() const { return SE.getContext(); }
diff --git a/llvm/include/llvm/Transforms/Utils/SimplifyIndVar.h b/llvm/include/llvm/Transforms/Utils/SimplifyIndVar.h
index bd1718dd8cad7..fc045674c739f 100644
--- a/llvm/include/llvm/Transforms/Utils/SimplifyIndVar.h
+++ b/llvm/include/llvm/Transforms/Utils/SimplifyIndVar.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_TRANSFORMS_UTILS_SIMPLIFYINDVAR_H
 #define LLVM_TRANSFORMS_UTILS_SIMPLIFYINDVAR_H
 
+#include "llvm/Support/Compiler.h"
 #include <utility>
 
 namespace llvm {
@@ -33,7 +34,7 @@ class TargetTransformInfo;
 
 /// Interface for visiting interesting IV users that are recognized but not
 /// simplified by this utility.
-class IVVisitor {
+class LLVM_ABI IVVisitor {
 protected:
   const DominatorTree *DT = nullptr;
 
@@ -52,18 +53,17 @@ class IVVisitor {
 /// where the first entry indicates that the function makes changes and the
 /// second entry indicates that it introduced new opportunities for loop
 /// unswitching.
-std::pair<bool, bool> simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE,
-                                        DominatorTree *DT, LoopInfo *LI,
-                                        const TargetTransformInfo *TTI,
-                                        SmallVectorImpl<WeakTrackingVH> &Dead,
-                                        SCEVExpander &Rewriter,
-                                        IVVisitor *V = nullptr);
+LLVM_ABI std::pair<bool, bool>
+simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE, DominatorTree *DT,
+                  LoopInfo *LI, const TargetTransformInfo *TTI,
+                  SmallVectorImpl<WeakTrackingVH> &Dead, SCEVExpander &Rewriter,
+                  IVVisitor *V = nullptr);
 
 /// SimplifyLoopIVs - Simplify users of induction variables within this
 /// loop. This does not actually change or add IVs.
-bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, DominatorTree *DT,
-                     LoopInfo *LI, const TargetTransformInfo *TTI,
-                     SmallVectorImpl<WeakTrackingVH> &Dead);
+LLVM_ABI bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, DominatorTree *DT,
+                              LoopInfo *LI, const TargetTransformInfo *TTI,
+                              SmallVectorImpl<WeakTrackingVH> &Dead);
 
 /// Collect information about induction variables that are used by sign/zero
 /// extend operations. This information is recorded by CollectExtend and provides
@@ -80,11 +80,12 @@ struct WideIVInfo {
 
 /// Widen Induction Variables - Extend the width of an IV to cover its
 /// widest uses.
-PHINode *createWideIV(const WideIVInfo &WI,
-    LoopInfo *LI, ScalarEvolution *SE, SCEVExpander &Rewriter,
-    DominatorTree *DT, SmallVectorImpl<WeakTrackingVH> &DeadInsts,
-    unsigned &NumElimExt, unsigned &NumWidened,
-    bool HasGuards, bool UsePostIncrementRanges);
+LLVM_ABI PHINode *createWideIV(const WideIVInfo &WI, LoopInfo *LI,
+                               ScalarEvolution *SE, SCEVExpander &Rewriter,
+                               DominatorTree *DT,
+                               SmallVectorImpl<WeakTrackingVH> &DeadInsts,
+                               unsigned &NumElimExt, unsigned &NumWidened,
+                               bool HasGuards, bool UsePostIncrementRanges);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h b/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h
index 64d2512308935..b224eb64920f1 100644
--- a/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h
+++ b/llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h
@@ -16,6 +16,7 @@
 
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class AssumptionCache;
@@ -44,14 +45,14 @@ class FortifiedLibCallSimplifier {
   bool OnlyLowerUnknownSize;
 
 public:
-  FortifiedLibCallSimplifier(const TargetLibraryInfo *TLI,
-                             bool OnlyLowerUnknownSize = false);
+  LLVM_ABI FortifiedLibCallSimplifier(const TargetLibraryInfo *TLI,
+                                      bool OnlyLowerUnknownSize = false);
 
   /// Take the given call instruction and return a more
   /// optimal value to replace the instruction with or 0 if a more
   /// optimal form can't be found.
   /// The call must not be an indirect call.
-  Value *optimizeCall(CallInst *CI, IRBuilderBase &B);
+  LLVM_ABI Value *optimizeCall(CallInst *CI, IRBuilderBase &B);
 
 private:
   Value *optimizeMemCpyChk(CallInst *CI, IRBuilderBase &B);
@@ -127,10 +128,10 @@ class LibCallSimplifier {
   static void eraseFromParentDefault(Instruction *I) { I->eraseFromParent(); }
 
   /// Replace an instruction's uses with a value using our replacer.
-  void replaceAllUsesWith(Instruction *I, Value *With);
+  LLVM_ABI void replaceAllUsesWith(Instruction *I, Value *With);
 
   /// Erase an instruction from its parent with our eraser.
-  void eraseFromParent(Instruction *I);
+  LLVM_ABI void eraseFromParent(Instruction *I);
 
   /// Replace an instruction with a value and erase it from its parent.
   void substituteInParent(Instruction *I, Value *With) {
@@ -139,7 +140,7 @@ class LibCallSimplifier {
   }
 
 public:
-  LibCallSimplifier(
+  LLVM_ABI LibCallSimplifier(
       const DataLayout &DL, const TargetLibraryInfo *TLI, DominatorTree *DT,
       DomConditionCache *DC, AssumptionCache *AC,
       OptimizationRemarkEmitter &ORE, BlockFrequencyInfo *BFI,
@@ -155,7 +156,7 @@ class LibCallSimplifier {
   /// other instructions that use the given instruction were modified
   /// and the given instruction is dead.
   /// The call must not be an indirect call.
-  Value *optimizeCall(CallInst *CI, IRBuilderBase &B);
+  LLVM_ABI Value *optimizeCall(CallInst *CI, IRBuilderBase &B);
 
 private:
   // String and Memory Library Call Optimizations
diff --git a/llvm/include/llvm/Transforms/Utils/StripGCRelocates.h b/llvm/include/llvm/Transforms/Utils/StripGCRelocates.h
index 13e6d8ac26a7f..e856cb067d40a 100644
--- a/llvm/include/llvm/Transforms/Utils/StripGCRelocates.h
+++ b/llvm/include/llvm/Transforms/Utils/StripGCRelocates.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_UTILS_STRIPGCRELOCATES_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -17,7 +18,7 @@ class Function;
 
 class StripGCRelocates : public PassInfoMixin<StripGCRelocates> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/StripNonLineTableDebugInfo.h b/llvm/include/llvm/Transforms/Utils/StripNonLineTableDebugInfo.h
index 20d0aabd29385..989a62764cfb6 100644
--- a/llvm/include/llvm/Transforms/Utils/StripNonLineTableDebugInfo.h
+++ b/llvm/include/llvm/Transforms/Utils/StripNonLineTableDebugInfo.h
@@ -10,6 +10,7 @@
 #define LLVM_TRANSFORMS_UTILS_STRIPNONLINETABLEDEBUGINFO_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -18,7 +19,7 @@ class Module;
 class StripNonLineTableDebugInfoPass
     : public PassInfoMixin<StripNonLineTableDebugInfoPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
index 296d3b755e2c8..3925f9845a1d4 100644
--- a/llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
+++ b/llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
@@ -16,13 +16,14 @@
 
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class UnifyFunctionExitNodesPass
     : public PassInfoMixin<UnifyFunctionExitNodesPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/UnifyLoopExits.h b/llvm/include/llvm/Transforms/Utils/UnifyLoopExits.h
index 0b219cd122226..7cda6fc3c27da 100644
--- a/llvm/include/llvm/Transforms/Utils/UnifyLoopExits.h
+++ b/llvm/include/llvm/Transforms/Utils/UnifyLoopExits.h
@@ -10,12 +10,13 @@
 #define LLVM_TRANSFORMS_UTILS_UNIFYLOOPEXITS_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 class UnifyLoopExitsPass : public PassInfoMixin<UnifyLoopExitsPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Utils/VNCoercion.h b/llvm/include/llvm/Transforms/Utils/VNCoercion.h
index ed4dbad50ee85..e0e482448505a 100644
--- a/llvm/include/llvm/Transforms/Utils/VNCoercion.h
+++ b/llvm/include/llvm/Transforms/Utils/VNCoercion.h
@@ -21,6 +21,8 @@
 #ifndef LLVM_TRANSFORMS_UTILS_VNCOERCION_H
 #define LLVM_TRANSFORMS_UTILS_VNCOERCION_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 class Constant;
 class Function;
@@ -35,8 +37,8 @@ class DataLayout;
 namespace VNCoercion {
 /// Return true if CoerceAvailableValueToLoadType would succeed if it was
 /// called.
-bool canCoerceMustAliasedValueToLoad(Value *StoredVal, Type *LoadTy,
-                                     Function *F);
+LLVM_ABI bool canCoerceMustAliasedValueToLoad(Value *StoredVal, Type *LoadTy,
+                                              Function *F);
 
 /// If we saw a store of a value to memory, and then a load from a must-aliased
 /// pointer of a different type, try to coerce the stored value to the loaded
@@ -44,55 +46,59 @@ bool canCoerceMustAliasedValueToLoad(Value *StoredVal, Type *LoadTy,
 /// IRBuilder used to insert new instructions.
 ///
 /// If we can't do it, return null.
-Value *coerceAvailableValueToLoadType(Value *StoredVal, Type *LoadedTy,
-                                      IRBuilderBase &IRB, Function *F);
+LLVM_ABI Value *coerceAvailableValueToLoadType(Value *StoredVal, Type *LoadedTy,
+                                               IRBuilderBase &IRB, Function *F);
 
 /// This function determines whether a value for the pointer LoadPtr can be
 /// extracted from the store at DepSI.
 ///
 /// On success, it returns the offset into DepSI that extraction would start.
 /// On failure, it returns -1.
-int analyzeLoadFromClobberingStore(Type *LoadTy, Value *LoadPtr,
-                                   StoreInst *DepSI, const DataLayout &DL);
+LLVM_ABI int analyzeLoadFromClobberingStore(Type *LoadTy, Value *LoadPtr,
+                                            StoreInst *DepSI,
+                                            const DataLayout &DL);
 
 /// This function determines whether a value for the pointer LoadPtr can be
 /// extracted from the load at DepLI.
 ///
 /// On success, it returns the offset into DepLI that extraction would start.
 /// On failure, it returns -1.
-int analyzeLoadFromClobberingLoad(Type *LoadTy, Value *LoadPtr, LoadInst *DepLI,
-                                  const DataLayout &DL);
+LLVM_ABI int analyzeLoadFromClobberingLoad(Type *LoadTy, Value *LoadPtr,
+                                           LoadInst *DepLI,
+                                           const DataLayout &DL);
 
 /// This function determines whether a value for the pointer LoadPtr can be
 /// extracted from the memory intrinsic at DepMI.
 ///
 /// On success, it returns the offset into DepMI that extraction would start.
 /// On failure, it returns -1.
-int analyzeLoadFromClobberingMemInst(Type *LoadTy, Value *LoadPtr,
-                                     MemIntrinsic *DepMI, const DataLayout &DL);
+LLVM_ABI int analyzeLoadFromClobberingMemInst(Type *LoadTy, Value *LoadPtr,
+                                              MemIntrinsic *DepMI,
+                                              const DataLayout &DL);
 
 /// If analyzeLoadFromClobberingStore/Load returned an offset, this function
 /// can be used to actually perform the extraction of the bits from the store.
 /// It inserts instructions to do so at InsertPt, and returns the extracted
 /// value.
-Value *getValueForLoad(Value *SrcVal, unsigned Offset, Type *LoadTy,
-                       Instruction *InsertPt, Function *F);
+LLVM_ABI Value *getValueForLoad(Value *SrcVal, unsigned Offset, Type *LoadTy,
+                                Instruction *InsertPt, Function *F);
 // This is the same as getValueForLoad, except it performs no insertion.
 // It only allows constant inputs.
-Constant *getConstantValueForLoad(Constant *SrcVal, unsigned Offset,
-                                  Type *LoadTy, const DataLayout &DL);
+LLVM_ABI Constant *getConstantValueForLoad(Constant *SrcVal, unsigned Offset,
+                                           Type *LoadTy, const DataLayout &DL);
 
 /// If analyzeLoadFromClobberingMemInst returned an offset, this function can be
 /// used to actually perform the extraction of the bits from the memory
 /// intrinsic.  It inserts instructions to do so at InsertPt, and returns the
 /// extracted value.
-Value *getMemInstValueForLoad(MemIntrinsic *SrcInst, unsigned Offset,
-                              Type *LoadTy, Instruction *InsertPt,
-                              const DataLayout &DL);
+LLVM_ABI Value *getMemInstValueForLoad(MemIntrinsic *SrcInst, unsigned Offset,
+                                       Type *LoadTy, Instruction *InsertPt,
+                                       const DataLayout &DL);
 // This is the same as getStoreValueForLoad, except it performs no insertion.
 // It returns nullptr if it cannot produce a constant.
-Constant *getConstantMemInstValueForLoad(MemIntrinsic *SrcInst, unsigned Offset,
-                                         Type *LoadTy, const DataLayout &DL);
+LLVM_ABI Constant *getConstantMemInstValueForLoad(MemIntrinsic *SrcInst,
+                                                  unsigned Offset, Type *LoadTy,
+                                                  const DataLayout &DL);
 }
 }
 #endif
diff --git a/llvm/include/llvm/Transforms/Vectorize/LoopIdiomVectorize.h b/llvm/include/llvm/Transforms/Vectorize/LoopIdiomVectorize.h
index ef6e0e0687809..ffb606ac51ca9 100644
--- a/llvm/include/llvm/Transforms/Vectorize/LoopIdiomVectorize.h
+++ b/llvm/include/llvm/Transforms/Vectorize/LoopIdiomVectorize.h
@@ -10,6 +10,7 @@
 #define LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Scalar/LoopPassManager.h"
 
 namespace llvm {
@@ -29,8 +30,9 @@ class LoopIdiomVectorizePass : public PassInfoMixin<LoopIdiomVectorizePass> {
   LoopIdiomVectorizePass(LoopIdiomVectorizeStyle S, unsigned BCVF)
       : VectorizeStyle(S), ByteCompareVF(BCVF) {}
 
-  PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
-                        LoopStandardAnalysisResults &AR, LPMUpdater &U);
+  LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
+                                 LoopStandardAnalysisResults &AR,
+                                 LPMUpdater &U);
 };
 } // namespace llvm
 #endif // LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H
diff --git a/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h b/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
index f82fc588639dd..2bb0794315f57 100644
--- a/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
+++ b/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
@@ -28,6 +28,7 @@
 
 #include "llvm/ADT/MapVector.h"
 #include "llvm/Analysis/LoopAccessAnalysis.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/TypeSize.h"
 #include "llvm/Transforms/Utils/LoopUtils.h"
 
@@ -76,7 +77,7 @@ class LoopVectorizeHints {
     Hint(const char *Name, unsigned Value, HintKind Kind)
         : Name(Name), Value(Value), Kind(Kind) {}
 
-    bool validate(unsigned Val);
+    LLVM_ABI bool validate(unsigned Val);
   };
 
   /// Vectorization width.
@@ -121,18 +122,18 @@ class LoopVectorizeHints {
     SK_PreferScalable = 1
   };
 
-  LoopVectorizeHints(const Loop *L, bool InterleaveOnlyWhenForced,
-                     OptimizationRemarkEmitter &ORE,
-                     const TargetTransformInfo *TTI = nullptr);
+  LLVM_ABI LoopVectorizeHints(const Loop *L, bool InterleaveOnlyWhenForced,
+                              OptimizationRemarkEmitter &ORE,
+                              const TargetTransformInfo *TTI = nullptr);
 
   /// Mark the loop L as already vectorized by setting the width to 1.
-  void setAlreadyVectorized();
+  LLVM_ABI void setAlreadyVectorized();
 
-  bool allowVectorization(Function *F, Loop *L,
-                          bool VectorizeOnlyWhenForced) const;
+  LLVM_ABI bool allowVectorization(Function *F, Loop *L,
+                                   bool VectorizeOnlyWhenForced) const;
 
   /// Dumps all the hint information.
-  void emitRemarkWithHints() const;
+  LLVM_ABI void emitRemarkWithHints() const;
 
   ElementCount getWidth() const {
     return ElementCount::get(Width.Value, (ScalableForceKind)Scalable.Value ==
@@ -164,14 +165,14 @@ class LoopVectorizeHints {
 
   /// If hints are provided that force vectorization, use the AlwaysPrint
   /// pass name to force the frontend to print the diagnostic.
-  const char *vectorizeAnalysisPassName() const;
+  LLVM_ABI const char *vectorizeAnalysisPassName() const;
 
   /// When enabling loop hints are provided we allow the vectorizer to change
   /// the order of operations that is given by the scalar loop. This is not
   /// enabled by default because can be unsafe or inefficient. For example,
   /// reordering floating-point operations will change the way round-off
   /// error accumulates in the loop.
-  bool allowReordering() const;
+  LLVM_ABI bool allowReordering() const;
 
   bool isPotentiallyUnsafe() const {
     // Avoid FP vectorization if the target is unsure about proper support.
@@ -289,20 +290,20 @@ class LoopVectorizationLegality {
   /// the new code path being implemented for outer loop vectorization
   /// (should be functional for inner loop vectorization) based on VPlan.
   /// If false, good old LV code.
-  bool canVectorize(bool UseVPlanNativePath);
+  LLVM_ABI bool canVectorize(bool UseVPlanNativePath);
 
   /// Returns true if it is legal to vectorize the FP math operations in this
   /// loop. Vectorizing is legal if we allow reordering of FP operations, or if
   /// we can use in-order reductions.
-  bool canVectorizeFPMath(bool EnableStrictReductions);
+  LLVM_ABI bool canVectorizeFPMath(bool EnableStrictReductions);
 
   /// Return true if we can vectorize this loop while folding its tail by
   /// masking.
-  bool canFoldTailByMasking() const;
+  LLVM_ABI bool canFoldTailByMasking() const;
 
   /// Mark all respective loads/stores for masking. Must only be called when
   /// tail-folding is possible.
-  void prepareToFoldTailByMasking();
+  LLVM_ABI void prepareToFoldTailByMasking();
 
   /// Returns the primary induction variable.
   PHINode *getPrimaryInduction() { return PrimaryInduction; }
@@ -329,42 +330,44 @@ class LoopVectorizationLegality {
 
   /// Returns True if given store is a final invariant store of one of the
   /// reductions found in the loop.
-  bool isInvariantStoreOfReduction(StoreInst *SI);
+  LLVM_ABI bool isInvariantStoreOfReduction(StoreInst *SI);
 
   /// Returns True if given address is invariant and is used to store recurrent
   /// expression
-  bool isInvariantAddressOfReduction(Value *V);
+  LLVM_ABI bool isInvariantAddressOfReduction(Value *V);
 
   /// Returns True if V is a Phi node of an induction variable in this loop.
-  bool isInductionPhi(const Value *V) const;
+  LLVM_ABI bool isInductionPhi(const Value *V) const;
 
   /// Returns a pointer to the induction descriptor, if \p Phi is an integer or
   /// floating point induction.
-  const InductionDescriptor *getIntOrFpInductionDescriptor(PHINode *Phi) const;
+  LLVM_ABI const InductionDescriptor *
+  getIntOrFpInductionDescriptor(PHINode *Phi) const;
 
   /// Returns a pointer to the induction descriptor, if \p Phi is pointer
   /// induction.
-  const InductionDescriptor *getPointerInductionDescriptor(PHINode *Phi) const;
+  LLVM_ABI const InductionDescriptor *
+  getPointerInductionDescriptor(PHINode *Phi) const;
 
   /// Returns True if V is a cast that is part of an induction def-use chain,
   /// and had been proven to be redundant under a runtime guard (in other
   /// words, the cast has the same SCEV expression as the induction phi).
-  bool isCastedInductionVariable(const Value *V) const;
+  LLVM_ABI bool isCastedInductionVariable(const Value *V) const;
 
   /// Returns True if V can be considered as an induction variable in this
   /// loop. V can be the induction phi, or some redundant cast in the def-use
   /// chain of the inducion phi.
-  bool isInductionVariable(const Value *V) const;
+  LLVM_ABI bool isInductionVariable(const Value *V) const;
 
   /// Returns True if PN is a reduction variable in this loop.
   bool isReductionVariable(PHINode *PN) const { return Reductions.count(PN); }
 
   /// Returns True if Phi is a fixed-order recurrence in this loop.
-  bool isFixedOrderRecurrence(const PHINode *Phi) const;
+  LLVM_ABI bool isFixedOrderRecurrence(const PHINode *Phi) const;
 
   /// Return true if the block BB needs to be predicated in order for the loop
   /// to be vectorized.
-  bool blockNeedsPredication(const BasicBlock *BB) const;
+  LLVM_ABI bool blockNeedsPredication(const BasicBlock *BB) const;
 
   /// Check if this pointer is consecutive when vectorizing. This happens
   /// when the last index of the GEP is the induction variable, or that the
@@ -376,20 +379,20 @@ class LoopVectorizationLegality {
   /// -1 - Address is consecutive, and decreasing.
   /// NOTE: This method must only be used before modifying the original scalar
   /// loop. Do not use after invoking 'createVectorizedLoopSkeleton' (PR34965).
-  int isConsecutivePtr(Type *AccessTy, Value *Ptr) const;
+  LLVM_ABI int isConsecutivePtr(Type *AccessTy, Value *Ptr) const;
 
   /// Returns true if \p V is invariant across all loop iterations according to
   /// SCEV.
-  bool isInvariant(Value *V) const;
+  LLVM_ABI bool isInvariant(Value *V) const;
 
   /// Returns true if value V is uniform across \p VF lanes, when \p VF is
   /// provided, and otherwise if \p V is invariant across all loop iterations.
-  bool isUniform(Value *V, ElementCount VF) const;
+  LLVM_ABI bool isUniform(Value *V, ElementCount VF) const;
 
   /// A uniform memory op is a load or store which accesses the same memory
   /// location on all \p VF lanes, if \p VF is provided and otherwise if the
   /// memory location is invariant.
-  bool isUniformMemOp(Instruction &I, ElementCount VF) const;
+  LLVM_ABI bool isUniformMemOp(Instruction &I, ElementCount VF) const;
 
   /// Returns the information that we collected about runtime memory check.
   const RuntimePointerChecking *getRuntimePointerChecking() const {
diff --git a/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h b/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
index 877c83291170b..3e342b6f6a201 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
@@ -23,6 +23,7 @@
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -73,13 +74,14 @@ struct SLPVectorizerPass : public PassInfoMixin<SLPVectorizerPass> {
   const DataLayout *DL = nullptr;
 
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   // Glue for old PM.
-  bool runImpl(Function &F, ScalarEvolution *SE_, TargetTransformInfo *TTI_,
-               TargetLibraryInfo *TLI_, AAResults *AA_, LoopInfo *LI_,
-               DominatorTree *DT_, AssumptionCache *AC_, DemandedBits *DB_,
-               OptimizationRemarkEmitter *ORE_);
+  LLVM_ABI bool runImpl(Function &F, ScalarEvolution *SE_,
+                        TargetTransformInfo *TTI_, TargetLibraryInfo *TLI_,
+                        AAResults *AA_, LoopInfo *LI_, DominatorTree *DT_,
+                        AssumptionCache *AC_, DemandedBits *DB_,
+                        OptimizationRemarkEmitter *ORE_);
 
 private:
   /// Collect store and getelementptr instructions and organize them
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
index c65e2cd45ab48..0e9d04c4d42d2 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
@@ -16,6 +16,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/SandboxIR/Constant.h"
 #include "llvm/SandboxIR/Pass.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Vectorize/SandboxVectorizer/InstrMaps.h"
 #include "llvm/Transforms/Vectorize/SandboxVectorizer/Legality.h"
@@ -32,7 +33,7 @@ namespace llvm::sandboxir {
 /// profitable or not. For now profitability is checked at the end of the region
 /// pass pipeline by a dedicated pass that accepts or rejects the IR
 /// transaction, depending on the cost.
-class BottomUpVec final : public RegionPass {
+class LLVM_ABI BottomUpVec final : public RegionPass {
   bool Change = false;
   /// The original instructions that are potentially dead after vectorization.
   DenseSet<Instruction *> DeadInstrCandidates;
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/PackReuse.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/PackReuse.h
index bd0bf244f6b1d..c03af423851a5 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/PackReuse.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/PackReuse.h
@@ -15,6 +15,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/SandboxIR/Pass.h"
 #include "llvm/SandboxIR/Region.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm::sandboxir {
 
@@ -23,7 +24,7 @@ namespace llvm::sandboxir {
 /// This is useful because even though the duplicates will most probably be
 /// optimized away by future passes, their added cost can make vectorization
 /// more conservative than it should be.
-class PackReuse final : public RegionPass {
+class LLVM_ABI PackReuse final : public RegionPass {
   bool Change = false;
 
 public:
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromBBs.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromBBs.h
index 66c9cd42fb878..11f2cc24c76e9 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromBBs.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromBBs.h
@@ -17,10 +17,11 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/SandboxIR/Pass.h"
 #include "llvm/SandboxIR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm::sandboxir {
 
-class RegionsFromBBs final : public FunctionPass {
+class LLVM_ABI RegionsFromBBs final : public FunctionPass {
   // The PM containing the pipeline of region passes.
   RegionPassManager RPM;
 
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.h
index 3d738ac8917ef..8154bfd57dcac 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.h
@@ -17,10 +17,11 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/SandboxIR/Pass.h"
 #include "llvm/SandboxIR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm::sandboxir {
 
-class RegionsFromMetadata final : public FunctionPass {
+class LLVM_ABI RegionsFromMetadata final : public FunctionPass {
   // The PM containing the pipeline of region passes.
   RegionPassManager RPM;
 
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/SeedCollection.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/SeedCollection.h
index 286d971ff4851..55a3f4f11afce 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/SeedCollection.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/SeedCollection.h
@@ -14,6 +14,7 @@
 
 #include "llvm/SandboxIR/Pass.h"
 #include "llvm/SandboxIR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm::sandboxir {
 
@@ -21,7 +22,7 @@ namespace llvm::sandboxir {
 /// like stores to consecutive memory addresses. It then goes over the collected
 /// seeds, slicing them into appropriately sized chunks, creating a Region with
 /// the seed slice as the Auxiliary vector and runs the region pass pipeline.
-class SeedCollection final : public FunctionPass {
+class LLVM_ABI SeedCollection final : public FunctionPass {
 
   /// The PM containing the pipeline of region passes.
   RegionPassManager RPM;
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/TransactionAcceptOrRevert.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/TransactionAcceptOrRevert.h
index fce9cc0c1bde7..4417b7fee6fa1 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/TransactionAcceptOrRevert.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/TransactionAcceptOrRevert.h
@@ -16,10 +16,11 @@
 
 #include "llvm/SandboxIR/Pass.h"
 #include "llvm/SandboxIR/Region.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm::sandboxir {
 
-class TransactionAcceptOrRevert : public RegionPass {
+class LLVM_ABI TransactionAcceptOrRevert : public RegionPass {
 public:
   TransactionAcceptOrRevert() : RegionPass("tr-accept-or-revert") {}
   bool runOnRegion(Region &Rgn, const Analyses &A) final;
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/TransactionSave.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/TransactionSave.h
index 73aafabfd0b0c..be35d7658e31f 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/TransactionSave.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/TransactionSave.h
@@ -14,10 +14,11 @@
 
 #include "llvm/SandboxIR/Pass.h"
 #include "llvm/SandboxIR/Region.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm::sandboxir {
 
-class TransactionSave : public RegionPass {
+class LLVM_ABI TransactionSave : public RegionPass {
 public:
   TransactionSave() : RegionPass("tr-save") {}
   bool runOnRegion(Region &Rgn, const Analyses &A) final;
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.h
index e3d6ecae836fc..0f93e58de4930 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.h
@@ -14,6 +14,7 @@
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/SandboxIR/Pass.h"
+#include "llvm/Support/Compiler.h"
 
 #include <memory>
 
@@ -21,10 +22,10 @@ namespace llvm::sandboxir {
 
 class SandboxVectorizerPassBuilder {
 public:
-  static std::unique_ptr<FunctionPass> createFunctionPass(StringRef Name,
-                                                          StringRef Args);
-  static std::unique_ptr<RegionPass> createRegionPass(StringRef Name,
-                                                      StringRef Args);
+  LLVM_ABI static std::unique_ptr<FunctionPass>
+  createFunctionPass(StringRef Name, StringRef Args);
+  LLVM_ABI static std::unique_ptr<RegionPass> createRegionPass(StringRef Name,
+                                                               StringRef Args);
 };
 
 } // namespace llvm::sandboxir
diff --git a/llvm/include/llvm/Transforms/Vectorize/VectorCombine.h b/llvm/include/llvm/Transforms/Vectorize/VectorCombine.h
index 935f739b7667a..5ae3d0bc0682d 100644
--- a/llvm/include/llvm/Transforms/Vectorize/VectorCombine.h
+++ b/llvm/include/llvm/Transforms/Vectorize/VectorCombine.h
@@ -16,6 +16,7 @@
 #define LLVM_TRANSFORMS_VECTORIZE_VECTORCOMBINE_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -29,7 +30,7 @@ class VectorCombinePass : public PassInfoMixin<VectorCombinePass> {
   VectorCombinePass(bool TryEarlyFoldsOnly = false)
       : TryEarlyFoldsOnly(TryEarlyFoldsOnly) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };
 }
 #endif // LLVM_TRANSFORMS_VECTORIZE_VECTORCOMBINE_H
diff --git a/llvm/include/llvm/WindowsResource/ResourceProcessor.h b/llvm/include/llvm/WindowsResource/ResourceProcessor.h
index 4e99c05f4cd98..50eda7721da42 100644
--- a/llvm/include/llvm/WindowsResource/ResourceProcessor.h
+++ b/llvm/include/llvm/WindowsResource/ResourceProcessor.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -35,8 +36,8 @@ class WindowsResourceProcessor {
   void setVerbose(bool Verbose) { IsVerbose = Verbose; }
   void setNullAtEnd(bool NullAtEnd) { AppendNull = NullAtEnd; }
 
-  Error process(StringRef InputData,
-    std::unique_ptr<raw_fd_ostream> OutputStream);
+  LLVM_ABI Error process(StringRef InputData,
+                         std::unique_ptr<raw_fd_ostream> OutputStream);
 
 private:
   StringRef InputData;
diff --git a/llvm/include/llvm/WindowsResource/ResourceScriptToken.h b/llvm/include/llvm/WindowsResource/ResourceScriptToken.h
index 254121cd318a3..49271f4bd0248 100644
--- a/llvm/include/llvm/WindowsResource/ResourceScriptToken.h
+++ b/llvm/include/llvm/WindowsResource/ResourceScriptToken.h
@@ -17,6 +17,7 @@
 #define LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_SCRIPTTOKEN_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -36,17 +37,17 @@ class RCToken {
 #undef SHORT_TOKEN
   };
 
-  RCToken(RCToken::Kind RCTokenKind, StringRef Value);
+  LLVM_ABI RCToken(RCToken::Kind RCTokenKind, StringRef Value);
 
   // Get an integer value of the integer token.
-  uint32_t intValue() const;
-  bool isLongInt() const;
+  LLVM_ABI uint32_t intValue() const;
+  LLVM_ABI bool isLongInt() const;
 
-  StringRef value() const;
-  Kind kind() const;
+  LLVM_ABI StringRef value() const;
+  LLVM_ABI Kind kind() const;
 
   // Check if a token describes a binary operator.
-  bool isBinaryOp() const;
+  LLVM_ABI bool isBinaryOp() const;
 
 private:
   Kind TokenKind;
diff --git a/llvm/include/llvm/XRay/FDRTraceExpander.h b/llvm/include/llvm/XRay/FDRTraceExpander.h
index ca400c9c567cb..aae88db7fb92e 100644
--- a/llvm/include/llvm/XRay/FDRTraceExpander.h
+++ b/llvm/include/llvm/XRay/FDRTraceExpander.h
@@ -14,12 +14,13 @@
 #define LLVM_XRAY_FDRTRACEEXPANDER_H
 
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/XRay/FDRRecords.h"
 #include "llvm/XRay/XRayRecord.h"
 
 namespace llvm::xray {
 
-class TraceExpander : public RecordVisitor {
+class LLVM_ABI TraceExpander : public RecordVisitor {
   // Type-erased callback for handling individual XRayRecord instances.
   function_ref<void(const XRayRecord &)> C;
   int32_t PID = 0;
diff --git a/llvm/utils/git/ids-check-helper.py b/llvm/utils/git/ids-check-helper.py
index 1f0b983fb2261..ca18f474d8d9f 100755
--- a/llvm/utils/git/ids-check-helper.py
+++ b/llvm/utils/git/ids-check-helper.py
@@ -138,6 +138,7 @@ def update_pr(
             "excludes": [
                 "llvm/include/llvm/Debuginfod/",
                 "llvm/include/llvm/Demangle/",
+                "llvm/include/llvm/Support/AutoConvert.h",
             ],
             "export_macro": "LLVM_ABI",
             "include_header": "llvm/Support/Compiler.h",
@@ -154,7 +155,7 @@ def update_pr(
             "patterns": ["llvm/include/llvm/Demangle/**/*.h"],
             "excludes": [],
             "export_macro": "DEMANGLE_ABI",
-            "include_header": "llvm/Demangle/Visibility.h",
+            "include_header": "DemangleConfig.h",
         },
     ]
 



More information about the llvm-commits mailing list