1919#include " llvm/ADT/APSInt.h"
2020#include " llvm/ADT/Hashing.h"
2121#include " llvm/ADT/SmallString.h"
22+ #include " llvm/Support/Compiler.h"
2223#include " llvm/Support/raw_ostream.h"
2324
2425namespace llvm {
@@ -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,26 @@ 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- bool *Overflow = nullptr ) const ;
194+ LLVM_ABI APFixedPoint convert (const FixedPointSemantics &DstSema,
195+ 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,
202+ bool *Overflow = nullptr ) const ;
203+ LLVM_ABI APFixedPoint sub (const APFixedPoint &Other,
204+ bool *Overflow = nullptr ) const ;
205+ LLVM_ABI APFixedPoint mul (const APFixedPoint &Other,
206+ bool *Overflow = nullptr ) const ;
207+ LLVM_ABI APFixedPoint div (const APFixedPoint &Other,
208+ bool *Overflow = nullptr ) const ;
204209
205210 // Perform shift operations on a fixed point type. Unlike the other binary
206211 // operations, the resulting fixed point value will be in the original
207212 // semantic.
208- APFixedPoint shl (unsigned Amt, bool *Overflow = nullptr ) const ;
213+ LLVM_ABI APFixedPoint shl (unsigned Amt, bool *Overflow = nullptr ) const ;
209214 APFixedPoint shr (unsigned Amt, bool *Overflow = nullptr ) const {
210215 // Right shift cannot overflow.
211216 if (Overflow)
@@ -215,7 +220,7 @@ class APFixedPoint {
215220
216221 // / Perform a unary negation (-X) on this fixed point type, taking into
217222 // / account saturation if applicable.
218- APFixedPoint negate (bool *Overflow = nullptr ) const ;
223+ LLVM_ABI APFixedPoint negate (bool *Overflow = nullptr ) const ;
219224
220225 // / Return the integral part of this fixed point number, rounded towards
221226 // / zero. (-2.5k -> -2)
@@ -234,28 +239,28 @@ class APFixedPoint {
234239 // / If the overflow parameter is provided, and the integral value is not able
235240 // / to be fully stored in the provided width and sign, the overflow parameter
236241 // / is set to true.
237- APSInt convertToInt (unsigned DstWidth, bool DstSign,
238- bool *Overflow = nullptr ) const ;
242+ LLVM_ABI APSInt convertToInt (unsigned DstWidth, bool DstSign,
243+ bool *Overflow = nullptr ) const ;
239244
240245 // / Convert this fixed point number to a floating point value with the
241246 // / provided semantics.
242- APFloat convertToFloat (const fltSemantics &FloatSema) const ;
247+ LLVM_ABI APFloat convertToFloat (const fltSemantics &FloatSema) const ;
243248
244- void toString (SmallVectorImpl<char > &Str) const ;
249+ LLVM_ABI void toString (SmallVectorImpl<char > &Str) const ;
245250 std::string toString () const {
246251 SmallString<40 > S;
247252 toString (S);
248253 return std::string (S);
249254 }
250255
251- void print (raw_ostream &) const ;
256+ LLVM_ABI void print (raw_ostream &) const ;
252257
253258#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
254259 LLVM_DUMP_METHOD void dump () const ;
255260#endif
256261
257262 // If LHS > RHS, return 1. If LHS == RHS, return 0. If LHS < RHS, return -1.
258- int compare (const APFixedPoint &Other) const ;
263+ LLVM_ABI int compare (const APFixedPoint &Other) const ;
259264 bool operator ==(const APFixedPoint &Other) const {
260265 return compare (Other) == 0 ;
261266 }
@@ -271,21 +276,22 @@ class APFixedPoint {
271276 return compare (Other) <= 0 ;
272277 }
273278
274- static APFixedPoint getMax (const FixedPointSemantics &Sema);
275- static APFixedPoint getMin (const FixedPointSemantics &Sema);
276- static APFixedPoint getEpsilon (const FixedPointSemantics &Sema);
279+ LLVM_ABI static APFixedPoint getMax (const FixedPointSemantics &Sema);
280+ LLVM_ABI static APFixedPoint getMin (const FixedPointSemantics &Sema);
281+ LLVM_ABI static APFixedPoint getEpsilon (const FixedPointSemantics &Sema);
277282
278283 // / Given a floating point semantic, return the next floating point semantic
279284 // / with a larger exponent and larger or equal mantissa.
280- static const fltSemantics *promoteFloatSemantics (const fltSemantics *S);
285+ LLVM_ABI static const fltSemantics *
286+ promoteFloatSemantics (const fltSemantics *S);
281287
282288 // / Create an APFixedPoint with a value equal to that of the provided integer,
283289 // / and in the same semantics as the provided target semantics. If the value
284290 // / is not able to fit in the specified fixed point semantics, and the
285291 // / overflow parameter is provided, it is set to true.
286- static APFixedPoint getFromIntValue ( const APSInt &Value,
287- const FixedPointSemantics &DstFXSema,
288- bool *Overflow = nullptr );
292+ LLVM_ABI static APFixedPoint
293+ getFromIntValue ( const APSInt &Value, const FixedPointSemantics &DstFXSema,
294+ bool *Overflow = nullptr );
289295
290296 // / Create an APFixedPoint with a value equal to that of the provided
291297 // / floating point value, in the provided target semantics. If the value is
@@ -294,9 +300,9 @@ class APFixedPoint {
294300 // / For NaN, the Overflow flag is always set. For +inf and -inf, if the
295301 // / semantic is saturating, the value saturates. Otherwise, the Overflow flag
296302 // / is set.
297- static APFixedPoint getFromFloatValue ( const APFloat &Value,
298- const FixedPointSemantics &DstFXSema,
299- bool *Overflow = nullptr );
303+ LLVM_ABI static APFixedPoint
304+ getFromFloatValue ( const APFloat &Value, const FixedPointSemantics &DstFXSema,
305+ bool *Overflow = nullptr );
300306
301307private:
302308 APSInt Val;
0 commit comments