1616#ifndef LLVM_ADT_APFIXEDPOINT_H
1717#define LLVM_ADT_APFIXEDPOINT_H
1818
19+ #include " llvm/Support/Compiler.h"
1920#include " llvm/ADT/APSInt.h"
2021#include " llvm/ADT/Hashing.h"
2122#include " llvm/ADT/SmallString.h"
@@ -84,11 +85,11 @@ class FixedPointSemantics {
8485 // / precision semantic that can precisely represent the precision and ranges
8586 // / of both input values. This does not compute the resulting semantics for a
8687 // / given binary operation.
87- FixedPointSemantics
88+ LLVM_ABI FixedPointSemantics
8889 getCommonSemantics (const FixedPointSemantics &Other) const ;
8990
9091 // / Print semantics for debug purposes
91- void print (llvm::raw_ostream& OS) const ;
92+ LLVM_ABI void print (llvm::raw_ostream& OS) const ;
9293
9394 // / Returns true if this fixed-point semantic with its value bits interpreted
9495 // / as an integer can fit in the given floating point semantic without
@@ -97,7 +98,7 @@ class FixedPointSemantics {
9798 // / minimum integer representation of 127 and -128, respectively. If both of
9899 // / these values can be represented (possibly inexactly) in the floating
99100 // / point semantic without overflowing, this returns true.
100- bool fitsInFloatSemantics (const fltSemantics &FloatSema) const ;
101+ LLVM_ABI bool fitsInFloatSemantics (const fltSemantics &FloatSema) const ;
101102
102103 // / Return the FixedPointSemantics for an integer type.
103104 static FixedPointSemantics GetIntegerSemantics (unsigned Width,
@@ -118,10 +119,10 @@ class FixedPointSemantics {
118119 // / The result is dependent on the host endianness and not stable across LLVM
119120 // / versions. See getFromOpaqueInt() to convert it back to a
120121 // / FixedPointSemantics object.
121- uint32_t toOpaqueInt () const ;
122+ LLVM_ABI uint32_t toOpaqueInt () const ;
122123 // / Create a FixedPointSemantics object from an integer created via
123124 // / toOpaqueInt().
124- static FixedPointSemantics getFromOpaqueInt (uint32_t );
125+ LLVM_ABI static FixedPointSemantics getFromOpaqueInt (uint32_t );
125126
126127private:
127128 unsigned Width : WidthBitWidth;
@@ -190,22 +191,22 @@ class APFixedPoint {
190191 // Convert this number to match the semantics provided. If the overflow
191192 // parameter is provided, set this value to true or false to indicate if this
192193 // operation results in an overflow.
193- APFixedPoint convert (const FixedPointSemantics &DstSema,
194+ LLVM_ABI APFixedPoint convert (const FixedPointSemantics &DstSema,
194195 bool *Overflow = nullptr ) const ;
195196
196197 // Perform binary operations on a fixed point type. The resulting fixed point
197198 // value will be in the common, full precision semantics that can represent
198199 // the precision and ranges of both input values. See convert() for an
199200 // explanation of the Overflow parameter.
200- APFixedPoint add (const APFixedPoint &Other, bool *Overflow = nullptr ) const ;
201- APFixedPoint sub (const APFixedPoint &Other, bool *Overflow = nullptr ) const ;
202- APFixedPoint mul (const APFixedPoint &Other, bool *Overflow = nullptr ) const ;
203- APFixedPoint div (const APFixedPoint &Other, bool *Overflow = nullptr ) const ;
201+ LLVM_ABI APFixedPoint add (const APFixedPoint &Other, bool *Overflow = nullptr ) const ;
202+ LLVM_ABI APFixedPoint sub (const APFixedPoint &Other, bool *Overflow = nullptr ) const ;
203+ LLVM_ABI APFixedPoint mul (const APFixedPoint &Other, bool *Overflow = nullptr ) const ;
204+ LLVM_ABI APFixedPoint div (const APFixedPoint &Other, bool *Overflow = nullptr ) const ;
204205
205206 // Perform shift operations on a fixed point type. Unlike the other binary
206207 // operations, the resulting fixed point value will be in the original
207208 // semantic.
208- APFixedPoint shl (unsigned Amt, bool *Overflow = nullptr ) const ;
209+ LLVM_ABI APFixedPoint shl (unsigned Amt, bool *Overflow = nullptr ) const ;
209210 APFixedPoint shr (unsigned Amt, bool *Overflow = nullptr ) const {
210211 // Right shift cannot overflow.
211212 if (Overflow)
@@ -215,7 +216,7 @@ class APFixedPoint {
215216
216217 // / Perform a unary negation (-X) on this fixed point type, taking into
217218 // / account saturation if applicable.
218- APFixedPoint negate (bool *Overflow = nullptr ) const ;
219+ LLVM_ABI APFixedPoint negate (bool *Overflow = nullptr ) const ;
219220
220221 // / Return the integral part of this fixed point number, rounded towards
221222 // / zero. (-2.5k -> -2)
@@ -234,28 +235,28 @@ class APFixedPoint {
234235 // / If the overflow parameter is provided, and the integral value is not able
235236 // / to be fully stored in the provided width and sign, the overflow parameter
236237 // / is set to true.
237- APSInt convertToInt (unsigned DstWidth, bool DstSign,
238+ LLVM_ABI APSInt convertToInt (unsigned DstWidth, bool DstSign,
238239 bool *Overflow = nullptr ) const ;
239240
240241 // / Convert this fixed point number to a floating point value with the
241242 // / provided semantics.
242- APFloat convertToFloat (const fltSemantics &FloatSema) const ;
243+ LLVM_ABI APFloat convertToFloat (const fltSemantics &FloatSema) const ;
243244
244- void toString (SmallVectorImpl<char > &Str) const ;
245+ LLVM_ABI void toString (SmallVectorImpl<char > &Str) const ;
245246 std::string toString () const {
246247 SmallString<40 > S;
247248 toString (S);
248249 return std::string (S);
249250 }
250251
251- void print (raw_ostream &) const ;
252+ LLVM_ABI void print (raw_ostream &) const ;
252253
253254#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
254255 LLVM_DUMP_METHOD void dump () const ;
255256#endif
256257
257258 // If LHS > RHS, return 1. If LHS == RHS, return 0. If LHS < RHS, return -1.
258- int compare (const APFixedPoint &Other) const ;
259+ LLVM_ABI int compare (const APFixedPoint &Other) const ;
259260 bool operator ==(const APFixedPoint &Other) const {
260261 return compare (Other) == 0 ;
261262 }
@@ -271,19 +272,19 @@ class APFixedPoint {
271272 return compare (Other) <= 0 ;
272273 }
273274
274- static APFixedPoint getMax (const FixedPointSemantics &Sema);
275- static APFixedPoint getMin (const FixedPointSemantics &Sema);
276- static APFixedPoint getEpsilon (const FixedPointSemantics &Sema);
275+ LLVM_ABI static APFixedPoint getMax (const FixedPointSemantics &Sema);
276+ LLVM_ABI static APFixedPoint getMin (const FixedPointSemantics &Sema);
277+ LLVM_ABI static APFixedPoint getEpsilon (const FixedPointSemantics &Sema);
277278
278279 // / Given a floating point semantic, return the next floating point semantic
279280 // / with a larger exponent and larger or equal mantissa.
280- static const fltSemantics *promoteFloatSemantics (const fltSemantics *S);
281+ LLVM_ABI static const fltSemantics *promoteFloatSemantics (const fltSemantics *S);
281282
282283 // / Create an APFixedPoint with a value equal to that of the provided integer,
283284 // / and in the same semantics as the provided target semantics. If the value
284285 // / is not able to fit in the specified fixed point semantics, and the
285286 // / overflow parameter is provided, it is set to true.
286- static APFixedPoint getFromIntValue (const APSInt &Value,
287+ LLVM_ABI static APFixedPoint getFromIntValue (const APSInt &Value,
287288 const FixedPointSemantics &DstFXSema,
288289 bool *Overflow = nullptr );
289290
@@ -294,7 +295,7 @@ class APFixedPoint {
294295 // / For NaN, the Overflow flag is always set. For +inf and -inf, if the
295296 // / semantic is saturating, the value saturates. Otherwise, the Overflow flag
296297 // / is set.
297- static APFixedPoint getFromFloatValue (const APFloat &Value,
298+ LLVM_ABI static APFixedPoint getFromFloatValue (const APFloat &Value,
298299 const FixedPointSemantics &DstFXSema,
299300 bool *Overflow = nullptr );
300301
0 commit comments