LLVM API Documentation

llvm::ConstantFP Class Reference

#include <Constants.h>

Inheritance diagram for llvm::ConstantFP:
[legend]
Collaboration diagram for llvm::ConstantFP:
[legend]

List of all members.

Public Member Functions

const APFloat & getValueAPF () const
virtual bool isNullValue () const
virtual bool isNegativeZeroValue () const
bool isExactlyValue (const APFloat &V) const
bool isExactlyValue (double V) const

Static Public Member Functions

static Constant * getZeroValueForNegation (const Type *Ty)
static Constant * get (const Type *Ty, double V)
static Constant * get (const Type *Ty, const StringRef &Str)
static ConstantFP * get (LLVMContext &Context, const APFloat &V)
static ConstantFP * getNegativeZero (const Type *Ty)
static bool isValueValidForType (const Type *Ty, const APFloat &V)
 isValueValidForType - return true if Ty is big enough to represent V.
static bool classof (const ConstantFP *)
 Methods for support type inquiry through isa, cast, and dyn_cast:.
static bool classof (const Value *V)

Protected Member Functions

 ConstantFP (const Type *Ty, const APFloat &V)
void * operator new (size_t s)

Friends

class LLVMContextImpl


Detailed Description

ConstantFP - Floating Point Values [float, double]

Definition at line 235 of file Constants.h.


Constructor & Destructor Documentation

ConstantFP::ConstantFP ( const Type *  Ty,
const APFloat &  V 
) [protected]

Definition at line 436 of file Constants.cpp.

References llvm::APFloat::getSemantics(), and TypeToFloatSemantics().


Member Function Documentation

void* llvm::ConstantFP::operator new ( size_t  s  )  [inline, protected]

Reimplemented from llvm::User.

Definition at line 244 of file Constants.h.

References operator new().

Constant * ConstantFP::getZeroValueForNegation ( const Type *  Ty  )  [static]

Floating point negation must be implemented with f(x) = -0.0 - x. This method returns the negative zero constant for floating point or vector floating point types; for all other types, it returns the null value.

Definition at line 384 of file Constants.cpp.

References llvm::ConstantVector::get(), getNegativeZero(), llvm::Constant::getNullValue(), and llvm::Type::isFloatingPoint().

Referenced by llvm::BinaryOperator::CreateFNeg(), llvm::BinaryOperator::CreateNeg(), llvm::ConstantExpr::getFNeg(), and llvm::ConstantExpr::getNeg().

Constant * ConstantFP::get ( const Type *  Ty,
double  V 
) [static]

get() - This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in the specified type. This should only be used for simple constant values like 2.0/1.0 etc, that are known-valid both as host double and as the target format.

get() - This returns a constant fp for the specified value in the specified type. This should only be used for simple constant values like 2.0/1.0 etc, that are known-valid both as double and as the target format.

Definition at line 343 of file Constants.cpp.

References llvm::CallingConv::C, Context, llvm::APFloat::convert(), llvm::ConstantVector::get(), llvm::Type::getContext(), llvm::Type::getScalarType(), llvm::APFloat::rmNearestTiesToEven, and TypeToFloatSemantics().

Referenced by ConstantFoldBinaryFP(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCall(), llvm::ConstantFoldCastInstruction(), ConstantFoldFP(), llvm::SelectionDAG::getConstantFP(), llvm::Constant::getNullValue(), and llvm::JIT::runFunction().

Constant * ConstantFP::get ( const Type *  Ty,
const StringRef &  Str 
) [static]

ConstantFP * ConstantFP::get ( LLVMContext &  Context,
const APFloat &  V 
) [static]

ConstantFP * ConstantFP::getNegativeZero ( const Type *  Ty  )  [static]

bool ConstantFP::isValueValidForType ( const Type *  Ty,
const APFloat &  V 
) [static]

const APFloat& llvm::ConstantFP::getValueAPF (  )  const [inline]

bool ConstantFP::isNullValue (  )  const [virtual]

isNullValue - Return true if this is the value that would be returned by getNullValue. Don't depend on == for doubles to tell us it's zero, it considers -0.0 to be null as well as 0.0. :(

Implements llvm::Constant.

Definition at line 442 of file Constants.cpp.

References llvm::APFloat::isNegative(), and llvm::APFloat::isZero().

virtual bool llvm::ConstantFP::isNegativeZeroValue (  )  const [inline, virtual]

isNegativeZeroValue - Return true if the value is what would be returned by getZeroValueForNegation.

Reimplemented from llvm::Constant.

Definition at line 273 of file Constants.h.

References Val.

bool ConstantFP::isExactlyValue ( const APFloat &  V  )  const

isExactlyValue - We don't rely on operator== working on double values, as it returns true for things that are clearly not equal, like -0.0 and 0.0. As such, this method can be used to do an exact bit-for-bit comparison of two floating point values. The version with a double operand is retained because it's so convenient to write isExactlyValue(2.0), but please use it only for simple constants.

Definition at line 446 of file Constants.cpp.

References llvm::APFloat::bitwiseIsEqual().

Referenced by isExactlyValue().

bool llvm::ConstantFP::isExactlyValue ( double  V  )  const [inline]

static bool llvm::ConstantFP::classof ( const ConstantFP *   )  [inline, static]

Methods for support type inquiry through isa, cast, and dyn_cast:.

Definition at line 295 of file Constants.h.

static bool llvm::ConstantFP::classof ( const Value *  V  )  [inline, static]

Reimplemented from llvm::Constant.

Definition at line 296 of file Constants.h.

References llvm::Value::ConstantFPVal, and llvm::Value::getValueID().


Friends And Related Function Documentation

friend class LLVMContextImpl [friend]

Definition at line 239 of file Constants.h.


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