summaryrefslogtreecommitdiff
path: root/ir.h
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-05-26 11:32:52 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-05-26 15:23:25 -0700
commitb067db2e253059e83249b1e4d5f3c626b0e33807 (patch)
treef9deff26e662c3e3b1c62ec3ca7729627676af09 /ir.h
parent36ea28646c666ac2af9b43c47e65f9f53ffcc390 (diff)
Refactor whole-variable assigment checking into member function
Diffstat (limited to 'ir.h')
-rw-r--r--ir.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/ir.h b/ir.h
index 2e6a194321..306ec8c162 100644
--- a/ir.h
+++ b/ir.h
@@ -95,6 +95,21 @@ public:
return NULL;
}
+
+ /**
+ * If an r-value is a reference to a whole variable, get that variable
+ *
+ * \return
+ * Pointer to a variable that is completely dereferenced by the r-value. If
+ * the r-value is not a dereference or the dereference does not access the
+ * entire variable (i.e., it's just one array element, struct field), \c NULL
+ * is returned.
+ */
+ virtual ir_variable *whole_variable_referenced()
+ {
+ return NULL;
+ }
+
protected:
ir_rvalue()
{
@@ -827,6 +842,17 @@ public:
return this->var;
}
+ virtual ir_variable *whole_variable_referenced()
+ {
+ /* ir_dereference_variable objects always dereference the entire
+ * variable. However, if this dereference is dereferenced by anything
+ * else, the complete deferefernce chain is not a whole-variable
+ * dereference. This method should only be called on the top most
+ * ir_rvalue in a dereference chain.
+ */
+ return this->var;
+ }
+
virtual void accept(ir_visitor *v)
{
v->visit(this);