nir: Introduce nir_debug_info_instr
Adds a new instruction type that stores metadata that might be useful for debugging purposes. Passes must ignore these instructions when making decisions. Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18903>
This commit is contained in:
committed by
Marge Bot
parent
a70968c62f
commit
ce24486ee4
@@ -959,6 +959,7 @@ typedef enum ENUM_PACKED {
|
||||
nir_instr_type_undef,
|
||||
nir_instr_type_phi,
|
||||
nir_instr_type_parallel_copy,
|
||||
nir_instr_type_debug_info,
|
||||
} nir_instr_type;
|
||||
|
||||
typedef struct nir_instr {
|
||||
@@ -2760,6 +2761,41 @@ typedef struct {
|
||||
struct exec_list entries;
|
||||
} nir_parallel_copy_instr;
|
||||
|
||||
typedef enum nir_debug_info_type {
|
||||
nir_debug_info_src_loc,
|
||||
nir_debug_info_string,
|
||||
} nir_debug_info_type;
|
||||
|
||||
typedef enum nir_debug_info_source {
|
||||
nir_debug_info_spirv,
|
||||
nir_debug_info_nir,
|
||||
} nir_debug_info_source;
|
||||
|
||||
typedef struct nir_debug_info_instr {
|
||||
nir_instr instr;
|
||||
|
||||
nir_debug_info_type type;
|
||||
|
||||
union {
|
||||
struct {
|
||||
nir_src filename;
|
||||
/* 0 if only the spirv_offset is available. */
|
||||
uint32_t line;
|
||||
uint32_t column;
|
||||
|
||||
uint32_t spirv_offset;
|
||||
|
||||
nir_debug_info_source source;
|
||||
} src_loc;
|
||||
|
||||
uint16_t string_length;
|
||||
};
|
||||
|
||||
nir_def def;
|
||||
|
||||
char string[];
|
||||
} nir_debug_info_instr;
|
||||
|
||||
NIR_DEFINE_CAST(nir_instr_as_alu, nir_instr, nir_alu_instr, instr,
|
||||
type, nir_instr_type_alu)
|
||||
NIR_DEFINE_CAST(nir_instr_as_deref, nir_instr, nir_deref_instr, instr,
|
||||
@@ -2781,6 +2817,9 @@ NIR_DEFINE_CAST(nir_instr_as_phi, nir_instr, nir_phi_instr, instr,
|
||||
NIR_DEFINE_CAST(nir_instr_as_parallel_copy, nir_instr,
|
||||
nir_parallel_copy_instr, instr,
|
||||
type, nir_instr_type_parallel_copy)
|
||||
NIR_DEFINE_CAST(nir_instr_as_debug_info, nir_instr,
|
||||
nir_debug_info_instr, instr,
|
||||
type, nir_instr_type_debug_info)
|
||||
|
||||
#define NIR_DEFINE_SRC_AS_CONST(type, suffix) \
|
||||
static inline type \
|
||||
@@ -4584,6 +4623,10 @@ nir_phi_src *nir_phi_instr_add_src(nir_phi_instr *instr,
|
||||
|
||||
nir_parallel_copy_instr *nir_parallel_copy_instr_create(nir_shader *shader);
|
||||
|
||||
nir_debug_info_instr *nir_debug_info_instr_create(nir_shader *shader,
|
||||
nir_debug_info_type type,
|
||||
uint32_t string_length);
|
||||
|
||||
nir_undef_instr *nir_undef_instr_create(nir_shader *shader,
|
||||
unsigned num_components,
|
||||
unsigned bit_size);
|
||||
@@ -4893,6 +4936,9 @@ NIR_SRC_AS_(alu_instr, nir_alu_instr, nir_instr_type_alu, nir_instr_as_alu)
|
||||
NIR_SRC_AS_(intrinsic, nir_intrinsic_instr,
|
||||
nir_instr_type_intrinsic, nir_instr_as_intrinsic)
|
||||
NIR_SRC_AS_(deref, nir_deref_instr, nir_instr_type_deref, nir_instr_as_deref)
|
||||
NIR_SRC_AS_(debug_info, nir_debug_info_instr, nir_instr_type_debug_info, nir_instr_as_debug_info)
|
||||
|
||||
const char *nir_src_as_string(nir_src src);
|
||||
|
||||
bool nir_src_is_always_uniform(nir_src src);
|
||||
bool nir_srcs_equal(nir_src src1, nir_src src2);
|
||||
|
||||
Reference in New Issue
Block a user