nir/glsl: convert nir_visitor::result to a nir_ssa_def *
authorConnor Abbott <cwabbott0@gmail.com>
Sat, 31 Oct 2015 03:47:46 +0000 (23:47 -0400)
committerConnor Abbott <cwabbott0@gmail.com>
Tue, 10 Nov 2015 18:55:54 +0000 (13:55 -0500)
Its only user now returns a nir_ssa_def *, and we'll need this since the
builder returns a nir_ssa_def *.

Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/nir/glsl_to_nir.cpp

index 3b8fb00abcf66aa563fb9eed140f5c5824cb4edc..10faa370ad11c0b83538b8c79988e74fcfdca70b 100644 (file)
@@ -87,7 +87,7 @@ private:
    nir_shader *shader;
    nir_function_impl *impl;
    exec_list *cf_node_list;
-   nir_instr *result; /* result of the expression tree last visited */
+   nir_ssa_def *result; /* result of the expression tree last visited */
 
    nir_deref_var *evaluate_deref(nir_instr *mem_ctx, ir_instruction *ir);
 
@@ -1174,7 +1174,11 @@ nir_visitor::add_instr(nir_instr *instr, unsigned num_components)
       nir_ssa_dest_init(instr, dest, num_components, NULL);
 
    nir_instr_insert_after_cf_list(this->cf_node_list, instr);
-   this->result = instr;
+
+   if (dest) {
+      assert(dest->is_ssa);
+      this->result = &dest->ssa;
+   }
 }
 
 nir_ssa_def *
@@ -1195,10 +1199,7 @@ nir_visitor::evaluate_rvalue(ir_rvalue* ir)
       add_instr(&load_instr->instr, ir->type->vector_elements);
    }
 
-   nir_dest *dest = get_instr_dest(this->result);
-   assert(dest->is_ssa);
-
-   return &dest->ssa;
+   return this->result;
 }
 
 nir_alu_instr *