[llvm] [llvm] annotate interfaces in llvm/MC and llvm/MCA for DLL export (PR #142655)

Andrew Rogers via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 3 12:08:21 PDT 2025


https://github.com/andrurogerz created https://github.com/llvm/llvm-project/pull/142655

## Purpose

This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/MC` and `llvm/MCA` 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"` to files where it was not auto-added by IDS due to no pre-existing block of include statements.
- Explicitly make classes non-copyable where needed to due IDS adding LLVM_ABI at the class level

## 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

>From 514264041d104bfb4851138d7a8c99beb932c82b Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Wed, 28 May 2025 12:26:33 -0700
Subject: [PATCH 1/3] [llvm] annotate interfaces in MC and MCA libraries for
 DLL export

---
 llvm/include/llvm/MC/MCAsmBackend.h           |   3 +-
 llvm/include/llvm/MC/MCAsmInfo.h              |   3 +-
 llvm/include/llvm/MC/MCAsmMacro.h             |   9 +-
 llvm/include/llvm/MC/MCAssembler.h            |  41 ++++---
 llvm/include/llvm/MC/MCCodeEmitter.h          |   2 +-
 llvm/include/llvm/MC/MCContext.h              | 116 +++++++++---------
 .../llvm/MC/MCDisassembler/MCDisassembler.h   |   5 +-
 .../llvm/MC/MCDisassembler/MCRelocationInfo.h |   2 +-
 .../llvm/MC/MCDisassembler/MCSymbolizer.h     |   3 +-
 llvm/include/llvm/MC/MCDwarf.h                |  47 +++----
 llvm/include/llvm/MC/MCExpr.h                 |  35 +++---
 llvm/include/llvm/MC/MCFragment.h             |   9 +-
 llvm/include/llvm/MC/MCInst.h                 |  17 +--
 llvm/include/llvm/MC/MCInstPrinter.h          |   8 +-
 llvm/include/llvm/MC/MCInstrAnalysis.h        |   3 +-
 llvm/include/llvm/MC/MCInstrDesc.h            |   7 +-
 llvm/include/llvm/MC/MCInstrInfo.h            |   3 +-
 .../llvm/MC/MCLinkerOptimizationHint.h        |   5 +-
 llvm/include/llvm/MC/MCMachObjectWriter.h     |   7 +-
 llvm/include/llvm/MC/MCObjectFileInfo.h       |   3 +-
 llvm/include/llvm/MC/MCObjectWriter.h         |   7 +-
 llvm/include/llvm/MC/MCParser/AsmLexer.h      |  11 +-
 llvm/include/llvm/MC/MCParser/MCAsmParser.h   |   9 +-
 .../llvm/MC/MCParser/MCAsmParserExtension.h   |   3 +-
 .../llvm/MC/MCParser/MCParsedAsmOperand.h     |   3 +-
 .../llvm/MC/MCParser/MCTargetAsmParser.h      |   3 +-
 llvm/include/llvm/MC/MCPseudoProbe.h          |  39 +++---
 llvm/include/llvm/MC/MCRegisterInfo.h         |   3 +-
 llvm/include/llvm/MC/MCSchedule.h             |  19 +--
 llvm/include/llvm/MC/MCSection.h              |   3 +-
 llvm/include/llvm/MC/MCSectionMachO.h         |   3 +-
 llvm/include/llvm/MC/MCStreamer.h             |   9 +-
 llvm/include/llvm/MC/MCSubtargetInfo.h        |   3 +-
 llvm/include/llvm/MC/MCSymbol.h               |  11 +-
 llvm/include/llvm/MC/MCTargetOptions.h        |   7 +-
 .../llvm/MC/MCTargetOptionsCommandFlags.h     |  45 +++----
 llvm/include/llvm/MC/MCWinEH.h                |   3 +-
 llvm/include/llvm/MC/StringTableBuilder.h     |  19 +--
 llvm/include/llvm/MC/TargetRegistry.h         |  40 +++---
 llvm/include/llvm/MCA/CodeEmitter.h           |   3 +-
 llvm/include/llvm/MCA/Context.h               |   5 +-
 llvm/include/llvm/MCA/CustomBehaviour.h       |   5 +-
 llvm/include/llvm/MCA/HWEventListener.h       |   3 +-
 .../llvm/MCA/HardwareUnits/HardwareUnit.h     |   2 +-
 llvm/include/llvm/MCA/HardwareUnits/LSUnit.h  |   5 +-
 .../llvm/MCA/HardwareUnits/ResourceManager.h  |  35 +++---
 .../llvm/MCA/HardwareUnits/Scheduler.h        |  23 ++--
 llvm/include/llvm/MCA/IncrementalSourceMgr.h  |   3 +-
 llvm/include/llvm/MCA/InstrBuilder.h          |   7 +-
 llvm/include/llvm/MCA/Instruction.h           |  33 ++---
 llvm/include/llvm/MCA/Pipeline.h              |   7 +-
 llvm/include/llvm/MCA/Stages/EntryStage.h     |   3 +-
 .../llvm/MCA/Stages/InstructionTables.h       |   3 +-
 llvm/include/llvm/MCA/Stages/Stage.h          |   5 +-
 llvm/include/llvm/MCA/Support.h               |   7 +-
 llvm/include/llvm/MCA/View.h                  |   3 +-
 56 files changed, 385 insertions(+), 335 deletions(-)

diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h
index f6d776b839fe5..ac49a16850545 100644
--- a/llvm/include/llvm/MC/MCAsmBackend.h
+++ b/llvm/include/llvm/MC/MCAsmBackend.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCASMBACKEND_H
 #define LLVM_MC_MCASMBACKEND_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/MCDirectives.h"
 #include "llvm/MC/MCFixup.h"
@@ -39,7 +40,7 @@ class StringRef;
 class raw_ostream;
 
 /// Generic interface to target specific assembler backends.
-class MCAsmBackend {
+class LLVM_ABI MCAsmBackend {
 protected: // Can only create subclasses.
   MCAsmBackend(llvm::endianness Endian) : Endian(Endian) {}
 
diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h
index 3a31957f2f6be..467f8ffcc2a03 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_MC_MCASMINFO_H
 #define LLVM_MC_MCASMINFO_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -55,7 +56,7 @@ enum LCOMMType { NoAlignment, ByteAlignment, Log2Alignment };
 
 /// This class is intended to be used as a base class for asm
 /// properties and features specific to the target.
-class MCAsmInfo {
+class LLVM_ABI MCAsmInfo {
 public:
   /// Assembly character literal syntax types.
   enum AsmCharLiteralSyntax {
diff --git a/llvm/include/llvm/MC/MCAsmMacro.h b/llvm/include/llvm/MC/MCAsmMacro.h
index c0c895fa94e64..f0ce8f1182bf1 100644
--- a/llvm/include/llvm/MC/MCAsmMacro.h
+++ b/llvm/include/llvm/MC/MCAsmMacro.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCASMMACRO_H
 #define LLVM_MC_MCASMMACRO_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Debug.h"
@@ -74,9 +75,9 @@ class AsmToken {
   bool is(TokenKind K) const { return Kind == K; }
   bool isNot(TokenKind K) const { return Kind != K; }
 
-  SMLoc getLoc() const;
-  SMLoc getEndLoc() const;
-  SMRange getLocRange() const;
+  LLVM_ABI SMLoc getLoc() const;
+  LLVM_ABI SMLoc getEndLoc() const;
+  LLVM_ABI SMRange getLocRange() const;
 
   /// Get the contents of a string token (without quotes).
   StringRef getStringContents() const {
@@ -115,7 +116,7 @@ class AsmToken {
     return IntVal;
   }
 
-  void dump(raw_ostream &OS) const;
+  LLVM_ABI void dump(raw_ostream &OS) const;
 };
 
 struct MCAsmMacroParameter {
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h
index 988677193d6d9..26f76f3525361 100644
--- a/llvm/include/llvm/MC/MCAssembler.h
+++ b/llvm/include/llvm/MC/MCAssembler.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCASSEMBLER_H
 #define LLVM_MC_MCASSEMBLER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
@@ -135,46 +136,46 @@ class MCAssembler {
   // concrete and require clients to pass in a target like object. The other
   // option is to make this abstract, and have targets provide concrete
   // implementations as we do with AsmParser.
-  MCAssembler(MCContext &Context, std::unique_ptr<MCAsmBackend> Backend,
+  LLVM_ABI MCAssembler(MCContext &Context, std::unique_ptr<MCAsmBackend> Backend,
               std::unique_ptr<MCCodeEmitter> Emitter,
               std::unique_ptr<MCObjectWriter> Writer);
   MCAssembler(const MCAssembler &) = delete;
   MCAssembler &operator=(const MCAssembler &) = delete;
 
   /// Compute the effective fragment size.
-  uint64_t computeFragmentSize(const MCFragment &F) const;
+  LLVM_ABI uint64_t computeFragmentSize(const MCFragment &F) const;
 
-  void layoutBundle(MCFragment *Prev, MCFragment *F) const;
+  LLVM_ABI void layoutBundle(MCFragment *Prev, MCFragment *F) const;
 
   // Get the offset of the given fragment inside its containing section.
   uint64_t getFragmentOffset(const MCFragment &F) const { return F.Offset; }
 
-  uint64_t getSectionAddressSize(const MCSection &Sec) const;
-  uint64_t getSectionFileSize(const MCSection &Sec) const;
+  LLVM_ABI uint64_t getSectionAddressSize(const MCSection &Sec) const;
+  LLVM_ABI uint64_t getSectionFileSize(const MCSection &Sec) const;
 
   // Get the offset of the given symbol, as computed in the current
   // layout.
   // \return True on success.
-  bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const;
+  LLVM_ABI bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const;
 
   // Variant that reports a fatal error if the offset is not computable.
-  uint64_t getSymbolOffset(const MCSymbol &S) const;
+  LLVM_ABI uint64_t getSymbolOffset(const MCSymbol &S) const;
 
   // If this symbol is equivalent to A + Constant, return A.
-  const MCSymbol *getBaseSymbol(const MCSymbol &Symbol) const;
+  LLVM_ABI const MCSymbol *getBaseSymbol(const MCSymbol &Symbol) const;
 
   /// Emit the section contents to \p OS.
-  void writeSectionData(raw_ostream &OS, const MCSection *Section) const;
+  LLVM_ABI void writeSectionData(raw_ostream &OS, const MCSection *Section) const;
 
   /// Check whether a given symbol has been flagged with .thumb_func.
-  bool isThumbFunc(const MCSymbol *Func) const;
+  LLVM_ABI bool isThumbFunc(const MCSymbol *Func) const;
 
   /// Flag a function symbol as the target of a .thumb_func directive.
   void setIsThumbFunc(const MCSymbol *Func) { ThumbFuncs.insert(Func); }
 
   /// Reuse an assembler instance
   ///
-  void reset();
+  LLVM_ABI void reset();
 
   MCContext &getContext() const { return Context; }
 
@@ -193,10 +194,10 @@ class MCAssembler {
   /// Finish - Do final processing and write the object to the output stream.
   /// \p Writer is used for custom object writer (as the MCJIT does),
   /// if not specified it is automatically created from backend.
-  void Finish();
+  LLVM_ABI void Finish();
 
   // Layout all section and prepare them for emission.
-  void layout();
+  LLVM_ABI void layout();
 
   bool hasLayout() const { return HasLayout; }
   bool hasFinalLayout() const { return HasFinalLayout; }
@@ -223,21 +224,21 @@ class MCAssembler {
     return make_pointee_range(Symbols);
   }
 
-  bool registerSection(MCSection &Section);
-  bool registerSymbol(const MCSymbol &Symbol);
+  LLVM_ABI bool registerSection(MCSection &Section);
+  LLVM_ABI bool registerSymbol(const MCSymbol &Symbol);
 
   /// Write the necessary bundle padding to \p OS.
   /// Expects a fragment \p F containing instructions and its size \p FSize.
-  void writeFragmentPadding(raw_ostream &OS, const MCEncodedFragment &F,
+  LLVM_ABI void writeFragmentPadding(raw_ostream &OS, const MCEncodedFragment &F,
                             uint64_t FSize) const;
 
-  void reportError(SMLoc L, const Twine &Msg) const;
+  LLVM_ABI void reportError(SMLoc L, const Twine &Msg) const;
   // Record pending errors during layout iteration, as they may go away once the
   // layout is finalized.
-  void recordError(SMLoc L, const Twine &Msg) const;
-  void flushPendingErrors() const;
+  LLVM_ABI void recordError(SMLoc L, const Twine &Msg) const;
+  LLVM_ABI void flushPendingErrors() const;
 
-  void dump() const;
+  LLVM_ABI void dump() const;
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/MC/MCCodeEmitter.h b/llvm/include/llvm/MC/MCCodeEmitter.h
index ceb16c9b4da78..709286b88ea73 100644
--- a/llvm/include/llvm/MC/MCCodeEmitter.h
+++ b/llvm/include/llvm/MC/MCCodeEmitter.h
@@ -18,7 +18,7 @@ class raw_ostream;
 template<typename T> class SmallVectorImpl;
 
 /// MCCodeEmitter - Generic instruction encoding interface.
-class MCCodeEmitter {
+class LLVM_ABI MCCodeEmitter {
 protected: // Can only create subclasses.
   MCCodeEmitter();
 
diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index a2a53427be986..763582a93f259 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -375,7 +375,7 @@ class MCContext {
   DenseSet<StringRef> ELFSeenGenericMergeableSections;
 
 public:
-  explicit MCContext(const Triple &TheTriple, const MCAsmInfo *MAI,
+  LLVM_ABI explicit MCContext(const Triple &TheTriple, const MCAsmInfo *MAI,
                      const MCRegisterInfo *MRI, const MCSubtargetInfo *MSTI,
                      const SourceMgr *Mgr = nullptr,
                      MCTargetOptions const *TargetOpts = nullptr,
@@ -383,7 +383,7 @@ class MCContext {
                      StringRef Swift5ReflSegmentName = {});
   MCContext(const MCContext &) = delete;
   MCContext &operator=(const MCContext &) = delete;
-  ~MCContext();
+  LLVM_ABI ~MCContext();
 
   Environment getObjectFileType() const { return Env; }
 
@@ -393,7 +393,7 @@ class MCContext {
   const Triple &getTargetTriple() const { return TT; }
   const SourceMgr *getSourceManager() const { return SrcMgr; }
 
-  void initInlineSourceManager();
+  LLVM_ABI void initInlineSourceManager();
   SourceMgr *getInlineSourceManager() { return InlineSrcMgr.get(); }
   std::vector<const MDNode *> &getLocInfos() { return LocInfos; }
   void setDiagnosticHandler(DiagHandlerTy DiagHandler) {
@@ -412,7 +412,7 @@ class MCContext {
 
   const MCTargetOptions *getTargetOptions() const { return TargetOptions; }
 
-  CodeViewContext &getCVContext();
+  LLVM_ABI CodeViewContext &getCVContext();
 
   void setUseNamesOnTempLabels(bool Value) { UseNamesOnTempLabels = Value; }
 
@@ -421,14 +421,14 @@ class MCContext {
 
   /// reset - return object to right after construction state to prepare
   /// to process a new module
-  void reset();
+  LLVM_ABI void reset();
 
   /// @}
 
   /// \name McInst Management
 
   /// Create and return a new MC instruction.
-  MCInst *createMCInst();
+  LLVM_ABI MCInst *createMCInst();
 
   template <typename F, typename... Args> F *allocFragment(Args &&...args) {
     return new (FragmentAllocator.Allocate(sizeof(F), alignof(F)))
@@ -441,64 +441,64 @@ class MCContext {
   /// Create a new linker temporary symbol with the specified prefix (Name) or
   /// "tmp". This creates a "l"-prefixed symbol for Mach-O and is identical to
   /// createNamedTempSymbol for other object file formats.
-  MCSymbol *createLinkerPrivateTempSymbol();
-  MCSymbol *createLinkerPrivateSymbol(const Twine &Name);
+  LLVM_ABI MCSymbol *createLinkerPrivateTempSymbol();
+  LLVM_ABI MCSymbol *createLinkerPrivateSymbol(const Twine &Name);
 
   /// Create a temporary symbol with a unique name. The name will be omitted
   /// in the symbol table if UseNamesOnTempLabels is false (default except
   /// MCAsmStreamer). The overload without Name uses an unspecified name.
-  MCSymbol *createTempSymbol();
-  MCSymbol *createTempSymbol(const Twine &Name, bool AlwaysAddSuffix = true);
+  LLVM_ABI MCSymbol *createTempSymbol();
+  LLVM_ABI MCSymbol *createTempSymbol(const Twine &Name, bool AlwaysAddSuffix = true);
 
   /// Create a temporary symbol with a unique name whose name cannot be
   /// omitted in the symbol table. This is rarely used.
-  MCSymbol *createNamedTempSymbol();
-  MCSymbol *createNamedTempSymbol(const Twine &Name);
+  LLVM_ABI MCSymbol *createNamedTempSymbol();
+  LLVM_ABI MCSymbol *createNamedTempSymbol(const Twine &Name);
 
   /// Get or create a symbol for a basic block. For non-always-emit symbols,
   /// this behaves like createTempSymbol, except that it uses the
   /// PrivateLabelPrefix instead of the PrivateGlobalPrefix. When AlwaysEmit is
   /// true, behaves like getOrCreateSymbol, prefixed with PrivateLabelPrefix.
-  MCSymbol *createBlockSymbol(const Twine &Name, bool AlwaysEmit = false);
+  LLVM_ABI MCSymbol *createBlockSymbol(const Twine &Name, bool AlwaysEmit = false);
 
   /// Create a local, non-temporary symbol like an ELF mapping symbol. Calling
   /// the function with the same name will generate new, unique instances.
-  MCSymbol *createLocalSymbol(StringRef Name);
+  LLVM_ABI MCSymbol *createLocalSymbol(StringRef Name);
 
   /// Create the definition of a directional local symbol for numbered label
   /// (used for "1:" definitions).
-  MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal);
+  LLVM_ABI MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal);
 
   /// Create and return a directional local symbol for numbered label (used
   /// for "1b" or 1f" references).
-  MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before);
+  LLVM_ABI MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before);
 
   /// Lookup the symbol inside with the specified \p Name.  If it exists,
   /// return it.  If not, create a forward reference and return it.
   ///
   /// \param Name - The symbol name, which must be unique across all symbols.
-  MCSymbol *getOrCreateSymbol(const Twine &Name);
+  LLVM_ABI MCSymbol *getOrCreateSymbol(const Twine &Name);
 
   /// Gets a symbol that will be defined to the final stack offset of a local
   /// variable after codegen.
   ///
   /// \param Idx - The index of a local variable passed to \@llvm.localescape.
-  MCSymbol *getOrCreateFrameAllocSymbol(const Twine &FuncName, unsigned Idx);
+  LLVM_ABI MCSymbol *getOrCreateFrameAllocSymbol(const Twine &FuncName, unsigned Idx);
 
-  MCSymbol *getOrCreateParentFrameOffsetSymbol(const Twine &FuncName);
+  LLVM_ABI MCSymbol *getOrCreateParentFrameOffsetSymbol(const Twine &FuncName);
 
-  MCSymbol *getOrCreateLSDASymbol(const Twine &FuncName);
+  LLVM_ABI MCSymbol *getOrCreateLSDASymbol(const Twine &FuncName);
 
   /// Get the symbol for \p Name, or null.
-  MCSymbol *lookupSymbol(const Twine &Name) const;
+  LLVM_ABI MCSymbol *lookupSymbol(const Twine &Name) const;
 
   /// Clone a symbol for the .set directive, replacing it in the symbol table.
   /// Existing references to the original symbol remain unchanged, and the
   /// original symbol is not emitted to the symbol table.
-  MCSymbol *cloneSymbol(MCSymbol &Sym);
+  LLVM_ABI MCSymbol *cloneSymbol(MCSymbol &Sym);
 
   /// Set value for a symbol.
-  void setSymbolValue(MCStreamer &Streamer, const Twine &Sym, uint64_t Val);
+  LLVM_ABI void setSymbolValue(MCStreamer &Streamer, const Twine &Sym, uint64_t Val);
 
   /// getSymbols - Get a reference for the symbol table for clients that
   /// want to, for example, iterate over all symbols. 'const' because we
@@ -514,11 +514,11 @@ class MCContext {
 
   /// registerInlineAsmLabel - Records that the name is a label referenced in
   /// inline assembly.
-  void registerInlineAsmLabel(MCSymbol *Sym);
+  LLVM_ABI void registerInlineAsmLabel(MCSymbol *Sym);
 
   /// Allocates and returns a new `WasmSignature` instance (with empty parameter
   /// and return type lists).
-  wasm::WasmSignature *createWasmSignature();
+  LLVM_ABI wasm::WasmSignature *createWasmSignature();
 
   /// @}
 
@@ -527,7 +527,7 @@ class MCContext {
 
   /// Return the MCSection for the specified mach-o section.  This requires
   /// the operands to be valid.
-  MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
+  LLVM_ABI MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
                                   unsigned TypeAndAttributes,
                                   unsigned Reserved2, SectionKind K,
                                   const char *BeginSymName = nullptr);
@@ -557,13 +557,13 @@ class MCContext {
                          MCSection::NonUniqueID, nullptr);
   }
 
-  MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
+  LLVM_ABI MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
                               unsigned Flags, unsigned EntrySize,
                               const Twine &Group, bool IsComdat,
                               unsigned UniqueID,
                               const MCSymbolELF *LinkedToSym);
 
-  MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
+  LLVM_ABI MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
                               unsigned Flags, unsigned EntrySize,
                               const MCSymbolELF *Group, bool IsComdat,
                               unsigned UniqueID,
@@ -573,69 +573,69 @@ class MCContext {
   /// named by concatenating \p Prefix with '.' then \p Suffix. The \p Type
   /// describes the type of the section and \p Flags are used to further
   /// configure this named section.
-  MCSectionELF *getELFNamedSection(const Twine &Prefix, const Twine &Suffix,
+  LLVM_ABI MCSectionELF *getELFNamedSection(const Twine &Prefix, const Twine &Suffix,
                                    unsigned Type, unsigned Flags,
                                    unsigned EntrySize = 0);
 
-  MCSectionELF *createELFRelSection(const Twine &Name, unsigned Type,
+  LLVM_ABI MCSectionELF *createELFRelSection(const Twine &Name, unsigned Type,
                                     unsigned Flags, unsigned EntrySize,
                                     const MCSymbolELF *Group,
                                     const MCSectionELF *RelInfoSection);
 
-  MCSectionELF *createELFGroupSection(const MCSymbolELF *Group, bool IsComdat);
+  LLVM_ABI MCSectionELF *createELFGroupSection(const MCSymbolELF *Group, bool IsComdat);
 
-  void recordELFMergeableSectionInfo(StringRef SectionName, unsigned Flags,
+  LLVM_ABI void recordELFMergeableSectionInfo(StringRef SectionName, unsigned Flags,
                                      unsigned UniqueID, unsigned EntrySize);
 
-  bool isELFImplicitMergeableSectionNamePrefix(StringRef Name);
+  LLVM_ABI bool isELFImplicitMergeableSectionNamePrefix(StringRef Name);
 
-  bool isELFGenericMergeableSection(StringRef Name);
+  LLVM_ABI bool isELFGenericMergeableSection(StringRef Name);
 
   /// Return the unique ID of the section with the given name, flags and entry
   /// size, if it exists.
-  std::optional<unsigned> getELFUniqueIDForEntsize(StringRef SectionName,
+  LLVM_ABI std::optional<unsigned> getELFUniqueIDForEntsize(StringRef SectionName,
                                                    unsigned Flags,
                                                    unsigned EntrySize);
 
-  MCSectionGOFF *getGOFFSection(StringRef Section, SectionKind Kind,
+  LLVM_ABI MCSectionGOFF *getGOFFSection(StringRef Section, SectionKind Kind,
                                 MCSection *Parent, uint32_t Subsection = 0);
 
-  MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics,
+  LLVM_ABI MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics,
                                 StringRef COMDATSymName, int Selection,
                                 unsigned UniqueID = MCSection::NonUniqueID);
 
-  MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics);
+  LLVM_ABI MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics);
 
   /// Gets or creates a section equivalent to Sec that is associated with the
   /// section containing KeySym. For example, to create a debug info section
   /// associated with an inline function, pass the normal debug info section
   /// as Sec and the function symbol as KeySym.
-  MCSectionCOFF *
+  LLVM_ABI MCSectionCOFF *
   getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym,
                             unsigned UniqueID = MCSection::NonUniqueID);
 
-  MCSectionSPIRV *getSPIRVSection();
+  LLVM_ABI MCSectionSPIRV *getSPIRVSection();
 
   MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
                                 unsigned Flags = 0) {
     return getWasmSection(Section, K, Flags, "", ~0);
   }
 
-  MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
+  LLVM_ABI MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
                                 unsigned Flags, const Twine &Group,
                                 unsigned UniqueID);
 
-  MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
+  LLVM_ABI MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
                                 unsigned Flags, const MCSymbolWasm *Group,
                                 unsigned UniqueID);
 
   /// Get the section for the provided Section name
-  MCSectionDXContainer *getDXContainerSection(StringRef Section, SectionKind K);
+  LLVM_ABI MCSectionDXContainer *getDXContainerSection(StringRef Section, SectionKind K);
 
-  bool hasXCOFFSection(StringRef Section,
+  LLVM_ABI bool hasXCOFFSection(StringRef Section,
                        XCOFF::CsectProperties CsectProp) const;
 
-  MCSectionXCOFF *getXCOFFSection(
+  LLVM_ABI MCSectionXCOFF *getXCOFFSection(
       StringRef Section, SectionKind K,
       std::optional<XCOFF::CsectProperties> CsectProp = std::nullopt,
       bool MultiSymbolsAllowed = false,
@@ -643,7 +643,7 @@ class MCContext {
           std::nullopt);
 
   // Create and save a copy of STI and return a reference to the copy.
-  MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI);
+  LLVM_ABI MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI);
 
   uint8_t getBBAddrMapVersion() const { return BBAddrMapVersion; }
 
@@ -661,13 +661,13 @@ class MCContext {
   void setCompilationDir(StringRef S) { CompilationDir = S.str(); }
 
   /// Add an entry to the debug prefix map.
-  void addDebugPrefixMapEntry(const std::string &From, const std::string &To);
+  LLVM_ABI void addDebugPrefixMapEntry(const std::string &From, const std::string &To);
 
   /// Remap one path in-place as per the debug prefix map.
-  void remapDebugPath(SmallVectorImpl<char> &Path);
+  LLVM_ABI void remapDebugPath(SmallVectorImpl<char> &Path);
 
   // Remaps all debug directory paths in-place as per the debug prefix map.
-  void RemapDebugPaths();
+  LLVM_ABI void RemapDebugPaths();
 
   /// Get the main file name for use in error messages and debug
   /// info. This can be set to ensure we've got the correct file name
@@ -678,13 +678,13 @@ class MCContext {
   void setMainFileName(StringRef S) { MainFileName = std::string(S); }
 
   /// Creates an entry in the dwarf file and directory tables.
-  Expected<unsigned> getDwarfFile(StringRef Directory, StringRef FileName,
+  LLVM_ABI Expected<unsigned> getDwarfFile(StringRef Directory, StringRef FileName,
                                   unsigned FileNumber,
                                   std::optional<MD5::MD5Result> Checksum,
                                   std::optional<StringRef> Source,
                                   unsigned CUID);
 
-  bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0);
+  LLVM_ABI bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0);
 
   const std::map<unsigned, MCDwarfLineTable> &getMCDwarfLineTables() const {
     return MCDwarfLineTablesCUMap;
@@ -751,8 +751,8 @@ class MCContext {
   bool getGenDwarfForAssembly() { return GenDwarfForAssembly; }
   void setGenDwarfForAssembly(bool Value) { GenDwarfForAssembly = Value; }
   unsigned getGenDwarfFileNumber() { return GenDwarfFileNumber; }
-  EmitDwarfUnwindType emitDwarfUnwindInfo() const;
-  bool emitCompactUnwindNonCanonical() const;
+  LLVM_ABI EmitDwarfUnwindType emitDwarfUnwindInfo() const;
+  LLVM_ABI bool emitCompactUnwindNonCanonical() const;
 
   void setGenDwarfFileNumber(unsigned FileNumber) {
     GenDwarfFileNumber = FileNumber;
@@ -760,7 +760,7 @@ class MCContext {
 
   /// Specifies information about the "root file" for assembler clients
   /// (e.g., llvm-mc). Assumes compilation dir etc. have been set up.
-  void setGenDwarfRootFile(StringRef FileName, StringRef Buffer);
+  LLVM_ABI void setGenDwarfRootFile(StringRef FileName, StringRef Buffer);
 
   const SetVector<MCSection *> &getGenDwarfSectionSyms() {
     return SectionsForRanges;
@@ -770,7 +770,7 @@ class MCContext {
     return SectionsForRanges.insert(Sec);
   }
 
-  void finalizeDwarfSections(MCStreamer &MCOS);
+  LLVM_ABI void finalizeDwarfSections(MCStreamer &MCOS);
 
   const std::vector<MCGenDwarfLabelEntry> &getMCGenDwarfLabelEntries() const {
     return MCGenDwarfLabelEntries;
@@ -817,9 +817,9 @@ class MCContext {
   }
 
   bool hadError() { return HadError; }
-  void diagnose(const SMDiagnostic &SMD);
-  void reportError(SMLoc L, const Twine &Msg);
-  void reportWarning(SMLoc L, const Twine &Msg);
+  LLVM_ABI void diagnose(const SMDiagnostic &SMD);
+  LLVM_ABI void reportError(SMLoc L, const Twine &Msg);
+  LLVM_ABI void reportWarning(SMLoc L, const Twine &Msg);
 
   MCAsmMacro *lookupMacro(StringRef Name) {
     StringMap<MCAsmMacro>::iterator I = MacroMap.find(Name);
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
index 901bfcf5fa54f..4ce6edda2bed0 100644
--- a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
+++ b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCDISASSEMBLER_MCDISASSEMBLER_H
 #define LLVM_MC_MCDISASSEMBLER_MCDISASSEMBLER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/XCOFF.h"
 #include "llvm/MC/MCDisassembler/MCSymbolizer.h"
@@ -23,7 +24,7 @@ struct XCOFFSymbolInfoTy {
   std::optional<XCOFF::StorageMappingClass> StorageMappingClass;
   std::optional<uint32_t> Index;
   bool IsLabel = false;
-  bool operator<(const XCOFFSymbolInfoTy &SymInfo) const;
+  LLVM_ABI bool operator<(const XCOFFSymbolInfoTy &SymInfo) const;
 };
 
 struct SymbolInfoTy {
@@ -81,7 +82,7 @@ class raw_ostream;
 
 /// Superclass for all disassemblers. Consumes a memory region and provides an
 /// array of assembly instructions.
-class MCDisassembler {
+class LLVM_ABI MCDisassembler {
 public:
   /// Ternary decode status. Most backends will just use Fail and
   /// Success, however some have a concept of an instruction with
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCRelocationInfo.h b/llvm/include/llvm/MC/MCDisassembler/MCRelocationInfo.h
index efc59da193353..f87c1bcb99799 100644
--- a/llvm/include/llvm/MC/MCDisassembler/MCRelocationInfo.h
+++ b/llvm/include/llvm/MC/MCDisassembler/MCRelocationInfo.h
@@ -21,7 +21,7 @@ class MCContext;
 class MCExpr;
 
 /// Create MCExprs from relocations found in an object file.
-class MCRelocationInfo {
+class LLVM_ABI MCRelocationInfo {
 protected:
   MCContext &Ctx;
 
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCSymbolizer.h b/llvm/include/llvm/MC/MCDisassembler/MCSymbolizer.h
index 1efb63f1a1425..1f999dd902a8c 100644
--- a/llvm/include/llvm/MC/MCDisassembler/MCSymbolizer.h
+++ b/llvm/include/llvm/MC/MCDisassembler/MCSymbolizer.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_MC_MCDISASSEMBLER_MCSYMBOLIZER_H
 #define LLVM_MC_MCDISASSEMBLER_MCSYMBOLIZER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/MCDisassembler/MCRelocationInfo.h"
 #include <cstdint>
@@ -36,7 +37,7 @@ class raw_ostream;
 /// inside each disassembler, but would use the instr info to determine what
 /// operands are actually symbolizable, and in what way. I don't think this
 /// information exists right now.
-class MCSymbolizer {
+class LLVM_ABI MCSymbolizer {
 protected:
   MCContext &Ctx;
   std::unique_ptr<MCRelocationInfo> RelInfo;
diff --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h
index b33c9f0c8e4d0..d924c65948da2 100644
--- a/llvm/include/llvm/MC/MCDwarf.h
+++ b/llvm/include/llvm/MC/MCDwarf.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_MC_MCDWARF_H
 #define LLVM_MC_MCDWARF_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
@@ -44,7 +45,7 @@ class SourceMgr;
 
 namespace mcdwarf {
 // Emit the common part of the DWARF 5 range/locations list tables header.
-MCSymbol *emitListsTableHeaderStart(MCStreamer &S);
+LLVM_ABI MCSymbol *emitListsTableHeaderStart(MCStreamer &S);
 } // namespace mcdwarf
 
 /// Manage the .debug_line_str section contents, if we use it.
@@ -58,22 +59,22 @@ class MCDwarfLineStr {
 public:
   /// Construct an instance that can emit .debug_line_str (for use in a normal
   /// v5 line table).
-  explicit MCDwarfLineStr(MCContext &Ctx);
+  LLVM_ABI explicit MCDwarfLineStr(MCContext &Ctx);
 
   StringSaver &getSaver() { return Saver; }
 
   /// Emit a reference to the string.
-  void emitRef(MCStreamer *MCOS, StringRef Path);
+  LLVM_ABI void emitRef(MCStreamer *MCOS, StringRef Path);
 
   /// Emit the .debug_line_str section if appropriate.
-  void emitSection(MCStreamer *MCOS);
+  LLVM_ABI void emitSection(MCStreamer *MCOS);
 
   /// Returns finalized section.
-  SmallString<0> getFinalizedData();
+  LLVM_ABI SmallString<0> getFinalizedData();
 
   /// Adds path \p Path to the line string. Returns offset in the
   /// .debug_line_str section.
-  size_t addString(StringRef Path);
+  LLVM_ABI size_t addString(StringRef Path);
 };
 
 /// Instances of this class represent the name of the dwarf .file directive and
@@ -226,7 +227,7 @@ class MCDwarfLineEntry : public MCDwarfLoc {
   // This is called when an instruction is assembled into the specified
   // section and if there is information from the last .loc directive that
   // has yet to have a line entry made for it is made.
-  static void make(MCStreamer *MCOS, MCSection *Section);
+  LLVM_ABI static void make(MCStreamer *MCOS, MCSection *Section);
 };
 
 /// Instances of this class represent the line information for a compile
@@ -242,7 +243,7 @@ class MCLineSection {
 
   // Add an end entry by cloning the last entry, if exists, for the section
   // the given EndLabel belongs to. The label is replaced by the given EndLabel.
-  void addEndEntry(MCSymbol *EndLabel);
+  LLVM_ABI void addEndEntry(MCSymbol *EndLabel);
 
   using MCDwarfLineEntryCollection = std::vector<MCDwarfLineEntry>;
   using iterator = MCDwarfLineEntryCollection::iterator;
@@ -289,14 +290,14 @@ struct MCDwarfLineTableHeader {
 public:
   MCDwarfLineTableHeader() = default;
 
-  Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
+  LLVM_ABI Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
                                 std::optional<MD5::MD5Result> Checksum,
                                 std::optional<StringRef> Source,
                                 uint16_t DwarfVersion, unsigned FileNumber = 0);
-  std::pair<MCSymbol *, MCSymbol *>
+  LLVM_ABI std::pair<MCSymbol *, MCSymbol *>
   Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
        std::optional<MCDwarfLineStr> &LineStr) const;
-  std::pair<MCSymbol *, MCSymbol *>
+  LLVM_ABI std::pair<MCSymbol *, MCSymbol *>
   Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
        ArrayRef<char> SpecialOpcodeLengths,
        std::optional<MCDwarfLineStr> &LineStr) const;
@@ -359,7 +360,7 @@ class MCDwarfDwoLineTable {
                                       DwarfVersion));
   }
 
-  void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
+  LLVM_ABI void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
             MCSection *Section) const;
 };
 
@@ -369,21 +370,21 @@ class MCDwarfLineTable {
 
 public:
   // This emits the Dwarf file and the line tables for all Compile Units.
-  static void emit(MCStreamer *MCOS, MCDwarfLineTableParams Params);
+  LLVM_ABI static void emit(MCStreamer *MCOS, MCDwarfLineTableParams Params);
 
   // This emits the Dwarf file and the line tables for a given Compile Unit.
-  void emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
+  LLVM_ABI void emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
               std::optional<MCDwarfLineStr> &LineStr) const;
 
   // This emits a single line table associated with a given Section.
-  static void
+  LLVM_ABI static void
   emitOne(MCStreamer *MCOS, MCSection *Section,
           const MCLineSection::MCDwarfLineEntryCollection &LineEntries);
 
-  void endCurrentSeqAndEmitLineStreamLabel(MCStreamer *MCOS, SMLoc DefLoc,
+  LLVM_ABI void endCurrentSeqAndEmitLineStreamLabel(MCStreamer *MCOS, SMLoc DefLoc,
                                            StringRef Name);
 
-  Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
+  LLVM_ABI Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
                                 std::optional<MD5::MD5Result> Checksum,
                                 std::optional<StringRef> Source,
                                 uint16_t DwarfVersion, unsigned FileNumber = 0);
@@ -452,11 +453,11 @@ class MCDwarfLineTable {
 class MCDwarfLineAddr {
 public:
   /// Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
-  static void encode(MCContext &Context, MCDwarfLineTableParams Params,
+  LLVM_ABI static void encode(MCContext &Context, MCDwarfLineTableParams Params,
                      int64_t LineDelta, uint64_t AddrDelta, SmallVectorImpl<char> &OS);
 
   /// Utility function to emit the encoding to a streamer.
-  static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
+  LLVM_ABI static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
                    int64_t LineDelta, uint64_t AddrDelta);
 };
 
@@ -466,7 +467,7 @@ class MCGenDwarfInfo {
   // When generating dwarf for assembly source files this emits the Dwarf
   // sections.
   //
-  static void Emit(MCStreamer *MCOS);
+  LLVM_ABI static void Emit(MCStreamer *MCOS);
 };
 
 // When generating dwarf for assembly source files this is the info that is
@@ -495,7 +496,7 @@ class MCGenDwarfLabelEntry {
 
   // This is called when label is created when we are generating dwarf for
   // assembly source files.
-  static void Make(MCSymbol *Symbol, MCStreamer *MCOS, SourceMgr &SrcMgr,
+  LLVM_ABI static void Make(MCSymbol *Symbol, MCStreamer *MCOS, SourceMgr &SrcMgr,
                    SMLoc &Loc);
 };
 
@@ -783,8 +784,8 @@ class MCDwarfFrameEmitter {
   //
   // This emits the frame info section.
   //
-  static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH);
-  static void encodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
+  LLVM_ABI static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH);
+  LLVM_ABI static void encodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
                                SmallVectorImpl<char> &OS);
 };
 
diff --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h
index d63fd1354255d..17e1df1c17ed9 100644
--- a/llvm/include/llvm/MC/MCExpr.h
+++ b/llvm/include/llvm/MC/MCExpr.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCEXPR_H
 #define LLVM_MC_MCEXPR_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/SMLoc.h"
 #include <cstdint>
@@ -61,7 +62,7 @@ class MCExpr {
            "Subclass data too large");
   }
 
-  bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
+  LLVM_ABI bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
                                  bool InSet) const;
 
   unsigned getSubclassData() const { return SubclassData; }
@@ -80,13 +81,13 @@ class MCExpr {
   /// \name Utility Methods
   /// @{
 
-  void print(raw_ostream &OS, const MCAsmInfo *MAI,
+  LLVM_ABI void print(raw_ostream &OS, const MCAsmInfo *MAI,
              int SurroundingPrec = 0) const;
-  void dump() const;
+  LLVM_ABI void dump() const;
 
   /// Returns whether the given symbol is used anywhere in the expression or
   /// subexpressions.
-  bool isSymbolUsedInExpression(const MCSymbol *Sym) const;
+  LLVM_ABI bool isSymbolUsedInExpression(const MCSymbol *Sym) const;
 
   /// @}
   /// \name Expression Evaluation
@@ -96,14 +97,14 @@ class MCExpr {
   ///
   /// \param Res - The absolute value, if evaluation succeeds.
   /// \return - True on success.
-  bool evaluateAsAbsolute(int64_t &Res) const;
-  bool evaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const;
-  bool evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm) const;
+  LLVM_ABI bool evaluateAsAbsolute(int64_t &Res) const;
+  LLVM_ABI bool evaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const;
+  LLVM_ABI bool evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm) const;
 
   /// Aggressive variant of evaluateAsRelocatable when relocations are
   /// unavailable (e.g. .fill). Expects callers to handle errors when true is
   /// returned.
-  bool evaluateKnownAbsolute(int64_t &Res, const MCAssembler &Asm) const;
+  LLVM_ABI bool evaluateKnownAbsolute(int64_t &Res, const MCAssembler &Asm) const;
 
   /// Try to evaluate the expression to a relocatable value, i.e. an
   /// expression of the fixed form (a - b + constant).
@@ -111,24 +112,24 @@ class MCExpr {
   /// \param Res - The relocatable value, if evaluation succeeds.
   /// \param Asm - The assembler object to use for evaluating values.
   /// \return - True on success.
-  bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm) const;
+  LLVM_ABI bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm) const;
 
   /// Try to evaluate the expression to the form (a - b + constant) where
   /// neither a nor b are variables.
   ///
   /// This is a more aggressive variant of evaluateAsRelocatable. The intended
   /// use is for when relocations are not available, like the .size directive.
-  bool evaluateAsValue(MCValue &Res, const MCAssembler &Asm) const;
+  LLVM_ABI bool evaluateAsValue(MCValue &Res, const MCAssembler &Asm) const;
 
   /// Find the "associated section" for this expression, which is
   /// currently defined as the absolute section for constants, or
   /// otherwise the section associated with the first defined symbol in the
   /// expression.
-  MCFragment *findAssociatedFragment() const;
+  LLVM_ABI MCFragment *findAssociatedFragment() const;
 
   /// @}
 
-  static bool evaluateSymbolicAdd(const MCAssembler *, bool, const MCValue &,
+  LLVM_ABI static bool evaluateSymbolicAdd(const MCAssembler *, bool, const MCValue &,
                                   const MCValue &, MCValue &);
 };
 
@@ -159,7 +160,7 @@ class MCConstantExpr : public MCExpr {
   /// \name Construction
   /// @{
 
-  static const MCConstantExpr *create(int64_t Value, MCContext &Ctx,
+  LLVM_ABI static const MCConstantExpr *create(int64_t Value, MCContext &Ctx,
                                       bool PrintInHex = false,
                                       unsigned SizeInBytes = 0);
 
@@ -220,7 +221,7 @@ class MCSymbolRefExpr : public MCExpr {
     return MCSymbolRefExpr::create(Symbol, VK_None, Ctx, Loc);
   }
 
-  static const MCSymbolRefExpr *create(const MCSymbol *Symbol, VariantKind Kind,
+  LLVM_ABI static const MCSymbolRefExpr *create(const MCSymbol *Symbol, VariantKind Kind,
                                        MCContext &Ctx, SMLoc Loc = SMLoc());
   static const MCSymbolRefExpr *create(const MCSymbol *Symbol, uint16_t Kind,
                                        MCContext &Ctx, SMLoc Loc = SMLoc()) {
@@ -266,7 +267,7 @@ class MCUnaryExpr : public MCExpr {
   /// \name Construction
   /// @{
 
-  static const MCUnaryExpr *create(Opcode Op, const MCExpr *Expr,
+  LLVM_ABI static const MCUnaryExpr *create(Opcode Op, const MCExpr *Expr,
                                    MCContext &Ctx, SMLoc Loc = SMLoc());
 
   static const MCUnaryExpr *createLNot(const MCExpr *Expr, MCContext &Ctx, SMLoc Loc = SMLoc()) {
@@ -343,7 +344,7 @@ class MCBinaryExpr : public MCExpr {
   /// \name Construction
   /// @{
 
-  static const MCBinaryExpr *create(Opcode Op, const MCExpr *LHS,
+  LLVM_ABI static const MCBinaryExpr *create(Opcode Op, const MCExpr *LHS,
                                     const MCExpr *RHS, MCContext &Ctx,
                                     SMLoc Loc = SMLoc());
 
@@ -469,7 +470,7 @@ class MCBinaryExpr : public MCExpr {
 ///
 /// NOTE: All subclasses are required to have trivial destructors because
 /// MCExprs are bump pointer allocated and not destructed.
-class MCTargetExpr : public MCExpr {
+class LLVM_ABI MCTargetExpr : public MCExpr {
   virtual void anchor();
 
 protected:
diff --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h
index 3d40e59c69849..81476ba86e898 100644
--- a/llvm/include/llvm/MC/MCFragment.h
+++ b/llvm/include/llvm/MC/MCFragment.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCFRAGMENT_H
 #define LLVM_MC_MCFRAGMENT_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
@@ -78,7 +79,7 @@ class MCFragment {
   /// MCRelaxableFragment: x86-specific
   bool AllowAutoPadding : 1;
 
-  MCFragment(FragmentType Kind, bool HasInstructions);
+  LLVM_ABI MCFragment(FragmentType Kind, bool HasInstructions);
 
 public:
   MCFragment() = delete;
@@ -89,7 +90,7 @@ class MCFragment {
   ///
   /// This must be used instead of delete as MCFragment is non-virtual.
   /// This method will dispatch to the appropriate subclass.
-  void destroy();
+  LLVM_ABI void destroy();
 
   MCFragment *getNext() const { return Next; }
 
@@ -98,7 +99,7 @@ class MCFragment {
   MCSection *getParent() const { return Parent; }
   void setParent(MCSection *Value) { Parent = Value; }
 
-  const MCSymbol *getAtom() const;
+  LLVM_ABI const MCSymbol *getAtom() const;
 
   unsigned getLayoutOrder() const { return LayoutOrder; }
   void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }
@@ -107,7 +108,7 @@ class MCFragment {
   /// this is false, but specific fragment types may set it to true.
   bool hasInstructions() const { return HasInstructions; }
 
-  void dump() const;
+  LLVM_ABI void dump() const;
 };
 
 /// Interface implemented by fragments that contain encoded instructions and/or
diff --git a/llvm/include/llvm/MC/MCInst.h b/llvm/include/llvm/MC/MCInst.h
index b3d615b4392f5..0cd483b9f1381 100644
--- a/llvm/include/llvm/MC/MCInst.h
+++ b/llvm/include/llvm/MC/MCInst.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_MC_MCINST_H
 #define LLVM_MC_MCINST_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/bit.h"
@@ -174,10 +175,10 @@ class MCOperand {
     return Op;
   }
 
-  void print(raw_ostream &OS, const MCRegisterInfo *RegInfo = nullptr) const;
-  void dump() const;
-  bool isBareSymbolRef() const;
-  bool evaluateAsConstantImm(int64_t &Imm) const;
+  LLVM_ABI void print(raw_ostream &OS, const MCRegisterInfo *RegInfo = nullptr) const;
+  LLVM_ABI void dump() const;
+  LLVM_ABI bool isBareSymbolRef() const;
+  LLVM_ABI bool evaluateAsConstantImm(int64_t &Imm) const;
 };
 
 /// Instances of this class represent a single low-level machine
@@ -226,16 +227,16 @@ class MCInst {
     return Operands.insert(I, Op);
   }
 
-  void print(raw_ostream &OS, const MCRegisterInfo *RegInfo = nullptr) const;
-  void dump() const;
+  LLVM_ABI void print(raw_ostream &OS, const MCRegisterInfo *RegInfo = nullptr) const;
+  LLVM_ABI void dump() const;
 
   /// Dump the MCInst as prettily as possible using the additional MC
   /// structures, if given. Operators are separated by the \p Separator
   /// string.
-  void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer = nullptr,
+  LLVM_ABI void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer = nullptr,
                    StringRef Separator = " ",
                    const MCRegisterInfo *RegInfo = nullptr) const;
-  void dump_pretty(raw_ostream &OS, StringRef Name, StringRef Separator = " ",
+  LLVM_ABI void dump_pretty(raw_ostream &OS, StringRef Name, StringRef Separator = " ",
                    const MCRegisterInfo *RegInfo = nullptr) const;
 };
 
diff --git a/llvm/include/llvm/MC/MCInstPrinter.h b/llvm/include/llvm/MC/MCInstPrinter.h
index ab1361313be05..7495c741b899f 100644
--- a/llvm/include/llvm/MC/MCInstPrinter.h
+++ b/llvm/include/llvm/MC/MCInstPrinter.h
@@ -28,7 +28,7 @@ class MCSubtargetInfo;
 class StringRef;
 
 /// Convert `Bytes' to a hex string and output to `OS'
-void dumpBytes(ArrayRef<uint8_t> Bytes, raw_ostream &OS);
+LLVM_ABI void dumpBytes(ArrayRef<uint8_t> Bytes, raw_ostream &OS);
 
 namespace HexStyle {
 
@@ -43,7 +43,7 @@ struct AliasMatchingData;
 
 /// This is an instance of a target assembly language printer that
 /// converts an MCInst to valid target assembly syntax.
-class MCInstPrinter {
+class LLVM_ABI MCInstPrinter {
 protected:
   /// A stream that comments can be emitted to if desired.  Each comment
   /// must end with a newline.  This will be null if verbose assembly emission
@@ -101,9 +101,9 @@ class MCInstPrinter {
 
   class WithMarkup {
   public:
-    LLVM_CTOR_NODISCARD WithMarkup(MCInstPrinter &IP, raw_ostream &OS, Markup M,
+    LLVM_CTOR_NODISCARD LLVM_ABI WithMarkup(MCInstPrinter &IP, raw_ostream &OS, Markup M,
                                    bool EnableMarkup, bool EnableColor);
-    ~WithMarkup();
+    LLVM_ABI ~WithMarkup();
 
     template <typename T> WithMarkup &operator<<(T &O) {
       OS << O;
diff --git a/llvm/include/llvm/MC/MCInstrAnalysis.h b/llvm/include/llvm/MC/MCInstrAnalysis.h
index 7ad4c5f49623f..4f4e299f31c0e 100644
--- a/llvm/include/llvm/MC/MCInstrAnalysis.h
+++ b/llvm/include/llvm/MC/MCInstrAnalysis.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_MC_MCINSTRANALYSIS_H
 #define LLVM_MC_MCINSTRANALYSIS_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCInstrDesc.h"
@@ -27,7 +28,7 @@ namespace llvm {
 class MCRegisterInfo;
 class Triple;
 
-class MCInstrAnalysis {
+class LLVM_ABI MCInstrAnalysis {
 protected:
   friend class Target;
 
diff --git a/llvm/include/llvm/MC/MCInstrDesc.h b/llvm/include/llvm/MC/MCInstrDesc.h
index 5bb7f18bf2587..5ababf9bc14f4 100644
--- a/llvm/include/llvm/MC/MCInstrDesc.h
+++ b/llvm/include/llvm/MC/MCInstrDesc.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_MC_MCINSTRDESC_H
 #define LLVM_MC_MCINSTRDESC_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/MC/MCRegister.h"
@@ -329,7 +330,7 @@ class MCInstrDesc {
   /// Return true if this is a branch or an instruction which directly
   /// writes to the program counter. Considered 'may' affect rather than
   /// 'does' affect as things like predication are not taken into account.
-  bool mayAffectControlFlow(const MCInst &MI, const MCRegisterInfo &RI) const;
+  LLVM_ABI bool mayAffectControlFlow(const MCInst &MI, const MCRegisterInfo &RI) const;
 
   /// Return true if this instruction has a predicate operand
   /// that controls execution. It may be set to 'always', or may be set to other
@@ -590,7 +591,7 @@ class MCInstrDesc {
 
   /// Return true if this instruction implicitly
   /// defines the specified physical register.
-  bool hasImplicitDefOfPhysReg(MCRegister Reg,
+  LLVM_ABI bool hasImplicitDefOfPhysReg(MCRegister Reg,
                                const MCRegisterInfo *MRI = nullptr) const;
 
   /// Return the scheduling class for this instruction.  The
@@ -617,7 +618,7 @@ class MCInstrDesc {
 
   /// Return true if this instruction defines the specified physical
   /// register, either explicitly or implicitly.
-  bool hasDefOfPhysReg(const MCInst &MI, MCRegister Reg,
+  LLVM_ABI bool hasDefOfPhysReg(const MCInst &MI, MCRegister Reg,
                        const MCRegisterInfo &RI) const;
 };
 
diff --git a/llvm/include/llvm/MC/MCInstrInfo.h b/llvm/include/llvm/MC/MCInstrInfo.h
index 35ec1b7970516..040f63ef6de40 100644
--- a/llvm/include/llvm/MC/MCInstrInfo.h
+++ b/llvm/include/llvm/MC/MCInstrInfo.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_MC_MCINSTRINFO_H
 #define LLVM_MC_MCINSTRINFO_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCInstrDesc.h"
 #include <cassert>
@@ -74,7 +75,7 @@ class MCInstrInfo {
 
   /// Returns true if a certain instruction is deprecated and if so
   /// returns the reason in \p Info.
-  bool getDeprecatedInfo(MCInst &MI, const MCSubtargetInfo &STI,
+  LLVM_ABI bool getDeprecatedInfo(MCInst &MI, const MCSubtargetInfo &STI,
                          std::string &Info) const;
 };
 
diff --git a/llvm/include/llvm/MC/MCLinkerOptimizationHint.h b/llvm/include/llvm/MC/MCLinkerOptimizationHint.h
index dc086f94e5c59..99790fde12266 100644
--- a/llvm/include/llvm/MC/MCLinkerOptimizationHint.h
+++ b/llvm/include/llvm/MC/MCLinkerOptimizationHint.h
@@ -16,6 +16,7 @@
 #ifndef LLVM_MC_MCLINKEROPTIMIZATIONHINT_H
 #define LLVM_MC_MCLINKEROPTIMIZATIONHINT_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
@@ -125,11 +126,11 @@ class MCLOHDirective {
 
   /// Emit this directive as:
   /// <kind, numArgs, addr1, ..., addrN>
-  void emit(const MCAssembler &Asm, MachObjectWriter &ObjWriter) const;
+  LLVM_ABI void emit(const MCAssembler &Asm, MachObjectWriter &ObjWriter) const;
 
   /// Get the size in bytes of this directive if emitted in \p ObjWriter with
   /// the given \p Layout.
-  uint64_t getEmitSize(const MCAssembler &Asm,
+  LLVM_ABI uint64_t getEmitSize(const MCAssembler &Asm,
                        const MachObjectWriter &ObjWriter) const;
 };
 
diff --git a/llvm/include/llvm/MC/MCMachObjectWriter.h b/llvm/include/llvm/MC/MCMachObjectWriter.h
index 5d8e69b32ba66..58156ea897237 100644
--- a/llvm/include/llvm/MC/MCMachObjectWriter.h
+++ b/llvm/include/llvm/MC/MCMachObjectWriter.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCMACHOBJECTWRITER_H
 #define LLVM_MC_MCMACHOBJECTWRITER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/MachO.h"
@@ -29,7 +30,7 @@ namespace llvm {
 
 class MachObjectWriter;
 
-class MCMachObjectTargetWriter : public MCObjectTargetWriter {
+class LLVM_ABI MCMachObjectTargetWriter : public MCObjectTargetWriter {
   const unsigned Is64Bit : 1;
   const uint32_t CPUType;
 protected:
@@ -83,7 +84,7 @@ class MCMachObjectTargetWriter : public MCObjectTargetWriter {
   /// @}
 };
 
-class MachObjectWriter final : public MCObjectWriter {
+class LLVM_ABI MachObjectWriter final : public MCObjectWriter {
 public:
   struct DataRegionData {
     MachO::DataRegionType Kind;
@@ -114,7 +115,7 @@ class MachObjectWriter final : public MCObjectWriter {
     uint8_t SectionIndex;
 
     // Support lexicographic sorting.
-    bool operator<(const MachSymbolData &RHS) const;
+    LLVM_ABI bool operator<(const MachSymbolData &RHS) const;
   };
 
   struct IndirectSymbolData {
diff --git a/llvm/include/llvm/MC/MCObjectFileInfo.h b/llvm/include/llvm/MC/MCObjectFileInfo.h
index fb575fe721015..a44bd98542b37 100644
--- a/llvm/include/llvm/MC/MCObjectFileInfo.h
+++ b/llvm/include/llvm/MC/MCObjectFileInfo.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_MC_MCOBJECTFILEINFO_H
 #define LLVM_MC_MCOBJECTFILEINFO_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/BinaryFormat/Swift.h"
 #include "llvm/MC/MCSection.h"
 #include "llvm/Support/VersionTuple.h"
@@ -25,7 +26,7 @@ namespace llvm {
 class MCContext;
 class MCSection;
 
-class MCObjectFileInfo {
+class LLVM_ABI MCObjectFileInfo {
 protected:
   /// True if target object file supports a weak_definition of constant 0 for an
   /// omitted EH frame.
diff --git a/llvm/include/llvm/MC/MCObjectWriter.h b/llvm/include/llvm/MC/MCObjectWriter.h
index 19530d2f651a6..ea972ec9d79a4 100644
--- a/llvm/include/llvm/MC/MCObjectWriter.h
+++ b/llvm/include/llvm/MC/MCObjectWriter.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCOBJECTWRITER_H
 #define LLVM_MC_MCOBJECTWRITER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/TargetParser/Triple.h"
 #include <cstdint>
@@ -30,7 +31,7 @@ class MCValue;
 /// points. Once assembly is complete, the object writer is given the
 /// MCAssembler instance, which contains all the symbol and section data which
 /// should be emitted as part of writeObject().
-class MCObjectWriter {
+class LLVM_ABI MCObjectWriter {
 protected:
   MCAssembler *Asm = nullptr;
   /// List of declared file names
@@ -139,8 +140,8 @@ class MCObjectTargetWriter {
   virtual Triple::ObjectFormatType getFormat() const = 0;
 
 protected:
-  MCContext &getContext() const;
-  void reportError(SMLoc L, const Twine &Msg) const;
+  LLVM_ABI MCContext &getContext() const;
+  LLVM_ABI void reportError(SMLoc L, const Twine &Msg) const;
 
   MCAssembler *Asm = nullptr;
 };
diff --git a/llvm/include/llvm/MC/MCParser/AsmLexer.h b/llvm/include/llvm/MC/MCParser/AsmLexer.h
index 2e027f92adafb..1f824d8059b90 100644
--- a/llvm/include/llvm/MC/MCParser/AsmLexer.h
+++ b/llvm/include/llvm/MC/MCParser/AsmLexer.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_MC_MCPARSER_ASMLEXER_H
 #define LLVM_MC_MCPARSER_ASMLEXER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
@@ -72,7 +73,7 @@ class AsmLexer {
   bool LexHLASMStrings = false;
   AsmCommentConsumer *CommentConsumer = nullptr;
 
-  AsmToken LexToken();
+  LLVM_ABI AsmToken LexToken();
 
   void SetError(SMLoc errLoc, const std::string &err) {
     ErrLoc = errLoc;
@@ -80,7 +81,7 @@ class AsmLexer {
   }
 
 public:
-  AsmLexer(const MCAsmInfo &MAI);
+  LLVM_ABI AsmLexer(const MCAsmInfo &MAI);
   AsmLexer(const AsmLexer &) = delete;
   AsmLexer &operator=(const AsmLexer &) = delete;
 
@@ -108,7 +109,7 @@ class AsmLexer {
 
   bool justConsumedEOL() { return JustConsumedEOL; }
 
-  StringRef LexUntilEndOfStatement();
+  LLVM_ABI StringRef LexUntilEndOfStatement();
 
   /// Get the current source location.
   SMLoc getLoc() const { return SMLoc::getFromPointer(TokStart); }
@@ -130,7 +131,7 @@ class AsmLexer {
   }
 
   /// Look ahead an arbitrary number of tokens.
-  size_t peekTokens(MutableArrayRef<AsmToken> Buf, bool ShouldSkipSpace = true);
+  LLVM_ABI size_t peekTokens(MutableArrayRef<AsmToken> Buf, bool ShouldSkipSpace = true);
 
   /// Get the current error location
   SMLoc getErrLoc() { return ErrLoc; }
@@ -189,7 +190,7 @@ class AsmLexer {
   /// literals.
   void setLexHLASMStrings(bool V) { LexHLASMStrings = V; }
 
-  void setBuffer(StringRef Buf, const char *ptr = nullptr,
+  LLVM_ABI void setBuffer(StringRef Buf, const char *ptr = nullptr,
                  bool EndStatementAtEOF = true);
 
   const MCAsmInfo &getMAI() const { return MAI; }
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParser.h b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
index e567a9ffbc0cc..8db256de77d29 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParser.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCPARSER_MCASMPARSER_H
 #define LLVM_MC_MCPARSER_MCASMPARSER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
@@ -105,7 +106,7 @@ struct AsmFieldInfo {
 };
 
 /// Generic Sema callback for assembly parser.
-class MCAsmParserSemaCallback {
+class LLVM_ABI MCAsmParserSemaCallback {
 public:
   virtual ~MCAsmParserSemaCallback();
 
@@ -120,7 +121,7 @@ class MCAsmParserSemaCallback {
 
 /// Generic assembler parser interface, for use by target specific
 /// assembly parsers.
-class MCAsmParser {
+class LLVM_ABI MCAsmParser {
 public:
   using DirectiveHandler = bool (*)(MCAsmParserExtension*, StringRef, SMLoc);
   using ExtensionDirectiveHandler =
@@ -338,11 +339,11 @@ class MCAsmParser {
 };
 
 /// Create an MCAsmParser instance for parsing assembly similar to gas syntax
-MCAsmParser *createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &,
+LLVM_ABI MCAsmParser *createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &,
                                const MCAsmInfo &, unsigned CB = 0);
 
 /// Create an MCAsmParser instance for parsing Microsoft MASM-style assembly
-MCAsmParser *createMCMasmParser(SourceMgr &, MCContext &, MCStreamer &,
+LLVM_ABI MCAsmParser *createMCMasmParser(SourceMgr &, MCContext &, MCStreamer &,
                                 const MCAsmInfo &, struct tm, unsigned CB = 0);
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h b/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
index 5081b7cbcf111..e5f9445d51ad8 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H
 #define LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCParser/MCAsmParser.h"
@@ -21,7 +22,7 @@ class Twine;
 /// Generic interface for extending the MCAsmParser,
 /// which is implemented by target and object file assembly parser
 /// implementations.
-class MCAsmParserExtension {
+class LLVM_ABI MCAsmParserExtension {
   MCAsmParser *Parser = nullptr;
 
 protected:
diff --git a/llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h b/llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h
index 27ecb7b85d229..32d1e4e0098a3 100644
--- a/llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h
+++ b/llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
 #define LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/SMLoc.h"
 #include <string>
@@ -22,7 +23,7 @@ class raw_ostream;
 /// instruction operand.  It should be subclassed by target-specific code.  This
 /// base class is used by target-independent clients and is the interface
 /// between parsing an asm instruction and recognizing it.
-class MCParsedAsmOperand {
+class LLVM_ABI MCParsedAsmOperand {
   /// MCOperandNum - The corresponding MCInst operand number.  Only valid when
   /// parsing MS-style inline assembly.
   unsigned MCOperandNum = ~0u;
diff --git a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h
index c94ae9442f028..1b83d3a6622a1 100644
--- a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h
+++ b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
 #define LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCParser/MCAsmParserExtension.h"
@@ -331,7 +332,7 @@ class NearMissInfo {
 };
 
 /// MCTargetAsmParser - Generic interface to target specific assembly parsers.
-class MCTargetAsmParser : public MCAsmParserExtension {
+class LLVM_ABI MCTargetAsmParser : public MCAsmParserExtension {
 public:
   enum MatchResultTy {
     Match_InvalidOperand,
diff --git a/llvm/include/llvm/MC/MCPseudoProbe.h b/llvm/include/llvm/MC/MCPseudoProbe.h
index dc14038a03acb..da7a7021512be 100644
--- a/llvm/include/llvm/MC/MCPseudoProbe.h
+++ b/llvm/include/llvm/MC/MCPseudoProbe.h
@@ -54,6 +54,7 @@
 #ifndef LLVM_MC_MCPSEUDOPROBE_H
 #define LLVM_MC_MCPSEUDOPROBE_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
@@ -92,7 +93,7 @@ struct MCPseudoProbeFuncDesc {
   MCPseudoProbeFuncDesc(uint64_t GUID, uint64_t Hash, StringRef Name)
       : FuncGUID(GUID), FuncHash(Hash), FuncName(Name){};
 
-  void print(raw_ostream &OS);
+  LLVM_ABI void print(raw_ostream &OS);
 };
 
 class MCDecodedPseudoProbe;
@@ -178,7 +179,7 @@ class MCPseudoProbe : public MCPseudoProbeBase {
 
   uint64_t getGuid() const { return Guid; };
   MCSymbol *getLabel() const { return Label; }
-  void emit(MCObjectStreamer *MCOS, const MCPseudoProbe *LastProbe) const;
+  LLVM_ABI void emit(MCObjectStreamer *MCOS, const MCPseudoProbe *LastProbe) const;
 };
 
 // Represents a callsite with caller function name and probe id
@@ -193,7 +194,7 @@ class MCDecodedPseudoProbe : public MCPseudoProbeBase {
                        uint32_t D, MCDecodedPseudoProbeInlineTree *Tree)
       : MCPseudoProbeBase(I, At, static_cast<uint8_t>(K), D), Address(Ad),
         InlineTree(Tree){};
-  uint64_t getGuid() const;
+  LLVM_ABI uint64_t getGuid() const;
 
   uint64_t getAddress() const { return Address; }
 
@@ -206,16 +207,16 @@ class MCDecodedPseudoProbe : public MCPseudoProbeBase {
   // Get the inlined context by traversing current inline tree backwards,
   // each tree node has its InlineSite which is taken as the context.
   // \p ContextStack is populated in root to leaf order
-  void
+  LLVM_ABI void
   getInlineContext(SmallVectorImpl<MCPseudoProbeFrameLocation> &ContextStack,
                    const GUIDProbeFunctionMap &GUID2FuncMAP) const;
 
   // Helper function to get the string from context stack
-  std::string
+  LLVM_ABI std::string
   getInlineContextStr(const GUIDProbeFunctionMap &GUID2FuncMAP) const;
 
   // Print pseudo probe while disassembling
-  void print(raw_ostream &OS, const GUIDProbeFunctionMap &GUID2FuncMAP,
+  LLVM_ABI void print(raw_ostream &OS, const GUIDProbeFunctionMap &GUID2FuncMAP,
              bool ShowName) const;
 };
 
@@ -302,9 +303,9 @@ class MCPseudoProbeInlineTree
   }
 
   // MCPseudoProbeInlineTree method based on Inlinees
-  void addPseudoProbe(const MCPseudoProbe &Probe,
+  LLVM_ABI void addPseudoProbe(const MCPseudoProbe &Probe,
                       const MCPseudoProbeInlineStack &InlineStack);
-  void emit(MCObjectStreamer *MCOS, const MCPseudoProbe *&LastProbe);
+  LLVM_ABI void emit(MCObjectStreamer *MCOS, const MCPseudoProbe *&LastProbe);
 };
 
 // inline tree node for the decoded pseudo probe
@@ -360,7 +361,7 @@ class MCPseudoProbeSections {
 
   bool empty() const { return MCProbeDivisions.empty(); }
 
-  void emit(MCObjectStreamer *MCOS);
+  LLVM_ABI void emit(MCObjectStreamer *MCOS);
 };
 
 class MCPseudoProbeTable {
@@ -373,7 +374,7 @@ class MCPseudoProbeTable {
   MCPseudoProbeSections MCProbeSections;
 
 public:
-  static void emit(MCObjectStreamer *MCOS);
+  LLVM_ABI static void emit(MCObjectStreamer *MCOS);
 
   MCPseudoProbeSections &getProbeSections() { return MCProbeSections; }
 
@@ -433,7 +434,7 @@ class MCPseudoProbeDecoder {
   // Decode pseudo_probe_desc section to build GUID to PseudoProbeFuncDesc map.
   // If pseudo_probe_desc section is mapped to memory and \p IsMMapped is true,
   // uses StringRefs pointing to the section.
-  bool buildGUID2FuncDescMap(const uint8_t *Start, std::size_t Size,
+  LLVM_ABI bool buildGUID2FuncDescMap(const uint8_t *Start, std::size_t Size,
                              bool IsMMapped = false);
 
   // Decode pseudo_probe section to count the number of probes and inlined
@@ -444,23 +445,23 @@ class MCPseudoProbeDecoder {
 
   // Decode pseudo_probe section to build address to probes map for specifed
   // functions only.
-  bool buildAddress2ProbeMap(const uint8_t *Start, std::size_t Size,
+  LLVM_ABI bool buildAddress2ProbeMap(const uint8_t *Start, std::size_t Size,
                              const Uint64Set &GuildFilter,
                              const Uint64Map &FuncStartAddrs);
 
   // Print pseudo_probe_desc section info
-  void printGUID2FuncDescMap(raw_ostream &OS);
+  LLVM_ABI void printGUID2FuncDescMap(raw_ostream &OS);
 
   // Print pseudo_probe section info, used along with show-disassembly
-  void printProbeForAddress(raw_ostream &OS, uint64_t Address);
+  LLVM_ABI void printProbeForAddress(raw_ostream &OS, uint64_t Address);
 
   // do printProbeForAddress for all addresses
-  void printProbesForAllAddresses(raw_ostream &OS);
+  LLVM_ABI void printProbesForAllAddresses(raw_ostream &OS);
 
   // Look up the probe of a call for the input address
-  const MCDecodedPseudoProbe *getCallProbeForAddr(uint64_t Address) const;
+  LLVM_ABI const MCDecodedPseudoProbe *getCallProbeForAddr(uint64_t Address) const;
 
-  const MCPseudoProbeFuncDesc *getFuncDescForGUID(uint64_t GUID) const;
+  LLVM_ABI const MCPseudoProbeFuncDesc *getFuncDescForGUID(uint64_t GUID) const;
 
   // Helper function to populate one probe's inline stack into
   // \p InlineContextStack.
@@ -469,7 +470,7 @@ class MCPseudoProbeDecoder {
   //  Current probe(bar:3) inlined at foo:2 then inlined at main:1
   //  IncludeLeaf = true,  Output: [main:1, foo:2, bar:3]
   //  IncludeLeaf = false, Output: [main:1, foo:2]
-  void getInlineContextForProbe(
+  LLVM_ABI void getInlineContextForProbe(
       const MCDecodedPseudoProbe *Probe,
       SmallVectorImpl<MCPseudoProbeFrameLocation> &InlineContextStack,
       bool IncludeLeaf) const;
@@ -484,7 +485,7 @@ class MCPseudoProbeDecoder {
     return GUID2FuncDescMap;
   }
 
-  const MCPseudoProbeFuncDesc *
+  LLVM_ABI const MCPseudoProbeFuncDesc *
   getInlinerDescForProbe(const MCDecodedPseudoProbe *Probe) const;
 
   const MCDecodedPseudoProbeInlineTree &getDummyInlineRoot() const {
diff --git a/llvm/include/llvm/MC/MCRegisterInfo.h b/llvm/include/llvm/MC/MCRegisterInfo.h
index f780bdb97d4fd..c0947e81a23a2 100644
--- a/llvm/include/llvm/MC/MCRegisterInfo.h
+++ b/llvm/include/llvm/MC/MCRegisterInfo.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_MC_MCREGISTERINFO_H
 #define LLVM_MC_MCREGISTERINFO_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/iterator.h"
 #include "llvm/ADT/iterator_range.h"
@@ -146,7 +147,7 @@ struct MCRegisterDesc {
 /// TableGen generated physical register data. It must not be extended with
 /// virtual methods.
 ///
-class MCRegisterInfo {
+class LLVM_ABI MCRegisterInfo {
 public:
   using regclass_iterator = const MCRegisterClass *;
 
diff --git a/llvm/include/llvm/MC/MCSchedule.h b/llvm/include/llvm/MC/MCSchedule.h
index 57c8ebeee02a7..40a19f312a422 100644
--- a/llvm/include/llvm/MC/MCSchedule.h
+++ b/llvm/include/llvm/MC/MCSchedule.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_MC_MCSCHEDULE_H
 #define LLVM_MC_MCSCHEDULE_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCInstrDesc.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -368,12 +369,12 @@ struct MCSchedModel {
   }
 
   /// Returns the latency value for the scheduling class.
-  static int computeInstrLatency(const MCSubtargetInfo &STI,
+  LLVM_ABI static int computeInstrLatency(const MCSubtargetInfo &STI,
                                  const MCSchedClassDesc &SCDesc);
 
-  int computeInstrLatency(const MCSubtargetInfo &STI, unsigned SClass) const;
+  LLVM_ABI int computeInstrLatency(const MCSubtargetInfo &STI, unsigned SClass) const;
 
-  int computeInstrLatency(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
+  LLVM_ABI int computeInstrLatency(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
                           const MCInst &Inst) const;
 
   template <typename MCSubtargetInfo, typename MCInstrInfo,
@@ -386,28 +387,28 @@ struct MCSchedModel {
               [](const MCSchedClassDesc *SCDesc) { return SCDesc; }) const;
 
   // Returns the reciprocal throughput information from a MCSchedClassDesc.
-  static double
+  LLVM_ABI static double
   getReciprocalThroughput(const MCSubtargetInfo &STI,
                           const MCSchedClassDesc &SCDesc);
 
-  static double
+  LLVM_ABI static double
   getReciprocalThroughput(unsigned SchedClass, const InstrItineraryData &IID);
 
-  double
+  LLVM_ABI double
   getReciprocalThroughput(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
                           const MCInst &Inst) const;
 
   /// Returns the maximum forwarding delay for register reads dependent on
   /// writes of scheduling class WriteResourceIdx.
-  static unsigned getForwardingDelayCycles(ArrayRef<MCReadAdvanceEntry> Entries,
+  LLVM_ABI static unsigned getForwardingDelayCycles(ArrayRef<MCReadAdvanceEntry> Entries,
                                            unsigned WriteResourceIdx = 0);
 
   /// Returns the bypass delay cycle for the maximum latency write cycle
-  static unsigned getBypassDelayCycles(const MCSubtargetInfo &STI,
+  LLVM_ABI static unsigned getBypassDelayCycles(const MCSubtargetInfo &STI,
                                        const MCSchedClassDesc &SCDesc);
 
   /// Returns the default initialized model.
-  static const MCSchedModel Default;
+  LLVM_ABI static const MCSchedModel Default;
 };
 
 // The first three are only template'd arguments so we can get away with leaving
diff --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h
index fb23e256d0aab..728270c9d4691 100644
--- a/llvm/include/llvm/MC/MCSection.h
+++ b/llvm/include/llvm/MC/MCSection.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_MC_MCSECTION_H
 #define LLVM_MC_MCSECTION_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCFragment.h"
 #include "llvm/MC/SectionKind.h"
@@ -33,7 +34,7 @@ class Triple;
 
 /// Instances of this class represent a uniqued identifier for a section in the
 /// current translation unit.  The MCContext class uniques and creates these.
-class MCSection {
+class LLVM_ABI MCSection {
 public:
   friend MCAssembler;
   friend MCObjectStreamer;
diff --git a/llvm/include/llvm/MC/MCSectionMachO.h b/llvm/include/llvm/MC/MCSectionMachO.h
index 1f38d24a20d2e..ab4013f211ba2 100644
--- a/llvm/include/llvm/MC/MCSectionMachO.h
+++ b/llvm/include/llvm/MC/MCSectionMachO.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_MC_MCSECTIONMACHO_H
 #define LLVM_MC_MCSECTIONMACHO_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/MachO.h"
 #include "llvm/MC/MCSection.h"
@@ -21,7 +22,7 @@ namespace llvm {
 
 /// This represents a section on a Mach-O system (used by Mac OS X).  On a Mac
 /// system, these are also described in /usr/include/mach-o/loader.h.
-class MCSectionMachO final : public MCSection {
+class LLVM_ABI MCSectionMachO final : public MCSection {
   char SegmentName[16];  // Not necessarily null terminated!
 
   /// This is the SECTION_TYPE and SECTION_ATTRIBUTES field of a section, drawn
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index 1f5014843c5da..fd74abff6c6f3 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_MC_MCSTREAMER_H
 #define LLVM_MC_MCSTREAMER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
@@ -91,7 +92,7 @@ using MCSectionSubPair = std::pair<MCSection *, uint32_t>;
 /// The base classes FooTargetAsmStreamer and FooTargetELFStreamer should
 /// *never* be treated differently. Callers should always talk to a
 /// FooTargetStreamer.
-class MCTargetStreamer {
+class LLVM_ABI MCTargetStreamer {
 protected:
   MCStreamer &Streamer;
 
@@ -134,7 +135,7 @@ class MCTargetStreamer {
 
 // FIXME: declared here because it is used from
 // lib/CodeGen/AsmPrinter/ARMException.cpp.
-class ARMTargetStreamer : public MCTargetStreamer {
+class LLVM_ABI ARMTargetStreamer : public MCTargetStreamer {
 public:
   ARMTargetStreamer(MCStreamer &S);
   ~ARMTargetStreamer() override;
@@ -218,7 +219,7 @@ class ARMTargetStreamer : public MCTargetStreamer {
 /// There are multiple implementations of this interface: one for writing out
 /// a .s file, and implementations that write out .o files of various formats.
 ///
-class MCStreamer {
+class LLVM_ABI MCStreamer {
   MCContext &Context;
   std::unique_ptr<MCTargetStreamer> TargetStreamer;
 
@@ -1129,7 +1130,7 @@ inline MCContext &MCTargetStreamer::getContext() {
 
 /// Create a dummy machine code streamer, which does nothing. This is useful for
 /// timing the assembler front end.
-MCStreamer *createNullStreamer(MCContext &Ctx);
+LLVM_ABI MCStreamer *createNullStreamer(MCContext &Ctx);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/MC/MCSubtargetInfo.h b/llvm/include/llvm/MC/MCSubtargetInfo.h
index 535bcfe2fb6d7..8cf83d3a3222c 100644
--- a/llvm/include/llvm/MC/MCSubtargetInfo.h
+++ b/llvm/include/llvm/MC/MCSubtargetInfo.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_MC_MCSUBTARGETINFO_H
 #define LLVM_MC_MCSUBTARGETINFO_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
@@ -73,7 +74,7 @@ struct SubtargetSubTypeKV {
 ///
 /// Generic base class for all target subtargets.
 ///
-class MCSubtargetInfo {
+class LLVM_ABI MCSubtargetInfo {
   Triple TargetTriple;
   std::string CPU; // CPU being targeted.
   std::string TuneCPU; // CPU being tuned for.
diff --git a/llvm/include/llvm/MC/MCSymbol.h b/llvm/include/llvm/MC/MCSymbol.h
index a990f360b0f76..30ce68c1ab4e5 100644
--- a/llvm/include/llvm/MC/MCSymbol.h
+++ b/llvm/include/llvm/MC/MCSymbol.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_MC_MCSYMBOL_H
 #define LLVM_MC_MCSYMBOL_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringMapEntry.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCExpr.h"
@@ -63,7 +64,7 @@ class MCSymbol {
   };
 
   // Special sentinel value for the absolute pseudo fragment.
-  static MCFragment *AbsolutePseudoFragment;
+  LLVM_ABI static MCFragment *AbsolutePseudoFragment;
 
   /// If a symbol has a Fragment, the section is implied, so we only need
   /// one pointer.
@@ -177,7 +178,7 @@ class MCSymbol {
 
   // Provide custom new/delete as we will only allocate space for a name
   // if we need one.
-  void *operator new(size_t s, const MCSymbolTableEntry *Name, MCContext &Ctx);
+  LLVM_ABI void *operator new(size_t s, const MCSymbolTableEntry *Name, MCContext &Ctx);
 
 private:
   void operator delete(void *);
@@ -306,7 +307,7 @@ class MCSymbol {
     return Value;
   }
 
-  void setVariableValue(const MCExpr *Value);
+  LLVM_ABI void setVariableValue(const MCExpr *Value);
 
   /// @}
 
@@ -409,10 +410,10 @@ class MCSymbol {
   bool isWeakExternal() const { return IsWeakExternal; }
 
   /// print - Print the value to the stream \p OS.
-  void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
+  LLVM_ABI void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
 
   /// dump - Print the value to stderr.
-  void dump() const;
+  LLVM_ABI void dump() const;
 
 protected:
   /// Get the (implementation defined) symbol flags.
diff --git a/llvm/include/llvm/MC/MCTargetOptions.h b/llvm/include/llvm/MC/MCTargetOptions.h
index fd554bc0ba7c6..c930eca886cbb 100644
--- a/llvm/include/llvm/MC/MCTargetOptions.h
+++ b/llvm/include/llvm/MC/MCTargetOptions.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCTARGETOPTIONS_H
 #define LLVM_MC_MCTARGETOPTIONS_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Compression.h"
 #include <string>
@@ -115,17 +116,17 @@ class MCTargetOptions {
   // Whether or not to use full register names on PowerPC.
   bool PPCUseFullRegisterNames : 1;
 
-  MCTargetOptions();
+  LLVM_ABI MCTargetOptions();
 
   /// getABIName - If this returns a non-empty string this represents the
   /// textual name of the ABI that we want the backend to use, e.g. o32, or
   /// aapcs-linux.
-  StringRef getABIName() const;
+  LLVM_ABI StringRef getABIName() const;
 
   /// getAssemblyLanguage - If this returns a non-empty string this represents
   /// the textual name of the assembly language that we will use for this
   /// target, e.g. masm.
-  StringRef getAssemblyLanguage() const;
+  LLVM_ABI StringRef getAssemblyLanguage() const;
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h b/llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
index 5e82bc53f3b5e..b057effd88128 100644
--- a/llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
+++ b/llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_MC_MCTARGETOPTIONSCOMMANDFLAGS_H
 #define LLVM_MC_MCTARGETOPTIONSCOMMANDFLAGS_H
 
+#include "llvm/Support/Compiler.h"
 #include <optional>
 #include <string>
 
@@ -24,52 +25,52 @@ enum class EmitDwarfUnwindType;
 
 namespace mc {
 
-bool getRelaxAll();
-std::optional<bool> getExplicitRelaxAll();
+LLVM_ABI bool getRelaxAll();
+LLVM_ABI std::optional<bool> getExplicitRelaxAll();
 
-bool getIncrementalLinkerCompatible();
+LLVM_ABI bool getIncrementalLinkerCompatible();
 
-bool getFDPIC();
+LLVM_ABI bool getFDPIC();
 
-int getDwarfVersion();
+LLVM_ABI int getDwarfVersion();
 
-bool getDwarf64();
+LLVM_ABI bool getDwarf64();
 
-EmitDwarfUnwindType getEmitDwarfUnwind();
+LLVM_ABI EmitDwarfUnwindType getEmitDwarfUnwind();
 
-bool getEmitCompactUnwindNonCanonical();
+LLVM_ABI bool getEmitCompactUnwindNonCanonical();
 
-bool getShowMCInst();
+LLVM_ABI bool getShowMCInst();
 
-bool getFatalWarnings();
+LLVM_ABI bool getFatalWarnings();
 
-bool getNoWarn();
+LLVM_ABI bool getNoWarn();
 
-bool getNoDeprecatedWarn();
+LLVM_ABI bool getNoDeprecatedWarn();
 
-bool getNoTypeCheck();
+LLVM_ABI bool getNoTypeCheck();
 
-bool getSaveTempLabels();
+LLVM_ABI bool getSaveTempLabels();
 
-bool getCrel();
+LLVM_ABI bool getCrel();
 
-bool getImplicitMapSyms();
+LLVM_ABI bool getImplicitMapSyms();
 
-bool getX86RelaxRelocations();
+LLVM_ABI bool getX86RelaxRelocations();
 
-bool getX86Sse2Avx();
+LLVM_ABI bool getX86Sse2Avx();
 
-std::string getABIName();
+LLVM_ABI std::string getABIName();
 
-std::string getAsSecureLogFile();
+LLVM_ABI std::string getAsSecureLogFile();
 
 /// Create this object with static storage to register mc-related command
 /// line options.
 struct RegisterMCTargetOptionsFlags {
-  RegisterMCTargetOptionsFlags();
+  LLVM_ABI RegisterMCTargetOptionsFlags();
 };
 
-MCTargetOptions InitMCTargetOptionsFromFlags();
+LLVM_ABI MCTargetOptions InitMCTargetOptionsFromFlags();
 
 } // namespace mc
 
diff --git a/llvm/include/llvm/MC/MCWinEH.h b/llvm/include/llvm/MC/MCWinEH.h
index d889ec71e7d8f..1f95df2b9d68b 100644
--- a/llvm/include/llvm/MC/MCWinEH.h
+++ b/llvm/include/llvm/MC/MCWinEH.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_MCWINEH_H
 #define LLVM_MC_MCWINEH_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/Support/SMLoc.h"
 #include <vector>
@@ -103,7 +104,7 @@ struct FrameInfo {
   }
 };
 
-class UnwindEmitter {
+class LLVM_ABI UnwindEmitter {
 public:
   virtual ~UnwindEmitter();
 
diff --git a/llvm/include/llvm/MC/StringTableBuilder.h b/llvm/include/llvm/MC/StringTableBuilder.h
index a738683548cfa..744d8df3652cd 100644
--- a/llvm/include/llvm/MC/StringTableBuilder.h
+++ b/llvm/include/llvm/MC/StringTableBuilder.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_MC_STRINGTABLEBUILDER_H
 #define LLVM_MC_STRINGTABLEBUILDER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/CachedHashString.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -47,26 +48,26 @@ class StringTableBuilder {
   void initSize();
 
 public:
-  StringTableBuilder(Kind K, Align Alignment = Align(1));
-  ~StringTableBuilder();
+  LLVM_ABI StringTableBuilder(Kind K, Align Alignment = Align(1));
+  LLVM_ABI ~StringTableBuilder();
 
   /// Add a string to the builder. Returns the position of S in the
   /// table. The position will be changed if finalize is used.
   /// Can only be used before the table is finalized.
-  size_t add(CachedHashStringRef S);
+  LLVM_ABI size_t add(CachedHashStringRef S);
   size_t add(StringRef S) { return add(CachedHashStringRef(S)); }
 
   /// Analyze the strings and build the final table. No more strings can
   /// be added after this point.
-  void finalize();
+  LLVM_ABI void finalize();
 
   /// Finalize the string table without reording it. In this mode, offsets
   /// returned by add will still be valid.
-  void finalizeInOrder();
+  LLVM_ABI void finalizeInOrder();
 
   /// Get the offest of a string in the string table. Can only be used
   /// after the table is finalized.
-  size_t getOffset(CachedHashStringRef S) const;
+  LLVM_ABI size_t getOffset(CachedHashStringRef S) const;
   size_t getOffset(StringRef S) const {
     return getOffset(CachedHashStringRef(S));
   }
@@ -78,10 +79,10 @@ class StringTableBuilder {
   bool contains(CachedHashStringRef S) const { return StringIndexMap.count(S); }
 
   size_t getSize() const { return Size; }
-  void clear();
+  LLVM_ABI void clear();
 
-  void write(raw_ostream &OS) const;
-  void write(uint8_t *Buf) const;
+  LLVM_ABI void write(raw_ostream &OS) const;
+  LLVM_ABI void write(uint8_t *Buf) const;
 
   bool isFinalized() const { return Finalized; }
 };
diff --git a/llvm/include/llvm/MC/TargetRegistry.h b/llvm/include/llvm/MC/TargetRegistry.h
index f54f7ce756536..58ad35389606d 100644
--- a/llvm/include/llvm/MC/TargetRegistry.h
+++ b/llvm/include/llvm/MC/TargetRegistry.h
@@ -65,7 +65,7 @@ class InstrumentManager;
 struct SourceMgr;
 } // namespace mca
 
-MCStreamer *createNullStreamer(MCContext &Ctx);
+LLVM_ABI MCStreamer *createNullStreamer(MCContext &Ctx);
 // Takes ownership of \p TAB and \p CE.
 
 /// Create a machine code streamer which will print out assembly for the native
@@ -84,54 +84,54 @@ MCStreamer *createNullStreamer(MCContext &Ctx);
 ///
 /// \param ShowInst - Whether to show the MCInst representation inline with
 /// the assembly.
-MCStreamer *createAsmStreamer(MCContext &Ctx,
+LLVM_ABI MCStreamer *createAsmStreamer(MCContext &Ctx,
                               std::unique_ptr<formatted_raw_ostream> OS,
                               std::unique_ptr<MCInstPrinter> InstPrint,
                               std::unique_ptr<MCCodeEmitter> CE,
                               std::unique_ptr<MCAsmBackend> TAB);
 
-MCStreamer *createELFStreamer(MCContext &Ctx,
+LLVM_ABI MCStreamer *createELFStreamer(MCContext &Ctx,
                               std::unique_ptr<MCAsmBackend> &&TAB,
                               std::unique_ptr<MCObjectWriter> &&OW,
                               std::unique_ptr<MCCodeEmitter> &&CE);
-MCStreamer *createGOFFStreamer(MCContext &Ctx,
+LLVM_ABI MCStreamer *createGOFFStreamer(MCContext &Ctx,
                                std::unique_ptr<MCAsmBackend> &&TAB,
                                std::unique_ptr<MCObjectWriter> &&OW,
                                std::unique_ptr<MCCodeEmitter> &&CE);
-MCStreamer *createMachOStreamer(MCContext &Ctx,
+LLVM_ABI MCStreamer *createMachOStreamer(MCContext &Ctx,
                                 std::unique_ptr<MCAsmBackend> &&TAB,
                                 std::unique_ptr<MCObjectWriter> &&OW,
                                 std::unique_ptr<MCCodeEmitter> &&CE,
                                 bool DWARFMustBeAtTheEnd,
                                 bool LabelSections = false);
-MCStreamer *createWasmStreamer(MCContext &Ctx,
+LLVM_ABI MCStreamer *createWasmStreamer(MCContext &Ctx,
                                std::unique_ptr<MCAsmBackend> &&TAB,
                                std::unique_ptr<MCObjectWriter> &&OW,
                                std::unique_ptr<MCCodeEmitter> &&CE);
-MCStreamer *createSPIRVStreamer(MCContext &Ctx,
+LLVM_ABI MCStreamer *createSPIRVStreamer(MCContext &Ctx,
                                 std::unique_ptr<MCAsmBackend> &&TAB,
                                 std::unique_ptr<MCObjectWriter> &&OW,
                                 std::unique_ptr<MCCodeEmitter> &&CE);
-MCStreamer *createDXContainerStreamer(MCContext &Ctx,
+LLVM_ABI MCStreamer *createDXContainerStreamer(MCContext &Ctx,
                                       std::unique_ptr<MCAsmBackend> &&TAB,
                                       std::unique_ptr<MCObjectWriter> &&OW,
                                       std::unique_ptr<MCCodeEmitter> &&CE);
 
-MCRelocationInfo *createMCRelocationInfo(const Triple &TT, MCContext &Ctx);
+LLVM_ABI MCRelocationInfo *createMCRelocationInfo(const Triple &TT, MCContext &Ctx);
 
-MCSymbolizer *createMCSymbolizer(const Triple &TT, LLVMOpInfoCallback GetOpInfo,
+LLVM_ABI MCSymbolizer *createMCSymbolizer(const Triple &TT, LLVMOpInfoCallback GetOpInfo,
                                  LLVMSymbolLookupCallback SymbolLookUp,
                                  void *DisInfo, MCContext *Ctx,
                                  std::unique_ptr<MCRelocationInfo> &&RelInfo);
 
-mca::CustomBehaviour *createCustomBehaviour(const MCSubtargetInfo &STI,
+LLVM_ABI mca::CustomBehaviour *createCustomBehaviour(const MCSubtargetInfo &STI,
                                             const mca::SourceMgr &SrcMgr,
                                             const MCInstrInfo &MCII);
 
-mca::InstrPostProcess *createInstrPostProcess(const MCSubtargetInfo &STI,
+LLVM_ABI mca::InstrPostProcess *createInstrPostProcess(const MCSubtargetInfo &STI,
                                               const MCInstrInfo &MCII);
 
-mca::InstrumentManager *createInstrumentManager(const MCSubtargetInfo &STI,
+LLVM_ABI mca::InstrumentManager *createInstrumentManager(const MCSubtargetInfo &STI,
                                                 const MCInstrInfo &MCII);
 
 /// Target - Wrapper for Target specific information.
@@ -545,13 +545,13 @@ class Target {
   /// \param TAB The target assembler backend object. Takes ownership.
   /// \param OW The stream object.
   /// \param Emitter The target independent assembler object.Takes ownership.
-  MCStreamer *createMCObjectStreamer(const Triple &T, MCContext &Ctx,
+  LLVM_ABI MCStreamer *createMCObjectStreamer(const Triple &T, MCContext &Ctx,
                                      std::unique_ptr<MCAsmBackend> TAB,
                                      std::unique_ptr<MCObjectWriter> OW,
                                      std::unique_ptr<MCCodeEmitter> Emitter,
                                      const MCSubtargetInfo &STI) const;
 
-  MCStreamer *createAsmStreamer(MCContext &Ctx,
+  LLVM_ABI MCStreamer *createAsmStreamer(MCContext &Ctx,
                                 std::unique_ptr<formatted_raw_ostream> OS,
                                 std::unique_ptr<MCInstPrinter> IP,
                                 std::unique_ptr<MCCodeEmitter> CE,
@@ -693,12 +693,12 @@ struct TargetRegistry {
 
   /// printRegisteredTargetsForVersion - Print the registered targets
   /// appropriately for inclusion in a tool's version output.
-  static void printRegisteredTargetsForVersion(raw_ostream &OS);
+  LLVM_ABI static void printRegisteredTargetsForVersion(raw_ostream &OS);
 
   /// @name Registry Access
   /// @{
 
-  static iterator_range<iterator> targets();
+  LLVM_ABI static iterator_range<iterator> targets();
 
   /// lookupTarget - Lookup a target based on a target triple.
   ///
@@ -715,7 +715,7 @@ struct TargetRegistry {
   /// \param Triple - The triple to use for finding a target.
   /// \param Error - On failure, an error string describing why no target was
   /// found.
-  static const Target *lookupTarget(const Triple &TheTriple,
+  LLVM_ABI static const Target *lookupTarget(const Triple &TheTriple,
                                     std::string &Error);
 
   /// lookupTarget - Lookup a target based on an architecture name
@@ -729,7 +729,7 @@ struct TargetRegistry {
   /// by architecture is done.
   /// \param Error - On failure, an error string describing why no target was
   /// found.
-  static const Target *lookupTarget(StringRef ArchName, Triple &TheTriple,
+  LLVM_ABI static const Target *lookupTarget(StringRef ArchName, Triple &TheTriple,
                                     std::string &Error);
 
   /// @}
@@ -754,7 +754,7 @@ struct TargetRegistry {
   /// @param ArchMatchFn - The arch match checking function for this target.
   /// @param HasJIT - Whether the target supports JIT code
   /// generation.
-  static void RegisterTarget(Target &T, const char *Name, const char *ShortDesc,
+  LLVM_ABI static void RegisterTarget(Target &T, const char *Name, const char *ShortDesc,
                              const char *BackendName,
                              Target::ArchMatchFnTy ArchMatchFn,
                              bool HasJIT = false);
diff --git a/llvm/include/llvm/MCA/CodeEmitter.h b/llvm/include/llvm/MCA/CodeEmitter.h
index 431ceea270648..7da65bfc2d300 100644
--- a/llvm/include/llvm/MCA/CodeEmitter.h
+++ b/llvm/include/llvm/MCA/CodeEmitter.h
@@ -16,6 +16,7 @@
 #ifndef LLVM_MCA_CODEEMITTER_H
 #define LLVM_MCA_CODEEMITTER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
@@ -46,7 +47,7 @@ class CodeEmitter {
   // A cache of encodings.
   SmallVector<EncodingInfo, 16> Encodings;
 
-  EncodingInfo getOrCreateEncodingInfo(unsigned MCID);
+  LLVM_ABI EncodingInfo getOrCreateEncodingInfo(unsigned MCID);
 
 public:
   CodeEmitter(const MCSubtargetInfo &ST, const MCAsmBackend &AB,
diff --git a/llvm/include/llvm/MCA/Context.h b/llvm/include/llvm/MCA/Context.h
index 0abcfd7ce9f05..52fa3ef676652 100644
--- a/llvm/include/llvm/MCA/Context.h
+++ b/llvm/include/llvm/MCA/Context.h
@@ -17,6 +17,7 @@
 #ifndef LLVM_MCA_CONTEXT_H
 #define LLVM_MCA_CONTEXT_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/MC/MCRegisterInfo.h"
 #include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/MCA/CustomBehaviour.h"
@@ -67,13 +68,13 @@ class Context {
 
   /// Construct a basic pipeline for simulating an out-of-order pipeline.
   /// This pipeline consists of Fetch, Dispatch, Execute, and Retire stages.
-  std::unique_ptr<Pipeline> createDefaultPipeline(const PipelineOptions &Opts,
+  LLVM_ABI std::unique_ptr<Pipeline> createDefaultPipeline(const PipelineOptions &Opts,
                                                   SourceMgr &SrcMgr,
                                                   CustomBehaviour &CB);
 
   /// Construct a basic pipeline for simulating an in-order pipeline.
   /// This pipeline consists of Fetch, InOrderIssue, and Retire stages.
-  std::unique_ptr<Pipeline> createInOrderPipeline(const PipelineOptions &Opts,
+  LLVM_ABI std::unique_ptr<Pipeline> createInOrderPipeline(const PipelineOptions &Opts,
                                                   SourceMgr &SrcMgr,
                                                   CustomBehaviour &CB);
 };
diff --git a/llvm/include/llvm/MCA/CustomBehaviour.h b/llvm/include/llvm/MCA/CustomBehaviour.h
index b3774894517ab..92e6efe479ce1 100644
--- a/llvm/include/llvm/MCA/CustomBehaviour.h
+++ b/llvm/include/llvm/MCA/CustomBehaviour.h
@@ -18,6 +18,7 @@
 #ifndef LLVM_MCA_CUSTOMBEHAVIOUR_H
 #define LLVM_MCA_CUSTOMBEHAVIOUR_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCInstrInfo.h"
@@ -63,7 +64,7 @@ class InstrPostProcess {
 /// them properly.
 /// If you implement this class for your target, make sure to also implement
 /// a target specific InstrPostProcess class as well.
-class CustomBehaviour {
+class LLVM_ABI CustomBehaviour {
 protected:
   const MCSubtargetInfo &STI;
   const mca::SourceMgr &SrcMgr;
@@ -138,7 +139,7 @@ using UniqueInstrument = std::unique_ptr<Instrument>;
 /// This class allows targets to optionally customize the logic that resolves
 /// scheduling class IDs. Targets can use information encoded in Instrument
 /// objects to make more informed scheduling decisions.
-class InstrumentManager {
+class LLVM_ABI InstrumentManager {
 protected:
   const MCSubtargetInfo &STI;
   const MCInstrInfo &MCII;
diff --git a/llvm/include/llvm/MCA/HWEventListener.h b/llvm/include/llvm/MCA/HWEventListener.h
index a27b1f12e6a6e..4b1b9b92ae717 100644
--- a/llvm/include/llvm/MCA/HWEventListener.h
+++ b/llvm/include/llvm/MCA/HWEventListener.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_MCA_HWEVENTLISTENER_H
 #define LLVM_MCA_HWEVENTLISTENER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MCA/Instruction.h"
 #include "llvm/MCA/Support.h"
@@ -160,7 +161,7 @@ class HWPressureEvent {
   const uint64_t ResourceMask;
 };
 
-class HWEventListener {
+class LLVM_ABI HWEventListener {
 public:
   // Generic events generated by the pipeline.
   virtual void onCycleBegin() {}
diff --git a/llvm/include/llvm/MCA/HardwareUnits/HardwareUnit.h b/llvm/include/llvm/MCA/HardwareUnits/HardwareUnit.h
index 85350e4eb7f07..38f66b54f5143 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/HardwareUnit.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/HardwareUnit.h
@@ -18,7 +18,7 @@
 namespace llvm {
 namespace mca {
 
-class HardwareUnit {
+class LLVM_ABI HardwareUnit {
   HardwareUnit(const HardwareUnit &H) = delete;
   HardwareUnit &operator=(const HardwareUnit &H) = delete;
 
diff --git a/llvm/include/llvm/MCA/HardwareUnits/LSUnit.h b/llvm/include/llvm/MCA/HardwareUnits/LSUnit.h
index 42bab5f93fe6d..223219f76d228 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/LSUnit.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/LSUnit.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_MCA_HARDWAREUNITS_LSUNIT_H
 #define LLVM_MCA_HARDWAREUNITS_LSUNIT_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
@@ -25,7 +26,7 @@ namespace llvm {
 namespace mca {
 
 /// Abstract base interface for LS (load/store) units in llvm-mca.
-class LSUnitBase : public HardwareUnit {
+class LLVM_ABI LSUnitBase : public HardwareUnit {
   /// Load queue size.
   ///
   /// A value of zero for this field means that the load queue is unbounded.
@@ -192,7 +193,7 @@ class LSUnitBase : public HardwareUnit {
 /// A load/store barrier is "executed" when it becomes the oldest entry in
 /// the load/store queue(s). That also means, all the older loads/stores have
 /// already been executed.
-class LSUnit : public LSUnitBase {
+class LLVM_ABI LSUnit : public LSUnitBase {
 
   // This class doesn't know about the latency of a load instruction. So, it
   // conservatively/pessimistically assumes that the latency of a load opcode
diff --git a/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h b/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h
index f71928f835c0e..44f87538362bc 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_MCA_HARDWAREUNITS_RESOURCEMANAGER_H
 #define LLVM_MCA_HARDWAREUNITS_RESOURCEMANAGER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
@@ -44,7 +45,7 @@ enum ResourceStateEvent {
 };
 
 /// Resource allocation strategy used by hardware scheduler resources.
-class ResourceStrategy {
+class LLVM_ABI ResourceStrategy {
   ResourceStrategy(const ResourceStrategy &) = delete;
   ResourceStrategy &operator=(const ResourceStrategy &) = delete;
 
@@ -64,7 +65,7 @@ class ResourceStrategy {
 
 /// Default resource allocation strategy used by processor resource groups and
 /// processor resources with multiple units.
-class DefaultResourceStrategy final : public ResourceStrategy {
+class LLVM_ABI DefaultResourceStrategy final : public ResourceStrategy {
   /// A Mask of resource unit identifiers.
   ///
   /// There is one bit set for every available resource unit.
@@ -211,7 +212,7 @@ class ResourceState {
   }
 
 public:
-  ResourceState(const MCProcResourceDesc &Desc, unsigned Index, uint64_t Mask);
+  LLVM_ABI ResourceState(const MCProcResourceDesc &Desc, unsigned Index, uint64_t Mask);
 
   unsigned getProcResourceID() const { return ProcResourceDescIndex; }
   uint64_t getResourceMask() const { return ResourceMask; }
@@ -230,7 +231,7 @@ class ResourceState {
 
   /// Returs true if this resource is not reserved, and if there are at least
   /// `NumUnits` available units.
-  bool isReady(unsigned NumUnits = 1) const;
+  LLVM_ABI bool isReady(unsigned NumUnits = 1) const;
 
   uint64_t getNumReadyUnits() const { return llvm::popcount(ReadyMask); }
 
@@ -261,7 +262,7 @@ class ResourceState {
   /// is reserved.
   ///
   /// Returns RS_BUFFER_UNAVAILABLE if there are no available slots.
-  ResourceStateEvent isBufferAvailable() const;
+  LLVM_ABI ResourceStateEvent isBufferAvailable() const;
 
   /// Reserve a buffer slot.
   ///
@@ -381,11 +382,11 @@ class ResourceManager {
 
   // Overrides the selection strategy for the processor resource with the given
   // mask.
-  void setCustomStrategyImpl(std::unique_ptr<ResourceStrategy> S,
+  LLVM_ABI void setCustomStrategyImpl(std::unique_ptr<ResourceStrategy> S,
                              uint64_t ResourceMask);
 
 public:
-  ResourceManager(const MCSchedModel &SM);
+  LLVM_ABI ResourceManager(const MCSchedModel &SM);
   virtual ~ResourceManager() = default;
 
   // Overrides the selection strategy for the resource at index ResourceID in
@@ -399,33 +400,33 @@ class ResourceManager {
 
   // Returns RS_BUFFER_AVAILABLE if buffered resources are not reserved, and if
   // there are enough available slots in the buffers.
-  ResourceStateEvent canBeDispatched(uint64_t ConsumedBuffers) const;
+  LLVM_ABI ResourceStateEvent canBeDispatched(uint64_t ConsumedBuffers) const;
 
   // Return the processor resource identifier associated to this Mask.
-  unsigned resolveResourceMask(uint64_t Mask) const;
+  LLVM_ABI unsigned resolveResourceMask(uint64_t Mask) const;
 
   // Acquires a slot from every buffered resource in mask `ConsumedBuffers`.
   // Units that are dispatch hazards (i.e. BufferSize=0) are marked as reserved.
-  void reserveBuffers(uint64_t ConsumedBuffers);
+  LLVM_ABI void reserveBuffers(uint64_t ConsumedBuffers);
 
   // Releases a slot from every buffered resource in mask `ConsumedBuffers`.
   // ConsumedBuffers is a bitmask of previously acquired buffers (using method
   // `reserveBuffers`). Units that are dispatch hazards (i.e. BufferSize=0) are
   // not automatically unreserved by this method.
-  void releaseBuffers(uint64_t ConsumedBuffers);
+  LLVM_ABI void releaseBuffers(uint64_t ConsumedBuffers);
 
   // Reserve a processor resource. A reserved resource is not available for
   // instruction issue until it is released.
-  void reserveResource(uint64_t ResourceID);
+  LLVM_ABI void reserveResource(uint64_t ResourceID);
 
   // Release a previously reserved processor resource.
-  void releaseResource(uint64_t ResourceID);
+  LLVM_ABI void releaseResource(uint64_t ResourceID);
 
   // Returns a zero mask if resources requested by Desc are all available during
   // this cycle. It returns a non-zero mask value only if there are unavailable
   // processor resources; each bit set in the mask represents a busy processor
   // resource unit or a reserved processor resource group.
-  uint64_t checkAvailability(const InstrDesc &Desc) const;
+  LLVM_ABI uint64_t checkAvailability(const InstrDesc &Desc) const;
 
   uint64_t getProcResUnitMask() const { return ProcResUnitMask; }
   uint64_t getAvailableProcResUnits() const { return AvailableProcResUnits; }
@@ -446,7 +447,7 @@ class ResourceManager {
   // schedule, no matter in which order individual uses are processed. For that
   // reason, the vector of resource uses is simply (and quickly) processed in
   // sequence. The resulting schedule is eventually stored into vector `Pipes`.
-  void fastIssueInstruction(const InstrDesc &Desc,
+  LLVM_ABI void fastIssueInstruction(const InstrDesc &Desc,
                             SmallVectorImpl<ResourceWithCycles> &Pipes);
 
   // Selects pipeline resources consumed by an instruction.
@@ -454,10 +455,10 @@ class ResourceManager {
   // partially overlap. This complicates the selection process, because the
   // order in which uses are processed matters. The logic internally prioritizes
   // groups which are more constrained than others.
-  void issueInstructionImpl(const InstrDesc &Desc,
+  LLVM_ABI void issueInstructionImpl(const InstrDesc &Desc,
                             SmallVectorImpl<ResourceWithCycles> &Pipes);
 
-  void cycleEvent(SmallVectorImpl<ResourceRef> &ResourcesFreed);
+  LLVM_ABI void cycleEvent(SmallVectorImpl<ResourceRef> &ResourcesFreed);
 
 #ifndef NDEBUG
   void dump() const {
diff --git a/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h b/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h
index 272f6b197868b..08e2f8fae04de 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_MCA_HARDWAREUNITS_SCHEDULER_H
 #define LLVM_MCA_HARDWAREUNITS_SCHEDULER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
 #include "llvm/MCA/HardwareUnits/HardwareUnit.h"
@@ -24,7 +25,7 @@
 namespace llvm {
 namespace mca {
 
-class SchedulerStrategy {
+class LLVM_ABI SchedulerStrategy {
 public:
   SchedulerStrategy() = default;
   virtual ~SchedulerStrategy();
@@ -37,7 +38,7 @@ class SchedulerStrategy {
 };
 
 /// Default instruction selection strategy used by class Scheduler.
-class DefaultSchedulerStrategy : public SchedulerStrategy {
+class LLVM_ABI DefaultSchedulerStrategy : public SchedulerStrategy {
   /// This method ranks instructions based on their age, and the number of known
   /// users. The lower the rank value, the better.
   int computeRank(const InstRef &Lhs) const {
@@ -131,7 +132,7 @@ class Scheduler : public HardwareUnit {
   /// Verify the given selection strategy and set the Strategy member
   /// accordingly.  If no strategy is provided, the DefaultSchedulerStrategy is
   /// used.
-  void initializeStrategy(std::unique_ptr<SchedulerStrategy> S);
+  LLVM_ABI void initializeStrategy(std::unique_ptr<SchedulerStrategy> S);
 
   /// Issue an instruction without updating the ready queue.
   void issueInstructionImpl(
@@ -183,7 +184,7 @@ class Scheduler : public HardwareUnit {
   ///
   /// This method is also responsible for setting field HadTokenStall if
   /// IR cannot be dispatched to the Scheduler due to unavailable resources.
-  Status isAvailable(const InstRef &IR);
+  LLVM_ABI Status isAvailable(const InstRef &IR);
 
   /// Reserves buffer and LSUnit queue resources that are necessary to issue
   /// this instruction.
@@ -195,12 +196,12 @@ class Scheduler : public HardwareUnit {
   /// If IR is a memory operation, then the Scheduler queries the LS unit to
   /// obtain a LS token. An LS token is used internally to track memory
   /// dependencies.
-  bool dispatch(InstRef &IR);
+  LLVM_ABI bool dispatch(InstRef &IR);
 
   /// Issue an instruction and populates a vector of used pipeline resources,
   /// and a vector of instructions that transitioned to the ready state as a
   /// result of this event.
-  void issueInstruction(
+  LLVM_ABI void issueInstruction(
       InstRef &IR,
       SmallVectorImpl<std::pair<ResourceRef, ReleaseAtCycles>> &Used,
       SmallVectorImpl<InstRef> &Pending,
@@ -208,7 +209,7 @@ class Scheduler : public HardwareUnit {
 
   /// Returns true if IR has to be issued immediately, or if IR is a zero
   /// latency instruction.
-  bool mustIssueImmediately(const InstRef &IR) const;
+  LLVM_ABI bool mustIssueImmediately(const InstRef &IR) const;
 
   /// This routine notifies the Scheduler that a new cycle just started.
   ///
@@ -222,7 +223,7 @@ class Scheduler : public HardwareUnit {
   /// disjoint. An instruction is allowed to transition from the WAIT state to
   /// the READY state (going through the PENDING state) within a single cycle.
   /// That means, instructions may appear in both the Pending and Ready set.
-  void cycleEvent(SmallVectorImpl<ResourceRef> &Freed,
+  LLVM_ABI void cycleEvent(SmallVectorImpl<ResourceRef> &Freed,
                   SmallVectorImpl<InstRef> &Executed,
                   SmallVectorImpl<InstRef> &Pending,
                   SmallVectorImpl<InstRef> &Ready);
@@ -238,7 +239,7 @@ class Scheduler : public HardwareUnit {
   /// Select the next instruction to issue from the ReadySet. Returns an invalid
   /// instruction reference if there are no ready instructions, or if processor
   /// resources are not available.
-  InstRef select();
+  LLVM_ABI InstRef select();
 
   bool isReadySetEmpty() const { return ReadySet.empty(); }
   bool isWaitSetEmpty() const { return WaitSet.empty(); }
@@ -248,13 +249,13 @@ class Scheduler : public HardwareUnit {
   /// populated by instructions that were not issued because of unsolved
   /// register dependencies.  Vector MemDeps is populated by instructions that
   /// were not issued because of unsolved memory dependencies.
-  void analyzeDataDependencies(SmallVectorImpl<InstRef> &RegDeps,
+  LLVM_ABI void analyzeDataDependencies(SmallVectorImpl<InstRef> &RegDeps,
                                SmallVectorImpl<InstRef> &MemDeps);
 
   /// Returns a mask of busy resources, and populates vector Insts with
   /// instructions that could not be issued to the underlying pipelines because
   /// not all pipeline resources were available.
-  uint64_t analyzeResourcePressure(SmallVectorImpl<InstRef> &Insts);
+  LLVM_ABI uint64_t analyzeResourcePressure(SmallVectorImpl<InstRef> &Insts);
 
   // Returns true if the dispatch logic couldn't dispatch a full group due to
   // unavailable scheduler and/or LS resources.
diff --git a/llvm/include/llvm/MCA/IncrementalSourceMgr.h b/llvm/include/llvm/MCA/IncrementalSourceMgr.h
index 81f9b51cf42f0..ada7bca49406f 100644
--- a/llvm/include/llvm/MCA/IncrementalSourceMgr.h
+++ b/llvm/include/llvm/MCA/IncrementalSourceMgr.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_MCA_INCREMENTALSOURCEMGR_H
 #define LLVM_MCA_INCREMENTALSOURCEMGR_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/MCA/SourceMgr.h"
 #include <deque>
 
@@ -23,7 +24,7 @@ namespace mca {
 /// An implementation of \a SourceMgr that allows users to add new instructions
 /// incrementally / dynamically.
 /// Note that this SourceMgr takes ownership of all \a mca::Instruction.
-class IncrementalSourceMgr : public SourceMgr {
+class LLVM_ABI IncrementalSourceMgr : public SourceMgr {
   /// Owner of all mca::Instruction instances. Note that we use std::deque here
   /// to have a better throughput, in comparison to std::vector or
   /// llvm::SmallVector, as they usually pay a higher re-allocation cost when
diff --git a/llvm/include/llvm/MCA/InstrBuilder.h b/llvm/include/llvm/MCA/InstrBuilder.h
index 00b19a65dc166..77f0fd961e7db 100644
--- a/llvm/include/llvm/MCA/InstrBuilder.h
+++ b/llvm/include/llvm/MCA/InstrBuilder.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_MCA_INSTRBUILDER_H
 #define LLVM_MCA_INSTRBUILDER_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/MC/MCInstrAnalysis.h"
@@ -32,7 +33,7 @@ class RecycledInstErr : public ErrorInfo<RecycledInstErr> {
   Instruction *RecycledInst;
 
 public:
-  static char ID;
+  LLVM_ABI static char ID;
 
   explicit RecycledInstErr(Instruction *Inst) : RecycledInst(Inst) {}
   // Always need to carry an Instruction
@@ -99,7 +100,7 @@ class InstrBuilder {
   Error verifyInstrDesc(const InstrDesc &ID, const MCInst &MCI) const;
 
 public:
-  InstrBuilder(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
+  LLVM_ABI InstrBuilder(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
                const MCRegisterInfo &RI, const MCInstrAnalysis *IA,
                const InstrumentManager &IM, unsigned CallLatency);
 
@@ -114,7 +115,7 @@ class InstrBuilder {
   /// or null if there isn't any.
   void setInstRecycleCallback(InstRecycleCallback CB) { InstRecycleCB = CB; }
 
-  Expected<std::unique_ptr<Instruction>>
+  LLVM_ABI Expected<std::unique_ptr<Instruction>>
   createInstruction(const MCInst &MCI, const SmallVector<Instrument *> &IVec);
 };
 } // namespace mca
diff --git a/llvm/include/llvm/MCA/Instruction.h b/llvm/include/llvm/MCA/Instruction.h
index e48a70164bec6..cceb9876342dd 100644
--- a/llvm/include/llvm/MCA/Instruction.h
+++ b/llvm/include/llvm/MCA/Instruction.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_MCA_INSTRUCTION_H
 #define LLVM_MCA_INSTRUCTION_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
@@ -271,11 +272,11 @@ class WriteState {
   // instruction identifier associated with this write. ReadAdvance is the
   // number of cycles to subtract from the latency of this data dependency.
   // Use is in a RAW dependency with this write.
-  void addUser(unsigned IID, ReadState *Use, int ReadAdvance);
+  LLVM_ABI void addUser(unsigned IID, ReadState *Use, int ReadAdvance);
 
   // Use is a younger register write that is in a false dependency with this
   // write. IID is the instruction identifier associated with this write.
-  void addUser(unsigned IID, WriteState *Use);
+  LLVM_ABI void addUser(unsigned IID, WriteState *Use);
 
   unsigned getNumUsers() const {
     unsigned NumUsers = Users.size();
@@ -300,7 +301,7 @@ class WriteState {
   }
 
   void setDependentWrite(const WriteState *Other) { DependentWrite = Other; }
-  void writeStartEvent(unsigned IID, MCPhysReg RegID, unsigned Cycles);
+  LLVM_ABI void writeStartEvent(unsigned IID, MCPhysReg RegID, unsigned Cycles);
   void setWriteZero() { WritesZero = true; }
   void setEliminated() {
     assert(Users.empty() && "Write is in an inconsistent state.");
@@ -311,8 +312,8 @@ class WriteState {
   void setPRF(unsigned PRF) { PRFID = PRF; }
 
   // On every cycle, update CyclesLeft and notify dependent users.
-  void cycleEvent();
-  void onInstructionIssued(unsigned IID);
+  LLVM_ABI void cycleEvent();
+  LLVM_ABI void onInstructionIssued(unsigned IID);
 
 #ifndef NDEBUG
   void dump() const;
@@ -371,8 +372,8 @@ class ReadState {
   bool isIndependentFromDef() const { return IndependentFromDef; }
   void setIndependentFromDef() { IndependentFromDef = true; }
 
-  void cycleEvent();
-  void writeStartEvent(unsigned IID, MCPhysReg RegID, unsigned Cycles);
+  LLVM_ABI void cycleEvent();
+  LLVM_ABI void writeStartEvent(unsigned IID, MCPhysReg RegID, unsigned Cycles);
   void setDependentWrites(unsigned Writes) {
     DependentWrites = Writes;
     IsReady = !Writes;
@@ -650,7 +651,7 @@ class Instruction : public InstructionBase {
         UsedBuffers(D.UsedBuffers), CriticalRegDep(), CriticalMemDep(),
         CriticalResourceMask(0), IsEliminated(false) {}
 
-  void reset();
+  LLVM_ABI void reset();
 
   unsigned getRCUTokenID() const { return RCUTokenID; }
   unsigned getLSUTokenID() const { return LSUTokenID; }
@@ -665,11 +666,11 @@ class Instruction : public InstructionBase {
   // Transition to the dispatch stage, and assign a RCUToken to this
   // instruction. The RCUToken is used to track the completion of every
   // register write performed by this instruction.
-  void dispatch(unsigned RCUTokenID);
+  LLVM_ABI void dispatch(unsigned RCUTokenID);
 
   // Instruction issued. Transition to the IS_EXECUTING state, and update
   // all the register definitions.
-  void execute(unsigned IID);
+  LLVM_ABI void execute(unsigned IID);
 
   // Force a transition from the IS_DISPATCHED state to the IS_READY or
   // IS_PENDING state. State transitions normally occur either at the beginning
@@ -677,9 +678,9 @@ class Instruction : public InstructionBase {
   // event. This method is called every time the instruction might have changed
   // in state. It internally delegates to method updateDispatched() and
   // updateWaiting().
-  void update();
-  bool updateDispatched();
-  bool updatePending();
+  LLVM_ABI void update();
+  LLVM_ABI bool updateDispatched();
+  LLVM_ABI bool updatePending();
 
   bool isInvalid() const { return Stage == IS_INVALID; }
   bool isDispatched() const { return Stage == IS_DISPATCHED; }
@@ -691,7 +692,7 @@ class Instruction : public InstructionBase {
   bool isEliminated() const { return IsEliminated; }
 
   // Forces a transition from state IS_DISPATCHED to state IS_EXECUTED.
-  void forceExecuted();
+  LLVM_ABI void forceExecuted();
   void setEliminated() { IsEliminated = true; }
 
   void retire() {
@@ -701,7 +702,7 @@ class Instruction : public InstructionBase {
 
   const CriticalDependency &getCriticalRegDep() const { return CriticalRegDep; }
   const CriticalDependency &getCriticalMemDep() const { return CriticalMemDep; }
-  const CriticalDependency &computeCriticalRegDep();
+  LLVM_ABI const CriticalDependency &computeCriticalRegDep();
   void setCriticalMemDep(const CriticalDependency &MemDep) {
     CriticalMemDep = MemDep;
   }
@@ -711,7 +712,7 @@ class Instruction : public InstructionBase {
     CriticalResourceMask = ResourceMask;
   }
 
-  void cycleEvent();
+  LLVM_ABI void cycleEvent();
 };
 
 /// An InstRef contains both a SourceMgr index and Instruction pair.  The index
diff --git a/llvm/include/llvm/MCA/Pipeline.h b/llvm/include/llvm/MCA/Pipeline.h
index 18032fdfe012c..b7b3da2a9e472 100644
--- a/llvm/include/llvm/MCA/Pipeline.h
+++ b/llvm/include/llvm/MCA/Pipeline.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_MCA_PIPELINE_H
 #define LLVM_MCA_PIPELINE_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/MCA/Stages/Stage.h"
 #include "llvm/Support/Error.h"
 
@@ -70,12 +71,12 @@ class Pipeline {
 
 public:
   Pipeline() = default;
-  void appendStage(std::unique_ptr<Stage> S);
+  LLVM_ABI void appendStage(std::unique_ptr<Stage> S);
 
   /// Returns the total number of simulated cycles.
-  Expected<unsigned> run();
+  LLVM_ABI Expected<unsigned> run();
 
-  void addEventListener(HWEventListener *Listener);
+  LLVM_ABI void addEventListener(HWEventListener *Listener);
 
   /// Returns whether the pipeline is currently paused.
   bool isPaused() const { return CurrentState == State::Paused; }
diff --git a/llvm/include/llvm/MCA/Stages/EntryStage.h b/llvm/include/llvm/MCA/Stages/EntryStage.h
index fb1244aa1933a..d123ccf4a7aa3 100644
--- a/llvm/include/llvm/MCA/Stages/EntryStage.h
+++ b/llvm/include/llvm/MCA/Stages/EntryStage.h
@@ -16,6 +16,7 @@
 #ifndef LLVM_MCA_STAGES_ENTRYSTAGE_H
 #define LLVM_MCA_STAGES_ENTRYSTAGE_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MCA/SourceMgr.h"
 #include "llvm/MCA/Stages/Stage.h"
@@ -23,7 +24,7 @@
 namespace llvm {
 namespace mca {
 
-class EntryStage final : public Stage {
+class LLVM_ABI EntryStage final : public Stage {
   InstRef CurrentInstruction;
   SmallVector<std::unique_ptr<Instruction>, 16> Instructions;
   SourceMgr &SM;
diff --git a/llvm/include/llvm/MCA/Stages/InstructionTables.h b/llvm/include/llvm/MCA/Stages/InstructionTables.h
index 9617fd49db6e0..2eae12e2b13be 100644
--- a/llvm/include/llvm/MCA/Stages/InstructionTables.h
+++ b/llvm/include/llvm/MCA/Stages/InstructionTables.h
@@ -16,6 +16,7 @@
 #ifndef LLVM_MCA_STAGES_INSTRUCTIONTABLES_H
 #define LLVM_MCA_STAGES_INSTRUCTIONTABLES_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
 #include "llvm/MCA/HardwareUnits/Scheduler.h"
@@ -25,7 +26,7 @@
 namespace llvm {
 namespace mca {
 
-class InstructionTables final : public Stage {
+class LLVM_ABI InstructionTables final : public Stage {
   const MCSchedModel &SM;
   SmallVector<ResourceUse, 4> UsedResources;
   SmallVector<uint64_t, 8> Masks;
diff --git a/llvm/include/llvm/MCA/Stages/Stage.h b/llvm/include/llvm/MCA/Stages/Stage.h
index a1fc7a8af7ad6..0942220070005 100644
--- a/llvm/include/llvm/MCA/Stages/Stage.h
+++ b/llvm/include/llvm/MCA/Stages/Stage.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_MCA_STAGES_STAGE_H
 #define LLVM_MCA_STAGES_STAGE_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/MCA/HWEventListener.h"
 #include "llvm/Support/Error.h"
 #include <set>
@@ -24,7 +25,7 @@ namespace mca {
 
 class InstRef;
 
-class Stage {
+class LLVM_ABI Stage {
   Stage *NextInSequence = nullptr;
   std::set<HWEventListener *> Listeners;
 
@@ -88,7 +89,7 @@ class Stage {
 /// This is actually not an error but a marker to indicate that
 /// the instruction stream is paused.
 struct InstStreamPause : public ErrorInfo<InstStreamPause> {
-  static char ID;
+  LLVM_ABI static char ID;
 
   std::error_code convertToErrorCode() const override {
     return llvm::inconvertibleErrorCode();
diff --git a/llvm/include/llvm/MCA/Support.h b/llvm/include/llvm/MCA/Support.h
index e3c155435e234..9352c17404fd1 100644
--- a/llvm/include/llvm/MCA/Support.h
+++ b/llvm/include/llvm/MCA/Support.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_MCA_SUPPORT_H
 #define LLVM_MCA_SUPPORT_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
@@ -67,7 +68,7 @@ class ReleaseAtCycles {
   // Add the components of RHS to this instance.  Instead of calculating
   // the final value here, we keep track of the numerator and denominator
   // separately, to reduce floating point error.
-  ReleaseAtCycles &operator+=(const ReleaseAtCycles &RHS);
+  LLVM_ABI ReleaseAtCycles &operator+=(const ReleaseAtCycles &RHS);
 };
 
 /// Populates vector Masks with processor resource masks.
@@ -92,7 +93,7 @@ class ReleaseAtCycles {
 ///
 /// Resource masks are used by the ResourceManager to solve set membership
 /// problems with simple bit manipulation operations.
-void computeProcResourceMasks(const MCSchedModel &SM,
+LLVM_ABI void computeProcResourceMasks(const MCSchedModel &SM,
                               MutableArrayRef<uint64_t> Masks);
 
 // Returns the index of the highest bit set. For resource masks, the position of
@@ -106,7 +107,7 @@ inline unsigned getResourceStateIndex(uint64_t Mask) {
 /// cycles. The reciprocal block throughput is computed as the MAX between:
 ///  - NumMicroOps / DispatchWidth
 ///  - ProcReleaseAtCycles / #ProcResourceUnits  (for every consumed resource).
-double computeBlockRThroughput(const MCSchedModel &SM, unsigned DispatchWidth,
+LLVM_ABI double computeBlockRThroughput(const MCSchedModel &SM, unsigned DispatchWidth,
                                unsigned NumMicroOps,
                                ArrayRef<unsigned> ProcResourceUsage);
 } // namespace mca
diff --git a/llvm/include/llvm/MCA/View.h b/llvm/include/llvm/MCA/View.h
index ff8fc1ceb3f14..ff284098634e1 100644
--- a/llvm/include/llvm/MCA/View.h
+++ b/llvm/include/llvm/MCA/View.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_MCA_VIEW_H
 #define LLVM_MCA_VIEW_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/MC/MCInstPrinter.h"
 #include "llvm/MCA/HWEventListener.h"
 #include "llvm/Support/JSON.h"
@@ -23,7 +24,7 @@
 namespace llvm {
 namespace mca {
 
-class View : public HWEventListener {
+class LLVM_ABI View : public HWEventListener {
 public:
   virtual ~View() = default;
 

>From 9417424d33dfcf7ec629b13c3a839a0a0f4049b9 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Wed, 28 May 2025 12:30:40 -0700
Subject: [PATCH 2/3] [llvm] manual fix-ups to IDS codemod of MC and MCA
 libraries

---
 llvm/include/llvm/MC/MCAsmInfo.h                       | 4 ++++
 llvm/include/llvm/MC/MCCodeEmitter.h                   | 2 ++
 llvm/include/llvm/MC/MCDisassembler/MCRelocationInfo.h | 2 ++
 llvm/include/llvm/MCA/HardwareUnits/HardwareUnit.h     | 2 ++
 llvm/include/llvm/MCA/IncrementalSourceMgr.h           | 4 ++++
 5 files changed, 14 insertions(+)

diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h
index 467f8ffcc2a03..ad50355af508d 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -428,6 +428,10 @@ class LLVM_ABI MCAsmInfo {
   explicit MCAsmInfo();
   virtual ~MCAsmInfo();
 
+  // Explicitly non-copyable.
+  MCAsmInfo(MCAsmInfo const&) = delete;
+  MCAsmInfo& operator=(MCAsmInfo const&) = delete;
+
   /// Get the code pointer size in bytes.
   unsigned getCodePointerSize() const { return CodePointerSize; }
 
diff --git a/llvm/include/llvm/MC/MCCodeEmitter.h b/llvm/include/llvm/MC/MCCodeEmitter.h
index 709286b88ea73..1c454c3795c2c 100644
--- a/llvm/include/llvm/MC/MCCodeEmitter.h
+++ b/llvm/include/llvm/MC/MCCodeEmitter.h
@@ -9,6 +9,8 @@
 #ifndef LLVM_MC_MCCODEEMITTER_H
 #define LLVM_MC_MCCODEEMITTER_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 
 class MCFixup;
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCRelocationInfo.h b/llvm/include/llvm/MC/MCDisassembler/MCRelocationInfo.h
index f87c1bcb99799..2cf4af02bef66 100644
--- a/llvm/include/llvm/MC/MCDisassembler/MCRelocationInfo.h
+++ b/llvm/include/llvm/MC/MCDisassembler/MCRelocationInfo.h
@@ -15,6 +15,8 @@
 #ifndef LLVM_MC_MCDISASSEMBLER_MCRELOCATIONINFO_H
 #define LLVM_MC_MCDISASSEMBLER_MCRELOCATIONINFO_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 
 class MCContext;
diff --git a/llvm/include/llvm/MCA/HardwareUnits/HardwareUnit.h b/llvm/include/llvm/MCA/HardwareUnits/HardwareUnit.h
index 38f66b54f5143..9d0e3749d5cf0 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/HardwareUnit.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/HardwareUnit.h
@@ -15,6 +15,8 @@
 #ifndef LLVM_MCA_HARDWAREUNITS_HARDWAREUNIT_H
 #define LLVM_MCA_HARDWAREUNITS_HARDWAREUNIT_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 namespace mca {
 
diff --git a/llvm/include/llvm/MCA/IncrementalSourceMgr.h b/llvm/include/llvm/MCA/IncrementalSourceMgr.h
index ada7bca49406f..4d7a9e206cd46 100644
--- a/llvm/include/llvm/MCA/IncrementalSourceMgr.h
+++ b/llvm/include/llvm/MCA/IncrementalSourceMgr.h
@@ -48,6 +48,10 @@ class LLVM_ABI IncrementalSourceMgr : public SourceMgr {
 public:
   IncrementalSourceMgr() = default;
 
+  // Explicitly non-copyable.
+  IncrementalSourceMgr& operator=(const IncrementalSourceMgr&) = delete;
+  IncrementalSourceMgr(const IncrementalSourceMgr&) = delete;
+
   void clear();
 
   /// Set a callback that is invoked when a mca::Instruction is

>From 39eee07cc4c8db2f27b2a80c5f6dbbfcd5ca1a3a Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Wed, 28 May 2025 12:31:07 -0700
Subject: [PATCH 3/3] [llvm] clang-format changes to MC and MCA libraries

---
 llvm/include/llvm/MC/MCAsmBackend.h           |   2 +-
 llvm/include/llvm/MC/MCAsmInfo.h              |   6 +-
 llvm/include/llvm/MC/MCAsmMacro.h             |   2 +-
 llvm/include/llvm/MC/MCAssembler.h            |  17 +--
 llvm/include/llvm/MC/MCContext.h              | 116 ++++++++++--------
 .../llvm/MC/MCDisassembler/MCDisassembler.h   |   2 +-
 .../llvm/MC/MCDisassembler/MCSymbolizer.h     |   2 +-
 llvm/include/llvm/MC/MCDwarf.h                |  45 ++++---
 llvm/include/llvm/MC/MCExpr.h                 |  35 +++---
 llvm/include/llvm/MC/MCFragment.h             |   2 +-
 llvm/include/llvm/MC/MCInst.h                 |  20 +--
 llvm/include/llvm/MC/MCInstPrinter.h          |   5 +-
 llvm/include/llvm/MC/MCInstrAnalysis.h        |   2 +-
 llvm/include/llvm/MC/MCInstrDesc.h            |  12 +-
 llvm/include/llvm/MC/MCInstrInfo.h            |   4 +-
 .../llvm/MC/MCLinkerOptimizationHint.h        |   4 +-
 llvm/include/llvm/MC/MCMachObjectWriter.h     |   2 +-
 llvm/include/llvm/MC/MCObjectFileInfo.h       |   2 +-
 llvm/include/llvm/MC/MCObjectWriter.h         |   2 +-
 llvm/include/llvm/MC/MCParser/AsmLexer.h      |   7 +-
 llvm/include/llvm/MC/MCParser/MCAsmParser.h   |   7 +-
 .../llvm/MC/MCParser/MCAsmParserExtension.h   |   2 +-
 .../llvm/MC/MCParser/MCParsedAsmOperand.h     |   2 +-
 .../llvm/MC/MCParser/MCTargetAsmParser.h      |   2 +-
 llvm/include/llvm/MC/MCPseudoProbe.h          |  18 +--
 llvm/include/llvm/MC/MCRegisterInfo.h         |   2 +-
 llvm/include/llvm/MC/MCSchedule.h             |  29 +++--
 llvm/include/llvm/MC/MCSection.h              |   2 +-
 llvm/include/llvm/MC/MCSectionMachO.h         |   2 +-
 llvm/include/llvm/MC/MCStreamer.h             |   2 +-
 llvm/include/llvm/MC/MCSubtargetInfo.h        |   2 +-
 llvm/include/llvm/MC/MCSymbol.h               |   5 +-
 llvm/include/llvm/MC/MCTargetOptions.h        |   2 +-
 llvm/include/llvm/MC/MCWinEH.h                |   2 +-
 llvm/include/llvm/MC/StringTableBuilder.h     |   2 +-
 llvm/include/llvm/MC/TargetRegistry.h         | 113 ++++++++---------
 llvm/include/llvm/MCA/CodeEmitter.h           |   2 +-
 llvm/include/llvm/MCA/Context.h               |  14 +--
 llvm/include/llvm/MCA/CustomBehaviour.h       |   2 +-
 llvm/include/llvm/MCA/HWEventListener.h       |   2 +-
 llvm/include/llvm/MCA/HardwareUnits/LSUnit.h  |   2 +-
 .../llvm/MCA/HardwareUnits/ResourceManager.h  |  17 +--
 .../llvm/MCA/HardwareUnits/Scheduler.h        |  13 +-
 llvm/include/llvm/MCA/IncrementalSourceMgr.h  |   6 +-
 llvm/include/llvm/MCA/InstrBuilder.h          |   6 +-
 llvm/include/llvm/MCA/Instruction.h           |   2 +-
 llvm/include/llvm/MCA/Pipeline.h              |   2 +-
 llvm/include/llvm/MCA/Stages/EntryStage.h     |   2 +-
 .../llvm/MCA/Stages/InstructionTables.h       |   2 +-
 llvm/include/llvm/MCA/Stages/Stage.h          |   2 +-
 llvm/include/llvm/MCA/Support.h               |  11 +-
 llvm/include/llvm/MCA/View.h                  |   2 +-
 52 files changed, 309 insertions(+), 261 deletions(-)

diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h
index ac49a16850545..e49e786a10f58 100644
--- a/llvm/include/llvm/MC/MCAsmBackend.h
+++ b/llvm/include/llvm/MC/MCAsmBackend.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_MC_MCASMBACKEND_H
 #define LLVM_MC_MCASMBACKEND_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/MCDirectives.h"
 #include "llvm/MC/MCFixup.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Endian.h"
 #include <cstdint>
 
diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h
index ad50355af508d..4eb50344d6384 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -15,12 +15,12 @@
 #ifndef LLVM_MC_MCASMINFO_H
 #define LLVM_MC_MCASMINFO_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCDirectives.h"
 #include "llvm/MC/MCTargetOptions.h"
+#include "llvm/Support/Compiler.h"
 #include <vector>
 
 namespace llvm {
@@ -429,8 +429,8 @@ class LLVM_ABI MCAsmInfo {
   virtual ~MCAsmInfo();
 
   // Explicitly non-copyable.
-  MCAsmInfo(MCAsmInfo const&) = delete;
-  MCAsmInfo& operator=(MCAsmInfo const&) = delete;
+  MCAsmInfo(MCAsmInfo const &) = delete;
+  MCAsmInfo &operator=(MCAsmInfo const &) = delete;
 
   /// Get the code pointer size in bytes.
   unsigned getCodePointerSize() const { return CodePointerSize; }
diff --git a/llvm/include/llvm/MC/MCAsmMacro.h b/llvm/include/llvm/MC/MCAsmMacro.h
index f0ce8f1182bf1..ce50fb6418845 100644
--- a/llvm/include/llvm/MC/MCAsmMacro.h
+++ b/llvm/include/llvm/MC/MCAsmMacro.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_MC_MCASMMACRO_H
 #define LLVM_MC_MCASMMACRO_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/SMLoc.h"
 #include <vector>
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h
index 26f76f3525361..5e009090311c4 100644
--- a/llvm/include/llvm/MC/MCAssembler.h
+++ b/llvm/include/llvm/MC/MCAssembler.h
@@ -9,7 +9,6 @@
 #ifndef LLVM_MC_MCASSEMBLER_H
 #define LLVM_MC_MCASSEMBLER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
@@ -18,6 +17,7 @@
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/MC/MCDwarf.h"
 #include "llvm/MC/MCSymbol.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <algorithm>
 #include <cassert>
@@ -136,9 +136,10 @@ class MCAssembler {
   // concrete and require clients to pass in a target like object. The other
   // option is to make this abstract, and have targets provide concrete
   // implementations as we do with AsmParser.
-  LLVM_ABI MCAssembler(MCContext &Context, std::unique_ptr<MCAsmBackend> Backend,
-              std::unique_ptr<MCCodeEmitter> Emitter,
-              std::unique_ptr<MCObjectWriter> Writer);
+  LLVM_ABI MCAssembler(MCContext &Context,
+                       std::unique_ptr<MCAsmBackend> Backend,
+                       std::unique_ptr<MCCodeEmitter> Emitter,
+                       std::unique_ptr<MCObjectWriter> Writer);
   MCAssembler(const MCAssembler &) = delete;
   MCAssembler &operator=(const MCAssembler &) = delete;
 
@@ -165,7 +166,8 @@ class MCAssembler {
   LLVM_ABI const MCSymbol *getBaseSymbol(const MCSymbol &Symbol) const;
 
   /// Emit the section contents to \p OS.
-  LLVM_ABI void writeSectionData(raw_ostream &OS, const MCSection *Section) const;
+  LLVM_ABI void writeSectionData(raw_ostream &OS,
+                                 const MCSection *Section) const;
 
   /// Check whether a given symbol has been flagged with .thumb_func.
   LLVM_ABI bool isThumbFunc(const MCSymbol *Func) const;
@@ -229,8 +231,9 @@ class MCAssembler {
 
   /// Write the necessary bundle padding to \p OS.
   /// Expects a fragment \p F containing instructions and its size \p FSize.
-  LLVM_ABI void writeFragmentPadding(raw_ostream &OS, const MCEncodedFragment &F,
-                            uint64_t FSize) const;
+  LLVM_ABI void writeFragmentPadding(raw_ostream &OS,
+                                     const MCEncodedFragment &F,
+                                     uint64_t FSize) const;
 
   LLVM_ABI void reportError(SMLoc L, const Twine &Msg) const;
   // Record pending errors during layout iteration, as they may go away once the
diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index 763582a93f259..76a750db3fa17 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -376,11 +376,12 @@ class MCContext {
 
 public:
   LLVM_ABI explicit MCContext(const Triple &TheTriple, const MCAsmInfo *MAI,
-                     const MCRegisterInfo *MRI, const MCSubtargetInfo *MSTI,
-                     const SourceMgr *Mgr = nullptr,
-                     MCTargetOptions const *TargetOpts = nullptr,
-                     bool DoAutoReset = true,
-                     StringRef Swift5ReflSegmentName = {});
+                              const MCRegisterInfo *MRI,
+                              const MCSubtargetInfo *MSTI,
+                              const SourceMgr *Mgr = nullptr,
+                              MCTargetOptions const *TargetOpts = nullptr,
+                              bool DoAutoReset = true,
+                              StringRef Swift5ReflSegmentName = {});
   MCContext(const MCContext &) = delete;
   MCContext &operator=(const MCContext &) = delete;
   LLVM_ABI ~MCContext();
@@ -448,7 +449,8 @@ class MCContext {
   /// in the symbol table if UseNamesOnTempLabels is false (default except
   /// MCAsmStreamer). The overload without Name uses an unspecified name.
   LLVM_ABI MCSymbol *createTempSymbol();
-  LLVM_ABI MCSymbol *createTempSymbol(const Twine &Name, bool AlwaysAddSuffix = true);
+  LLVM_ABI MCSymbol *createTempSymbol(const Twine &Name,
+                                      bool AlwaysAddSuffix = true);
 
   /// Create a temporary symbol with a unique name whose name cannot be
   /// omitted in the symbol table. This is rarely used.
@@ -459,7 +461,8 @@ class MCContext {
   /// this behaves like createTempSymbol, except that it uses the
   /// PrivateLabelPrefix instead of the PrivateGlobalPrefix. When AlwaysEmit is
   /// true, behaves like getOrCreateSymbol, prefixed with PrivateLabelPrefix.
-  LLVM_ABI MCSymbol *createBlockSymbol(const Twine &Name, bool AlwaysEmit = false);
+  LLVM_ABI MCSymbol *createBlockSymbol(const Twine &Name,
+                                       bool AlwaysEmit = false);
 
   /// Create a local, non-temporary symbol like an ELF mapping symbol. Calling
   /// the function with the same name will generate new, unique instances.
@@ -471,7 +474,8 @@ class MCContext {
 
   /// Create and return a directional local symbol for numbered label (used
   /// for "1b" or 1f" references).
-  LLVM_ABI MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before);
+  LLVM_ABI MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal,
+                                               bool Before);
 
   /// Lookup the symbol inside with the specified \p Name.  If it exists,
   /// return it.  If not, create a forward reference and return it.
@@ -483,7 +487,8 @@ class MCContext {
   /// variable after codegen.
   ///
   /// \param Idx - The index of a local variable passed to \@llvm.localescape.
-  LLVM_ABI MCSymbol *getOrCreateFrameAllocSymbol(const Twine &FuncName, unsigned Idx);
+  LLVM_ABI MCSymbol *getOrCreateFrameAllocSymbol(const Twine &FuncName,
+                                                 unsigned Idx);
 
   LLVM_ABI MCSymbol *getOrCreateParentFrameOffsetSymbol(const Twine &FuncName);
 
@@ -498,7 +503,8 @@ class MCContext {
   LLVM_ABI MCSymbol *cloneSymbol(MCSymbol &Sym);
 
   /// Set value for a symbol.
-  LLVM_ABI void setSymbolValue(MCStreamer &Streamer, const Twine &Sym, uint64_t Val);
+  LLVM_ABI void setSymbolValue(MCStreamer &Streamer, const Twine &Sym,
+                               uint64_t Val);
 
   /// getSymbols - Get a reference for the symbol table for clients that
   /// want to, for example, iterate over all symbols. 'const' because we
@@ -528,9 +534,9 @@ class MCContext {
   /// Return the MCSection for the specified mach-o section.  This requires
   /// the operands to be valid.
   LLVM_ABI MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
-                                  unsigned TypeAndAttributes,
-                                  unsigned Reserved2, SectionKind K,
-                                  const char *BeginSymName = nullptr);
+                                           unsigned TypeAndAttributes,
+                                           unsigned Reserved2, SectionKind K,
+                                           const char *BeginSymName = nullptr);
 
   MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
                                   unsigned TypeAndAttributes, SectionKind K,
@@ -558,34 +564,37 @@ class MCContext {
   }
 
   LLVM_ABI MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
-                              unsigned Flags, unsigned EntrySize,
-                              const Twine &Group, bool IsComdat,
-                              unsigned UniqueID,
-                              const MCSymbolELF *LinkedToSym);
+                                       unsigned Flags, unsigned EntrySize,
+                                       const Twine &Group, bool IsComdat,
+                                       unsigned UniqueID,
+                                       const MCSymbolELF *LinkedToSym);
 
   LLVM_ABI MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
-                              unsigned Flags, unsigned EntrySize,
-                              const MCSymbolELF *Group, bool IsComdat,
-                              unsigned UniqueID,
-                              const MCSymbolELF *LinkedToSym);
+                                       unsigned Flags, unsigned EntrySize,
+                                       const MCSymbolELF *Group, bool IsComdat,
+                                       unsigned UniqueID,
+                                       const MCSymbolELF *LinkedToSym);
 
   /// Get a section with the provided group identifier. This section is
   /// named by concatenating \p Prefix with '.' then \p Suffix. The \p Type
   /// describes the type of the section and \p Flags are used to further
   /// configure this named section.
-  LLVM_ABI MCSectionELF *getELFNamedSection(const Twine &Prefix, const Twine &Suffix,
-                                   unsigned Type, unsigned Flags,
-                                   unsigned EntrySize = 0);
+  LLVM_ABI MCSectionELF *getELFNamedSection(const Twine &Prefix,
+                                            const Twine &Suffix, unsigned Type,
+                                            unsigned Flags,
+                                            unsigned EntrySize = 0);
 
-  LLVM_ABI MCSectionELF *createELFRelSection(const Twine &Name, unsigned Type,
-                                    unsigned Flags, unsigned EntrySize,
-                                    const MCSymbolELF *Group,
-                                    const MCSectionELF *RelInfoSection);
+  LLVM_ABI MCSectionELF *
+  createELFRelSection(const Twine &Name, unsigned Type, unsigned Flags,
+                      unsigned EntrySize, const MCSymbolELF *Group,
+                      const MCSectionELF *RelInfoSection);
 
-  LLVM_ABI MCSectionELF *createELFGroupSection(const MCSymbolELF *Group, bool IsComdat);
+  LLVM_ABI MCSectionELF *createELFGroupSection(const MCSymbolELF *Group,
+                                               bool IsComdat);
 
-  LLVM_ABI void recordELFMergeableSectionInfo(StringRef SectionName, unsigned Flags,
-                                     unsigned UniqueID, unsigned EntrySize);
+  LLVM_ABI void recordELFMergeableSectionInfo(StringRef SectionName,
+                                              unsigned Flags, unsigned UniqueID,
+                                              unsigned EntrySize);
 
   LLVM_ABI bool isELFImplicitMergeableSectionNamePrefix(StringRef Name);
 
@@ -593,18 +602,21 @@ class MCContext {
 
   /// Return the unique ID of the section with the given name, flags and entry
   /// size, if it exists.
-  LLVM_ABI std::optional<unsigned> getELFUniqueIDForEntsize(StringRef SectionName,
-                                                   unsigned Flags,
-                                                   unsigned EntrySize);
+  LLVM_ABI std::optional<unsigned>
+  getELFUniqueIDForEntsize(StringRef SectionName, unsigned Flags,
+                           unsigned EntrySize);
 
   LLVM_ABI MCSectionGOFF *getGOFFSection(StringRef Section, SectionKind Kind,
-                                MCSection *Parent, uint32_t Subsection = 0);
+                                         MCSection *Parent,
+                                         uint32_t Subsection = 0);
 
-  LLVM_ABI MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics,
-                                StringRef COMDATSymName, int Selection,
-                                unsigned UniqueID = MCSection::NonUniqueID);
+  LLVM_ABI MCSectionCOFF *
+  getCOFFSection(StringRef Section, unsigned Characteristics,
+                 StringRef COMDATSymName, int Selection,
+                 unsigned UniqueID = MCSection::NonUniqueID);
 
-  LLVM_ABI MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics);
+  LLVM_ABI MCSectionCOFF *getCOFFSection(StringRef Section,
+                                         unsigned Characteristics);
 
   /// Gets or creates a section equivalent to Sec that is associated with the
   /// section containing KeySym. For example, to create a debug info section
@@ -622,18 +634,20 @@ class MCContext {
   }
 
   LLVM_ABI MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
-                                unsigned Flags, const Twine &Group,
-                                unsigned UniqueID);
+                                         unsigned Flags, const Twine &Group,
+                                         unsigned UniqueID);
 
   LLVM_ABI MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
-                                unsigned Flags, const MCSymbolWasm *Group,
-                                unsigned UniqueID);
+                                         unsigned Flags,
+                                         const MCSymbolWasm *Group,
+                                         unsigned UniqueID);
 
   /// Get the section for the provided Section name
-  LLVM_ABI MCSectionDXContainer *getDXContainerSection(StringRef Section, SectionKind K);
+  LLVM_ABI MCSectionDXContainer *getDXContainerSection(StringRef Section,
+                                                       SectionKind K);
 
   LLVM_ABI bool hasXCOFFSection(StringRef Section,
-                       XCOFF::CsectProperties CsectProp) const;
+                                XCOFF::CsectProperties CsectProp) const;
 
   LLVM_ABI MCSectionXCOFF *getXCOFFSection(
       StringRef Section, SectionKind K,
@@ -661,7 +675,8 @@ class MCContext {
   void setCompilationDir(StringRef S) { CompilationDir = S.str(); }
 
   /// Add an entry to the debug prefix map.
-  LLVM_ABI void addDebugPrefixMapEntry(const std::string &From, const std::string &To);
+  LLVM_ABI void addDebugPrefixMapEntry(const std::string &From,
+                                       const std::string &To);
 
   /// Remap one path in-place as per the debug prefix map.
   LLVM_ABI void remapDebugPath(SmallVectorImpl<char> &Path);
@@ -678,11 +693,10 @@ class MCContext {
   void setMainFileName(StringRef S) { MainFileName = std::string(S); }
 
   /// Creates an entry in the dwarf file and directory tables.
-  LLVM_ABI Expected<unsigned> getDwarfFile(StringRef Directory, StringRef FileName,
-                                  unsigned FileNumber,
-                                  std::optional<MD5::MD5Result> Checksum,
-                                  std::optional<StringRef> Source,
-                                  unsigned CUID);
+  LLVM_ABI Expected<unsigned>
+  getDwarfFile(StringRef Directory, StringRef FileName, unsigned FileNumber,
+               std::optional<MD5::MD5Result> Checksum,
+               std::optional<StringRef> Source, unsigned CUID);
 
   LLVM_ABI bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0);
 
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
index 4ce6edda2bed0..3a7ca1a69ab85 100644
--- a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
+++ b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_MC_MCDISASSEMBLER_MCDISASSEMBLER_H
 #define LLVM_MC_MCDISASSEMBLER_MCDISASSEMBLER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/XCOFF.h"
 #include "llvm/MC/MCDisassembler/MCSymbolizer.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <cstdint>
 #include <memory>
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCSymbolizer.h b/llvm/include/llvm/MC/MCDisassembler/MCSymbolizer.h
index 1f999dd902a8c..1e4c9f20481dd 100644
--- a/llvm/include/llvm/MC/MCDisassembler/MCSymbolizer.h
+++ b/llvm/include/llvm/MC/MCDisassembler/MCSymbolizer.h
@@ -15,9 +15,9 @@
 #ifndef LLVM_MC_MCDISASSEMBLER_MCSYMBOLIZER_H
 #define LLVM_MC_MCDISASSEMBLER_MCSYMBOLIZER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/MCDisassembler/MCRelocationInfo.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <memory>
 #include <utility>
diff --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h
index d924c65948da2..9944a9a92ab1f 100644
--- a/llvm/include/llvm/MC/MCDwarf.h
+++ b/llvm/include/llvm/MC/MCDwarf.h
@@ -14,12 +14,12 @@
 #ifndef LLVM_MC_MCDWARF_H
 #define LLVM_MC_MCDWARF_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/StringTableBuilder.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/SMLoc.h"
@@ -290,10 +290,12 @@ struct MCDwarfLineTableHeader {
 public:
   MCDwarfLineTableHeader() = default;
 
-  LLVM_ABI Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
-                                std::optional<MD5::MD5Result> Checksum,
-                                std::optional<StringRef> Source,
-                                uint16_t DwarfVersion, unsigned FileNumber = 0);
+  LLVM_ABI Expected<unsigned> tryGetFile(StringRef &Directory,
+                                         StringRef &FileName,
+                                         std::optional<MD5::MD5Result> Checksum,
+                                         std::optional<StringRef> Source,
+                                         uint16_t DwarfVersion,
+                                         unsigned FileNumber = 0);
   LLVM_ABI std::pair<MCSymbol *, MCSymbol *>
   Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
        std::optional<MCDwarfLineStr> &LineStr) const;
@@ -361,7 +363,7 @@ class MCDwarfDwoLineTable {
   }
 
   LLVM_ABI void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
-            MCSection *Section) const;
+                     MCSection *Section) const;
 };
 
 class MCDwarfLineTable {
@@ -374,20 +376,23 @@ class MCDwarfLineTable {
 
   // This emits the Dwarf file and the line tables for a given Compile Unit.
   LLVM_ABI void emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
-              std::optional<MCDwarfLineStr> &LineStr) const;
+                       std::optional<MCDwarfLineStr> &LineStr) const;
 
   // This emits a single line table associated with a given Section.
   LLVM_ABI static void
   emitOne(MCStreamer *MCOS, MCSection *Section,
           const MCLineSection::MCDwarfLineEntryCollection &LineEntries);
 
-  LLVM_ABI void endCurrentSeqAndEmitLineStreamLabel(MCStreamer *MCOS, SMLoc DefLoc,
-                                           StringRef Name);
+  LLVM_ABI void endCurrentSeqAndEmitLineStreamLabel(MCStreamer *MCOS,
+                                                    SMLoc DefLoc,
+                                                    StringRef Name);
 
-  LLVM_ABI Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
-                                std::optional<MD5::MD5Result> Checksum,
-                                std::optional<StringRef> Source,
-                                uint16_t DwarfVersion, unsigned FileNumber = 0);
+  LLVM_ABI Expected<unsigned> tryGetFile(StringRef &Directory,
+                                         StringRef &FileName,
+                                         std::optional<MD5::MD5Result> Checksum,
+                                         std::optional<StringRef> Source,
+                                         uint16_t DwarfVersion,
+                                         unsigned FileNumber = 0);
   unsigned getFile(StringRef &Directory, StringRef &FileName,
                    std::optional<MD5::MD5Result> Checksum,
                    std::optional<StringRef> Source, uint16_t DwarfVersion,
@@ -454,11 +459,12 @@ class MCDwarfLineAddr {
 public:
   /// Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
   LLVM_ABI static void encode(MCContext &Context, MCDwarfLineTableParams Params,
-                     int64_t LineDelta, uint64_t AddrDelta, SmallVectorImpl<char> &OS);
+                              int64_t LineDelta, uint64_t AddrDelta,
+                              SmallVectorImpl<char> &OS);
 
   /// Utility function to emit the encoding to a streamer.
   LLVM_ABI static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
-                   int64_t LineDelta, uint64_t AddrDelta);
+                            int64_t LineDelta, uint64_t AddrDelta);
 };
 
 class MCGenDwarfInfo {
@@ -496,8 +502,8 @@ class MCGenDwarfLabelEntry {
 
   // This is called when label is created when we are generating dwarf for
   // assembly source files.
-  LLVM_ABI static void Make(MCSymbol *Symbol, MCStreamer *MCOS, SourceMgr &SrcMgr,
-                   SMLoc &Loc);
+  LLVM_ABI static void Make(MCSymbol *Symbol, MCStreamer *MCOS,
+                            SourceMgr &SrcMgr, SMLoc &Loc);
 };
 
 class MCCFIInstruction {
@@ -784,9 +790,10 @@ class MCDwarfFrameEmitter {
   //
   // This emits the frame info section.
   //
-  LLVM_ABI static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH);
+  LLVM_ABI static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB,
+                            bool isEH);
   LLVM_ABI static void encodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
-                               SmallVectorImpl<char> &OS);
+                                        SmallVectorImpl<char> &OS);
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h
index 17e1df1c17ed9..fd3bb36dcde4f 100644
--- a/llvm/include/llvm/MC/MCExpr.h
+++ b/llvm/include/llvm/MC/MCExpr.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_MC_MCEXPR_H
 #define LLVM_MC_MCEXPR_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <cstdint>
 
@@ -63,7 +63,7 @@ class MCExpr {
   }
 
   LLVM_ABI bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
-                                 bool InSet) const;
+                                          bool InSet) const;
 
   unsigned getSubclassData() const { return SubclassData; }
 
@@ -82,7 +82,7 @@ class MCExpr {
   /// @{
 
   LLVM_ABI void print(raw_ostream &OS, const MCAsmInfo *MAI,
-             int SurroundingPrec = 0) const;
+                      int SurroundingPrec = 0) const;
   LLVM_ABI void dump() const;
 
   /// Returns whether the given symbol is used anywhere in the expression or
@@ -104,7 +104,8 @@ class MCExpr {
   /// Aggressive variant of evaluateAsRelocatable when relocations are
   /// unavailable (e.g. .fill). Expects callers to handle errors when true is
   /// returned.
-  LLVM_ABI bool evaluateKnownAbsolute(int64_t &Res, const MCAssembler &Asm) const;
+  LLVM_ABI bool evaluateKnownAbsolute(int64_t &Res,
+                                      const MCAssembler &Asm) const;
 
   /// Try to evaluate the expression to a relocatable value, i.e. an
   /// expression of the fixed form (a - b + constant).
@@ -112,7 +113,8 @@ class MCExpr {
   /// \param Res - The relocatable value, if evaluation succeeds.
   /// \param Asm - The assembler object to use for evaluating values.
   /// \return - True on success.
-  LLVM_ABI bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm) const;
+  LLVM_ABI bool evaluateAsRelocatable(MCValue &Res,
+                                      const MCAssembler *Asm) const;
 
   /// Try to evaluate the expression to the form (a - b + constant) where
   /// neither a nor b are variables.
@@ -129,8 +131,9 @@ class MCExpr {
 
   /// @}
 
-  LLVM_ABI static bool evaluateSymbolicAdd(const MCAssembler *, bool, const MCValue &,
-                                  const MCValue &, MCValue &);
+  LLVM_ABI static bool evaluateSymbolicAdd(const MCAssembler *, bool,
+                                           const MCValue &, const MCValue &,
+                                           MCValue &);
 };
 
 inline raw_ostream &operator<<(raw_ostream &OS, const MCExpr &E) {
@@ -161,8 +164,8 @@ class MCConstantExpr : public MCExpr {
   /// @{
 
   LLVM_ABI static const MCConstantExpr *create(int64_t Value, MCContext &Ctx,
-                                      bool PrintInHex = false,
-                                      unsigned SizeInBytes = 0);
+                                               bool PrintInHex = false,
+                                               unsigned SizeInBytes = 0);
 
   /// @}
   /// \name Accessors
@@ -221,8 +224,10 @@ class MCSymbolRefExpr : public MCExpr {
     return MCSymbolRefExpr::create(Symbol, VK_None, Ctx, Loc);
   }
 
-  LLVM_ABI static const MCSymbolRefExpr *create(const MCSymbol *Symbol, VariantKind Kind,
-                                       MCContext &Ctx, SMLoc Loc = SMLoc());
+  LLVM_ABI static const MCSymbolRefExpr *create(const MCSymbol *Symbol,
+                                                VariantKind Kind,
+                                                MCContext &Ctx,
+                                                SMLoc Loc = SMLoc());
   static const MCSymbolRefExpr *create(const MCSymbol *Symbol, uint16_t Kind,
                                        MCContext &Ctx, SMLoc Loc = SMLoc()) {
     return MCSymbolRefExpr::create(Symbol, VariantKind(Kind), Ctx, Loc);
@@ -267,8 +272,8 @@ class MCUnaryExpr : public MCExpr {
   /// \name Construction
   /// @{
 
-  LLVM_ABI static const MCUnaryExpr *create(Opcode Op, const MCExpr *Expr,
-                                   MCContext &Ctx, SMLoc Loc = SMLoc());
+  LLVM_ABI static const MCUnaryExpr *
+  create(Opcode Op, const MCExpr *Expr, MCContext &Ctx, SMLoc Loc = SMLoc());
 
   static const MCUnaryExpr *createLNot(const MCExpr *Expr, MCContext &Ctx, SMLoc Loc = SMLoc()) {
     return create(LNot, Expr, Ctx, Loc);
@@ -345,8 +350,8 @@ class MCBinaryExpr : public MCExpr {
   /// @{
 
   LLVM_ABI static const MCBinaryExpr *create(Opcode Op, const MCExpr *LHS,
-                                    const MCExpr *RHS, MCContext &Ctx,
-                                    SMLoc Loc = SMLoc());
+                                             const MCExpr *RHS, MCContext &Ctx,
+                                             SMLoc Loc = SMLoc());
 
   static const MCBinaryExpr *createAdd(const MCExpr *LHS, const MCExpr *RHS,
                                        MCContext &Ctx) {
diff --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h
index 81476ba86e898..473dec6477df6 100644
--- a/llvm/include/llvm/MC/MCFragment.h
+++ b/llvm/include/llvm/MC/MCFragment.h
@@ -9,7 +9,6 @@
 #ifndef LLVM_MC_MCFRAGMENT_H
 #define LLVM_MC_MCFRAGMENT_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
@@ -18,6 +17,7 @@
 #include "llvm/MC/MCFixup.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/Support/Alignment.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <cstdint>
 #include <utility>
diff --git a/llvm/include/llvm/MC/MCInst.h b/llvm/include/llvm/MC/MCInst.h
index 0cd483b9f1381..581dc609b913f 100644
--- a/llvm/include/llvm/MC/MCInst.h
+++ b/llvm/include/llvm/MC/MCInst.h
@@ -15,11 +15,11 @@
 #ifndef LLVM_MC_MCINST_H
 #define LLVM_MC_MCINST_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/bit.h"
 #include "llvm/MC/MCRegister.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <cassert>
 #include <cstddef>
@@ -175,7 +175,8 @@ class MCOperand {
     return Op;
   }
 
-  LLVM_ABI void print(raw_ostream &OS, const MCRegisterInfo *RegInfo = nullptr) const;
+  LLVM_ABI void print(raw_ostream &OS,
+                      const MCRegisterInfo *RegInfo = nullptr) const;
   LLVM_ABI void dump() const;
   LLVM_ABI bool isBareSymbolRef() const;
   LLVM_ABI bool evaluateAsConstantImm(int64_t &Imm) const;
@@ -227,17 +228,20 @@ class MCInst {
     return Operands.insert(I, Op);
   }
 
-  LLVM_ABI void print(raw_ostream &OS, const MCRegisterInfo *RegInfo = nullptr) const;
+  LLVM_ABI void print(raw_ostream &OS,
+                      const MCRegisterInfo *RegInfo = nullptr) const;
   LLVM_ABI void dump() const;
 
   /// Dump the MCInst as prettily as possible using the additional MC
   /// structures, if given. Operators are separated by the \p Separator
   /// string.
-  LLVM_ABI void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer = nullptr,
-                   StringRef Separator = " ",
-                   const MCRegisterInfo *RegInfo = nullptr) const;
-  LLVM_ABI void dump_pretty(raw_ostream &OS, StringRef Name, StringRef Separator = " ",
-                   const MCRegisterInfo *RegInfo = nullptr) const;
+  LLVM_ABI void dump_pretty(raw_ostream &OS,
+                            const MCInstPrinter *Printer = nullptr,
+                            StringRef Separator = " ",
+                            const MCRegisterInfo *RegInfo = nullptr) const;
+  LLVM_ABI void dump_pretty(raw_ostream &OS, StringRef Name,
+                            StringRef Separator = " ",
+                            const MCRegisterInfo *RegInfo = nullptr) const;
 };
 
 inline raw_ostream& operator<<(raw_ostream &OS, const MCOperand &MO) {
diff --git a/llvm/include/llvm/MC/MCInstPrinter.h b/llvm/include/llvm/MC/MCInstPrinter.h
index 7495c741b899f..434c2e7623563 100644
--- a/llvm/include/llvm/MC/MCInstPrinter.h
+++ b/llvm/include/llvm/MC/MCInstPrinter.h
@@ -101,8 +101,9 @@ class LLVM_ABI MCInstPrinter {
 
   class WithMarkup {
   public:
-    LLVM_CTOR_NODISCARD LLVM_ABI WithMarkup(MCInstPrinter &IP, raw_ostream &OS, Markup M,
-                                   bool EnableMarkup, bool EnableColor);
+    LLVM_CTOR_NODISCARD LLVM_ABI WithMarkup(MCInstPrinter &IP, raw_ostream &OS,
+                                            Markup M, bool EnableMarkup,
+                                            bool EnableColor);
     LLVM_ABI ~WithMarkup();
 
     template <typename T> WithMarkup &operator<<(T &O) {
diff --git a/llvm/include/llvm/MC/MCInstrAnalysis.h b/llvm/include/llvm/MC/MCInstrAnalysis.h
index 4f4e299f31c0e..63a4e02a92360 100644
--- a/llvm/include/llvm/MC/MCInstrAnalysis.h
+++ b/llvm/include/llvm/MC/MCInstrAnalysis.h
@@ -14,12 +14,12 @@
 #ifndef LLVM_MC_MCINSTRANALYSIS_H
 #define LLVM_MC_MCINSTRANALYSIS_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCInstrDesc.h"
 #include "llvm/MC/MCInstrInfo.h"
 #include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdint>
 #include <vector>
 
diff --git a/llvm/include/llvm/MC/MCInstrDesc.h b/llvm/include/llvm/MC/MCInstrDesc.h
index 5ababf9bc14f4..8c70925d4780e 100644
--- a/llvm/include/llvm/MC/MCInstrDesc.h
+++ b/llvm/include/llvm/MC/MCInstrDesc.h
@@ -14,10 +14,10 @@
 #ifndef LLVM_MC_MCINSTRDESC_H
 #define LLVM_MC_MCINSTRDESC_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/MC/MCRegister.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 class MCRegisterInfo;
@@ -330,7 +330,8 @@ class MCInstrDesc {
   /// Return true if this is a branch or an instruction which directly
   /// writes to the program counter. Considered 'may' affect rather than
   /// 'does' affect as things like predication are not taken into account.
-  LLVM_ABI bool mayAffectControlFlow(const MCInst &MI, const MCRegisterInfo &RI) const;
+  LLVM_ABI bool mayAffectControlFlow(const MCInst &MI,
+                                     const MCRegisterInfo &RI) const;
 
   /// Return true if this instruction has a predicate operand
   /// that controls execution. It may be set to 'always', or may be set to other
@@ -591,8 +592,9 @@ class MCInstrDesc {
 
   /// Return true if this instruction implicitly
   /// defines the specified physical register.
-  LLVM_ABI bool hasImplicitDefOfPhysReg(MCRegister Reg,
-                               const MCRegisterInfo *MRI = nullptr) const;
+  LLVM_ABI bool
+  hasImplicitDefOfPhysReg(MCRegister Reg,
+                          const MCRegisterInfo *MRI = nullptr) const;
 
   /// Return the scheduling class for this instruction.  The
   /// scheduling class is an index into the InstrItineraryData table.  This
@@ -619,7 +621,7 @@ class MCInstrDesc {
   /// Return true if this instruction defines the specified physical
   /// register, either explicitly or implicitly.
   LLVM_ABI bool hasDefOfPhysReg(const MCInst &MI, MCRegister Reg,
-                       const MCRegisterInfo &RI) const;
+                                const MCRegisterInfo &RI) const;
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/MC/MCInstrInfo.h b/llvm/include/llvm/MC/MCInstrInfo.h
index 040f63ef6de40..77ead222b9549 100644
--- a/llvm/include/llvm/MC/MCInstrInfo.h
+++ b/llvm/include/llvm/MC/MCInstrInfo.h
@@ -13,9 +13,9 @@
 #ifndef LLVM_MC_MCINSTRINFO_H
 #define LLVM_MC_MCINSTRINFO_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCInstrDesc.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 
 namespace llvm {
@@ -76,7 +76,7 @@ class MCInstrInfo {
   /// Returns true if a certain instruction is deprecated and if so
   /// returns the reason in \p Info.
   LLVM_ABI bool getDeprecatedInfo(MCInst &MI, const MCSubtargetInfo &STI,
-                         std::string &Info) const;
+                                  std::string &Info) const;
 };
 
 } // End llvm namespace
diff --git a/llvm/include/llvm/MC/MCLinkerOptimizationHint.h b/llvm/include/llvm/MC/MCLinkerOptimizationHint.h
index 99790fde12266..d9dad791d6a2a 100644
--- a/llvm/include/llvm/MC/MCLinkerOptimizationHint.h
+++ b/llvm/include/llvm/MC/MCLinkerOptimizationHint.h
@@ -16,10 +16,10 @@
 #ifndef LLVM_MC_MCLINKEROPTIMIZATIONHINT_H
 #define LLVM_MC_MCLINKEROPTIMIZATIONHINT_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <cstdint>
 
@@ -131,7 +131,7 @@ class MCLOHDirective {
   /// Get the size in bytes of this directive if emitted in \p ObjWriter with
   /// the given \p Layout.
   LLVM_ABI uint64_t getEmitSize(const MCAssembler &Asm,
-                       const MachObjectWriter &ObjWriter) const;
+                                const MachObjectWriter &ObjWriter) const;
 };
 
 class MCLOHContainer {
diff --git a/llvm/include/llvm/MC/MCMachObjectWriter.h b/llvm/include/llvm/MC/MCMachObjectWriter.h
index 58156ea897237..a6ccdf06eb91d 100644
--- a/llvm/include/llvm/MC/MCMachObjectWriter.h
+++ b/llvm/include/llvm/MC/MCMachObjectWriter.h
@@ -9,7 +9,6 @@
 #ifndef LLVM_MC_MCMACHOBJECTWRITER_H
 #define LLVM_MC_MCMACHOBJECTWRITER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/MachO.h"
@@ -19,6 +18,7 @@
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/StringTableBuilder.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/EndianStream.h"
 #include "llvm/Support/VersionTuple.h"
 #include <cstdint>
diff --git a/llvm/include/llvm/MC/MCObjectFileInfo.h b/llvm/include/llvm/MC/MCObjectFileInfo.h
index a44bd98542b37..20c819bdfd961 100644
--- a/llvm/include/llvm/MC/MCObjectFileInfo.h
+++ b/llvm/include/llvm/MC/MCObjectFileInfo.h
@@ -13,9 +13,9 @@
 #ifndef LLVM_MC_MCOBJECTFILEINFO_H
 #define LLVM_MC_MCOBJECTFILEINFO_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/BinaryFormat/Swift.h"
 #include "llvm/MC/MCSection.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/VersionTuple.h"
 #include "llvm/TargetParser/Triple.h"
 
diff --git a/llvm/include/llvm/MC/MCObjectWriter.h b/llvm/include/llvm/MC/MCObjectWriter.h
index ea972ec9d79a4..54a8f8236f6e4 100644
--- a/llvm/include/llvm/MC/MCObjectWriter.h
+++ b/llvm/include/llvm/MC/MCObjectWriter.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_MC_MCOBJECTWRITER_H
 #define LLVM_MC_MCOBJECTWRITER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/MC/MCSymbol.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/TargetParser/Triple.h"
 #include <cstdint>
 
diff --git a/llvm/include/llvm/MC/MCParser/AsmLexer.h b/llvm/include/llvm/MC/MCParser/AsmLexer.h
index 1f824d8059b90..11d32fbb64702 100644
--- a/llvm/include/llvm/MC/MCParser/AsmLexer.h
+++ b/llvm/include/llvm/MC/MCParser/AsmLexer.h
@@ -13,11 +13,11 @@
 #ifndef LLVM_MC_MCPARSER_ASMLEXER_H
 #define LLVM_MC_MCPARSER_ASMLEXER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCAsmMacro.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <cstddef>
 #include <string>
@@ -131,7 +131,8 @@ class AsmLexer {
   }
 
   /// Look ahead an arbitrary number of tokens.
-  LLVM_ABI size_t peekTokens(MutableArrayRef<AsmToken> Buf, bool ShouldSkipSpace = true);
+  LLVM_ABI size_t peekTokens(MutableArrayRef<AsmToken> Buf,
+                             bool ShouldSkipSpace = true);
 
   /// Get the current error location
   SMLoc getErrLoc() { return ErrLoc; }
@@ -191,7 +192,7 @@ class AsmLexer {
   void setLexHLASMStrings(bool V) { LexHLASMStrings = V; }
 
   LLVM_ABI void setBuffer(StringRef Buf, const char *ptr = nullptr,
-                 bool EndStatementAtEOF = true);
+                          bool EndStatementAtEOF = true);
 
   const MCAsmInfo &getMAI() const { return MAI; }
 
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParser.h b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
index 8db256de77d29..cb9bd5c600d52 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParser.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
@@ -9,7 +9,6 @@
 #ifndef LLVM_MC_MCPARSER_MCASMPARSER_H
 #define LLVM_MC_MCPARSER_MCASMPARSER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
@@ -18,6 +17,7 @@
 #include "llvm/MC/MCAsmMacro.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCParser/AsmLexer.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <cstdint>
 #include <string>
@@ -340,11 +340,12 @@ class LLVM_ABI MCAsmParser {
 
 /// Create an MCAsmParser instance for parsing assembly similar to gas syntax
 LLVM_ABI MCAsmParser *createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &,
-                               const MCAsmInfo &, unsigned CB = 0);
+                                        const MCAsmInfo &, unsigned CB = 0);
 
 /// Create an MCAsmParser instance for parsing Microsoft MASM-style assembly
 LLVM_ABI MCAsmParser *createMCMasmParser(SourceMgr &, MCContext &, MCStreamer &,
-                                const MCAsmInfo &, struct tm, unsigned CB = 0);
+                                         const MCAsmInfo &, struct tm,
+                                         unsigned CB = 0);
 
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h b/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
index e5f9445d51ad8..f8387d888fc21 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H
 #define LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCParser/MCAsmParser.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h b/llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h
index 32d1e4e0098a3..fd52fbac5199b 100644
--- a/llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h
+++ b/llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
 #define LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <string>
 
diff --git a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h
index 1b83d3a6622a1..7628987b9587d 100644
--- a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h
+++ b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h
@@ -9,13 +9,13 @@
 #ifndef LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
 #define LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCParser/MCAsmParserExtension.h"
 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
 #include "llvm/MC/MCRegister.h"
 #include "llvm/MC/MCTargetOptions.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include "llvm/TargetParser/SubtargetFeature.h"
 #include <cstdint>
diff --git a/llvm/include/llvm/MC/MCPseudoProbe.h b/llvm/include/llvm/MC/MCPseudoProbe.h
index da7a7021512be..ac28e45891df2 100644
--- a/llvm/include/llvm/MC/MCPseudoProbe.h
+++ b/llvm/include/llvm/MC/MCPseudoProbe.h
@@ -54,7 +54,6 @@
 #ifndef LLVM_MC_MCPSEUDOPROBE_H
 #define LLVM_MC_MCPSEUDOPROBE_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
@@ -63,6 +62,7 @@
 #include "llvm/ADT/iterator.h"
 #include "llvm/IR/PseudoProbe.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorOr.h"
 #include <functional>
 #include <memory>
@@ -179,7 +179,8 @@ class MCPseudoProbe : public MCPseudoProbeBase {
 
   uint64_t getGuid() const { return Guid; };
   MCSymbol *getLabel() const { return Label; }
-  LLVM_ABI void emit(MCObjectStreamer *MCOS, const MCPseudoProbe *LastProbe) const;
+  LLVM_ABI void emit(MCObjectStreamer *MCOS,
+                     const MCPseudoProbe *LastProbe) const;
 };
 
 // Represents a callsite with caller function name and probe id
@@ -217,7 +218,7 @@ class MCDecodedPseudoProbe : public MCPseudoProbeBase {
 
   // Print pseudo probe while disassembling
   LLVM_ABI void print(raw_ostream &OS, const GUIDProbeFunctionMap &GUID2FuncMAP,
-             bool ShowName) const;
+                      bool ShowName) const;
 };
 
 // Address to pseudo probes map.
@@ -304,7 +305,7 @@ class MCPseudoProbeInlineTree
 
   // MCPseudoProbeInlineTree method based on Inlinees
   LLVM_ABI void addPseudoProbe(const MCPseudoProbe &Probe,
-                      const MCPseudoProbeInlineStack &InlineStack);
+                               const MCPseudoProbeInlineStack &InlineStack);
   LLVM_ABI void emit(MCObjectStreamer *MCOS, const MCPseudoProbe *&LastProbe);
 };
 
@@ -435,7 +436,7 @@ class MCPseudoProbeDecoder {
   // If pseudo_probe_desc section is mapped to memory and \p IsMMapped is true,
   // uses StringRefs pointing to the section.
   LLVM_ABI bool buildGUID2FuncDescMap(const uint8_t *Start, std::size_t Size,
-                             bool IsMMapped = false);
+                                      bool IsMMapped = false);
 
   // Decode pseudo_probe section to count the number of probes and inlined
   // function records for each function record.
@@ -446,8 +447,8 @@ class MCPseudoProbeDecoder {
   // Decode pseudo_probe section to build address to probes map for specifed
   // functions only.
   LLVM_ABI bool buildAddress2ProbeMap(const uint8_t *Start, std::size_t Size,
-                             const Uint64Set &GuildFilter,
-                             const Uint64Map &FuncStartAddrs);
+                                      const Uint64Set &GuildFilter,
+                                      const Uint64Map &FuncStartAddrs);
 
   // Print pseudo_probe_desc section info
   LLVM_ABI void printGUID2FuncDescMap(raw_ostream &OS);
@@ -459,7 +460,8 @@ class MCPseudoProbeDecoder {
   LLVM_ABI void printProbesForAllAddresses(raw_ostream &OS);
 
   // Look up the probe of a call for the input address
-  LLVM_ABI const MCDecodedPseudoProbe *getCallProbeForAddr(uint64_t Address) const;
+  LLVM_ABI const MCDecodedPseudoProbe *
+  getCallProbeForAddr(uint64_t Address) const;
 
   LLVM_ABI const MCPseudoProbeFuncDesc *getFuncDescForGUID(uint64_t GUID) const;
 
diff --git a/llvm/include/llvm/MC/MCRegisterInfo.h b/llvm/include/llvm/MC/MCRegisterInfo.h
index c0947e81a23a2..aad3792f88784 100644
--- a/llvm/include/llvm/MC/MCRegisterInfo.h
+++ b/llvm/include/llvm/MC/MCRegisterInfo.h
@@ -15,12 +15,12 @@
 #ifndef LLVM_MC_MCREGISTERINFO_H
 #define LLVM_MC_MCREGISTERINFO_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/iterator.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/MC/LaneBitmask.h"
 #include "llvm/MC/MCRegister.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <cstdint>
 #include <iterator>
diff --git a/llvm/include/llvm/MC/MCSchedule.h b/llvm/include/llvm/MC/MCSchedule.h
index 40a19f312a422..eb71f4581bd61 100644
--- a/llvm/include/llvm/MC/MCSchedule.h
+++ b/llvm/include/llvm/MC/MCSchedule.h
@@ -14,9 +14,9 @@
 #ifndef LLVM_MC_MCSCHEDULE_H
 #define LLVM_MC_MCSCHEDULE_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCInstrDesc.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <cassert>
 #include <optional>
@@ -370,12 +370,14 @@ struct MCSchedModel {
 
   /// Returns the latency value for the scheduling class.
   LLVM_ABI static int computeInstrLatency(const MCSubtargetInfo &STI,
-                                 const MCSchedClassDesc &SCDesc);
+                                          const MCSchedClassDesc &SCDesc);
 
-  LLVM_ABI int computeInstrLatency(const MCSubtargetInfo &STI, unsigned SClass) const;
+  LLVM_ABI int computeInstrLatency(const MCSubtargetInfo &STI,
+                                   unsigned SClass) const;
 
-  LLVM_ABI int computeInstrLatency(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
-                          const MCInst &Inst) const;
+  LLVM_ABI int computeInstrLatency(const MCSubtargetInfo &STI,
+                                   const MCInstrInfo &MCII,
+                                   const MCInst &Inst) const;
 
   template <typename MCSubtargetInfo, typename MCInstrInfo,
             typename InstrItineraryData, typename MCInstOrMachineInstr>
@@ -391,21 +393,22 @@ struct MCSchedModel {
   getReciprocalThroughput(const MCSubtargetInfo &STI,
                           const MCSchedClassDesc &SCDesc);
 
-  LLVM_ABI static double
-  getReciprocalThroughput(unsigned SchedClass, const InstrItineraryData &IID);
+  LLVM_ABI static double getReciprocalThroughput(unsigned SchedClass,
+                                                 const InstrItineraryData &IID);
 
-  LLVM_ABI double
-  getReciprocalThroughput(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
-                          const MCInst &Inst) const;
+  LLVM_ABI double getReciprocalThroughput(const MCSubtargetInfo &STI,
+                                          const MCInstrInfo &MCII,
+                                          const MCInst &Inst) const;
 
   /// Returns the maximum forwarding delay for register reads dependent on
   /// writes of scheduling class WriteResourceIdx.
-  LLVM_ABI static unsigned getForwardingDelayCycles(ArrayRef<MCReadAdvanceEntry> Entries,
-                                           unsigned WriteResourceIdx = 0);
+  LLVM_ABI static unsigned
+  getForwardingDelayCycles(ArrayRef<MCReadAdvanceEntry> Entries,
+                           unsigned WriteResourceIdx = 0);
 
   /// Returns the bypass delay cycle for the maximum latency write cycle
   LLVM_ABI static unsigned getBypassDelayCycles(const MCSubtargetInfo &STI,
-                                       const MCSchedClassDesc &SCDesc);
+                                                const MCSchedClassDesc &SCDesc);
 
   /// Returns the default initialized model.
   LLVM_ABI static const MCSchedModel Default;
diff --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h
index 728270c9d4691..7a94a7d65613d 100644
--- a/llvm/include/llvm/MC/MCSection.h
+++ b/llvm/include/llvm/MC/MCSection.h
@@ -13,11 +13,11 @@
 #ifndef LLVM_MC_MCSECTION_H
 #define LLVM_MC_MCSECTION_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCFragment.h"
 #include "llvm/MC/SectionKind.h"
 #include "llvm/Support/Alignment.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <utility>
 
diff --git a/llvm/include/llvm/MC/MCSectionMachO.h b/llvm/include/llvm/MC/MCSectionMachO.h
index ab4013f211ba2..4312175fd16df 100644
--- a/llvm/include/llvm/MC/MCSectionMachO.h
+++ b/llvm/include/llvm/MC/MCSectionMachO.h
@@ -13,10 +13,10 @@
 #ifndef LLVM_MC_MCSECTIONMACHO_H
 #define LLVM_MC_MCSECTIONMACHO_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/MachO.h"
 #include "llvm/MC/MCSection.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index fd74abff6c6f3..8f2e137ea0c84 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_MC_MCSTREAMER_H
 #define LLVM_MC_MCSTREAMER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
@@ -24,6 +23,7 @@
 #include "llvm/MC/MCLinkerOptimizationHint.h"
 #include "llvm/MC/MCPseudoProbe.h"
 #include "llvm/MC/MCWinEH.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/SMLoc.h"
diff --git a/llvm/include/llvm/MC/MCSubtargetInfo.h b/llvm/include/llvm/MC/MCSubtargetInfo.h
index 8cf83d3a3222c..44b4cb8fa17bd 100644
--- a/llvm/include/llvm/MC/MCSubtargetInfo.h
+++ b/llvm/include/llvm/MC/MCSubtargetInfo.h
@@ -13,12 +13,12 @@
 #ifndef LLVM_MC_MCSUBTARGETINFO_H
 #define LLVM_MC_MCSUBTARGETINFO_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCInstrItineraries.h"
 #include "llvm/MC/MCSchedule.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/TargetParser/SubtargetFeature.h"
 #include "llvm/TargetParser/Triple.h"
 #include <cassert>
diff --git a/llvm/include/llvm/MC/MCSymbol.h b/llvm/include/llvm/MC/MCSymbol.h
index 30ce68c1ab4e5..b02bc111955ab 100644
--- a/llvm/include/llvm/MC/MCSymbol.h
+++ b/llvm/include/llvm/MC/MCSymbol.h
@@ -13,12 +13,12 @@
 #ifndef LLVM_MC_MCSYMBOL_H
 #define LLVM_MC_MCSYMBOL_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/StringMapEntry.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCFragment.h"
 #include "llvm/MC/MCSymbolTableEntry.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
 #include <cassert>
@@ -178,7 +178,8 @@ class MCSymbol {
 
   // Provide custom new/delete as we will only allocate space for a name
   // if we need one.
-  LLVM_ABI void *operator new(size_t s, const MCSymbolTableEntry *Name, MCContext &Ctx);
+  LLVM_ABI void *operator new(size_t s, const MCSymbolTableEntry *Name,
+                              MCContext &Ctx);
 
 private:
   void operator delete(void *);
diff --git a/llvm/include/llvm/MC/MCTargetOptions.h b/llvm/include/llvm/MC/MCTargetOptions.h
index c930eca886cbb..3ee21d9cda4b7 100644
--- a/llvm/include/llvm/MC/MCTargetOptions.h
+++ b/llvm/include/llvm/MC/MCTargetOptions.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_MC_MCTARGETOPTIONS_H
 #define LLVM_MC_MCTARGETOPTIONS_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Compression.h"
 #include <string>
 #include <vector>
diff --git a/llvm/include/llvm/MC/MCWinEH.h b/llvm/include/llvm/MC/MCWinEH.h
index 1f95df2b9d68b..1bbfb9f59bc4c 100644
--- a/llvm/include/llvm/MC/MCWinEH.h
+++ b/llvm/include/llvm/MC/MCWinEH.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_MC_MCWINEH_H
 #define LLVM_MC_MCWINEH_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/MapVector.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <vector>
 
diff --git a/llvm/include/llvm/MC/StringTableBuilder.h b/llvm/include/llvm/MC/StringTableBuilder.h
index 744d8df3652cd..83d55ef8512fe 100644
--- a/llvm/include/llvm/MC/StringTableBuilder.h
+++ b/llvm/include/llvm/MC/StringTableBuilder.h
@@ -9,11 +9,11 @@
 #ifndef LLVM_MC_STRINGTABLEBUILDER_H
 #define LLVM_MC_STRINGTABLEBUILDER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/CachedHashString.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Alignment.h"
+#include "llvm/Support/Compiler.h"
 #include <cstddef>
 #include <cstdint>
 
diff --git a/llvm/include/llvm/MC/TargetRegistry.h b/llvm/include/llvm/MC/TargetRegistry.h
index 58ad35389606d..efff08d7f8ea5 100644
--- a/llvm/include/llvm/MC/TargetRegistry.h
+++ b/llvm/include/llvm/MC/TargetRegistry.h
@@ -84,55 +84,56 @@ LLVM_ABI MCStreamer *createNullStreamer(MCContext &Ctx);
 ///
 /// \param ShowInst - Whether to show the MCInst representation inline with
 /// the assembly.
-LLVM_ABI MCStreamer *createAsmStreamer(MCContext &Ctx,
-                              std::unique_ptr<formatted_raw_ostream> OS,
-                              std::unique_ptr<MCInstPrinter> InstPrint,
-                              std::unique_ptr<MCCodeEmitter> CE,
-                              std::unique_ptr<MCAsmBackend> TAB);
+LLVM_ABI MCStreamer *
+createAsmStreamer(MCContext &Ctx, std::unique_ptr<formatted_raw_ostream> OS,
+                  std::unique_ptr<MCInstPrinter> InstPrint,
+                  std::unique_ptr<MCCodeEmitter> CE,
+                  std::unique_ptr<MCAsmBackend> TAB);
 
 LLVM_ABI MCStreamer *createELFStreamer(MCContext &Ctx,
-                              std::unique_ptr<MCAsmBackend> &&TAB,
-                              std::unique_ptr<MCObjectWriter> &&OW,
-                              std::unique_ptr<MCCodeEmitter> &&CE);
+                                       std::unique_ptr<MCAsmBackend> &&TAB,
+                                       std::unique_ptr<MCObjectWriter> &&OW,
+                                       std::unique_ptr<MCCodeEmitter> &&CE);
 LLVM_ABI MCStreamer *createGOFFStreamer(MCContext &Ctx,
-                               std::unique_ptr<MCAsmBackend> &&TAB,
-                               std::unique_ptr<MCObjectWriter> &&OW,
-                               std::unique_ptr<MCCodeEmitter> &&CE);
+                                        std::unique_ptr<MCAsmBackend> &&TAB,
+                                        std::unique_ptr<MCObjectWriter> &&OW,
+                                        std::unique_ptr<MCCodeEmitter> &&CE);
 LLVM_ABI MCStreamer *createMachOStreamer(MCContext &Ctx,
-                                std::unique_ptr<MCAsmBackend> &&TAB,
-                                std::unique_ptr<MCObjectWriter> &&OW,
-                                std::unique_ptr<MCCodeEmitter> &&CE,
-                                bool DWARFMustBeAtTheEnd,
-                                bool LabelSections = false);
+                                         std::unique_ptr<MCAsmBackend> &&TAB,
+                                         std::unique_ptr<MCObjectWriter> &&OW,
+                                         std::unique_ptr<MCCodeEmitter> &&CE,
+                                         bool DWARFMustBeAtTheEnd,
+                                         bool LabelSections = false);
 LLVM_ABI MCStreamer *createWasmStreamer(MCContext &Ctx,
-                               std::unique_ptr<MCAsmBackend> &&TAB,
-                               std::unique_ptr<MCObjectWriter> &&OW,
-                               std::unique_ptr<MCCodeEmitter> &&CE);
+                                        std::unique_ptr<MCAsmBackend> &&TAB,
+                                        std::unique_ptr<MCObjectWriter> &&OW,
+                                        std::unique_ptr<MCCodeEmitter> &&CE);
 LLVM_ABI MCStreamer *createSPIRVStreamer(MCContext &Ctx,
-                                std::unique_ptr<MCAsmBackend> &&TAB,
-                                std::unique_ptr<MCObjectWriter> &&OW,
-                                std::unique_ptr<MCCodeEmitter> &&CE);
-LLVM_ABI MCStreamer *createDXContainerStreamer(MCContext &Ctx,
-                                      std::unique_ptr<MCAsmBackend> &&TAB,
-                                      std::unique_ptr<MCObjectWriter> &&OW,
-                                      std::unique_ptr<MCCodeEmitter> &&CE);
+                                         std::unique_ptr<MCAsmBackend> &&TAB,
+                                         std::unique_ptr<MCObjectWriter> &&OW,
+                                         std::unique_ptr<MCCodeEmitter> &&CE);
+LLVM_ABI MCStreamer *
+createDXContainerStreamer(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
+                          std::unique_ptr<MCObjectWriter> &&OW,
+                          std::unique_ptr<MCCodeEmitter> &&CE);
 
-LLVM_ABI MCRelocationInfo *createMCRelocationInfo(const Triple &TT, MCContext &Ctx);
+LLVM_ABI MCRelocationInfo *createMCRelocationInfo(const Triple &TT,
+                                                  MCContext &Ctx);
 
-LLVM_ABI MCSymbolizer *createMCSymbolizer(const Triple &TT, LLVMOpInfoCallback GetOpInfo,
-                                 LLVMSymbolLookupCallback SymbolLookUp,
-                                 void *DisInfo, MCContext *Ctx,
-                                 std::unique_ptr<MCRelocationInfo> &&RelInfo);
+LLVM_ABI MCSymbolizer *
+createMCSymbolizer(const Triple &TT, LLVMOpInfoCallback GetOpInfo,
+                   LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo,
+                   MCContext *Ctx, std::unique_ptr<MCRelocationInfo> &&RelInfo);
 
-LLVM_ABI mca::CustomBehaviour *createCustomBehaviour(const MCSubtargetInfo &STI,
-                                            const mca::SourceMgr &SrcMgr,
-                                            const MCInstrInfo &MCII);
+LLVM_ABI mca::CustomBehaviour *
+createCustomBehaviour(const MCSubtargetInfo &STI, const mca::SourceMgr &SrcMgr,
+                      const MCInstrInfo &MCII);
 
-LLVM_ABI mca::InstrPostProcess *createInstrPostProcess(const MCSubtargetInfo &STI,
-                                              const MCInstrInfo &MCII);
+LLVM_ABI mca::InstrPostProcess *
+createInstrPostProcess(const MCSubtargetInfo &STI, const MCInstrInfo &MCII);
 
-LLVM_ABI mca::InstrumentManager *createInstrumentManager(const MCSubtargetInfo &STI,
-                                                const MCInstrInfo &MCII);
+LLVM_ABI mca::InstrumentManager *
+createInstrumentManager(const MCSubtargetInfo &STI, const MCInstrInfo &MCII);
 
 /// Target - Wrapper for Target specific information.
 ///
@@ -545,17 +546,16 @@ class Target {
   /// \param TAB The target assembler backend object. Takes ownership.
   /// \param OW The stream object.
   /// \param Emitter The target independent assembler object.Takes ownership.
-  LLVM_ABI MCStreamer *createMCObjectStreamer(const Triple &T, MCContext &Ctx,
-                                     std::unique_ptr<MCAsmBackend> TAB,
-                                     std::unique_ptr<MCObjectWriter> OW,
-                                     std::unique_ptr<MCCodeEmitter> Emitter,
-                                     const MCSubtargetInfo &STI) const;
-
-  LLVM_ABI MCStreamer *createAsmStreamer(MCContext &Ctx,
-                                std::unique_ptr<formatted_raw_ostream> OS,
-                                std::unique_ptr<MCInstPrinter> IP,
-                                std::unique_ptr<MCCodeEmitter> CE,
-                                std::unique_ptr<MCAsmBackend> TAB) const;
+  LLVM_ABI MCStreamer *createMCObjectStreamer(
+      const Triple &T, MCContext &Ctx, std::unique_ptr<MCAsmBackend> TAB,
+      std::unique_ptr<MCObjectWriter> OW,
+      std::unique_ptr<MCCodeEmitter> Emitter, const MCSubtargetInfo &STI) const;
+
+  LLVM_ABI MCStreamer *
+  createAsmStreamer(MCContext &Ctx, std::unique_ptr<formatted_raw_ostream> OS,
+                    std::unique_ptr<MCInstPrinter> IP,
+                    std::unique_ptr<MCCodeEmitter> CE,
+                    std::unique_ptr<MCAsmBackend> TAB) const;
 
   MCTargetStreamer *createAsmTargetStreamer(MCStreamer &S,
                                             formatted_raw_ostream &OS,
@@ -716,7 +716,7 @@ struct TargetRegistry {
   /// \param Error - On failure, an error string describing why no target was
   /// found.
   LLVM_ABI static const Target *lookupTarget(const Triple &TheTriple,
-                                    std::string &Error);
+                                             std::string &Error);
 
   /// lookupTarget - Lookup a target based on an architecture name
   /// and a target triple.  If the architecture name is non-empty,
@@ -729,8 +729,8 @@ struct TargetRegistry {
   /// by architecture is done.
   /// \param Error - On failure, an error string describing why no target was
   /// found.
-  LLVM_ABI static const Target *lookupTarget(StringRef ArchName, Triple &TheTriple,
-                                    std::string &Error);
+  LLVM_ABI static const Target *
+  lookupTarget(StringRef ArchName, Triple &TheTriple, std::string &Error);
 
   /// @}
   /// @name Target Registration
@@ -754,10 +754,11 @@ struct TargetRegistry {
   /// @param ArchMatchFn - The arch match checking function for this target.
   /// @param HasJIT - Whether the target supports JIT code
   /// generation.
-  LLVM_ABI static void RegisterTarget(Target &T, const char *Name, const char *ShortDesc,
-                             const char *BackendName,
-                             Target::ArchMatchFnTy ArchMatchFn,
-                             bool HasJIT = false);
+  LLVM_ABI static void RegisterTarget(Target &T, const char *Name,
+                                      const char *ShortDesc,
+                                      const char *BackendName,
+                                      Target::ArchMatchFnTy ArchMatchFn,
+                                      bool HasJIT = false);
 
   /// RegisterMCAsmInfo - Register a MCAsmInfo implementation for the
   /// given target.
diff --git a/llvm/include/llvm/MCA/CodeEmitter.h b/llvm/include/llvm/MCA/CodeEmitter.h
index 7da65bfc2d300..cc978c78244fd 100644
--- a/llvm/include/llvm/MCA/CodeEmitter.h
+++ b/llvm/include/llvm/MCA/CodeEmitter.h
@@ -16,7 +16,6 @@
 #ifndef LLVM_MCA_CODEEMITTER_H
 #define LLVM_MCA_CODEEMITTER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
@@ -24,6 +23,7 @@
 #include "llvm/MC/MCCodeEmitter.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
diff --git a/llvm/include/llvm/MCA/Context.h b/llvm/include/llvm/MCA/Context.h
index 52fa3ef676652..b364cee5c1696 100644
--- a/llvm/include/llvm/MCA/Context.h
+++ b/llvm/include/llvm/MCA/Context.h
@@ -17,13 +17,13 @@
 #ifndef LLVM_MCA_CONTEXT_H
 #define LLVM_MCA_CONTEXT_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/MC/MCRegisterInfo.h"
 #include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/MCA/CustomBehaviour.h"
 #include "llvm/MCA/HardwareUnits/HardwareUnit.h"
 #include "llvm/MCA/Pipeline.h"
 #include "llvm/MCA/SourceMgr.h"
+#include "llvm/Support/Compiler.h"
 #include <memory>
 
 namespace llvm {
@@ -68,15 +68,15 @@ class Context {
 
   /// Construct a basic pipeline for simulating an out-of-order pipeline.
   /// This pipeline consists of Fetch, Dispatch, Execute, and Retire stages.
-  LLVM_ABI std::unique_ptr<Pipeline> createDefaultPipeline(const PipelineOptions &Opts,
-                                                  SourceMgr &SrcMgr,
-                                                  CustomBehaviour &CB);
+  LLVM_ABI std::unique_ptr<Pipeline>
+  createDefaultPipeline(const PipelineOptions &Opts, SourceMgr &SrcMgr,
+                        CustomBehaviour &CB);
 
   /// Construct a basic pipeline for simulating an in-order pipeline.
   /// This pipeline consists of Fetch, InOrderIssue, and Retire stages.
-  LLVM_ABI std::unique_ptr<Pipeline> createInOrderPipeline(const PipelineOptions &Opts,
-                                                  SourceMgr &SrcMgr,
-                                                  CustomBehaviour &CB);
+  LLVM_ABI std::unique_ptr<Pipeline>
+  createInOrderPipeline(const PipelineOptions &Opts, SourceMgr &SrcMgr,
+                        CustomBehaviour &CB);
 };
 
 } // namespace mca
diff --git a/llvm/include/llvm/MCA/CustomBehaviour.h b/llvm/include/llvm/MCA/CustomBehaviour.h
index 92e6efe479ce1..0bf86ce688f44 100644
--- a/llvm/include/llvm/MCA/CustomBehaviour.h
+++ b/llvm/include/llvm/MCA/CustomBehaviour.h
@@ -18,13 +18,13 @@
 #ifndef LLVM_MCA_CUSTOMBEHAVIOUR_H
 #define LLVM_MCA_CUSTOMBEHAVIOUR_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCInstrInfo.h"
 #include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/MCA/SourceMgr.h"
 #include "llvm/MCA/View.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
diff --git a/llvm/include/llvm/MCA/HWEventListener.h b/llvm/include/llvm/MCA/HWEventListener.h
index 4b1b9b92ae717..e217c4893149a 100644
--- a/llvm/include/llvm/MCA/HWEventListener.h
+++ b/llvm/include/llvm/MCA/HWEventListener.h
@@ -14,10 +14,10 @@
 #ifndef LLVM_MCA_HWEVENTLISTENER_H
 #define LLVM_MCA_HWEVENTLISTENER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MCA/Instruction.h"
 #include "llvm/MCA/Support.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
diff --git a/llvm/include/llvm/MCA/HardwareUnits/LSUnit.h b/llvm/include/llvm/MCA/HardwareUnits/LSUnit.h
index 223219f76d228..3700901d723cc 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/LSUnit.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/LSUnit.h
@@ -15,12 +15,12 @@
 #ifndef LLVM_MCA_HARDWAREUNITS_LSUNIT_H
 #define LLVM_MCA_HARDWAREUNITS_LSUNIT_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
 #include "llvm/MCA/HardwareUnits/HardwareUnit.h"
 #include "llvm/MCA/Instruction.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
diff --git a/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h b/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h
index 44f87538362bc..d88ee7cbb9580 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h
@@ -15,12 +15,12 @@
 #ifndef LLVM_MCA_HARDWAREUNITS_RESOURCEMANAGER_H
 #define LLVM_MCA_HARDWAREUNITS_RESOURCEMANAGER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
 #include "llvm/MCA/Instruction.h"
 #include "llvm/MCA/Support.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
@@ -212,7 +212,8 @@ class ResourceState {
   }
 
 public:
-  LLVM_ABI ResourceState(const MCProcResourceDesc &Desc, unsigned Index, uint64_t Mask);
+  LLVM_ABI ResourceState(const MCProcResourceDesc &Desc, unsigned Index,
+                         uint64_t Mask);
 
   unsigned getProcResourceID() const { return ProcResourceDescIndex; }
   uint64_t getResourceMask() const { return ResourceMask; }
@@ -383,7 +384,7 @@ class ResourceManager {
   // Overrides the selection strategy for the processor resource with the given
   // mask.
   LLVM_ABI void setCustomStrategyImpl(std::unique_ptr<ResourceStrategy> S,
-                             uint64_t ResourceMask);
+                                      uint64_t ResourceMask);
 
 public:
   LLVM_ABI ResourceManager(const MCSchedModel &SM);
@@ -447,16 +448,18 @@ class ResourceManager {
   // schedule, no matter in which order individual uses are processed. For that
   // reason, the vector of resource uses is simply (and quickly) processed in
   // sequence. The resulting schedule is eventually stored into vector `Pipes`.
-  LLVM_ABI void fastIssueInstruction(const InstrDesc &Desc,
-                            SmallVectorImpl<ResourceWithCycles> &Pipes);
+  LLVM_ABI void
+  fastIssueInstruction(const InstrDesc &Desc,
+                       SmallVectorImpl<ResourceWithCycles> &Pipes);
 
   // Selects pipeline resources consumed by an instruction.
   // This method works under the assumption that used resource groups may
   // partially overlap. This complicates the selection process, because the
   // order in which uses are processed matters. The logic internally prioritizes
   // groups which are more constrained than others.
-  LLVM_ABI void issueInstructionImpl(const InstrDesc &Desc,
-                            SmallVectorImpl<ResourceWithCycles> &Pipes);
+  LLVM_ABI void
+  issueInstructionImpl(const InstrDesc &Desc,
+                       SmallVectorImpl<ResourceWithCycles> &Pipes);
 
   LLVM_ABI void cycleEvent(SmallVectorImpl<ResourceRef> &ResourcesFreed);
 
diff --git a/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h b/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h
index 08e2f8fae04de..0372600e99637 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h
@@ -14,13 +14,13 @@
 #ifndef LLVM_MCA_HARDWAREUNITS_SCHEDULER_H
 #define LLVM_MCA_HARDWAREUNITS_SCHEDULER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
 #include "llvm/MCA/HardwareUnits/HardwareUnit.h"
 #include "llvm/MCA/HardwareUnits/LSUnit.h"
 #include "llvm/MCA/HardwareUnits/ResourceManager.h"
 #include "llvm/MCA/Support.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
@@ -204,8 +204,7 @@ class Scheduler : public HardwareUnit {
   LLVM_ABI void issueInstruction(
       InstRef &IR,
       SmallVectorImpl<std::pair<ResourceRef, ReleaseAtCycles>> &Used,
-      SmallVectorImpl<InstRef> &Pending,
-      SmallVectorImpl<InstRef> &Ready);
+      SmallVectorImpl<InstRef> &Pending, SmallVectorImpl<InstRef> &Ready);
 
   /// Returns true if IR has to be issued immediately, or if IR is a zero
   /// latency instruction.
@@ -224,9 +223,9 @@ class Scheduler : public HardwareUnit {
   /// the READY state (going through the PENDING state) within a single cycle.
   /// That means, instructions may appear in both the Pending and Ready set.
   LLVM_ABI void cycleEvent(SmallVectorImpl<ResourceRef> &Freed,
-                  SmallVectorImpl<InstRef> &Executed,
-                  SmallVectorImpl<InstRef> &Pending,
-                  SmallVectorImpl<InstRef> &Ready);
+                           SmallVectorImpl<InstRef> &Executed,
+                           SmallVectorImpl<InstRef> &Pending,
+                           SmallVectorImpl<InstRef> &Ready);
 
   /// Convert a resource mask into a valid llvm processor resource identifier.
   ///
@@ -250,7 +249,7 @@ class Scheduler : public HardwareUnit {
   /// register dependencies.  Vector MemDeps is populated by instructions that
   /// were not issued because of unsolved memory dependencies.
   LLVM_ABI void analyzeDataDependencies(SmallVectorImpl<InstRef> &RegDeps,
-                               SmallVectorImpl<InstRef> &MemDeps);
+                                        SmallVectorImpl<InstRef> &MemDeps);
 
   /// Returns a mask of busy resources, and populates vector Insts with
   /// instructions that could not be issued to the underlying pipelines because
diff --git a/llvm/include/llvm/MCA/IncrementalSourceMgr.h b/llvm/include/llvm/MCA/IncrementalSourceMgr.h
index 4d7a9e206cd46..a28663de53846 100644
--- a/llvm/include/llvm/MCA/IncrementalSourceMgr.h
+++ b/llvm/include/llvm/MCA/IncrementalSourceMgr.h
@@ -14,8 +14,8 @@
 #ifndef LLVM_MCA_INCREMENTALSOURCEMGR_H
 #define LLVM_MCA_INCREMENTALSOURCEMGR_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/MCA/SourceMgr.h"
+#include "llvm/Support/Compiler.h"
 #include <deque>
 
 namespace llvm {
@@ -49,8 +49,8 @@ class LLVM_ABI IncrementalSourceMgr : public SourceMgr {
   IncrementalSourceMgr() = default;
 
   // Explicitly non-copyable.
-  IncrementalSourceMgr& operator=(const IncrementalSourceMgr&) = delete;
-  IncrementalSourceMgr(const IncrementalSourceMgr&) = delete;
+  IncrementalSourceMgr &operator=(const IncrementalSourceMgr &) = delete;
+  IncrementalSourceMgr(const IncrementalSourceMgr &) = delete;
 
   void clear();
 
diff --git a/llvm/include/llvm/MCA/InstrBuilder.h b/llvm/include/llvm/MCA/InstrBuilder.h
index 77f0fd961e7db..e0949d975fa99 100644
--- a/llvm/include/llvm/MCA/InstrBuilder.h
+++ b/llvm/include/llvm/MCA/InstrBuilder.h
@@ -14,7 +14,6 @@
 #ifndef LLVM_MCA_INSTRBUILDER_H
 #define LLVM_MCA_INSTRBUILDER_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/MC/MCInstrAnalysis.h"
@@ -24,6 +23,7 @@
 #include "llvm/MCA/CustomBehaviour.h"
 #include "llvm/MCA/Instruction.h"
 #include "llvm/MCA/Support.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
@@ -101,8 +101,8 @@ class InstrBuilder {
 
 public:
   LLVM_ABI InstrBuilder(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
-               const MCRegisterInfo &RI, const MCInstrAnalysis *IA,
-               const InstrumentManager &IM, unsigned CallLatency);
+                        const MCRegisterInfo &RI, const MCInstrAnalysis *IA,
+                        const InstrumentManager &IM, unsigned CallLatency);
 
   void clear() {
     Descriptors.clear();
diff --git a/llvm/include/llvm/MCA/Instruction.h b/llvm/include/llvm/MCA/Instruction.h
index cceb9876342dd..4c683aa3421de 100644
--- a/llvm/include/llvm/MCA/Instruction.h
+++ b/llvm/include/llvm/MCA/Instruction.h
@@ -15,11 +15,11 @@
 #ifndef LLVM_MCA_INSTRUCTION_H
 #define LLVM_MCA_INSTRUCTION_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCRegister.h" // definition of MCPhysReg.
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/MathExtras.h"
 
 #ifndef NDEBUG
diff --git a/llvm/include/llvm/MCA/Pipeline.h b/llvm/include/llvm/MCA/Pipeline.h
index b7b3da2a9e472..1fbc56d86a98c 100644
--- a/llvm/include/llvm/MCA/Pipeline.h
+++ b/llvm/include/llvm/MCA/Pipeline.h
@@ -15,8 +15,8 @@
 #ifndef LLVM_MCA_PIPELINE_H
 #define LLVM_MCA_PIPELINE_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/MCA/Stages/Stage.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/MCA/Stages/EntryStage.h b/llvm/include/llvm/MCA/Stages/EntryStage.h
index d123ccf4a7aa3..262863b6996cc 100644
--- a/llvm/include/llvm/MCA/Stages/EntryStage.h
+++ b/llvm/include/llvm/MCA/Stages/EntryStage.h
@@ -16,10 +16,10 @@
 #ifndef LLVM_MCA_STAGES_ENTRYSTAGE_H
 #define LLVM_MCA_STAGES_ENTRYSTAGE_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MCA/SourceMgr.h"
 #include "llvm/MCA/Stages/Stage.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
diff --git a/llvm/include/llvm/MCA/Stages/InstructionTables.h b/llvm/include/llvm/MCA/Stages/InstructionTables.h
index 2eae12e2b13be..7a96e82dd995b 100644
--- a/llvm/include/llvm/MCA/Stages/InstructionTables.h
+++ b/llvm/include/llvm/MCA/Stages/InstructionTables.h
@@ -16,12 +16,12 @@
 #ifndef LLVM_MCA_STAGES_INSTRUCTIONTABLES_H
 #define LLVM_MCA_STAGES_INSTRUCTIONTABLES_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
 #include "llvm/MCA/HardwareUnits/Scheduler.h"
 #include "llvm/MCA/Stages/Stage.h"
 #include "llvm/MCA/Support.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace mca {
diff --git a/llvm/include/llvm/MCA/Stages/Stage.h b/llvm/include/llvm/MCA/Stages/Stage.h
index 0942220070005..69a6b382032b6 100644
--- a/llvm/include/llvm/MCA/Stages/Stage.h
+++ b/llvm/include/llvm/MCA/Stages/Stage.h
@@ -15,8 +15,8 @@
 #ifndef LLVM_MCA_STAGES_STAGE_H
 #define LLVM_MCA_STAGES_STAGE_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/MCA/HWEventListener.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <set>
 
diff --git a/llvm/include/llvm/MCA/Support.h b/llvm/include/llvm/MCA/Support.h
index 9352c17404fd1..ce2ac9b4b6cd2 100644
--- a/llvm/include/llvm/MCA/Support.h
+++ b/llvm/include/llvm/MCA/Support.h
@@ -14,10 +14,10 @@
 #ifndef LLVM_MCA_SUPPORT_H
 #define LLVM_MCA_SUPPORT_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MathExtras.h"
 
@@ -94,7 +94,7 @@ class ReleaseAtCycles {
 /// Resource masks are used by the ResourceManager to solve set membership
 /// problems with simple bit manipulation operations.
 LLVM_ABI void computeProcResourceMasks(const MCSchedModel &SM,
-                              MutableArrayRef<uint64_t> Masks);
+                                       MutableArrayRef<uint64_t> Masks);
 
 // Returns the index of the highest bit set. For resource masks, the position of
 // the highest bit set can be used to construct a resource mask identifier.
@@ -107,9 +107,10 @@ inline unsigned getResourceStateIndex(uint64_t Mask) {
 /// cycles. The reciprocal block throughput is computed as the MAX between:
 ///  - NumMicroOps / DispatchWidth
 ///  - ProcReleaseAtCycles / #ProcResourceUnits  (for every consumed resource).
-LLVM_ABI double computeBlockRThroughput(const MCSchedModel &SM, unsigned DispatchWidth,
-                               unsigned NumMicroOps,
-                               ArrayRef<unsigned> ProcResourceUsage);
+LLVM_ABI double computeBlockRThroughput(const MCSchedModel &SM,
+                                        unsigned DispatchWidth,
+                                        unsigned NumMicroOps,
+                                        ArrayRef<unsigned> ProcResourceUsage);
 } // namespace mca
 } // namespace llvm
 
diff --git a/llvm/include/llvm/MCA/View.h b/llvm/include/llvm/MCA/View.h
index ff284098634e1..4d6f930663207 100644
--- a/llvm/include/llvm/MCA/View.h
+++ b/llvm/include/llvm/MCA/View.h
@@ -15,9 +15,9 @@
 #ifndef LLVM_MCA_VIEW_H
 #define LLVM_MCA_VIEW_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/MC/MCInstPrinter.h"
 #include "llvm/MCA/HWEventListener.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/raw_ostream.h"
 



More information about the llvm-commits mailing list