Skip to content

[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

Merged
merged 3 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions llvm/include/llvm/CodeGenTypes/LowLevelType.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions llvm/include/llvm/CodeGenTypes/MachineValueType.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/CodeGen/GlobalMergeFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 5 additions & 4 deletions llvm/lib/CodeGen/MachineDomTreeUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();

Expand Down
30 changes: 18 additions & 12 deletions llvm/lib/CodeGen/MachineDominators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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>; // 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,
MachineBasicBlock *To);
template LLVM_EXPORT_TEMPLATE void
InsertEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
MachineBasicBlock *To);

template void DeleteEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
MachineBasicBlock *To);
template LLVM_EXPORT_TEMPLATE void
DeleteEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
MachineBasicBlock *To);

template void ApplyUpdates<MBBDomTree>(MBBDomTree &DT, MBBDomTreeGraphDiff &,
MBBDomTreeGraphDiff *);
template LLVM_EXPORT_TEMPLATE void
ApplyUpdates<MBBDomTree>(MBBDomTree &DT, MBBDomTreeGraphDiff &,
MBBDomTreeGraphDiff *);

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
}

Expand Down
7 changes: 5 additions & 2 deletions llvm/lib/CodeGen/MachineLoopInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
#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;

Expand Down
15 changes: 8 additions & 7 deletions llvm/lib/CodeGen/MachinePassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@
#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,
Module>;
template class InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
Function>;
template class 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(
Expand Down
29 changes: 16 additions & 13 deletions llvm/lib/CodeGen/MachinePostDominators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,25 @@
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,
MachineBasicBlock *From,
MachineBasicBlock *To);
template void DeleteEdge<MBBPostDomTree>(MBBPostDomTree &DT,
MachineBasicBlock *From,
MachineBasicBlock *To);
template void ApplyUpdates<MBBPostDomTree>(MBBPostDomTree &DT,
MBBPostDomTreeGraphDiff &,
MBBPostDomTreeGraphDiff *);
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;
Expand Down
17 changes: 10 additions & 7 deletions llvm/lib/CodeGen/RegAllocScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@
#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),
cl::Hidden);
cl::opt<double> ExpensiveRematWeight("regalloc-expensive-remat-weight",
cl::init(1.0), 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);
#define DEBUG_TYPE "regalloc-score"

RegAllocScore &RegAllocScore::operator+=(const RegAllocScore &Other) {
Expand Down