-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm] annotate remaining CodeGen and CodeGenTypes library interfaces for DLL export #145361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-llvm-globalisel @llvm/pr-subscribers-mlgo Author: Andrew Rogers (andrurogerz) ChangesPurposeThis 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 interfaces that were 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. BackgroundThis effort is tracked in #109483. Additional context is provided in this discourse, and documentation for OverviewThe bulk of these changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with The following manual adjustments were also applied after running IDS:
ValidationLocal builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:
Patch is 28.94 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/145361.diff 16 Files Affected:
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/include/llvm/CodeGenTypes/LowLevelType.h b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
index 06879e1f8d15b..d8e0848aff84d 100644
--- a/llvm/include/llvm/CodeGenTypes/LowLevelType.h
+++ b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
@@ -28,6 +28,7 @@
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include <cassert>
@@ -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..b8e91a022ec5e 100644
--- a/llvm/include/llvm/CodeGenTypes/MachineValueType.h
+++ b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
@@ -17,6 +17,7 @@
#define LLVM_CODEGEN_MACHINEVALUETYPE_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"
@@ -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
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
index 24a973b392715..b6cb47d81b7b7 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
@@ -15,6 +15,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/CodeGen/DIE.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MD5.h"
namespace llvm {
@@ -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..08b9caf8299b9 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,14 +38,16 @@ 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,
- MCSymbol *StartSym);
+ LLVM_ABI void emitStringOffsetsTableHeader(AsmPrinter &Asm,
+ MCSection *OffsetSection,
+ MCSymbol *StartSym);
- void emit(AsmPrinter &Asm, MCSection *StrSection,
- MCSection *OffsetSection = nullptr,
- bool UseRelativeOffsets = false);
+ LLVM_ABI void emit(AsmPrinter &Asm, MCSection *StrSection,
+ MCSection *OffsetSection = nullptr,
+ bool UseRelativeOffsets = false);
bool empty() const { return Pool.empty(); }
@@ -53,12 +56,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..8e9fdbc292168 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,8 +789,9 @@ class MLocTracker {
value_type operator*() { return value_type(Idx, ValueMap[LocIdx(Idx)]); }
};
- MLocTracker(MachineFunction &MF, const TargetInstrInfo &TII,
- const TargetRegisterInfo &TRI, const TargetLowering &TLI);
+ 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
/// type safety.
@@ -903,7 +905,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 +970,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 +1344,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,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.
- 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.
@@ -1362,10 +1365,10 @@ 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,
- SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
- FuncValueTable &MInLocs,
- SmallVectorImpl<MLocTransferMap> &MLocTransfer);
+ LLVM_ABI void placeMLocPHIs(MachineFunction &MF,
+ 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
@@ -1422,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.
- 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
@@ -1436,16 +1440,17 @@ 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,
- 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
/// 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 +1466,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 +1495,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..62615180626cf 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,13 +42,12 @@ void extractInstructionFeatures(
const int MBBFreqIndex, const int MBBMappingIndex,
const SlotIndex LastIndex);
-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/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..b221fa8b6de84 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,24 +36,29 @@ 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>; // ...
[truncated]
|
@llvm/pr-subscribers-debuginfo Author: Andrew Rogers (andrurogerz) ChangesPurposeThis 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 interfaces that were 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. BackgroundThis effort is tracked in #109483. Additional context is provided in this discourse, and documentation for OverviewThe bulk of these changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with The following manual adjustments were also applied after running IDS:
ValidationLocal builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:
Patch is 28.94 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/145361.diff 16 Files Affected:
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/include/llvm/CodeGenTypes/LowLevelType.h b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
index 06879e1f8d15b..d8e0848aff84d 100644
--- a/llvm/include/llvm/CodeGenTypes/LowLevelType.h
+++ b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
@@ -28,6 +28,7 @@
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include <cassert>
@@ -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..b8e91a022ec5e 100644
--- a/llvm/include/llvm/CodeGenTypes/MachineValueType.h
+++ b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
@@ -17,6 +17,7 @@
#define LLVM_CODEGEN_MACHINEVALUETYPE_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"
@@ -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
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
index 24a973b392715..b6cb47d81b7b7 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
@@ -15,6 +15,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/CodeGen/DIE.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MD5.h"
namespace llvm {
@@ -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..08b9caf8299b9 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,14 +38,16 @@ 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,
- MCSymbol *StartSym);
+ LLVM_ABI void emitStringOffsetsTableHeader(AsmPrinter &Asm,
+ MCSection *OffsetSection,
+ MCSymbol *StartSym);
- void emit(AsmPrinter &Asm, MCSection *StrSection,
- MCSection *OffsetSection = nullptr,
- bool UseRelativeOffsets = false);
+ LLVM_ABI void emit(AsmPrinter &Asm, MCSection *StrSection,
+ MCSection *OffsetSection = nullptr,
+ bool UseRelativeOffsets = false);
bool empty() const { return Pool.empty(); }
@@ -53,12 +56,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..8e9fdbc292168 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,8 +789,9 @@ class MLocTracker {
value_type operator*() { return value_type(Idx, ValueMap[LocIdx(Idx)]); }
};
- MLocTracker(MachineFunction &MF, const TargetInstrInfo &TII,
- const TargetRegisterInfo &TRI, const TargetLowering &TLI);
+ 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
/// type safety.
@@ -903,7 +905,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 +970,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 +1344,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,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.
- 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.
@@ -1362,10 +1365,10 @@ 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,
- SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
- FuncValueTable &MInLocs,
- SmallVectorImpl<MLocTransferMap> &MLocTransfer);
+ LLVM_ABI void placeMLocPHIs(MachineFunction &MF,
+ 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
@@ -1422,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.
- 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
@@ -1436,16 +1440,17 @@ 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,
- 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
/// 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 +1466,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 +1495,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..62615180626cf 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,13 +42,12 @@ void extractInstructionFeatures(
const int MBBFreqIndex, const int MBBMappingIndex,
const SlotIndex LastIndex);
-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/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..b221fa8b6de84 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,24 +36,29 @@ 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>; // ...
[truncated]
|
23923f3
to
02c63d6
Compare
@compnerd, @vgvassilev here's another quick one if you don't mind taking a look |
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 interfaces that were 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, and documentation for
LLVM_ABI
and related annotations is found in the LLVM repo here.Overview
The bulk of these changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with
git clang-format
.The following manual adjustments were also applied after running IDS:
CallLowering::setArgFlags
template method instances inCodeGen/GlobalISel/CallLowering.h
and annotate them withLLVM_ABI
. These methods are already explicitly instantiated inlib/CodeGen/GlobalISel/CallLowering.cpp
but were notextern
declared in the header.LLVM_EXPORT_TEMPLATE
.llvm/CodeGen/Passes.h
fromllvm/lib/CodeGen/GlobalMergeFunctions.cpp
to pick up the declaration ofllvm::createGlobalMergeFuncPass
with theLLVM_ABI
annotation (instead of addingLLVM_ABI
to the function definition in this file)Validation
Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: