[llvm] 150d466 - [llvm] annotate interfaces in FileCheck, FrontEnd, and FuzzMutate libraries for DLL export (#141864)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 09:38:01 PDT 2025


Author: Andrew Rogers
Date: 2025-06-02T09:37:57-07:00
New Revision: 150d466994050c52db76b64ff2ce44cddddbcad4

URL: https://github.com/llvm/llvm-project/commit/150d466994050c52db76b64ff2ce44cddddbcad4
DIFF: https://github.com/llvm/llvm-project/commit/150d466994050c52db76b64ff2ce44cddddbcad4.diff

LOG: [llvm] annotate interfaces in FileCheck, FrontEnd, and FuzzMutate libraries for DLL export (#141864)

## Purpose

This patch is one in a series of code-mods that annotate LLVM’s public
interface for export. This patch annotates the `llvm/FileCheck`,
`llvm/FrontEnd`, and `llvm/FuzzMutate libraries. These annotations
currently have no meaningful impact on the LLVM build; however, they are
a prerequisite to support an LLVM Windows DLL (shared library) build.

## Background

This effort is tracked in #109483. Additional context is provided in
[this
discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307),
and documentation for `LLVM_ABI` and related annotations is found in the
LLVM repo
[here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst).

The bulk of these changes were generated automatically using the
[Interface Definition Scanner (IDS)](https://github.com/compnerd/ids)
tool, followed formatting with `git clang-format`.

The following manual adjustments were also applied after running IDS on
Linux:
- Add #include "llvm/Support/Compiler.h" where it was not auto-added by
IDS due to no pre-existing block of include statements.

## Validation

Local builds and tests to validate cross-platform compatibility. This
included llvm, clang, and lldb on the following configurations:

- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
- Darwin with Clang

Added: 
    

Modified: 
    llvm/include/llvm/FileCheck/FileCheck.h
    llvm/include/llvm/Frontend/Atomic/Atomic.h
    llvm/include/llvm/Frontend/Driver/CodeGenOptions.h
    llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
    llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h
    llvm/include/llvm/Frontend/Offloading/Utility.h
    llvm/include/llvm/Frontend/OpenMP/OMP.h
    llvm/include/llvm/Frontend/OpenMP/OMPContext.h
    llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    llvm/include/llvm/FuzzMutate/FuzzerCLI.h
    llvm/include/llvm/FuzzMutate/IRMutator.h
    llvm/include/llvm/FuzzMutate/OpDescriptor.h
    llvm/include/llvm/FuzzMutate/Operations.h
    llvm/include/llvm/FuzzMutate/RandomIRBuilder.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/FileCheck/FileCheck.h b/llvm/include/llvm/FileCheck/FileCheck.h
index 72d0b91b27ad0..b44ed8ed3f839 100644
--- a/llvm/include/llvm/FileCheck/FileCheck.h
+++ b/llvm/include/llvm/FileCheck/FileCheck.h
@@ -14,6 +14,7 @@
 #define LLVM_FILECHECK_FILECHECK_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Regex.h"
 #include "llvm/Support/SMLoc.h"
 #include <bitset>
@@ -91,7 +92,7 @@ class FileCheckType {
   operator FileCheckKind() const { return Kind; }
 
   int getCount() const { return Count; }
-  FileCheckType &setCount(int C);
+  LLVM_ABI FileCheckType &setCount(int C);
 
   bool isLiteralMatch() const {
     return Modifiers[FileCheckKindModifier::ModifierLiteral];
@@ -102,10 +103,10 @@ class FileCheckType {
   }
 
   // \returns a description of \p Prefix.
-  std::string getDescription(StringRef Prefix) const;
+  LLVM_ABI std::string getDescription(StringRef Prefix) const;
 
   // \returns a description of \p Modifiers.
-  std::string getModifiersDescription() const;
+  LLVM_ABI std::string getModifiersDescription() const;
 };
 } // namespace Check
 
@@ -167,9 +168,10 @@ struct FileCheckDiag {
   /// A note to replace the one normally indicated by MatchTy, or the empty
   /// string if none.
   std::string Note;
-  FileCheckDiag(const SourceMgr &SM, const Check::FileCheckType &CheckTy,
-                SMLoc CheckLoc, MatchType MatchTy, SMRange InputRange,
-                StringRef Note = "");
+  LLVM_ABI FileCheckDiag(const SourceMgr &SM,
+                         const Check::FileCheckType &CheckTy, SMLoc CheckLoc,
+                         MatchType MatchTy, SMRange InputRange,
+                         StringRef Note = "");
 };
 
 class FileCheckPatternContext;
@@ -183,8 +185,8 @@ class FileCheck {
   std::vector<FileCheckString> CheckStrings;
 
 public:
-  explicit FileCheck(FileCheckRequest Req);
-  ~FileCheck();
+  LLVM_ABI explicit FileCheck(FileCheckRequest Req);
+  LLVM_ABI ~FileCheck();
 
   /// Reads the check file from \p Buffer and records the expected strings it
   /// contains. Errors are reported against \p SM.
@@ -192,24 +194,24 @@ class FileCheck {
   /// If \p ImpPatBufferIDRange, then the range (inclusive start, exclusive end)
   /// of IDs for source buffers added to \p SM for implicit patterns are
   /// recorded in it.  The range is empty if there are none.
-  bool
+  LLVM_ABI bool
   readCheckFile(SourceMgr &SM, StringRef Buffer,
                 std::pair<unsigned, unsigned> *ImpPatBufferIDRange = nullptr);
 
-  bool ValidateCheckPrefixes();
+  LLVM_ABI bool ValidateCheckPrefixes();
 
   /// Canonicalizes whitespaces in the file. Line endings are replaced with
   /// UNIX-style '\n'.
-  StringRef CanonicalizeFile(MemoryBuffer &MB,
-                             SmallVectorImpl<char> &OutputBuffer);
+  LLVM_ABI StringRef CanonicalizeFile(MemoryBuffer &MB,
+                                      SmallVectorImpl<char> &OutputBuffer);
 
   /// Checks the input to FileCheck provided in the \p Buffer against the
   /// expected strings read from the check file and record diagnostics emitted
   /// in \p Diags. Errors are recorded against \p SM.
   ///
   /// \returns false if the input fails to satisfy the checks.
-  bool checkInput(SourceMgr &SM, StringRef Buffer,
-                  std::vector<FileCheckDiag> *Diags = nullptr);
+  LLVM_ABI bool checkInput(SourceMgr &SM, StringRef Buffer,
+                           std::vector<FileCheckDiag> *Diags = nullptr);
 };
 
 } // namespace llvm

diff  --git a/llvm/include/llvm/Frontend/Atomic/Atomic.h b/llvm/include/llvm/Frontend/Atomic/Atomic.h
index 0231e01344bfe..8addcd388d734 100644
--- a/llvm/include/llvm/Frontend/Atomic/Atomic.h
+++ b/llvm/include/llvm/Frontend/Atomic/Atomic.h
@@ -11,6 +11,7 @@
 
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Module.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class AtomicInfo {
@@ -55,13 +56,13 @@ class AtomicInfo {
 
   LLVMContext &getLLVMContext() const { return Builder->getContext(); }
 
-  bool shouldCastToInt(Type *ValTy, bool CmpXchg);
+  LLVM_ABI bool shouldCastToInt(Type *ValTy, bool CmpXchg);
 
-  Value *EmitAtomicLoadOp(AtomicOrdering AO, bool IsVolatile,
-                          bool CmpXchg = false);
+  LLVM_ABI Value *EmitAtomicLoadOp(AtomicOrdering AO, bool IsVolatile,
+                                   bool CmpXchg = false);
 
-  CallInst *EmitAtomicLibcall(StringRef fnName, Type *ResultType,
-                              ArrayRef<Value *> Args);
+  LLVM_ABI CallInst *EmitAtomicLibcall(StringRef fnName, Type *ResultType,
+                                       ArrayRef<Value *> Args);
 
   Value *getAtomicSizeValue() const {
     LLVMContext &ctx = getLLVMContext();
@@ -73,7 +74,7 @@ class AtomicInfo {
                             AtomicSizeInBits / BitsPerByte);
   }
 
-  std::pair<Value *, Value *>
+  LLVM_ABI std::pair<Value *, Value *>
   EmitAtomicCompareExchangeLibcall(Value *ExpectedVal, Value *DesiredVal,
                                    AtomicOrdering Success,
                                    AtomicOrdering Failure);
@@ -86,19 +87,20 @@ class AtomicInfo {
     return castToAtomicIntPointer(getAtomicPointer());
   }
 
-  std::pair<Value *, Value *>
+  LLVM_ABI std::pair<Value *, Value *>
   EmitAtomicCompareExchangeOp(Value *ExpectedVal, Value *DesiredVal,
                               AtomicOrdering Success, AtomicOrdering Failure,
                               bool IsVolatile = false, bool IsWeak = false);
 
-  std::pair<Value *, Value *>
+  LLVM_ABI std::pair<Value *, Value *>
   EmitAtomicCompareExchange(Value *ExpectedVal, Value *DesiredVal,
                             AtomicOrdering Success, AtomicOrdering Failure,
                             bool IsVolatile, bool IsWeak);
 
-  std::pair<LoadInst *, AllocaInst *> EmitAtomicLoadLibcall(AtomicOrdering AO);
+  LLVM_ABI std::pair<LoadInst *, AllocaInst *>
+  EmitAtomicLoadLibcall(AtomicOrdering AO);
 
-  void EmitAtomicStoreLibcall(AtomicOrdering AO, Value *Source);
+  LLVM_ABI void EmitAtomicStoreLibcall(AtomicOrdering AO, Value *Source);
 };
 } // end namespace llvm
 

diff  --git a/llvm/include/llvm/Frontend/Driver/CodeGenOptions.h b/llvm/include/llvm/Frontend/Driver/CodeGenOptions.h
index ee52645f2e51b..e8e70c0e126a9 100644
--- a/llvm/include/llvm/Frontend/Driver/CodeGenOptions.h
+++ b/llvm/include/llvm/Frontend/Driver/CodeGenOptions.h
@@ -13,6 +13,8 @@
 #ifndef LLVM_FRONTEND_DRIVER_CODEGENOPTIONS_H
 #define LLVM_FRONTEND_DRIVER_CODEGENOPTIONS_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 class Triple;
 class TargetLibraryInfoImpl;
@@ -46,8 +48,8 @@ enum class VectorLibrary {
   AMDLIBM             // AMD vector math library.
 };
 
-TargetLibraryInfoImpl *createTLII(const llvm::Triple &TargetTriple,
-                                  VectorLibrary Veclib);
+LLVM_ABI TargetLibraryInfoImpl *createTLII(const llvm::Triple &TargetTriple,
+                                           VectorLibrary Veclib);
 
 } // end namespace llvm::driver
 

diff  --git a/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h b/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
index 4d4fb261595ad..68f3cb97db859 100644
--- a/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
+++ b/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
@@ -15,6 +15,7 @@
 #define LLVM_FRONTEND_HLSL_HLSLROOTSIGNATURE_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DXILABI.h"
 #include "llvm/Support/raw_ostream.h"
 #include <variant>
@@ -150,7 +151,7 @@ struct DescriptorTable {
   uint32_t NumClauses = 0;
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const DescriptorTable &Table);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const DescriptorTable &Table);
 
 static const uint32_t NumDescriptorsUnbounded = 0xffffffff;
 static const uint32_t DescriptorTableOffsetAppend = 0xffffffff;
@@ -180,7 +181,8 @@ struct DescriptorTableClause {
   }
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const DescriptorTableClause &Clause);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS,
+                                 const DescriptorTableClause &Clause);
 
 struct StaticSampler {
   Register Reg;
@@ -217,7 +219,7 @@ using RootElement =
     std::variant<RootFlags, RootConstants, RootDescriptor, DescriptorTable,
                  DescriptorTableClause, StaticSampler>;
 
-void dumpRootElements(raw_ostream &OS, ArrayRef<RootElement> Elements);
+LLVM_ABI void dumpRootElements(raw_ostream &OS, ArrayRef<RootElement> Elements);
 
 class MetadataBuilder {
 public:
@@ -228,7 +230,7 @@ class MetadataBuilder {
   ///
   /// Accumulates the root signature and returns the Metadata node that is just
   /// a list of all the elements
-  MDNode *BuildRootSignature();
+  LLVM_ABI MDNode *BuildRootSignature();
 
 private:
   /// Define the various builders for the 
diff erent metadata types

diff  --git a/llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h b/llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h
index 79309251c3b6b..6b9da06707261 100644
--- a/llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h
+++ b/llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/IR/Module.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace offloading {
@@ -22,11 +23,10 @@ using EntryArrayTy = std::pair<GlobalVariable *, GlobalVariable *>;
 /// \param Suffix An optional suffix appended to the emitted symbols.
 /// \param Relocatable Indicate if we need to change the offloading section to
 /// create a relocatable object.
-llvm::Error wrapOpenMPBinaries(llvm::Module &M,
-                               llvm::ArrayRef<llvm::ArrayRef<char>> Images,
-                               EntryArrayTy EntryArray,
-                               llvm::StringRef Suffix = "",
-                               bool Relocatable = false);
+LLVM_ABI llvm::Error
+wrapOpenMPBinaries(llvm::Module &M, llvm::ArrayRef<llvm::ArrayRef<char>> Images,
+                   EntryArrayTy EntryArray, llvm::StringRef Suffix = "",
+                   bool Relocatable = false);
 
 /// Wraps the input fatbinary image into the module \p M as global symbols and
 /// registers the images with the CUDA runtime.
@@ -35,9 +35,11 @@ llvm::Error wrapOpenMPBinaries(llvm::Module &M,
 /// \param Suffix An optional suffix appended to the emitted symbols.
 /// \param EmitSurfacesAndTextures Whether to emit surface and textures
 /// registration code. It defaults to false.
-llvm::Error wrapCudaBinary(llvm::Module &M, llvm::ArrayRef<char> Images,
-                           EntryArrayTy EntryArray, llvm::StringRef Suffix = "",
-                           bool EmitSurfacesAndTextures = true);
+LLVM_ABI llvm::Error wrapCudaBinary(llvm::Module &M,
+                                    llvm::ArrayRef<char> Images,
+                                    EntryArrayTy EntryArray,
+                                    llvm::StringRef Suffix = "",
+                                    bool EmitSurfacesAndTextures = true);
 
 /// Wraps the input bundled image into the module \p M as global symbols and
 /// registers the images with the HIP runtime.
@@ -46,9 +48,10 @@ llvm::Error wrapCudaBinary(llvm::Module &M, llvm::ArrayRef<char> Images,
 /// \param Suffix An optional suffix appended to the emitted symbols.
 /// \param EmitSurfacesAndTextures Whether to emit surface and textures
 /// registration code. It defaults to false.
-llvm::Error wrapHIPBinary(llvm::Module &M, llvm::ArrayRef<char> Images,
-                          EntryArrayTy EntryArray, llvm::StringRef Suffix = "",
-                          bool EmitSurfacesAndTextures = true);
+LLVM_ABI llvm::Error wrapHIPBinary(llvm::Module &M, llvm::ArrayRef<char> Images,
+                                   EntryArrayTy EntryArray,
+                                   llvm::StringRef Suffix = "",
+                                   bool EmitSurfacesAndTextures = true);
 } // namespace offloading
 } // namespace llvm
 

diff  --git a/llvm/include/llvm/Frontend/Offloading/Utility.h b/llvm/include/llvm/Frontend/Offloading/Utility.h
index 7b717a4733b79..f8a2b1237b5e1 100644
--- a/llvm/include/llvm/Frontend/Offloading/Utility.h
+++ b/llvm/include/llvm/Frontend/Offloading/Utility.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_FRONTEND_OFFLOADING_UTILITY_H
 #define LLVM_FRONTEND_OFFLOADING_UTILITY_H
 
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <memory>
 
@@ -67,7 +68,7 @@ enum OffloadEntryKindFlag : uint32_t {
 
 /// Returns the type of the offloading entry we use to store kernels and
 /// globals that will be registered with the offloading runtime.
-StructType *getEntryTy(Module &M);
+LLVM_ABI StructType *getEntryTy(Module &M);
 
 /// Create an offloading section struct used to register this global at
 /// runtime.
@@ -81,22 +82,23 @@ StructType *getEntryTy(Module &M);
 /// \param Data Extra data storage associated with the entry.
 /// \param SectionName The section this entry will be placed at.
 /// \param AuxAddr An extra pointer if needed.
-void emitOffloadingEntry(Module &M, object::OffloadKind Kind, Constant *Addr,
-                         StringRef Name, uint64_t Size, uint32_t Flags,
-                         uint64_t Data, Constant *AuxAddr = nullptr,
-                         StringRef SectionName = "llvm_offload_entries");
+LLVM_ABI void
+emitOffloadingEntry(Module &M, object::OffloadKind Kind, Constant *Addr,
+                    StringRef Name, uint64_t Size, uint32_t Flags,
+                    uint64_t Data, Constant *AuxAddr = nullptr,
+                    StringRef SectionName = "llvm_offload_entries");
 
 /// Create a constant struct initializer used to register this global at
 /// runtime.
 /// \return the constant struct and the global variable holding the symbol name.
-std::pair<Constant *, GlobalVariable *>
+LLVM_ABI std::pair<Constant *, GlobalVariable *>
 getOffloadingEntryInitializer(Module &M, object::OffloadKind Kind,
                               Constant *Addr, StringRef Name, uint64_t Size,
                               uint32_t Flags, uint64_t Data, Constant *AuxAddr);
 
 /// Creates a pair of globals used to iterate the array of offloading entries by
 /// accessing the section variables provided by the linker.
-std::pair<GlobalVariable *, GlobalVariable *>
+LLVM_ABI std::pair<GlobalVariable *, GlobalVariable *>
 getOffloadEntryArray(Module &M, StringRef SectionName = "llvm_offload_entries");
 
 namespace amdgpu {
@@ -109,8 +111,8 @@ namespace amdgpu {
 /// and is compatible with either '+' or '-'. The HSA runtime returns this
 /// information using the target-id, while we use the ELF header to determine
 /// these features.
-bool isImageCompatibleWithEnv(StringRef ImageArch, uint32_t ImageFlags,
-                              StringRef EnvTargetID);
+LLVM_ABI bool isImageCompatibleWithEnv(StringRef ImageArch, uint32_t ImageFlags,
+                                       StringRef EnvTargetID);
 
 /// Struct for holding metadata related to AMDGPU kernels, for more information
 /// about the metadata and its meaning see:
@@ -149,15 +151,16 @@ struct AMDGPUKernelMetaData {
 
 /// Reads AMDGPU specific metadata from the ELF file and propagates the
 /// KernelInfoMap.
-Error getAMDGPUMetaDataFromImage(MemoryBufferRef MemBuffer,
-                                 StringMap<AMDGPUKernelMetaData> &KernelInfoMap,
-                                 uint16_t &ELFABIVersion);
+LLVM_ABI Error getAMDGPUMetaDataFromImage(
+    MemoryBufferRef MemBuffer, StringMap<AMDGPUKernelMetaData> &KernelInfoMap,
+    uint16_t &ELFABIVersion);
 } // namespace amdgpu
 
 namespace intel {
 /// Containerizes an offloading binary into the ELF binary format expected by
 /// the Intel runtime offload plugin.
-Error containerizeOpenMPSPIRVImage(std::unique_ptr<MemoryBuffer> &Binary);
+LLVM_ABI Error
+containerizeOpenMPSPIRVImage(std::unique_ptr<MemoryBuffer> &Binary);
 } // namespace intel
 } // namespace offloading
 } // namespace llvm

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMP.h b/llvm/include/llvm/Frontend/OpenMP/OMP.h
index c3381705093ad..35dafc6d246f0 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.h
@@ -14,23 +14,24 @@
 #define LLVM_FRONTEND_OPENMP_OMP_H
 
 #include "llvm/Frontend/OpenMP/OMP.h.inc"
+#include "llvm/Support/Compiler.h"
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace llvm::omp {
-ArrayRef<Directive> getLeafConstructs(Directive D);
-ArrayRef<Directive> getLeafConstructsOrSelf(Directive D);
+LLVM_ABI ArrayRef<Directive> getLeafConstructs(Directive D);
+LLVM_ABI ArrayRef<Directive> getLeafConstructsOrSelf(Directive D);
 
-ArrayRef<Directive>
+LLVM_ABI ArrayRef<Directive>
 getLeafOrCompositeConstructs(Directive D, SmallVectorImpl<Directive> &Output);
 
-Directive getCompoundConstruct(ArrayRef<Directive> Parts);
+LLVM_ABI Directive getCompoundConstruct(ArrayRef<Directive> Parts);
 
-bool isLeafConstruct(Directive D);
-bool isCompositeConstruct(Directive D);
-bool isCombinedConstruct(Directive D);
+LLVM_ABI bool isLeafConstruct(Directive D);
+LLVM_ABI bool isCompositeConstruct(Directive D);
+LLVM_ABI bool isCombinedConstruct(Directive D);
 
 /// Can clause C have an iterator-modifier.
 static constexpr inline bool canHaveIterator(Clause C) {
@@ -48,14 +49,15 @@ static constexpr inline bool canHaveIterator(Clause C) {
 }
 
 static constexpr unsigned FallbackVersion = 52;
-ArrayRef<unsigned> getOpenMPVersions();
+LLVM_ABI ArrayRef<unsigned> getOpenMPVersions();
 
 /// Create a nicer version of a function name for humans to look at.
-std::string prettifyFunctionName(StringRef FunctionName);
+LLVM_ABI std::string prettifyFunctionName(StringRef FunctionName);
 
 /// Deconstruct an OpenMP kernel name into the parent function name and the line
 /// number.
-std::string deconstructOpenMPKernelName(StringRef KernelName, unsigned &LineNo);
+LLVM_ABI std::string deconstructOpenMPKernelName(StringRef KernelName,
+                                                 unsigned &LineNo);
 
 } // namespace llvm::omp
 

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPContext.h b/llvm/include/llvm/Frontend/OpenMP/OMPContext.h
index 9942cbd08aa43..e6c1b4f1f224a 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPContext.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPContext.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/Frontend/OpenMP/OMPConstants.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class Triple;
@@ -49,69 +50,73 @@ enum class TraitProperty {
 };
 
 /// Parse \p Str and return the trait set it matches or TraitSet::invalid.
-TraitSet getOpenMPContextTraitSetKind(StringRef Str);
+LLVM_ABI TraitSet getOpenMPContextTraitSetKind(StringRef Str);
 
 /// Return the trait set for which \p Selector is a selector.
-TraitSet getOpenMPContextTraitSetForSelector(TraitSelector Selector);
+LLVM_ABI TraitSet getOpenMPContextTraitSetForSelector(TraitSelector Selector);
 
 /// Return the trait set for which \p Property is a property.
-TraitSet getOpenMPContextTraitSetForProperty(TraitProperty Property);
+LLVM_ABI TraitSet getOpenMPContextTraitSetForProperty(TraitProperty Property);
 
 /// Return a textual representation of the trait set \p Kind.
-StringRef getOpenMPContextTraitSetName(TraitSet Kind);
+LLVM_ABI StringRef getOpenMPContextTraitSetName(TraitSet Kind);
 
 /// Parse \p Str and return the trait set it matches or
 /// TraitSelector::invalid.
-TraitSelector getOpenMPContextTraitSelectorKind(StringRef Str, TraitSet Set);
+LLVM_ABI TraitSelector getOpenMPContextTraitSelectorKind(StringRef Str,
+                                                         TraitSet Set);
 
 /// Return the trait selector for which \p Property is a property.
-TraitSelector getOpenMPContextTraitSelectorForProperty(TraitProperty Property);
+LLVM_ABI TraitSelector
+getOpenMPContextTraitSelectorForProperty(TraitProperty Property);
 
 /// Return a textual representation of the trait selector \p Kind.
-StringRef getOpenMPContextTraitSelectorName(TraitSelector Kind);
+LLVM_ABI StringRef getOpenMPContextTraitSelectorName(TraitSelector Kind);
 
 /// Parse \p Str and return the trait property it matches in the set \p Set and
 /// selector \p Selector or TraitProperty::invalid.
-TraitProperty getOpenMPContextTraitPropertyKind(TraitSet Set,
-                                                TraitSelector Selector,
-                                                StringRef Str);
+LLVM_ABI TraitProperty getOpenMPContextTraitPropertyKind(TraitSet Set,
+                                                         TraitSelector Selector,
+                                                         StringRef Str);
 
 /// Return the trait property for a singleton selector \p Selector.
-TraitProperty getOpenMPContextTraitPropertyForSelector(TraitSelector Selector);
+LLVM_ABI TraitProperty
+getOpenMPContextTraitPropertyForSelector(TraitSelector Selector);
 
 /// Return a textual representation of the trait property \p Kind, which might
 /// be the raw string we parsed (\p RawString) if we do not translate the
 /// property into a (distinct) enum.
-StringRef getOpenMPContextTraitPropertyName(TraitProperty Kind,
-                                            StringRef RawString);
+LLVM_ABI StringRef getOpenMPContextTraitPropertyName(TraitProperty Kind,
+                                                     StringRef RawString);
 
 /// Return a textual representation of the trait property \p Kind with selector
 /// and set name included.
-StringRef getOpenMPContextTraitPropertyFullName(TraitProperty Kind);
+LLVM_ABI StringRef getOpenMPContextTraitPropertyFullName(TraitProperty Kind);
 
 /// Return a string listing all trait sets.
-std::string listOpenMPContextTraitSets();
+LLVM_ABI std::string listOpenMPContextTraitSets();
 
 /// Return a string listing all trait selectors for \p Set.
-std::string listOpenMPContextTraitSelectors(TraitSet Set);
+LLVM_ABI std::string listOpenMPContextTraitSelectors(TraitSet Set);
 
 /// Return a string listing all trait properties for \p Set and \p Selector.
-std::string listOpenMPContextTraitProperties(TraitSet Set,
-                                             TraitSelector Selector);
+LLVM_ABI std::string listOpenMPContextTraitProperties(TraitSet Set,
+                                                      TraitSelector Selector);
 ///}
 
 /// Return true if \p Selector can be nested in \p Set. Also sets
 /// \p AllowsTraitScore and \p RequiresProperty to true/false if the user can
 /// specify a score for properties in \p Selector and if the \p Selector
 /// requires at least one property.
-bool isValidTraitSelectorForTraitSet(TraitSelector Selector, TraitSet Set,
-                                     bool &AllowsTraitScore,
-                                     bool &RequiresProperty);
+LLVM_ABI bool isValidTraitSelectorForTraitSet(TraitSelector Selector,
+                                              TraitSet Set,
+                                              bool &AllowsTraitScore,
+                                              bool &RequiresProperty);
 
 /// Return true if \p Property can be nested in \p Selector and \p Set.
-bool isValidTraitPropertyForTraitSetAndSelector(TraitProperty Property,
-                                                TraitSelector Selector,
-                                                TraitSet Set);
+LLVM_ABI bool isValidTraitPropertyForTraitSetAndSelector(TraitProperty Property,
+                                                         TraitSelector Selector,
+                                                         TraitSet Set);
 
 /// Variant match information describes the required traits and how they are
 /// scored (via the ScoresMap). In addition, the required consturct nesting is
@@ -157,8 +162,8 @@ struct VariantMatchInfo {
 /// e.g., device={kind(host)}, and constructs traits which describe the nesting
 /// in OpenMP constructs at the location.
 struct OMPContext {
-  OMPContext(bool IsDeviceCompilation, Triple TargetTriple,
-             Triple TargetOffloadTriple, int DeviceNum);
+  LLVM_ABI OMPContext(bool IsDeviceCompilation, Triple TargetTriple,
+                      Triple TargetOffloadTriple, int DeviceNum);
   virtual ~OMPContext() = default;
 
   void addTrait(TraitProperty Property) {
@@ -184,14 +189,15 @@ struct OMPContext {
 /// \p DeviceOrImplementationSetOnly is true, only the device and implementation
 /// selector set, if present, are checked. Note that we still honor extension
 /// traits provided by the user.
-bool isVariantApplicableInContext(const VariantMatchInfo &VMI,
-                                  const OMPContext &Ctx,
-                                  bool DeviceOrImplementationSetOnly = false);
+LLVM_ABI bool
+isVariantApplicableInContext(const VariantMatchInfo &VMI, const OMPContext &Ctx,
+                             bool DeviceOrImplementationSetOnly = false);
 
 /// Return the index (into \p VMIs) of the variant with the highest score
 /// from the ones applicable in \p Ctx. See llvm::isVariantApplicableInContext.
-int getBestVariantMatchForContext(const SmallVectorImpl<VariantMatchInfo> &VMIs,
-                                  const OMPContext &Ctx);
+LLVM_ABI int
+getBestVariantMatchForContext(const SmallVectorImpl<VariantMatchInfo> &VMIs,
+                              const OMPContext &Ctx);
 
 } // namespace omp
 

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index e5eb0e44c853f..e4b1241151e9d 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -22,6 +22,7 @@
 #include "llvm/IR/Module.h"
 #include "llvm/IR/ValueMap.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/TargetParser/Triple.h"
 #include <forward_list>
@@ -43,14 +44,15 @@ class OpenMPIRBuilder;
 /// \p IP insert block remains degenerate and it is up to the caller to insert a
 /// terminator. \p DL is used as the debug location for the branch instruction
 /// if one is created.
-void spliceBB(IRBuilderBase::InsertPoint IP, BasicBlock *New, bool CreateBranch,
-              DebugLoc DL);
+LLVM_ABI void spliceBB(IRBuilderBase::InsertPoint IP, BasicBlock *New,
+                       bool CreateBranch, DebugLoc DL);
 
 /// Splice a BasicBlock at an IRBuilder's current insertion point. Its new
 /// insert location will stick to after the instruction before the insertion
 /// point (instead of moving with the instruction the InsertPoint stores
 /// internally).
-void spliceBB(IRBuilder<> &Builder, BasicBlock *New, bool CreateBranch);
+LLVM_ABI void spliceBB(IRBuilder<> &Builder, BasicBlock *New,
+                       bool CreateBranch);
 
 /// Split a BasicBlock at an InsertPoint, even if the block is degenerate
 /// (missing the terminator).
@@ -62,25 +64,27 @@ void spliceBB(IRBuilder<> &Builder, BasicBlock *New, bool CreateBranch);
 /// remains degenerate and it is the caller's responsibility to insert a
 /// terminator. \p DL is used as the debug location for the branch instruction
 /// if one is created. Returns the new successor block.
-BasicBlock *splitBB(IRBuilderBase::InsertPoint IP, bool CreateBranch,
-                    DebugLoc DL, llvm::Twine Name = {});
+LLVM_ABI BasicBlock *splitBB(IRBuilderBase::InsertPoint IP, bool CreateBranch,
+                             DebugLoc DL, llvm::Twine Name = {});
 
 /// Split a BasicBlock at \p Builder's insertion point, even if the block is
 /// degenerate (missing the terminator).  Its new insert location will stick to
 /// after the instruction before the insertion point (instead of moving with the
 /// instruction the InsertPoint stores internally).
-BasicBlock *splitBB(IRBuilderBase &Builder, bool CreateBranch,
-                    llvm::Twine Name = {});
+LLVM_ABI BasicBlock *splitBB(IRBuilderBase &Builder, bool CreateBranch,
+                             llvm::Twine Name = {});
 
 /// Split a BasicBlock at \p Builder's insertion point, even if the block is
 /// degenerate (missing the terminator).  Its new insert location will stick to
 /// after the instruction before the insertion point (instead of moving with the
 /// instruction the InsertPoint stores internally).
-BasicBlock *splitBB(IRBuilder<> &Builder, bool CreateBranch, llvm::Twine Name);
+LLVM_ABI BasicBlock *splitBB(IRBuilder<> &Builder, bool CreateBranch,
+                             llvm::Twine Name);
 
 /// Like splitBB, but reuses the current block's name for the new name.
-BasicBlock *splitBBWithSuffix(IRBuilderBase &Builder, bool CreateBranch,
-                              llvm::Twine Suffix = ".split");
+LLVM_ABI BasicBlock *splitBBWithSuffix(IRBuilderBase &Builder,
+                                       bool CreateBranch,
+                                       llvm::Twine Suffix = ".split");
 
 /// Captures attributes that affect generating LLVM-IR using the
 /// OpenMPIRBuilder and related classes. Note that not all attributes are
@@ -123,13 +127,13 @@ class OpenMPIRBuilderConfig {
   /// false`), this contains the list of offloading triples associated, if any.
   SmallVector<Triple> TargetTriples;
 
-  OpenMPIRBuilderConfig();
-  OpenMPIRBuilderConfig(bool IsTargetDevice, bool IsGPU,
-                        bool OpenMPOffloadMandatory,
-                        bool HasRequiresReverseOffload,
-                        bool HasRequiresUnifiedAddress,
-                        bool HasRequiresUnifiedSharedMemory,
-                        bool HasRequiresDynamicAllocators);
+  LLVM_ABI OpenMPIRBuilderConfig();
+  LLVM_ABI OpenMPIRBuilderConfig(bool IsTargetDevice, bool IsGPU,
+                                 bool OpenMPOffloadMandatory,
+                                 bool HasRequiresReverseOffload,
+                                 bool HasRequiresUnifiedAddress,
+                                 bool HasRequiresUnifiedSharedMemory,
+                                 bool HasRequiresDynamicAllocators);
 
   // Getters functions that assert if the required values are not present.
   bool isTargetDevice() const {
@@ -154,14 +158,14 @@ class OpenMPIRBuilderConfig {
   }
 
   bool hasRequiresFlags() const { return RequiresFlags; }
-  bool hasRequiresReverseOffload() const;
-  bool hasRequiresUnifiedAddress() const;
-  bool hasRequiresUnifiedSharedMemory() const;
-  bool hasRequiresDynamicAllocators() const;
+  LLVM_ABI bool hasRequiresReverseOffload() const;
+  LLVM_ABI bool hasRequiresUnifiedAddress() const;
+  LLVM_ABI bool hasRequiresUnifiedSharedMemory() const;
+  LLVM_ABI bool hasRequiresDynamicAllocators() const;
 
   /// Returns requires directive clauses as flags compatible with those expected
   /// by libomptarget.
-  int64_t getRequiresFlags() const;
+  LLVM_ABI int64_t getRequiresFlags() const;
 
   // Returns the FirstSeparator if set, otherwise use the default separator
   // depending on isGPU
@@ -191,10 +195,10 @@ class OpenMPIRBuilderConfig {
   void setSeparator(StringRef S) { Separator = S; }
   void setGridValue(omp::GV G) { GridValue = G; }
 
-  void setHasRequiresReverseOffload(bool Value);
-  void setHasRequiresUnifiedAddress(bool Value);
-  void setHasRequiresUnifiedSharedMemory(bool Value);
-  void setHasRequiresDynamicAllocators(bool Value);
+  LLVM_ABI void setHasRequiresReverseOffload(bool Value);
+  LLVM_ABI void setHasRequiresUnifiedAddress(bool Value);
+  LLVM_ABI void setHasRequiresUnifiedSharedMemory(bool Value);
+  LLVM_ABI void setHasRequiresDynamicAllocators(bool Value);
 
 private:
   /// Flags for specifying which requires directive clauses are present.
@@ -219,10 +223,10 @@ struct TargetRegionEntryInfo {
       : ParentName(ParentName), DeviceID(DeviceID), FileID(FileID), Line(Line),
         Count(Count) {}
 
-  static void getTargetRegionEntryFnName(SmallVectorImpl<char> &Name,
-                                         StringRef ParentName,
-                                         unsigned DeviceID, unsigned FileID,
-                                         unsigned Line, unsigned Count);
+  LLVM_ABI static void
+  getTargetRegionEntryFnName(SmallVectorImpl<char> &Name, StringRef ParentName,
+                             unsigned DeviceID, unsigned FileID, unsigned Line,
+                             unsigned Count);
 
   bool operator<(const TargetRegionEntryInfo &RHS) const {
     return std::make_tuple(ParentName, DeviceID, FileID, Line, Count) <
@@ -286,7 +290,7 @@ class OffloadEntriesInfoManager {
   };
 
   /// Return true if a there are no entries defined.
-  bool empty() const;
+  LLVM_ABI bool empty() const;
   /// Return number of entries defined so far.
   unsigned size() const { return OffloadingEntriesNum; }
 
@@ -330,26 +334,28 @@ class OffloadEntriesInfoManager {
 
   /// Initialize target region entry.
   /// This is ONLY needed for DEVICE compilation.
-  void initializeTargetRegionEntryInfo(const TargetRegionEntryInfo &EntryInfo,
-                                       unsigned Order);
+  LLVM_ABI void
+  initializeTargetRegionEntryInfo(const TargetRegionEntryInfo &EntryInfo,
+                                  unsigned Order);
   /// Register target region entry.
-  void registerTargetRegionEntryInfo(TargetRegionEntryInfo EntryInfo,
-                                     Constant *Addr, Constant *ID,
-                                     OMPTargetRegionEntryKind Flags);
+  LLVM_ABI void registerTargetRegionEntryInfo(TargetRegionEntryInfo EntryInfo,
+                                              Constant *Addr, Constant *ID,
+                                              OMPTargetRegionEntryKind Flags);
   /// Return true if a target region entry with the provided information
   /// exists.
-  bool hasTargetRegionEntryInfo(TargetRegionEntryInfo EntryInfo,
-                                bool IgnoreAddressId = false) const;
+  LLVM_ABI bool hasTargetRegionEntryInfo(TargetRegionEntryInfo EntryInfo,
+                                         bool IgnoreAddressId = false) const;
 
   // Return the Name based on \a EntryInfo using the next available Count.
-  void getTargetRegionEntryFnName(SmallVectorImpl<char> &Name,
-                                  const TargetRegionEntryInfo &EntryInfo);
+  LLVM_ABI void
+  getTargetRegionEntryFnName(SmallVectorImpl<char> &Name,
+                             const TargetRegionEntryInfo &EntryInfo);
 
   /// brief Applies action \a Action on all registered entries.
   typedef function_ref<void(const TargetRegionEntryInfo &EntryInfo,
                             const OffloadEntryInfoTargetRegion &)>
       OffloadTargetRegionEntryInfoActTy;
-  void
+  LLVM_ABI void
   actOnTargetRegionEntriesInfo(const OffloadTargetRegionEntryInfoActTy &Action);
 
   //
@@ -423,15 +429,13 @@ class OffloadEntriesInfoManager {
 
   /// Initialize device global variable entry.
   /// This is ONLY used for DEVICE compilation.
-  void initializeDeviceGlobalVarEntryInfo(StringRef Name,
-                                          OMPTargetGlobalVarEntryKind Flags,
-                                          unsigned Order);
+  LLVM_ABI void initializeDeviceGlobalVarEntryInfo(
+      StringRef Name, OMPTargetGlobalVarEntryKind Flags, unsigned Order);
 
   /// Register device global variable entry.
-  void registerDeviceGlobalVarEntryInfo(StringRef VarName, Constant *Addr,
-                                        int64_t VarSize,
-                                        OMPTargetGlobalVarEntryKind Flags,
-                                        GlobalValue::LinkageTypes Linkage);
+  LLVM_ABI void registerDeviceGlobalVarEntryInfo(
+      StringRef VarName, Constant *Addr, int64_t VarSize,
+      OMPTargetGlobalVarEntryKind Flags, GlobalValue::LinkageTypes Linkage);
   /// Checks if the variable with the given name has been registered already.
   bool hasDeviceGlobalVarEntryInfo(StringRef VarName) const {
     return OffloadEntriesDeviceGlobalVar.count(VarName) > 0;
@@ -439,7 +443,7 @@ class OffloadEntriesInfoManager {
   /// Applies action \a Action on all registered entries.
   typedef function_ref<void(StringRef, const OffloadEntryInfoDeviceGlobalVar &)>
       OffloadDeviceGlobalVarEntryInfoActTy;
-  void actOnDeviceGlobalVarEntriesInfo(
+  LLVM_ABI void actOnDeviceGlobalVarEntriesInfo(
       const OffloadDeviceGlobalVarEntryInfoActTy &Action);
 
 private:
@@ -481,7 +485,7 @@ class OpenMPIRBuilder {
   OpenMPIRBuilder(Module &M)
       : M(M), Builder(M.getContext()), OffloadInfoManager(this),
         T(M.getTargetTriple()) {}
-  ~OpenMPIRBuilder();
+  LLVM_ABI ~OpenMPIRBuilder();
 
   class AtomicInfo : public llvm::AtomicInfo {
     llvm::Value *AtomicVar;
@@ -508,17 +512,17 @@ class OpenMPIRBuilder {
   /// potentially other helpers into the underlying module. Must be called
   /// before any other method and only once! This internal state includes types
   /// used in the OpenMPIRBuilder generated from OMPKinds.def.
-  void initialize();
+  LLVM_ABI void initialize();
 
   void setConfig(OpenMPIRBuilderConfig C) { Config = C; }
 
   /// Finalize the underlying module, e.g., by outlining regions.
   /// \param Fn                    The function to be finalized. If not used,
   ///                              all functions are finalized.
-  void finalize(Function *Fn = nullptr);
+  LLVM_ABI void finalize(Function *Fn = nullptr);
 
   /// Add attributes known for \p FnID to \p Fn.
-  void addAttributes(omp::RuntimeFunction FnID, Function &Fn);
+  LLVM_ABI void addAttributes(omp::RuntimeFunction FnID, Function &Fn);
 
   /// Type used throughout for insertion points.
   using InsertPointTy = IRBuilder<>::InsertPoint;
@@ -534,7 +538,8 @@ class OpenMPIRBuilder {
   /// parts: "p1", "p2", "p3", "p4"
   /// The resulting name is "p1$p2.p3.p4"
   /// The separators are retrieved from the OpenMPIRBuilderConfig.
-  std::string createPlatformSpecificName(ArrayRef<StringRef> Parts) const;
+  LLVM_ABI std::string
+  createPlatformSpecificName(ArrayRef<StringRef> Parts) const;
 
   /// Callback type for variable finalization (think destructors).
   ///
@@ -670,10 +675,10 @@ class OpenMPIRBuilder {
   /// \param ThreadID Optional parameter to pass in any existing ThreadID value.
   ///
   /// \returns The insertion point after the barrier.
-  InsertPointOrErrorTy createBarrier(const LocationDescription &Loc,
-                                     omp::Directive Kind,
-                                     bool ForceSimpleCall = false,
-                                     bool CheckCancelFlag = true);
+  LLVM_ABI InsertPointOrErrorTy createBarrier(const LocationDescription &Loc,
+                                              omp::Directive Kind,
+                                              bool ForceSimpleCall = false,
+                                              bool CheckCancelFlag = true);
 
   /// Generator for '#omp cancel'
   ///
@@ -682,9 +687,9 @@ class OpenMPIRBuilder {
   /// \param CanceledDirective The kind of directive that is cancled.
   ///
   /// \returns The insertion point after the barrier.
-  InsertPointOrErrorTy createCancel(const LocationDescription &Loc,
-                                    Value *IfCondition,
-                                    omp::Directive CanceledDirective);
+  LLVM_ABI InsertPointOrErrorTy createCancel(const LocationDescription &Loc,
+                                             Value *IfCondition,
+                                             omp::Directive CanceledDirective);
 
   /// Generator for '#omp cancellation point'
   ///
@@ -692,9 +697,8 @@ class OpenMPIRBuilder {
   /// \param CanceledDirective The kind of directive that is cancled.
   ///
   /// \returns The insertion point after the barrier.
-  InsertPointOrErrorTy
-  createCancellationPoint(const LocationDescription &Loc,
-                          omp::Directive CanceledDirective);
+  LLVM_ABI InsertPointOrErrorTy createCancellationPoint(
+      const LocationDescription &Loc, omp::Directive CanceledDirective);
 
   /// Generator for '#omp parallel'
   ///
@@ -709,12 +713,11 @@ class OpenMPIRBuilder {
   /// \param IsCancellable Flag to indicate a cancellable parallel region.
   ///
   /// \returns The insertion position *after* the parallel.
-  InsertPointOrErrorTy
-  createParallel(const LocationDescription &Loc, InsertPointTy AllocaIP,
-                 BodyGenCallbackTy BodyGenCB, PrivatizeCallbackTy PrivCB,
-                 FinalizeCallbackTy FiniCB, Value *IfCondition,
-                 Value *NumThreads, omp::ProcBindKind ProcBind,
-                 bool IsCancellable);
+  LLVM_ABI InsertPointOrErrorTy createParallel(
+      const LocationDescription &Loc, InsertPointTy AllocaIP,
+      BodyGenCallbackTy BodyGenCB, PrivatizeCallbackTy PrivCB,
+      FinalizeCallbackTy FiniCB, Value *IfCondition, Value *NumThreads,
+      omp::ProcBindKind ProcBind, bool IsCancellable);
 
   /// Generator for the control flow structure of an OpenMP canonical loop.
   ///
@@ -735,7 +738,7 @@ class OpenMPIRBuilder {
   ///
   /// \returns An object representing the created control flow structure which
   ///          can be used for loop-associated directives.
-  Expected<CanonicalLoopInfo *>
+  LLVM_ABI Expected<CanonicalLoopInfo *>
   createCanonicalLoop(const LocationDescription &Loc,
                       LoopBodyGenCallbackTy BodyGenCB, Value *TripCount,
                       const Twine &Name = "loop");
@@ -780,10 +783,9 @@ class OpenMPIRBuilder {
   /// \param Name      Base name used to derive instruction names.
   ///
   /// \returns The value holding the calculated trip count.
-  Value *calculateCanonicalLoopTripCount(const LocationDescription &Loc,
-                                         Value *Start, Value *Stop, Value *Step,
-                                         bool IsSigned, bool InclusiveStop,
-                                         const Twine &Name = "loop");
+  LLVM_ABI Value *calculateCanonicalLoopTripCount(
+      const LocationDescription &Loc, Value *Start, Value *Stop, Value *Step,
+      bool IsSigned, bool InclusiveStop, const Twine &Name = "loop");
 
   /// Generator for the control flow structure of an OpenMP canonical loop.
   ///
@@ -812,7 +814,7 @@ class OpenMPIRBuilder {
   ///
   /// \returns An object representing the created control flow structure which
   ///          can be used for loop-associated directives.
-  Expected<CanonicalLoopInfo *> createCanonicalLoop(
+  LLVM_ABI Expected<CanonicalLoopInfo *> createCanonicalLoop(
       const LocationDescription &Loc, LoopBodyGenCallbackTy BodyGenCB,
       Value *Start, Value *Stop, Value *Step, bool IsSigned, bool InclusiveStop,
       InsertPointTy ComputeIP = {}, const Twine &Name = "loop");
@@ -877,16 +879,17 @@ class OpenMPIRBuilder {
   ///                  loop.
   ///
   /// \returns The CanonicalLoopInfo object representing the collapsed loop.
-  CanonicalLoopInfo *collapseLoops(DebugLoc DL,
-                                   ArrayRef<CanonicalLoopInfo *> Loops,
-                                   InsertPointTy ComputeIP);
+  LLVM_ABI CanonicalLoopInfo *collapseLoops(DebugLoc DL,
+                                            ArrayRef<CanonicalLoopInfo *> Loops,
+                                            InsertPointTy ComputeIP);
 
   /// Get the default alignment value for given target
   ///
   /// \param TargetTriple   Target triple
   /// \param Features       StringMap which describes extra CPU features
-  static unsigned getOpenMPDefaultSimdAlign(const Triple &TargetTriple,
-                                            const StringMap<bool> &Features);
+  LLVM_ABI static unsigned
+  getOpenMPDefaultSimdAlign(const Triple &TargetTriple,
+                            const StringMap<bool> &Features);
 
   /// Retrieve (or create if non-existent) the address of a declare
   /// target variable, used in conjunction with registerTargetGlobalVariable
@@ -922,7 +925,7 @@ class OpenMPIRBuilder {
   /// linkage type, if unspecified and a nullptr is given, it will instead
   /// utilise the linkage stored on the existing global variable in the
   /// LLVMModule.
-  Constant *getAddrOfDeclareTargetVar(
+  LLVM_ABI Constant *getAddrOfDeclareTargetVar(
       OffloadEntriesInfoManager::OMPTargetGlobalVarEntryKind CaptureClause,
       OffloadEntriesInfoManager::OMPTargetDeviceClauseKind DeviceClause,
       bool IsDeclaration, bool IsExternallyVisible,
@@ -966,7 +969,7 @@ class OpenMPIRBuilder {
   /// retrieving an address for
   /// \param Addr - the original llvm value (addr) of the variable to be
   /// registered
-  void registerTargetGlobalVariable(
+  LLVM_ABI void registerTargetGlobalVariable(
       OffloadEntriesInfoManager::OMPTargetGlobalVarEntryKind CaptureClause,
       OffloadEntriesInfoManager::OMPTargetDeviceClauseKind DeviceClause,
       bool IsDeclaration, bool IsExternallyVisible,
@@ -978,7 +981,7 @@ class OpenMPIRBuilder {
       Type *LlvmPtrTy, Constant *Addr);
 
   /// Get the offset of the OMP_MAP_MEMBER_OF field.
-  unsigned getFlagMemberOffset();
+  LLVM_ABI unsigned getFlagMemberOffset();
 
   /// Get OMP_MAP_MEMBER_OF flag with extra bits reserved based on
   /// the position given.
@@ -987,7 +990,7 @@ class OpenMPIRBuilder {
   /// by the parents position in the combined information vectors used
   /// to generate the structure itself. Multiple children (member's of)
   /// with the same parent will use the same returned member flag.
-  omp::OpenMPOffloadMappingFlags getMemberOfFlag(unsigned Position);
+  LLVM_ABI omp::OpenMPOffloadMappingFlags getMemberOfFlag(unsigned Position);
 
   /// Given an initial flag set, this function modifies it to contain
   /// the passed in MemberOfFlag generated from the getMemberOfFlag
@@ -998,8 +1001,9 @@ class OpenMPIRBuilder {
   /// \param MemberOfFlag - A modified OMP_MAP_MEMBER_OF flag, adjusted
   /// slightly based on the getMemberOfFlag which adjusts the flag bits
   /// based on the members position in its parent.
-  void setCorrectMemberOfFlag(omp::OpenMPOffloadMappingFlags &Flags,
-                              omp::OpenMPOffloadMappingFlags MemberOfFlag);
+  LLVM_ABI void
+  setCorrectMemberOfFlag(omp::OpenMPOffloadMappingFlags &Flags,
+                         omp::OpenMPOffloadMappingFlags MemberOfFlag);
 
 private:
   /// Modifies the canonical loop to be a statically-scheduled workshare loop
@@ -1143,7 +1147,7 @@ class OpenMPIRBuilder {
   ///                 It corresponds to type of loop workshare OpenMP pragma.
   ///
   /// \returns Point where to insert code after the workshare construct.
-  InsertPointOrErrorTy applyWorkshareLoop(
+  LLVM_ABI InsertPointOrErrorTy applyWorkshareLoop(
       DebugLoc DL, CanonicalLoopInfo *CLI, InsertPointTy AllocaIP,
       bool NeedsBarrier,
       llvm::omp::ScheduleKind SchedKind = llvm::omp::OMP_SCHEDULE_Default,
@@ -1196,7 +1200,7 @@ class OpenMPIRBuilder {
   /// \returns A list of generated loops. Contains twice as many loops as the
   ///          input loop nest; the first half are the floor loops and the
   ///          second half are the tile loops.
-  std::vector<CanonicalLoopInfo *>
+  LLVM_ABI std::vector<CanonicalLoopInfo *>
   tileLoops(DebugLoc DL, ArrayRef<CanonicalLoopInfo *> Loops,
             ArrayRef<Value *> TileSizes);
 
@@ -1208,14 +1212,14 @@ class OpenMPIRBuilder {
   ///
   /// \param DL   Debug location for instructions added by unrolling.
   /// \param Loop The loop to unroll. The loop will be invalidated.
-  void unrollLoopFull(DebugLoc DL, CanonicalLoopInfo *Loop);
+  LLVM_ABI void unrollLoopFull(DebugLoc DL, CanonicalLoopInfo *Loop);
 
   /// Fully or partially unroll a loop. How the loop is unrolled is determined
   /// using LLVM's LoopUnrollPass.
   ///
   /// \param DL   Debug location for instructions added by unrolling.
   /// \param Loop The loop to unroll. The loop will be invalidated.
-  void unrollLoopHeuristic(DebugLoc DL, CanonicalLoopInfo *Loop);
+  LLVM_ABI void unrollLoopHeuristic(DebugLoc DL, CanonicalLoopInfo *Loop);
 
   /// Partially unroll a loop.
   ///
@@ -1239,8 +1243,9 @@ class OpenMPIRBuilder {
   /// \param UnrolledCLI If non-null, receives the CanonicalLoopInfo of the
   ///                    partially unrolled loop. Otherwise, uses loop metadata
   ///                    to defer unrolling to the LoopUnrollPass.
-  void unrollLoopPartial(DebugLoc DL, CanonicalLoopInfo *Loop, int32_t Factor,
-                         CanonicalLoopInfo **UnrolledCLI);
+  LLVM_ABI void unrollLoopPartial(DebugLoc DL, CanonicalLoopInfo *Loop,
+                                  int32_t Factor,
+                                  CanonicalLoopInfo **UnrolledCLI);
 
   /// Add metadata to simd-ize a loop. If IfCond is not nullptr, the loop
   /// is cloned. The metadata which prevents vectorization is added to
@@ -1255,25 +1260,25 @@ class OpenMPIRBuilder {
   /// \param Order       The enum to map order clause.
   /// \param Simdlen     The Simdlen length to apply to the simd loop.
   /// \param Safelen     The Safelen length to apply to the simd loop.
-  void applySimd(CanonicalLoopInfo *Loop,
-                 MapVector<Value *, Value *> AlignedVars, Value *IfCond,
-                 omp::OrderKind Order, ConstantInt *Simdlen,
-                 ConstantInt *Safelen);
+  LLVM_ABI void applySimd(CanonicalLoopInfo *Loop,
+                          MapVector<Value *, Value *> AlignedVars,
+                          Value *IfCond, omp::OrderKind Order,
+                          ConstantInt *Simdlen, ConstantInt *Safelen);
 
   /// Generator for '#omp flush'
   ///
   /// \param Loc The location where the flush directive was encountered
-  void createFlush(const LocationDescription &Loc);
+  LLVM_ABI void createFlush(const LocationDescription &Loc);
 
   /// Generator for '#omp taskwait'
   ///
   /// \param Loc The location where the taskwait directive was encountered.
-  void createTaskwait(const LocationDescription &Loc);
+  LLVM_ABI void createTaskwait(const LocationDescription &Loc);
 
   /// Generator for '#omp taskyield'
   ///
   /// \param Loc The location where the taskyield directive was encountered.
-  void createTaskyield(const LocationDescription &Loc);
+  LLVM_ABI void createTaskyield(const LocationDescription &Loc);
 
   /// A struct to pack the relevant information for an OpenMP depend clause.
   struct DependData {
@@ -1305,7 +1310,7 @@ class OpenMPIRBuilder {
   /// \param Mergeable	 If the given task is `mergeable`
   /// \param priority `priority-value' specifies the execution order of the
   ///                 tasks that is generated by the construct
-  InsertPointOrErrorTy
+  LLVM_ABI InsertPointOrErrorTy
   createTask(const LocationDescription &Loc, InsertPointTy AllocaIP,
              BodyGenCallbackTy BodyGenCB, bool Tied = true,
              Value *Final = nullptr, Value *IfCondition = nullptr,
@@ -1317,9 +1322,9 @@ class OpenMPIRBuilder {
   /// \param Loc The location where the taskgroup construct was encountered.
   /// \param AllocaIP The insertion point to be used for alloca instructions.
   /// \param BodyGenCB Callback that will generate the region code.
-  InsertPointOrErrorTy createTaskgroup(const LocationDescription &Loc,
-                                       InsertPointTy AllocaIP,
-                                       BodyGenCallbackTy BodyGenCB);
+  LLVM_ABI InsertPointOrErrorTy createTaskgroup(const LocationDescription &Loc,
+                                                InsertPointTy AllocaIP,
+                                                BodyGenCallbackTy BodyGenCB);
 
   using FileIdentifierInfoCallbackTy =
       std::function<std::tuple<std::string, uint64_t>()>;
@@ -1331,7 +1336,7 @@ class OpenMPIRBuilder {
   /// resides in as well as the line number for the target entry
   /// \param ParentName The name of the parent the target entry resides in, if
   /// any.
-  static TargetRegionEntryInfo
+  LLVM_ABI static TargetRegionEntryInfo
   getTargetEntryUniqueInfo(FileIdentifierInfoCallbackTy CallBack,
                            StringRef ParentName = "");
 
@@ -1922,7 +1927,7 @@ class OpenMPIRBuilder {
   /// \param ReductionBufNum    Optional OpenMPCUDAReductionBufNumValue to be
   /// used for teams reduction.
   /// \param SrcLocInfo         Source location information global.
-  InsertPointOrErrorTy createReductionsGPU(
+  LLVM_ABI InsertPointOrErrorTy createReductionsGPU(
       const LocationDescription &Loc, InsertPointTy AllocaIP,
       InsertPointTy CodeGenIP, ArrayRef<ReductionInfo> ReductionInfos,
       bool IsNoWait = false, bool IsTeamsReduction = false,
@@ -1995,12 +2000,10 @@ class OpenMPIRBuilder {
   /// or direct value.
   /// \param IsTeamsReduction   Optional flag set if it is a teams
   ///                           reduction.
-  InsertPointOrErrorTy createReductions(const LocationDescription &Loc,
-                                        InsertPointTy AllocaIP,
-                                        ArrayRef<ReductionInfo> ReductionInfos,
-                                        ArrayRef<bool> IsByRef,
-                                        bool IsNoWait = false,
-                                        bool IsTeamsReduction = false);
+  LLVM_ABI InsertPointOrErrorTy createReductions(
+      const LocationDescription &Loc, InsertPointTy AllocaIP,
+      ArrayRef<ReductionInfo> ReductionInfos, ArrayRef<bool> IsByRef,
+      bool IsNoWait = false, bool IsTeamsReduction = false);
 
   ///}
 
@@ -2015,48 +2018,51 @@ class OpenMPIRBuilder {
   }
 
   /// Return the function declaration for the runtime function with \p FnID.
-  FunctionCallee getOrCreateRuntimeFunction(Module &M,
-                                            omp::RuntimeFunction FnID);
+  LLVM_ABI FunctionCallee getOrCreateRuntimeFunction(Module &M,
+                                                     omp::RuntimeFunction FnID);
 
-  Function *getOrCreateRuntimeFunctionPtr(omp::RuntimeFunction FnID);
+  LLVM_ABI Function *getOrCreateRuntimeFunctionPtr(omp::RuntimeFunction FnID);
 
   /// Return the (LLVM-IR) string describing the source location \p LocStr.
-  Constant *getOrCreateSrcLocStr(StringRef LocStr, uint32_t &SrcLocStrSize);
+  LLVM_ABI Constant *getOrCreateSrcLocStr(StringRef LocStr,
+                                          uint32_t &SrcLocStrSize);
 
   /// Return the (LLVM-IR) string describing the default source location.
-  Constant *getOrCreateDefaultSrcLocStr(uint32_t &SrcLocStrSize);
+  LLVM_ABI Constant *getOrCreateDefaultSrcLocStr(uint32_t &SrcLocStrSize);
 
   /// Return the (LLVM-IR) string describing the source location identified by
   /// the arguments.
-  Constant *getOrCreateSrcLocStr(StringRef FunctionName, StringRef FileName,
-                                 unsigned Line, unsigned Column,
-                                 uint32_t &SrcLocStrSize);
+  LLVM_ABI Constant *getOrCreateSrcLocStr(StringRef FunctionName,
+                                          StringRef FileName, unsigned Line,
+                                          unsigned Column,
+                                          uint32_t &SrcLocStrSize);
 
   /// Return the (LLVM-IR) string describing the DebugLoc \p DL. Use \p F as
   /// fallback if \p DL does not specify the function name.
-  Constant *getOrCreateSrcLocStr(DebugLoc DL, uint32_t &SrcLocStrSize,
-                                 Function *F = nullptr);
+  LLVM_ABI Constant *getOrCreateSrcLocStr(DebugLoc DL, uint32_t &SrcLocStrSize,
+                                          Function *F = nullptr);
 
   /// Return the (LLVM-IR) string describing the source location \p Loc.
-  Constant *getOrCreateSrcLocStr(const LocationDescription &Loc,
-                                 uint32_t &SrcLocStrSize);
+  LLVM_ABI Constant *getOrCreateSrcLocStr(const LocationDescription &Loc,
+                                          uint32_t &SrcLocStrSize);
 
   /// Return an ident_t* encoding the source location \p SrcLocStr and \p Flags.
   /// TODO: Create a enum class for the Reserve2Flags
-  Constant *getOrCreateIdent(Constant *SrcLocStr, uint32_t SrcLocStrSize,
-                             omp::IdentFlag Flags = omp::IdentFlag(0),
-                             unsigned Reserve2Flags = 0);
+  LLVM_ABI Constant *getOrCreateIdent(Constant *SrcLocStr,
+                                      uint32_t SrcLocStrSize,
+                                      omp::IdentFlag Flags = omp::IdentFlag(0),
+                                      unsigned Reserve2Flags = 0);
 
   /// Create a hidden global flag \p Name in the module with initial value \p
   /// Value.
-  GlobalValue *createGlobalFlag(unsigned Value, StringRef Name);
+  LLVM_ABI GlobalValue *createGlobalFlag(unsigned Value, StringRef Name);
 
   /// Emit the llvm.used metadata.
-  void emitUsed(StringRef Name, ArrayRef<llvm::WeakTrackingVH> List);
+  LLVM_ABI void emitUsed(StringRef Name, ArrayRef<llvm::WeakTrackingVH> List);
 
   /// Emit the kernel execution mode.
-  GlobalVariable *emitKernelExecutionMode(StringRef KernelName,
-                                          omp::OMPTgtExecModeFlags Mode);
+  LLVM_ABI GlobalVariable *
+  emitKernelExecutionMode(StringRef KernelName, omp::OMPTgtExecModeFlags Mode);
 
   /// Generate control flow and cleanup for cancellation.
   ///
@@ -2065,9 +2071,9 @@ class OpenMPIRBuilder {
   /// \param ExitCB Extra code to be generated in the exit block.
   ///
   /// \return an error, if any were triggered during execution.
-  Error emitCancelationCheckImpl(Value *CancelFlag,
-                                 omp::Directive CanceledDirective,
-                                 FinalizeCallbackTy ExitCB = {});
+  LLVM_ABI Error emitCancelationCheckImpl(Value *CancelFlag,
+                                          omp::Directive CanceledDirective,
+                                          FinalizeCallbackTy ExitCB = {});
 
   /// Generate a target region entry call.
   ///
@@ -2080,16 +2086,17 @@ class OpenMPIRBuilder {
   /// \param NumThreads Number of threads via the 'thread_limit' clause.
   /// \param HostPtr Pointer to the host-side pointer of the target kernel.
   /// \param KernelArgs Array of arguments to the kernel.
-  InsertPointTy emitTargetKernel(const LocationDescription &Loc,
-                                 InsertPointTy AllocaIP, Value *&Return,
-                                 Value *Ident, Value *DeviceID, Value *NumTeams,
-                                 Value *NumThreads, Value *HostPtr,
-                                 ArrayRef<Value *> KernelArgs);
+  LLVM_ABI InsertPointTy emitTargetKernel(const LocationDescription &Loc,
+                                          InsertPointTy AllocaIP,
+                                          Value *&Return, Value *Ident,
+                                          Value *DeviceID, Value *NumTeams,
+                                          Value *NumThreads, Value *HostPtr,
+                                          ArrayRef<Value *> KernelArgs);
 
   /// Generate a flush runtime call.
   ///
   /// \param Loc The location at which the request originated and is fulfilled.
-  void emitFlush(const LocationDescription &Loc);
+  LLVM_ABI void emitFlush(const LocationDescription &Loc);
 
   /// The finalization stack made up of finalize callbacks currently in-flight,
   /// wrapped into FinalizationInfo objects that reference also the finalization
@@ -2107,17 +2114,17 @@ class OpenMPIRBuilder {
   /// Generate a taskwait runtime call.
   ///
   /// \param Loc The location at which the request originated and is fulfilled.
-  void emitTaskwaitImpl(const LocationDescription &Loc);
+  LLVM_ABI void emitTaskwaitImpl(const LocationDescription &Loc);
 
   /// Generate a taskyield runtime call.
   ///
   /// \param Loc The location at which the request originated and is fulfilled.
-  void emitTaskyieldImpl(const LocationDescription &Loc);
+  LLVM_ABI void emitTaskyieldImpl(const LocationDescription &Loc);
 
   /// Return the current thread ID.
   ///
   /// \param Ident The ident (ident_t*) describing the query origin.
-  Value *getOrCreateThreadID(Value *Ident);
+  LLVM_ABI Value *getOrCreateThreadID(Value *Ident);
 
   /// The OpenMPIRBuilder Configuration
   OpenMPIRBuilderConfig Config;
@@ -2150,8 +2157,8 @@ class OpenMPIRBuilder {
 
     /// Collect all blocks in between EntryBB and ExitBB in both the given
     /// vector and set.
-    void collectBlocks(SmallPtrSetImpl<BasicBlock *> &BlockSet,
-                       SmallVectorImpl<BasicBlock *> &BlockVector);
+    LLVM_ABI void collectBlocks(SmallPtrSetImpl<BasicBlock *> &BlockSet,
+                                SmallVectorImpl<BasicBlock *> &BlockVector);
 
     /// Return the function that contains the region to be outlined.
     Function *getFunction() const { return EntryBB->getParent(); }
@@ -2180,16 +2187,17 @@ class OpenMPIRBuilder {
   StringMap<GlobalVariable *, BumpPtrAllocator> InternalVars;
 
   /// Computes the size of type in bytes.
-  Value *getSizeInBytes(Value *BasePtr);
+  LLVM_ABI Value *getSizeInBytes(Value *BasePtr);
 
   // Emit a branch from the current block to the Target block only if
   // the current block has a terminator.
-  void emitBranch(BasicBlock *Target);
+  LLVM_ABI void emitBranch(BasicBlock *Target);
 
   // If BB has no use then delete it and return. Else place BB after the current
   // block, if possible, or else at the end of the function. Also add a branch
   // from current block to BB if current block does not have a terminator.
-  void emitBlock(BasicBlock *BB, Function *CurFn, bool IsFinished = false);
+  LLVM_ABI void emitBlock(BasicBlock *BB, Function *CurFn,
+                          bool IsFinished = false);
 
   /// Emits code for OpenMP 'if' clause using specified \a BodyGenCallbackTy
   /// Here is the logic:
@@ -2200,15 +2208,17 @@ class OpenMPIRBuilder {
   /// }
   ///
   /// \return an error, if any were triggered during execution.
-  Error emitIfClause(Value *Cond, BodyGenCallbackTy ThenGen,
-                     BodyGenCallbackTy ElseGen, InsertPointTy AllocaIP = {});
+  LLVM_ABI Error emitIfClause(Value *Cond, BodyGenCallbackTy ThenGen,
+                              BodyGenCallbackTy ElseGen,
+                              InsertPointTy AllocaIP = {});
 
   /// Create the global variable holding the offload mappings information.
-  GlobalVariable *createOffloadMaptypes(SmallVectorImpl<uint64_t> &Mappings,
-                                        std::string VarName);
+  LLVM_ABI GlobalVariable *
+  createOffloadMaptypes(SmallVectorImpl<uint64_t> &Mappings,
+                        std::string VarName);
 
   /// Create the global variable holding the offload names information.
-  GlobalVariable *
+  LLVM_ABI GlobalVariable *
   createOffloadMapnames(SmallVectorImpl<llvm::Constant *> &Names,
                         std::string VarName);
 
@@ -2219,9 +2229,10 @@ class OpenMPIRBuilder {
   };
 
   /// Create the allocas instruction used in call to mapper functions.
-  void createMapperAllocas(const LocationDescription &Loc,
-                           InsertPointTy AllocaIP, unsigned NumOperands,
-                           struct MapperAllocas &MapperAllocas);
+  LLVM_ABI void createMapperAllocas(const LocationDescription &Loc,
+                                    InsertPointTy AllocaIP,
+                                    unsigned NumOperands,
+                                    struct MapperAllocas &MapperAllocas);
 
   /// Create the call for the target mapper function.
   /// \param Loc The source location description.
@@ -2232,10 +2243,11 @@ class OpenMPIRBuilder {
   /// \param MapperAllocas The AllocaInst used for the call.
   /// \param DeviceID Device ID for the call.
   /// \param NumOperands Number of operands in the call.
-  void emitMapperCall(const LocationDescription &Loc, Function *MapperFunc,
-                      Value *SrcLocInfo, Value *MaptypesArg, Value *MapnamesArg,
-                      struct MapperAllocas &MapperAllocas, int64_t DeviceID,
-                      unsigned NumOperands);
+  LLVM_ABI void emitMapperCall(const LocationDescription &Loc,
+                               Function *MapperFunc, Value *SrcLocInfo,
+                               Value *MaptypesArg, Value *MapnamesArg,
+                               struct MapperAllocas &MapperAllocas,
+                               int64_t DeviceID, unsigned NumOperands);
 
   /// Container for the arguments used to pass data to the runtime library.
   struct TargetDataRTArgs {
@@ -2341,9 +2353,9 @@ class OpenMPIRBuilder {
   /// Create the kernel args vector used by emitTargetKernel. This function
   /// creates various constant values that are used in the resulting args
   /// vector.
-  static void getKernelArgsVector(TargetKernelArgs &KernelArgs,
-                                  IRBuilderBase &Builder,
-                                  SmallVector<Value *> &ArgsVector);
+  LLVM_ABI static void getKernelArgsVector(TargetKernelArgs &KernelArgs,
+                                           IRBuilderBase &Builder,
+                                           SmallVector<Value *> &ArgsVector);
 
   /// Struct that keeps the information that should be kept throughout
   /// a 'target data' region.
@@ -2462,11 +2474,10 @@ class OpenMPIRBuilder {
   /// \param DeviceID Identifier for the device via the 'device' clause.
   /// \param RTLoc Source location identifier
   /// \param AllocaIP The insertion point to be used for alloca instructions.
-  InsertPointOrErrorTy
-  emitKernelLaunch(const LocationDescription &Loc, Value *OutlinedFnID,
-                   EmitFallbackCallbackTy EmitTargetCallFallbackCB,
-                   TargetKernelArgs &Args, Value *DeviceID, Value *RTLoc,
-                   InsertPointTy AllocaIP);
+  LLVM_ABI InsertPointOrErrorTy emitKernelLaunch(
+      const LocationDescription &Loc, Value *OutlinedFnID,
+      EmitFallbackCallbackTy EmitTargetCallFallbackCB, TargetKernelArgs &Args,
+      Value *DeviceID, Value *RTLoc, InsertPointTy AllocaIP);
 
   /// Callback type for generating the bodies of device directives that require
   /// outer target tasks (e.g. in case of having `nowait` or `depend` clauses).
@@ -2492,7 +2503,7 @@ class OpenMPIRBuilder {
   ///        dependencies as specified by the 'depend' clause.
   /// \param HasNoWait True if the target construct had 'nowait' on it, false
   ///        otherwise
-  InsertPointOrErrorTy emitTargetTask(
+  LLVM_ABI InsertPointOrErrorTy emitTargetTask(
       TargetTaskBodyCallbackTy TaskBodyCB, Value *DeviceID, Value *RTLoc,
       OpenMPIRBuilder::InsertPointTy AllocaIP,
       const SmallVector<llvm::OpenMPIRBuilder::DependData> &Dependencies,
@@ -2502,23 +2513,22 @@ class OpenMPIRBuilder {
   /// arrays of base pointers, pointers, sizes, map types, and mappers.  If
   /// ForEndCall, emit map types to be passed for the end of the region instead
   /// of the beginning.
-  void emitOffloadingArraysArgument(IRBuilderBase &Builder,
-                                    OpenMPIRBuilder::TargetDataRTArgs &RTArgs,
-                                    OpenMPIRBuilder::TargetDataInfo &Info,
-                                    bool ForEndCall = false);
+  LLVM_ABI void emitOffloadingArraysArgument(
+      IRBuilderBase &Builder, OpenMPIRBuilder::TargetDataRTArgs &RTArgs,
+      OpenMPIRBuilder::TargetDataInfo &Info, bool ForEndCall = false);
 
   /// Emit an array of struct descriptors to be assigned to the offload args.
-  void emitNonContiguousDescriptor(InsertPointTy AllocaIP,
-                                   InsertPointTy CodeGenIP,
-                                   MapInfosTy &CombinedInfo,
-                                   TargetDataInfo &Info);
+  LLVM_ABI void emitNonContiguousDescriptor(InsertPointTy AllocaIP,
+                                            InsertPointTy CodeGenIP,
+                                            MapInfosTy &CombinedInfo,
+                                            TargetDataInfo &Info);
 
   /// Emit the arrays used to pass the captures and map information to the
   /// offloading runtime library. If there is no map or capture information,
   /// return nullptr by reference. Accepts a reference to a MapInfosTy object
   /// that contains information generated for mappable clauses,
   /// including base pointers, pointers, sizes, map types, user-defined mappers.
-  Error emitOffloadingArrays(
+  LLVM_ABI Error emitOffloadingArrays(
       InsertPointTy AllocaIP, InsertPointTy CodeGenIP, MapInfosTy &CombinedInfo,
       TargetDataInfo &Info, CustomMapperCallbackTy CustomMapperCB,
       bool IsNonContiguous = false,
@@ -2530,7 +2540,7 @@ class OpenMPIRBuilder {
   /// library. In essence, this function is a combination of
   /// emitOffloadingArrays and emitOffloadingArraysArgument and should arguably
   /// be preferred by clients of OpenMPIRBuilder.
-  Error emitOffloadingArraysAndArgs(
+  LLVM_ABI Error emitOffloadingArraysAndArgs(
       InsertPointTy AllocaIP, InsertPointTy CodeGenIP, TargetDataInfo &Info,
       TargetDataRTArgs &RTArgs, MapInfosTy &CombinedInfo,
       CustomMapperCallbackTy CustomMapperCB, bool IsNonContiguous = false,
@@ -2539,9 +2549,9 @@ class OpenMPIRBuilder {
 
   /// Creates offloading entry for the provided entry ID \a ID, address \a
   /// Addr, size \a Size, and flags \a Flags.
-  void createOffloadEntry(Constant *ID, Constant *Addr, uint64_t Size,
-                          int32_t Flags, GlobalValue::LinkageTypes,
-                          StringRef Name = "");
+  LLVM_ABI void createOffloadEntry(Constant *ID, Constant *Addr, uint64_t Size,
+                                   int32_t Flags, GlobalValue::LinkageTypes,
+                                   StringRef Name = "");
 
   /// The kind of errors that can occur when emitting the offload entries and
   /// metadata.
@@ -2562,7 +2572,7 @@ class OpenMPIRBuilder {
   // !omp_offload.info = !{!1, ...}
   //
   // We only generate metadata for function that contain target regions.
-  void createOffloadEntriesAndInfoMetadata(
+  LLVM_ABI void createOffloadEntriesAndInfoMetadata(
       EmitMetadataErrorReportFunctionTy &ErrorReportFunction);
 
 public:
@@ -2576,9 +2586,11 @@ class OpenMPIRBuilder {
   ///
   /// \return The insertion position *after* the CopyPrivate call.
 
-  InsertPointTy createCopyPrivate(const LocationDescription &Loc,
-                                  llvm::Value *BufSize, llvm::Value *CpyBuf,
-                                  llvm::Value *CpyFn, llvm::Value *DidIt);
+  LLVM_ABI InsertPointTy createCopyPrivate(const LocationDescription &Loc,
+                                           llvm::Value *BufSize,
+                                           llvm::Value *CpyBuf,
+                                           llvm::Value *CpyFn,
+                                           llvm::Value *DidIt);
 
   /// Generator for '#omp single'
   ///
@@ -2590,11 +2602,11 @@ class OpenMPIRBuilder {
   /// \param CPFuncs copy functions to use for each copyprivate variable.
   ///
   /// \returns The insertion position *after* the single call.
-  InsertPointOrErrorTy createSingle(const LocationDescription &Loc,
-                                    BodyGenCallbackTy BodyGenCB,
-                                    FinalizeCallbackTy FiniCB, bool IsNowait,
-                                    ArrayRef<llvm::Value *> CPVars = {},
-                                    ArrayRef<llvm::Function *> CPFuncs = {});
+  LLVM_ABI InsertPointOrErrorTy
+  createSingle(const LocationDescription &Loc, BodyGenCallbackTy BodyGenCB,
+               FinalizeCallbackTy FiniCB, bool IsNowait,
+               ArrayRef<llvm::Value *> CPVars = {},
+               ArrayRef<llvm::Function *> CPFuncs = {});
 
   /// Generator for '#omp master'
   ///
@@ -2603,9 +2615,9 @@ class OpenMPIRBuilder {
   /// \param FiniCB Callback to finalize variable copies.
   ///
   /// \returns The insertion position *after* the master.
-  InsertPointOrErrorTy createMaster(const LocationDescription &Loc,
-                                    BodyGenCallbackTy BodyGenCB,
-                                    FinalizeCallbackTy FiniCB);
+  LLVM_ABI InsertPointOrErrorTy createMaster(const LocationDescription &Loc,
+                                             BodyGenCallbackTy BodyGenCB,
+                                             FinalizeCallbackTy FiniCB);
 
   /// Generator for '#omp masked'
   ///
@@ -2614,9 +2626,10 @@ class OpenMPIRBuilder {
   /// \param FiniCB Callback to finialize variable copies.
   ///
   /// \returns The insertion position *after* the masked.
-  InsertPointOrErrorTy createMasked(const LocationDescription &Loc,
-                                    BodyGenCallbackTy BodyGenCB,
-                                    FinalizeCallbackTy FiniCB, Value *Filter);
+  LLVM_ABI InsertPointOrErrorTy createMasked(const LocationDescription &Loc,
+                                             BodyGenCallbackTy BodyGenCB,
+                                             FinalizeCallbackTy FiniCB,
+                                             Value *Filter);
 
   /// Generator for '#omp critical'
   ///
@@ -2627,10 +2640,11 @@ class OpenMPIRBuilder {
   /// \param HintInst Hint Instruction for hint clause associated with critical
   ///
   /// \returns The insertion position *after* the critical.
-  InsertPointOrErrorTy createCritical(const LocationDescription &Loc,
-                                      BodyGenCallbackTy BodyGenCB,
-                                      FinalizeCallbackTy FiniCB,
-                                      StringRef CriticalName, Value *HintInst);
+  LLVM_ABI InsertPointOrErrorTy createCritical(const LocationDescription &Loc,
+                                               BodyGenCallbackTy BodyGenCB,
+                                               FinalizeCallbackTy FiniCB,
+                                               StringRef CriticalName,
+                                               Value *HintInst);
 
   /// Generator for '#omp ordered depend (source | sink)'
   ///
@@ -2642,10 +2656,10 @@ class OpenMPIRBuilder {
   /// \param IsDependSource If true, depend source; otherwise, depend sink.
   ///
   /// \return The insertion position *after* the ordered.
-  InsertPointTy createOrderedDepend(const LocationDescription &Loc,
-                                    InsertPointTy AllocaIP, unsigned NumLoops,
-                                    ArrayRef<llvm::Value *> StoreValues,
-                                    const Twine &Name, bool IsDependSource);
+  LLVM_ABI InsertPointTy
+  createOrderedDepend(const LocationDescription &Loc, InsertPointTy AllocaIP,
+                      unsigned NumLoops, ArrayRef<llvm::Value *> StoreValues,
+                      const Twine &Name, bool IsDependSource);
 
   /// Generator for '#omp ordered [threads | simd]'
   ///
@@ -2656,10 +2670,9 @@ class OpenMPIRBuilder {
   /// otherwise, with simd clause;
   ///
   /// \returns The insertion position *after* the ordered.
-  InsertPointOrErrorTy createOrderedThreadsSimd(const LocationDescription &Loc,
-                                                BodyGenCallbackTy BodyGenCB,
-                                                FinalizeCallbackTy FiniCB,
-                                                bool IsThreads);
+  LLVM_ABI InsertPointOrErrorTy createOrderedThreadsSimd(
+      const LocationDescription &Loc, BodyGenCallbackTy BodyGenCB,
+      FinalizeCallbackTy FiniCB, bool IsThreads);
 
   /// Generator for '#omp sections'
   ///
@@ -2672,7 +2685,7 @@ class OpenMPIRBuilder {
   /// \param IsNowait If true, barrier - to ensure all sections are executed
   /// before moving forward will not be generated.
   /// \returns The insertion position *after* the sections.
-  InsertPointOrErrorTy
+  LLVM_ABI InsertPointOrErrorTy
   createSections(const LocationDescription &Loc, InsertPointTy AllocaIP,
                  ArrayRef<StorableBodyGenCallbackTy> SectionCBs,
                  PrivatizeCallbackTy PrivCB, FinalizeCallbackTy FiniCB,
@@ -2684,9 +2697,9 @@ class OpenMPIRBuilder {
   /// \param BodyGenCB Callback that will generate the region body code.
   /// \param FiniCB Callback to finalize variable copies.
   /// \returns The insertion position *after* the section.
-  InsertPointOrErrorTy createSection(const LocationDescription &Loc,
-                                     BodyGenCallbackTy BodyGenCB,
-                                     FinalizeCallbackTy FiniCB);
+  LLVM_ABI InsertPointOrErrorTy createSection(const LocationDescription &Loc,
+                                              BodyGenCallbackTy BodyGenCB,
+                                              FinalizeCallbackTy FiniCB);
 
   /// Generator for `#omp teams`
   ///
@@ -2700,19 +2713,21 @@ class OpenMPIRBuilder {
   ///        contention group created by each team.
   /// \param IfExpr is the integer argument value of the if condition on the
   ///        teams clause.
-  InsertPointOrErrorTy
-  createTeams(const LocationDescription &Loc, BodyGenCallbackTy BodyGenCB,
-              Value *NumTeamsLower = nullptr, Value *NumTeamsUpper = nullptr,
-              Value *ThreadLimit = nullptr, Value *IfExpr = nullptr);
+  LLVM_ABI InsertPointOrErrorTy createTeams(const LocationDescription &Loc,
+                                            BodyGenCallbackTy BodyGenCB,
+                                            Value *NumTeamsLower = nullptr,
+                                            Value *NumTeamsUpper = nullptr,
+                                            Value *ThreadLimit = nullptr,
+                                            Value *IfExpr = nullptr);
 
   /// Generator for `#omp distribute`
   ///
   /// \param Loc The location where the distribute construct was encountered.
   /// \param AllocaIP The insertion points to be used for alloca instructions.
   /// \param BodyGenCB Callback that will generate the region code.
-  InsertPointOrErrorTy createDistribute(const LocationDescription &Loc,
-                                        InsertPointTy AllocaIP,
-                                        BodyGenCallbackTy BodyGenCB);
+  LLVM_ABI InsertPointOrErrorTy createDistribute(const LocationDescription &Loc,
+                                                 InsertPointTy AllocaIP,
+                                                 BodyGenCallbackTy BodyGenCB);
 
   /// Generate conditional branch and relevant BasicBlocks through which private
   /// threads copy the 'copyin' variables from Master copy to threadprivate
@@ -2726,10 +2741,11 @@ class OpenMPIRBuilder {
   //				 and copy.in.end block
   ///
   /// \returns The insertion point where copying operation to be emitted.
-  InsertPointTy createCopyinClauseBlocks(InsertPointTy IP, Value *MasterAddr,
-                                         Value *PrivateAddr,
-                                         llvm::IntegerType *IntPtrTy,
-                                         bool BranchtoEnd = true);
+  LLVM_ABI InsertPointTy createCopyinClauseBlocks(InsertPointTy IP,
+                                                  Value *MasterAddr,
+                                                  Value *PrivateAddr,
+                                                  llvm::IntegerType *IntPtrTy,
+                                                  bool BranchtoEnd = true);
 
   /// Create a runtime call for kmpc_Alloc
   ///
@@ -2739,8 +2755,8 @@ class OpenMPIRBuilder {
   /// \param Name Name of call Instruction for OMP_alloc
   ///
   /// \returns CallInst to the OMP_Alloc call
-  CallInst *createOMPAlloc(const LocationDescription &Loc, Value *Size,
-                           Value *Allocator, std::string Name = "");
+  LLVM_ABI CallInst *createOMPAlloc(const LocationDescription &Loc, Value *Size,
+                                    Value *Allocator, std::string Name = "");
 
   /// Create a runtime call for kmpc_free
   ///
@@ -2750,8 +2766,8 @@ class OpenMPIRBuilder {
   /// \param Name Name of call Instruction for OMP_Free
   ///
   /// \returns CallInst to the OMP_Free call
-  CallInst *createOMPFree(const LocationDescription &Loc, Value *Addr,
-                          Value *Allocator, std::string Name = "");
+  LLVM_ABI CallInst *createOMPFree(const LocationDescription &Loc, Value *Addr,
+                                   Value *Allocator, std::string Name = "");
 
   /// Create a runtime call for kmpc_threadprivate_cached
   ///
@@ -2761,10 +2777,10 @@ class OpenMPIRBuilder {
   /// \param Name Name of call Instruction for callinst
   ///
   /// \returns CallInst to the thread private cache call.
-  CallInst *createCachedThreadPrivate(const LocationDescription &Loc,
-                                      llvm::Value *Pointer,
-                                      llvm::ConstantInt *Size,
-                                      const llvm::Twine &Name = Twine(""));
+  LLVM_ABI CallInst *
+  createCachedThreadPrivate(const LocationDescription &Loc,
+                            llvm::Value *Pointer, llvm::ConstantInt *Size,
+                            const llvm::Twine &Name = Twine(""));
 
   /// Create a runtime call for __tgt_interop_init
   ///
@@ -2777,12 +2793,12 @@ class OpenMPIRBuilder {
   /// \param HaveNowaitClause does nowait clause exist
   ///
   /// \returns CallInst to the __tgt_interop_init call
-  CallInst *createOMPInteropInit(const LocationDescription &Loc,
-                                 Value *InteropVar,
-                                 omp::OMPInteropType InteropType, Value *Device,
-                                 Value *NumDependences,
-                                 Value *DependenceAddress,
-                                 bool HaveNowaitClause);
+  LLVM_ABI CallInst *createOMPInteropInit(const LocationDescription &Loc,
+                                          Value *InteropVar,
+                                          omp::OMPInteropType InteropType,
+                                          Value *Device, Value *NumDependences,
+                                          Value *DependenceAddress,
+                                          bool HaveNowaitClause);
 
   /// Create a runtime call for __tgt_interop_destroy
   ///
@@ -2794,11 +2810,11 @@ class OpenMPIRBuilder {
   /// \param HaveNowaitClause does nowait clause exist
   ///
   /// \returns CallInst to the __tgt_interop_destroy call
-  CallInst *createOMPInteropDestroy(const LocationDescription &Loc,
-                                    Value *InteropVar, Value *Device,
-                                    Value *NumDependences,
-                                    Value *DependenceAddress,
-                                    bool HaveNowaitClause);
+  LLVM_ABI CallInst *createOMPInteropDestroy(const LocationDescription &Loc,
+                                             Value *InteropVar, Value *Device,
+                                             Value *NumDependences,
+                                             Value *DependenceAddress,
+                                             bool HaveNowaitClause);
 
   /// Create a runtime call for __tgt_interop_use
   ///
@@ -2810,10 +2826,11 @@ class OpenMPIRBuilder {
   /// \param HaveNowaitClause does nowait clause exist
   ///
   /// \returns CallInst to the __tgt_interop_use call
-  CallInst *createOMPInteropUse(const LocationDescription &Loc,
-                                Value *InteropVar, Value *Device,
-                                Value *NumDependences, Value *DependenceAddress,
-                                bool HaveNowaitClause);
+  LLVM_ABI CallInst *createOMPInteropUse(const LocationDescription &Loc,
+                                         Value *InteropVar, Value *Device,
+                                         Value *NumDependences,
+                                         Value *DependenceAddress,
+                                         bool HaveNowaitClause);
 
   /// The `omp target` interface
   ///
@@ -2827,7 +2844,7 @@ class OpenMPIRBuilder {
   /// \param Loc The insert and source location description.
   /// \param Attrs Structure containing the default attributes, including
   ///        numbers of threads and teams to launch the kernel with.
-  InsertPointTy createTargetInit(
+  LLVM_ABI InsertPointTy createTargetInit(
       const LocationDescription &Loc,
       const llvm::OpenMPIRBuilder::TargetKernelDefaultAttrs &Attrs);
 
@@ -2838,9 +2855,9 @@ class OpenMPIRBuilder {
   ///        for teams reduction.
   /// \param TeamsReductionBufferLength The number of elements (each of up to
   ///        \p TeamsReductionDataSize size), in the teams reduction buffer.
-  void createTargetDeinit(const LocationDescription &Loc,
-                          int32_t TeamsReductionDataSize = 0,
-                          int32_t TeamsReductionBufferLength = 1024);
+  LLVM_ABI void createTargetDeinit(const LocationDescription &Loc,
+                                   int32_t TeamsReductionDataSize = 0,
+                                   int32_t TeamsReductionBufferLength = 1024);
 
   ///}
 
@@ -2850,17 +2867,18 @@ class OpenMPIRBuilder {
 
   /// Read/write a bounds on threads for \p Kernel. Read will return 0 if none
   /// is set.
-  static std::pair<int32_t, int32_t>
+  LLVM_ABI static std::pair<int32_t, int32_t>
   readThreadBoundsForKernel(const Triple &T, Function &Kernel);
-  static void writeThreadBoundsForKernel(const Triple &T, Function &Kernel,
-                                         int32_t LB, int32_t UB);
+  LLVM_ABI static void writeThreadBoundsForKernel(const Triple &T,
+                                                  Function &Kernel, int32_t LB,
+                                                  int32_t UB);
 
   /// Read/write a bounds on teams for \p Kernel. Read will return 0 if none
   /// is set.
-  static std::pair<int32_t, int32_t> readTeamBoundsForKernel(const Triple &T,
-                                                             Function &Kernel);
-  static void writeTeamsForKernel(const Triple &T, Function &Kernel, int32_t LB,
-                                  int32_t UB);
+  LLVM_ABI static std::pair<int32_t, int32_t>
+  readTeamBoundsForKernel(const Triple &T, Function &Kernel);
+  LLVM_ABI static void writeTeamsForKernel(const Triple &T, Function &Kernel,
+                                           int32_t LB, int32_t UB);
   ///}
 
 private:
@@ -2913,10 +2931,10 @@ class OpenMPIRBuilder {
   /// \param GenerateFunctionCallback The callback function to generate the code
   /// \param OutlinedFunction Pointer to the outlined function
   /// \param EntryFnIDName Name of the ID o be created
-  Error emitTargetRegionFunction(TargetRegionEntryInfo &EntryInfo,
-                                 FunctionGenCallback &GenerateFunctionCallback,
-                                 bool IsOffloadEntry, Function *&OutlinedFn,
-                                 Constant *&OutlinedFnID);
+  LLVM_ABI Error emitTargetRegionFunction(
+      TargetRegionEntryInfo &EntryInfo,
+      FunctionGenCallback &GenerateFunctionCallback, bool IsOffloadEntry,
+      Function *&OutlinedFn, Constant *&OutlinedFnID);
 
   /// Registers the given function and sets up the attribtues of the function
   /// Returns the FunctionID.
@@ -2926,10 +2944,10 @@ class OpenMPIRBuilder {
   /// \param OutlinedFunction Pointer to the outlined function
   /// \param EntryFnName Name of the outlined function
   /// \param EntryFnIDName Name of the ID o be created
-  Constant *registerTargetRegionFunction(TargetRegionEntryInfo &EntryInfo,
-                                         Function *OutlinedFunction,
-                                         StringRef EntryFnName,
-                                         StringRef EntryFnIDName);
+  LLVM_ABI Constant *
+  registerTargetRegionFunction(TargetRegionEntryInfo &EntryInfo,
+                               Function *OutlinedFunction,
+                               StringRef EntryFnName, StringRef EntryFnIDName);
 
   /// Type of BodyGen to use for region codegen
   ///
@@ -3004,7 +3022,7 @@ class OpenMPIRBuilder {
   /// \param FuncName Optional param to specify mapper function name.
   /// \param CustomMapperCB Optional callback to generate code related to
   /// custom mappers.
-  Expected<Function *> emitUserDefinedMapper(
+  LLVM_ABI Expected<Function *> emitUserDefinedMapper(
       function_ref<MapInfosOrErrorTy(
           InsertPointTy CodeGenIP, llvm::Value *PtrPHI, llvm::Value *BeginArg)>
           PrivAndGenMapInfoCB,
@@ -3028,7 +3046,7 @@ class OpenMPIRBuilder {
   /// \param BodyGenCB Optional Callback to generate the region code.
   /// \param DeviceAddrCB Optional callback to generate code related to
   /// use_device_ptr and use_device_addr.
-  InsertPointOrErrorTy createTargetData(
+  LLVM_ABI InsertPointOrErrorTy createTargetData(
       const LocationDescription &Loc, InsertPointTy AllocaIP,
       InsertPointTy CodeGenIP, Value *DeviceID, Value *IfCond,
       TargetDataInfo &Info, GenMapInfoCallbackTy GenMapInfoCB,
@@ -3071,7 +3089,7 @@ class OpenMPIRBuilder {
   ///        dependency information as passed in the depend clause
   /// \param HasNowait Whether the target construct has a `nowait` clause or
   ///        not.
-  InsertPointOrErrorTy createTarget(
+  LLVM_ABI InsertPointOrErrorTy createTarget(
       const LocationDescription &Loc, bool IsOffloadEntry,
       OpenMPIRBuilder::InsertPointTy AllocaIP,
       OpenMPIRBuilder::InsertPointTy CodeGenIP, TargetDataInfo &Info,
@@ -3087,23 +3105,27 @@ class OpenMPIRBuilder {
   /// Returns __kmpc_for_static_init_* runtime function for the specified
   /// size \a IVSize and sign \a IVSigned. Will create a distribute call
   /// __kmpc_distribute_static_init* if \a IsGPUDistribute is set.
-  FunctionCallee createForStaticInitFunction(unsigned IVSize, bool IVSigned,
-                                             bool IsGPUDistribute);
+  LLVM_ABI FunctionCallee createForStaticInitFunction(unsigned IVSize,
+                                                      bool IVSigned,
+                                                      bool IsGPUDistribute);
 
   /// Returns __kmpc_dispatch_init_* runtime function for the specified
   /// size \a IVSize and sign \a IVSigned.
-  FunctionCallee createDispatchInitFunction(unsigned IVSize, bool IVSigned);
+  LLVM_ABI FunctionCallee createDispatchInitFunction(unsigned IVSize,
+                                                     bool IVSigned);
 
   /// Returns __kmpc_dispatch_next_* runtime function for the specified
   /// size \a IVSize and sign \a IVSigned.
-  FunctionCallee createDispatchNextFunction(unsigned IVSize, bool IVSigned);
+  LLVM_ABI FunctionCallee createDispatchNextFunction(unsigned IVSize,
+                                                     bool IVSigned);
 
   /// Returns __kmpc_dispatch_fini_* runtime function for the specified
   /// size \a IVSize and sign \a IVSigned.
-  FunctionCallee createDispatchFiniFunction(unsigned IVSize, bool IVSigned);
+  LLVM_ABI FunctionCallee createDispatchFiniFunction(unsigned IVSize,
+                                                     bool IVSigned);
 
   /// Returns __kmpc_dispatch_deinit runtime function.
-  FunctionCallee createDispatchDeinitFunction();
+  LLVM_ABI FunctionCallee createDispatchDeinitFunction();
 
   /// Declarations for LLVM-IR types (simple, array, function and structure) are
   /// generated below. Their names are defined and used in OpenMPKinds.def. Here
@@ -3284,9 +3306,10 @@ class OpenMPIRBuilder {
   /// \param AllocaIP           Insert point for allocas
   //
   /// \return Insertion point after generated atomic read IR.
-  InsertPointTy createAtomicRead(const LocationDescription &Loc,
-                                 AtomicOpValue &X, AtomicOpValue &V,
-                                 AtomicOrdering AO, InsertPointTy AllocaIP);
+  LLVM_ABI InsertPointTy createAtomicRead(const LocationDescription &Loc,
+                                          AtomicOpValue &X, AtomicOpValue &V,
+                                          AtomicOrdering AO,
+                                          InsertPointTy AllocaIP);
 
   /// Emit atomic write for : X = Expr --- Only Scalar data types.
   ///
@@ -3298,9 +3321,10 @@ class OpenMPIRBuilder {
   /// \param AllocaIP           Insert point for allocas
   ///
   /// \return Insertion point after generated atomic Write IR.
-  InsertPointTy createAtomicWrite(const LocationDescription &Loc,
-                                  AtomicOpValue &X, Value *Expr,
-                                  AtomicOrdering AO, InsertPointTy AllocaIP);
+  LLVM_ABI InsertPointTy createAtomicWrite(const LocationDescription &Loc,
+                                           AtomicOpValue &X, Value *Expr,
+                                           AtomicOrdering AO,
+                                           InsertPointTy AllocaIP);
 
   /// Emit atomic update for constructs: X = X BinOp Expr ,or X = Expr BinOp X
   /// For complex Operations: X = UpdateOp(X) => CmpExch X, old_X, UpdateOp(X)
@@ -3322,11 +3346,10 @@ class OpenMPIRBuilder {
   ///	                    (e.g. true for X = X BinOp Expr)
   ///
   /// \return Insertion point after generated atomic update IR.
-  InsertPointOrErrorTy
-  createAtomicUpdate(const LocationDescription &Loc, InsertPointTy AllocaIP,
-                     AtomicOpValue &X, Value *Expr, AtomicOrdering AO,
-                     AtomicRMWInst::BinOp RMWOp,
-                     AtomicUpdateCallbackTy &UpdateOp, bool IsXBinopExpr);
+  LLVM_ABI InsertPointOrErrorTy createAtomicUpdate(
+      const LocationDescription &Loc, InsertPointTy AllocaIP, AtomicOpValue &X,
+      Value *Expr, AtomicOrdering AO, AtomicRMWInst::BinOp RMWOp,
+      AtomicUpdateCallbackTy &UpdateOp, bool IsXBinopExpr);
 
   /// Emit atomic update for constructs: --- Only Scalar data types
   /// V = X; X = X BinOp Expr ,
@@ -3357,12 +3380,11 @@ class OpenMPIRBuilder {
   ///                        'v', not an updated one.
   ///
   /// \return Insertion point after generated atomic capture IR.
-  InsertPointOrErrorTy
-  createAtomicCapture(const LocationDescription &Loc, InsertPointTy AllocaIP,
-                      AtomicOpValue &X, AtomicOpValue &V, Value *Expr,
-                      AtomicOrdering AO, AtomicRMWInst::BinOp RMWOp,
-                      AtomicUpdateCallbackTy &UpdateOp, bool UpdateExpr,
-                      bool IsPostfixUpdate, bool IsXBinopExpr);
+  LLVM_ABI InsertPointOrErrorTy createAtomicCapture(
+      const LocationDescription &Loc, InsertPointTy AllocaIP, AtomicOpValue &X,
+      AtomicOpValue &V, Value *Expr, AtomicOrdering AO,
+      AtomicRMWInst::BinOp RMWOp, AtomicUpdateCallbackTy &UpdateOp,
+      bool UpdateExpr, bool IsPostfixUpdate, bool IsXBinopExpr);
 
   /// Emit atomic compare for constructs: --- Only scalar data types
   /// cond-expr-stmt:
@@ -3409,18 +3431,16 @@ class OpenMPIRBuilder {
   ///                     the case the comparison is '=='.
   ///
   /// \return Insertion point after generated atomic capture IR.
-  InsertPointTy
+  LLVM_ABI InsertPointTy
   createAtomicCompare(const LocationDescription &Loc, AtomicOpValue &X,
                       AtomicOpValue &V, AtomicOpValue &R, Value *E, Value *D,
                       AtomicOrdering AO, omp::OMPAtomicCompareOp Op,
                       bool IsXBinopExpr, bool IsPostfixUpdate, bool IsFailOnly);
-  InsertPointTy createAtomicCompare(const LocationDescription &Loc,
-                                    AtomicOpValue &X, AtomicOpValue &V,
-                                    AtomicOpValue &R, Value *E, Value *D,
-                                    AtomicOrdering AO,
-                                    omp::OMPAtomicCompareOp Op,
-                                    bool IsXBinopExpr, bool IsPostfixUpdate,
-                                    bool IsFailOnly, AtomicOrdering Failure);
+  LLVM_ABI InsertPointTy createAtomicCompare(
+      const LocationDescription &Loc, AtomicOpValue &X, AtomicOpValue &V,
+      AtomicOpValue &R, Value *E, Value *D, AtomicOrdering AO,
+      omp::OMPAtomicCompareOp Op, bool IsXBinopExpr, bool IsPostfixUpdate,
+      bool IsFailOnly, AtomicOrdering Failure);
 
   /// Create the control flow structure of a canonical OpenMP loop.
   ///
@@ -3438,11 +3458,11 @@ class OpenMPIRBuilder {
   ///                  and instruction names.
   ///
   /// \returns The CanonicalLoopInfo that represents the emitted loop.
-  CanonicalLoopInfo *createLoopSkeleton(DebugLoc DL, Value *TripCount,
-                                        Function *F,
-                                        BasicBlock *PreInsertBefore,
-                                        BasicBlock *PostInsertBefore,
-                                        const Twine &Name = {});
+  LLVM_ABI CanonicalLoopInfo *createLoopSkeleton(DebugLoc DL, Value *TripCount,
+                                                 Function *F,
+                                                 BasicBlock *PreInsertBefore,
+                                                 BasicBlock *PostInsertBefore,
+                                                 const Twine &Name = {});
   /// OMP Offload Info Metadata name string
   const std::string ompOffloadInfoName = "omp_offload.info";
 
@@ -3452,7 +3472,7 @@ class OpenMPIRBuilder {
   ///
   /// \param M         Module to load Metadata info from. Module passed maybe
   /// loaded from bitcode file, i.e, 
diff erent from OpenMPIRBuilder::M module.
-  void loadOffloadInfoMetadata(Module &M);
+  LLVM_ABI void loadOffloadInfoMetadata(Module &M);
 
   /// Loads all the offload entries information from the host IR
   /// metadata read from the file passed in as the HostFilePath argument. This
@@ -3461,7 +3481,7 @@ class OpenMPIRBuilder {
   /// \param HostFilePath The path to the host IR file,
   /// used to load in offload metadata for the device, allowing host and device
   /// to maintain the same metadata mapping.
-  void loadOffloadInfoMetadata(StringRef HostFilePath);
+  LLVM_ABI void loadOffloadInfoMetadata(StringRef HostFilePath);
 
   /// Gets (if variable with the given name already exist) or creates
   /// internal global variable with the specified Name. The created variable has
@@ -3469,8 +3489,9 @@ class OpenMPIRBuilder {
   /// \param Ty Type of the global variable. If it is exist already the type
   /// must be the same.
   /// \param Name Name of the variable.
-  GlobalVariable *getOrCreateInternalVariable(Type *Ty, const StringRef &Name,
-                                              unsigned AddressSpace = 0);
+  LLVM_ABI GlobalVariable *
+  getOrCreateInternalVariable(Type *Ty, const StringRef &Name,
+                              unsigned AddressSpace = 0);
 };
 
 /// Class to represented the control flow structure of an OpenMP canonical loop.
@@ -3636,7 +3657,7 @@ class CanonicalLoopInfo {
   /// Code that must be execute before any loop iteration can be emitted here,
   /// such as computing the loop trip count and begin lifetime markers. Code in
   /// the preheader is not considered part of the canonical loop.
-  BasicBlock *getPreheader() const;
+  LLVM_ABI BasicBlock *getPreheader() const;
 
   /// The header is the entry for each iteration. In the canonical control flow,
   /// it only contains the PHINode for the induction variable.
@@ -3736,11 +3757,11 @@ class CanonicalLoopInfo {
   }
 
   /// Consistency self-check.
-  void assertOK() const;
+  LLVM_ABI void assertOK() const;
 
   /// Invalidate this loop. That is, the underlying IR does not fulfill the
   /// requirements of an OpenMP canonical loop anymore.
-  void invalidate();
+  LLVM_ABI void invalidate();
 };
 
 } // end namespace llvm

diff  --git a/llvm/include/llvm/FuzzMutate/FuzzerCLI.h b/llvm/include/llvm/FuzzMutate/FuzzerCLI.h
index d6518107b24b6..3641b82f37d8b 100644
--- a/llvm/include/llvm/FuzzMutate/FuzzerCLI.h
+++ b/llvm/include/llvm/FuzzMutate/FuzzerCLI.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_FUZZMUTATE_FUZZERCLI_H
 #define LLVM_FUZZMUTATE_FUZZERCLI_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DataTypes.h"
 #include <stddef.h>
 
@@ -24,7 +25,7 @@ class StringRef;
 /// Parse cl::opts from a fuzz target commandline.
 ///
 /// This handles all arguments after -ignore_remaining_args=1 as cl::opts.
-void parseFuzzerCLOpts(int ArgC, char *ArgV[]);
+LLVM_ABI void parseFuzzerCLOpts(int ArgC, char *ArgV[]);
 
 /// Handle backend options that are encoded in the executable name.
 ///
@@ -35,11 +36,11 @@ void parseFuzzerCLOpts(int ArgC, char *ArgV[]);
 ///
 /// This is meant to be used for environments like OSS-Fuzz that aren't capable
 /// of passing in command line arguments in the normal way.
-void handleExecNameEncodedBEOpts(StringRef ExecName);
+LLVM_ABI void handleExecNameEncodedBEOpts(StringRef ExecName);
 
 /// Handle optimizer options which are encoded in the executable name.
 /// Same semantics as in 'handleExecNameEncodedBEOpts'.
-void handleExecNameEncodedOptimizerOpts(StringRef ExecName);
+LLVM_ABI void handleExecNameEncodedOptimizerOpts(StringRef ExecName);
 
 using FuzzerTestFun = int (*)(const uint8_t *Data, size_t Size);
 using FuzzerInitFun = int (*)(int *argc, char ***argv);
@@ -48,7 +49,7 @@ using FuzzerInitFun = int (*)(int *argc, char ***argv);
 ///
 /// Useful for testing fuzz targets without linking to libFuzzer. Finds inputs
 /// in the argument list in a libFuzzer compatible way.
-int runFuzzerOnInputs(
+LLVM_ABI int runFuzzerOnInputs(
     int ArgC, char *ArgV[], FuzzerTestFun TestOne,
     FuzzerInitFun Init = [](int *, char ***) { return 0; });
 

diff  --git a/llvm/include/llvm/FuzzMutate/IRMutator.h b/llvm/include/llvm/FuzzMutate/IRMutator.h
index dd4534bd9d1a8..4b02578792bc4 100644
--- a/llvm/include/llvm/FuzzMutate/IRMutator.h
+++ b/llvm/include/llvm/FuzzMutate/IRMutator.h
@@ -19,6 +19,7 @@
 #define LLVM_FUZZMUTATE_IRMUTATOR_H
 
 #include "llvm/FuzzMutate/OpDescriptor.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <optional>
 
@@ -32,7 +33,7 @@ struct RandomIRBuilder;
 
 /// Base class for describing how to mutate a module. mutation functions for
 /// each IR unit forward to the contained unit.
-class IRMutationStrategy {
+class LLVM_ABI IRMutationStrategy {
 public:
   virtual ~IRMutationStrategy() = default;
 
@@ -75,18 +76,18 @@ class IRMutator {
   ///
   /// \param M module
   /// \return number of objects in module
-  static size_t getModuleSize(const Module &M);
+  LLVM_ABI static size_t getModuleSize(const Module &M);
 
   /// Mutate given module. No change will be made if no strategy is selected.
   ///
   /// \param M  module to mutate
   /// \param Seed seed for random mutation
   /// \param MaxSize max module size (see getModuleSize)
-  void mutateModule(Module &M, int Seed, size_t MaxSize);
+  LLVM_ABI void mutateModule(Module &M, int Seed, size_t MaxSize);
 };
 
 /// Strategy that injects operations into the function.
-class InjectorIRStrategy : public IRMutationStrategy {
+class LLVM_ABI InjectorIRStrategy : public IRMutationStrategy {
   std::vector<fuzzerop::OpDescriptor> Operations;
 
   std::optional<fuzzerop::OpDescriptor> chooseOperation(Value *Src,
@@ -109,7 +110,7 @@ class InjectorIRStrategy : public IRMutationStrategy {
 };
 
 /// Strategy that deletes instructions when the Module is too large.
-class InstDeleterIRStrategy : public IRMutationStrategy {
+class LLVM_ABI InstDeleterIRStrategy : public IRMutationStrategy {
 public:
   uint64_t getWeight(size_t CurrentSize, size_t MaxSize,
                      uint64_t CurrentWeight) override;
@@ -120,7 +121,7 @@ class InstDeleterIRStrategy : public IRMutationStrategy {
 };
 
 /// Strategy that modifies instruction attributes and operands.
-class InstModificationIRStrategy : public IRMutationStrategy {
+class LLVM_ABI InstModificationIRStrategy : public IRMutationStrategy {
 public:
   uint64_t getWeight(size_t CurrentSize, size_t MaxSize,
                      uint64_t CurrentWeight) override {
@@ -134,7 +135,7 @@ class InstModificationIRStrategy : public IRMutationStrategy {
 /// Strategy that generates new function calls and inserts function signatures
 /// to the modules. If any signatures are present in the module it will be
 /// called.
-class InsertFunctionStrategy : public IRMutationStrategy {
+class LLVM_ABI InsertFunctionStrategy : public IRMutationStrategy {
 public:
   uint64_t getWeight(size_t CurrentSize, size_t MaxSize,
                      uint64_t CurrentWeight) override {
@@ -146,7 +147,7 @@ class InsertFunctionStrategy : public IRMutationStrategy {
 };
 
 /// Strategy to split a random block and insert a random CFG in between.
-class InsertCFGStrategy : public IRMutationStrategy {
+class LLVM_ABI InsertCFGStrategy : public IRMutationStrategy {
 private:
   uint64_t MaxNumCases;
   enum CFGToSink { Return, DirectSink, SinkOrSelfLoop, EndOfCFGToLink };
@@ -166,7 +167,7 @@ class InsertCFGStrategy : public IRMutationStrategy {
 };
 
 /// Strategy to insert PHI Nodes at the head of each basic block.
-class InsertPHIStrategy : public IRMutationStrategy {
+class LLVM_ABI InsertPHIStrategy : public IRMutationStrategy {
 public:
   uint64_t getWeight(size_t CurrentSize, size_t MaxSize,
                      uint64_t CurrentWeight) override {
@@ -178,7 +179,7 @@ class InsertPHIStrategy : public IRMutationStrategy {
 
 /// Strategy to select a random instruction and add a new sink (user) to it to
 /// increate data dependency.
-class SinkInstructionStrategy : public IRMutationStrategy {
+class LLVM_ABI SinkInstructionStrategy : public IRMutationStrategy {
 public:
   uint64_t getWeight(size_t CurrentSize, size_t MaxSize,
                      uint64_t CurrentWeight) override {
@@ -191,7 +192,7 @@ class SinkInstructionStrategy : public IRMutationStrategy {
 
 /// Strategy to randomly select a block and shuffle the operations without
 /// affecting data dependency.
-class ShuffleBlockStrategy : public IRMutationStrategy {
+class LLVM_ABI ShuffleBlockStrategy : public IRMutationStrategy {
 public:
   uint64_t getWeight(size_t CurrentSize, size_t MaxSize,
                      uint64_t CurrentWeight) override {
@@ -206,8 +207,8 @@ class ShuffleBlockStrategy : public IRMutationStrategy {
 /// \param Data Bitcode we are going to parse
 /// \param Size Size of the 'Data' in bytes
 /// \return New module or nullptr in case of error
-std::unique_ptr<Module> parseModule(const uint8_t *Data, size_t Size,
-                                    LLVMContext &Context);
+LLVM_ABI std::unique_ptr<Module> parseModule(const uint8_t *Data, size_t Size,
+                                             LLVMContext &Context);
 
 /// Fuzzer friendly interface for the llvm bitcode printer.
 ///
@@ -216,13 +217,13 @@ std::unique_ptr<Module> parseModule(const uint8_t *Data, size_t Size,
 /// \param MaxSize Size of the destination buffer
 /// \return Number of bytes that were written. When module size exceeds MaxSize
 ///         returns 0 and leaves Dest unchanged.
-size_t writeModule(const Module &M, uint8_t *Dest, size_t MaxSize);
+LLVM_ABI size_t writeModule(const Module &M, uint8_t *Dest, size_t MaxSize);
 
 /// Try to parse module and verify it. May output verification errors to the
 /// errs().
 /// \return New module or nullptr in case of error.
-std::unique_ptr<Module> parseAndVerify(const uint8_t *Data, size_t Size,
-                                       LLVMContext &Context);
+LLVM_ABI std::unique_ptr<Module>
+parseAndVerify(const uint8_t *Data, size_t Size, LLVMContext &Context);
 
 } // namespace llvm
 

diff  --git a/llvm/include/llvm/FuzzMutate/OpDescriptor.h b/llvm/include/llvm/FuzzMutate/OpDescriptor.h
index 771b711dd1b48..9c449c100ae8e 100644
--- a/llvm/include/llvm/FuzzMutate/OpDescriptor.h
+++ b/llvm/include/llvm/FuzzMutate/OpDescriptor.h
@@ -21,6 +21,7 @@
 #include "llvm/IR/InstrTypes.h"
 #include "llvm/IR/Type.h"
 #include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
 #include <functional>
 
 namespace llvm {
@@ -29,8 +30,8 @@ namespace fuzzerop {
 
 /// @{
 /// Populate a small list of potentially interesting constants of a given type.
-void makeConstantsWithType(Type *T, std::vector<Constant *> &Cs);
-std::vector<Constant *> makeConstantsWithType(Type *T);
+LLVM_ABI void makeConstantsWithType(Type *T, std::vector<Constant *> &Cs);
+LLVM_ABI std::vector<Constant *> makeConstantsWithType(Type *T);
 /// @}
 
 /// A matcher/generator for finding suitable values for the next source in an

diff  --git a/llvm/include/llvm/FuzzMutate/Operations.h b/llvm/include/llvm/FuzzMutate/Operations.h
index 84155730a93cd..4f972886d4491 100644
--- a/llvm/include/llvm/FuzzMutate/Operations.h
+++ b/llvm/include/llvm/FuzzMutate/Operations.h
@@ -17,37 +17,44 @@
 #include "llvm/FuzzMutate/OpDescriptor.h"
 #include "llvm/IR/InstrTypes.h"
 #include "llvm/IR/Instruction.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
 /// Getters for the default sets of operations, per general category.
 /// @{
-void describeFuzzerIntOps(std::vector<fuzzerop::OpDescriptor> &Ops);
-void describeFuzzerFloatOps(std::vector<fuzzerop::OpDescriptor> &Ops);
-void describeFuzzerControlFlowOps(std::vector<fuzzerop::OpDescriptor> &Ops);
-void describeFuzzerPointerOps(std::vector<fuzzerop::OpDescriptor> &Ops);
-void describeFuzzerAggregateOps(std::vector<fuzzerop::OpDescriptor> &Ops);
-void describeFuzzerVectorOps(std::vector<fuzzerop::OpDescriptor> &Ops);
-void describeFuzzerUnaryOperations(std::vector<fuzzerop::OpDescriptor> &Ops);
-void describeFuzzerOtherOps(std::vector<fuzzerop::OpDescriptor> &Ops);
+LLVM_ABI void describeFuzzerIntOps(std::vector<fuzzerop::OpDescriptor> &Ops);
+LLVM_ABI void describeFuzzerFloatOps(std::vector<fuzzerop::OpDescriptor> &Ops);
+LLVM_ABI void
+describeFuzzerControlFlowOps(std::vector<fuzzerop::OpDescriptor> &Ops);
+LLVM_ABI void
+describeFuzzerPointerOps(std::vector<fuzzerop::OpDescriptor> &Ops);
+LLVM_ABI void
+describeFuzzerAggregateOps(std::vector<fuzzerop::OpDescriptor> &Ops);
+LLVM_ABI void describeFuzzerVectorOps(std::vector<fuzzerop::OpDescriptor> &Ops);
+LLVM_ABI void
+describeFuzzerUnaryOperations(std::vector<fuzzerop::OpDescriptor> &Ops);
+LLVM_ABI void describeFuzzerOtherOps(std::vector<fuzzerop::OpDescriptor> &Ops);
 /// @}
 
 namespace fuzzerop {
 
 /// Descriptors for individual operations.
 /// @{
-OpDescriptor selectDescriptor(unsigned Weight);
-OpDescriptor fnegDescriptor(unsigned Weight);
-OpDescriptor binOpDescriptor(unsigned Weight, Instruction::BinaryOps Op);
-OpDescriptor cmpOpDescriptor(unsigned Weight, Instruction::OtherOps CmpOp,
-                             CmpInst::Predicate Pred);
-OpDescriptor splitBlockDescriptor(unsigned Weight);
-OpDescriptor gepDescriptor(unsigned Weight);
-OpDescriptor extractValueDescriptor(unsigned Weight);
-OpDescriptor insertValueDescriptor(unsigned Weight);
-OpDescriptor extractElementDescriptor(unsigned Weight);
-OpDescriptor insertElementDescriptor(unsigned Weight);
-OpDescriptor shuffleVectorDescriptor(unsigned Weight);
+LLVM_ABI OpDescriptor selectDescriptor(unsigned Weight);
+LLVM_ABI OpDescriptor fnegDescriptor(unsigned Weight);
+LLVM_ABI OpDescriptor binOpDescriptor(unsigned Weight,
+                                      Instruction::BinaryOps Op);
+LLVM_ABI OpDescriptor cmpOpDescriptor(unsigned Weight,
+                                      Instruction::OtherOps CmpOp,
+                                      CmpInst::Predicate Pred);
+LLVM_ABI OpDescriptor splitBlockDescriptor(unsigned Weight);
+LLVM_ABI OpDescriptor gepDescriptor(unsigned Weight);
+LLVM_ABI OpDescriptor extractValueDescriptor(unsigned Weight);
+LLVM_ABI OpDescriptor insertValueDescriptor(unsigned Weight);
+LLVM_ABI OpDescriptor extractElementDescriptor(unsigned Weight);
+LLVM_ABI OpDescriptor insertElementDescriptor(unsigned Weight);
+LLVM_ABI OpDescriptor shuffleVectorDescriptor(unsigned Weight);
 
 /// @}
 

diff  --git a/llvm/include/llvm/FuzzMutate/RandomIRBuilder.h b/llvm/include/llvm/FuzzMutate/RandomIRBuilder.h
index af6d7216b77b5..65b1ca686416f 100644
--- a/llvm/include/llvm/FuzzMutate/RandomIRBuilder.h
+++ b/llvm/include/llvm/FuzzMutate/RandomIRBuilder.h
@@ -15,6 +15,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 #include <random>
 
 namespace llvm {
@@ -49,11 +50,12 @@ struct RandomIRBuilder {
 
   /// Create a stack memory at the head of the function, store \c Init to the
   /// memory if provided.
-  AllocaInst *createStackMemory(Function *F, Type *Ty, Value *Init = nullptr);
+  LLVM_ABI AllocaInst *createStackMemory(Function *F, Type *Ty,
+                                         Value *Init = nullptr);
   /// Find or create a global variable. It will be initialized by random
   /// constants that satisfies \c Pred. It will also report whether this global
   /// variable found or created.
-  std::pair<GlobalVariable *, bool>
+  LLVM_ABI std::pair<GlobalVariable *, bool>
   findOrCreateGlobalVariable(Module *M, ArrayRef<Value *> Srcs,
                              fuzzerop::SourcePred Pred);
   enum SourceType {
@@ -67,19 +69,22 @@ struct RandomIRBuilder {
   /// Find a "source" for some operation, which will be used in one of the
   /// operation's operands. This either selects an instruction in \c Insts or
   /// returns some new arbitrary Value.
-  Value *findOrCreateSource(BasicBlock &BB, ArrayRef<Instruction *> Insts);
+  LLVM_ABI Value *findOrCreateSource(BasicBlock &BB,
+                                     ArrayRef<Instruction *> Insts);
   /// Find a "source" for some operation, which will be used in one of the
   /// operation's operands. This either selects an instruction in \c Insts that
   /// matches \c Pred, or returns some new Value that matches \c Pred. The
   /// values in \c Srcs should be source operands that have already been
   /// selected.
-  Value *findOrCreateSource(BasicBlock &BB, ArrayRef<Instruction *> Insts,
+  LLVM_ABI Value *findOrCreateSource(BasicBlock &BB,
+                                     ArrayRef<Instruction *> Insts,
+                                     ArrayRef<Value *> Srcs,
+                                     fuzzerop::SourcePred Pred,
+                                     bool allowConstant = true);
+  /// Create some Value suitable as a source for some operation.
+  LLVM_ABI Value *newSource(BasicBlock &BB, ArrayRef<Instruction *> Insts,
                             ArrayRef<Value *> Srcs, fuzzerop::SourcePred Pred,
                             bool allowConstant = true);
-  /// Create some Value suitable as a source for some operation.
-  Value *newSource(BasicBlock &BB, ArrayRef<Instruction *> Insts,
-                   ArrayRef<Value *> Srcs, fuzzerop::SourcePred Pred,
-                   bool allowConstant = true);
 
   enum SinkType {
     /// TODO: Also consider pointers in function argument.
@@ -92,17 +97,18 @@ struct RandomIRBuilder {
   };
   /// Find a viable user for \c V in \c Insts, which should all be contained in
   /// \c BB. This may also create some new instruction in \c BB and use that.
-  Instruction *connectToSink(BasicBlock &BB, ArrayRef<Instruction *> Insts,
-                             Value *V);
+  LLVM_ABI Instruction *connectToSink(BasicBlock &BB,
+                                      ArrayRef<Instruction *> Insts, Value *V);
   /// Create a user for \c V in \c BB.
-  Instruction *newSink(BasicBlock &BB, ArrayRef<Instruction *> Insts, Value *V);
-  Value *findPointer(BasicBlock &BB, ArrayRef<Instruction *> Insts);
+  LLVM_ABI Instruction *newSink(BasicBlock &BB, ArrayRef<Instruction *> Insts,
+                                Value *V);
+  LLVM_ABI Value *findPointer(BasicBlock &BB, ArrayRef<Instruction *> Insts);
   /// Return a uniformly choosen type from \c AllowedTypes
-  Type *randomType();
-  Function *createFunctionDeclaration(Module &M, uint64_t ArgNum);
-  Function *createFunctionDeclaration(Module &M);
-  Function *createFunctionDefinition(Module &M, uint64_t ArgNum);
-  Function *createFunctionDefinition(Module &M);
+  LLVM_ABI Type *randomType();
+  LLVM_ABI Function *createFunctionDeclaration(Module &M, uint64_t ArgNum);
+  LLVM_ABI Function *createFunctionDeclaration(Module &M);
+  LLVM_ABI Function *createFunctionDefinition(Module &M, uint64_t ArgNum);
+  LLVM_ABI Function *createFunctionDefinition(Module &M);
 };
 
 } // namespace llvm


        


More information about the llvm-commits mailing list