diff --git a/llvm/include/llvm/Support/AMDGPUMetadata.h b/llvm/include/llvm/Support/AMDGPUMetadata.h index 76ac7ab74a32e..990c825ae6875 100644 --- a/llvm/include/llvm/Support/AMDGPUMetadata.h +++ b/llvm/include/llvm/Support/AMDGPUMetadata.h @@ -16,6 +16,7 @@ #define LLVM_SUPPORT_AMDGPUMETADATA_H #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" #include #include #include @@ -447,10 +448,10 @@ struct Metadata final { }; /// Converts \p String to \p HSAMetadata. -std::error_code fromString(StringRef String, Metadata &HSAMetadata); +LLVM_ABI std::error_code fromString(StringRef String, Metadata &HSAMetadata); /// Converts \p HSAMetadata to \p String. -std::error_code toString(Metadata HSAMetadata, std::string &String); +LLVM_ABI std::error_code toString(Metadata HSAMetadata, std::string &String); //===----------------------------------------------------------------------===// // HSA metadata for v3 code object. diff --git a/llvm/include/llvm/Support/ARMAttributeParser.h b/llvm/include/llvm/Support/ARMAttributeParser.h index 749f9cd2213d7..0fd8a1ed57204 100644 --- a/llvm/include/llvm/Support/ARMAttributeParser.h +++ b/llvm/include/llvm/Support/ARMAttributeParser.h @@ -11,6 +11,7 @@ #include "ARMBuildAttributes.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/ELFAttrParserCompact.h" #include "llvm/Support/Error.h" @@ -18,7 +19,7 @@ namespace llvm { class ScopedPrinter; -class ARMAttributeParser : public ELFCompactAttrParser { +class LLVM_ABI ARMAttributeParser : public ELFCompactAttrParser { struct DisplayHandler { ARMBuildAttrs::AttrType attribute; Error (ARMAttributeParser::*routine)(ARMBuildAttrs::AttrType); diff --git a/llvm/include/llvm/Support/ARMBuildAttributes.h b/llvm/include/llvm/Support/ARMBuildAttributes.h index 35f8992ca9329..68acf30e52f3e 100644 --- a/llvm/include/llvm/Support/ARMBuildAttributes.h +++ b/llvm/include/llvm/Support/ARMBuildAttributes.h @@ -18,12 +18,13 @@ #ifndef LLVM_SUPPORT_ARMBUILDATTRIBUTES_H #define LLVM_SUPPORT_ARMBUILDATTRIBUTES_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/ELFAttributes.h" namespace llvm { namespace ARMBuildAttrs { -const TagNameMap &getARMAttributeTags(); +LLVM_ABI const TagNameMap &getARMAttributeTags(); enum SpecialAttr { // This is for the .cpu asm attr. It translates into one or more diff --git a/llvm/include/llvm/Support/ARMWinEH.h b/llvm/include/llvm/Support/ARMWinEH.h index b6710cca95650..083bbf405a6b6 100644 --- a/llvm/include/llvm/Support/ARMWinEH.h +++ b/llvm/include/llvm/Support/ARMWinEH.h @@ -10,6 +10,7 @@ #define LLVM_SUPPORT_ARMWINEH_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Endian.h" namespace llvm { @@ -205,8 +206,8 @@ inline uint16_t StackAdjustment(const RuntimeFunction &RF) { /// SavedRegisterMask - Utility function to calculate the set of saved general /// purpose (r0-r15) and VFP (d0-d31) registers. -std::pair SavedRegisterMask(const RuntimeFunction &RF, - bool Prologue = true); +LLVM_ABI std::pair +SavedRegisterMask(const RuntimeFunction &RF, bool Prologue = true); /// RuntimeFunctionARM64 - An entry in the table of procedure data (.pdata) /// diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h index 568f0d34032fa..59934190a5206 100644 --- a/llvm/include/llvm/Support/Allocator.h +++ b/llvm/include/llvm/Support/Allocator.h @@ -36,8 +36,9 @@ namespace detail { // We call out to an external function to actually print the message as the // printing code uses Allocator.h in its implementation. -void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated, - size_t TotalMemory); +LLVM_ABI void printBumpPtrAllocatorStats(unsigned NumSlabs, + size_t BytesAllocated, + size_t TotalMemory); } // end namespace detail diff --git a/llvm/include/llvm/Support/BalancedPartitioning.h b/llvm/include/llvm/Support/BalancedPartitioning.h index 539d157343fbe..05307d74c209c 100644 --- a/llvm/include/llvm/Support/BalancedPartitioning.h +++ b/llvm/include/llvm/Support/BalancedPartitioning.h @@ -41,6 +41,7 @@ #include "raw_ostream.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/Compiler.h" #include #include @@ -67,7 +68,7 @@ class BPFunctionNode { /// The ID of this node IDT Id; - void dump(raw_ostream &OS) const; + LLVM_ABI void dump(raw_ostream &OS) const; protected: /// The list of utility nodes associated with this node @@ -99,10 +100,10 @@ struct BalancedPartitioningConfig { class BalancedPartitioning { public: - BalancedPartitioning(const BalancedPartitioningConfig &Config); + LLVM_ABI BalancedPartitioning(const BalancedPartitioningConfig &Config); /// Run recursive graph partitioning that optimizes a given objective. - void run(std::vector &Nodes) const; + LLVM_ABI void run(std::vector &Nodes) const; private: struct UtilitySignature; @@ -127,7 +128,7 @@ class BalancedPartitioning { /// Blocking wait for all threads to complete. Unlike ThreadPool, it is /// acceptable for other threads to add more tasks while blocking on this /// call. - void wait(); + LLVM_ABI void wait(); BPThreadPool(ThreadPoolInterface &TheThreadPool) : TheThreadPool(TheThreadPool) {} }; @@ -192,8 +193,8 @@ class BalancedPartitioning { protected: /// Compute the move gain for uniform log-gap cost - static float moveGain(const BPFunctionNode &N, bool FromLeftToRight, - const SignaturesT &Signatures); + LLVM_ABI static float moveGain(const BPFunctionNode &N, bool FromLeftToRight, + const SignaturesT &Signatures); friend class BalancedPartitioningTest_MoveGain_Test; }; diff --git a/llvm/include/llvm/Support/Base64.h b/llvm/include/llvm/Support/Base64.h index 3d96884749b32..0dbd87b37868d 100644 --- a/llvm/include/llvm/Support/Base64.h +++ b/llvm/include/llvm/Support/Base64.h @@ -13,6 +13,7 @@ #ifndef LLVM_SUPPORT_BASE64_H #define LLVM_SUPPORT_BASE64_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include #include @@ -54,7 +55,8 @@ template std::string encodeBase64(InputBytes const &Bytes) { return Buffer; } -llvm::Error decodeBase64(llvm::StringRef Input, std::vector &Output); +LLVM_ABI llvm::Error decodeBase64(llvm::StringRef Input, + std::vector &Output); } // end namespace llvm diff --git a/llvm/include/llvm/Support/BinaryStreamError.h b/llvm/include/llvm/Support/BinaryStreamError.h index cf6e034ffd2ce..8a45f7bbd52cc 100644 --- a/llvm/include/llvm/Support/BinaryStreamError.h +++ b/llvm/include/llvm/Support/BinaryStreamError.h @@ -10,6 +10,7 @@ #define LLVM_SUPPORT_BINARYSTREAMERROR_H #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include @@ -24,7 +25,7 @@ enum class stream_error_code { }; /// Base class for errors originating when parsing raw PDB files -class BinaryStreamError : public ErrorInfo { +class LLVM_ABI BinaryStreamError : public ErrorInfo { public: static char ID; explicit BinaryStreamError(stream_error_code C); diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h index ca99388c5d03a..5f0ca06a466e6 100644 --- a/llvm/include/llvm/Support/BinaryStreamReader.h +++ b/llvm/include/llvm/Support/BinaryStreamReader.h @@ -14,6 +14,7 @@ #include "llvm/Support/Alignment.h" #include "llvm/Support/BinaryStreamArray.h" #include "llvm/Support/BinaryStreamRef.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/ConvertUTF.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" @@ -29,10 +30,11 @@ namespace llvm { class BinaryStreamReader { public: BinaryStreamReader() = default; - explicit BinaryStreamReader(BinaryStreamRef Ref); - explicit BinaryStreamReader(BinaryStream &Stream); - explicit BinaryStreamReader(ArrayRef Data, llvm::endianness Endian); - explicit BinaryStreamReader(StringRef Data, llvm::endianness Endian); + LLVM_ABI explicit BinaryStreamReader(BinaryStreamRef Ref); + LLVM_ABI explicit BinaryStreamReader(BinaryStream &Stream); + LLVM_ABI explicit BinaryStreamReader(ArrayRef Data, + llvm::endianness Endian); + LLVM_ABI explicit BinaryStreamReader(StringRef Data, llvm::endianness Endian); BinaryStreamReader(const BinaryStreamReader &Other) = default; @@ -46,7 +48,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readLongestContiguousChunk(ArrayRef &Buffer); + LLVM_ABI Error readLongestContiguousChunk(ArrayRef &Buffer); /// Read \p Size bytes from the underlying stream at the current offset and /// and set \p Buffer to the resulting data slice. Whether a copy occurs @@ -55,7 +57,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readBytes(ArrayRef &Buffer, uint32_t Size); + LLVM_ABI Error readBytes(ArrayRef &Buffer, uint32_t Size); /// Read an integer of the specified endianness into \p Dest and update the /// stream's offset. The data is always copied from the stream's underlying @@ -91,13 +93,13 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readULEB128(uint64_t &Dest); + LLVM_ABI Error readULEB128(uint64_t &Dest); /// Read a signed LEB128 encoded value. /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readSLEB128(int64_t &Dest); + LLVM_ABI Error readSLEB128(int64_t &Dest); /// Read a null terminated string from \p Dest. Whether a copy occurs depends /// on the implementation of the underlying stream. Updates the stream's @@ -105,14 +107,14 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readCString(StringRef &Dest); + LLVM_ABI Error readCString(StringRef &Dest); /// Similar to readCString, however read a null-terminated UTF16 string /// instead. /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readWideString(ArrayRef &Dest); + LLVM_ABI Error readWideString(ArrayRef &Dest); /// Read a \p Length byte string into \p Dest. Whether a copy occurs depends /// on the implementation of the underlying stream. Updates the stream's @@ -120,7 +122,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readFixedString(StringRef &Dest, uint32_t Length); + LLVM_ABI Error readFixedString(StringRef &Dest, uint32_t Length); /// Read the entire remainder of the underlying stream into \p Ref. This is /// equivalent to calling getUnderlyingStream().slice(Offset). Updates the @@ -128,7 +130,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readStreamRef(BinaryStreamRef &Ref); + LLVM_ABI Error readStreamRef(BinaryStreamRef &Ref); /// Read \p Length bytes from the underlying stream into \p Ref. This is /// equivalent to calling getUnderlyingStream().slice(Offset, Length). @@ -137,7 +139,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readStreamRef(BinaryStreamRef &Ref, uint32_t Length); + LLVM_ABI Error readStreamRef(BinaryStreamRef &Ref, uint32_t Length); /// Read \p Length bytes from the underlying stream into \p Ref. This is /// equivalent to calling getUnderlyingStream().slice(Offset, Length). @@ -146,7 +148,7 @@ class BinaryStreamReader { /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length); + LLVM_ABI Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length); /// Get a pointer to an object of type T from the underlying stream, as if by /// memcpy, and store the result into \p Dest. It is up to the caller to @@ -251,17 +253,17 @@ class BinaryStreamReader { /// /// \returns a success error code if at least \p Amount bytes remain in the /// stream, otherwise returns an appropriate error code. - Error skip(uint64_t Amount); + LLVM_ABI Error skip(uint64_t Amount); /// Examine the next byte of the underlying stream without advancing the /// stream's offset. If the stream is empty the behavior is undefined. /// /// \returns the next byte in the stream. - uint8_t peek() const; + LLVM_ABI uint8_t peek() const; - Error padToAlignment(uint32_t Align); + LLVM_ABI Error padToAlignment(uint32_t Align); - std::pair + LLVM_ABI std::pair split(uint64_t Offset) const; private: diff --git a/llvm/include/llvm/Support/BinaryStreamRef.h b/llvm/include/llvm/Support/BinaryStreamRef.h index fdc46f5fd5605..47009ff0b96fc 100644 --- a/llvm/include/llvm/Support/BinaryStreamRef.h +++ b/llvm/include/llvm/Support/BinaryStreamRef.h @@ -12,6 +12,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/BinaryStream.h" #include "llvm/Support/BinaryStreamError.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include #include @@ -160,11 +161,12 @@ class BinaryStreamRef public: BinaryStreamRef() = default; - BinaryStreamRef(BinaryStream &Stream); - BinaryStreamRef(BinaryStream &Stream, uint64_t Offset, - std::optional Length); - explicit BinaryStreamRef(ArrayRef Data, llvm::endianness Endian); - explicit BinaryStreamRef(StringRef Data, llvm::endianness Endian); + LLVM_ABI BinaryStreamRef(BinaryStream &Stream); + LLVM_ABI BinaryStreamRef(BinaryStream &Stream, uint64_t Offset, + std::optional Length); + LLVM_ABI explicit BinaryStreamRef(ArrayRef Data, + llvm::endianness Endian); + LLVM_ABI explicit BinaryStreamRef(StringRef Data, llvm::endianness Endian); BinaryStreamRef(const BinaryStreamRef &Other) = default; BinaryStreamRef &operator=(const BinaryStreamRef &Other) = default; @@ -181,16 +183,16 @@ class BinaryStreamRef /// \returns a success error code if the entire range of data is within the /// bounds of this BinaryStreamRef's view and the implementation could read /// the data, and an appropriate error code otherwise. - Error readBytes(uint64_t Offset, uint64_t Size, - ArrayRef &Buffer) const; + LLVM_ABI Error readBytes(uint64_t Offset, uint64_t Size, + ArrayRef &Buffer) const; /// Given an Offset into this BinaryStreamRef, return a reference to the /// largest buffer the stream could support without necessitating a copy. /// /// \returns a success error code if implementation could read the data, /// and an appropriate error code otherwise. - Error readLongestContiguousChunk(uint64_t Offset, - ArrayRef &Buffer) const; + LLVM_ABI Error readLongestContiguousChunk(uint64_t Offset, + ArrayRef &Buffer) const; }; struct BinarySubstreamRef { @@ -233,11 +235,12 @@ class WritableBinaryStreamRef public: WritableBinaryStreamRef() = default; - WritableBinaryStreamRef(WritableBinaryStream &Stream); - WritableBinaryStreamRef(WritableBinaryStream &Stream, uint64_t Offset, - std::optional Length); - explicit WritableBinaryStreamRef(MutableArrayRef Data, - llvm::endianness Endian); + LLVM_ABI WritableBinaryStreamRef(WritableBinaryStream &Stream); + LLVM_ABI WritableBinaryStreamRef(WritableBinaryStream &Stream, + uint64_t Offset, + std::optional Length); + LLVM_ABI explicit WritableBinaryStreamRef(MutableArrayRef Data, + llvm::endianness Endian); WritableBinaryStreamRef(const WritableBinaryStreamRef &Other) = default; WritableBinaryStreamRef & operator=(const WritableBinaryStreamRef &Other) = default; @@ -255,13 +258,13 @@ class WritableBinaryStreamRef /// \returns a success error code if the data could fit within the underlying /// stream at the specified location and the implementation could write the /// data, and an appropriate error code otherwise. - Error writeBytes(uint64_t Offset, ArrayRef Data) const; + LLVM_ABI Error writeBytes(uint64_t Offset, ArrayRef Data) const; /// Conver this WritableBinaryStreamRef to a read-only BinaryStreamRef. - operator BinaryStreamRef() const; + LLVM_ABI operator BinaryStreamRef() const; /// For buffered streams, commits changes to the backing store. - Error commit(); + LLVM_ABI Error commit(); }; } // end namespace llvm diff --git a/llvm/include/llvm/Support/BinaryStreamWriter.h b/llvm/include/llvm/Support/BinaryStreamWriter.h index bc1d7949841d6..dddf53bd5483c 100644 --- a/llvm/include/llvm/Support/BinaryStreamWriter.h +++ b/llvm/include/llvm/Support/BinaryStreamWriter.h @@ -14,6 +14,7 @@ #include "llvm/Support/BinaryStreamArray.h" #include "llvm/Support/BinaryStreamError.h" #include "llvm/Support/BinaryStreamRef.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" #include @@ -30,10 +31,10 @@ namespace llvm { class BinaryStreamWriter { public: BinaryStreamWriter() = default; - explicit BinaryStreamWriter(WritableBinaryStreamRef Ref); - explicit BinaryStreamWriter(WritableBinaryStream &Stream); - explicit BinaryStreamWriter(MutableArrayRef Data, - llvm::endianness Endian); + LLVM_ABI explicit BinaryStreamWriter(WritableBinaryStreamRef Ref); + LLVM_ABI explicit BinaryStreamWriter(WritableBinaryStream &Stream); + LLVM_ABI explicit BinaryStreamWriter(MutableArrayRef Data, + llvm::endianness Endian); BinaryStreamWriter(const BinaryStreamWriter &Other) = default; @@ -47,7 +48,7 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeBytes(ArrayRef Buffer); + LLVM_ABI Error writeBytes(ArrayRef Buffer); /// Write the integer \p Value to the underlying stream in the /// specified endianness. On success, updates the offset so that @@ -77,14 +78,14 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeULEB128(uint64_t Value); + LLVM_ABI Error writeULEB128(uint64_t Value); /// Write the unsigned integer Value to the underlying stream using ULEB128 /// encoding. /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeSLEB128(int64_t Value); + LLVM_ABI Error writeSLEB128(int64_t Value); /// Write the string \p Str to the underlying stream followed by a null /// terminator. On success, updates the offset so that subsequent writes @@ -93,7 +94,7 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeCString(StringRef Str); + LLVM_ABI Error writeCString(StringRef Str); /// Write the string \p Str to the underlying stream without a null /// terminator. On success, updates the offset so that subsequent writes @@ -101,7 +102,7 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeFixedString(StringRef Str); + LLVM_ABI Error writeFixedString(StringRef Str); /// Efficiently reads all data from \p Ref, and writes it to this stream. /// This operation will not invoke any copies of the source data, regardless @@ -109,7 +110,7 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeStreamRef(BinaryStreamRef Ref); + LLVM_ABI Error writeStreamRef(BinaryStreamRef Ref); /// Efficiently reads \p Size bytes from \p Ref, and writes it to this stream. /// This operation will not invoke any copies of the source data, regardless @@ -117,7 +118,7 @@ class BinaryStreamWriter { /// /// \returns a success error code if the data was successfully written, /// otherwise returns an appropriate error code. - Error writeStreamRef(BinaryStreamRef Ref, uint64_t Size); + LLVM_ABI Error writeStreamRef(BinaryStreamRef Ref, uint64_t Size); /// Writes the object \p Obj to the underlying stream, as if by using memcpy. /// It is up to the caller to ensure that type of \p Obj can be safely copied @@ -171,13 +172,14 @@ class BinaryStreamWriter { } /// Splits the Writer into two Writers at a given offset. - std::pair split(uint64_t Off) const; + LLVM_ABI std::pair + split(uint64_t Off) const; void setOffset(uint64_t Off) { Offset = Off; } uint64_t getOffset() const { return Offset; } uint64_t getLength() const { return Stream.getLength(); } uint64_t bytesRemaining() const { return getLength() - getOffset(); } - Error padToAlignment(uint32_t Align); + LLVM_ABI Error padToAlignment(uint32_t Align); protected: WritableBinaryStreamRef Stream; diff --git a/llvm/include/llvm/Support/BlockFrequency.h b/llvm/include/llvm/Support/BlockFrequency.h index aeab99615a951..eb979af8aa376 100644 --- a/llvm/include/llvm/Support/BlockFrequency.h +++ b/llvm/include/llvm/Support/BlockFrequency.h @@ -13,6 +13,7 @@ #ifndef LLVM_SUPPORT_BLOCKFREQUENCY_H #define LLVM_SUPPORT_BLOCKFREQUENCY_H +#include "llvm/Support/Compiler.h" #include #include #include @@ -39,13 +40,13 @@ class BlockFrequency { /// Multiplies with a branch probability. The computation will never /// overflow. - BlockFrequency &operator*=(BranchProbability Prob); - BlockFrequency operator*(BranchProbability Prob) const; + LLVM_ABI BlockFrequency &operator*=(BranchProbability Prob); + LLVM_ABI BlockFrequency operator*(BranchProbability Prob) const; /// Divide by a non-zero branch probability using saturating /// arithmetic. - BlockFrequency &operator/=(BranchProbability Prob); - BlockFrequency operator/(BranchProbability Prob) const; + LLVM_ABI BlockFrequency &operator/=(BranchProbability Prob); + LLVM_ABI BlockFrequency operator/(BranchProbability Prob) const; /// Adds another block frequency using saturating arithmetic. BlockFrequency &operator+=(BlockFrequency Freq) { @@ -80,7 +81,7 @@ class BlockFrequency { } /// Multiplies frequency with `Factor`. Returns `nullopt` in case of overflow. - std::optional mul(uint64_t Factor) const; + LLVM_ABI std::optional mul(uint64_t Factor) const; /// Shift block frequency to the right by count digits saturating to 1. BlockFrequency &operator>>=(const unsigned count) { @@ -120,8 +121,8 @@ class BlockFrequency { } }; -void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq, - BlockFrequency Freq); +LLVM_ABI void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq, + BlockFrequency Freq); } // namespace llvm diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h index 74731c416ac04..570531e6b9e92 100644 --- a/llvm/include/llvm/Support/BranchProbability.h +++ b/llvm/include/llvm/Support/BranchProbability.h @@ -14,6 +14,7 @@ #define LLVM_SUPPORT_BRANCHPROBABILITY_H #include "llvm/ADT/ADL.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/DataTypes.h" #include #include @@ -42,7 +43,7 @@ class BranchProbability { public: BranchProbability() : N(UnknownN) {} - BranchProbability(uint32_t Numerator, uint32_t Denominator); + LLVM_ABI BranchProbability(uint32_t Numerator, uint32_t Denominator); bool isZero() const { return N == 0; } bool isUnknown() const { return N == UnknownN; } @@ -54,8 +55,8 @@ class BranchProbability { // as denominator. static BranchProbability getRaw(uint32_t N) { return BranchProbability(N); } // Create a BranchProbability object from 64-bit integers. - static BranchProbability getBranchProbability(uint64_t Numerator, - uint64_t Denominator); + LLVM_ABI static BranchProbability getBranchProbability(uint64_t Numerator, + uint64_t Denominator); // Normalize given probabilties so that the sum of them becomes approximate // one. @@ -74,9 +75,9 @@ class BranchProbability { // Return (1 - Probability). BranchProbability getCompl() const { return BranchProbability(D - N); } - raw_ostream &print(raw_ostream &OS) const; + LLVM_ABI raw_ostream &print(raw_ostream &OS) const; - void dump() const; + LLVM_ABI void dump() const; /// Scale a large integer. /// @@ -84,7 +85,7 @@ class BranchProbability { /// result. /// /// \return \c Num times \c this. - uint64_t scale(uint64_t Num) const; + LLVM_ABI uint64_t scale(uint64_t Num) const; /// Scale a large integer by the inverse. /// @@ -92,7 +93,7 @@ class BranchProbability { /// Returns the floor of the result. /// /// \return \c Num divided by \c this. - uint64_t scaleByInverse(uint64_t Num) const; + LLVM_ABI uint64_t scaleByInverse(uint64_t Num) const; BranchProbability &operator+=(BranchProbability RHS) { assert(N != UnknownN && RHS.N != UnknownN && diff --git a/llvm/include/llvm/Support/BuryPointer.h b/llvm/include/llvm/Support/BuryPointer.h index 276a5b7089c3e..02144baed36af 100644 --- a/llvm/include/llvm/Support/BuryPointer.h +++ b/llvm/include/llvm/Support/BuryPointer.h @@ -9,6 +9,7 @@ #ifndef LLVM_SUPPORT_BURYPOINTER_H #define LLVM_SUPPORT_BURYPOINTER_H +#include "llvm/Support/Compiler.h" #include namespace llvm { @@ -19,7 +20,7 @@ namespace llvm { // the memory is not misdiagnosed as an unintentional leak by leak detection // tools (this is achieved by preserving pointers to the object in a globally // visible array). -void BuryPointer(const void *Ptr); +LLVM_ABI void BuryPointer(const void *Ptr); template void BuryPointer(std::unique_ptr Ptr) { BuryPointer(Ptr.release()); } diff --git a/llvm/include/llvm/Support/COM.h b/llvm/include/llvm/Support/COM.h index d59966f849b48..e2701cae10dda 100644 --- a/llvm/include/llvm/Support/COM.h +++ b/llvm/include/llvm/Support/COM.h @@ -14,6 +14,8 @@ #ifndef LLVM_SUPPORT_COM_H #define LLVM_SUPPORT_COM_H +#include "llvm/Support/Compiler.h" + namespace llvm { namespace sys { @@ -21,9 +23,9 @@ enum class COMThreadingMode { SingleThreaded, MultiThreaded }; class InitializeCOMRAII { public: - explicit InitializeCOMRAII(COMThreadingMode Threading, - bool SpeedOverMemory = false); - ~InitializeCOMRAII(); + LLVM_ABI explicit InitializeCOMRAII(COMThreadingMode Threading, + bool SpeedOverMemory = false); + LLVM_ABI ~InitializeCOMRAII(); private: InitializeCOMRAII(const InitializeCOMRAII &) = delete; diff --git a/llvm/include/llvm/Support/CRC.h b/llvm/include/llvm/Support/CRC.h index 210890ae06d47..a07b017d23519 100644 --- a/llvm/include/llvm/Support/CRC.h +++ b/llvm/include/llvm/Support/CRC.h @@ -13,17 +13,18 @@ #ifndef LLVM_SUPPORT_CRC_H #define LLVM_SUPPORT_CRC_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/DataTypes.h" namespace llvm { template class ArrayRef; // Compute the CRC-32 of Data. -uint32_t crc32(ArrayRef Data); +LLVM_ABI uint32_t crc32(ArrayRef Data); // Compute the running CRC-32 of Data, with CRC being the previous value of the // checksum. -uint32_t crc32(uint32_t CRC, ArrayRef Data); +LLVM_ABI uint32_t crc32(uint32_t CRC, ArrayRef Data); // Class for computing the JamCRC. // @@ -47,7 +48,7 @@ class JamCRC { JamCRC(uint32_t Init = 0xFFFFFFFFU) : CRC(Init) {} // Update the CRC calculation with Data. - void update(ArrayRef Data); + LLVM_ABI void update(ArrayRef Data); uint32_t getCRC() const { return CRC; } diff --git a/llvm/include/llvm/Support/CSKYAttributeParser.h b/llvm/include/llvm/Support/CSKYAttributeParser.h index 08257a744a959..0d28c92b4b5d4 100644 --- a/llvm/include/llvm/Support/CSKYAttributeParser.h +++ b/llvm/include/llvm/Support/CSKYAttributeParser.h @@ -10,10 +10,11 @@ #define LLVM_SUPPORT_CSKYATTRIBUTEPARSER_H #include "llvm/Support/CSKYAttributes.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/ELFAttrParserCompact.h" namespace llvm { -class CSKYAttributeParser : public ELFCompactAttrParser { +class LLVM_ABI CSKYAttributeParser : public ELFCompactAttrParser { struct DisplayHandler { CSKYAttrs::AttrType attribute; Error (CSKYAttributeParser::*routine)(unsigned); diff --git a/llvm/include/llvm/Support/CSKYAttributes.h b/llvm/include/llvm/Support/CSKYAttributes.h index 723f2ceee8fb7..c16d3de96c219 100644 --- a/llvm/include/llvm/Support/CSKYAttributes.h +++ b/llvm/include/llvm/Support/CSKYAttributes.h @@ -12,12 +12,13 @@ #ifndef LLVM_SUPPORT_CSKYATTRIBUTES_H #define LLVM_SUPPORT_CSKYATTRIBUTES_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/ELFAttributes.h" namespace llvm { namespace CSKYAttrs { -const TagNameMap &getCSKYAttributeTags(); +LLVM_ABI const TagNameMap &getCSKYAttributeTags(); enum AttrType { CSKY_ARCH_NAME = 4, diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h index 17e148830a73f..a677a684a221a 100644 --- a/llvm/include/llvm/Support/CachePruning.h +++ b/llvm/include/llvm/Support/CachePruning.h @@ -14,6 +14,7 @@ #ifndef LLVM_SUPPORT_CACHEPRUNING_H #define LLVM_SUPPORT_CACHEPRUNING_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/MemoryBuffer.h" #include #include @@ -66,7 +67,8 @@ struct CachePruningPolicy { /// For example: "prune_interval=30s:prune_after=24h:cache_size=50%" /// which means a pruning interval of 30 seconds, expiration time of 24 hours /// and maximum cache size of 50% of available disk space. -Expected parseCachePruningPolicy(StringRef PolicyStr); +LLVM_ABI Expected +parseCachePruningPolicy(StringRef PolicyStr); /// Peform pruning using the supplied policy, returns true if pruning /// occurred, i.e. if Policy.Interval was expired. @@ -79,8 +81,9 @@ Expected parseCachePruningPolicy(StringRef PolicyStr); /// As a safeguard against data loss if the user specifies the wrong directory /// as their cache directory, this function will ignore files not matching the /// pattern "llvmcache-*". -bool pruneCache(StringRef Path, CachePruningPolicy Policy, - const std::vector> &Files = {}); +LLVM_ABI bool +pruneCache(StringRef Path, CachePruningPolicy Policy, + const std::vector> &Files = {}); } // namespace llvm #endif diff --git a/llvm/include/llvm/Support/Caching.h b/llvm/include/llvm/Support/Caching.h index 9a82921e6ffc7..7fd9befbef9db 100644 --- a/llvm/include/llvm/Support/Caching.h +++ b/llvm/include/llvm/Support/Caching.h @@ -15,6 +15,7 @@ #ifndef LLVM_SUPPORT_CACHING_H #define LLVM_SUPPORT_CACHING_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" namespace llvm { @@ -113,7 +114,7 @@ using AddBufferFn = std::function localCache( +LLVM_ABI Expected localCache( const Twine &CacheNameRef, const Twine &TempFilePrefixRef, const Twine &CacheDirectoryPathRef, AddBufferFn AddBuffer = [](size_t Task, const Twine &ModuleName, diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h index 71859af7c7e4a..5b8102d8e11cf 100644 --- a/llvm/include/llvm/Support/Chrono.h +++ b/llvm/include/llvm/Support/Chrono.h @@ -77,8 +77,8 @@ toTimePoint(std::time_t T, uint32_t nsec) { } // namespace sys -raw_ostream &operator<<(raw_ostream &OS, sys::TimePoint<> TP); -raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP); +LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, sys::TimePoint<> TP); +LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP); /// Format provider for TimePoint<> /// @@ -90,25 +90,37 @@ raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP); /// If no options are given, the default format is "%Y-%m-%d %H:%M:%S.%N". template <> struct format_provider> { - static void format(const sys::TimePoint<> &TP, llvm::raw_ostream &OS, - StringRef Style); + LLVM_ABI static void format(const sys::TimePoint<> &TP, llvm::raw_ostream &OS, + StringRef Style); }; template <> struct format_provider> { - static void format(const sys::UtcTime &TP, - llvm::raw_ostream &OS, StringRef Style); + LLVM_ABI static void format(const sys::UtcTime &TP, + llvm::raw_ostream &OS, StringRef Style); }; namespace detail { template struct unit { static const char value[]; }; template const char unit::value[] = ""; -template <> struct unit> { static const char value[]; }; -template <> struct unit> { static const char value[]; }; -template <> struct unit> { static const char value[]; }; -template <> struct unit { static const char value[]; }; -template <> struct unit { static const char value[]; }; -template <> struct unit { static const char value[]; }; +template <> struct unit> { + LLVM_ABI static const char value[]; +}; +template <> struct unit> { + LLVM_ABI static const char value[]; +}; +template <> struct unit> { + LLVM_ABI static const char value[]; +}; +template <> struct unit { + LLVM_ABI static const char value[]; +}; +template <> struct unit { + LLVM_ABI static const char value[]; +}; +template <> struct unit { + LLVM_ABI static const char value[]; +}; } // namespace detail /// Implementation of format_provider for duration types. diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index 531750572102c..1fa7790f8a962 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -27,6 +27,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/ADT/iterator_range.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/StringSaver.h" #include "llvm/Support/raw_ostream.h" @@ -65,11 +66,11 @@ namespace cl { // that give precedence to later occurrences. If your program supports options // that give precedence to earlier occurrences, you will need to extend this // function to support it correctly. -bool ParseCommandLineOptions(int argc, const char *const *argv, - StringRef Overview = "", - raw_ostream *Errs = nullptr, - const char *EnvVar = nullptr, - bool LongOptionsUseDoubleDash = false); +LLVM_ABI bool ParseCommandLineOptions(int argc, const char *const *argv, + StringRef Overview = "", + raw_ostream *Errs = nullptr, + const char *EnvVar = nullptr, + bool LongOptionsUseDoubleDash = false); // Function pointer type for printing version information. using VersionPrinterTy = std::function; @@ -78,20 +79,20 @@ using VersionPrinterTy = std::function; /// Override the default (LLVM specific) version printer used to print out the /// version when --version is given on the command line. This allows other /// systems using the CommandLine utilities to print their own version string. -void SetVersionPrinter(VersionPrinterTy func); +LLVM_ABI void SetVersionPrinter(VersionPrinterTy func); ///===---------------------------------------------------------------------===// /// Add an extra printer to use in addition to the default one. This can be /// called multiple times, and each time it adds a new function to the list /// which will be called after the basic LLVM version printing is complete. /// Each can then add additional information specific to the tool. -void AddExtraVersionPrinter(VersionPrinterTy func); +LLVM_ABI void AddExtraVersionPrinter(VersionPrinterTy func); // Print option values. // With -print-options print the difference between option values and defaults. // With -print-all-options print all option values. // (Currently not perfect, but best-effort.) -void PrintOptionValues(); +LLVM_ABI void PrintOptionValues(); // Forward declaration - AddLiteralOption needs to be up here to make gcc happy. class Option; @@ -103,7 +104,7 @@ class Option; /// /// Literal options are used by some parsers to register special option values. /// This is how the PassNameParser registers pass names for opt. -void AddLiteralOption(Option &O, StringRef Name); +LLVM_ABI void AddLiteralOption(Option &O, StringRef Name); //===----------------------------------------------------------------------===// // Flags permitted to be passed to command line arguments @@ -195,7 +196,7 @@ class OptionCategory { }; // The general Option Category (used as default category). -OptionCategory &getGeneralCategory(); +LLVM_ABI OptionCategory &getGeneralCategory(); //===----------------------------------------------------------------------===// // @@ -205,8 +206,8 @@ class SubCommand { StringRef Description; protected: - void registerSubCommand(); - void unregisterSubCommand(); + LLVM_ABI void registerSubCommand(); + LLVM_ABI void unregisterSubCommand(); public: SubCommand(StringRef Name, StringRef Description = "") @@ -216,15 +217,15 @@ class SubCommand { SubCommand() = default; // Get the special subcommand representing no subcommand. - static SubCommand &getTopLevel(); + LLVM_ABI static SubCommand &getTopLevel(); // Get the special subcommand that can be used to put an option into all // subcommands. - static SubCommand &getAll(); + LLVM_ABI static SubCommand &getAll(); - void reset(); + LLVM_ABI void reset(); - explicit operator bool() const; + LLVM_ABI explicit operator bool() const; StringRef getName() const { return Name; } StringRef getDescription() const { return Description; } @@ -247,7 +248,7 @@ class SubCommandGroup { //===----------------------------------------------------------------------===// // -class Option { +class LLVM_ABI Option { friend class alias; // Overriden by subclasses to handle the value passed into an argument. Should @@ -529,7 +530,7 @@ callback(F CB) { //===----------------------------------------------------------------------===// // Support value comparison outside the template. -struct GenericOptionValue { +struct LLVM_ABI GenericOptionValue { virtual bool compare(const GenericOptionValue &V) const = 0; protected: @@ -636,7 +637,7 @@ struct OptionValue final // Other safe-to-copy-by-value common option types. enum boolOrDefault { BOU_UNSET, BOU_TRUE, BOU_FALSE }; template <> -struct OptionValue final +struct LLVM_ABI OptionValue final : OptionValueCopy { using WrapperType = cl::boolOrDefault; @@ -654,7 +655,7 @@ struct OptionValue final }; template <> -struct OptionValue final : OptionValueCopy { +struct LLVM_ABI OptionValue final : OptionValueCopy { using WrapperType = StringRef; OptionValue() = default; @@ -724,7 +725,7 @@ template ValuesClass values(OptsTy... Options) { // every instance of the generic parser. This also allows us to put stuff into // CommandLine.cpp // -class generic_parser_base { +class LLVM_ABI generic_parser_base { protected: class GenericOptionInfo { public: @@ -890,7 +891,8 @@ template class parser : public generic_parser_base { //-------------------------------------------------- // Super class of parsers to provide boilerplate code // -class basic_parser_impl { // non-template implementation of basic_parser +class LLVM_ABI + basic_parser_impl { // non-template implementation of basic_parser public: basic_parser_impl(Option &) {} @@ -939,9 +941,9 @@ template class basic_parser : public basic_parser_impl { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -966,9 +968,10 @@ template <> class parser : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; -template <> class parser : public basic_parser { +template <> +class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -991,9 +994,9 @@ template <> class parser : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1012,9 +1015,9 @@ template <> class parser : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; -template <> class parser final : public basic_parser { +template <> class LLVM_ABI parser final : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1033,9 +1036,9 @@ template <> class parser final : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1054,9 +1057,9 @@ template <> class parser : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1075,10 +1078,11 @@ template <> class parser : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; template <> -class parser final : public basic_parser { +class LLVM_ABI parser final + : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1097,10 +1101,11 @@ class parser final : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; template <> -class parser : public basic_parser { +class LLVM_ABI parser + : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1120,9 +1125,9 @@ class parser : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1141,9 +1146,9 @@ template <> class parser : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1162,9 +1167,10 @@ template <> class parser : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; -template <> class parser : public basic_parser { +template <> +class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1186,9 +1192,9 @@ template <> class parser : public basic_parser { //-------------------------------------------------- -extern template class basic_parser; +extern template class LLVM_TEMPLATE_ABI basic_parser; -template <> class parser : public basic_parser { +template <> class LLVM_ABI parser : public basic_parser { public: parser(Option &O) : basic_parser(O) {} @@ -1506,11 +1512,11 @@ class opt [](const typename ParserClass::parser_data_type &) {}; }; -extern template class opt; -extern template class opt; -extern template class opt; -extern template class opt; -extern template class opt; +extern template class LLVM_ABI opt; +extern template class LLVM_ABI opt; +extern template class LLVM_ABI opt; +extern template class LLVM_ABI opt; +extern template class LLVM_ABI opt; //===----------------------------------------------------------------------===// // Default storage class definition: external storage. This implementation @@ -1906,7 +1912,7 @@ class bits : public Option, public bits_storage { // Aliased command line option (alias this name to a preexisting name) // -class alias : public Option { +class LLVM_ABI alias : public Option { Option *AliasFor; bool handleOccurrence(unsigned pos, StringRef /*ArgName*/, @@ -1979,27 +1985,27 @@ struct aliasopt { struct extrahelp { StringRef morehelp; - explicit extrahelp(StringRef help); + LLVM_ABI explicit extrahelp(StringRef help); }; -void PrintVersionMessage(); +LLVM_ABI void PrintVersionMessage(); /// This function just prints the help message, exactly the same way as if the /// -help or -help-hidden option had been given on the command line. /// /// \param Hidden if true will print hidden options /// \param Categorized if true print options in categories -void PrintHelpMessage(bool Hidden = false, bool Categorized = false); +LLVM_ABI void PrintHelpMessage(bool Hidden = false, bool Categorized = false); /// An array of optional enabled settings in the LLVM build configuration, /// which may be of interest to compiler developers. For example, includes /// "+assertions" if assertions are enabled. Used by printBuildConfig. -ArrayRef getCompilerBuildConfig(); +LLVM_ABI ArrayRef getCompilerBuildConfig(); /// Prints the compiler build configuration. /// Designed for compiler developers, not compiler end-users. /// Intended to be used in --version output when enabled. -void printBuildConfig(raw_ostream &OS); +LLVM_ABI void printBuildConfig(raw_ostream &OS); //===----------------------------------------------------------------------===// // Public interface for accessing registered options. @@ -2032,7 +2038,7 @@ void printBuildConfig(raw_ostream &OS); /// Hopefully this API can be deprecated soon. Any situation where options need /// to be modified by tools or libraries should be handled by sane APIs rather /// than just handing around a global list. -StringMap