LLVM API Documentation
#include <Constants.h>
Public Member Functions | |
const APFloat & | getValueAPF () const |
bool | isZero () const |
isZero - Return true if the value is positive or negative zero. | |
bool | isNegative () const |
isNegative - Return true if the sign bit is set. | |
bool | isNaN () const |
isNaN - Return true if the value is a NaN. | |
bool | isExactlyValue (const APFloat &V) const |
bool | isExactlyValue (double V) const |
Static Public Member Functions | |
static Constant * | getZeroValueForNegation (Type *Ty) |
static Constant * | get (Type *Ty, double V) |
static Constant * | get (Type *Ty, StringRef Str) |
static ConstantFP * | get (LLVMContext &Context, const APFloat &V) |
static Constant * | getNegativeZero (Type *Ty) |
static Constant * | getInfinity (Type *Ty, bool Negative=false) |
static bool | isValueValidForType (Type *Ty, const APFloat &V) |
isValueValidForType - return true if Ty is big enough to represent V. | |
static bool | classof (const Value *V) |
Methods for support type inquiry through isa, cast, and dyn_cast: | |
Protected Member Functions | |
ConstantFP (Type *Ty, const APFloat &V) | |
void * | operator new (size_t s) |
Friends | |
class | LLVMContextImpl |
ConstantFP - Floating Point Values [float, double]
Definition at line 228 of file Constants.h.
Definition at line 727 of file Constants.cpp.
References llvm::APFloat::getSemantics(), and TypeToFloatSemantics().
static bool llvm::ConstantFP::classof | ( | const Value * | V | ) | [inline, static] |
Methods for support type inquiry through isa, cast, and dyn_cast:
Reimplemented from llvm::Constant.
Definition at line 285 of file Constants.h.
References llvm::Value::ConstantFPVal, and llvm::Value::getValueID().
Constant * ConstantFP::get | ( | 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 638 of file Constants.cpp.
References llvm::CallingConv::C, llvm::APFloat::convert(), llvm::Type::getContext(), llvm::Type::getScalarType(), llvm::ConstantVector::getSplat(), llvm::APFloat::rmNearestTiesToEven, and TypeToFloatSemantics().
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCastInstruction(), ConstantFoldScalarCall(), llvm::MDBuilder::createFPMath(), CvtFDivConstToReciprocal(), FitsInFPType(), FoldBitCast(), llvm::Constant::getAllOnesValue(), GetConstantFoldFPValue(), llvm::SelectionDAG::getConstantFP(), llvm::ConstantDataSequential::getElementAsConstant(), llvm::Constant::getNullValue(), LLVMConstReal(), LLVMConstRealOfString(), LLVMConstRealOfStringAndSize(), LowerNegateToMultiply(), llvm::InstCombiner::visitCallInst(), and llvm::InstCombiner::visitFCmpInst().
Constant * ConstantFP::get | ( | Type * | Ty, |
StringRef | Str | ||
) | [static] |
Definition at line 655 of file Constants.cpp.
References llvm::CallingConv::C, llvm::Type::getContext(), llvm::Type::getScalarType(), llvm::ConstantVector::getSplat(), and TypeToFloatSemantics().
ConstantFP * ConstantFP::get | ( | LLVMContext & | Context, |
const APFloat & | V | ||
) | [static] |
Definition at line 689 of file Constants.cpp.
References llvm::LLVMContextImpl::FPConstants, llvm::Type::getDoubleTy(), llvm::Type::getFloatTy(), llvm::Type::getFP128Ty(), llvm::Type::getHalfTy(), llvm::Type::getPPC_FP128Ty(), llvm::APFloat::getSemantics(), llvm::Type::getX86_FP80Ty(), llvm::APFloat::IEEEdouble, llvm::APFloat::IEEEhalf, llvm::APFloat::IEEEquad, llvm::APFloat::IEEEsingle, llvm::LLVMContext::pImpl, llvm::APFloat::PPCDoubleDouble, and llvm::APFloat::x87DoubleExtended.
Constant * ConstantFP::getInfinity | ( | Type * | Ty, |
bool | Negative = false |
||
) | [static] |
Definition at line 717 of file Constants.cpp.
References llvm::CallingConv::C, llvm::Type::getContext(), llvm::APFloat::getInf(), llvm::Type::getScalarType(), llvm::ConstantVector::getSplat(), and TypeToFloatSemantics().
Constant * ConstantFP::getNegativeZero | ( | Type * | Ty | ) | [static] |
Definition at line 668 of file Constants.cpp.
References llvm::CallingConv::C, llvm::Type::getContext(), llvm::Type::getScalarType(), llvm::ConstantVector::getSplat(), llvm::APFloat::getZero(), and TypeToFloatSemantics().
Referenced by getZeroValueForNegation(), and llvm::InstCombiner::visitFMul().
const APFloat& llvm::ConstantFP::getValueAPF | ( | ) | const [inline] |
Definition at line 259 of file Constants.h.
Referenced by llvm::DwarfUnit::addConstantFPValue(), emitDebugValueComment(), emitGlobalConstantFP(), llvm::R600TargetLowering::EmitInstrWithCustomInserter(), FitsInFPType(), foldImmediates(), llvm::FPMathOperator::getFPAccuracy(), getValueAsDouble(), llvm::HexagonLowerToMC(), isFiniteNonZeroFp(), llvm::SIInstrInfo::isInlineConstant(), isNormalFp(), llvm::ARMAsmPrinter::lowerOperand(), and llvm::InstCombiner::visitSelectInst().
Constant * ConstantFP::getZeroValueForNegation | ( | 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 680 of file Constants.cpp.
References getNegativeZero(), llvm::Constant::getNullValue(), and llvm::Type::isFPOrFPVectorTy().
Referenced by llvm::BinaryOperator::CreateFNeg(), llvm::BinaryOperator::CreateNeg(), llvm::BinaryOperator::CreateNSWNeg(), llvm::BinaryOperator::CreateNUWNeg(), llvm::ConstantExpr::getFNeg(), and llvm::ConstantExpr::getNeg().
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 733 of file Constants.cpp.
References llvm::APFloat::bitwiseIsEqual().
Referenced by isExactlyValue().
bool llvm::ConstantFP::isExactlyValue | ( | double | V | ) | const [inline] |
Definition at line 278 of file Constants.h.
References llvm::APFloat::convert(), llvm::APFloat::getSemantics(), isExactlyValue(), and llvm::APFloat::rmNearestTiesToEven.
bool llvm::ConstantFP::isNaN | ( | ) | const [inline] |
isNaN - Return true if the value is a NaN.
Definition at line 268 of file Constants.h.
References llvm::APFloat::isNaN().
bool llvm::ConstantFP::isNegative | ( | ) | const [inline] |
isNegative - Return true if the sign bit is set.
Definition at line 265 of file Constants.h.
References llvm::APFloat::isNegative().
bool ConstantFP::isValueValidForType | ( | Type * | Ty, |
const APFloat & | V | ||
) | [static] |
isValueValidForType - return true if Ty is big enough to represent V.
Definition at line 1279 of file Constants.cpp.
References llvm::lltok::APFloat, llvm::APFloat::convert(), llvm::Type::DoubleTyID, llvm::Type::FloatTyID, llvm::Type::FP128TyID, llvm::APFloat::getSemantics(), llvm::Type::getTypeID(), llvm::Type::HalfTyID, llvm::APFloat::IEEEdouble, llvm::APFloat::IEEEhalf, llvm::APFloat::IEEEquad, llvm::APFloat::IEEEsingle, llvm::Type::PPC_FP128TyID, llvm::APFloat::PPCDoubleDouble, llvm::APFloat::rmNearestTiesToEven, llvm::Type::X86_FP80TyID, and llvm::APFloat::x87DoubleExtended.
bool llvm::ConstantFP::isZero | ( | ) | const [inline] |
isZero - Return true if the value is positive or negative zero.
Definition at line 262 of file Constants.h.
References llvm::APFloat::isZero().
void* llvm::ConstantFP::operator new | ( | size_t | s | ) | [inline, protected] |
Reimplemented from llvm::User.
Definition at line 238 of file Constants.h.
References operator new().
friend class LLVMContextImpl [friend] |
Definition at line 233 of file Constants.h.