summaryrefslogtreecommitdiffstats
path: root/include/llvm/Constants.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-03-06 21:02:43 +0000
committerChris Lattner <sabre@nondot.org>2003-03-06 21:02:43 +0000
commita5ae71a137b9c6f458cc6c9064be787dbc5f4311 (patch)
treee01a18a4574a24aa78b53c25ed201d32cfcdedec /include/llvm/Constants.h
parent27accf7692562d247a162a6762391b4c07d2c23d (diff)
downloadexternal_llvm-a5ae71a137b9c6f458cc6c9064be787dbc5f4311.zip
external_llvm-a5ae71a137b9c6f458cc6c9064be787dbc5f4311.tar.gz
external_llvm-a5ae71a137b9c6f458cc6c9064be787dbc5f4311.tar.bz2
Extend struct and array constants to support isNullValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5719 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constants.h')
-rw-r--r--include/llvm/Constants.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index ec63458..6c1b8eb 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -289,7 +289,14 @@ public:
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue.
- virtual bool isNullValue() const { return false; }
+ virtual bool isNullValue() const {
+ // FIXME: This should be made to be MUCH faster. Just check against well
+ // known null value!
+ for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
+ if (!cast<Constant>(getOperand(i))->isNullValue())
+ return false;
+ return true;
+ }
virtual void destroyConstant();
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To);
@@ -328,7 +335,14 @@ public:
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue.
- virtual bool isNullValue() const { return false; }
+ virtual bool isNullValue() const {
+ // FIXME: This should be made to be MUCH faster. Just check against well
+ // known null value!
+ for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
+ if (!cast<Constant>(getOperand(i))->isNullValue())
+ return false;
+ return true;
+ }
virtual void destroyConstant();
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To);