LLVM  8.0.1
Functions

Functions in this group model LLVMValueRef instances that correspond to constants referring to scalar types. More...

Collaboration diagram for Scalar constants:

Functions

LLVMValueRef LLVMConstInt (LLVMTypeRef IntTy, unsigned long long N, LLVMBool SignExtend)
 Obtain a constant value for an integer type. More...
 
LLVMValueRef LLVMConstIntOfArbitraryPrecision (LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])
 Obtain a constant value for an integer of arbitrary precision. More...
 
LLVMValueRef LLVMConstIntOfString (LLVMTypeRef IntTy, const char *Text, uint8_t Radix)
 Obtain a constant value for an integer parsed from a string. More...
 
LLVMValueRef LLVMConstIntOfStringAndSize (LLVMTypeRef IntTy, const char *Text, unsigned SLen, uint8_t Radix)
 Obtain a constant value for an integer parsed from a string with specified length. More...
 
LLVMValueRef LLVMConstReal (LLVMTypeRef RealTy, double N)
 Obtain a constant value referring to a double floating point value. More...
 
LLVMValueRef LLVMConstRealOfString (LLVMTypeRef RealTy, const char *Text)
 Obtain a constant for a floating point value parsed from a string. More...
 
LLVMValueRef LLVMConstRealOfStringAndSize (LLVMTypeRef RealTy, const char *Text, unsigned SLen)
 Obtain a constant for a floating point value parsed from a string. More...
 
unsigned long long LLVMConstIntGetZExtValue (LLVMValueRef ConstantVal)
 Obtain the zero extended value for an integer constant value. More...
 
long long LLVMConstIntGetSExtValue (LLVMValueRef ConstantVal)
 Obtain the sign extended value for an integer constant value. More...
 
double LLVMConstRealGetDouble (LLVMValueRef ConstantVal, LLVMBool *losesInfo)
 Obtain the double value for an floating point constant value. More...
 

Detailed Description

Functions in this group model LLVMValueRef instances that correspond to constants referring to scalar types.

For integer types, the LLVMTypeRef parameter should correspond to a llvm::IntegerType instance and the returned LLVMValueRef will correspond to a llvm::ConstantInt.

For floating point types, the LLVMTypeRef returned corresponds to a llvm::ConstantFP.

Function Documentation

◆ LLVMConstInt()

LLVMValueRef LLVMConstInt ( LLVMTypeRef  IntTy,
unsigned long long  N,
LLVMBool  SignExtend 
)

Obtain a constant value for an integer type.

The returned value corresponds to a llvm::ConstantInt.

See also
llvm::ConstantInt::get()
Parameters
IntTyInteger type to obtain value of.
NThe value the returned instance should refer to.
SignExtendWhether to sign extend the produced value.

Definition at line 1274 of file Core.cpp.

References llvm::ConstantInt::get(), and llvm::wrap().

◆ LLVMConstIntGetSExtValue()

long long LLVMConstIntGetSExtValue ( LLVMValueRef  ConstantVal)

Obtain the sign extended value for an integer constant value.

See also
llvm::ConstantInt::getSExtValue()

Definition at line 1317 of file Core.cpp.

◆ LLVMConstIntGetZExtValue()

unsigned long long LLVMConstIntGetZExtValue ( LLVMValueRef  ConstantVal)

Obtain the zero extended value for an integer constant value.

See also
llvm::ConstantInt::getZExtValue()

Definition at line 1313 of file Core.cpp.

◆ LLVMConstIntOfArbitraryPrecision()

LLVMValueRef LLVMConstIntOfArbitraryPrecision ( LLVMTypeRef  IntTy,
unsigned  NumWords,
const uint64_t  Words[] 
)

Obtain a constant value for an integer of arbitrary precision.

See also
llvm::ConstantInt::get()

Definition at line 1279 of file Core.cpp.

References llvm::ConstantInt::get(), llvm::IntegerType::getBitWidth(), llvm::Type::getContext(), llvm::makeArrayRef(), and llvm::wrap().

◆ LLVMConstIntOfString()

LLVMValueRef LLVMConstIntOfString ( LLVMTypeRef  IntTy,
const char Text,
uint8_t  Radix 
)

Obtain a constant value for an integer parsed from a string.

A similar API, LLVMConstIntOfStringAndSize is also available. If the string's length is available, it is preferred to call that function instead.

See also
llvm::ConstantInt::get()

◆ LLVMConstIntOfStringAndSize()

LLVMValueRef LLVMConstIntOfStringAndSize ( LLVMTypeRef  IntTy,
const char Text,
unsigned  SLen,
uint8_t  Radix 
)

Obtain a constant value for an integer parsed from a string with specified length.

See also
llvm::ConstantInt::get()

◆ LLVMConstReal()

LLVMValueRef LLVMConstReal ( LLVMTypeRef  RealTy,
double  N 
)

Obtain a constant value referring to a double floating point value.

Definition at line 1300 of file Core.cpp.

References llvm::ConstantFP::get(), llvm::unwrap(), and llvm::wrap().

◆ LLVMConstRealGetDouble()

double LLVMConstRealGetDouble ( LLVMValueRef  ConstantVal,
LLVMBool losesInfo 
)

Obtain the double value for an floating point constant value.

losesInfo indicates if some precision was lost in the conversion.

See also
llvm::ConstantFP::getDoubleValue

Definition at line 1321 of file Core.cpp.

References llvm::APFloat::convert(), llvm::APFloat::convertToDouble(), llvm::APFloat::convertToFloat(), llvm::Value::getType(), llvm::ConstantFP::getValueAPF(), llvm::APFloatBase::IEEEdouble(), and llvm::APFloatBase::rmNearestTiesToEven.

◆ LLVMConstRealOfString()

LLVMValueRef LLVMConstRealOfString ( LLVMTypeRef  RealTy,
const char Text 
)

Obtain a constant for a floating point value parsed from a string.

A similar API, LLVMConstRealOfStringAndSize is also available. It should be used if the input string's length is known.

Definition at line 1304 of file Core.cpp.

References llvm::ConstantFP::get(), llvm::unwrap(), and llvm::wrap().

◆ LLVMConstRealOfStringAndSize()

LLVMValueRef LLVMConstRealOfStringAndSize ( LLVMTypeRef  RealTy,
const char Text,
unsigned  SLen 
)

Obtain a constant for a floating point value parsed from a string.