aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-11-01 05:53:56 +0000
committerChris Lattner <sabre@nondot.org>2001-11-01 05:53:56 +0000
commit0eca13bf58e0a1d6b492ca257d01abc19c4024da (patch)
tree2d5a6622eaab0740440daafe761d85f1f032562f /include
parent8d38e54c2f1b58ba617892801183836f0a7d2ca8 (diff)
downloadexternal_llvm-0eca13bf58e0a1d6b492ca257d01abc19c4024da.zip
external_llvm-0eca13bf58e0a1d6b492ca257d01abc19c4024da.tar.gz
external_llvm-0eca13bf58e0a1d6b492ca257d01abc19c4024da.tar.bz2
Add new isNullValue method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1076 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ConstPoolVals.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/include/llvm/ConstPoolVals.h b/include/llvm/ConstPoolVals.h
index 3142bbb..b25ca3e 100644
--- a/include/llvm/ConstPoolVals.h
+++ b/include/llvm/ConstPoolVals.h
@@ -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) {