glsl2: Replace insert_before/remove pairs with exec_node::replace_with.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 20 Jul 2010 04:44:03 +0000 (21:44 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 21 Jul 2010 23:37:57 +0000 (16:37 -0700)
src/glsl/ast_function.cpp
src/glsl/ir_expression_flattening.cpp
src/glsl/ir_function_inlining.cpp
src/glsl/ir_if_return.cpp
src/glsl/ir_vec_index_to_cond_assign.cpp
src/glsl/ir_vec_index_to_swizzle.cpp

index 73af882c530811dcec5b0393f4eb96118e3c9d4e..2348bdf24fa9a90982837bbb42427e07b4936304 100644 (file)
@@ -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);
         }
       }
 
index 6dbebc63780f19a623bdbdcfaa0ffb64b06604ea..ccb2e2bce9e6ae3f484b97456c97ba97ef5512b7 100644 (file)
@@ -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);
       }
    }
 
index 05dd83f7ffd2bd2fe646ba8123ff1a45b5363203..c391f12d883c615c03aa6d2562b8d8415538863d 100644 (file)
@@ -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()).
index a9af7166b96e98ea3d778c945d3d4f90a7894474..bfb52e7e6844ad674daf5ccb1d34e0ad02f2bb36 100644 (file)
@@ -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));
index 7e04389b5f9b804f787777966f47dcd0de746053..dbc6f9ada8928c95441de5d3f68083382ff5c532 100644 (file)
@@ -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);
       }
    }
 
index abeb43cd68edb95669ae4bb04692285e043320e5..1e170cbae61cc0cf39656282d1ee99cff7820db1 100644 (file)
@@ -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);
       }
    }