summaryrefslogtreecommitdiffstats
path: root/include/clang/Basic/TargetInfo.h
diff options
context:
space:
mode:
authorLeonard Chan <leonardchan@google.com>2018-08-06 16:42:37 +0000
committerLeonard Chan <leonardchan@google.com>2018-08-06 16:42:37 +0000
commit0fb95938a3413eb60232cbe186b9c66df1d657e3 (patch)
treeffb1079e1ace7073b0cf6d48d4405180ed38b802 /include/clang/Basic/TargetInfo.h
parent1d1e4e257b6c260b28e00487f9f3301c56defccf (diff)
[Fixed Point Arithmetic] Fixed Point Constant
This patch proposes an abstract type that represents fixed point numbers, similar to APInt or APSInt that was discussed in https://reviews.llvm.org/D48456#inline-425585. This type holds a value, scale, and saturation and is meant to perform intermediate calculations on constant fixed point values. Currently this class is used as a way for handling the conversions between fixed point numbers with different sizes and radixes. For example, if I'm casting from a signed _Accum to a saturated unsigned short _Accum, I will need to check the value of the signed _Accum to see if it fits into the short _Accum which involves getting and comparing against the max/min values of the short _Accum. The FixedPointNumber class currently handles the radix shifting and extension when converting to a signed _Accum. Differential Revision: https://reviews.llvm.org/D48661 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/TargetInfo.h')
-rw-r--r--include/clang/Basic/TargetInfo.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index f91f7761da..c3ef56110b 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -312,6 +312,14 @@ public:
}
}
+ /// In the event this target uses the same number of fractional bits for its
+ /// unsigned types as it does with its signed counterparts, there will be
+ /// exactly one bit of padding.
+ /// Return true if unsigned fixed point types have padding for this target.
+ bool doUnsignedFixedPointTypesHavePadding() const {
+ return PaddingOnUnsignedFixedPoint;
+ }
+
/// Return the width (in bits) of the specified integer type enum.
///
/// For example, SignedInt -> getIntWidth().