It was easy while typing implementations to accidentally overwrite the
original expression or assignment variables.
-ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign)
+ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *orig_assign)
- ir_expression *expr = assign->rhs->as_expression();
+ ir_expression *orig_expr = orig_assign->rhs->as_expression();
bool found_matrix = false;
unsigned int i, matrix_columns = 1;
ir_variable *op_var[2];
bool found_matrix = false;
unsigned int i, matrix_columns = 1;
ir_variable *op_var[2];
- for (i = 0; i < expr->get_num_operands(); i++) {
- if (expr->operands[i]->type->is_matrix()) {
+ for (i = 0; i < orig_expr->get_num_operands(); i++) {
+ if (orig_expr->operands[i]->type->is_matrix()) {
- matrix_columns = expr->operands[i]->type->matrix_columns;
+ matrix_columns = orig_expr->operands[i]->type->matrix_columns;
break;
}
}
if (!found_matrix)
return visit_continue;
break;
}
}
if (!found_matrix)
return visit_continue;
- mem_ctx = talloc_parent(assign);
+ mem_ctx = talloc_parent(orig_assign);
- ir_dereference_variable *lhs_deref = assign->lhs->as_dereference_variable();
+ ir_dereference_variable *lhs_deref =
+ orig_assign->lhs->as_dereference_variable();
assert(lhs_deref);
ir_variable *result_var = lhs_deref->var;
assert(lhs_deref);
ir_variable *result_var = lhs_deref->var;
/* Store the expression operands in temps so we can use them
* multiple times.
*/
/* Store the expression operands in temps so we can use them
* multiple times.
*/
- for (i = 0; i < expr->get_num_operands(); i++) {
+ for (i = 0; i < orig_expr->get_num_operands(); i++) {
- op_var[i] = new(mem_ctx) ir_variable(expr->operands[i]->type,
+ op_var[i] = new(mem_ctx) ir_variable(orig_expr->operands[i]->type,
"mat_op_to_vec",
ir_var_temporary);
base_ir->insert_before(op_var[i]);
lhs_deref = new(mem_ctx) ir_dereference_variable(op_var[i]);
assign = new(mem_ctx) ir_assignment(lhs_deref,
"mat_op_to_vec",
ir_var_temporary);
base_ir->insert_before(op_var[i]);
lhs_deref = new(mem_ctx) ir_dereference_variable(op_var[i]);
assign = new(mem_ctx) ir_assignment(lhs_deref,
+ orig_expr->operands[i],
NULL);
base_ir->insert_before(assign);
}
/* OK, time to break down this matrix operation. */
NULL);
base_ir->insert_before(assign);
}
/* OK, time to break down this matrix operation. */
- switch (expr->operation) {
+ switch (orig_expr->operation) {
case ir_unop_neg: {
const unsigned mask = (1U << result_var->type->vector_elements) - 1;
case ir_unop_neg: {
const unsigned mask = (1U << result_var->type->vector_elements) - 1;
ir_expression *column_expr;
ir_assignment *column_assign;
ir_expression *column_expr;
ir_assignment *column_assign;
- column_expr = new(mem_ctx) ir_expression(expr->operation,
+ column_expr = new(mem_ctx) ir_expression(orig_expr->operation,
result->type,
op0,
NULL);
result->type,
op0,
NULL);
ir_expression *column_expr;
ir_assignment *column_assign;
ir_expression *column_expr;
ir_assignment *column_assign;
- column_expr = new(mem_ctx) ir_expression(expr->operation,
+ column_expr = new(mem_ctx) ir_expression(orig_expr->operation,
- printf("FINISHME: Handle matrix operation for %s\n", expr->operator_string());
+ printf("FINISHME: Handle matrix operation for %s\n",
+ orig_expr->operator_string());
this->made_progress = true;
return visit_continue;
this->made_progress = true;
return visit_continue;