17 #ifndef LLVM_CLANG_BASIC_FIXEDPOINT_H 18 #define LLVM_CLANG_BASIC_FIXEDPOINT_H 20 #include "llvm/ADT/APSInt.h" 35 bool IsSaturated,
bool HasUnsignedPadding)
36 : Width(Width), Scale(Scale), IsSigned(IsSigned),
37 IsSaturated(IsSaturated), HasUnsignedPadding(HasUnsignedPadding) {
38 assert(Width >= Scale &&
"Not enough room for the scale");
50 if (IsSigned || (!IsSigned && HasUnsignedPadding))
51 return Width - Scale - 1;
61 bool HasUnsignedPadding;
77 : Val(Val, !Sema.
isSigned()), Sema(Sema) {
78 assert(Val.getBitWidth() == Sema.
getWidth() &&
79 "The value should have a bit width that matches the Sema width");
86 llvm::APSInt
getValue()
const {
return llvm::APSInt(Val, !
Sema.isSigned()); }
105 if (Val < 0 && Val != -Val)
llvm::APSInt getValue() const
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
The fixed point semantics work similarly to llvm::fltSemantics.
unsigned getScale() const
unsigned getWidth() const
bool operator!=(const APFixedPoint &Other) const
llvm::APSInt getIntPart() const
void setSaturated(bool Saturated)
unsigned getIntegralBits() const
bool operator>(const APFixedPoint &Other) const
unsigned getScale() const
The APFixedPoint class works similarly to APInt/APSInt in that it is a functional replacement for a s...
Sema - This implements semantic analysis and AST building for C.
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
APFixedPoint shl(unsigned Amt) const
bool operator<(const APFixedPoint &Other) const
APFixedPoint(uint64_t Val, const FixedPointSemantics &Sema)
bool hasUnsignedPadding() const
bool operator<=(const APFixedPoint &Other) const
FixedPointSemantics(unsigned Width, unsigned Scale, bool IsSigned, bool IsSaturated, bool HasUnsignedPadding)
bool operator==(const APFixedPoint &Other) const
Dataflow Directional Tag Classes.
APFixedPoint shr(unsigned Amt) const
unsigned getWidth() const
APFixedPoint(const llvm::APInt &Val, const FixedPointSemantics &Sema)
bool operator>=(const APFixedPoint &Other) const