mesa: remove support for GL_APPLE_client_storage extension
[mesa.git] / src / glsl / opt_function_inlining.cpp
index 147c1824c1a06f5a450e92949336b35193e9e9c5..8fef358cc97b102c68d007bbdc5dcf348d632d69 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 /**
- * \file ir_function_inlining.cpp
+ * \file opt_function_inlining.cpp
  *
  * Replaces calls to functions with the body of the function.
  */
@@ -89,7 +89,7 @@ do_function_inlining(exec_list *instructions)
 static void
 replace_return_with_assignment(ir_instruction *ir, void *data)
 {
-   void *ctx = talloc_parent(ir);
+   void *ctx = ralloc_parent(ir);
    ir_variable *retval = (ir_variable *)data;
    ir_return *ret = ir->as_return();
 
@@ -110,7 +110,7 @@ replace_return_with_assignment(ir_instruction *ir, void *data)
 ir_rvalue *
 ir_call::generate_inline(ir_instruction *next_ir)
 {
-   void *ctx = talloc_parent(this);
+   void *ctx = ralloc_parent(this);
    ir_variable **parameters;
    int num_parameters;
    int i;
@@ -126,7 +126,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
    parameters = new ir_variable *[num_parameters];
 
    /* Generate storage for the return value. */
-   if (this->callee->return_type) {
+   if (!this->callee->return_type->is_void()) {
       retval = new(ctx) ir_variable(this->callee->return_type, "_ret_val",
                                    ir_var_auto);
       next_ir->insert_before(retval);
@@ -165,6 +165,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
 
       /* Move the actual param into our param variable if it's an 'in' type. */
       if (parameters[i] && (sig_param->mode == ir_var_in ||
+                           sig_param->mode == ir_var_const_in ||
                            sig_param->mode == ir_var_inout)) {
         ir_assignment *assign;
 
@@ -208,10 +209,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
    }
 
    /* Now push those new instructions in. */
-   foreach_iter(exec_list_iterator, iter, new_instructions) {
-      ir_instruction *ir = (ir_instruction *)iter.get();
-      next_ir->insert_before(ir);
-   }
+   next_ir->insert_before(&new_instructions);
 
    /* Copy back the value of any 'out' parameters from the function body
     * variables to our own.
@@ -357,7 +355,7 @@ ir_sampler_replacement_visitor::replace_deref(ir_dereference **deref)
 {
    ir_dereference_variable *deref_var = (*deref)->as_dereference_variable();
    if (deref_var && deref_var->var == this->sampler) {
-      *deref = this->deref->clone(talloc_parent(*deref), NULL);
+      *deref = this->deref->clone(ralloc_parent(*deref), NULL);
    }
 }