LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
llvm::ConstantFP Class Reference

#include <Constants.h>

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

Public Member Functions

const APFloatgetValueAPF () const
 
bool isZero () const
 isZero - Return true if the value is positive or negative zero. More...
 
bool isNegative () const
 isNegative - Return true if the sign bit is set. More...
 
bool isNaN () const
 isNaN - Return true if the value is a NaN. More...
 
bool isExactlyValue (const APFloat &V) const
 
bool isExactlyValue (double V) const
 
- Public Member Functions inherited from llvm::Constant
bool isNullValue () const
 
bool isAllOnesValue () const
 
bool isNegativeZeroValue () const
 
bool isZeroValue () const
 Return true if the value is negative zero or null value. More...
 
bool canTrap () const
 
bool isThreadDependent () const
 isThreadDependent - Return true if the value can vary between threads. More...
 
bool isConstantUsed () const
 
PossibleRelocationsTy getRelocationInfo () const
 
ConstantgetAggregateElement (unsigned Elt) const
 
ConstantgetAggregateElement (Constant *Elt) const
 
ConstantgetSplatValue () const
 
const APIntgetUniqueInteger () const
 
virtual void destroyConstant ()
 
virtual void replaceUsesOfWithOnConstant (Value *, Value *, Use *)
 
void removeDeadConstantUsers () const
 
- Public Member Functions inherited from llvm::User
 ~User ()
 
void operator delete (void *Usr)
 operator delete - free memory allocated for User and Use objects More...
 
void operator delete (void *, unsigned)
 placement delete - required by std, but never called. More...
 
void operator delete (void *, unsigned, bool)
 placement delete - required by std, but never called. More...
 
ValuegetOperand (unsigned i) const
 
void setOperand (unsigned i, Value *Val)
 
const UsegetOperandUse (unsigned i) const
 
UsegetOperandUse (unsigned i)
 
unsigned getNumOperands () const
 
op_iterator op_begin ()
 
const_op_iterator op_begin () const
 
op_iterator op_end ()
 
const_op_iterator op_end () const
 
value_op_iterator value_op_begin ()
 
value_op_iterator value_op_end ()
 
void dropAllReferences ()
 
void replaceUsesOfWith (Value *From, Value *To)
 
- Public Member Functions inherited from llvm::Value
virtual ~Value ()
 
void dump () const
 dump - Support for debugging, callable in GDB: V->dump() More...
 
void print (raw_ostream &O, AssemblyAnnotationWriter *AAW=0) const
 
TypegetType () const
 
LLVMContextgetContext () const
 All values hold a context through their type. More...
 
bool hasName () const
 
ValueNamegetValueName () const
 
void setValueName (ValueName *VN)
 
StringRef getName () const
 
void setName (const Twine &Name)
 
void takeName (Value *V)
 
void replaceAllUsesWith (Value *V)
 
bool use_empty () const
 
use_iterator use_begin ()
 
const_use_iterator use_begin () const
 
use_iterator use_end ()
 
const_use_iterator use_end () const
 
Useruse_back ()
 
const Useruse_back () const
 
bool hasOneUse () const
 
bool hasNUses (unsigned N) const
 
bool hasNUsesOrMore (unsigned N) const
 
bool isUsedInBasicBlock (const BasicBlock *BB) const
 
unsigned getNumUses () const
 
void addUse (Use &U)
 
unsigned getValueID () const
 
unsigned getRawSubclassOptionalData () const
 
void clearSubclassOptionalData ()
 
bool hasSameSubclassOptionalData (const Value *V) const
 
void intersectOptionalDataWith (const Value *V)
 
bool hasValueHandle () const
 
ValuestripPointerCasts ()
 Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCasts () const
 
ValuestripPointerCastsNoFollowAliases ()
 Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCastsNoFollowAliases () const
 
ValuestripInBoundsConstantOffsets ()
 Strips off unneeded pointer casts and all-constant GEPs from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsConstantOffsets () const
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 Strips like stripInBoundsConstantOffsets but also accumulates the constant offset stripped. More...
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 
ValuestripInBoundsOffsets ()
 Strips off unneeded pointer casts and any in-bounds offsets from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsOffsets () const
 
bool isDereferenceablePointer () const
 
ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 
void mutateType (Type *Ty)
 

Static Public Member Functions

static ConstantgetZeroValueForNegation (Type *Ty)
 
static Constantget (Type *Ty, double V)
 
static Constantget (Type *Ty, StringRef Str)
 
static ConstantFPget (LLVMContext &Context, const APFloat &V)
 
static ConstantFPgetNegativeZero (Type *Ty)
 
static ConstantFPgetInfinity (Type *Ty, bool Negative=false)
 
static bool isValueValidForType (Type *Ty, const APFloat &V)
 isValueValidForType - return true if Ty is big enough to represent V. More...
 
static bool classof (const Value *V)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
- Static Public Member Functions inherited from llvm::Constant
static bool classof (const Value *V)
 
static ConstantgetNullValue (Type *Ty)
 
static ConstantgetAllOnesValue (Type *Ty)
 Get the all ones value. More...
 
static ConstantgetIntegerValue (Type *Ty, const APInt &V)
 
- Static Public Member Functions inherited from llvm::User
static bool classof (const Value *V)
 

Protected Member Functions

 ConstantFP (Type *Ty, const APFloat &V)
 
void * operator new (size_t s)
 
- Protected Member Functions inherited from llvm::Constant
 Constant (Type *ty, ValueTy vty, Use *Ops, unsigned NumOps)
 
void destroyConstantImpl ()
 
- Protected Member Functions inherited from llvm::User
void * operator new (size_t s, unsigned Us)
 
 User (Type *ty, unsigned vty, Use *OpList, unsigned NumOps)
 
UseallocHungoffUses (unsigned) const
 
void dropHungoffUses ()
 
template<int Idx>
UseOp ()
 
template<int Idx>
const UseOp () const
 
- Protected Member Functions inherited from llvm::Value
virtual void printCustom (raw_ostream &O) const
 
 Value (Type *Ty, unsigned scid)
 
unsigned short getSubclassDataFromValue () const
 
void setValueSubclassData (unsigned short D)
 

Friends

class LLVMContextImpl
 

Additional Inherited Members

- Public Types inherited from llvm::Constant
enum  PossibleRelocationsTy { NoRelocation = 0, LocalRelocation = 1, GlobalRelocations = 2 }
 
- Public Types inherited from llvm::User
typedef Useop_iterator
 
typedef const Useconst_op_iterator
 
- Public Types inherited from llvm::Value
enum  ValueTy {
  ArgumentVal, BasicBlockVal, FunctionVal, GlobalAliasVal,
  GlobalVariableVal, UndefValueVal, BlockAddressVal, ConstantExprVal,
  ConstantAggregateZeroVal, ConstantDataArrayVal, ConstantDataVectorVal, ConstantIntVal,
  ConstantFPVal, ConstantArrayVal, ConstantStructVal, ConstantVectorVal,
  ConstantPointerNullVal, MDNodeVal, MDStringVal, InlineAsmVal,
  PseudoSourceValueVal, FixedStackPseudoSourceValueVal, InstructionVal, ConstantFirstVal = FunctionVal,
  ConstantLastVal = ConstantPointerNullVal
}
 
typedef value_use_iterator< Useruse_iterator
 
typedef value_use_iterator
< const User
const_use_iterator
 
- Static Public Attributes inherited from llvm::Value
static const unsigned MaximumAlignment = 1u << 29
 
- Static Protected Member Functions inherited from llvm::User
template<int Idx, typename U >
static UseOpFrom (const U *that)
 
- Protected Attributes inherited from llvm::User
UseOperandList
 
unsigned NumOperands
 
- Protected Attributes inherited from llvm::Value
unsigned char SubclassOptionalData: 7
 

Detailed Description

ConstantFP - Floating Point Values [float, double]

Definition at line 232 of file Constants.h.

Constructor & Destructor Documentation

ConstantFP::ConstantFP ( Type Ty,
const APFloat V 
)
protected

Definition at line 644 of file Constants.cpp.

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

Member Function Documentation

static bool llvm::ConstantFP::classof ( const Value V)
inlinestatic

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

Definition at line 289 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 557 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::X86TargetLowering::BuildFILD(), ConstantFoldBinaryFP(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCall(), llvm::ConstantFoldCastInstruction(), ConstantFoldFP(), llvm::MDBuilder::createFPMath(), CvtFDivConstToReciprocal(), FitsInFPType(), FoldBitCast(), llvm::Constant::getAllOnesValue(), llvm::SelectionDAG::getConstantFP(), llvm::ConstantDataSequential::getElementAsConstant(), getInfinity(), llvm::Constant::getNullValue(), LLVMConstReal(), LLVMConstRealOfString(), LLVMConstRealOfStringAndSize(), llvm::JIT::runFunction(), llvm::InstCombiner::visitCallInst(), and llvm::InstCombiner::visitFCmpInst().

Constant * ConstantFP::get ( Type Ty,
StringRef  Str 
)
static
ConstantFP * ConstantFP::get ( LLVMContext Context,
const APFloat V 
)
static
ConstantFP * ConstantFP::getInfinity ( Type Ty,
bool  Negative = false 
)
static
ConstantFP * ConstantFP::getNegativeZero ( Type Ty)
static
const APFloat& llvm::ConstantFP::getValueAPF ( ) const
inline
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 596 of file Constants.cpp.

References llvm::CallingConv::C, getNegativeZero(), llvm::Constant::getNullValue(), llvm::Type::getScalarType(), llvm::ConstantVector::getSplat(), and llvm::Type::isFloatingPointTy().

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 650 of file Constants.cpp.

References llvm::APFloat::bitwiseIsEqual().

Referenced by detectLog2OfHalf(), isExactlyValue(), llvm::SIInstrInfo::isInlineConstant(), and llvm::AArch64AsmPrinter::PrintAsmOperand().

bool llvm::ConstantFP::isExactlyValue ( double  V) const
inline
bool llvm::ConstantFP::isNaN ( ) const
inline

isNaN - Return true if the value is a NaN.

Definition at line 272 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 269 of file Constants.h.

References llvm::APFloat::isNegative().

bool ConstantFP::isValueValidForType ( Type Ty,
const APFloat V 
)
static
bool llvm::ConstantFP::isZero ( ) const
inline

isZero - Return true if the value is positive or negative zero.

Definition at line 266 of file Constants.h.

References llvm::APFloat::isZero().

Referenced by llvm::AArch64AsmPrinter::lowerOperand().

void* llvm::ConstantFP::operator new ( size_t  s)
inlineprotected

Definition at line 242 of file Constants.h.

Friends And Related Function Documentation

friend class LLVMContextImpl
friend

Definition at line 237 of file Constants.h.


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