lima/ppir: clean up override-init warnings

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>
This commit is contained in:
Erico Nunes 2022-01-30 10:50:42 +01:00 committed by Marge Bot
parent 823be63216
commit 3d77950b8b
3 changed files with 5 additions and 4 deletions

View 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;
}

View 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 []) {

View 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,