[llvm] [llvm] annotate remaining CodeGen and CodeGenTypes library interfaces for DLL export (PR #145361)
Andrew Rogers via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 23 09:48:19 PDT 2025
https://github.com/andrurogerz created https://github.com/llvm/llvm-project/pull/145361
## Purpose
This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the remaining LLVM CodeGen and CodeGenTypes library interface that was missed in, or modified since, previous patches. The 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).
## Overview
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:
- Explicitly instantiate `CallLowering::setArgFlags` template method instances in `CodeGen/GlobalISel/CallLowering.h` and annotate them with `LLVM_ABI`. These methods are already explicitly instantiated in `lib/CodeGen/GlobalISel/CallLowering.cpp` but were not `extern` declared in the header.
- Annotate several explicit template instantiations with `LLVM_EXPORT_TEMPLATE`.
- Include `llvm/CodeGen/Passes.h` from `llvm/lib/CodeGen/GlobalMergeFunctions.cpp` to pick up the declaration of `llvm::createGlobalMergeFuncPass` with the `LLVM_ABI` annotation (instead of adding `LLVM_ABI` to the function definition in this file)
- Annotate a number of private interfaces that are referenced by CodeGen unit tests. We do not currently have a better solution for test-only exports than just exporting them from the DLL. The following interfaces were annotated to build the tests:
- `llvm/lib/CodeGen/AsmPrinter/DIEHash.h`
- ` llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h`
- `llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h`
- `llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h`
- `llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h`
- `llvm/lib/CodeGen/RegAllocScore.h`
## 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 9bfa93a04f41a4b328077f0b154e1ceed580b2ea Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 23 Jun 2025 09:12:57 -0700
Subject: [PATCH 1/3] [llvm] auto-annotate remaining CodegenType library
interfaces for DLL export using IDS
---
llvm/include/llvm/CodeGenTypes/LowLevelType.h | 5 +++--
llvm/include/llvm/CodeGenTypes/MachineValueType.h | 9 +++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/llvm/include/llvm/CodeGenTypes/LowLevelType.h b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
index 06879e1f8d15b..1eecb5ad74eea 100644
--- a/llvm/include/llvm/CodeGenTypes/LowLevelType.h
+++ b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
@@ -26,6 +26,7 @@
#ifndef LLVM_CODEGEN_LOWLEVELTYPE_H
#define LLVM_CODEGEN_LOWLEVELTYPE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
#include "llvm/Support/Debug.h"
@@ -140,7 +141,7 @@ class LLT {
explicit constexpr LLT()
: IsScalar(false), IsPointer(false), IsVector(false), RawData(0) {}
- explicit LLT(MVT VT);
+ LLVM_ABI explicit LLT(MVT VT);
constexpr bool isValid() const { return IsScalar || RawData != 0; }
constexpr bool isScalar() const { return IsScalar; }
@@ -282,7 +283,7 @@ class LLT {
return scalar(getScalarSizeInBits());
}
- void print(raw_ostream &OS) const;
+ LLVM_ABI void print(raw_ostream &OS) const;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void dump() const;
diff --git a/llvm/include/llvm/CodeGenTypes/MachineValueType.h b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
index c14abca027350..a42e31f019b9f 100644
--- a/llvm/include/llvm/CodeGenTypes/MachineValueType.h
+++ b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
@@ -16,6 +16,7 @@
#ifndef LLVM_CODEGEN_MACHINEVALUETYPE_H
#define LLVM_CODEGEN_MACHINEVALUETYPE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
@@ -65,10 +66,10 @@ namespace llvm {
bool operator<=(const MVT& S) const { return SimpleTy <= S.SimpleTy; }
/// Support for debugging, callable in GDB: VT.dump()
- void dump() const;
+ LLVM_ABI void dump() const;
/// Implement operator<<.
- void print(raw_ostream &OS) const;
+ LLVM_ABI void print(raw_ostream &OS) const;
/// Return true if this is a valid simple valuetype.
bool isValid() const {
@@ -509,11 +510,11 @@ namespace llvm {
/// otherwise they are invalid.
/// NB: This includes pointer types, which require a DataLayout to convert
/// to a concrete value type.
- static MVT getVT(Type *Ty, bool HandleUnknown = false);
+ LLVM_ABI static MVT getVT(Type *Ty, bool HandleUnknown = false);
/// Returns an APFloat semantics tag appropriate for the value type. If this
/// is a vector type, the element semantics are returned.
- const fltSemantics &getFltSemantics() const;
+ LLVM_ABI const fltSemantics &getFltSemantics() const;
public:
/// SimpleValueType Iteration
>From f7420b0c37ec61bceab20ce405fc8fbe35b0af75 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 23 Jun 2025 09:16:47 -0700
Subject: [PATCH 2/3] [llvm] manual fix-ups to IDS codemod of CodeGen lib
interfaces
---
.../llvm/CodeGen/GlobalISel/CallLowering.h | 9 ++++++
llvm/lib/CodeGen/AsmPrinter/DIEHash.h | 11 +++----
llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h | 11 +++----
llvm/lib/CodeGen/GlobalMergeFunctions.cpp | 1 +
.../LiveDebugValues/InstrRefBasedImpl.h | 29 ++++++++++---------
.../CodeGen/LiveDebugValues/LiveDebugValues.h | 8 +++--
llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h | 5 ++--
llvm/lib/CodeGen/MachineDomTreeUpdater.cpp | 9 +++---
llvm/lib/CodeGen/MachineDominators.cpp | 17 ++++++-----
llvm/lib/CodeGen/MachineLoopInfo.cpp | 5 ++--
llvm/lib/CodeGen/MachinePassManager.cpp | 9 +++---
llvm/lib/CodeGen/MachinePostDominators.cpp | 12 ++++----
llvm/lib/CodeGen/RegAllocScore.cpp | 10 +++----
llvm/lib/CodeGen/RegAllocScore.h | 9 +++---
14 files changed, 83 insertions(+), 62 deletions(-)
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h b/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
index 109dc8812c24d..75c051712ae43 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
@@ -609,6 +609,15 @@ class LLVM_ABI CallLowering {
virtual bool isTypeIsValidForThisReturn(EVT Ty) const { return false; }
};
+extern template LLVM_ABI void
+CallLowering::setArgFlags<Function>(CallLowering::ArgInfo &Arg, unsigned OpIdx,
+ const DataLayout &DL,
+ const Function &FuncInfo) const;
+
+extern template LLVM_ABI void
+CallLowering::setArgFlags<CallBase>(CallLowering::ArgInfo &Arg, unsigned OpIdx,
+ const DataLayout &DL,
+ const CallBase &FuncInfo) const;
} // end namespace llvm
#endif // LLVM_CODEGEN_GLOBALISEL_CALLLOWERING_H
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
index 24a973b392715..faa49ba642e91 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
@@ -13,6 +13,7 @@
#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DIEHASH_H
#define LLVM_LIB_CODEGEN_ASMPRINTER_DIEHASH_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/Support/MD5.h"
@@ -35,10 +36,10 @@ class DIEHash {
: AP(A), CU(CU) {}
/// Computes the CU signature.
- uint64_t computeCUSignature(StringRef DWOName, const DIE &Die);
+ LLVM_ABI uint64_t computeCUSignature(StringRef DWOName, const DIE &Die);
/// Computes the type signature.
- uint64_t computeTypeSignature(const DIE &Die);
+ LLVM_ABI uint64_t computeTypeSignature(const DIE &Die);
// Helper routines to process parts of a DIE.
private:
@@ -57,12 +58,12 @@ class DIEHash {
void update(uint8_t Value) { Hash.update(Value); }
/// Encodes and adds \param Value to the hash as a ULEB128.
- void addULEB128(uint64_t Value);
+ LLVM_ABI void addULEB128(uint64_t Value);
/// Encodes and adds \param Value to the hash as a SLEB128.
- void addSLEB128(int64_t Value);
+ LLVM_ABI void addSLEB128(int64_t Value);
- void hashRawTypeReference(const DIE &Entry);
+ LLVM_ABI void hashRawTypeReference(const DIE &Entry);
private:
/// Adds \param Str to the hash and includes a NULL byte.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
index 79b5df89e3389..0a43d0e066908 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
@@ -13,6 +13,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/DwarfStringPoolEntry.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -37,12 +38,12 @@ class DwarfStringPool {
public:
using EntryRef = DwarfStringPoolEntryRef;
- DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix);
+ LLVM_ABI DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix);
- void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection,
+ LLVM_ABI void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection,
MCSymbol *StartSym);
- void emit(AsmPrinter &Asm, MCSection *StrSection,
+ LLVM_ABI void emit(AsmPrinter &Asm, MCSection *StrSection,
MCSection *OffsetSection = nullptr,
bool UseRelativeOffsets = false);
@@ -53,12 +54,12 @@ class DwarfStringPool {
unsigned getNumIndexedStrings() const { return NumIndexedStrings; }
/// Get a reference to an entry in the string pool.
- EntryRef getEntry(AsmPrinter &Asm, StringRef Str);
+ LLVM_ABI EntryRef getEntry(AsmPrinter &Asm, StringRef Str);
/// Same as getEntry, except that you can use EntryRef::getIndex to obtain a
/// unique ID of this entry (e.g., for use in indexed forms like
/// DW_FORM_strx).
- EntryRef getIndexedEntry(AsmPrinter &Asm, StringRef Str);
+ LLVM_ABI EntryRef getIndexedEntry(AsmPrinter &Asm, StringRef Str);
};
} // end namespace llvm
diff --git a/llvm/lib/CodeGen/GlobalMergeFunctions.cpp b/llvm/lib/CodeGen/GlobalMergeFunctions.cpp
index 84dc4ab0a5522..92ecfadf97c99 100644
--- a/llvm/lib/CodeGen/GlobalMergeFunctions.cpp
+++ b/llvm/lib/CodeGen/GlobalMergeFunctions.cpp
@@ -15,6 +15,7 @@
#include "llvm/Analysis/ModuleSummaryAnalysis.h"
#include "llvm/CGData/CodeGenData.h"
#include "llvm/CGData/CodeGenDataWriter.h"
+#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/StructuralHash.h"
#include "llvm/InitializePasses.h"
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index 810a71f4d8af4..ac95093f7d3b2 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -19,6 +19,7 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
#include "LiveDebugValues.h"
@@ -204,8 +205,8 @@ class ValueIDNum {
.str();
}
- static ValueIDNum EmptyValue;
- static ValueIDNum TombstoneValue;
+ LLVM_ABI static ValueIDNum EmptyValue;
+ LLVM_ABI static ValueIDNum TombstoneValue;
};
} // End namespace LiveDebugValues
@@ -425,7 +426,7 @@ struct DbgOpID {
DbgOpID(uint32_t RawID) : RawID(RawID) {}
DbgOpID(bool IsConst, uint32_t Index) : ID({IsConst, Index}) {}
- static DbgOpID UndefID;
+ LLVM_ABI static DbgOpID UndefID;
bool operator==(const DbgOpID &Other) const { return RawID == Other.RawID; }
bool operator!=(const DbgOpID &Other) const { return !(*this == Other); }
@@ -788,7 +789,7 @@ class MLocTracker {
value_type operator*() { return value_type(Idx, ValueMap[LocIdx(Idx)]); }
};
- MLocTracker(MachineFunction &MF, const TargetInstrInfo &TII,
+ LLVM_ABI MLocTracker(MachineFunction &MF, const TargetInstrInfo &TII,
const TargetRegisterInfo &TRI, const TargetLowering &TLI);
/// Produce location ID number for a Register. Provides some small amount of
@@ -903,7 +904,7 @@ class MLocTracker {
/// Create a LocIdx for an untracked register ID. Initialize it to either an
/// mphi value representing a live-in, or a recent register mask clobber.
- LocIdx trackRegister(unsigned ID);
+ LLVM_ABI LocIdx trackRegister(unsigned ID);
LocIdx lookupOrTrackRegister(unsigned ID) {
LocIdx &Index = LocIDToLocIdx[ID];
@@ -968,7 +969,7 @@ class MLocTracker {
/// Find LocIdx for SpillLoc \p L, creating a new one if it's not tracked.
/// Returns std::nullopt when in scenarios where a spill slot could be
/// tracked, but we would likely run into resource limitations.
- std::optional<SpillLocationNo> getOrTrackSpillLoc(SpillLoc L);
+ LLVM_ABI std::optional<SpillLocationNo> getOrTrackSpillLoc(SpillLoc L);
// Get LocIdx of a spill ID.
LocIdx getSpillMLoc(unsigned SpillID) {
@@ -1342,7 +1343,7 @@ class InstrRefBasedLDV : public LDVImpl {
/// in an MLocTracker. Convert the observations into a per-block transfer
/// function in \p MLocTransfer, suitable for using with the machine value
/// location dataflow problem.
- void
+ LLVM_ABI void
produceMLocTransferFunction(MachineFunction &MF,
SmallVectorImpl<MLocTransferMap> &MLocTransfer,
unsigned MaxNumBlocks);
@@ -1352,7 +1353,7 @@ class InstrRefBasedLDV : public LDVImpl {
/// live-out arrays to the (initialized to zero) multidimensional arrays in
/// \p MInLocs and \p MOutLocs. The outer dimension is indexed by block
/// number, the inner by LocIdx.
- void buildMLocValueMap(MachineFunction &MF, FuncValueTable &MInLocs,
+ LLVM_ABI void buildMLocValueMap(MachineFunction &MF, FuncValueTable &MInLocs,
FuncValueTable &MOutLocs,
SmallVectorImpl<MLocTransferMap> &MLocTransfer);
@@ -1362,7 +1363,7 @@ class InstrRefBasedLDV : public LDVImpl {
/// Install PHI values into the live-in array for each block, according to
/// the IDF of each register.
- void placeMLocPHIs(MachineFunction &MF,
+ LLVM_ABI void placeMLocPHIs(MachineFunction &MF,
SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
FuncValueTable &MInLocs,
SmallVectorImpl<MLocTransferMap> &MLocTransfer);
@@ -1422,7 +1423,7 @@ class InstrRefBasedLDV : public LDVImpl {
/// \p AssignBlocks contains the set of blocks that aren't in \p DILoc's
/// scope, but which do contain DBG_VALUEs, which VarLocBasedImpl tracks
/// locations through.
- void buildVLocValueMap(const DILocation *DILoc,
+ LLVM_ABI void buildVLocValueMap(const DILocation *DILoc,
const SmallSet<DebugVariableID, 4> &VarsWeCareAbout,
SmallPtrSetImpl<MachineBasicBlock *> &AssignBlocks,
LiveInsT &Output, FuncValueTable &MOutLocs,
@@ -1436,7 +1437,7 @@ class InstrRefBasedLDV : public LDVImpl {
/// \p LiveIn Old live-in value, overwritten with new one if live-in changes.
/// \returns true if any live-ins change value, either from value propagation
/// or PHI elimination.
- bool vlocJoin(MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
+ LLVM_ABI bool vlocJoin(MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
SmallPtrSet<const MachineBasicBlock *, 8> &BlocksToExplore,
DbgValue &LiveIn);
@@ -1445,7 +1446,7 @@ class InstrRefBasedLDV : public LDVImpl {
/// into that operand join together.
/// \returns true if a joined location was found for every value that needed
/// to be joined.
- bool
+ LLVM_ABI bool
pickVPHILoc(SmallVectorImpl<DbgOpID> &OutValues, const MachineBasicBlock &MBB,
const LiveIdxT &LiveOuts, FuncValueTable &MOutLocs,
const SmallVectorImpl<const MachineBasicBlock *> &BlockOrders);
@@ -1461,7 +1462,7 @@ class InstrRefBasedLDV : public LDVImpl {
/// Boilerplate computation of some initial sets, artifical blocks and
/// RPOT block ordering.
- void initialSetup(MachineFunction &MF);
+ LLVM_ABI void initialSetup(MachineFunction &MF);
/// Produce a map of the last lexical scope that uses a block, using the
/// scopes DFSOut number. Mapping is block-number to DFSOut.
@@ -1490,7 +1491,7 @@ class InstrRefBasedLDV : public LDVImpl {
public:
/// Default construct and initialize the pass.
- InstrRefBasedLDV();
+ LLVM_ABI InstrRefBasedLDV();
LLVM_DUMP_METHOD
void dump_mloc_transfer(const MLocTransferMap &mloc_transfer) const;
diff --git a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h
index 3bbe9ce34b355..0a6fa95a44ec4 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h
@@ -9,6 +9,8 @@
#ifndef LLVM_LIB_CODEGEN_LIVEDEBUGVALUES_LIVEDEBUGVALUES_H
#define LLVM_LIB_CODEGEN_LIVEDEBUGVALUES_LIVEDEBUGVALUES_H
+#include "llvm/Support/Compiler.h"
+
namespace llvm {
class MachineDominatorTree;
class MachineFunction;
@@ -34,10 +36,10 @@ class LDVImpl {
} // namespace SharedLiveDebugValues
// Factory functions for LiveDebugValues implementations.
-extern LDVImpl *makeVarLocBasedLiveDebugValues();
-extern LDVImpl *makeInstrRefBasedLiveDebugValues();
+LLVM_ABI extern LDVImpl *makeVarLocBasedLiveDebugValues();
+LLVM_ABI extern LDVImpl *makeInstrRefBasedLiveDebugValues();
-extern bool debuginfoShouldUseDebugInstrRef(const Triple &T);
+LLVM_ABI extern bool debuginfoShouldUseDebugInstrRef(const Triple &T);
} // namespace llvm
diff --git a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
index 27dd2b9aee9af..6dc63c838802c 100644
--- a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
+++ b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
@@ -17,6 +17,7 @@
#include "llvm/Analysis/MLModelRunner.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/SlotIndexes.h"
+#include "llvm/Support/Compiler.h"
#include <map>
namespace llvm {
@@ -32,7 +33,7 @@ struct LRStartEndInfo {
size_t Pos = 0;
};
-void extractInstructionFeatures(
+LLVM_ABI void extractInstructionFeatures(
llvm::SmallVectorImpl<LRStartEndInfo> &LRPosInfo,
MLModelRunner *RegallocRunner, function_ref<int(SlotIndex)> GetOpcode,
function_ref<float(SlotIndex)> GetMBBFreq,
@@ -41,7 +42,7 @@ void extractInstructionFeatures(
const int MBBFreqIndex, const int MBBMappingIndex,
const SlotIndex LastIndex);
-void extractMBBFrequency(const SlotIndex CurrentIndex,
+LLVM_ABI void extractMBBFrequency(const SlotIndex CurrentIndex,
const size_t CurrentInstructionIndex,
std::map<MachineBasicBlock *, size_t> &VisitedMBBs,
function_ref<float(SlotIndex)> GetMBBFreq,
diff --git a/llvm/lib/CodeGen/MachineDomTreeUpdater.cpp b/llvm/lib/CodeGen/MachineDomTreeUpdater.cpp
index 72e4be0165bf8..15a175d6391dd 100644
--- a/llvm/lib/CodeGen/MachineDomTreeUpdater.cpp
+++ b/llvm/lib/CodeGen/MachineDomTreeUpdater.cpp
@@ -14,21 +14,22 @@
#include "llvm/CodeGen/MachineDomTreeUpdater.h"
#include "llvm/Analysis/GenericDomTreeUpdaterImpl.h"
#include "llvm/CodeGen/MachinePostDominators.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
-template class GenericDomTreeUpdater<
+template class LLVM_EXPORT_TEMPLATE GenericDomTreeUpdater<
MachineDomTreeUpdater, MachineDominatorTree, MachinePostDominatorTree>;
-template void
+template LLVM_EXPORT_TEMPLATE void
GenericDomTreeUpdater<MachineDomTreeUpdater, MachineDominatorTree,
MachinePostDominatorTree>::recalculate(MachineFunction
&MF);
-template void GenericDomTreeUpdater<
+template LLVM_EXPORT_TEMPLATE void GenericDomTreeUpdater<
MachineDomTreeUpdater, MachineDominatorTree,
MachinePostDominatorTree>::applyUpdatesImpl</*IsForward=*/true>();
-template void GenericDomTreeUpdater<
+template LLVM_EXPORT_TEMPLATE void GenericDomTreeUpdater<
MachineDomTreeUpdater, MachineDominatorTree,
MachinePostDominatorTree>::applyUpdatesImpl</*IsForward=*/false>();
diff --git a/llvm/lib/CodeGen/MachineDominators.cpp b/llvm/lib/CodeGen/MachineDominators.cpp
index 917519f12a039..47840c7c8d038 100644
--- a/llvm/lib/CodeGen/MachineDominators.cpp
+++ b/llvm/lib/CodeGen/MachineDominators.cpp
@@ -17,6 +17,7 @@
#include "llvm/Pass.h"
#include "llvm/PassRegistry.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/GenericDomTreeConstruction.h"
using namespace llvm;
@@ -35,23 +36,23 @@ static cl::opt<bool, true> VerifyMachineDomInfoX(
cl::desc("Verify machine dominator info (time consuming)"));
namespace llvm {
-template class DomTreeNodeBase<MachineBasicBlock>;
-template class DominatorTreeBase<MachineBasicBlock, false>; // DomTreeBase
+template class LLVM_EXPORT_TEMPLATE DomTreeNodeBase<MachineBasicBlock>;
+template class LLVM_EXPORT_TEMPLATE DominatorTreeBase<MachineBasicBlock, false>; // DomTreeBase
namespace DomTreeBuilder {
-template void Calculate<MBBDomTree>(MBBDomTree &DT);
-template void CalculateWithUpdates<MBBDomTree>(MBBDomTree &DT, MBBUpdates U);
+template LLVM_EXPORT_TEMPLATE void Calculate<MBBDomTree>(MBBDomTree &DT);
+template LLVM_EXPORT_TEMPLATE void CalculateWithUpdates<MBBDomTree>(MBBDomTree &DT, MBBUpdates U);
-template void InsertEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
+template LLVM_EXPORT_TEMPLATE void InsertEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
MachineBasicBlock *To);
-template void DeleteEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
+template LLVM_EXPORT_TEMPLATE void DeleteEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
MachineBasicBlock *To);
-template void ApplyUpdates<MBBDomTree>(MBBDomTree &DT, MBBDomTreeGraphDiff &,
+template LLVM_EXPORT_TEMPLATE void ApplyUpdates<MBBDomTree>(MBBDomTree &DT, MBBDomTreeGraphDiff &,
MBBDomTreeGraphDiff *);
-template bool Verify<MBBDomTree>(const MBBDomTree &DT,
+template LLVM_EXPORT_TEMPLATE bool Verify<MBBDomTree>(const MBBDomTree &DT,
MBBDomTree::VerificationLevel VL);
} // namespace DomTreeBuilder
}
diff --git a/llvm/lib/CodeGen/MachineLoopInfo.cpp b/llvm/lib/CodeGen/MachineLoopInfo.cpp
index 1c97e5c9063e4..62a57f0c2f4df 100644
--- a/llvm/lib/CodeGen/MachineLoopInfo.cpp
+++ b/llvm/lib/CodeGen/MachineLoopInfo.cpp
@@ -22,13 +22,14 @@
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/PassRegistry.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/GenericLoopInfoImpl.h"
using namespace llvm;
// Explicitly instantiate methods in LoopInfoImpl.h for MI-level Loops.
-template class llvm::LoopBase<MachineBasicBlock, MachineLoop>;
-template class llvm::LoopInfoBase<MachineBasicBlock, MachineLoop>;
+template class LLVM_EXPORT_TEMPLATE llvm::LoopBase<MachineBasicBlock, MachineLoop>;
+template class LLVM_EXPORT_TEMPLATE llvm::LoopInfoBase<MachineBasicBlock, MachineLoop>;
AnalysisKey MachineLoopAnalysis::Key;
diff --git a/llvm/lib/CodeGen/MachinePassManager.cpp b/llvm/lib/CodeGen/MachinePassManager.cpp
index bbe386507fcd2..41efa0b1c424b 100644
--- a/llvm/lib/CodeGen/MachinePassManager.cpp
+++ b/llvm/lib/CodeGen/MachinePassManager.cpp
@@ -17,19 +17,20 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManagerImpl.h"
+#include "llvm/Support/Compiler.h"
using namespace llvm;
AnalysisKey FunctionAnalysisManagerMachineFunctionProxy::Key;
namespace llvm {
-template class AnalysisManager<MachineFunction>;
+template class LLVM_EXPORT_TEMPLATE AnalysisManager<MachineFunction>;
template class PassManager<MachineFunction>;
-template class InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
+template class LLVM_EXPORT_TEMPLATE InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
Module>;
-template class InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
+template class LLVM_EXPORT_TEMPLATE InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
Function>;
-template class OuterAnalysisManagerProxy<ModuleAnalysisManager,
+template class LLVM_EXPORT_TEMPLATE OuterAnalysisManagerProxy<ModuleAnalysisManager,
MachineFunction>;
} // namespace llvm
diff --git a/llvm/lib/CodeGen/MachinePostDominators.cpp b/llvm/lib/CodeGen/MachinePostDominators.cpp
index 51637130addc4..ec9b34b4ec041 100644
--- a/llvm/lib/CodeGen/MachinePostDominators.cpp
+++ b/llvm/lib/CodeGen/MachinePostDominators.cpp
@@ -18,21 +18,21 @@
using namespace llvm;
namespace llvm {
-template class DominatorTreeBase<MachineBasicBlock, true>; // PostDomTreeBase
+template class LLVM_EXPORT_TEMPLATE DominatorTreeBase<MachineBasicBlock, true>; // PostDomTreeBase
namespace DomTreeBuilder {
-template void Calculate<MBBPostDomTree>(MBBPostDomTree &DT);
-template void InsertEdge<MBBPostDomTree>(MBBPostDomTree &DT,
+template LLVM_EXPORT_TEMPLATE void Calculate<MBBPostDomTree>(MBBPostDomTree &DT);
+template LLVM_EXPORT_TEMPLATE void InsertEdge<MBBPostDomTree>(MBBPostDomTree &DT,
MachineBasicBlock *From,
MachineBasicBlock *To);
-template void DeleteEdge<MBBPostDomTree>(MBBPostDomTree &DT,
+template LLVM_EXPORT_TEMPLATE void DeleteEdge<MBBPostDomTree>(MBBPostDomTree &DT,
MachineBasicBlock *From,
MachineBasicBlock *To);
-template void ApplyUpdates<MBBPostDomTree>(MBBPostDomTree &DT,
+template LLVM_EXPORT_TEMPLATE void ApplyUpdates<MBBPostDomTree>(MBBPostDomTree &DT,
MBBPostDomTreeGraphDiff &,
MBBPostDomTreeGraphDiff *);
-template bool Verify<MBBPostDomTree>(const MBBPostDomTree &DT,
+template LLVM_EXPORT_TEMPLATE bool Verify<MBBPostDomTree>(const MBBPostDomTree &DT,
MBBPostDomTree::VerificationLevel VL);
} // namespace DomTreeBuilder
diff --git a/llvm/lib/CodeGen/RegAllocScore.cpp b/llvm/lib/CodeGen/RegAllocScore.cpp
index 8c140261c11ca..9a34ae94d9360 100644
--- a/llvm/lib/CodeGen/RegAllocScore.cpp
+++ b/llvm/lib/CodeGen/RegAllocScore.cpp
@@ -23,12 +23,12 @@
#include "llvm/Support/CommandLine.h"
using namespace llvm;
-cl::opt<double> CopyWeight("regalloc-copy-weight", cl::init(0.2), cl::Hidden);
-cl::opt<double> LoadWeight("regalloc-load-weight", cl::init(4.0), cl::Hidden);
-cl::opt<double> StoreWeight("regalloc-store-weight", cl::init(1.0), cl::Hidden);
-cl::opt<double> CheapRematWeight("regalloc-cheap-remat-weight", cl::init(0.2),
+LLVM_ABI cl::opt<double> CopyWeight("regalloc-copy-weight", cl::init(0.2), cl::Hidden);
+LLVM_ABI cl::opt<double> LoadWeight("regalloc-load-weight", cl::init(4.0), cl::Hidden);
+LLVM_ABI cl::opt<double> StoreWeight("regalloc-store-weight", cl::init(1.0), cl::Hidden);
+LLVM_ABI cl::opt<double> CheapRematWeight("regalloc-cheap-remat-weight", cl::init(0.2),
cl::Hidden);
-cl::opt<double> ExpensiveRematWeight("regalloc-expensive-remat-weight",
+LLVM_ABI cl::opt<double> ExpensiveRematWeight("regalloc-expensive-remat-weight",
cl::init(1.0), cl::Hidden);
#define DEBUG_TYPE "regalloc-score"
diff --git a/llvm/lib/CodeGen/RegAllocScore.h b/llvm/lib/CodeGen/RegAllocScore.h
index b80adae29f23c..89c67ac6a32ea 100644
--- a/llvm/lib/CodeGen/RegAllocScore.h
+++ b/llvm/lib/CodeGen/RegAllocScore.h
@@ -16,6 +16,7 @@
#define LLVM_CODEGEN_REGALLOCSCORE_H_
#include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -52,19 +53,19 @@ class RegAllocScore final {
void onCheapRemat(double Freq) { CheapRematCounts += Freq; }
RegAllocScore &operator+=(const RegAllocScore &Other);
- bool operator==(const RegAllocScore &Other) const;
+ LLVM_ABI bool operator==(const RegAllocScore &Other) const;
bool operator!=(const RegAllocScore &Other) const;
- double getScore() const;
+ LLVM_ABI double getScore() const;
};
/// Calculate a score. When comparing 2 scores for the same function but
/// different policies, the better policy would have a smaller score.
/// The implementation is the overload below (which is also easily unittestable)
-RegAllocScore calculateRegAllocScore(const MachineFunction &MF,
+LLVM_ABI RegAllocScore calculateRegAllocScore(const MachineFunction &MF,
const MachineBlockFrequencyInfo &MBFI);
/// Implementation of the above, which is also more easily unittestable.
-RegAllocScore calculateRegAllocScore(
+LLVM_ABI RegAllocScore calculateRegAllocScore(
const MachineFunction &MF,
llvm::function_ref<double(const MachineBasicBlock &)> GetBBFreq,
llvm::function_ref<bool(const MachineInstr &)> IsTriviallyRematerializable);
>From 23923f3b001a99bda1c8518362dd1834ad802b9f Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 23 Jun 2025 09:18:04 -0700
Subject: [PATCH 3/3] [llvm] clang-format changes
---
llvm/include/llvm/CodeGenTypes/LowLevelType.h | 2 +-
.../llvm/CodeGenTypes/MachineValueType.h | 2 +-
llvm/lib/CodeGen/AsmPrinter/DIEHash.h | 2 +-
llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h | 12 ++++---
.../LiveDebugValues/InstrRefBasedImpl.h | 36 ++++++++++---------
llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h | 13 ++++---
llvm/lib/CodeGen/MachineDominators.cpp | 25 +++++++------
llvm/lib/CodeGen/MachineLoopInfo.cpp | 6 ++--
llvm/lib/CodeGen/MachinePassManager.cpp | 12 +++----
llvm/lib/CodeGen/MachinePostDominators.cpp | 29 ++++++++-------
llvm/lib/CodeGen/RegAllocScore.cpp | 15 ++++----
llvm/lib/CodeGen/RegAllocScore.h | 4 +--
12 files changed, 88 insertions(+), 70 deletions(-)
diff --git a/llvm/include/llvm/CodeGenTypes/LowLevelType.h b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
index 1eecb5ad74eea..d8e0848aff84d 100644
--- a/llvm/include/llvm/CodeGenTypes/LowLevelType.h
+++ b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
@@ -26,9 +26,9 @@
#ifndef LLVM_CODEGEN_LOWLEVELTYPE_H
#define LLVM_CODEGEN_LOWLEVELTYPE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include <cassert>
diff --git a/llvm/include/llvm/CodeGenTypes/MachineValueType.h b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
index a42e31f019b9f..b8e91a022ec5e 100644
--- a/llvm/include/llvm/CodeGenTypes/MachineValueType.h
+++ b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
@@ -16,8 +16,8 @@
#ifndef LLVM_CODEGEN_MACHINEVALUETYPE_H
#define LLVM_CODEGEN_MACHINEVALUETYPE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Sequence.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/TypeSize.h"
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
index faa49ba642e91..b6cb47d81b7b7 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
@@ -13,9 +13,9 @@
#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DIEHASH_H
#define LLVM_LIB_CODEGEN_ASMPRINTER_DIEHASH_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/CodeGen/DIE.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MD5.h"
namespace llvm {
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
index 0a43d0e066908..08b9caf8299b9 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
@@ -38,14 +38,16 @@ class DwarfStringPool {
public:
using EntryRef = DwarfStringPoolEntryRef;
- LLVM_ABI DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix);
+ LLVM_ABI DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm,
+ StringRef Prefix);
- LLVM_ABI void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection,
- MCSymbol *StartSym);
+ LLVM_ABI void emitStringOffsetsTableHeader(AsmPrinter &Asm,
+ MCSection *OffsetSection,
+ MCSymbol *StartSym);
LLVM_ABI void emit(AsmPrinter &Asm, MCSection *StrSection,
- MCSection *OffsetSection = nullptr,
- bool UseRelativeOffsets = false);
+ MCSection *OffsetSection = nullptr,
+ bool UseRelativeOffsets = false);
bool empty() const { return Pool.empty(); }
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index ac95093f7d3b2..8e9fdbc292168 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -790,7 +790,8 @@ class MLocTracker {
};
LLVM_ABI MLocTracker(MachineFunction &MF, const TargetInstrInfo &TII,
- const TargetRegisterInfo &TRI, const TargetLowering &TLI);
+ const TargetRegisterInfo &TRI,
+ const TargetLowering &TLI);
/// Produce location ID number for a Register. Provides some small amount of
/// type safety.
@@ -1353,9 +1354,10 @@ class InstrRefBasedLDV : public LDVImpl {
/// live-out arrays to the (initialized to zero) multidimensional arrays in
/// \p MInLocs and \p MOutLocs. The outer dimension is indexed by block
/// number, the inner by LocIdx.
- LLVM_ABI void buildMLocValueMap(MachineFunction &MF, FuncValueTable &MInLocs,
- FuncValueTable &MOutLocs,
- SmallVectorImpl<MLocTransferMap> &MLocTransfer);
+ LLVM_ABI void
+ buildMLocValueMap(MachineFunction &MF, FuncValueTable &MInLocs,
+ FuncValueTable &MOutLocs,
+ SmallVectorImpl<MLocTransferMap> &MLocTransfer);
/// Examine the stack indexes (i.e. offsets within the stack) to find the
/// basic units of interference -- like reg units, but for the stack.
@@ -1364,9 +1366,9 @@ class InstrRefBasedLDV : public LDVImpl {
/// Install PHI values into the live-in array for each block, according to
/// the IDF of each register.
LLVM_ABI void placeMLocPHIs(MachineFunction &MF,
- SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
- FuncValueTable &MInLocs,
- SmallVectorImpl<MLocTransferMap> &MLocTransfer);
+ SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
+ FuncValueTable &MInLocs,
+ SmallVectorImpl<MLocTransferMap> &MLocTransfer);
/// Propagate variable values to blocks in the common case where there's
/// only one value assigned to the variable. This function has better
@@ -1423,12 +1425,13 @@ class InstrRefBasedLDV : public LDVImpl {
/// \p AssignBlocks contains the set of blocks that aren't in \p DILoc's
/// scope, but which do contain DBG_VALUEs, which VarLocBasedImpl tracks
/// locations through.
- LLVM_ABI void buildVLocValueMap(const DILocation *DILoc,
- const SmallSet<DebugVariableID, 4> &VarsWeCareAbout,
- SmallPtrSetImpl<MachineBasicBlock *> &AssignBlocks,
- LiveInsT &Output, FuncValueTable &MOutLocs,
- FuncValueTable &MInLocs,
- SmallVectorImpl<VLocTracker> &AllTheVLocs);
+ LLVM_ABI void
+ buildVLocValueMap(const DILocation *DILoc,
+ const SmallSet<DebugVariableID, 4> &VarsWeCareAbout,
+ SmallPtrSetImpl<MachineBasicBlock *> &AssignBlocks,
+ LiveInsT &Output, FuncValueTable &MOutLocs,
+ FuncValueTable &MInLocs,
+ SmallVectorImpl<VLocTracker> &AllTheVLocs);
/// Attempt to eliminate un-necessary PHIs on entry to a block. Examines the
/// live-in values coming from predecessors live-outs, and replaces any PHIs
@@ -1437,9 +1440,10 @@ class InstrRefBasedLDV : public LDVImpl {
/// \p LiveIn Old live-in value, overwritten with new one if live-in changes.
/// \returns true if any live-ins change value, either from value propagation
/// or PHI elimination.
- LLVM_ABI bool vlocJoin(MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
- SmallPtrSet<const MachineBasicBlock *, 8> &BlocksToExplore,
- DbgValue &LiveIn);
+ LLVM_ABI bool
+ vlocJoin(MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
+ SmallPtrSet<const MachineBasicBlock *, 8> &BlocksToExplore,
+ DbgValue &LiveIn);
/// For the given block and live-outs feeding into it, try to find
/// machine locations for each debug operand where all the values feeding
diff --git a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
index 6dc63c838802c..62615180626cf 100644
--- a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
+++ b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
@@ -42,13 +42,12 @@ LLVM_ABI void extractInstructionFeatures(
const int MBBFreqIndex, const int MBBMappingIndex,
const SlotIndex LastIndex);
-LLVM_ABI void extractMBBFrequency(const SlotIndex CurrentIndex,
- const size_t CurrentInstructionIndex,
- std::map<MachineBasicBlock *, size_t> &VisitedMBBs,
- function_ref<float(SlotIndex)> GetMBBFreq,
- MachineBasicBlock *CurrentMBBReference,
- MLModelRunner *RegallocRunner, const int MBBFreqIndex,
- const int MBBMappingIndex);
+LLVM_ABI void extractMBBFrequency(
+ const SlotIndex CurrentIndex, const size_t CurrentInstructionIndex,
+ std::map<MachineBasicBlock *, size_t> &VisitedMBBs,
+ function_ref<float(SlotIndex)> GetMBBFreq,
+ MachineBasicBlock *CurrentMBBReference, MLModelRunner *RegallocRunner,
+ const int MBBFreqIndex, const int MBBMappingIndex);
// This is the maximum number of interfererring ranges. That's the number of
// distinct AllocationOrder values, which comes from MCRegisterClass::RegsSize.
diff --git a/llvm/lib/CodeGen/MachineDominators.cpp b/llvm/lib/CodeGen/MachineDominators.cpp
index 47840c7c8d038..b221fa8b6de84 100644
--- a/llvm/lib/CodeGen/MachineDominators.cpp
+++ b/llvm/lib/CodeGen/MachineDominators.cpp
@@ -37,23 +37,28 @@ static cl::opt<bool, true> VerifyMachineDomInfoX(
namespace llvm {
template class LLVM_EXPORT_TEMPLATE DomTreeNodeBase<MachineBasicBlock>;
-template class LLVM_EXPORT_TEMPLATE DominatorTreeBase<MachineBasicBlock, false>; // DomTreeBase
+template class LLVM_EXPORT_TEMPLATE
+ DominatorTreeBase<MachineBasicBlock, false>; // DomTreeBase
namespace DomTreeBuilder {
template LLVM_EXPORT_TEMPLATE void Calculate<MBBDomTree>(MBBDomTree &DT);
-template LLVM_EXPORT_TEMPLATE void CalculateWithUpdates<MBBDomTree>(MBBDomTree &DT, MBBUpdates U);
+template LLVM_EXPORT_TEMPLATE void
+CalculateWithUpdates<MBBDomTree>(MBBDomTree &DT, MBBUpdates U);
-template LLVM_EXPORT_TEMPLATE void InsertEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
- MachineBasicBlock *To);
+template LLVM_EXPORT_TEMPLATE void
+InsertEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
+ MachineBasicBlock *To);
-template LLVM_EXPORT_TEMPLATE void DeleteEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
- MachineBasicBlock *To);
+template LLVM_EXPORT_TEMPLATE void
+DeleteEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
+ MachineBasicBlock *To);
-template LLVM_EXPORT_TEMPLATE void ApplyUpdates<MBBDomTree>(MBBDomTree &DT, MBBDomTreeGraphDiff &,
- MBBDomTreeGraphDiff *);
+template LLVM_EXPORT_TEMPLATE void
+ApplyUpdates<MBBDomTree>(MBBDomTree &DT, MBBDomTreeGraphDiff &,
+ MBBDomTreeGraphDiff *);
-template LLVM_EXPORT_TEMPLATE bool Verify<MBBDomTree>(const MBBDomTree &DT,
- MBBDomTree::VerificationLevel VL);
+template LLVM_EXPORT_TEMPLATE bool
+Verify<MBBDomTree>(const MBBDomTree &DT, MBBDomTree::VerificationLevel VL);
} // namespace DomTreeBuilder
}
diff --git a/llvm/lib/CodeGen/MachineLoopInfo.cpp b/llvm/lib/CodeGen/MachineLoopInfo.cpp
index 62a57f0c2f4df..fdb1a470493ce 100644
--- a/llvm/lib/CodeGen/MachineLoopInfo.cpp
+++ b/llvm/lib/CodeGen/MachineLoopInfo.cpp
@@ -28,8 +28,10 @@
using namespace llvm;
// Explicitly instantiate methods in LoopInfoImpl.h for MI-level Loops.
-template class LLVM_EXPORT_TEMPLATE llvm::LoopBase<MachineBasicBlock, MachineLoop>;
-template class LLVM_EXPORT_TEMPLATE llvm::LoopInfoBase<MachineBasicBlock, MachineLoop>;
+template class LLVM_EXPORT_TEMPLATE
+ llvm::LoopBase<MachineBasicBlock, MachineLoop>;
+template class LLVM_EXPORT_TEMPLATE
+ llvm::LoopInfoBase<MachineBasicBlock, MachineLoop>;
AnalysisKey MachineLoopAnalysis::Key;
diff --git a/llvm/lib/CodeGen/MachinePassManager.cpp b/llvm/lib/CodeGen/MachinePassManager.cpp
index 41efa0b1c424b..6e445f6787903 100644
--- a/llvm/lib/CodeGen/MachinePassManager.cpp
+++ b/llvm/lib/CodeGen/MachinePassManager.cpp
@@ -26,12 +26,12 @@ AnalysisKey FunctionAnalysisManagerMachineFunctionProxy::Key;
namespace llvm {
template class LLVM_EXPORT_TEMPLATE AnalysisManager<MachineFunction>;
template class PassManager<MachineFunction>;
-template class LLVM_EXPORT_TEMPLATE InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
- Module>;
-template class LLVM_EXPORT_TEMPLATE InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
- Function>;
-template class LLVM_EXPORT_TEMPLATE OuterAnalysisManagerProxy<ModuleAnalysisManager,
- MachineFunction>;
+template class LLVM_EXPORT_TEMPLATE
+ InnerAnalysisManagerProxy<MachineFunctionAnalysisManager, Module>;
+template class LLVM_EXPORT_TEMPLATE
+ InnerAnalysisManagerProxy<MachineFunctionAnalysisManager, Function>;
+template class LLVM_EXPORT_TEMPLATE
+ OuterAnalysisManagerProxy<ModuleAnalysisManager, MachineFunction>;
} // namespace llvm
bool FunctionAnalysisManagerMachineFunctionProxy::Result::invalidate(
diff --git a/llvm/lib/CodeGen/MachinePostDominators.cpp b/llvm/lib/CodeGen/MachinePostDominators.cpp
index ec9b34b4ec041..1cb7e465881a2 100644
--- a/llvm/lib/CodeGen/MachinePostDominators.cpp
+++ b/llvm/lib/CodeGen/MachinePostDominators.cpp
@@ -18,22 +18,25 @@
using namespace llvm;
namespace llvm {
-template class LLVM_EXPORT_TEMPLATE DominatorTreeBase<MachineBasicBlock, true>; // PostDomTreeBase
+template class LLVM_EXPORT_TEMPLATE
+ DominatorTreeBase<MachineBasicBlock, true>; // PostDomTreeBase
namespace DomTreeBuilder {
-template LLVM_EXPORT_TEMPLATE void Calculate<MBBPostDomTree>(MBBPostDomTree &DT);
-template LLVM_EXPORT_TEMPLATE void InsertEdge<MBBPostDomTree>(MBBPostDomTree &DT,
- MachineBasicBlock *From,
- MachineBasicBlock *To);
-template LLVM_EXPORT_TEMPLATE void DeleteEdge<MBBPostDomTree>(MBBPostDomTree &DT,
- MachineBasicBlock *From,
- MachineBasicBlock *To);
-template LLVM_EXPORT_TEMPLATE void ApplyUpdates<MBBPostDomTree>(MBBPostDomTree &DT,
- MBBPostDomTreeGraphDiff &,
- MBBPostDomTreeGraphDiff *);
-template LLVM_EXPORT_TEMPLATE bool Verify<MBBPostDomTree>(const MBBPostDomTree &DT,
- MBBPostDomTree::VerificationLevel VL);
+template LLVM_EXPORT_TEMPLATE void
+Calculate<MBBPostDomTree>(MBBPostDomTree &DT);
+template LLVM_EXPORT_TEMPLATE void
+InsertEdge<MBBPostDomTree>(MBBPostDomTree &DT, MachineBasicBlock *From,
+ MachineBasicBlock *To);
+template LLVM_EXPORT_TEMPLATE void
+DeleteEdge<MBBPostDomTree>(MBBPostDomTree &DT, MachineBasicBlock *From,
+ MachineBasicBlock *To);
+template LLVM_EXPORT_TEMPLATE void
+ApplyUpdates<MBBPostDomTree>(MBBPostDomTree &DT, MBBPostDomTreeGraphDiff &,
+ MBBPostDomTreeGraphDiff *);
+template LLVM_EXPORT_TEMPLATE bool
+Verify<MBBPostDomTree>(const MBBPostDomTree &DT,
+ MBBPostDomTree::VerificationLevel VL);
} // namespace DomTreeBuilder
extern bool VerifyMachineDomInfo;
diff --git a/llvm/lib/CodeGen/RegAllocScore.cpp b/llvm/lib/CodeGen/RegAllocScore.cpp
index 9a34ae94d9360..b86647dbe0a48 100644
--- a/llvm/lib/CodeGen/RegAllocScore.cpp
+++ b/llvm/lib/CodeGen/RegAllocScore.cpp
@@ -23,13 +23,16 @@
#include "llvm/Support/CommandLine.h"
using namespace llvm;
-LLVM_ABI cl::opt<double> CopyWeight("regalloc-copy-weight", cl::init(0.2), cl::Hidden);
-LLVM_ABI cl::opt<double> LoadWeight("regalloc-load-weight", cl::init(4.0), cl::Hidden);
-LLVM_ABI cl::opt<double> StoreWeight("regalloc-store-weight", cl::init(1.0), cl::Hidden);
-LLVM_ABI cl::opt<double> CheapRematWeight("regalloc-cheap-remat-weight", cl::init(0.2),
- cl::Hidden);
+LLVM_ABI cl::opt<double> CopyWeight("regalloc-copy-weight", cl::init(0.2),
+ cl::Hidden);
+LLVM_ABI cl::opt<double> LoadWeight("regalloc-load-weight", cl::init(4.0),
+ cl::Hidden);
+LLVM_ABI cl::opt<double> StoreWeight("regalloc-store-weight", cl::init(1.0),
+ cl::Hidden);
+LLVM_ABI cl::opt<double> CheapRematWeight("regalloc-cheap-remat-weight",
+ cl::init(0.2), cl::Hidden);
LLVM_ABI cl::opt<double> ExpensiveRematWeight("regalloc-expensive-remat-weight",
- cl::init(1.0), cl::Hidden);
+ cl::init(1.0), cl::Hidden);
#define DEBUG_TYPE "regalloc-score"
RegAllocScore &RegAllocScore::operator+=(const RegAllocScore &Other) {
diff --git a/llvm/lib/CodeGen/RegAllocScore.h b/llvm/lib/CodeGen/RegAllocScore.h
index 89c67ac6a32ea..8274ab9a5814d 100644
--- a/llvm/lib/CodeGen/RegAllocScore.h
+++ b/llvm/lib/CodeGen/RegAllocScore.h
@@ -61,8 +61,8 @@ class RegAllocScore final {
/// Calculate a score. When comparing 2 scores for the same function but
/// different policies, the better policy would have a smaller score.
/// The implementation is the overload below (which is also easily unittestable)
-LLVM_ABI RegAllocScore calculateRegAllocScore(const MachineFunction &MF,
- const MachineBlockFrequencyInfo &MBFI);
+LLVM_ABI RegAllocScore calculateRegAllocScore(
+ const MachineFunction &MF, const MachineBlockFrequencyInfo &MBFI);
/// Implementation of the above, which is also more easily unittestable.
LLVM_ABI RegAllocScore calculateRegAllocScore(
More information about the llvm-commits
mailing list