//===- APFixedPoint.h - Fixed point constant handling -----------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// Defines the fixed point number interface. /// This is a class for abstracting various operations performed on fixed point /// types. /// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_APFIXEDPOINT_H #define LLVM_ADT_APFIXEDPOINT_H #include "llvm/ADT/APSInt.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/raw_ostream.h" namespace llvm { class APFloat; struct fltSemantics; /// The fixed point semantics work similarly to fltSemantics. The width /// specifies the whole bit width of the underlying scaled integer (with padding /// if any). The scale represents the number of fractional bits in this type. /// When HasUnsignedPadding is true and this type is unsigned, the first bit /// in the value this represents is treated as padding. class FixedPointSemantics { … }; static_assert …; inline hash_code hash_value(const FixedPointSemantics &Val) { … } template <> struct DenseMapInfo<FixedPointSemantics> { … }; /// The APFixedPoint class works similarly to APInt/APSInt in that it is a /// functional replacement for a scaled integer. It supports a wide range of /// semantics including the one used by fixed point types proposed in ISO/IEC /// JTC1 SC22 WG14 N1169. The class carries the value and semantics of /// a fixed point, and provides different operations that would normally be /// performed on fixed point types. class APFixedPoint { … }; inline raw_ostream &operator<<(raw_ostream &OS, const APFixedPoint &FX) { … } inline hash_code hash_value(const APFixedPoint &Val) { … } template <> struct DenseMapInfo<APFixedPoint> { … }; } // namespace llvm #endif