Skip to content

Commit 37172da

Browse files
committed
[llvm] IDS auto codemod for ADT library
1 parent f338216 commit 37172da

22 files changed

+561
-542
lines changed

llvm/include/llvm/ADT/APFixedPoint.h

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
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

126127
private:
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,25 +235,25 @@ 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-
void dump() const;
252+
LLVM_ABI void print(raw_ostream &) const;
253+
LLVM_ABI void dump() const;
253254

254255
// If LHS > RHS, return 1. If LHS == RHS, return 0. If LHS < RHS, return -1.
255-
int compare(const APFixedPoint &Other) const;
256+
LLVM_ABI int compare(const APFixedPoint &Other) const;
256257
bool operator==(const APFixedPoint &Other) const {
257258
return compare(Other) == 0;
258259
}
@@ -268,19 +269,19 @@ class APFixedPoint {
268269
return compare(Other) <= 0;
269270
}
270271

271-
static APFixedPoint getMax(const FixedPointSemantics &Sema);
272-
static APFixedPoint getMin(const FixedPointSemantics &Sema);
273-
static APFixedPoint getEpsilon(const FixedPointSemantics &Sema);
272+
LLVM_ABI static APFixedPoint getMax(const FixedPointSemantics &Sema);
273+
LLVM_ABI static APFixedPoint getMin(const FixedPointSemantics &Sema);
274+
LLVM_ABI static APFixedPoint getEpsilon(const FixedPointSemantics &Sema);
274275

275276
/// Given a floating point semantic, return the next floating point semantic
276277
/// with a larger exponent and larger or equal mantissa.
277-
static const fltSemantics *promoteFloatSemantics(const fltSemantics *S);
278+
LLVM_ABI static const fltSemantics *promoteFloatSemantics(const fltSemantics *S);
278279

279280
/// Create an APFixedPoint with a value equal to that of the provided integer,
280281
/// and in the same semantics as the provided target semantics. If the value
281282
/// is not able to fit in the specified fixed point semantics, and the
282283
/// overflow parameter is provided, it is set to true.
283-
static APFixedPoint getFromIntValue(const APSInt &Value,
284+
LLVM_ABI static APFixedPoint getFromIntValue(const APSInt &Value,
284285
const FixedPointSemantics &DstFXSema,
285286
bool *Overflow = nullptr);
286287

@@ -291,7 +292,7 @@ class APFixedPoint {
291292
/// For NaN, the Overflow flag is always set. For +inf and -inf, if the
292293
/// semantic is saturating, the value saturates. Otherwise, the Overflow flag
293294
/// is set.
294-
static APFixedPoint getFromFloatValue(const APFloat &Value,
295+
LLVM_ABI static APFixedPoint getFromFloatValue(const APFloat &Value,
295296
const FixedPointSemantics &DstFXSema,
296297
bool *Overflow = nullptr);
297298

0 commit comments

Comments
 (0)