diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 7e0a3cf5591ce..97bc063ad34e5 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -43,6 +43,7 @@ #include "llvm/ProfileData/InstrProfCorrelator.h" #include "llvm/Support/BuryPointer.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Program.h" @@ -96,8 +97,6 @@ using namespace llvm; #include "llvm/Support/Extension.def" namespace llvm { -extern cl::opt PrintPipelinePasses; - // Experiment to move sanitizers earlier. static cl::opt ClSanitizeOnOptimizerEarlyEP( "sanitizer-early-opt-ep", cl::Optional, @@ -118,7 +117,8 @@ static cl::opt ClPGOColdFuncAttr( clEnumValN(PGOOptions::ColdFuncOpt::OptNone, "optnone", "Mark cold functions with optnone."))); -extern cl::opt ProfileCorrelate; +LLVM_ABI extern cl::opt + ProfileCorrelate; } // namespace llvm namespace clang { extern llvm::cl::opt ClSanitizeGuardChecks; diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp index d684eeb696755..bf15def3f3b2e 100644 --- a/flang/lib/Frontend/FrontendActions.cpp +++ b/flang/lib/Frontend/FrontendActions.cpp @@ -74,10 +74,6 @@ #include #include -namespace llvm { -extern cl::opt PrintPipelinePasses; -} // namespace llvm - using namespace Fortran::frontend; constexpr llvm::StringLiteral timingIdParse = "Parse"; diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h index 13df838da3dad..a3ff0184d666d 100644 --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -673,7 +673,9 @@ class IEEEFloat final { integerPart addSignificand(const IEEEFloat &); integerPart subtractSignificand(const IEEEFloat &, integerPart); - lostFraction addOrSubtractSignificand(const IEEEFloat &, bool subtract); + // Exported for IEEEFloatUnitTestHelper. + LLVM_ABI lostFraction addOrSubtractSignificand(const IEEEFloat &, + bool subtract); lostFraction multiplySignificand(const IEEEFloat &, IEEEFloat, bool ignoreAddend = false); lostFraction multiplySignificand(const IEEEFloat&); diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index fe48c60466e96..164e9e52970d8 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -561,7 +561,7 @@ class [[nodiscard]] APInt { } /// Overload to compute a hash_code for an APInt value. - friend hash_code hash_value(const APInt &Arg); + LLVM_ABI_FRIEND friend hash_code hash_value(const APInt &Arg); /// This function returns a pointer to the internal storage of the APInt. /// This is useful for writing out the APInt in binary form without any diff --git a/llvm/include/llvm/ADT/DynamicAPInt.h b/llvm/include/llvm/ADT/DynamicAPInt.h index 48c5c6eac9013..373c0e6247969 100644 --- a/llvm/include/llvm/ADT/DynamicAPInt.h +++ b/llvm/include/llvm/ADT/DynamicAPInt.h @@ -212,7 +212,7 @@ class DynamicAPInt { friend DynamicAPInt operator/(int64_t A, const DynamicAPInt &B); friend DynamicAPInt operator%(int64_t A, const DynamicAPInt &B); - friend hash_code hash_value(const DynamicAPInt &x); // NOLINT + LLVM_ABI_FRIEND friend hash_code hash_value(const DynamicAPInt &x); // NOLINT LLVM_ABI void static_assert_layout(); // NOLINT diff --git a/llvm/include/llvm/Analysis/DXILResource.h b/llvm/include/llvm/Analysis/DXILResource.h index cfc21b3ec202b..07b0e97a20fce 100644 --- a/llvm/include/llvm/Analysis/DXILResource.h +++ b/llvm/include/llvm/Analysis/DXILResource.h @@ -34,7 +34,7 @@ namespace dxil { // Returns the resource name from dx_resource_handlefrombinding or // dx_resource_handlefromimplicitbinding call -StringRef getResourceNameFromBindingCall(CallInst *CI); +LLVM_ABI StringRef getResourceNameFromBindingCall(CallInst *CI); /// The dx.RawBuffer target extension type /// diff --git a/llvm/include/llvm/Analysis/IR2Vec.h b/llvm/include/llvm/Analysis/IR2Vec.h index de67955d85d7c..1eb4a9b8aaf9e 100644 --- a/llvm/include/llvm/Analysis/IR2Vec.h +++ b/llvm/include/llvm/Analysis/IR2Vec.h @@ -32,6 +32,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/IR/PassManager.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/JSON.h" #include @@ -57,9 +58,9 @@ enum class IR2VecKind { Symbolic }; namespace ir2vec { -extern cl::opt OpcWeight; -extern cl::opt TypeWeight; -extern cl::opt ArgWeight; +LLVM_ABI extern cl::opt OpcWeight; +LLVM_ABI extern cl::opt TypeWeight; +LLVM_ABI extern cl::opt ArgWeight; /// Embedding is a datatype that wraps std::vector. It provides /// additional functionality for arithmetic and comparison operations. @@ -106,16 +107,17 @@ struct Embedding { const std::vector &getData() const { return Data; } /// Arithmetic operators - Embedding &operator+=(const Embedding &RHS); - Embedding &operator-=(const Embedding &RHS); + LLVM_ABI Embedding &operator+=(const Embedding &RHS); + LLVM_ABI Embedding &operator-=(const Embedding &RHS); /// Adds Src Embedding scaled by Factor with the called Embedding. /// Called_Embedding += Src * Factor - Embedding &scaleAndAdd(const Embedding &Src, float Factor); + LLVM_ABI Embedding &scaleAndAdd(const Embedding &Src, float Factor); /// Returns true if the embedding is approximately equal to the RHS embedding /// within the specified tolerance. - bool approximatelyEquals(const Embedding &RHS, double Tolerance = 1e-6) const; + LLVM_ABI bool approximatelyEquals(const Embedding &RHS, + double Tolerance = 1e-6) const; }; using InstEmbeddingsMap = DenseMap; @@ -148,7 +150,7 @@ class Embedder { mutable BBEmbeddingsMap BBVecMap; mutable InstEmbeddingsMap InstVecMap; - Embedder(const Function &F, const Vocab &Vocabulary); + LLVM_ABI Embedder(const Function &F, const Vocab &Vocabulary); /// Helper function to compute embeddings. It generates embeddings for all /// the instructions and basic blocks in the function F. Logic of computing @@ -161,38 +163,38 @@ class Embedder { /// Lookup vocabulary for a given Key. If the key is not found, it returns a /// zero vector. - Embedding lookupVocab(const std::string &Key) const; + LLVM_ABI Embedding lookupVocab(const std::string &Key) const; public: virtual ~Embedder() = default; /// Factory method to create an Embedder object. - static Expected> + LLVM_ABI static Expected> create(IR2VecKind Mode, const Function &F, const Vocab &Vocabulary); /// Returns a map containing instructions and the corresponding embeddings for /// the function F if it has been computed. If not, it computes the embeddings /// for the function and returns the map. - const InstEmbeddingsMap &getInstVecMap() const; + LLVM_ABI const InstEmbeddingsMap &getInstVecMap() const; /// Returns a map containing basic block and the corresponding embeddings for /// the function F if it has been computed. If not, it computes the embeddings /// for the function and returns the map. - const BBEmbeddingsMap &getBBVecMap() const; + LLVM_ABI const BBEmbeddingsMap &getBBVecMap() const; /// Returns the embedding for a given basic block in the function F if it has /// been computed. If not, it computes the embedding for the basic block and /// returns it. - const Embedding &getBBVector(const BasicBlock &BB) const; + LLVM_ABI const Embedding &getBBVector(const BasicBlock &BB) const; /// Computes and returns the embedding for the current function. - const Embedding &getFunctionVector() const; + LLVM_ABI const Embedding &getFunctionVector() const; }; /// Class for computing the Symbolic embeddings of IR2Vec. /// Symbolic embeddings are constructed based on the entity-level /// representations obtained from the Vocabulary. -class SymbolicEmbedder : public Embedder { +class LLVM_ABI SymbolicEmbedder : public Embedder { private: /// Utility function to compute the embedding for a given type. Embedding getTypeEmbedding(const Type *Ty) const; @@ -219,13 +221,13 @@ class IR2VecVocabResult { public: IR2VecVocabResult() = default; - IR2VecVocabResult(ir2vec::Vocab &&Vocabulary); + LLVM_ABI IR2VecVocabResult(ir2vec::Vocab &&Vocabulary); bool isValid() const { return Valid; } - const ir2vec::Vocab &getVocabulary() const; - unsigned getDimension() const; - bool invalidate(Module &M, const PreservedAnalyses &PA, - ModuleAnalysisManager::Invalidator &Inv) const; + LLVM_ABI const ir2vec::Vocab &getVocabulary() const; + LLVM_ABI unsigned getDimension() const; + LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA, + ModuleAnalysisManager::Invalidator &Inv) const; }; /// This analysis provides the vocabulary for IR2Vec. The vocabulary provides a @@ -237,12 +239,12 @@ class IR2VecVocabAnalysis : public AnalysisInfoMixin { void emitError(Error Err, LLVMContext &Ctx); public: - static AnalysisKey Key; + LLVM_ABI static AnalysisKey Key; IR2VecVocabAnalysis() = default; - explicit IR2VecVocabAnalysis(const ir2vec::Vocab &Vocab); - explicit IR2VecVocabAnalysis(ir2vec::Vocab &&Vocab); + LLVM_ABI explicit IR2VecVocabAnalysis(const ir2vec::Vocab &Vocab); + LLVM_ABI explicit IR2VecVocabAnalysis(ir2vec::Vocab &&Vocab); using Result = IR2VecVocabResult; - Result run(Module &M, ModuleAnalysisManager &MAM); + LLVM_ABI Result run(Module &M, ModuleAnalysisManager &MAM); }; /// This pass prints the IR2Vec embeddings for instructions, basic blocks, and @@ -253,7 +255,7 @@ class IR2VecPrinterPass : public PassInfoMixin { public: explicit IR2VecPrinterPass(raw_ostream &OS) : OS(OS) {} - PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); + LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); static bool isRequired() { return true; } }; diff --git a/llvm/include/llvm/Analysis/ValueTracking.h b/llvm/include/llvm/Analysis/ValueTracking.h index e215c90b5a72a..1b0c57b917954 100644 --- a/llvm/include/llvm/Analysis/ValueTracking.h +++ b/llvm/include/llvm/Analysis/ValueTracking.h @@ -311,11 +311,11 @@ LLVM_ABI std::optional computeKnownFPSignBit(const Value *V, /// Return true if the sign bit of the FP value can be ignored by the user when /// the value is zero. -bool canIgnoreSignBitOfZero(const Use &U); +LLVM_ABI bool canIgnoreSignBitOfZero(const Use &U); /// Return true if the sign bit of the FP value can be ignored by the user when /// the value is NaN. -bool canIgnoreSignBitOfNaN(const Use &U); +LLVM_ABI bool canIgnoreSignBitOfNaN(const Use &U); /// If the specified value can be set by repeating the same byte in memory, /// return the i8 value that it is represented with. This is true for all i8 diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h index 6d625dad5853f..260535f8da21f 100644 --- a/llvm/include/llvm/BinaryFormat/DXContainer.h +++ b/llvm/include/llvm/BinaryFormat/DXContainer.h @@ -181,7 +181,7 @@ enum class DescriptorRangeType : uint32_t { #include "DXContainerConstants.def" }; -ArrayRef> getDescriptorRangeTypes(); +LLVM_ABI ArrayRef> getDescriptorRangeTypes(); #define ROOT_PARAMETER(Val, Enum) \ case Val: \ 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(CallLowering::ArgInfo &Arg, unsigned OpIdx, + const DataLayout &DL, + const Function &FuncInfo) const; + +extern template LLVM_ABI void +CallLowering::setArgFlags(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 @@ -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/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h index 32e8247ac4c22..4723f00a4d241 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h @@ -10,6 +10,7 @@ #define LLVM_DEBUGINFO_DWARF_DWARFCFIPRINTER_H #include "llvm/DebugInfo/DWARF/DWARFCFIProgram.h" +#include "llvm/Support/Compiler.h" namespace llvm { @@ -17,9 +18,10 @@ struct DIDumpOptions; namespace dwarf { -void printCFIProgram(const CFIProgram &P, raw_ostream &OS, - const DIDumpOptions &DumpOpts, unsigned IndentLevel, - std::optional Address); +LLVM_ABI void printCFIProgram(const CFIProgram &P, raw_ostream &OS, + const DIDumpOptions &DumpOpts, + unsigned IndentLevel, + std::optional Address); } // end namespace dwarf diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h index ad7358c28f16b..1d89ac3578c10 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h @@ -106,11 +106,11 @@ class CFIProgram { }; /// Get the OperandType as a "const char *". - static const char *operandTypeString(OperandType OT); + LLVM_ABI static const char *operandTypeString(OperandType OT); /// Retrieve the array describing the types of operands according to the enum /// above. This is indexed by opcode. - static ArrayRef getOperandTypes(); + LLVM_ABI static ArrayRef getOperandTypes(); private: std::vector Instructions; diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h index 44432d3219111..ea414278c35d6 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h @@ -186,8 +186,9 @@ class DWARFExpressionPrinter { /// \param E to be printed /// \param OS to this stream /// \param GetNameForDWARFReg callback to return dwarf register name - static void print(const DWARFExpression *E, raw_ostream &OS, - DIDumpOptions DumpOpts, DWARFUnit *U, bool IsEH = false); + LLVM_ABI static void print(const DWARFExpression *E, raw_ostream &OS, + DIDumpOptions DumpOpts, DWARFUnit *U, + bool IsEH = false); /// Print the expression in a format intended to be compact and useful to a /// user, but not perfectly unambiguous, or capable of representing every @@ -199,9 +200,10 @@ class DWARFExpressionPrinter { /// \param GetNameForDWARFReg callback to return dwarf register name /// /// \returns true if the expression was successfully printed - static bool printCompact(const DWARFExpression *E, raw_ostream &OS, - std::function - GetNameForDWARFReg = nullptr); + LLVM_ABI static bool printCompact( + const DWARFExpression *E, raw_ostream &OS, + std::function GetNameForDWARFReg = + nullptr); /// Pretty print a register opcode and operands. /// \param U within the context of this Dwarf unit, if any. @@ -211,9 +213,10 @@ class DWARFExpressionPrinter { /// \param Operands to the opcode /// /// returns true if the Op was successfully printed - static bool prettyPrintRegisterOp(DWARFUnit *U, raw_ostream &OS, - DIDumpOptions DumpOpts, uint8_t Opcode, - ArrayRef Operands); + LLVM_ABI static bool prettyPrintRegisterOp(DWARFUnit *U, raw_ostream &OS, + DIDumpOptions DumpOpts, + uint8_t Opcode, + ArrayRef Operands); private: static bool printOp(const DWARFExpression::Operation *Op, raw_ostream &OS, diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSourceLanguage.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSourceLanguage.h index 52e4aa9701e44..f4ebfc914ad05 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSourceLanguage.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSourceLanguage.h @@ -17,6 +17,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/DebugInfo/CodeView/CodeView.h" +#include "llvm/Support/Compiler.h" namespace llvm { namespace logicalview { @@ -52,7 +53,7 @@ struct LVSourceLanguage { bool isValid() const { return Language != Invalid; } TaggedLanguage get() const { return Language; } - StringRef getName() const; + LLVM_ABI StringRef getName() const; private: TaggedLanguage Language = Invalid; diff --git a/llvm/include/llvm/ExecutionEngine/Orc/COFF.h b/llvm/include/llvm/ExecutionEngine/Orc/COFF.h index adc9e9e171165..42a6c85a577fa 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/COFF.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/COFF.h @@ -13,6 +13,7 @@ #ifndef LLVM_EXECUTIONENGINE_ORC_COFF_H #define LLVM_EXECUTIONENGINE_ORC_COFF_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include "llvm/Support/MemoryBuffer.h" @@ -31,8 +32,8 @@ class COFFImportFileScanner { public: COFFImportFileScanner(std::set &ImportedDynamicLibraries) : ImportedDynamicLibraries(ImportedDynamicLibraries) {} - Expected operator()(object::Archive &A, MemoryBufferRef MemberBuf, - size_t Index) const; + LLVM_ABI Expected + operator()(object::Archive &A, MemoryBufferRef MemberBuf, size_t Index) const; private: std::set &ImportedDynamicLibraries; diff --git a/llvm/include/llvm/Frontend/Directive/Spelling.h b/llvm/include/llvm/Frontend/Directive/Spelling.h index a101489603254..a13e26e88823d 100644 --- a/llvm/include/llvm/Frontend/Directive/Spelling.h +++ b/llvm/include/llvm/Frontend/Directive/Spelling.h @@ -10,6 +10,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/iterator_range.h" +#include "llvm/Support/Compiler.h" #include #include @@ -33,7 +34,8 @@ struct Spelling { VersionRange Versions; }; -StringRef FindName(llvm::iterator_range, unsigned Version); +LLVM_ABI StringRef FindName(llvm::iterator_range, + unsigned Version); } // namespace llvm::directive diff --git a/llvm/include/llvm/Frontend/Driver/CodeGenOptions.h b/llvm/include/llvm/Frontend/Driver/CodeGenOptions.h index f0168c0407884..17ba28b6de443 100644 --- a/llvm/include/llvm/Frontend/Driver/CodeGenOptions.h +++ b/llvm/include/llvm/Frontend/Driver/CodeGenOptions.h @@ -63,7 +63,7 @@ enum ProfileInstrKind { }; // Default filename used for profile generation. -std::string getDefaultProfileGenName(); +LLVM_ABI std::string getDefaultProfileGenName(); } // end namespace llvm::driver #endif diff --git a/llvm/include/llvm/Frontend/HLSL/HLSLRootSignatureUtils.h b/llvm/include/llvm/Frontend/HLSL/HLSLRootSignatureUtils.h index 25c2a9f0cc808..e7ceb9597028b 100644 --- a/llvm/include/llvm/Frontend/HLSL/HLSLRootSignatureUtils.h +++ b/llvm/include/llvm/Frontend/HLSL/HLSLRootSignatureUtils.h @@ -93,10 +93,11 @@ class ResourceRange { // Returns a reference to the first RangeInfo that overlaps with // [Info.LowerBound;Info.UpperBound], or, std::nullopt if there is no overlap - std::optional getOverlapping(const RangeInfo &Info) const; + LLVM_ABI std::optional + getOverlapping(const RangeInfo &Info) const; // Return the mapped RangeInfo at X or nullptr if no mapping exists - const RangeInfo *lookup(uint32_t X) const; + LLVM_ABI const RangeInfo *lookup(uint32_t X) const; // Insert the required (sub-)intervals such that the interval of [a;b] = // [Info.LowerBound, Info.UpperBound] is covered and points to a valid @@ -124,7 +125,7 @@ class ResourceRange { // Returns a reference to the first RangeInfo that overlaps with // [Info.LowerBound;Info.UpperBound], or, std::nullopt if there is no overlap // (equivalent to getOverlapping) - std::optional insert(const RangeInfo &Info); + LLVM_ABI std::optional insert(const RangeInfo &Info); }; } // namespace rootsig diff --git a/llvm/include/llvm/Support/ConvertUTF.h b/llvm/include/llvm/Support/ConvertUTF.h index 3bb238e7df2ed..bb1723518a490 100644 --- a/llvm/include/llvm/Support/ConvertUTF.h +++ b/llvm/include/llvm/Support/ConvertUTF.h @@ -346,9 +346,9 @@ LLVM_ABI bool convertUTF32ToUTF8String(ArrayRef Src, std::string &Out); LLVM_ABI bool convertUTF8ToUTF16String(StringRef SrcUTF8, SmallVectorImpl &DstUTF16); -bool IsSingleCodeUnitUTF8Codepoint(unsigned); -bool IsSingleCodeUnitUTF16Codepoint(unsigned); -bool IsSingleCodeUnitUTF32Codepoint(unsigned); +LLVM_ABI bool IsSingleCodeUnitUTF8Codepoint(unsigned); +LLVM_ABI bool IsSingleCodeUnitUTF16Codepoint(unsigned); +LLVM_ABI bool IsSingleCodeUnitUTF32Codepoint(unsigned); #if defined(_WIN32) namespace sys { diff --git a/llvm/include/llvm/Support/KnownFPClass.h b/llvm/include/llvm/Support/KnownFPClass.h index 9ebdf260e0ec7..b3c18bcf6b34b 100644 --- a/llvm/include/llvm/Support/KnownFPClass.h +++ b/llvm/include/llvm/Support/KnownFPClass.h @@ -15,6 +15,7 @@ #define LLVM_SUPPORT_KNOWNFPCLASS_H #include "llvm/ADT/FloatingPointMode.h" +#include "llvm/Support/Compiler.h" #include namespace llvm { @@ -78,13 +79,13 @@ struct KnownFPClass { /// Return true if it's know this can never be interpreted as a zero. This /// extends isKnownNeverZero to cover the case where the assumed /// floating-point mode for the function interprets denormals as zero. - bool isKnownNeverLogicalZero(DenormalMode Mode) const; + LLVM_ABI bool isKnownNeverLogicalZero(DenormalMode Mode) const; /// Return true if it's know this can never be interpreted as a negative zero. - bool isKnownNeverLogicalNegZero(DenormalMode Mode) const; + LLVM_ABI bool isKnownNeverLogicalNegZero(DenormalMode Mode) const; /// Return true if it's know this can never be interpreted as a positive zero. - bool isKnownNeverLogicalPosZero(DenormalMode Mode) const; + LLVM_ABI bool isKnownNeverLogicalPosZero(DenormalMode Mode) const; static constexpr FPClassTest OrderedLessThanZeroMask = fcNegSubnormal | fcNegNormal | fcNegInf; @@ -209,7 +210,7 @@ struct KnownFPClass { /// /// This assumes a copy-like operation and will replace any currently known /// information. - void propagateDenormal(const KnownFPClass &Src, DenormalMode Mode); + LLVM_ABI void propagateDenormal(const KnownFPClass &Src, DenormalMode Mode); /// Report known classes if \p Src is evaluated through a potentially /// canonicalizing operation. We can assume signaling nans will not be @@ -217,7 +218,8 @@ struct KnownFPClass { /// /// This assumes a copy-like operation and will replace any currently known /// information. - void propagateCanonicalizingSrc(const KnownFPClass &Src, DenormalMode Mode); + LLVM_ABI void propagateCanonicalizingSrc(const KnownFPClass &Src, + DenormalMode Mode); void resetAll() { *this = KnownFPClass(); } }; diff --git a/llvm/include/llvm/Support/ProgramStack.h b/llvm/include/llvm/Support/ProgramStack.h index 55964c9779209..0dd8235b90c06 100644 --- a/llvm/include/llvm/Support/ProgramStack.h +++ b/llvm/include/llvm/Support/ProgramStack.h @@ -10,6 +10,7 @@ #define LLVM_SUPPORT_PROGRAMSTACK_H #include "llvm/ADT/STLFunctionalExtras.h" +#include "llvm/Support/Compiler.h" // LLVM_HAS_SPLIT_STACKS is exposed in the header because CrashRecoveryContext // needs to know if it's running on another thread or not. @@ -28,12 +29,12 @@ namespace llvm { /// /// The value is not guaranteed to point to anything specific. It can be used to /// estimate how much stack space has been used since the previous call. -uintptr_t getStackPointer(); +LLVM_ABI uintptr_t getStackPointer(); /// \returns the default stack size for this platform. /// /// Based on \p RLIMIT_STACK or the equivalent. -unsigned getDefaultStackSize(); +LLVM_ABI unsigned getDefaultStackSize(); /// Runs Fn on a new stack of at least the given size. /// @@ -42,7 +43,7 @@ unsigned getDefaultStackSize(); /// /// The preferred implementation is split stacks on platforms that have a good /// debugging experience for them. On other platforms a new thread is used. -void runOnNewStack(unsigned StackSize, function_ref Fn); +LLVM_ABI void runOnNewStack(unsigned StackSize, function_ref Fn); template std::enable_if_t, R> diff --git a/llvm/include/llvm/Support/TextEncoding.h b/llvm/include/llvm/Support/TextEncoding.h index e204b95dd2dd7..8a304910aa5dd 100644 --- a/llvm/include/llvm/Support/TextEncoding.h +++ b/llvm/include/llvm/Support/TextEncoding.h @@ -18,6 +18,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/Config/config.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorOr.h" #include @@ -92,8 +93,8 @@ class TextEncodingConverter { /// \param[in] From the source character encoding /// \param[in] To the target character encoding /// \return a TextEncodingConverter instance or an error code - static ErrorOr create(TextEncoding From, - TextEncoding To); + LLVM_ABI static ErrorOr create(TextEncoding From, + TextEncoding To); /// Creates a TextEncodingConverter instance. /// Returns std::errc::invalid_argument in case the requested conversion is @@ -101,7 +102,8 @@ class TextEncodingConverter { /// \param[in] From name of the source character encoding /// \param[in] To name of the target character encoding /// \return a TextEncodingConverter instance or an error code - static ErrorOr create(StringRef From, StringRef To); + LLVM_ABI static ErrorOr create(StringRef From, + StringRef To); TextEncodingConverter(const TextEncodingConverter &) = delete; TextEncodingConverter &operator=(const TextEncodingConverter &) = delete; diff --git a/llvm/include/llvm/Support/Timer.h b/llvm/include/llvm/Support/Timer.h index 36890c75a65e3..c303ff06f3de9 100644 --- a/llvm/include/llvm/Support/Timer.h +++ b/llvm/include/llvm/Support/Timer.h @@ -258,7 +258,7 @@ class TimerGroup { private: friend class Timer; - friend void PrintStatisticsJSON(raw_ostream &OS); + LLVM_ABI_FRIEND friend void PrintStatisticsJSON(raw_ostream &OS); void addTimer(Timer &T); void removeTimer(Timer &T); void prepareToPrintList(bool reset_time = false); diff --git a/llvm/include/llvm/Telemetry/Telemetry.h b/llvm/include/llvm/Telemetry/Telemetry.h index bc0056ec7e848..708ec439ed40f 100644 --- a/llvm/include/llvm/Telemetry/Telemetry.h +++ b/llvm/include/llvm/Telemetry/Telemetry.h @@ -17,6 +17,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include #include @@ -101,7 +102,7 @@ struct EntryKind { /// For example, The LLDB debugger can define a DebugCommandInfo subclass /// which has additional fields about the debug-command being instrumented, /// such as `CommandArguments` or `CommandName`. -struct TelemetryInfo { +struct LLVM_ABI TelemetryInfo { // This represents a unique-id, conventionally corresponding to // a tool's session - i.e., every time the tool starts until it exits. // @@ -141,10 +142,15 @@ class Destination { /// and this framework. /// It is responsible for collecting telemetry data from the tool being /// monitored and transmitting the data elsewhere. -class Manager { +class LLVM_ABI Manager { public: + Manager() = default; virtual ~Manager() = default; + // Explicitly non-copyable. + Manager(Manager const &) = delete; + Manager &operator=(Manager const &) = delete; + // Dispatch Telemetry data to the Destination(s). // The argument is non-const because the Manager may add or remove // data from the entry. diff --git a/llvm/include/llvm/ToolDrivers/llvm-dlltool/DlltoolDriver.h b/llvm/include/llvm/ToolDrivers/llvm-dlltool/DlltoolDriver.h index d144f62f1cc1a..30a260c52f1d9 100644 --- a/llvm/include/llvm/ToolDrivers/llvm-dlltool/DlltoolDriver.h +++ b/llvm/include/llvm/ToolDrivers/llvm-dlltool/DlltoolDriver.h @@ -14,10 +14,12 @@ #ifndef LLVM_TOOLDRIVERS_LLVM_DLLTOOL_DLLTOOLDRIVER_H #define LLVM_TOOLDRIVERS_LLVM_DLLTOOL_DLLTOOLDRIVER_H +#include "llvm/Support/Compiler.h" + namespace llvm { template class ArrayRef; -int dlltoolDriverMain(ArrayRef ArgsArr); +LLVM_ABI int dlltoolDriverMain(ArrayRef ArgsArr); } // namespace llvm #endif diff --git a/llvm/include/llvm/ToolDrivers/llvm-lib/LibDriver.h b/llvm/include/llvm/ToolDrivers/llvm-lib/LibDriver.h index 23a2fc348a892..43fc5d72d3a89 100644 --- a/llvm/include/llvm/ToolDrivers/llvm-lib/LibDriver.h +++ b/llvm/include/llvm/ToolDrivers/llvm-lib/LibDriver.h @@ -14,11 +14,12 @@ #ifndef LLVM_TOOLDRIVERS_LLVM_LIB_LIBDRIVER_H #define LLVM_TOOLDRIVERS_LLVM_LIB_LIBDRIVER_H +#include "llvm/Support/Compiler.h" + namespace llvm { template class ArrayRef; -int libDriverMain(ArrayRef ARgs); - +LLVM_ABI int libDriverMain(ArrayRef ARgs); } #endif diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h index f19f3292c4798..27e8155d4aa6b 100644 --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -6349,8 +6349,8 @@ struct AAInvariantLoadPointer : public AbstractAttribute { } /// Create an abstract attribute view for the position \p IRP. - static AAInvariantLoadPointer &createForPosition(const IRPosition &IRP, - Attributor &A); + LLVM_ABI static AAInvariantLoadPointer & + createForPosition(const IRPosition &IRP, Attributor &A); /// Return true if the pointer's contents are known to remain invariant. virtual bool isKnownInvariant() const = 0; @@ -6373,7 +6373,7 @@ struct AAInvariantLoadPointer : public AbstractAttribute { } /// Unique ID (due to the unique address). - static const char ID; + LLVM_ABI static const char ID; }; /// An abstract interface for address space information. diff --git a/llvm/include/llvm/WindowsDriver/MSVCPaths.h b/llvm/include/llvm/WindowsDriver/MSVCPaths.h index 51ffd6b6bc2c2..076c2eaf9c3f0 100644 --- a/llvm/include/llvm/WindowsDriver/MSVCPaths.h +++ b/llvm/include/llvm/WindowsDriver/MSVCPaths.h @@ -11,6 +11,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" #include "llvm/TargetParser/Triple.h" #include #include @@ -36,58 +37,64 @@ enum class ToolsetLayout { // Windows SDKs and VC Toolchains group their contents into subdirectories based // on the target architecture. This function converts an llvm::Triple::ArchType // to the corresponding subdirectory name. -const char *archToWindowsSDKArch(llvm::Triple::ArchType Arch); +LLVM_ABI const char *archToWindowsSDKArch(llvm::Triple::ArchType Arch); // Similar to the above function, but for Visual Studios before VS2017. -const char *archToLegacyVCArch(llvm::Triple::ArchType Arch); +LLVM_ABI const char *archToLegacyVCArch(llvm::Triple::ArchType Arch); // Similar to the above function, but for DevDiv internal builds. -const char *archToDevDivInternalArch(llvm::Triple::ArchType Arch); +LLVM_ABI const char *archToDevDivInternalArch(llvm::Triple::ArchType Arch); -bool appendArchToWindowsSDKLibPath(int SDKMajor, llvm::SmallString<128> LibPath, - llvm::Triple::ArchType Arch, - std::string &path); +LLVM_ABI bool appendArchToWindowsSDKLibPath(int SDKMajor, + llvm::SmallString<128> LibPath, + llvm::Triple::ArchType Arch, + std::string &path); // Get the path to a specific subdirectory in the current toolchain for // a given target architecture. // VS2017 changed the VC toolchain layout, so this should be used instead // of hardcoding paths. -std::string getSubDirectoryPath(SubDirectoryType Type, ToolsetLayout VSLayout, - const std::string &VCToolChainPath, - llvm::Triple::ArchType TargetArch, - llvm::StringRef SubdirParent = ""); +LLVM_ABI std::string getSubDirectoryPath(SubDirectoryType Type, + ToolsetLayout VSLayout, + const std::string &VCToolChainPath, + llvm::Triple::ArchType TargetArch, + llvm::StringRef SubdirParent = ""); // Check if the Include path of a specified version of Visual Studio contains // specific header files. If not, they are probably shipped with Universal CRT. -bool useUniversalCRT(ToolsetLayout VSLayout, const std::string &VCToolChainPath, - llvm::Triple::ArchType TargetArch, - llvm::vfs::FileSystem &VFS); +LLVM_ABI bool useUniversalCRT(ToolsetLayout VSLayout, + const std::string &VCToolChainPath, + llvm::Triple::ArchType TargetArch, + llvm::vfs::FileSystem &VFS); /// Get Windows SDK installation directory. -bool getWindowsSDKDir(vfs::FileSystem &VFS, +LLVM_ABI bool getWindowsSDKDir(vfs::FileSystem &VFS, + std::optional WinSdkDir, + std::optional WinSdkVersion, + std::optional WinSysRoot, + std::string &Path, int &Major, + std::string &WindowsSDKIncludeVersion, + std::string &WindowsSDKLibVersion); + +LLVM_ABI bool +getUniversalCRTSdkDir(vfs::FileSystem &VFS, std::optional WinSdkDir, std::optional WinSdkVersion, std::optional WinSysRoot, - std::string &Path, int &Major, - std::string &WindowsSDKIncludeVersion, - std::string &WindowsSDKLibVersion); - -bool getUniversalCRTSdkDir(vfs::FileSystem &VFS, - std::optional WinSdkDir, - std::optional WinSdkVersion, - std::optional WinSysRoot, - std::string &Path, std::string &UCRTVersion); + std::string &Path, std::string &UCRTVersion); // Check command line arguments to try and find a toolchain. -bool findVCToolChainViaCommandLine( - vfs::FileSystem &VFS, std::optional VCToolsDir, - std::optional VCToolsVersion, - std::optional WinSysRoot, std::string &Path, - ToolsetLayout &VSLayout); +LLVM_ABI bool +findVCToolChainViaCommandLine(vfs::FileSystem &VFS, + std::optional VCToolsDir, + std::optional VCToolsVersion, + std::optional WinSysRoot, + std::string &Path, ToolsetLayout &VSLayout); // Check various environment variables to try and find a toolchain. -bool findVCToolChainViaEnvironment(vfs::FileSystem &VFS, std::string &Path, - ToolsetLayout &VSLayout); +LLVM_ABI bool findVCToolChainViaEnvironment(vfs::FileSystem &VFS, + std::string &Path, + ToolsetLayout &VSLayout); // Query the Setup Config server for installs, then pick the newest version // and find its default VC toolchain. If `VCToolsVersion` is specified, that @@ -95,7 +102,7 @@ bool findVCToolChainViaEnvironment(vfs::FileSystem &VFS, std::string &Path, // // This is the preferred way to discover new Visual Studios, as they're no // longer listed in the registry. -bool +LLVM_ABI bool findVCToolChainViaSetupConfig(vfs::FileSystem &VFS, std::optional VCToolsVersion, std::string &Path, ToolsetLayout &VSLayout); @@ -103,7 +110,8 @@ findVCToolChainViaSetupConfig(vfs::FileSystem &VFS, // Look in the registry for Visual Studio installs, and use that to get // a toolchain path. VS2017 and newer don't get added to the registry. // So if we find something here, we know that it's an older version. -bool findVCToolChainViaRegistry(std::string &Path, ToolsetLayout &VSLayout); +LLVM_ABI bool findVCToolChainViaRegistry(std::string &Path, + ToolsetLayout &VSLayout); } // namespace llvm diff --git a/llvm/include/llvm/WindowsManifest/WindowsManifestMerger.h b/llvm/include/llvm/WindowsManifest/WindowsManifestMerger.h index 2da74bb9dce8c..0c938aceeebb0 100644 --- a/llvm/include/llvm/WindowsManifest/WindowsManifestMerger.h +++ b/llvm/include/llvm/WindowsManifest/WindowsManifestMerger.h @@ -25,6 +25,7 @@ #ifndef LLVM_WINDOWSMANIFEST_WINDOWSMANIFESTMERGER_H #define LLVM_WINDOWSMANIFEST_WINDOWSMANIFESTMERGER_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" namespace llvm { @@ -34,9 +35,10 @@ class MemoryBufferRef; namespace windows_manifest { -bool isAvailable(); +LLVM_ABI bool isAvailable(); -class WindowsManifestError : public ErrorInfo { +class LLVM_ABI WindowsManifestError + : public ErrorInfo { public: static char ID; WindowsManifestError(const Twine &Msg); @@ -48,13 +50,13 @@ class WindowsManifestError : public ErrorInfo { class WindowsManifestMerger { public: - WindowsManifestMerger(); - ~WindowsManifestMerger(); - Error merge(MemoryBufferRef Manifest); + LLVM_ABI WindowsManifestMerger(); + LLVM_ABI ~WindowsManifestMerger(); + LLVM_ABI Error merge(MemoryBufferRef Manifest); // Returns vector containing merged xml manifest, or uninitialized vector for // empty manifest. - std::unique_ptr getMergedManifest(); + LLVM_ABI std::unique_ptr getMergedManifest(); private: class WindowsManifestMergerImpl; 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/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::recalculate(MachineFunction &MF); -template void GenericDomTreeUpdater< +template LLVM_EXPORT_TEMPLATE void GenericDomTreeUpdater< MachineDomTreeUpdater, MachineDominatorTree, MachinePostDominatorTree>::applyUpdatesImpl(); -template void GenericDomTreeUpdater< +template LLVM_EXPORT_TEMPLATE void GenericDomTreeUpdater< MachineDomTreeUpdater, MachineDominatorTree, MachinePostDominatorTree>::applyUpdatesImpl(); 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 VerifyMachineDomInfoX( cl::desc("Verify machine dominator info (time consuming)")); namespace llvm { -template class DomTreeNodeBase; -template class DominatorTreeBase; // DomTreeBase +template class LLVM_EXPORT_TEMPLATE DomTreeNodeBase; +template class LLVM_EXPORT_TEMPLATE + DominatorTreeBase; // DomTreeBase namespace DomTreeBuilder { -template void Calculate(MBBDomTree &DT); -template void CalculateWithUpdates(MBBDomTree &DT, MBBUpdates U); +template LLVM_EXPORT_TEMPLATE void Calculate(MBBDomTree &DT); +template LLVM_EXPORT_TEMPLATE void +CalculateWithUpdates(MBBDomTree &DT, MBBUpdates U); -template void InsertEdge(MBBDomTree &DT, MachineBasicBlock *From, - MachineBasicBlock *To); +template LLVM_EXPORT_TEMPLATE void +InsertEdge(MBBDomTree &DT, MachineBasicBlock *From, + MachineBasicBlock *To); -template void DeleteEdge(MBBDomTree &DT, MachineBasicBlock *From, - MachineBasicBlock *To); +template LLVM_EXPORT_TEMPLATE void +DeleteEdge(MBBDomTree &DT, MachineBasicBlock *From, + MachineBasicBlock *To); -template void ApplyUpdates(MBBDomTree &DT, MBBDomTreeGraphDiff &, - MBBDomTreeGraphDiff *); +template LLVM_EXPORT_TEMPLATE void +ApplyUpdates(MBBDomTree &DT, MBBDomTreeGraphDiff &, + MBBDomTreeGraphDiff *); -template bool Verify(const MBBDomTree &DT, - MBBDomTree::VerificationLevel VL); +template LLVM_EXPORT_TEMPLATE bool +Verify(const MBBDomTree &DT, MBBDomTree::VerificationLevel VL); } // namespace DomTreeBuilder } diff --git a/llvm/lib/CodeGen/MachineLoopInfo.cpp b/llvm/lib/CodeGen/MachineLoopInfo.cpp index 1c97e5c9063e4..fdb1a470493ce 100644 --- a/llvm/lib/CodeGen/MachineLoopInfo.cpp +++ b/llvm/lib/CodeGen/MachineLoopInfo.cpp @@ -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; -template class llvm::LoopInfoBase; +template class LLVM_EXPORT_TEMPLATE + llvm::LoopBase; +template class LLVM_EXPORT_TEMPLATE + llvm::LoopInfoBase; AnalysisKey MachineLoopAnalysis::Key; diff --git a/llvm/lib/CodeGen/MachinePassManager.cpp b/llvm/lib/CodeGen/MachinePassManager.cpp index bbe386507fcd2..6e445f6787903 100644 --- a/llvm/lib/CodeGen/MachinePassManager.cpp +++ b/llvm/lib/CodeGen/MachinePassManager.cpp @@ -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; +template class LLVM_EXPORT_TEMPLATE AnalysisManager; template class PassManager; -template class InnerAnalysisManagerProxy; -template class InnerAnalysisManagerProxy; -template class OuterAnalysisManagerProxy; +template class LLVM_EXPORT_TEMPLATE + InnerAnalysisManagerProxy; +template class LLVM_EXPORT_TEMPLATE + InnerAnalysisManagerProxy; +template class LLVM_EXPORT_TEMPLATE + OuterAnalysisManagerProxy; } // namespace llvm bool FunctionAnalysisManagerMachineFunctionProxy::Result::invalidate( diff --git a/llvm/lib/CodeGen/MachinePostDominators.cpp b/llvm/lib/CodeGen/MachinePostDominators.cpp index 51637130addc4..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 DominatorTreeBase; // PostDomTreeBase +template class LLVM_EXPORT_TEMPLATE + DominatorTreeBase; // PostDomTreeBase namespace DomTreeBuilder { -template void Calculate(MBBPostDomTree &DT); -template void InsertEdge(MBBPostDomTree &DT, - MachineBasicBlock *From, - MachineBasicBlock *To); -template void DeleteEdge(MBBPostDomTree &DT, - MachineBasicBlock *From, - MachineBasicBlock *To); -template void ApplyUpdates(MBBPostDomTree &DT, - MBBPostDomTreeGraphDiff &, - MBBPostDomTreeGraphDiff *); -template bool Verify(const MBBPostDomTree &DT, - MBBPostDomTree::VerificationLevel VL); +template LLVM_EXPORT_TEMPLATE void +Calculate(MBBPostDomTree &DT); +template LLVM_EXPORT_TEMPLATE void +InsertEdge(MBBPostDomTree &DT, MachineBasicBlock *From, + MachineBasicBlock *To); +template LLVM_EXPORT_TEMPLATE void +DeleteEdge(MBBPostDomTree &DT, MachineBasicBlock *From, + MachineBasicBlock *To); +template LLVM_EXPORT_TEMPLATE void +ApplyUpdates(MBBPostDomTree &DT, MBBPostDomTreeGraphDiff &, + MBBPostDomTreeGraphDiff *); +template LLVM_EXPORT_TEMPLATE bool +Verify(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 8c140261c11ca..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; -cl::opt CopyWeight("regalloc-copy-weight", cl::init(0.2), cl::Hidden); -cl::opt LoadWeight("regalloc-load-weight", cl::init(4.0), cl::Hidden); -cl::opt StoreWeight("regalloc-store-weight", cl::init(1.0), cl::Hidden); -cl::opt CheapRematWeight("regalloc-cheap-remat-weight", cl::init(0.2), - cl::Hidden); -cl::opt ExpensiveRematWeight("regalloc-expensive-remat-weight", - cl::init(1.0), cl::Hidden); +LLVM_ABI cl::opt CopyWeight("regalloc-copy-weight", cl::init(0.2), + cl::Hidden); +LLVM_ABI cl::opt LoadWeight("regalloc-load-weight", cl::init(4.0), + cl::Hidden); +LLVM_ABI cl::opt StoreWeight("regalloc-store-weight", cl::init(1.0), + cl::Hidden); +LLVM_ABI cl::opt CheapRematWeight("regalloc-cheap-remat-weight", + cl::init(0.2), cl::Hidden); +LLVM_ABI cl::opt ExpensiveRematWeight("regalloc-expensive-remat-weight", + cl::init(1.0), cl::Hidden); #define DEBUG_TYPE "regalloc-score" RegAllocScore &RegAllocScore::operator+=(const RegAllocScore &Other) { diff --git a/llvm/lib/Transforms/Utils/CloneModule.cpp b/llvm/lib/Transforms/Utils/CloneModule.cpp index 55fb0acd39eae..ae6234c1349d6 100644 --- a/llvm/lib/Transforms/Utils/CloneModule.cpp +++ b/llvm/lib/Transforms/Utils/CloneModule.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm-c/Core.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Module.h" #include "llvm/Transforms/Utils/Cloning.h" diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.cpp b/llvm/tools/llvm-profgen/ProfileGenerator.cpp index b47c77c5f2ff3..db686c3b597eb 100644 --- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp +++ b/llvm/tools/llvm-profgen/ProfileGenerator.cpp @@ -108,8 +108,6 @@ using namespace llvm; using namespace sampleprof; namespace llvm { -extern cl::opt ProfileSummaryCutoffHot; -extern cl::opt UseContextLessSummary; namespace sampleprof { diff --git a/llvm/unittests/Analysis/MemoryProfileInfoTest.cpp b/llvm/unittests/Analysis/MemoryProfileInfoTest.cpp index 6eef0b5f91719..aa4d712cde09e 100644 --- a/llvm/unittests/Analysis/MemoryProfileInfoTest.cpp +++ b/llvm/unittests/Analysis/MemoryProfileInfoTest.cpp @@ -14,6 +14,7 @@ #include "llvm/IR/Module.h" #include "llvm/IR/ModuleSummaryIndex.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/SourceMgr.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -23,7 +24,7 @@ using namespace llvm; using namespace llvm::memprof; -extern cl::opt MemProfKeepAllNotColdContexts; +LLVM_ABI extern cl::opt MemProfKeepAllNotColdContexts; namespace {