clang  10.0.0svn
Public Member Functions | Static Public Member Functions | List of all members
clang::FixedPointSemantics Class Reference

The fixed point semantics work similarly to llvm::fltSemantics. More...

#include "clang/Basic/FixedPoint.h"

Public Member Functions

 FixedPointSemantics (unsigned Width, unsigned Scale, bool IsSigned, bool IsSaturated, bool HasUnsignedPadding)
 
unsigned getWidth () const
 
unsigned getScale () const
 
bool isSigned () const
 
bool isSaturated () const
 
bool hasUnsignedPadding () const
 
void setSaturated (bool Saturated)
 
unsigned getIntegralBits () const
 Return the number of integral bits represented by these semantics. More...
 
FixedPointSemantics getCommonSemantics (const FixedPointSemantics &Other) const
 Return the FixedPointSemantics that allows for calculating the full precision semantic that can precisely represent the precision and ranges of both input values. More...
 

Static Public Member Functions

static FixedPointSemantics GetIntegerSemantics (unsigned Width, bool IsSigned)
 Return the FixedPointSemantics for an integer type. More...
 

Detailed Description

The fixed point semantics work similarly to llvm::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 signed, the first bit in the value this represents is treaded as padding.

Definition at line 33 of file FixedPoint.h.

Constructor & Destructor Documentation

◆ FixedPointSemantics()

clang::FixedPointSemantics::FixedPointSemantics ( unsigned  Width,
unsigned  Scale,
bool  IsSigned,
bool  IsSaturated,
bool  HasUnsignedPadding 
)
inline

Definition at line 35 of file FixedPoint.h.

Referenced by GetIntegerSemantics().

Member Function Documentation

◆ getCommonSemantics()

FixedPointSemantics clang::FixedPointSemantics::getCommonSemantics ( const FixedPointSemantics Other) const

Return the FixedPointSemantics that allows for calculating the full precision semantic that can precisely represent the precision and ranges of both input values.

This does not compute the resulting semantics for a given binary operation.

Definition at line 127 of file FixedPoint.cpp.

References getIntegralBits(), getScale(), clang::APFixedPoint::getScale(), hasUnsignedPadding(), isSaturated(), clang::APFixedPoint::isSaturated(), isSigned(), clang::APFixedPoint::isSigned(), and max().

Referenced by getIntegralBits(), and tryEmitFMulAdd().

◆ GetIntegerSemantics()

static FixedPointSemantics clang::FixedPointSemantics::GetIntegerSemantics ( unsigned  Width,
bool  IsSigned 
)
inlinestatic

Return the FixedPointSemantics for an integer type.

Definition at line 70 of file FixedPoint.h.

References FixedPointSemantics().

Referenced by clang::ASTContext::getFixedPointSemantics(), and clang::APFixedPoint::getFromIntValue().

◆ getIntegralBits()

unsigned clang::FixedPointSemantics::getIntegralBits ( ) const
inline

Return the number of integral bits represented by these semantics.

These are separate from the fractional bits and do not include the sign or padding bit.

Definition at line 55 of file FixedPoint.h.

References getCommonSemantics().

Referenced by clang::APFixedPoint::convert(), and getCommonSemantics().

◆ getScale()

unsigned clang::FixedPointSemantics::getScale ( ) const
inline

◆ getWidth()

unsigned clang::FixedPointSemantics::getWidth ( ) const
inline

◆ hasUnsignedPadding()

bool clang::FixedPointSemantics::hasUnsignedPadding ( ) const
inline

◆ isSaturated()

bool clang::FixedPointSemantics::isSaturated ( ) const
inline

◆ isSigned()

bool clang::FixedPointSemantics::isSigned ( ) const
inline

◆ setSaturated()

void clang::FixedPointSemantics::setSaturated ( bool  Saturated)
inline

Definition at line 50 of file FixedPoint.h.


The documentation for this class was generated from the following files: