From ae000fcb2e47a88d507a616709ae42d4aefae7a0 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 21 Apr 2010 11:54:02 -0700 Subject: [PATCH] Implement structures and arrays in ir_dereference::is_lvalue --- ir.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ir.cpp b/ir.cpp index 7ada145d53b..6778997ac83 100644 --- a/ir.cpp +++ b/ir.cpp @@ -260,22 +260,21 @@ ir_dereference::is_lvalue() if (var == NULL) return false; + ir_variable *const as_var = var->as_variable(); if (mode == ir_reference_variable) { - ir_variable *const as_var = var->as_variable(); if (as_var == NULL) return false; if (as_var->type->is_array() && !as_var->array_lvalue) return false; + } + if (as_var != NULL) return !as_var->read_only; - } else if (mode == ir_reference_array) { - /* FINISHME: Walk up the dereference chain and figure out if - * FINISHME: the variable is read-only. - */ - } - return true; + /* Walk up the dereference chain and figure out if the variable is read-only. + */ + return this->var->as_rvalue()->is_lvalue(); } ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z, -- 2.30.2