[Mesa-dev] [PATCH 2/4] nir/glsl: convert nir_visitor::result to a nir_ssa_def *

Connor Abbott cwabbott0 at gmail.com
Sat Oct 31 15:32:29 PDT 2015


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 at gmail.com>
---
 src/glsl/nir/glsl_to_nir.cpp | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index 2ca23a8..dd707fc 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -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);
 
@@ -1157,7 +1157,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 *
@@ -1178,10 +1182,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 *
-- 
2.4.3



More information about the mesa-dev mailing list