Aggressively prune the DFS when inserting phi-defs.
[oota-llvm.git] / include / llvm / ADT / APFloat.h
index d4c2f950e2db571c0844c777681996e736274444..dfe4e0f49adb2836f7202fcd2d551e662691495b 100644 (file)
@@ -173,11 +173,16 @@ namespace llvm {
       fcZero
     };
 
+    enum uninitializedTag {
+      uninitialized
+    };
+
     // Constructors.
     APFloat(const fltSemantics &); // Default construct to 0.0
-    APFloat(const fltSemantics &, const StringRef &);
+    APFloat(const fltSemantics &, StringRef);
     APFloat(const fltSemantics &, integerPart);
-    APFloat(const fltSemantics &, fltCategory, bool negative, unsigned type=0);
+    APFloat(const fltSemantics &, fltCategory, bool negative);
+    APFloat(const fltSemantics &, uninitializedTag);
     explicit APFloat(double d);
     explicit APFloat(float f);
     explicit APFloat(const APInt &, bool isIEEE = false);
@@ -199,7 +204,26 @@ namespace llvm {
     /// default.  The value is truncated as necessary.
     static APFloat getNaN(const fltSemantics &Sem, bool Negative = false,
                           unsigned type = 0) {
-      return APFloat(Sem, fcNaN, Negative, type);
+      if (type) {
+        APInt fill(64, type);
+        return getQNaN(Sem, Negative, &fill);
+      } else {
+        return getQNaN(Sem, Negative, 0);
+      }
+    }
+
+    /// getQNan - Factory for QNaN values.
+    static APFloat getQNaN(const fltSemantics &Sem,
+                           bool Negative = false,
+                           const APInt *payload = 0) {
+      return makeNaN(Sem, false, Negative, payload);
+    }
+
+    /// getSNan - Factory for SNaN values.
+    static APFloat getSNaN(const fltSemantics &Sem,
+                           bool Negative = false,
+                           const APInt *payload = 0) {
+      return makeNaN(Sem, true, Negative, payload);
     }
 
     /// getLargest - Returns the largest finite number in the given
@@ -258,7 +282,7 @@ namespace llvm {
                                             bool, roundingMode);
     opStatus convertFromZeroExtendedInteger(const integerPart *, unsigned int,
                                             bool, roundingMode);
-    opStatus convertFromString(const StringRef&, roundingMode);
+    opStatus convertFromString(StringRef, roundingMode);
     APInt bitcastToAPInt() const;
     double convertToDouble() const;
     float convertToFloat() const;
@@ -304,7 +328,8 @@ namespace llvm {
     ///   precision to output.  If there are fewer digits available,
     ///   zero padding will not be used unless the value is
     ///   integral and small enough to be expressed in
-    ///   FormatPrecision digits.
+    ///   FormatPrecision digits.  0 means to use the natural
+    ///   precision of the number.
     /// \param FormatMaxPadding The maximum number of zeros to
     ///   consider inserting before falling back to scientific
     ///   notation.  0 means to always use scientific notation.
@@ -315,11 +340,11 @@ namespace llvm {
     /// 1.01E+4              4             2       1.01E+4
     /// 1.01E+4              5             1       1.01E+4
     /// 1.01E-2              5             2       0.0101
-    /// 1.01E-2              4             2       1.01E-2
+    /// 1.01E-2              4             2       0.0101
     /// 1.01E-2              4             1       1.01E-2
     void toString(SmallVectorImpl<char> &Str,
-                  unsigned FormatPrecision = 8,
-                  unsigned FormatMaxPadding = 3);
+                  unsigned FormatPrecision = 0,
+                  unsigned FormatMaxPadding = 3) const;
 
   private:
 
@@ -349,7 +374,9 @@ namespace llvm {
     opStatus modSpecials(const APFloat &);
 
     /* Miscellany.  */
-    void makeNaN(unsigned = 0);
+    static APFloat makeNaN(const fltSemantics &Sem, bool SNaN, bool Negative,
+                           const APInt *fill);
+    void makeNaN(bool SNaN = false, bool Neg = false, const APInt *fill = 0);
     opStatus normalize(roundingMode, lostFraction);
     opStatus addOrSubtract(const APFloat &, roundingMode, bool subtract);
     cmpResult compareAbsoluteValue(const APFloat &) const;
@@ -359,8 +386,8 @@ namespace llvm {
                                           roundingMode, bool *) const;
     opStatus convertFromUnsignedParts(const integerPart *, unsigned int,
                                       roundingMode);
-    opStatus convertFromHexadecimalString(const StringRef&, roundingMode);
-    opStatus convertFromDecimalString (const StringRef&, roundingMode);
+    opStatus convertFromHexadecimalString(StringRef, roundingMode);
+    opStatus convertFromDecimalString(StringRef, roundingMode);
     char *convertNormalToHexString(char *, unsigned int, bool,
                                    roundingMode) const;
     opStatus roundSignificandWithExponent(const integerPart *, unsigned int,