aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2005-08-17 20:06:22 +0000
committerJim Laskey <jlaskey@mac.com>2005-08-17 20:06:22 +0000
commit3a1eff732b36a663cdb9f07f4a9ccae6452eadcb (patch)
treea234ed0b089f91f3468b7ede6853feec5b06840c
parentb8df7c22131368abd3e7d6e0e4b0fc6ee74f8427 (diff)
Move code dependency for MathExtras.h out of Constants.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22840 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Constants.h9
-rw-r--r--lib/VMCore/Constants.cpp9
2 files changed, 11 insertions, 7 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 1a9d87d68a..4a5d0181a5 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -23,7 +23,6 @@
#include "llvm/Constant.h"
#include "llvm/Type.h"
#include "llvm/Support/DataTypes.h"
-#include "llvm/Support/MathExtras.h"
namespace llvm {
@@ -277,17 +276,13 @@ public:
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue. Don't depend on == for doubles to tell us it's zero, it
/// considers -0.0 to be null as well as 0.0. :(
- virtual bool isNullValue() const {
- return DoubleToBits(Val) == 0;
- }
+ virtual bool isNullValue() 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.
- bool isExactlyValue(double V) const {
- return DoubleToBits(V) == DoubleToBits(Val);
- }
+ bool isExactlyValue(double V) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantFP *) { return true; }
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index a14b690313..d250002441 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -812,6 +812,15 @@ namespace llvm {
static ValueMap<uint64_t, Type, ConstantFP> DoubleConstants;
static ValueMap<uint32_t, Type, ConstantFP> FloatConstants;
+bool ConstantFP::isNullValue() const {
+ return DoubleToBits(Val) == 0;
+}
+
+bool ConstantFP::isExactlyValue(double V) const {
+ return DoubleToBits(V) == DoubleToBits(Val);
+}
+
+
ConstantFP *ConstantFP::get(const Type *Ty, double V) {
if (Ty == Type::FloatTy) {
// Force the value through memory to normalize it.