microsoft/compiler: Change calls to NIR_INSTR_UNSUPPORTED to log to dxil_logger instead

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12510>
This commit is contained in:
Michael Tang 2021-10-05 15:33:26 -07:00 committed by Marge Bot
parent 97902a9ef8
commit a3bf0da1cb
1 changed files with 19 additions and 13 deletions

View File

@ -32,6 +32,7 @@
#include "dxil_signature.h"
#include "nir/nir_builder.h"
#include "util/ralloc.h"
#include "util/u_debug.h"
#include "util/u_dynarray.h"
#include "util/u_math.h"
@ -55,13 +56,18 @@ dxil_debug_options[] = {
DEBUG_GET_ONCE_FLAGS_OPTION(debug_dxil, "DXIL_DEBUG", dxil_debug_options, 0)
#define NIR_INSTR_UNSUPPORTED(instr) \
if (debug_dxil & DXIL_DEBUG_VERBOSE) \
do { \
fprintf(stderr, "Unsupported instruction:"); \
nir_print_instr(instr, stderr); \
fprintf(stderr, "\n"); \
} while (0)
static void
log_nir_instr_unsupported(const struct dxil_logger *logger,
const char *message_prefix, const nir_instr *instr)
{
char *msg = NULL;
char *instr_str = nir_instr_as_str(instr, NULL);
asprintf(&msg, "%s: %s\n", message_prefix, instr_str);
ralloc_free(instr_str);
assert(msg);
logger->log(logger->priv, msg);
free(msg);
}
static void
default_logger_func(void *priv, const char *msg)
@ -2514,8 +2520,8 @@ emit_alu(struct ntd_context *ctx, nir_alu_instr *alu)
case nir_op_b2f32: return emit_b2f32(ctx, alu, src[0]);
case nir_op_b2f64: return emit_b2f64(ctx, alu, src[0]);
default:
NIR_INSTR_UNSUPPORTED(&alu->instr);
assert("Unimplemented ALU instruction");
log_nir_instr_unsupported(ctx->logger, "Unimplemented ALU instruction",
&alu->instr);
return false;
}
}
@ -4411,8 +4417,8 @@ emit_intrinsic(struct ntd_context *ctx, nir_intrinsic_instr *intr)
case nir_intrinsic_load_num_workgroups:
case nir_intrinsic_load_workgroup_size:
default:
NIR_INSTR_UNSUPPORTED(&intr->instr);
unreachable("Unimplemented intrinsic instruction");
log_nir_instr_unsupported(
ctx->logger, "Unimplemented intrinsic instruction", &intr->instr);
return false;
}
}
@ -5061,8 +5067,8 @@ static bool emit_instr(struct ntd_context *ctx, struct nir_instr* instr)
case nir_instr_type_ssa_undef:
return emit_undefined(ctx, nir_instr_as_ssa_undef(instr));
default:
NIR_INSTR_UNSUPPORTED(instr);
unreachable("Unimplemented instruction type");
log_nir_instr_unsupported(ctx->logger, "Unimplemented instruction type",
instr);
return false;
}
}