From: Kenneth Graunke Date: Tue, 20 Jul 2010 04:44:03 +0000 (-0700) Subject: glsl2: Replace insert_before/remove pairs with exec_node::replace_with. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7a18da69022d3f9b05c21ff2473e8ea390f77f1;p=mesa.git glsl2: Replace insert_before/remove pairs with exec_node::replace_with. --- diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 73af882c530..2348bdf24fa 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -1081,8 +1081,7 @@ ast_function_expression::hir(exec_list *instructions, all_parameters_are_constant = false; if (result != ir) { - ir->insert_before(result); - ir->remove(); + ir->replace_with(result); } } diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index 6dbebc63780..ccb2e2bce9e 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -171,8 +171,7 @@ ir_expression_flattening_visitor::visit_enter(ir_call *ir) ir_rvalue *new_ir = operand_to_temp(ir); if (new_ir != ir) { - ir->insert_before(new_ir); - ir->remove(); + ir->replace_with(new_ir); } } diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 05dd83f7ffd..c391f12d883 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -91,8 +91,7 @@ replace_return_with_assignment(ir_instruction *ir, void *data) if (ret) { if (ret->value) { ir_rvalue *lhs = new(ctx) ir_dereference_variable(retval); - ret->insert_before(new(ctx) ir_assignment(lhs, ret->value, NULL)); - ret->remove(); + ret->replace_with(new(ctx) ir_assignment(lhs, ret->value, NULL)); } else { /* un-valued return has to be the last return, or we shouldn't * have reached here. (see can_inline()). diff --git a/src/glsl/ir_if_return.cpp b/src/glsl/ir_if_return.cpp index a9af7166b96..bfb52e7e684 100644 --- a/src/glsl/ir_if_return.cpp +++ b/src/glsl/ir_if_return.cpp @@ -108,13 +108,11 @@ ir_if_return_visitor::visit_enter(ir_if *ir) assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(new_var), then_return->value, NULL); - then_return->insert_before(assign); - then_return->remove(); + then_return->replace_with(assign); assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(new_var), else_return->value, NULL); - else_return->insert_before(assign); - else_return->remove(); + else_return->replace_with(assign); ir_dereference_variable *deref = new(ir) ir_dereference_variable(new_var); ir->insert_after(new(ir) ir_return(deref)); diff --git a/src/glsl/ir_vec_index_to_cond_assign.cpp b/src/glsl/ir_vec_index_to_cond_assign.cpp index 7e04389b5f9..dbc6f9ada89 100644 --- a/src/glsl/ir_vec_index_to_cond_assign.cpp +++ b/src/glsl/ir_vec_index_to_cond_assign.cpp @@ -218,8 +218,7 @@ ir_vec_index_to_cond_assign_visitor::visit_enter(ir_call *ir) ir_rvalue *new_param = convert_vec_index_to_cond_assign(param); if (new_param != param) { - param->insert_before(new_param); - param->remove(); + param->replace_with(new_param); } } diff --git a/src/glsl/ir_vec_index_to_swizzle.cpp b/src/glsl/ir_vec_index_to_swizzle.cpp index abeb43cd68e..1e170cbae61 100644 --- a/src/glsl/ir_vec_index_to_swizzle.cpp +++ b/src/glsl/ir_vec_index_to_swizzle.cpp @@ -121,8 +121,7 @@ ir_vec_index_to_swizzle_visitor::visit_enter(ir_call *ir) ir_rvalue *new_param = convert_vec_index_to_swizzle(param); if (new_param != param) { - param->insert_before(new_param); - param->remove(); + param->replace_with(new_param); } }