LLVM API Documentation

llvm::APFloat Class Reference

#include <APFloat.h>

Collaboration diagram for llvm::APFloat:
[legend]

List of all members.

Public Types

enum  cmpResult { cmpLessThan, cmpEqual, cmpGreaterThan, cmpUnordered }
enum  roundingMode {
  rmNearestTiesToEven, rmTowardPositive, rmTowardNegative, rmTowardZero,
  rmNearestTiesToAway
}
enum  opStatus {
  opOK = 0x00, opInvalidOp = 0x01, opDivByZero = 0x02, opOverflow = 0x04,
  opUnderflow = 0x08, opInexact = 0x10
}
enum  fltCategory { fcInfinity, fcNaN, fcNormal, fcZero }

Public Member Functions

 APFloat (const fltSemantics &, const char *)
 APFloat (const fltSemantics &, integerPart)
 APFloat (const fltSemantics &, fltCategory, bool negative)
 APFloat (double d)
 APFloat (float f)
 APFloat (const APInt &, bool isIEEE=false)
 APFloat (const APFloat &)
 ~APFloat ()
void Profile (FoldingSetNodeID &NID) const
void Emit (Serializer &S) const
 Used by the Bitcode serializer to emit APInts to Bitcode.
opStatus add (const APFloat &, roundingMode)
opStatus subtract (const APFloat &, roundingMode)
opStatus multiply (const APFloat &, roundingMode)
opStatus divide (const APFloat &, roundingMode)
opStatus remainder (const APFloat &)
opStatus mod (const APFloat &, roundingMode)
opStatus fusedMultiplyAdd (const APFloat &, const APFloat &, roundingMode)
void changeSign ()
void clearSign ()
void copySign (const APFloat &)
opStatus convert (const fltSemantics &, roundingMode, bool *)
opStatus convertToInteger (integerPart *, unsigned int, bool, roundingMode, bool *) const
opStatus convertFromAPInt (const APInt &, bool, roundingMode)
opStatus convertFromSignExtendedInteger (const integerPart *, unsigned int, bool, roundingMode)
opStatus convertFromZeroExtendedInteger (const integerPart *, unsigned int, bool, roundingMode)
opStatus convertFromString (const char *, roundingMode)
APInt bitcastToAPInt () const
double convertToDouble () const
float convertToFloat () const
cmpResult compare (const APFloat &) const
bool bitwiseIsEqual (const APFloat &) const
unsigned int convertToHexString (char *dst, unsigned int hexDigits, bool upperCase, roundingMode) const
fltCategory getCategory () const
const fltSemantics & getSemantics () const
bool isZero () const
bool isNonZero () const
bool isNaN () const
bool isInfinity () const
bool isNegative () const
bool isPosZero () const
bool isNegZero () const
APFloat & operator= (const APFloat &)
uint32_t getHashValue () const

Static Public Member Functions

static unsigned int semanticsPrecision (const fltSemantics &)
static APFloat getZero (const fltSemantics &Sem, bool Negative=false)
static APFloat getInf (const fltSemantics &Sem, bool Negative=false)
static APFloat getNaN (const fltSemantics &Sem, bool Negative=false)
static APFloat ReadVal (Deserializer &D)
 Used by the Bitcode deserializer to deserialize APInts.

Static Public Attributes

static const fltSemantics IEEEsingle = { 127, -126, 24, true }
static const fltSemantics IEEEdouble = { 1023, -1022, 53, true }
static const fltSemantics IEEEquad = { 16383, -16382, 113, true }
static const fltSemantics PPCDoubleDouble = { 1023, -1022, 106, false }
static const fltSemantics x87DoubleExtended = { 16383, -16382, 64, true }
static const fltSemantics Bogus = { 0, 0, 0, true }

Classes

union  Significand


Detailed Description

Definition at line 123 of file APFloat.h.


Member Enumeration Documentation

Enumerator:
cmpLessThan 
cmpEqual 
cmpGreaterThan 
cmpUnordered 

Definition at line 139 of file APFloat.h.

Enumerator:
rmNearestTiesToEven 
rmTowardPositive 
rmTowardNegative 
rmTowardZero 
rmNearestTiesToAway 

Definition at line 147 of file APFloat.h.

Enumerator:
opOK 
opInvalidOp 
opDivByZero 
opOverflow 
opUnderflow 
opInexact 

Definition at line 157 of file APFloat.h.

Enumerator:
fcInfinity 
fcNaN 
fcNormal 
fcZero 

Definition at line 167 of file APFloat.h.


Constructor & Destructor Documentation

APFloat::APFloat ( const fltSemantics &  ourSemantics,
const char *  text 
)

Definition at line 679 of file APFloat.cpp.

References assertArithmeticOK(), convertFromString(), and rmNearestTiesToEven.

Referenced by getInf(), getNaN(), getZero(), and ReadVal().

APFloat::APFloat ( const fltSemantics &  ourSemantics,
integerPart  value 
)

APFloat::APFloat ( const fltSemantics &  ourSemantics,
fltCategory  ourCategory,
bool  negative 
)

Definition at line 666 of file APFloat.cpp.

References assertArithmeticOK(), fcNaN, fcNormal, and fcZero.

APFloat::APFloat ( double  d  )  [explicit]

Definition at line 2944 of file APFloat.cpp.

References llvm::APInt::doubleToBits().

APFloat::APFloat ( float  f  )  [explicit]

Definition at line 2938 of file APFloat.cpp.

References llvm::APInt::floatToBits().

APFloat::APFloat ( const APInt &  api,
bool  isIEEE = false 
) [explicit]

Definition at line 2933 of file APFloat.cpp.

APFloat::APFloat ( const APFloat &  rhs  ) 

Definition at line 686 of file APFloat.cpp.

References semantics.

APFloat::~APFloat (  ) 

Definition at line 692 of file APFloat.cpp.


Member Function Documentation

unsigned int APFloat::semanticsPrecision ( const fltSemantics &  semantics  )  [static]

Definition at line 709 of file APFloat.cpp.

References llvm::fltSemantics::precision.

static APFloat llvm::APFloat::getZero ( const fltSemantics &  Sem,
bool  Negative = false 
) [inline, static]

Definition at line 185 of file APFloat.h.

References APFloat(), and fcZero.

static APFloat llvm::APFloat::getInf ( const fltSemantics &  Sem,
bool  Negative = false 
) [inline, static]

Definition at line 188 of file APFloat.h.

References APFloat(), and fcInfinity.

static APFloat llvm::APFloat::getNaN ( const fltSemantics &  Sem,
bool  Negative = false 
) [inline, static]

Definition at line 191 of file APFloat.h.

References APFloat(), and fcNaN.

void APFloat::Profile ( FoldingSetNodeID &  NID  )  const

Profile - Used to insert APFloat objects, or objects that contain APFloat objects, into FoldingSets.

Definition at line 698 of file APFloat.cpp.

References llvm::FoldingSetNodeID::Add(), and bitcastToAPInt().

void APFloat::Emit ( Serializer &  S  )  const

Used by the Bitcode serializer to emit APInts to Bitcode.

Definition at line 19 of file SerializeAPFloat.cpp.

References bitcastToAPInt(), and llvm::Serializer::Emit().

APFloat APFloat::ReadVal ( Deserializer &  D  )  [static]

Used by the Bitcode deserializer to deserialize APInts.

Definition at line 19 of file DeserializeAPFloat.cpp.

References APFloat(), and llvm::Deserializer::Read().

APFloat::opStatus APFloat::add ( const APFloat &  rhs,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::subtract ( const APFloat &  rhs,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::multiply ( const APFloat &  rhs,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::divide ( const APFloat &  rhs,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::remainder ( const APFloat &  rhs  ) 

APFloat::opStatus APFloat::mod ( const APFloat &  rhs,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::fusedMultiplyAdd ( const APFloat &  multiplicand,
const APFloat &  addend,
roundingMode  rounding_mode 
)

void APFloat::changeSign (  ) 

void APFloat::clearSign (  ) 

Definition at line 1454 of file APFloat.cpp.

Referenced by llvm::SelectionDAG::getNode().

void APFloat::copySign ( const APFloat &  rhs  ) 

Definition at line 1461 of file APFloat.cpp.

References sign.

Referenced by llvm::SelectionDAG::getNode().

APFloat::opStatus APFloat::convert ( const fltSemantics &  toSemantics,
roundingMode  rounding_mode,
bool *  losesInfo 
)

APFloat::convert - convert a value of one floating point type to another. The return value corresponds to the IEEE754 exceptions. *losesInfo records whether the transformation lost information, i.e. whether converting the result back to the original type will produce the original value (this is almost the same as return value==fsOK, but there are edge cases where this is not so).

Definition at line 1762 of file APFloat.cpp.

References assertArithmeticOK(), fcNaN, fcNormal, llvm::lfExactlyZero, lostFractionThroughTruncation(), opOK, partCountForBits(), llvm::fltSemantics::precision, llvm::APInt::tcAssign(), llvm::APInt::tcLSB(), llvm::APInt::tcSet(), llvm::APInt::tcShiftLeft(), llvm::APInt::tcShiftRight(), and x87DoubleExtended.

Referenced by llvm::ConstantFoldCastInstruction(), FitsInFPType(), llvm::ConstantFP::get(), llvm::SelectionDAG::getNode(), llvm::ConstantFPSDNode::isExactlyValue(), llvm::ConstantFP::isExactlyValue(), isFPCSafeToPrint(), llvm::ConstantFPSDNode::isValueValidForType(), llvm::ConstantFP::isValueValidForType(), LLVMConstReal(), WriteConstantInt(), and llvm::X86TargetLowering::X86TargetLowering().

APFloat::opStatus APFloat::convertToInteger ( integerPart *  parts,
unsigned int  width,
bool  isSigned,
roundingMode  rounding_mode,
bool *  isExact 
) const

APFloat::opStatus APFloat::convertFromAPInt ( const APInt &  Val,
bool  isSigned,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::convertFromSignExtendedInteger ( const integerPart *  src,
unsigned int  srcCount,
bool  isSigned,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::convertFromZeroExtendedInteger ( const integerPart *  parts,
unsigned int  width,
bool  isSigned,
roundingMode  rounding_mode 
)

Definition at line 2088 of file APFloat.cpp.

References llvm::APInt::getRawData(), partCountForBits(), and llvm::APInt::tcExtractBit().

Referenced by mod(), and remainder().

APFloat::opStatus APFloat::convertFromString ( const char *  p,
roundingMode  rounding_mode 
)

Definition at line 2362 of file APFloat.cpp.

References assertArithmeticOK().

Referenced by APFloat().

APInt APFloat::bitcastToAPInt (  )  const

double APFloat::convertToDouble (  )  const

float APFloat::convertToFloat (  )  const

APFloat::cmpResult APFloat::compare ( const APFloat &  rhs  )  const

bool APFloat::bitwiseIsEqual ( const APFloat &  rhs  )  const

unsigned int APFloat::convertToHexString ( char *  dst,
unsigned int  hexDigits,
bool  upperCase,
roundingMode  rounding_mode 
) const

fltCategory llvm::APFloat::getCategory (  )  const [inline]

Definition at line 256 of file APFloat.h.

const fltSemantics& llvm::APFloat::getSemantics (  )  const [inline]

bool llvm::APFloat::isZero (  )  const [inline]

Definition at line 258 of file APFloat.h.

References fcZero.

Referenced by isNegZero(), llvm::ConstantFP::isNullValue(), isPosZero(), mod(), and remainder().

bool llvm::APFloat::isNonZero (  )  const [inline]

Definition at line 259 of file APFloat.h.

References fcZero.

bool llvm::APFloat::isNaN (  )  const [inline]

Definition at line 260 of file APFloat.h.

References fcNaN.

bool llvm::APFloat::isInfinity (  )  const [inline]

Definition at line 261 of file APFloat.h.

References fcInfinity.

bool llvm::APFloat::isNegative (  )  const [inline]

bool llvm::APFloat::isPosZero (  )  const [inline]

Definition at line 263 of file APFloat.h.

References isNegative(), and isZero().

bool llvm::APFloat::isNegZero (  )  const [inline]

Definition at line 264 of file APFloat.h.

References isNegative(), and isZero().

APFloat & APFloat::operator= ( const APFloat &  rhs  ) 

Definition at line 612 of file APFloat.cpp.

References semantics.

uint32_t APFloat::getHashValue (  )  const

Definition at line 2559 of file APFloat.cpp.

References fcInfinity, fcNaN, fcZero, hash(), and llvm::fltSemantics::precision.


Member Data Documentation

const fltSemantics llvm::APFloat::IEEEsingle = { 127, -126, 24, true } [static]

const fltSemantics llvm::APFloat::IEEEdouble = { 1023, -1022, 53, true } [static]

const fltSemantics llvm::APFloat::IEEEquad = { 16383, -16382, 113, true } [static]

const fltSemantics llvm::APFloat::PPCDoubleDouble = { 1023, -1022, 106, false } [static]

const fltSemantics llvm::APFloat::x87DoubleExtended = { 16383, -16382, 64, true } [static]

const fltSemantics llvm::APFloat::Bogus = { 0, 0, 0, true } [static]

Definition at line 134 of file APFloat.h.

Referenced by llvm::ConstantFoldCastInstruction().


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