lima/ppir: clean up override-init warnings
authorErico Nunes <nunes.erico@gmail.com>
Sun, 30 Jan 2022 09:50:42 +0000 (10:50 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 11 Feb 2022 21:55:10 +0000 (21:55 +0000)
Define ppir_op_unsupported as 0 so that we don't have to do the
initialization to -1.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14894>

src/gallium/drivers/lima/ir/pp/nir.c
src/gallium/drivers/lima/ir/pp/node.c
src/gallium/drivers/lima/ir/pp/ppir.h

index 1d58708..816daf7 100644 (file)
@@ -123,9 +123,6 @@ static void ppir_node_add_src(ppir_compiler *comp, ppir_node *node,
 }
 
 static int nir_to_ppir_opcodes[nir_num_opcodes] = {
-   /* not supported */
-   [0 ... nir_last_opcode] = -1,
-
    [nir_op_mov] = ppir_op_mov,
    [nir_op_fmul] = ppir_op_mul,
    [nir_op_fabs] = ppir_op_abs,
@@ -162,7 +159,7 @@ static bool ppir_emit_alu(ppir_block *block, nir_instr *ni)
    nir_alu_instr *instr = nir_instr_as_alu(ni);
    int op = nir_to_ppir_opcodes[instr->op];
 
-   if (op < 0) {
+   if (op == ppir_op_unsupported) {
       ppir_error("unsupported nir_op: %s\n", nir_op_infos[instr->op].name);
       return false;
    }
index cc51448..8948208 100644 (file)
@@ -29,6 +29,9 @@
 #include "ppir.h"
 
 const ppir_op_info ppir_op_infos[] = {
+   [ppir_op_unsupported] = {
+      .name = "unsupported",
+   },
    [ppir_op_mov] = {
       .name = "mov",
       .slots = (int []) {
index 70b9559..de2b542 100644 (file)
@@ -32,6 +32,7 @@
 #include "ir/lima_ir.h"
 
 typedef enum {
+   ppir_op_unsupported = 0,
    ppir_op_mov,
    ppir_op_abs,
    ppir_op_neg,