[Mesa-dev] [PATCH 5.5/8] glsl: Just ignore non-dereference IR in constant_referenced
Ian Romanick
idr at freedesktop.org
Wed Mar 12 16:14:11 PDT 2014
From: Ian Romanick <ian.d.romanick at intel.com>
This simplifies some of the call sites.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/glsl/ir_constant_expression.cpp | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index f7174ad..7ffbde0 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -396,7 +396,7 @@ unpack_half_1x16(uint16_t u)
*/
/*@{*/
static bool
-constant_referenced(const ir_dereference *deref,
+constant_referenced(const ir_rvalue *rv,
struct hash_table *variable_context,
ir_constant *&store, int &offset)
{
@@ -406,10 +406,10 @@ constant_referenced(const ir_dereference *deref,
if (variable_context == NULL)
return false;
- switch (deref->ir_type) {
+ switch (rv->ir_type) {
case ir_type_dereference_array: {
const ir_dereference_array *const da =
- (const ir_dereference_array *) deref;
+ (const ir_dereference_array *) rv;
ir_constant *index_c =
da->array_index->constant_expression_value(variable_context);
@@ -424,11 +424,7 @@ constant_referenced(const ir_dereference *deref,
ir_constant *substore;
int suboffset;
- const ir_dereference *array_deref = da->array->as_dereference();
- if (!array_deref)
- break;
-
- if (!constant_referenced(array_deref, variable_context, substore,
+ if (!constant_referenced(da->array, variable_context, substore,
suboffset))
break;
@@ -454,16 +450,12 @@ constant_referenced(const ir_dereference *deref,
case ir_type_dereference_record: {
const ir_dereference_record *const dr =
- (const ir_dereference_record *) deref;
-
- const ir_dereference *const rec_deref = dr->record->as_dereference();
- if (!rec_deref)
- break;
+ (const ir_dereference_record *) rv;
ir_constant *substore;
int suboffset;
- if (!constant_referenced(rec_deref, variable_context, substore,
+ if (!constant_referenced(dr->record, variable_context, substore,
suboffset))
break;
@@ -477,14 +469,13 @@ constant_referenced(const ir_dereference *deref,
case ir_type_dereference_variable: {
const ir_dereference_variable *const dv =
- (const ir_dereference_variable *) deref;
+ (const ir_dereference_variable *) rv;
store = (ir_constant *) hash_table_find(variable_context, dv->var);
break;
}
default:
- assert(!"Should not get here.");
break;
}
--
1.8.1.4
More information about the mesa-dev
mailing list