X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FConstants.h;h=a75aaf72a309c4889cf93cb071ac026ccf3def54;hb=0cf15d61b7e3bf53f5a99f58ada37b93bc039559;hp=4b356067998d842c13fe7d01724760a1eb1ddf53;hpb=d75ff3104c2298ecb4abb18fb4bfc3f20a9099f8;p=oota-llvm.git diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 4b356067998..a75aaf72a30 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -25,7 +25,6 @@ #include "llvm/OperandTraits.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/APFloat.h" -#include "llvm/ADT/SmallVector.h" #include namespace llvm { @@ -40,6 +39,8 @@ template struct ConstantCreator; template struct ConvertConstantType; +template +class SmallVector; //===----------------------------------------------------------------------===// /// This is the shared class of boolean and integer constants. This class @@ -275,6 +276,12 @@ public: return Val.isZero() && Val.isNegative(); } + /// isZero - Return true if the value is positive or negative zero. + bool isZero() const { return Val.isZero(); } + + /// isNaN - Return true if the value is a NaN. + bool isNaN() const { return Val.isNaN(); } + /// 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 @@ -452,6 +459,7 @@ struct OperandTraits : public VariadicOperandTraits<> { DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantStruct, Constant) + //===----------------------------------------------------------------------===// /// ConstantVector - Constant Vector Declarations /// @@ -640,15 +648,13 @@ public: // ConstantExpr class, because they will attempt to fold the constant // expression into something simpler if possible. - /// Cast constant expr - /// - /// getAlignOf constant expr - computes the alignment of a type in a target /// independent way (Note: the return type is an i64). static Constant *getAlignOf(const Type* Ty); - /// getSizeOf constant expr - computes the size of a type in a target - /// independent way (Note: the return type is an i64). + /// getSizeOf constant expr - computes the (alloc) size of a type (in + /// address-units, not bits) in a target independent way (Note: the return + /// type is an i64). /// static Constant *getSizeOf(const Type* Ty); @@ -697,10 +703,13 @@ public: static Constant *getBitCast (Constant *C, const Type *Ty); static Constant *getNSWNeg(Constant *C); + static Constant *getNUWNeg(Constant *C); static Constant *getNSWAdd(Constant *C1, Constant *C2); + static Constant *getNUWAdd(Constant *C1, Constant *C2); static Constant *getNSWSub(Constant *C1, Constant *C2); - static Constant *getNUWMul(Constant *C1, Constant *C2); + static Constant *getNUWSub(Constant *C1, Constant *C2); static Constant *getNSWMul(Constant *C1, Constant *C2); + static Constant *getNUWMul(Constant *C1, Constant *C2); static Constant *getExactSDiv(Constant *C1, Constant *C2); /// Transparently provide more efficient getOperand methods. @@ -871,7 +880,11 @@ DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantExpr, Constant) /// UndefValue - 'undef' values are things that do not have specified contents. /// These are used for a variety of purposes, including global variable /// initializers and operands to instructions. 'undef' values can occur with -/// any type. +/// any first-class type. +/// +/// Undef values aren't exactly constants; if they have multiple uses, they +/// can appear to have different bit patterns at each use. See +/// LangRef.html#undefvalues for details. /// class UndefValue : public Constant { friend struct ConstantCreator; @@ -902,6 +915,7 @@ public: return V->getValueID() == UndefValueVal; } }; + } // End llvm namespace #endif