Make read-only variables not be considered lvalues.
authorEric Anholt <eric@anholt.net>
Fri, 26 Mar 2010 22:51:45 +0000 (15:51 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 27 Mar 2010 00:51:41 +0000 (17:51 -0700)
This should fix tests trying to assign to builtin "in" variables, and
will also be relied on for post_inc/dec handling.

ir.h

diff --git a/ir.h b/ir.h
index a69f932..7e2f304 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -455,7 +455,17 @@ public:
 
    bool is_lvalue()
    {
-      return var != NULL;
+      ir_variable *as_var;
+
+      if (var == NULL)
+        return NULL;
+
+      as_var = var->as_variable();
+
+      if (as_var == NULL)
+        return NULL;
+
+      return !as_var->read_only;
    }
 
    enum {