[Mesa-dev] [RFC 2/3] glsl: set non-default cases for assignment_recipient
Alejandro PiƱeiro
apinheiro at igalia.com
Wed Feb 24 19:04:46 UTC 2016
It is true for the lhs of all the ast nodes related with assignmnent,
plus the array on ast_array_index.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94129
---
src/compiler/glsl/ast_to_hir.cpp | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 6b70e1f..ee5485c 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -1333,7 +1333,7 @@ ast_expression::do_hir(exec_list *instructions,
break;
case ast_assign: {
- op[0] = this->subexpressions[0]->hir(instructions, state);
+ op[0] = this->subexpressions[0]->hir(instructions, state, true);
op[1] = this->subexpressions[1]->hir(instructions, state);
error_emitted =
@@ -1602,7 +1602,7 @@ ast_expression::do_hir(exec_list *instructions,
case ast_div_assign:
case ast_add_assign:
case ast_sub_assign: {
- op[0] = this->subexpressions[0]->hir(instructions, state);
+ op[0] = this->subexpressions[0]->hir(instructions, state, true);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = arithmetic_result_type(op[0], op[1],
@@ -1628,7 +1628,7 @@ ast_expression::do_hir(exec_list *instructions,
}
case ast_mod_assign: {
- op[0] = this->subexpressions[0]->hir(instructions, state);
+ op[0] = this->subexpressions[0]->hir(instructions, state, true);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = modulus_result_type(op[0], op[1], state, &loc);
@@ -1650,7 +1650,7 @@ ast_expression::do_hir(exec_list *instructions,
case ast_ls_assign:
case ast_rs_assign: {
- op[0] = this->subexpressions[0]->hir(instructions, state);
+ op[0] = this->subexpressions[0]->hir(instructions, state, true);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = shift_result_type(op[0]->type, op[1]->type, this->oper, state,
&loc);
@@ -1668,7 +1668,7 @@ ast_expression::do_hir(exec_list *instructions,
case ast_and_assign:
case ast_xor_assign:
case ast_or_assign: {
- op[0] = this->subexpressions[0]->hir(instructions, state);
+ op[0] = this->subexpressions[0]->hir(instructions, state, true);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = bit_logic_result_type(op[0], op[1], this->oper, state, &loc);
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
@@ -1848,8 +1848,10 @@ ast_expression::do_hir(exec_list *instructions,
case ast_array_index: {
YYLTYPE index_loc = subexpressions[1]->get_location();
-
- op[0] = subexpressions[0]->hir(instructions, state);
+ /* Getting if an array is being used unintialized is beyond what we get
+ * from ir_value.data.assigned. Setting isAssigned as false would force
+ * to not raise a unitialized warning when using an array*/
+ op[0] = subexpressions[0]->hir(instructions, state, true);
op[1] = subexpressions[1]->hir(instructions, state);
result = _mesa_ast_array_index_to_hir(ctx, state, op[0], op[1],
--
2.5.0
More information about the mesa-dev
mailing list