Add new isNullValue method

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1076 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-11-01 05:53:56 +00:00
parent 8d38e54c2f
commit 0eca13bf58

View File

@ -43,6 +43,10 @@ public:
// Static constructor to get a '0' constant of arbitrary type...
static ConstPoolVal *getNullConstant(const Type *Ty);
// isNullValue - Return true if this is the value that would be returned by
// getNullConstant.
virtual bool isNullValue() const = 0;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstPoolVal *) { return true; }
static inline bool classof(const Value *V) {
@ -77,6 +81,10 @@ public:
virtual string getStrValue() const;
inline bool getValue() const { return Val; }
// isNullValue - Return true if this is the value that would be returned by
// getNullConstant.
virtual bool isNullValue() const { return this == False; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstPoolBool *) { return true; }
static bool classof(const ConstPoolVal *CPV) {
@ -117,6 +125,10 @@ public:
//
static ConstPoolInt *get(const Type *Ty, unsigned char V);
// isNullValue - Return true if this is the value that would be returned by
// getNullConstant.
virtual bool isNullValue() const { return Val.Unsigned == 0; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstPoolInt *) { return true; }
static bool classof(const ConstPoolVal *CPV); // defined in CPV.cpp
@ -192,6 +204,10 @@ public:
static bool isValueValidForType(const Type *Ty, double V);
inline double getValue() const { return Val; }
// isNullValue - Return true if this is the value that would be returned by
// getNullConstant.
virtual bool isNullValue() const { return Val == 0; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstPoolFP *) { return true; }
static bool classof(const ConstPoolVal *CPV); // defined in CPV.cpp
@ -219,6 +235,10 @@ public:
inline const vector<Use> &getValues() const { return Operands; }
// isNullValue - Return true if this is the value that would be returned by
// getNullConstant.
virtual bool isNullValue() const { return false; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstPoolArray *) { return true; }
static bool classof(const ConstPoolVal *CPV); // defined in CPV.cpp
@ -246,6 +266,10 @@ public:
inline const vector<Use> &getValues() const { return Operands; }
// isNullValue - Return true if this is the value that would be returned by
// getNullConstant.
virtual bool isNullValue() const { return false; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstPoolStruct *) { return true; }
static bool classof(const ConstPoolVal *CPV); // defined in CPV.cpp
@ -261,7 +285,6 @@ public:
// a more specific/useful instance, a subclass of ConstPoolPointer should be
// used.
//
class ConstPoolPointerNull;
class ConstPoolPointer : public ConstPoolVal {
ConstPoolPointer(const ConstPoolPointer &); // DO NOT IMPLEMENT
protected:
@ -270,6 +293,10 @@ protected:
public:
virtual string getStrValue() const = 0;
// isNullValue - Return true if this is the value that would be returned by
// getNullConstant.
virtual bool isNullValue() const { return false; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstPoolPointer *) { return true; }
static bool classof(const ConstPoolVal *CPV); // defined in CPV.cpp
@ -290,6 +317,10 @@ public:
static ConstPoolPointerNull *get(const PointerType *T);
// isNullValue - Return true if this is the value that would be returned by
// getNullConstant.
virtual bool isNullValue() const { return true; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstPoolPointerNull *) { return true; }
static inline bool classof(const ConstPoolPointer *P) {