mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 15:48:38 +00:00
Add a ConstantFP::getInf utility function for creating infinity ConstantFPs.
llvm-svn: 82818
This commit is contained in:
parent
7c98ffa2b6
commit
01b2c857ed
@ -258,6 +258,7 @@ public:
|
||||
static Constant* get(const Type* Ty, const StringRef& Str);
|
||||
static ConstantFP* get(LLVMContext &Context, const APFloat& V);
|
||||
static ConstantFP* getNegativeZero(const Type* Ty);
|
||||
static ConstantFP* getInf(const Type* Ty, bool negative = false);
|
||||
|
||||
/// isValueValidForType - return true if Ty is big enough to represent V.
|
||||
static bool isValueValidForType(const Type *Ty, const APFloat& V);
|
||||
|
@ -436,6 +436,12 @@ ConstantFP* ConstantFP::get(LLVMContext &Context, const APFloat& V) {
|
||||
return Slot;
|
||||
}
|
||||
|
||||
ConstantFP *ConstantFP::getInf(const Type *Ty, bool Negative) {
|
||||
const fltSemantics &Semantics = *TypeToFloatSemantics(Ty);
|
||||
return ConstantFP::get(Ty->getContext(),
|
||||
APFloat::getInf(Semantics, Negative));
|
||||
}
|
||||
|
||||
ConstantFP::ConstantFP(const Type *Ty, const APFloat& V)
|
||||
: Constant(Ty, ConstantFPVal, 0, 0), Val(V) {
|
||||
assert(&V.getSemantics() == TypeToFloatSemantics(Ty) &&
|
||||
|
Loading…
Reference in New Issue
Block a user