Skip to content

Commit f7420b0

Browse files
committed
[llvm] manual fix-ups to IDS codemod of CodeGen lib interfaces
1 parent 9bfa93a commit f7420b0

14 files changed

+83
-62
lines changed

llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,15 @@ class LLVM_ABI CallLowering {
609609
virtual bool isTypeIsValidForThisReturn(EVT Ty) const { return false; }
610610
};
611611

612+
extern template LLVM_ABI void
613+
CallLowering::setArgFlags<Function>(CallLowering::ArgInfo &Arg, unsigned OpIdx,
614+
const DataLayout &DL,
615+
const Function &FuncInfo) const;
616+
617+
extern template LLVM_ABI void
618+
CallLowering::setArgFlags<CallBase>(CallLowering::ArgInfo &Arg, unsigned OpIdx,
619+
const DataLayout &DL,
620+
const CallBase &FuncInfo) const;
612621
} // end namespace llvm
613622

614623
#endif // LLVM_CODEGEN_GLOBALISEL_CALLLOWERING_H

llvm/lib/CodeGen/AsmPrinter/DIEHash.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DIEHASH_H
1414
#define LLVM_LIB_CODEGEN_ASMPRINTER_DIEHASH_H
1515

16+
#include "llvm/Support/Compiler.h"
1617
#include "llvm/ADT/DenseMap.h"
1718
#include "llvm/CodeGen/DIE.h"
1819
#include "llvm/Support/MD5.h"
@@ -35,10 +36,10 @@ class DIEHash {
3536
: AP(A), CU(CU) {}
3637

3738
/// Computes the CU signature.
38-
uint64_t computeCUSignature(StringRef DWOName, const DIE &Die);
39+
LLVM_ABI uint64_t computeCUSignature(StringRef DWOName, const DIE &Die);
3940

4041
/// Computes the type signature.
41-
uint64_t computeTypeSignature(const DIE &Die);
42+
LLVM_ABI uint64_t computeTypeSignature(const DIE &Die);
4243

4344
// Helper routines to process parts of a DIE.
4445
private:
@@ -57,12 +58,12 @@ class DIEHash {
5758
void update(uint8_t Value) { Hash.update(Value); }
5859

5960
/// Encodes and adds \param Value to the hash as a ULEB128.
60-
void addULEB128(uint64_t Value);
61+
LLVM_ABI void addULEB128(uint64_t Value);
6162

6263
/// Encodes and adds \param Value to the hash as a SLEB128.
63-
void addSLEB128(int64_t Value);
64+
LLVM_ABI void addSLEB128(int64_t Value);
6465

65-
void hashRawTypeReference(const DIE &Entry);
66+
LLVM_ABI void hashRawTypeReference(const DIE &Entry);
6667

6768
private:
6869
/// Adds \param Str to the hash and includes a NULL byte.

llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "llvm/ADT/StringRef.h"
1414
#include "llvm/CodeGen/DwarfStringPoolEntry.h"
1515
#include "llvm/Support/Allocator.h"
16+
#include "llvm/Support/Compiler.h"
1617

1718
namespace llvm {
1819

@@ -37,12 +38,12 @@ class DwarfStringPool {
3738
public:
3839
using EntryRef = DwarfStringPoolEntryRef;
3940

40-
DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix);
41+
LLVM_ABI DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix);
4142

42-
void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection,
43+
LLVM_ABI void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection,
4344
MCSymbol *StartSym);
4445

45-
void emit(AsmPrinter &Asm, MCSection *StrSection,
46+
LLVM_ABI void emit(AsmPrinter &Asm, MCSection *StrSection,
4647
MCSection *OffsetSection = nullptr,
4748
bool UseRelativeOffsets = false);
4849

@@ -53,12 +54,12 @@ class DwarfStringPool {
5354
unsigned getNumIndexedStrings() const { return NumIndexedStrings; }
5455

5556
/// Get a reference to an entry in the string pool.
56-
EntryRef getEntry(AsmPrinter &Asm, StringRef Str);
57+
LLVM_ABI EntryRef getEntry(AsmPrinter &Asm, StringRef Str);
5758

5859
/// Same as getEntry, except that you can use EntryRef::getIndex to obtain a
5960
/// unique ID of this entry (e.g., for use in indexed forms like
6061
/// DW_FORM_strx).
61-
EntryRef getIndexedEntry(AsmPrinter &Asm, StringRef Str);
62+
LLVM_ABI EntryRef getIndexedEntry(AsmPrinter &Asm, StringRef Str);
6263
};
6364

6465
} // end namespace llvm

llvm/lib/CodeGen/GlobalMergeFunctions.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "llvm/Analysis/ModuleSummaryAnalysis.h"
1616
#include "llvm/CGData/CodeGenData.h"
1717
#include "llvm/CGData/CodeGenDataWriter.h"
18+
#include "llvm/CodeGen/Passes.h"
1819
#include "llvm/IR/IRBuilder.h"
1920
#include "llvm/IR/StructuralHash.h"
2021
#include "llvm/InitializePasses.h"

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "llvm/CodeGen/MachineInstr.h"
2020
#include "llvm/CodeGen/TargetRegisterInfo.h"
2121
#include "llvm/IR/DebugInfoMetadata.h"
22+
#include "llvm/Support/Compiler.h"
2223
#include <optional>
2324

2425
#include "LiveDebugValues.h"
@@ -204,8 +205,8 @@ class ValueIDNum {
204205
.str();
205206
}
206207

207-
static ValueIDNum EmptyValue;
208-
static ValueIDNum TombstoneValue;
208+
LLVM_ABI static ValueIDNum EmptyValue;
209+
LLVM_ABI static ValueIDNum TombstoneValue;
209210
};
210211

211212
} // End namespace LiveDebugValues
@@ -425,7 +426,7 @@ struct DbgOpID {
425426
DbgOpID(uint32_t RawID) : RawID(RawID) {}
426427
DbgOpID(bool IsConst, uint32_t Index) : ID({IsConst, Index}) {}
427428

428-
static DbgOpID UndefID;
429+
LLVM_ABI static DbgOpID UndefID;
429430

430431
bool operator==(const DbgOpID &Other) const { return RawID == Other.RawID; }
431432
bool operator!=(const DbgOpID &Other) const { return !(*this == Other); }
@@ -788,7 +789,7 @@ class MLocTracker {
788789
value_type operator*() { return value_type(Idx, ValueMap[LocIdx(Idx)]); }
789790
};
790791

791-
MLocTracker(MachineFunction &MF, const TargetInstrInfo &TII,
792+
LLVM_ABI MLocTracker(MachineFunction &MF, const TargetInstrInfo &TII,
792793
const TargetRegisterInfo &TRI, const TargetLowering &TLI);
793794

794795
/// Produce location ID number for a Register. Provides some small amount of
@@ -903,7 +904,7 @@ class MLocTracker {
903904

904905
/// Create a LocIdx for an untracked register ID. Initialize it to either an
905906
/// mphi value representing a live-in, or a recent register mask clobber.
906-
LocIdx trackRegister(unsigned ID);
907+
LLVM_ABI LocIdx trackRegister(unsigned ID);
907908

908909
LocIdx lookupOrTrackRegister(unsigned ID) {
909910
LocIdx &Index = LocIDToLocIdx[ID];
@@ -968,7 +969,7 @@ class MLocTracker {
968969
/// Find LocIdx for SpillLoc \p L, creating a new one if it's not tracked.
969970
/// Returns std::nullopt when in scenarios where a spill slot could be
970971
/// tracked, but we would likely run into resource limitations.
971-
std::optional<SpillLocationNo> getOrTrackSpillLoc(SpillLoc L);
972+
LLVM_ABI std::optional<SpillLocationNo> getOrTrackSpillLoc(SpillLoc L);
972973

973974
// Get LocIdx of a spill ID.
974975
LocIdx getSpillMLoc(unsigned SpillID) {
@@ -1342,7 +1343,7 @@ class InstrRefBasedLDV : public LDVImpl {
13421343
/// in an MLocTracker. Convert the observations into a per-block transfer
13431344
/// function in \p MLocTransfer, suitable for using with the machine value
13441345
/// location dataflow problem.
1345-
void
1346+
LLVM_ABI void
13461347
produceMLocTransferFunction(MachineFunction &MF,
13471348
SmallVectorImpl<MLocTransferMap> &MLocTransfer,
13481349
unsigned MaxNumBlocks);
@@ -1352,7 +1353,7 @@ class InstrRefBasedLDV : public LDVImpl {
13521353
/// live-out arrays to the (initialized to zero) multidimensional arrays in
13531354
/// \p MInLocs and \p MOutLocs. The outer dimension is indexed by block
13541355
/// number, the inner by LocIdx.
1355-
void buildMLocValueMap(MachineFunction &MF, FuncValueTable &MInLocs,
1356+
LLVM_ABI void buildMLocValueMap(MachineFunction &MF, FuncValueTable &MInLocs,
13561357
FuncValueTable &MOutLocs,
13571358
SmallVectorImpl<MLocTransferMap> &MLocTransfer);
13581359

@@ -1362,7 +1363,7 @@ class InstrRefBasedLDV : public LDVImpl {
13621363

13631364
/// Install PHI values into the live-in array for each block, according to
13641365
/// the IDF of each register.
1365-
void placeMLocPHIs(MachineFunction &MF,
1366+
LLVM_ABI void placeMLocPHIs(MachineFunction &MF,
13661367
SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
13671368
FuncValueTable &MInLocs,
13681369
SmallVectorImpl<MLocTransferMap> &MLocTransfer);
@@ -1422,7 +1423,7 @@ class InstrRefBasedLDV : public LDVImpl {
14221423
/// \p AssignBlocks contains the set of blocks that aren't in \p DILoc's
14231424
/// scope, but which do contain DBG_VALUEs, which VarLocBasedImpl tracks
14241425
/// locations through.
1425-
void buildVLocValueMap(const DILocation *DILoc,
1426+
LLVM_ABI void buildVLocValueMap(const DILocation *DILoc,
14261427
const SmallSet<DebugVariableID, 4> &VarsWeCareAbout,
14271428
SmallPtrSetImpl<MachineBasicBlock *> &AssignBlocks,
14281429
LiveInsT &Output, FuncValueTable &MOutLocs,
@@ -1436,7 +1437,7 @@ class InstrRefBasedLDV : public LDVImpl {
14361437
/// \p LiveIn Old live-in value, overwritten with new one if live-in changes.
14371438
/// \returns true if any live-ins change value, either from value propagation
14381439
/// or PHI elimination.
1439-
bool vlocJoin(MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
1440+
LLVM_ABI bool vlocJoin(MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
14401441
SmallPtrSet<const MachineBasicBlock *, 8> &BlocksToExplore,
14411442
DbgValue &LiveIn);
14421443

@@ -1445,7 +1446,7 @@ class InstrRefBasedLDV : public LDVImpl {
14451446
/// into that operand join together.
14461447
/// \returns true if a joined location was found for every value that needed
14471448
/// to be joined.
1448-
bool
1449+
LLVM_ABI bool
14491450
pickVPHILoc(SmallVectorImpl<DbgOpID> &OutValues, const MachineBasicBlock &MBB,
14501451
const LiveIdxT &LiveOuts, FuncValueTable &MOutLocs,
14511452
const SmallVectorImpl<const MachineBasicBlock *> &BlockOrders);
@@ -1461,7 +1462,7 @@ class InstrRefBasedLDV : public LDVImpl {
14611462

14621463
/// Boilerplate computation of some initial sets, artifical blocks and
14631464
/// RPOT block ordering.
1464-
void initialSetup(MachineFunction &MF);
1465+
LLVM_ABI void initialSetup(MachineFunction &MF);
14651466

14661467
/// Produce a map of the last lexical scope that uses a block, using the
14671468
/// scopes DFSOut number. Mapping is block-number to DFSOut.
@@ -1490,7 +1491,7 @@ class InstrRefBasedLDV : public LDVImpl {
14901491

14911492
public:
14921493
/// Default construct and initialize the pass.
1493-
InstrRefBasedLDV();
1494+
LLVM_ABI InstrRefBasedLDV();
14941495

14951496
LLVM_DUMP_METHOD
14961497
void dump_mloc_transfer(const MLocTransferMap &mloc_transfer) const;

llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef LLVM_LIB_CODEGEN_LIVEDEBUGVALUES_LIVEDEBUGVALUES_H
1010
#define LLVM_LIB_CODEGEN_LIVEDEBUGVALUES_LIVEDEBUGVALUES_H
1111

12+
#include "llvm/Support/Compiler.h"
13+
1214
namespace llvm {
1315
class MachineDominatorTree;
1416
class MachineFunction;
@@ -34,10 +36,10 @@ class LDVImpl {
3436
} // namespace SharedLiveDebugValues
3537

3638
// Factory functions for LiveDebugValues implementations.
37-
extern LDVImpl *makeVarLocBasedLiveDebugValues();
38-
extern LDVImpl *makeInstrRefBasedLiveDebugValues();
39+
LLVM_ABI extern LDVImpl *makeVarLocBasedLiveDebugValues();
40+
LLVM_ABI extern LDVImpl *makeInstrRefBasedLiveDebugValues();
3941

40-
extern bool debuginfoShouldUseDebugInstrRef(const Triple &T);
42+
LLVM_ABI extern bool debuginfoShouldUseDebugInstrRef(const Triple &T);
4143

4244
} // namespace llvm
4345

llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/Analysis/MLModelRunner.h"
1818
#include "llvm/CodeGen/MachineBasicBlock.h"
1919
#include "llvm/CodeGen/SlotIndexes.h"
20+
#include "llvm/Support/Compiler.h"
2021
#include <map>
2122

2223
namespace llvm {
@@ -32,7 +33,7 @@ struct LRStartEndInfo {
3233
size_t Pos = 0;
3334
};
3435

35-
void extractInstructionFeatures(
36+
LLVM_ABI void extractInstructionFeatures(
3637
llvm::SmallVectorImpl<LRStartEndInfo> &LRPosInfo,
3738
MLModelRunner *RegallocRunner, function_ref<int(SlotIndex)> GetOpcode,
3839
function_ref<float(SlotIndex)> GetMBBFreq,
@@ -41,7 +42,7 @@ void extractInstructionFeatures(
4142
const int MBBFreqIndex, const int MBBMappingIndex,
4243
const SlotIndex LastIndex);
4344

44-
void extractMBBFrequency(const SlotIndex CurrentIndex,
45+
LLVM_ABI void extractMBBFrequency(const SlotIndex CurrentIndex,
4546
const size_t CurrentInstructionIndex,
4647
std::map<MachineBasicBlock *, size_t> &VisitedMBBs,
4748
function_ref<float(SlotIndex)> GetMBBFreq,

llvm/lib/CodeGen/MachineDomTreeUpdater.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,22 @@
1414
#include "llvm/CodeGen/MachineDomTreeUpdater.h"
1515
#include "llvm/Analysis/GenericDomTreeUpdaterImpl.h"
1616
#include "llvm/CodeGen/MachinePostDominators.h"
17+
#include "llvm/Support/Compiler.h"
1718

1819
namespace llvm {
1920

20-
template class GenericDomTreeUpdater<
21+
template class LLVM_EXPORT_TEMPLATE GenericDomTreeUpdater<
2122
MachineDomTreeUpdater, MachineDominatorTree, MachinePostDominatorTree>;
2223

23-
template void
24+
template LLVM_EXPORT_TEMPLATE void
2425
GenericDomTreeUpdater<MachineDomTreeUpdater, MachineDominatorTree,
2526
MachinePostDominatorTree>::recalculate(MachineFunction
2627
&MF);
2728

28-
template void GenericDomTreeUpdater<
29+
template LLVM_EXPORT_TEMPLATE void GenericDomTreeUpdater<
2930
MachineDomTreeUpdater, MachineDominatorTree,
3031
MachinePostDominatorTree>::applyUpdatesImpl</*IsForward=*/true>();
31-
template void GenericDomTreeUpdater<
32+
template LLVM_EXPORT_TEMPLATE void GenericDomTreeUpdater<
3233
MachineDomTreeUpdater, MachineDominatorTree,
3334
MachinePostDominatorTree>::applyUpdatesImpl</*IsForward=*/false>();
3435

llvm/lib/CodeGen/MachineDominators.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/Pass.h"
1818
#include "llvm/PassRegistry.h"
1919
#include "llvm/Support/CommandLine.h"
20+
#include "llvm/Support/Compiler.h"
2021
#include "llvm/Support/GenericDomTreeConstruction.h"
2122

2223
using namespace llvm;
@@ -35,23 +36,23 @@ static cl::opt<bool, true> VerifyMachineDomInfoX(
3536
cl::desc("Verify machine dominator info (time consuming)"));
3637

3738
namespace llvm {
38-
template class DomTreeNodeBase<MachineBasicBlock>;
39-
template class DominatorTreeBase<MachineBasicBlock, false>; // DomTreeBase
39+
template class LLVM_EXPORT_TEMPLATE DomTreeNodeBase<MachineBasicBlock>;
40+
template class LLVM_EXPORT_TEMPLATE DominatorTreeBase<MachineBasicBlock, false>; // DomTreeBase
4041

4142
namespace DomTreeBuilder {
42-
template void Calculate<MBBDomTree>(MBBDomTree &DT);
43-
template void CalculateWithUpdates<MBBDomTree>(MBBDomTree &DT, MBBUpdates U);
43+
template LLVM_EXPORT_TEMPLATE void Calculate<MBBDomTree>(MBBDomTree &DT);
44+
template LLVM_EXPORT_TEMPLATE void CalculateWithUpdates<MBBDomTree>(MBBDomTree &DT, MBBUpdates U);
4445

45-
template void InsertEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
46+
template LLVM_EXPORT_TEMPLATE void InsertEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
4647
MachineBasicBlock *To);
4748

48-
template void DeleteEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
49+
template LLVM_EXPORT_TEMPLATE void DeleteEdge<MBBDomTree>(MBBDomTree &DT, MachineBasicBlock *From,
4950
MachineBasicBlock *To);
5051

51-
template void ApplyUpdates<MBBDomTree>(MBBDomTree &DT, MBBDomTreeGraphDiff &,
52+
template LLVM_EXPORT_TEMPLATE void ApplyUpdates<MBBDomTree>(MBBDomTree &DT, MBBDomTreeGraphDiff &,
5253
MBBDomTreeGraphDiff *);
5354

54-
template bool Verify<MBBDomTree>(const MBBDomTree &DT,
55+
template LLVM_EXPORT_TEMPLATE bool Verify<MBBDomTree>(const MBBDomTree &DT,
5556
MBBDomTree::VerificationLevel VL);
5657
} // namespace DomTreeBuilder
5758
}

llvm/lib/CodeGen/MachineLoopInfo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
#include "llvm/InitializePasses.h"
2323
#include "llvm/Pass.h"
2424
#include "llvm/PassRegistry.h"
25+
#include "llvm/Support/Compiler.h"
2526
#include "llvm/Support/GenericLoopInfoImpl.h"
2627

2728
using namespace llvm;
2829

2930
// Explicitly instantiate methods in LoopInfoImpl.h for MI-level Loops.
30-
template class llvm::LoopBase<MachineBasicBlock, MachineLoop>;
31-
template class llvm::LoopInfoBase<MachineBasicBlock, MachineLoop>;
31+
template class LLVM_EXPORT_TEMPLATE llvm::LoopBase<MachineBasicBlock, MachineLoop>;
32+
template class LLVM_EXPORT_TEMPLATE llvm::LoopInfoBase<MachineBasicBlock, MachineLoop>;
3233

3334
AnalysisKey MachineLoopAnalysis::Key;
3435

llvm/lib/CodeGen/MachinePassManager.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@
1717
#include "llvm/IR/Function.h"
1818
#include "llvm/IR/Module.h"
1919
#include "llvm/IR/PassManagerImpl.h"
20+
#include "llvm/Support/Compiler.h"
2021

2122
using namespace llvm;
2223

2324
AnalysisKey FunctionAnalysisManagerMachineFunctionProxy::Key;
2425

2526
namespace llvm {
26-
template class AnalysisManager<MachineFunction>;
27+
template class LLVM_EXPORT_TEMPLATE AnalysisManager<MachineFunction>;
2728
template class PassManager<MachineFunction>;
28-
template class InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
29+
template class LLVM_EXPORT_TEMPLATE InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
2930
Module>;
30-
template class InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
31+
template class LLVM_EXPORT_TEMPLATE InnerAnalysisManagerProxy<MachineFunctionAnalysisManager,
3132
Function>;
32-
template class OuterAnalysisManagerProxy<ModuleAnalysisManager,
33+
template class LLVM_EXPORT_TEMPLATE OuterAnalysisManagerProxy<ModuleAnalysisManager,
3334
MachineFunction>;
3435
} // namespace llvm
3536

0 commit comments

Comments
 (0)