[llvm] [llvm] Fix most remaining LLVM_ABI annotations (PR #203267)

Fabrice de Gans via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 06:45:20 PDT 2026


https://github.com/Steelskin created https://github.com/llvm/llvm-project/pull/203267

This updates most LLVM_ABI annotations in the public LLVM headers to match expected usage:
* All public APIs should be properly annotated.
* Inlined functions should not be annotated.

These changes were done by a script fixing annotations on LLVM public headers and manually checked.

This effort is tracked in #109483.

>From f169dc46d6b3ac0a493dd4b468fff487cca8a1c4 Mon Sep 17 00:00:00 2001
From: Fabrice de Gans <steelskin at gmail.com>
Date: Thu, 11 Jun 2026 15:43:57 +0200
Subject: [PATCH] [llvm] Fix most remaining LLVM_ABI annotations

This updates most LLVM_ABI annotations in the public LLVM headers to
match expected usage:
* All public APIs should be properly annotated.
* Inlined functions should not be annotated.

These changes were done by a script fixing annotations on LLVM public
headers and manually checked.

This effort is tracked in #109483.
---
 llvm/include/llvm/ABI/FunctionInfo.h          |   2 +-
 llvm/include/llvm/ABI/IRTypeMapper.h          |   2 +-
 llvm/include/llvm/ABI/TargetInfo.h            |  13 +-
 llvm/include/llvm/ABI/Types.h                 |   4 +-
 llvm/include/llvm/ADT/APFloat.h               |   9 +-
 llvm/include/llvm/AsmParser/LLLexer.h         |  10 +-
 llvm/include/llvm/AsmParser/LLParser.h        |  63 +--
 llvm/include/llvm/BinaryFormat/DXContainer.h  |  28 +-
 llvm/include/llvm/CGData/StableFunctionMap.h  |   2 +-
 .../include/llvm/CodeGen/MachineInstrBundle.h |   4 +-
 .../llvm/CodeGen/RegAllocEvictionAdvisor.h    |   4 +-
 llvm/include/llvm/CodeGenTypes/LowLevelType.h |   2 +-
 llvm/include/llvm/DTLTO/DTLTO.h               |  31 +-
 .../Classic/DWARFLinkerDeclContext.h          |   9 +-
 llvm/include/llvm/DWARFLinker/Utils.h         |   2 +-
 llvm/include/llvm/DWP/ELFWriter.h             |  16 +-
 .../Orc/EPCGenericDylibManager.h              |  25 +-
 .../ExecutionEngine/Orc/Shared/OrcRTBridge.h  |   2 +-
 llvm/include/llvm/IR/PrintPasses.h            |   7 +-
 llvm/include/llvm/LTO/LTO.h                   |  30 +-
 .../llvm/LTO/legacy/UpdateCompilerUsed.h      |   4 +-
 llvm/include/llvm/MC/DXContainerInfo.h        |  39 +-
 llvm/include/llvm/MC/MCDwarf.h                |   2 +-
 llvm/include/llvm/MC/MCSchedule.h             |   2 +-
 llvm/include/llvm/MC/MCWin64EH.h              |   3 +-
 llvm/include/llvm/Object/Archive.h            |   4 +-
 llvm/include/llvm/ObjectYAML/BBAddrMapYAML.h  |  16 +-
 llvm/include/llvm/Option/Option.h             |   2 +-
 llvm/include/llvm/Plugins/PassPlugin.h        |   2 +-
 .../llvm/ProfileData/ETMTraceDecoder.h        |   2 +-
 .../llvm/ProfileData/InstrProfReader.h        |   2 +-
 llvm/include/llvm/ProfileData/SampleProf.h    |   2 +-
 .../llvm/Remarks/BitstreamRemarkSerializer.h  |  29 +-
 llvm/include/llvm/Remarks/RemarkStreamer.h    |  11 +-
 llvm/include/llvm/Support/Win64EH.h           |   8 +-
 .../llvm/TargetParser/RISCVTargetParser.h     |   4 +-
 llvm/include/llvm/TargetParser/Triple.h       |   2 +-
 .../llvm/TargetParser/XtensaTargetParser.h    |   9 +-
 llvm/include/llvm/TextAPI/Target.h            |   2 +-
 .../llvm/Transforms/IPO/Instrumentor.h        | 372 ++++++++++--------
 .../Transforms/IPO/InstrumentorConfigFile.h   |  14 +-
 .../Transforms/IPO/InstrumentorStubPrinter.h  |   8 +-
 .../Transforms/InstCombine/InstCombiner.h     |   3 +-
 .../llvm/Transforms/Utils/SSAUpdaterImpl.h    |   2 +-
 .../llvm/Transforms/Utils/TriggerCrashPass.h  |   6 +-
 .../Vectorize/LoopVectorizationLegality.h     |   2 +-
 .../SandboxVectorizer/SandboxVectorizerIR.h   |   6 +-
 llvm/include/llvm/XRay/FDRTraceExpander.h     |   2 +-
 48 files changed, 446 insertions(+), 379 deletions(-)

diff --git a/llvm/include/llvm/ABI/FunctionInfo.h b/llvm/include/llvm/ABI/FunctionInfo.h
index 0ebd0700836e2..3fbbf840bdcec 100644
--- a/llvm/include/llvm/ABI/FunctionInfo.h
+++ b/llvm/include/llvm/ABI/FunctionInfo.h
@@ -234,7 +234,7 @@ class FunctionInfo final : private TrailingObjects<FunctionInfo, ArgEntry> {
 
   unsigned arg_size() const { return NumArgs; }
 
-  static std::unique_ptr<FunctionInfo>
+  LLVM_ABI static std::unique_ptr<FunctionInfo>
   create(CallingConv::ID CC, const Type *ReturnType,
          ArrayRef<const Type *> ArgTypes,
          std::optional<unsigned> NumRequired = std::nullopt);
diff --git a/llvm/include/llvm/ABI/IRTypeMapper.h b/llvm/include/llvm/ABI/IRTypeMapper.h
index 1a77cfd91bca9..0fbb9a550348b 100644
--- a/llvm/include/llvm/ABI/IRTypeMapper.h
+++ b/llvm/include/llvm/ABI/IRTypeMapper.h
@@ -32,7 +32,7 @@ class IRTypeMapper {
 public:
   IRTypeMapper(LLVMContext &Ctx, const DataLayout &DL) : Context(Ctx), DL(DL) {}
 
-  llvm::Type *convertType(const abi::Type *ABIType);
+  LLVM_ABI llvm::Type *convertType(const abi::Type *ABIType);
 
   void clearCache() { TypeCache.clear(); }
 
diff --git a/llvm/include/llvm/ABI/TargetInfo.h b/llvm/include/llvm/ABI/TargetInfo.h
index f4feb3b164fbb..9040c2a909c8c 100644
--- a/llvm/include/llvm/ABI/TargetInfo.h
+++ b/llvm/include/llvm/ABI/TargetInfo.h
@@ -74,14 +74,15 @@ class TargetInfo {
   const ABICompatInfo &getABICompatInfo() const { return CompatInfo; }
 
 protected:
-  RecordArgABI getRecordArgABI(const RecordType *RT) const;
-  RecordArgABI getRecordArgABI(const Type *Ty) const;
-  bool isPromotableInteger(const IntegerType *IT) const;
-  ArgInfo getNaturalAlignIndirect(const Type *Ty, bool ByVal = true) const;
-  bool isAggregateTypeForABI(const Type *Ty) const;
+  LLVM_ABI RecordArgABI getRecordArgABI(const RecordType *RT) const;
+  LLVM_ABI RecordArgABI getRecordArgABI(const Type *Ty) const;
+  LLVM_ABI bool isPromotableInteger(const IntegerType *IT) const;
+  LLVM_ABI ArgInfo getNaturalAlignIndirect(const Type *Ty,
+                                           bool ByVal = true) const;
+  LLVM_ABI bool isAggregateTypeForABI(const Type *Ty) const;
 };
 
-std::unique_ptr<TargetInfo> createBPFTargetInfo(TypeBuilder &TB);
+LLVM_ABI std::unique_ptr<TargetInfo> createBPFTargetInfo(TypeBuilder &TB);
 
 } // namespace abi
 } // namespace llvm
diff --git a/llvm/include/llvm/ABI/Types.h b/llvm/include/llvm/ABI/Types.h
index b66f28212fa4f..7b7efaf5841cc 100644
--- a/llvm/include/llvm/ABI/Types.h
+++ b/llvm/include/llvm/ABI/Types.h
@@ -244,7 +244,7 @@ struct FieldInfo {
         BitFieldWidth(BitFieldWidth), IsBitField(IsBitField),
         IsUnnamedBitfield(IsUnnamedBitField) {}
 
-  bool isEmpty() const;
+  LLVM_ABI bool isEmpty() const;
 };
 
 enum class StructPacking { Default, Packed, ExplicitPacking };
@@ -308,7 +308,7 @@ class RecordType : public Type {
     return VirtualBaseClasses;
   }
 
-  bool isEmpty() const;
+  LLVM_ABI bool isEmpty() const;
 
   static bool classof(const Type *T) {
     return T->getKind() == TypeKind::Record;
diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h
index 07e509baa5f1c..cf6c1276d7592 100644
--- a/llvm/include/llvm/ADT/APFloat.h
+++ b/llvm/include/llvm/ADT/APFloat.h
@@ -677,7 +677,7 @@ class IEEEFloat final {
 
   LLVM_ABI cmpResult compareAbsoluteValue(const IEEEFloat &) const;
 
-  APInt getNaNPayload() const;
+  LLVM_ABI APInt getNaNPayload() const;
 
 private:
   /// \name Simple Queries
@@ -925,7 +925,7 @@ class DoubleAPFloat final {
   LLVM_ABI bool isLargest() const;
   LLVM_ABI bool isInteger() const;
 
-  APInt getNaNPayload() const;
+  LLVM_ABI APInt getNaNPayload() const;
 
   LLVM_ABI void toString(SmallVectorImpl<char> &Str, unsigned FormatPrecision,
                          unsigned FormatMaxPadding,
@@ -1426,7 +1426,7 @@ class APFloat : public APFloatBase {
   ///
   /// If a floating-point exception occurs during conversion, then no error is
   /// returned, and the exception is indicated via opStatus.
-  Expected<opStatus> convertFromString(StringRef, roundingMode);
+  LLVM_ABI Expected<opStatus> convertFromString(StringRef, roundingMode);
   APInt bitcastToAPInt() const {
     APFLOAT_DISPATCH_ON_SEMANTICS(bitcastToAPInt());
   }
@@ -1762,7 +1762,8 @@ inline APFloat maximumnum(const APFloat &A, const APFloat &B) {
 
 /// Implement IEEE 754-2019 exp functions
 LLVM_READONLY
-APFloat exp(const APFloat &X, RoundingMode RM = APFloat::rmNearestTiesToEven);
+LLVM_ABI APFloat exp(const APFloat &X,
+                     RoundingMode RM = APFloat::rmNearestTiesToEven);
 
 inline raw_ostream &operator<<(raw_ostream &OS, const APFloat &V) {
   V.print(OS);
diff --git a/llvm/include/llvm/AsmParser/LLLexer.h b/llvm/include/llvm/AsmParser/LLLexer.h
index 639fd5c06e0a6..a33e7828fb2fc 100644
--- a/llvm/include/llvm/AsmParser/LLLexer.h
+++ b/llvm/include/llvm/AsmParser/LLLexer.h
@@ -62,8 +62,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 +101,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();
@@ -134,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 8eda81d13583b..788b56cb78f08 100644
--- a/llvm/include/llvm/AsmParser/LLParser.h
+++ b/llvm/include/llvm/AsmParser/LLParser.h
@@ -219,19 +219,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; }
 
@@ -297,12 +299,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);
@@ -314,14 +316,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);
     }
@@ -361,8 +364,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))
@@ -476,7 +479,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);
     }
@@ -512,37 +516,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,
@@ -552,7 +557,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);
     }
@@ -562,7 +567,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);
     }
@@ -570,8 +575,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 84c822ddbd2cb..a4e45c3a2fc9c 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -205,7 +205,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 {
@@ -214,14 +214,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();
 
@@ -232,7 +232,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 {
@@ -241,29 +241,29 @@ 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();
 
 LLVM_ABI PartType parsePartType(StringRef S);
 
-bool isDebugProgramPart(PartType PT);
+LLVM_ABI bool isDebugProgramPart(PartType PT);
 
-const char *getProgramPartName(bool IsDebug);
-bool isProgramPart(StringRef PartName);
+LLVM_ABI const char *getProgramPartName(bool IsDebug);
+LLVM_ABI bool isProgramPart(StringRef PartName);
 
 struct VertexPSVInfo {
   uint8_t OutputPositionPresent;
@@ -832,7 +832,7 @@ enum class CompilerVersionFlags : uint32_t {
   LLVM_MARK_AS_BITMASK_ENUM(Internal)
 };
 
-bool isValidCompilerVersionFlags(uint32_t V);
+LLVM_ABI bool isValidCompilerVersionFlags(uint32_t V);
 
 struct CompilerVersionHeader {
   uint16_t Major;
@@ -951,7 +951,7 @@ enum class CompressionType : uint16_t {
 };
 
 LLVM_ABI ArrayRef<EnumEntry<CompressionType>> getCompressionTypes();
-bool isValidCompressionType(uint16_t V);
+LLVM_ABI bool isValidCompressionType(uint16_t V);
 
 struct Header {
   /// Size of the section including this header. Aligned to a 4-byte boundary.
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/MachineInstrBundle.h b/llvm/include/llvm/CodeGen/MachineInstrBundle.h
index ad3347c41854e..2168a485a68fa 100644
--- a/llvm/include/llvm/CodeGen/MachineInstrBundle.h
+++ b/llvm/include/llvm/CodeGen/MachineInstrBundle.h
@@ -298,8 +298,8 @@ LLVM_ABI PhysRegInfo AnalyzePhysRegInBundle(const MachineInstr &MI,
 class FinalizeBundleTestPass
     : public RequiredPassInfoMixin<FinalizeBundleTestPass> {
 public:
-  PreservedAnalyses run(MachineFunction &MF,
-                        MachineFunctionAnalysisManager &MFAM);
+  LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM);
 };
 
 class UnpackMachineBundlesPass
diff --git a/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h b/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h
index 9f8dc0215963b..145a7219e6311 100644
--- a/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h
+++ b/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h
@@ -122,8 +122,8 @@ class RegAllocEvictionAdvisor {
   LLVM_ABI bool isUnusedCalleeSavedReg(MCRegister PhysReg) const;
 
   /// Returns true if this is an urgent eviction.
-  bool isUrgentEviction(const LiveInterval &VirtReg,
-                        const LiveInterval &Intf) const;
+  LLVM_ABI bool isUrgentEviction(const LiveInterval &VirtReg,
+                                 const LiveInterval &Intf) const;
 
 protected:
   LLVM_ABI RegAllocEvictionAdvisor(const MachineFunction &MF,
diff --git a/llvm/include/llvm/CodeGenTypes/LowLevelType.h b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
index c3277ba95f86f..3e1bb672081dd 100644
--- a/llvm/include/llvm/CodeGenTypes/LowLevelType.h
+++ b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
@@ -708,7 +708,7 @@ class LLT {
   static void setUseExtended(bool Enable) { ExtendedLLT = Enable; }
 
 private:
-  static bool ExtendedLLT;
+  LLVM_ABI static bool ExtendedLLT;
 };
 
 inline raw_ostream &operator<<(raw_ostream &OS, const LLT &Ty) {
diff --git a/llvm/include/llvm/DTLTO/DTLTO.h b/llvm/include/llvm/DTLTO/DTLTO.h
index b1e43c3e9346d..54e4a414dae2a 100644
--- a/llvm/include/llvm/DTLTO/DTLTO.h
+++ b/llvm/include/llvm/DTLTO/DTLTO.h
@@ -43,18 +43,17 @@ namespace lto {
 /// set module ID to the on-disk member path; (4) for other archives and FatLTO,
 /// set module ID to a unique path and serialize content in
 /// serializeLTOInputs().
-class DTLTO : public LTO {
+class LLVM_ABI DTLTO : public LTO {
   using Base = LTO;
 
 public:
-  LLVM_ABI DTLTO(Config Conf, unsigned ParallelCodeGenParallelismLevel,
-                 LTOKind LTOMode, IndexWriteCallback OnWrite,
-                 bool EmitIndexFiles, bool EmitImportsFiles,
-                 StringRef LinkerOutputFile, StringRef Distributor,
-                 ArrayRef<StringRef> DistributorArgs, StringRef RemoteCompiler,
-                 ArrayRef<StringRef> RemoteCompilerPrependArgs,
-                 ArrayRef<StringRef> RemoteCompilerArgs,
-                 AddBufferFn AddBufferArg, bool SaveTempsArg)
+  DTLTO(Config Conf, unsigned ParallelCodeGenParallelismLevel, LTOKind LTOMode,
+        IndexWriteCallback OnWrite, bool EmitIndexFiles, bool EmitImportsFiles,
+        StringRef LinkerOutputFile, StringRef Distributor,
+        ArrayRef<StringRef> DistributorArgs, StringRef RemoteCompiler,
+        ArrayRef<StringRef> RemoteCompilerPrependArgs,
+        ArrayRef<StringRef> RemoteCompilerArgs, AddBufferFn AddBufferArg,
+        bool SaveTempsArg)
       : Base(std::move(Conf), writeIndexesBackendInstance(),
              ParallelCodeGenParallelismLevel, LTOMode),
         AddBuffer(AddBufferArg), SaveTemps(SaveTempsArg),
@@ -85,7 +84,7 @@ class DTLTO : public LTO {
   ///    unique path (normalized on Windows) naming a file that will contain the
   ///    member content. The file is created and populated later (see
   ///    serializeInputs()).
-  LLVM_ABI Expected<std::shared_ptr<InputFile>>
+  Expected<std::shared_ptr<InputFile>>
   addInput(std::unique_ptr<InputFile> InputPtr) override;
 
   /// Runs the DTLTO pipeline. This function calls the supplied AddStream
@@ -96,8 +95,7 @@ class DTLTO : public LTO {
   ///
   /// The client will receive at most one callback (via either AddStream or
   /// Cache) for each task identifier.
-  LLVM_ABI virtual Error run(AddStreamFn AddStream,
-                             FileCache Cache = {}) override;
+  virtual Error run(AddStreamFn AddStream, FileCache Cache = {}) override;
 
 private:
   /// DTLTO archives support.
@@ -109,10 +107,10 @@ class DTLTO : public LTO {
   /// Must be called after all input files are added but before optimization
   /// begins. If a file with that name already exists, it is likely a leftover
   /// from a previously terminated linker process and can be safely overwritten.
-  LLVM_ABI Error serializeLTOInputs();
+  Error serializeLTOInputs();
 
   // Remove temporary files created to enable distribution.
-  LLVM_ABI void cleanup() override;
+  void cleanup() override;
 
 public:
   // Mutable and const accessors to the LTO configuration object.
@@ -313,7 +311,7 @@ class DTLTO : public LTO {
 public:
   // Parameters and shared state for DistributorDriver class.
   struct DistributionDriverParams {
-    LLVM_ABI
+
     DistributionDriverParams() = default;
     DistributionDriverParams(StringRef DistributorArg,
                              ArrayRef<StringRef> DistributorArgsArg,
@@ -368,7 +366,6 @@ constexpr StringRef BCError = "DTLTO backend compilation: ";
 
 class DistributionDriver {
 public:
-  LLVM_ABI
   DistributionDriver(DTLTO::DistributionDriverParams &ParamsArg,
                      ArrayRef<DTLTO::Job> JobsArg, bool SaveTempsArg,
                      std::function<void(StringRef)> AddToClenupArg)
@@ -396,7 +393,7 @@ class DistributionDriver {
   ///
   /// \returns Error::success() on success, or an Error if the distributor
   /// fails.
-  Error operator()();
+  LLVM_ABI Error operator()();
 };
 
 } // namespace lto
diff --git a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h
index d16387b28d332..2b10759cb25a6 100644
--- a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h
+++ b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h
@@ -94,7 +94,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 +143,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/DWARFLinker/Utils.h b/llvm/include/llvm/DWARFLinker/Utils.h
index 8bc45706107f7..c8748eacaedb2 100644
--- a/llvm/include/llvm/DWARFLinker/Utils.h
+++ b/llvm/include/llvm/DWARFLinker/Utils.h
@@ -31,7 +31,7 @@ namespace dwarf_linker {
 /// have registered and keeps the classic and parallel DWARFLinkers in
 /// lockstep. Caller passes \p SortedStmtSeqOffsets sorted ascending
 /// and deduplicated.
-void buildStmtSeqOffsetToFirstRowIndex(
+LLVM_ABI void buildStmtSeqOffsetToFirstRowIndex(
     const DWARFDebugLine::LineTable &LT,
     ArrayRef<uint64_t> SortedStmtSeqOffsets,
     DenseMap<uint64_t, uint64_t> &SeqOffToFirstRow);
diff --git a/llvm/include/llvm/DWP/ELFWriter.h b/llvm/include/llvm/DWP/ELFWriter.h
index 5b20ebfb59405..046197330884f 100644
--- a/llvm/include/llvm/DWP/ELFWriter.h
+++ b/llvm/include/llvm/DWP/ELFWriter.h
@@ -21,15 +21,17 @@ namespace llvm {
 namespace ELF {
 
 /// Write an ELF file header (Elf32_Ehdr or Elf64_Ehdr) for an ET_REL object.
-void writeHeader(support::endian::Writer &W, bool Is64Bit, uint8_t OSABI,
-                 uint8_t ABIVersion, uint16_t EMachine, uint32_t EFlags,
-                 uint64_t SHOff, uint16_t SHNum, uint16_t SHStrNdx);
+LLVM_ABI void writeHeader(support::endian::Writer &W, bool Is64Bit,
+                          uint8_t OSABI, uint8_t ABIVersion, uint16_t EMachine,
+                          uint32_t EFlags, uint64_t SHOff, uint16_t SHNum,
+                          uint16_t SHStrNdx);
 
 /// Write a single ELF section header entry (Elf32_Shdr or Elf64_Shdr).
-void writeSectionHeader(support::endian::Writer &W, bool Is64Bit, uint32_t Name,
-                        uint32_t Type, uint64_t Flags, uint64_t Address,
-                        uint64_t Offset, uint64_t Size, uint32_t Link,
-                        uint32_t Info, uint64_t Alignment, uint64_t EntrySize);
+LLVM_ABI void writeSectionHeader(support::endian::Writer &W, bool Is64Bit,
+                                 uint32_t Name, uint32_t Type, uint64_t Flags,
+                                 uint64_t Address, uint64_t Offset,
+                                 uint64_t Size, uint32_t Link, uint32_t Info,
+                                 uint64_t Alignment, uint64_t EntrySize);
 
 } // namespace ELF
 } // namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCGenericDylibManager.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCGenericDylibManager.h
index f5daa2f03bdeb..80aa6441827e2 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/EPCGenericDylibManager.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/EPCGenericDylibManager.h
@@ -31,7 +31,7 @@ namespace orc {
 class JITDylib;
 class SymbolLookupSet;
 
-class EPCGenericDylibManager : public DylibManager {
+class LLVM_ABI EPCGenericDylibManager : public DylibManager {
 public:
   /// Function addresses for memory access.
   struct SymbolAddrs {
@@ -42,19 +42,19 @@ class EPCGenericDylibManager : public DylibManager {
 
   /// Create an EPCGenericDylibManager instance by looking up the LLVM-style
   /// SimpleExecutorDylibManager symbol names in the EPC's bootstrap table.
-  LLVM_ABI static Expected<EPCGenericDylibManager>
+  static Expected<EPCGenericDylibManager>
   CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC);
 
   /// Create an EPCGenericDylibManager using the given implementation symbol
   /// names. These will be looked up in the given JITDylib.
-  LLVM_ABI static Expected<EPCGenericDylibManager>
+  static Expected<EPCGenericDylibManager>
   Create(JITDylib &JD, rt::SimpleExecutorDylibManagerSymbolNames SNs =
                            rt::orc_rt_NativeDylibManagerSPSSymbols);
 
   /// Create an EPCGenericDylibManager using the given implementation symbol
   /// names. These will be looked up in the given ExecutionSession's bootstrap
   /// JITDylib.
-  LLVM_ABI static Expected<EPCGenericDylibManager>
+  static Expected<EPCGenericDylibManager>
   Create(ExecutionSession &ES, rt::SimpleExecutorDylibManagerSymbolNames SNs =
                                    rt::orc_rt_NativeDylibManagerSPSSymbols);
 
@@ -64,7 +64,7 @@ class EPCGenericDylibManager : public DylibManager {
       : EPC(EPC), SAs(SAs) {}
 
   /// Loads the dylib with the given name.
-  LLVM_ABI Expected<tpctypes::DylibHandle> open(StringRef Path, uint64_t Mode);
+  Expected<tpctypes::DylibHandle> open(StringRef Path, uint64_t Mode);
 
   /// Looks up symbols within the given dylib.
   Expected<tpctypes::LookupResult> lookup(tpctypes::DylibHandle H,
@@ -88,23 +88,20 @@ class EPCGenericDylibManager : public DylibManager {
       unique_function<void(Expected<tpctypes::LookupResult>)>;
 
   /// Looks up symbols within the given dylib.
-  LLVM_ABI void lookupAsync(tpctypes::DylibHandle H,
-                            const SymbolLookupSet &Lookup,
-                            SymbolLookupCompleteFn Complete);
+  void lookupAsync(tpctypes::DylibHandle H, const SymbolLookupSet &Lookup,
+                   SymbolLookupCompleteFn Complete);
 
   /// Looks up symbols within the given dylib.
-  LLVM_ABI void lookupAsync(tpctypes::DylibHandle H,
-                            const RemoteSymbolLookupSet &Lookup,
-                            SymbolLookupCompleteFn Complete);
+  void lookupAsync(tpctypes::DylibHandle H, const RemoteSymbolLookupSet &Lookup,
+                   SymbolLookupCompleteFn Complete);
 
   /// Load the dynamic library at the given path and return a handle to it.
   /// If DylibPath is null this function will return the global handle for
   /// the target process.
-  LLVM_ABI Expected<tpctypes::DylibHandle>
-  loadDylib(const char *DylibPath) override;
+  Expected<tpctypes::DylibHandle> loadDylib(const char *DylibPath) override;
 
   /// Search for symbols in the target process.
-  LLVM_ABI void
+  void
   lookupSymbolsAsync(tpctypes::DylibHandle H, const SymbolLookupSet &Symbols,
                      DylibManager::SymbolLookupCompleteFn Complete) override;
 
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
index b7722156a364b..c6a6518bcee4a 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
@@ -90,7 +90,7 @@ struct SimpleExecutorDylibManagerSymbolNames {
 
 /// Default symbol names for the ORC runtime's NativeDylibManager SPS
 /// interface.
-extern const SimpleExecutorDylibManagerSymbolNames
+extern const LLVM_ABI SimpleExecutorDylibManagerSymbolNames
     orc_rt_NativeDylibManagerSPSSymbols;
 
 using SPSSimpleExecutorDylibManagerOpenSignature =
diff --git a/llvm/include/llvm/IR/PrintPasses.h b/llvm/include/llvm/IR/PrintPasses.h
index fabf7ca440c80..234c743b798eb 100644
--- a/llvm/include/llvm/IR/PrintPasses.h
+++ b/llvm/include/llvm/IR/PrintPasses.h
@@ -86,9 +86,10 @@ LLVM_ABI std::string doSystemDiff(StringRef Before, StringRef After,
 // Report a -print-changed diff for one pass over one IR unit (function or
 // module). IsInteresting is isPassInPrintList(PassID); ShouldReport is whether
 // the unit passed all filters (Before/After are only set then).
-void reportChangedIR(StringRef Before, StringRef After, StringRef PassName,
-                     StringRef PassID, StringRef IRName, bool IsInteresting,
-                     bool ShouldReport);
+LLVM_ABI void reportChangedIR(StringRef Before, StringRef After,
+                              StringRef PassName, StringRef PassID,
+                              StringRef IRName, bool IsInteresting,
+                              bool ShouldReport);
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index bfb5388c8c7cb..d6b6864047eac 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -179,8 +179,8 @@ 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 TargetLibraryInfo &TLI,
-                   const RTLIB::RuntimeLibcallsInfo &Libcalls) const;
+    LLVM_ABI bool isLibcall(const TargetLibraryInfo &TLI,
+                            const RTLIB::RuntimeLibcallsInfo &Libcalls) const;
   };
 
   /// A range over the symbols in this InputFile.
@@ -387,7 +387,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:
@@ -408,26 +408,25 @@ 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);
 
   /// Set the list of functions implemented in bitcode that were not extracted
   /// from an archive. Such functions may not be referenced, as they have
   /// lost their opportunity to be defined.
-  LLVM_ABI void setBitcodeLibFuncs(ArrayRef<StringRef> BitcodeLibFuncs);
+  void setBitcodeLibFuncs(ArrayRef<StringRef> BitcodeLibFuncs);
 
   /// 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.
@@ -437,20 +436,19 @@ class LTO {
   ///
   /// The client will receive at most one callback (via either AddStream or
   /// Cache) for each task identifier.
-  LLVM_ABI virtual Error run(AddStreamFn AddStream, FileCache Cache = {});
+  virtual 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);
 
   /// Static method that returns a list of library function symbols that can be
   /// generated by LTO but might not be visible from bitcode symbol table.
   /// Unlike the runtime libcalls, the linker can report to the code generator
   /// which of these are actually available in the link, and the code generator
   /// can then only reference that set of symbols.
-  LLVM_ABI static SmallVector<StringRef>
-  getLibFuncSymbols(const Triple &TT, llvm::StringSaver &Saver);
+  static SmallVector<StringRef> getLibFuncSymbols(const Triple &TT,
+                                                  llvm::StringSaver &Saver);
 
 protected:
   // Called before returning from run().
diff --git a/llvm/include/llvm/LTO/legacy/UpdateCompilerUsed.h b/llvm/include/llvm/LTO/legacy/UpdateCompilerUsed.h
index 25a8c553ccb8c..c0bcdf759ab79 100644
--- a/llvm/include/llvm/LTO/legacy/UpdateCompilerUsed.h
+++ b/llvm/include/llvm/LTO/legacy/UpdateCompilerUsed.h
@@ -24,8 +24,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/DXContainerInfo.h b/llvm/include/llvm/MC/DXContainerInfo.h
index 31462fee02340..a730613b07020 100644
--- a/llvm/include/llvm/MC/DXContainerInfo.h
+++ b/llvm/include/llvm/MC/DXContainerInfo.h
@@ -26,8 +26,8 @@ struct DebugName {
   DebugName(dxbc::DebugNameHeader &Parameters, StringRef Filename)
       : Parameters(Parameters), Filename(Filename) {}
 
-  void setFilename(StringRef DebugFilename);
-  void write(raw_ostream &OS) const;
+  LLVM_ABI void setFilename(StringRef DebugFilename);
+  LLVM_ABI void write(raw_ostream &OS) const;
 };
 
 struct CompilerVersion {
@@ -35,11 +35,11 @@ struct CompilerVersion {
   StringRef CommitSha;
   StringRef CustomVersionString;
 
-  CompilerVersion();
+  LLVM_ABI CompilerVersion();
 
-  void setCommitSha(StringRef CommitSha);
-  void setVersionString(StringRef VersionString);
-  void write(raw_ostream &OS) const;
+  LLVM_ABI void setCommitSha(StringRef CommitSha);
+  LLVM_ABI void setVersionString(StringRef VersionString);
+  LLVM_ABI void write(raw_ostream &OS) const;
 
 private:
   void updateContentSize();
@@ -49,8 +49,8 @@ struct SourceInfo {
   struct Section {
     dxbc::SourceInfo::SectionHeader GenericHeader;
 
-    void computeGenericHeader(uint32_t ContentSize,
-                              dxbc::SourceInfo::SectionType Type);
+    LLVM_ABI void computeGenericHeader(uint32_t ContentSize,
+                                       dxbc::SourceInfo::SectionType Type);
   };
 
   struct SourceContents : public Section {
@@ -59,7 +59,7 @@ struct SourceInfo {
       std::string FileContent;
 
       /// Compute Parameters based on FileContent.
-      void compute();
+      LLVM_ABI void compute();
     };
 
     dxbc::SourceInfo::Contents::Header Parameters;
@@ -67,9 +67,10 @@ struct SourceInfo {
 
     /// Compute Parameters based on the content of Args.
     /// Sizes are computed assuming CompressionType == None.
-    void computeUncompressed(dxbc::SourceInfo::Contents::CompressionType Type);
+    LLVM_ABI void
+    computeUncompressed(dxbc::SourceInfo::Contents::CompressionType Type);
     /// Update Parameters based on the compressed size of section content.
-    void computeFinalSize(uint32_t CompressedSize);
+    LLVM_ABI void computeFinalSize(uint32_t CompressedSize);
   };
 
   struct SourceNames : public Section {
@@ -79,7 +80,7 @@ struct SourceInfo {
       uint16_t EntriesSizeInBytes;
 
       Header() {}
-      Header(const dxbc::SourceInfo::Names::HeaderOnDisk &H);
+      LLVM_ABI Header(const dxbc::SourceInfo::Names::HeaderOnDisk &H);
 
       void swapBytes() {
         sys::swapByteOrder(Flags);
@@ -93,14 +94,14 @@ struct SourceInfo {
       StringRef FileName;
 
       /// Compute Parameters based on FileName and FileContent.
-      void compute(uint32_t ContentSize);
+      LLVM_ABI void compute(uint32_t ContentSize);
     };
 
     Header Parameters;
     SmallVector<Entry> Entries;
 
     /// Compute headers based on the content of entries.
-    void compute();
+    LLVM_ABI void compute();
   };
 
   struct ProgramArgs : public Section {
@@ -110,7 +111,7 @@ struct SourceInfo {
     SmallVector<Entry> Args;
 
     /// Compute Parameters based on Args.
-    void compute();
+    LLVM_ABI void compute();
   };
 
   dxbc::SourceInfo::Header Parameters;
@@ -119,7 +120,7 @@ struct SourceInfo {
   ProgramArgs Args;
 
   /// Compute Parameters based on the content of sections.
-  void compute();
+  LLVM_ABI void compute();
 };
 
 /// This data structure is a helper for reading and writing SourceInfo data.
@@ -143,9 +144,9 @@ struct SourceInfoBuilder {
     Args.emplace_back(Name, Value);
   }
 
-  void computeEntries();
-  void finalize();
-  void write(raw_ostream &OS) const;
+  LLVM_ABI void computeEntries();
+  LLVM_ABI void finalize();
+  LLVM_ABI void write(raw_ostream &OS) const;
 
 private:
   std::optional<dxbc::SourceInfo::Contents::CompressionType> CompressionType;
diff --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h
index 168eba59c11db..10a7035326036 100644
--- a/llvm/include/llvm/MC/MCDwarf.h
+++ b/llvm/include/llvm/MC/MCDwarf.h
@@ -849,7 +849,7 @@ class MCCFIInstruction {
   SMLoc getLoc() const { return Loc; }
 
   /// Replaces in place all references to FromReg with ToReg.
-  void replaceRegister(unsigned FromReg, unsigned ToReg);
+  LLVM_ABI void replaceRegister(unsigned FromReg, unsigned ToReg);
 };
 
 struct MCDwarfFrameInfo {
diff --git a/llvm/include/llvm/MC/MCSchedule.h b/llvm/include/llvm/MC/MCSchedule.h
index 8c21dbd0ae385..7ed86df0a8caf 100644
--- a/llvm/include/llvm/MC/MCSchedule.h
+++ b/llvm/include/llvm/MC/MCSchedule.h
@@ -36,7 +36,7 @@ namespace cl {
 class OptionCategory;
 }
 
-extern cl::OptionCategory MCScheduleOptions;
+extern LLVM_ABI cl::OptionCategory MCScheduleOptions;
 
 /// Define a kind of processor resource that will be modeled by the scheduler.
 struct MCProcResourceDesc {
diff --git a/llvm/include/llvm/MC/MCWin64EH.h b/llvm/include/llvm/MC/MCWin64EH.h
index 27e821ec3ecc0..56584cd239254 100644
--- a/llvm/include/llvm/MC/MCWin64EH.h
+++ b/llvm/include/llvm/MC/MCWin64EH.h
@@ -75,7 +75,8 @@ class LLVM_ABI ARM64UnwindEmitter : public WinEH::UnwindEmitter {
 };
 /// Encode a single WinEH::Instruction as V3 WOD bytes.
 /// Appends encoded bytes to Out.
-void EncodeWOD(const WinEH::Instruction &Inst, SmallVectorImpl<uint8_t> &Out);
+LLVM_ABI void EncodeWOD(const WinEH::Instruction &Inst,
+                        SmallVectorImpl<uint8_t> &Out);
 } // namespace Win64EH
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Object/Archive.h b/llvm/include/llvm/Object/Archive.h
index cdb7d32311e4a..45877335b0778 100644
--- a/llvm/include/llvm/Object/Archive.h
+++ b/llvm/include/llvm/Object/Archive.h
@@ -170,7 +170,7 @@ class LLVM_ABI BigArchiveMemberHeader
 //   char ar_fmag[2];  /* contains backtick (X'79'), followed by new line
 //   (X'15') */
 // };
-class ZOSArchiveMemberHeader : public ArchiveMemberHeader {
+class LLVM_ABI ZOSArchiveMemberHeader : public ArchiveMemberHeader {
 public:
   ZOSArchiveMemberHeader(Archive const *Parent, const char *RawHeaderPtr,
                          uint64_t Size, Error *Err);
@@ -490,7 +490,7 @@ class ZOSArchive : public Archive {
     char Magic[sizeof(ZOSArchiveMagic) - 1]; ///< ZOS archive magic string.
   };
 
-  ZOSArchive(MemoryBufferRef Source, Error &Err);
+  LLVM_ABI ZOSArchive(MemoryBufferRef Source, Error &Err);
 
 private:
   std::string SymbolTableBuf; // __.SYMDEF strings converted to ASCII.
diff --git a/llvm/include/llvm/ObjectYAML/BBAddrMapYAML.h b/llvm/include/llvm/ObjectYAML/BBAddrMapYAML.h
index ddf139b025015..dd672b6b82510 100644
--- a/llvm/include/llvm/ObjectYAML/BBAddrMapYAML.h
+++ b/llvm/include/llvm/ObjectYAML/BBAddrMapYAML.h
@@ -97,31 +97,33 @@ namespace llvm {
 namespace yaml {
 
 template <> struct MappingTraits<BBAddrMapYAML::BBAddrMapEntry> {
-  static void mapping(IO &IO, BBAddrMapYAML::BBAddrMapEntry &E);
+  LLVM_ABI static void mapping(IO &IO, BBAddrMapYAML::BBAddrMapEntry &E);
 };
 
 template <> struct MappingTraits<BBAddrMapYAML::BBAddrMapEntry::BBRangeEntry> {
-  static void mapping(IO &IO, BBAddrMapYAML::BBAddrMapEntry::BBRangeEntry &E);
+  LLVM_ABI static void mapping(IO &IO,
+                               BBAddrMapYAML::BBAddrMapEntry::BBRangeEntry &E);
 };
 
 template <> struct MappingTraits<BBAddrMapYAML::BBAddrMapEntry::BBEntry> {
-  static void mapping(IO &IO, BBAddrMapYAML::BBAddrMapEntry::BBEntry &E);
+  LLVM_ABI static void mapping(IO &IO,
+                               BBAddrMapYAML::BBAddrMapEntry::BBEntry &E);
 };
 
 template <> struct MappingTraits<BBAddrMapYAML::PGOAnalysisMapEntry> {
-  static void mapping(IO &IO, BBAddrMapYAML::PGOAnalysisMapEntry &E);
+  LLVM_ABI static void mapping(IO &IO, BBAddrMapYAML::PGOAnalysisMapEntry &E);
 };
 
 template <>
 struct MappingTraits<BBAddrMapYAML::PGOAnalysisMapEntry::PGOBBEntry> {
-  static void mapping(IO &IO,
-                      BBAddrMapYAML::PGOAnalysisMapEntry::PGOBBEntry &E);
+  LLVM_ABI static void
+  mapping(IO &IO, BBAddrMapYAML::PGOAnalysisMapEntry::PGOBBEntry &E);
 };
 
 template <>
 struct MappingTraits<
     BBAddrMapYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry> {
-  static void
+  LLVM_ABI static void
   mapping(IO &IO,
           BBAddrMapYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry &E);
 };
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/ETMTraceDecoder.h b/llvm/include/llvm/ProfileData/ETMTraceDecoder.h
index 86599fa2fb6d2..7337e5f4d0411 100644
--- a/llvm/include/llvm/ProfileData/ETMTraceDecoder.h
+++ b/llvm/include/llvm/ProfileData/ETMTraceDecoder.h
@@ -33,7 +33,7 @@ class ETMDecoder {
     virtual void processInstructionRange(uint64_t Start, uint64_t End) = 0;
   };
 
-  static Expected<std::unique_ptr<ETMDecoder>>
+  LLVM_ABI static Expected<std::unique_ptr<ETMDecoder>>
   create(const object::Binary &Binary, const Triple &TargetTriple,
          uint8_t TraceID = 0x10);
 
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 534c97b295bc5..a3f25e5402ff9 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..97a2889c862d8 100644
--- a/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h
+++ b/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h
@@ -49,6 +49,7 @@ struct BitstreamRemarkSerializerHelper {
   uint64_t RecordRemarkArgWithDebugLocAbbrevID = 0;
   uint64_t RecordRemarkArgWithoutDebugLocAbbrevID = 0;
 
+  LLVM_ABI
   BitstreamRemarkSerializerHelper(BitstreamRemarkContainerType ContainerType,
                                   raw_ostream &OS);
 
@@ -64,36 +65,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 +138,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 a6f11b4c0b566..77898fba9f29a 100644
--- a/llvm/include/llvm/Remarks/RemarkStreamer.h
+++ b/llvm/include/llvm/Remarks/RemarkStreamer.h
@@ -50,9 +50,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,13 +73,13 @@ 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 NEED to have metadata in an object section
-  bool needsSection() const;
+  LLVM_ABI bool needsSection() const;
   /// Check if the remarks should store associated metadata if suppported
-  bool wantsSection() const;
+  LLVM_ABI bool wantsSection() const;
 };
 } // end namespace remarks
 } // end namespace llvm
diff --git a/llvm/include/llvm/Support/Win64EH.h b/llvm/include/llvm/Support/Win64EH.h
index c42d2ac063b8d..34a88f442d8eb 100644
--- a/llvm/include/llvm/Support/Win64EH.h
+++ b/llvm/include/llvm/Support/Win64EH.h
@@ -308,15 +308,17 @@ struct DecodedUnwindInfoV3 {
 
 /// Return the register name for a 5-bit AMD64 integer register number.
 /// Covers 0-15 (RAX-R15) and 16-31 (R16-R31 for APX).
-StringRef getRegisterNameV3(unsigned Reg);
+LLVM_ABI StringRef getRegisterNameV3(unsigned Reg);
 
 /// Decode one WOD from the pool at the given byte offset.
 /// Returns an error on malformed data.
-Expected<DecodedWOD> decodeWOD(ArrayRef<uint8_t> Pool, unsigned Offset);
+LLVM_ABI Expected<DecodedWOD> decodeWOD(ArrayRef<uint8_t> Pool,
+                                        unsigned Offset);
 
 /// Parse a V3 UNWIND_INFO from raw bytes.
 /// Returns an error on malformed data.
-Expected<DecodedUnwindInfoV3> decodeUnwindInfoV3(ArrayRef<uint8_t> Data);
+LLVM_ABI Expected<DecodedUnwindInfoV3>
+decodeUnwindInfoV3(ArrayRef<uint8_t> Data);
 
 } // End of namespace Win64EH
 } // End of namespace llvm
diff --git a/llvm/include/llvm/TargetParser/RISCVTargetParser.h b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
index a3ff841a88381..0851dbb2a3899 100644
--- a/llvm/include/llvm/TargetParser/RISCVTargetParser.h
+++ b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
@@ -53,7 +53,7 @@ struct ParserError : public ErrorInfo<ParserError, StringError> {
   using ErrorInfo<ParserError, StringError>::ErrorInfo;
   explicit ParserError(const Twine &S)
       : ErrorInfo(S, inconvertibleErrorCode()) {}
-  static char ID;
+  LLVM_ABI static char ID;
 };
 
 /// Warnings encountered during parsing.
@@ -61,7 +61,7 @@ struct ParserWarning : public ErrorInfo<ParserWarning, StringError> {
   using ErrorInfo<ParserWarning, StringError>::ErrorInfo;
   explicit ParserWarning(const Twine &S)
       : ErrorInfo(S, inconvertibleErrorCode()) {}
-  static char ID;
+  LLVM_ABI static char ID;
 };
 
 // We use 64 bits as the known part in the scalable vector types.
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 7b24db121818f..2fb28cfda053f 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -1199,7 +1199,7 @@ class Triple {
   }
 
   /// Returns the default wchar_t size (in bytes) for this target triple.
-  unsigned getDefaultWCharSize() const;
+  LLVM_ABI unsigned getDefaultWCharSize() const;
 
   /// Tests if the environment supports dllimport/export annotations.
   bool hasDLLImportExport() const { return isOSWindows() || isPS(); }
diff --git a/llvm/include/llvm/TargetParser/XtensaTargetParser.h b/llvm/include/llvm/TargetParser/XtensaTargetParser.h
index 41369b1d64499..b45457f69494a 100644
--- a/llvm/include/llvm/TargetParser/XtensaTargetParser.h
+++ b/llvm/include/llvm/TargetParser/XtensaTargetParser.h
@@ -67,10 +67,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/TextAPI/Target.h b/llvm/include/llvm/TextAPI/Target.h
index 5f2b4a1f02553..62aeb376954ff 100644
--- a/llvm/include/llvm/TextAPI/Target.h
+++ b/llvm/include/llvm/TextAPI/Target.h
@@ -38,7 +38,7 @@ class Target {
 
   LLVM_ABI static llvm::Expected<Target> create(StringRef Target);
 
-  LLVM_ABI bool isValid() const {
+  bool isValid() const {
     return Arch != AK_unknown && Platform != PLATFORM_UNKNOWN;
   }
 
diff --git a/llvm/include/llvm/Transforms/IPO/Instrumentor.h b/llvm/include/llvm/Transforms/IPO/Instrumentor.h
index 1cedc111d48fd..b08edfde66fbc 100644
--- a/llvm/include/llvm/Transforms/IPO/Instrumentor.h
+++ b/llvm/include/llvm/Transforms/IPO/Instrumentor.h
@@ -107,31 +107,33 @@ struct IRTArg {
 struct IRTCallDescription {
   /// Construct an instrumentation function description linked to the \p IO
   /// instrumentation opportunity and \p RetTy return type.
-  IRTCallDescription(InstrumentationOpportunity &IO, Type *RetTy = nullptr);
+  LLVM_ABI IRTCallDescription(InstrumentationOpportunity &IO,
+                              Type *RetTy = nullptr);
 
   /// Create the type of the instrumentation function.
-  FunctionType *createLLVMSignature(InstrumentationConfig &IConf,
-                                    InstrumentorIRBuilderTy &IIRB,
-                                    const DataLayout &DL,
-                                    bool ForceIndirection);
+  LLVM_ABI FunctionType *createLLVMSignature(InstrumentationConfig &IConf,
+                                             InstrumentorIRBuilderTy &IIRB,
+                                             const DataLayout &DL,
+                                             bool ForceIndirection);
 
   /// Create a call instruction that calls to the instrumentation function and
   /// passes the corresponding arguments.
-  CallInst *createLLVMCall(Value *&V, InstrumentationConfig &IConf,
-                           InstrumentorIRBuilderTy &IIRB, const DataLayout &DL,
-                           InstrumentationCaches &ICaches);
+  LLVM_ABI CallInst *createLLVMCall(Value *&V, InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB,
+                                    const DataLayout &DL,
+                                    InstrumentationCaches &ICaches);
 
   /// Create a string representation of the function declaration in C. Two
   /// strings are returned: the function definition with direct arguments and
   /// the function with any indirect argument.
-  std::pair<std::string, std::string>
+  LLVM_ABI std::pair<std::string, std::string>
   createCSignature(const InstrumentationConfig &IConf) const;
 
   /// Create a string representation of the function definition in C. The
   /// function body implements a stub and only prints the passed arguments. Two
   /// strings are returned: the function definition with direct arguments and
   /// the function with any indirect argument.
-  std::pair<std::string, std::string> createCBodies() const;
+  LLVM_ABI std::pair<std::string, std::string> createCBodies() const;
 
   /// Return whether the \p IRTA argument can be replaced.
   bool isReplacable(IRTArg &IRTA) const {
@@ -274,13 +276,13 @@ struct BaseConfigurationOption {
 
   /// Create a boolean option with \p Name name, \p Description description and
   /// \p DefaultValue as boolean default value.
-  static std::unique_ptr<BaseConfigurationOption>
+  LLVM_ABI static std::unique_ptr<BaseConfigurationOption>
   createBoolOption(InstrumentationConfig &IC, StringRef Name,
                    StringRef Description, bool DefaultValue);
 
   /// Create a string option with \p Name name, \p Description description and
   /// \p DefaultValue as string default value.
-  static std::unique_ptr<BaseConfigurationOption>
+  LLVM_ABI static std::unique_ptr<BaseConfigurationOption>
   createStringOption(InstrumentationConfig &IC, StringRef Name,
                      StringRef Description, StringRef DefaultValue);
 
@@ -331,7 +333,7 @@ struct BaseConfigurationOption {
 /// information for each instrumented opportunity, including the base
 /// configuration options. Another class may inherit from this one to modify the
 /// default behavior.
-struct InstrumentationConfig {
+struct LLVM_ABI InstrumentationConfig {
   virtual ~InstrumentationConfig() {}
 
   /// Construct an instrumentation configuration with the base options.
@@ -490,14 +492,15 @@ struct InstrumentationOpportunity {
   /// Helpers to cast values, pass them to the runtime, and replace them. To be
   /// used as part of the getter/setter of a InstrumentationOpportunity.
   ///{
-  static Value *forceCast(Value &V, Type &Ty, InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *forceCast(Value &V, Type &Ty,
+                                   InstrumentorIRBuilderTy &IIRB);
   static Value *getValue(Value &V, Type &Ty, InstrumentationConfig &IConf,
                          InstrumentorIRBuilderTy &IIRB) {
     return forceCast(V, Ty, IIRB);
   }
-  static Value *replaceValue(Value &V, Value &NewV,
-                             InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *replaceValue(Value &V, Value &NewV,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
   ///}
 
   /// Instrument the value \p V using the configuration \p IConf, and
@@ -557,10 +560,12 @@ struct InstrumentationOpportunity {
 
   /// Get the opportunity identifier for the pre and post positions.
   ///{
-  static Value *getIdPre(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                         InstrumentorIRBuilderTy &IIRB);
-  static Value *getIdPost(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                          InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getIdPre(Value &V, Type &Ty,
+                                  InstrumentationConfig &IConf,
+                                  InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getIdPost(Value &V, Type &Ty,
+                                   InstrumentationConfig &IConf,
+                                   InstrumentorIRBuilderTy &IIRB);
   ///}
 
   /// Compute the opportunity identifier for the current instrumentation epoch
@@ -641,23 +646,27 @@ struct FunctionIO final : public InstrumentationOpportunity {
 
   StringRef getName() const override { return "function"; }
 
-  void init(InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB,
-            ConfigTy *UserConfig = nullptr);
-
-  static Value *getFunctionAddress(Value &V, Type &Ty,
-                                   InstrumentationConfig &IConf,
-                                   InstrumentorIRBuilderTy &IIRB);
-  static Value *getFunctionName(Value &V, Type &Ty,
-                                InstrumentationConfig &IConf,
-                                InstrumentorIRBuilderTy &IIRB);
-  Value *getNumArguments(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                         InstrumentorIRBuilderTy &IIRB);
-  Value *getArguments(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                      InstrumentorIRBuilderTy &IIRB);
-  Value *setArguments(Value &V, Value &NewV, InstrumentationConfig &IConf,
-                      InstrumentorIRBuilderTy &IIRB);
-  static Value *isMainFunction(Value &V, Type &Ty, InstrumentationConfig &IConf,
+  LLVM_ABI void init(InstrumentationConfig &IConf,
+                     InstrumentorIRBuilderTy &IIRB,
+                     ConfigTy *UserConfig = nullptr);
+
+  LLVM_ABI static Value *getFunctionAddress(Value &V, Type &Ty,
+                                            InstrumentationConfig &IConf,
+                                            InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getFunctionName(Value &V, Type &Ty,
+                                         InstrumentationConfig &IConf,
+                                         InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI Value *getNumArguments(Value &V, Type &Ty,
+                                  InstrumentationConfig &IConf,
+                                  InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI Value *getArguments(Value &V, Type &Ty, InstrumentationConfig &IConf,
+                               InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI Value *setArguments(Value &V, Value &NewV,
+                               InstrumentationConfig &IConf,
                                InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *isMainFunction(Value &V, Type &Ty,
+                                        InstrumentationConfig &IConf,
+                                        InstrumentorIRBuilderTy &IIRB);
 
   static void populate(InstrumentationConfig &IConf,
                        InstrumentorIRBuilderTy &IIRB) {
@@ -687,15 +696,19 @@ struct AllocaIO final : public InstructionIO<Instruction::Alloca> {
   using ConfigTy = BaseConfigTy<ConfigKind>;
   ConfigTy Config;
 
-  void init(InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB,
-            ConfigTy *UserConfig = nullptr);
+  LLVM_ABI void init(InstrumentationConfig &IConf,
+                     InstrumentorIRBuilderTy &IIRB,
+                     ConfigTy *UserConfig = nullptr);
 
-  static Value *getSize(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                        InstrumentorIRBuilderTy &IIRB);
-  static Value *setSize(Value &V, Value &NewV, InstrumentationConfig &IConf,
-                        InstrumentorIRBuilderTy &IIRB);
-  static Value *getAlignment(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getSize(Value &V, Type &Ty,
+                                 InstrumentationConfig &IConf,
+                                 InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *setSize(Value &V, Value &NewV,
+                                 InstrumentationConfig &IConf,
+                                 InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getAlignment(Value &V, Type &Ty,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
 
   static void populate(InstrumentationConfig &IConf,
                        InstrumentorIRBuilderTy &IIRB) {
@@ -721,8 +734,9 @@ struct UnreachableIO final : public InstructionIO<Instruction::Unreachable> {
   using ConfigTy = BaseConfigTy<ConfigKind>;
   ConfigTy Config;
 
-  void init(InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB,
-            ConfigTy *UserConfig = nullptr);
+  LLVM_ABI void init(InstrumentationConfig &IConf,
+                     InstrumentorIRBuilderTy &IIRB,
+                     ConfigTy *UserConfig = nullptr);
 
   static void populate(InstrumentationConfig &IConf,
                        InstrumentorIRBuilderTy &IIRB) {
@@ -750,11 +764,13 @@ struct BasePointerIO final : public InstrumentationOpportunity {
 
   StringRef getName() const override { return "base_pointer_info"; }
 
-  void init(InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB,
-            ConfigTy *UserConfig = nullptr);
+  LLVM_ABI void init(InstrumentationConfig &IConf,
+                     InstrumentorIRBuilderTy &IIRB,
+                     ConfigTy *UserConfig = nullptr);
 
-  static Value *getPointerKind(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                               InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getPointerKind(Value &V, Type &Ty,
+                                        InstrumentationConfig &IConf,
+                                        InstrumentorIRBuilderTy &IIRB);
 
   /// This is necessary to produce a return value that can be used by other IOs.
   /// No replacement is actually happening.
@@ -788,14 +804,16 @@ struct ModuleIO final : public InstrumentationOpportunity {
 
   StringRef getName() const override { return "module"; }
 
-  void init(InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB,
-            ConfigTy *UserConfig = nullptr);
+  LLVM_ABI void init(InstrumentationConfig &IConf,
+                     InstrumentorIRBuilderTy &IIRB,
+                     ConfigTy *UserConfig = nullptr);
 
-  static Value *getModuleName(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                              InstrumentorIRBuilderTy &IIRB);
-  static Value *getTargetTriple(Value &V, Type &Ty,
-                                InstrumentationConfig &IConf,
-                                InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getModuleName(Value &V, Type &Ty,
+                                       InstrumentationConfig &IConf,
+                                       InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getTargetTriple(Value &V, Type &Ty,
+                                         InstrumentationConfig &IConf,
+                                         InstrumentorIRBuilderTy &IIRB);
 
   static void populate(InstrumentationConfig &IConf,
                        InstrumentorIRBuilderTy &IIRB) {
@@ -831,29 +849,36 @@ struct GlobalVarIO final : public InstrumentationOpportunity {
 
   StringRef getName() const override { return "global"; }
 
-  void init(InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB,
-            ConfigTy *UserConfig = nullptr);
-
-  static Value *getAddress(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                           InstrumentorIRBuilderTy &IIRB);
-  static Value *setAddress(Value &V, Value &NewV, InstrumentationConfig &IConf,
-                           InstrumentorIRBuilderTy &IIRB);
-  static Value *getAS(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                      InstrumentorIRBuilderTy &IIRB);
-  static Value *getDeclaredSize(Value &V, Type &Ty,
-                                InstrumentationConfig &IConf,
-                                InstrumentorIRBuilderTy &IIRB);
-  static Value *getAlignment(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
-  static Value *getSymbolName(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                              InstrumentorIRBuilderTy &IIRB);
-  static Value *getInitialValue(Value &V, Type &Ty,
-                                InstrumentationConfig &IConf,
-                                InstrumentorIRBuilderTy &IIRB);
-  static Value *isConstant(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                           InstrumentorIRBuilderTy &IIRB);
-  static Value *isDefinition(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI void init(InstrumentationConfig &IConf,
+                     InstrumentorIRBuilderTy &IIRB,
+                     ConfigTy *UserConfig = nullptr);
+
+  LLVM_ABI static Value *getAddress(Value &V, Type &Ty,
+                                    InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *setAddress(Value &V, Value &NewV,
+                                    InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getAS(Value &V, Type &Ty, InstrumentationConfig &IConf,
+                               InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getDeclaredSize(Value &V, Type &Ty,
+                                         InstrumentationConfig &IConf,
+                                         InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getAlignment(Value &V, Type &Ty,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getSymbolName(Value &V, Type &Ty,
+                                       InstrumentationConfig &IConf,
+                                       InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getInitialValue(Value &V, Type &Ty,
+                                         InstrumentationConfig &IConf,
+                                         InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *isConstant(Value &V, Type &Ty,
+                                    InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *isDefinition(Value &V, Type &Ty,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
 
   static void populate(InstrumentationConfig &IConf,
                        InstrumentorIRBuilderTy &IIRB) {
@@ -902,36 +927,46 @@ struct StoreIO : public InstructionIO<Instruction::Store> {
 
   /// Initialize the store opportunity using the instrumentation config \p IConf
   /// and the user config \p UserConfig.
-  void init(InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB,
-            ConfigTy *UserConfig = nullptr);
+  LLVM_ABI void init(InstrumentationConfig &IConf,
+                     InstrumentorIRBuilderTy &IIRB,
+                     ConfigTy *UserConfig = nullptr);
 
   /// Getters and setters for the arguments of the instrumentation function for
   /// the store opportunity.
   ///{
-  static Value *getPointer(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                           InstrumentorIRBuilderTy &IIRB);
-  static Value *setPointer(Value &V, Value &NewV, InstrumentationConfig &IConf,
-                           InstrumentorIRBuilderTy &IIRB);
-  static Value *getPointerAS(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
-  static Value *getBasePointerInfo(Value &V, Type &Ty,
-                                   InstrumentationConfig &IConf,
-                                   InstrumentorIRBuilderTy &IIRB);
-  static Value *getValue(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                         InstrumentorIRBuilderTy &IIRB);
-  static Value *getValueSize(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
-  static Value *getAlignment(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
-  static Value *getValueTypeId(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                               InstrumentorIRBuilderTy &IIRB);
-  static Value *getAtomicityOrdering(Value &V, Type &Ty,
-                                     InstrumentationConfig &IConf,
-                                     InstrumentorIRBuilderTy &IIRB);
-  static Value *getSyncScopeId(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                               InstrumentorIRBuilderTy &IIRB);
-  static Value *isVolatile(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                           InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getPointer(Value &V, Type &Ty,
+                                    InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *setPointer(Value &V, Value &NewV,
+                                    InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getPointerAS(Value &V, Type &Ty,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getBasePointerInfo(Value &V, Type &Ty,
+                                            InstrumentationConfig &IConf,
+                                            InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getValue(Value &V, Type &Ty,
+                                  InstrumentationConfig &IConf,
+                                  InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getValueSize(Value &V, Type &Ty,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getAlignment(Value &V, Type &Ty,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getValueTypeId(Value &V, Type &Ty,
+                                        InstrumentationConfig &IConf,
+                                        InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getAtomicityOrdering(Value &V, Type &Ty,
+                                              InstrumentationConfig &IConf,
+                                              InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getSyncScopeId(Value &V, Type &Ty,
+                                        InstrumentationConfig &IConf,
+                                        InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *isVolatile(Value &V, Type &Ty,
+                                    InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB);
   ///}
 
   /// Create the store opportunities for pre and post positions. The
@@ -985,36 +1020,46 @@ struct LoadIO : public InstructionIO<Instruction::Load> {
 
   /// Initialize the load opportunity using the instrumentation config \p IConf
   /// and the user config \p UserConfig.
-  void init(InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB,
-            ConfigTy *UserConfig = nullptr);
+  LLVM_ABI void init(InstrumentationConfig &IConf,
+                     InstrumentorIRBuilderTy &IIRB,
+                     ConfigTy *UserConfig = nullptr);
 
   /// Getters and setters for the arguments of the instrumentation function for
   /// the load opportunity.
   ///{
-  static Value *getPointer(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                           InstrumentorIRBuilderTy &IIRB);
-  static Value *setPointer(Value &V, Value &NewV, InstrumentationConfig &IConf,
-                           InstrumentorIRBuilderTy &IIRB);
-  static Value *getPointerAS(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
-  static Value *getBasePointerInfo(Value &V, Type &Ty,
-                                   InstrumentationConfig &IConf,
-                                   InstrumentorIRBuilderTy &IIRB);
-  static Value *getValue(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                         InstrumentorIRBuilderTy &IIRB);
-  static Value *getValueSize(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
-  static Value *getAlignment(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
-  static Value *getValueTypeId(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                               InstrumentorIRBuilderTy &IIRB);
-  static Value *getAtomicityOrdering(Value &V, Type &Ty,
-                                     InstrumentationConfig &IConf,
-                                     InstrumentorIRBuilderTy &IIRB);
-  static Value *getSyncScopeId(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                               InstrumentorIRBuilderTy &IIRB);
-  static Value *isVolatile(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                           InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getPointer(Value &V, Type &Ty,
+                                    InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *setPointer(Value &V, Value &NewV,
+                                    InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getPointerAS(Value &V, Type &Ty,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getBasePointerInfo(Value &V, Type &Ty,
+                                            InstrumentationConfig &IConf,
+                                            InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getValue(Value &V, Type &Ty,
+                                  InstrumentationConfig &IConf,
+                                  InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getValueSize(Value &V, Type &Ty,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getAlignment(Value &V, Type &Ty,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getValueTypeId(Value &V, Type &Ty,
+                                        InstrumentationConfig &IConf,
+                                        InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getAtomicityOrdering(Value &V, Type &Ty,
+                                              InstrumentationConfig &IConf,
+                                              InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getSyncScopeId(Value &V, Type &Ty,
+                                        InstrumentationConfig &IConf,
+                                        InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *isVolatile(Value &V, Type &Ty,
+                                    InstrumentationConfig &IConf,
+                                    InstrumentorIRBuilderTy &IIRB);
   ///}
 
   /// Create the load opportunities for PRE and POST positions.
@@ -1059,20 +1104,25 @@ struct CastIO final
 
   StringRef getName() const override { return "cast"; }
 
-  void init(InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB,
-            ConfigTy *UserConfig = nullptr);
-
-  static Value *getInput(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                         InstrumentorIRBuilderTy &IIRB);
-  static Value *getInputTypeId(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                               InstrumentorIRBuilderTy &IIRB);
-  static Value *getInputSize(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                             InstrumentorIRBuilderTy &IIRB);
-  static Value *getResultTypeId(Value &V, Type &Ty,
-                                InstrumentationConfig &IConf,
-                                InstrumentorIRBuilderTy &IIRB);
-  static Value *getResultSize(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                              InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI void init(InstrumentationConfig &IConf,
+                     InstrumentorIRBuilderTy &IIRB,
+                     ConfigTy *UserConfig = nullptr);
+
+  LLVM_ABI static Value *getInput(Value &V, Type &Ty,
+                                  InstrumentationConfig &IConf,
+                                  InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getInputTypeId(Value &V, Type &Ty,
+                                        InstrumentationConfig &IConf,
+                                        InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getInputSize(Value &V, Type &Ty,
+                                      InstrumentationConfig &IConf,
+                                      InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getResultTypeId(Value &V, Type &Ty,
+                                         InstrumentationConfig &IConf,
+                                         InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getResultSize(Value &V, Type &Ty,
+                                       InstrumentationConfig &IConf,
+                                       InstrumentorIRBuilderTy &IIRB);
 
   static void populate(InstrumentationConfig &IConf,
                        InstrumentorIRBuilderTy &IIRB) {
@@ -1117,15 +1167,19 @@ struct NumericIO final
 
   StringRef getName() const override { return "numeric"; }
 
-  void init(InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB,
-            ConfigTy *UserConfig = nullptr);
+  LLVM_ABI void init(InstrumentationConfig &IConf,
+                     InstrumentorIRBuilderTy &IIRB,
+                     ConfigTy *UserConfig = nullptr);
 
-  static Value *getLeft(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                        InstrumentorIRBuilderTy &IIRB);
-  static Value *getRight(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                         InstrumentorIRBuilderTy &IIRB);
-  static Value *getFlags(Value &V, Type &Ty, InstrumentationConfig &IConf,
-                         InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getLeft(Value &V, Type &Ty,
+                                 InstrumentationConfig &IConf,
+                                 InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getRight(Value &V, Type &Ty,
+                                  InstrumentationConfig &IConf,
+                                  InstrumentorIRBuilderTy &IIRB);
+  LLVM_ABI static Value *getFlags(Value &V, Type &Ty,
+                                  InstrumentationConfig &IConf,
+                                  InstrumentorIRBuilderTy &IIRB);
 
   static void populate(InstrumentationConfig &IConf,
                        InstrumentorIRBuilderTy &IIRB) {
@@ -1161,11 +1215,11 @@ class InstrumentorPass : public RequiredPassInfoMixin<InstrumentorPass> {
   /// provided, a default builder is used. When the configuration is not
   /// provided, it is read from the config file if available and otherwise a
   /// default configuration is used.
-  InstrumentorPass(IntrusiveRefCntPtr<vfs::FileSystem> FS = nullptr,
-                   InstrumentationConfig *IC = nullptr,
-                   InstrumentorIRBuilderTy *IIRB = nullptr);
+  LLVM_ABI InstrumentorPass(IntrusiveRefCntPtr<vfs::FileSystem> FS = nullptr,
+                            InstrumentationConfig *IC = nullptr,
+                            InstrumentorIRBuilderTy *IIRB = nullptr);
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/InstrumentorConfigFile.h b/llvm/include/llvm/Transforms/IPO/InstrumentorConfigFile.h
index 21c5f72dc34db..52fae4d40d70d 100644
--- a/llvm/include/llvm/Transforms/IPO/InstrumentorConfigFile.h
+++ b/llvm/include/llvm/Transforms/IPO/InstrumentorConfigFile.h
@@ -21,17 +21,19 @@ namespace llvm {
 namespace instrumentor {
 
 /// Write the configuration in /p IConf to the file with path \p OutputFile.
-void writeConfigToJSON(InstrumentationConfig &IConf, StringRef OutputFile,
-                       LLVMContext &Ctx);
+LLVM_ABI void writeConfigToJSON(InstrumentationConfig &IConf,
+                                StringRef OutputFile, LLVMContext &Ctx);
 
 /// Read the configuration from the file with path \p InputFile  into /p IConf.
-bool readConfigFromJSON(InstrumentationConfig &IConf, StringRef InputFile,
-                        LLVMContext &Ctx, vfs::FileSystem &FS);
+LLVM_ABI bool readConfigFromJSON(InstrumentationConfig &IConf,
+                                 StringRef InputFile, LLVMContext &Ctx,
+                                 vfs::FileSystem &FS);
 
 /// Read the configuration paths from the file with path \p InputFile into \p
 /// Configs.
-bool readConfigPathsFile(StringRef InputFile, cl::list<std::string> &Configs,
-                         LLVMContext &Ctx, vfs::FileSystem &FS);
+LLVM_ABI bool readConfigPathsFile(StringRef InputFile,
+                                  cl::list<std::string> &Configs,
+                                  LLVMContext &Ctx, vfs::FileSystem &FS);
 
 } // end namespace instrumentor
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/IPO/InstrumentorStubPrinter.h b/llvm/include/llvm/Transforms/IPO/InstrumentorStubPrinter.h
index 18bb2dc1ff111..f4c52c12ec62d 100644
--- a/llvm/include/llvm/Transforms/IPO/InstrumentorStubPrinter.h
+++ b/llvm/include/llvm/Transforms/IPO/InstrumentorStubPrinter.h
@@ -23,13 +23,13 @@ namespace instrumentor {
 /// Print a runtime stub file with the implementation of the instrumentation
 /// runtime functions corresponding to the instrumentation opportunities
 /// enabled.
-void printRuntimeStub(const InstrumentationConfig &IConf,
-                      StringRef StubRuntimeName, LLVMContext &Ctx);
+LLVM_ABI void printRuntimeStub(const InstrumentationConfig &IConf,
+                               StringRef StubRuntimeName, LLVMContext &Ctx);
 
 /// Print the runtime header file that provides helper structures and functions
 /// for reading data generated by the Instrumentor pass.
-void printRuntimeHeader(const InstrumentationConfig &IConf,
-                        StringRef HeaderFileName, LLVMContext &Ctx);
+LLVM_ABI void printRuntimeHeader(const InstrumentationConfig &IConf,
+                                 StringRef HeaderFileName, LLVMContext &Ctx);
 
 } // end namespace instrumentor
 } // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h b/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
index d59ac3af4c59f..8f9c586066298 100644
--- a/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
+++ b/llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
@@ -49,7 +49,8 @@ class TargetTransformInfo;
 class LLVM_LIBRARY_VISIBILITY InstCombiner {
   /// IRBuilder inserter that adds new instructions to the worklist and new
   /// assumptions to the AssumptionCache.
-  class IRBuilderInstCombineInserter final : public IRBuilderDefaultInserter {
+  class LLVM_ABI IRBuilderInstCombineInserter final
+      : public IRBuilderDefaultInserter {
     InstCombiner &IC;
 
   public:
diff --git a/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h b/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
index 69710edcd7de8..dae47e8972e71 100644
--- a/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
+++ b/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
@@ -26,7 +26,7 @@
 
 namespace llvm {
 
-extern cl::opt<unsigned> SSAUpdaterPhiSearchLimit;
+extern LLVM_ABI cl::opt<unsigned> SSAUpdaterPhiSearchLimit;
 
 template<typename T> class SSAUpdaterTraits;
 
diff --git a/llvm/include/llvm/Transforms/Utils/TriggerCrashPass.h b/llvm/include/llvm/Transforms/Utils/TriggerCrashPass.h
index 1321f4e2464f4..157d745eceb99 100644
--- a/llvm/include/llvm/Transforms/Utils/TriggerCrashPass.h
+++ b/llvm/include/llvm/Transforms/Utils/TriggerCrashPass.h
@@ -23,16 +23,16 @@ namespace llvm {
 class TriggerCrashModulePass
     : public OptionalPassInfoMixin<TriggerCrashModulePass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 class TriggerCrashFunctionPass
     : public OptionalPassInfoMixin<TriggerCrashFunctionPass> {
 public:
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
-FunctionPass *createTriggerCrashFunctionPass();
+LLVM_ABI FunctionPass *createTriggerCrashFunctionPass();
 
 } // namespace llvm
 
diff --git a/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h b/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
index 3b565f2a48ff8..e4d40b7423dbd 100644
--- a/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
+++ b/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
@@ -385,7 +385,7 @@ class LoopVectorizationLegality {
 
   /// Add unit stride predicates for memory accesses to PSE, if runtime checks
   /// are allowed and an inner loop is vectorized.
-  void collectUnitStridePredicates() const;
+  LLVM_ABI void collectUnitStridePredicates() 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
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerIR.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerIR.h
index f2988bc8377ec..c52ea23114be0 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerIR.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerIR.h
@@ -38,11 +38,11 @@ class PackInst final : public Instruction {
       : Instruction(ClassID::Pack, Opcode::Pack, LLVMInstrs[0], Ctx) {}
 
 public:
-  static Value *create(ArrayRef<Value *> PackOps, InsertPosition InsertBefore,
-                       SBVecContext &Ctx);
+  LLVM_ABI static Value *create(ArrayRef<Value *> PackOps,
+                                InsertPosition InsertBefore, SBVecContext &Ctx);
 
   /// For isa/dyn_cast.
-  static bool classof(const Value *From);
+  LLVM_ABI static bool classof(const Value *From);
 };
 
 class SBVecContext : public Context {
diff --git a/llvm/include/llvm/XRay/FDRTraceExpander.h b/llvm/include/llvm/XRay/FDRTraceExpander.h
index ca400c9c567cb..95325b5cb3dc6 100644
--- a/llvm/include/llvm/XRay/FDRTraceExpander.h
+++ b/llvm/include/llvm/XRay/FDRTraceExpander.h
@@ -19,7 +19,7 @@
 
 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;



More information about the llvm-commits mailing list