[Mesa-dev] [PATCH 19/22] nvir/nir: implement nir_ssa_undef_instr

Karol Herbst kherbst at redhat.com
Thu Dec 21 15:51:37 UTC 2017


Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
index 98cd73451e..bf213bca51 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -81,6 +81,7 @@ public:
    bool visit(nir_jump_instr *);
    bool visit(nir_load_const_instr*);
    bool visit(nir_loop *);
+   bool visit(nir_ssa_undef_instr *);
 
    bool run();
 
@@ -1113,6 +1114,10 @@ Converter::visit(nir_instr *insn)
       if (!visit(nir_instr_as_jump(insn)))
          return false;
       break;
+   case nir_instr_type_ssa_undef:
+      if (!visit(nir_instr_as_ssa_undef(insn)))
+         return false;
+      break;
    default:
       ERROR("unknown nir_instr type %u\n", insn->type);
       return false;
@@ -1659,6 +1664,16 @@ Converter::visit(nir_alu_instr *insn)
 #undef CASE_OPIU
 #undef DEFAULT_CHECKS
 
+bool
+Converter::visit(nir_ssa_undef_instr *insn)
+{
+   LValues &newDefs = convert(&insn->def);
+   for (auto i = 0u; i < insn->def.num_components; ++i) {
+      mkOp1(OP_NOP, TYPE_NONE, newDefs[i], nullptr);
+   }
+   return true;
+}
+
 bool
 Converter::run()
 {
-- 
2.14.3



More information about the mesa-dev mailing list