[llvm-commits] [llvm] r82818 - in /llvm/trunk: include/llvm/Constants.h lib/VMCore/Constants.cpp
Dan Gohman
gohman at apple.com
Fri Sep 25 16:00:48 PDT 2009
Author: djg
Date: Fri Sep 25 18:00:48 2009
New Revision: 82818
URL: http://llvm.org/viewvc/llvm-project?rev=82818&view=rev
Log:
Add a ConstantFP::getInf utility function for creating infinity ConstantFPs.
Modified:
llvm/trunk/include/llvm/Constants.h
llvm/trunk/lib/VMCore/Constants.cpp
Modified: llvm/trunk/include/llvm/Constants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=82818&r1=82817&r2=82818&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Constants.h (original)
+++ llvm/trunk/include/llvm/Constants.h Fri Sep 25 18:00:48 2009
@@ -258,6 +258,7 @@
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);
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=82818&r1=82817&r2=82818&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Fri Sep 25 18:00:48 2009
@@ -436,6 +436,12 @@
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) &&
More information about the llvm-commits
mailing list