mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
ir3: add ir3_disasm_options struct
We want to add some disassembly options in the future. Add new ir3_shader_disasm_options function that takes options from a new ir3_disasm_options struct in which we can add options later. The original ir3_shader_disasm becomes a wrapper for the new function to not have to update all call sites now. Signed-off-by: Job Noorman <jnoorman@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37595>
This commit is contained in:
parent
166afc592b
commit
e413615d55
8 changed files with 35 additions and 11 deletions
|
|
@ -56,9 +56,9 @@ a4xx_assemble(struct backend *b, FILE *in)
|
|||
}
|
||||
|
||||
static void
|
||||
a4xx_disassemble(struct kernel *kernel, FILE *out)
|
||||
a4xx_disassemble(struct kernel *kernel, struct ir3_disasm_options *options)
|
||||
{
|
||||
ir3_asm_disassemble(to_ir3_kernel(kernel), out);
|
||||
ir3_asm_disassemble(to_ir3_kernel(kernel), options);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@ a6xx_assemble(struct backend *b, FILE *in)
|
|||
}
|
||||
|
||||
static void
|
||||
a6xx_disassemble(struct kernel *kernel, FILE *out)
|
||||
a6xx_disassemble(struct kernel *kernel, struct ir3_disasm_options *options)
|
||||
{
|
||||
ir3_asm_disassemble(to_ir3_kernel(kernel), out);
|
||||
ir3_asm_disassemble(to_ir3_kernel(kernel), options);
|
||||
}
|
||||
|
||||
template<chip CHIP>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ ir3_asm_assemble(struct ir3_compiler *c, FILE *in)
|
|||
}
|
||||
|
||||
void
|
||||
ir3_asm_disassemble(struct ir3_kernel *k, FILE *out)
|
||||
ir3_asm_disassemble(struct ir3_kernel *k, struct ir3_disasm_options *options)
|
||||
{
|
||||
ir3_shader_disasm(k->v, (uint32_t *)k->bin, out);
|
||||
ir3_shader_disasm_options(k->v, (uint32_t *)k->bin, options);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ struct ir3_kernel {
|
|||
define_cast(kernel, ir3_kernel);
|
||||
|
||||
struct ir3_kernel *ir3_asm_assemble(struct ir3_compiler *c, FILE *in);
|
||||
void ir3_asm_disassemble(struct ir3_kernel *k, FILE *out);
|
||||
void ir3_asm_disassemble(struct ir3_kernel *k,
|
||||
struct ir3_disasm_options *options);
|
||||
|
||||
#endif /* __IR3_ASM_H__ */
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "util/u_math.h"
|
||||
|
||||
#include "perfcntrs/freedreno_perfcntr.h"
|
||||
#include "ir3/ir3_shader.h"
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
|
@ -279,8 +280,12 @@ main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (disasm)
|
||||
backend->disassemble(kernel, stdout);
|
||||
if (disasm) {
|
||||
struct ir3_disasm_options options = {
|
||||
.out = stdout,
|
||||
};
|
||||
backend->disassemble(kernel, &options);
|
||||
}
|
||||
|
||||
if (grid[0] == 0)
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ struct perfcntr {
|
|||
/* per-generation entry-points: */
|
||||
struct backend {
|
||||
struct kernel *(*assemble)(struct backend *b, FILE *in);
|
||||
void (*disassemble)(struct kernel *kernel, FILE *out);
|
||||
void (*disassemble)(struct kernel *kernel, struct ir3_disasm_options *);
|
||||
void (*emit_grid)(struct kernel *kernel, uint32_t grid[3],
|
||||
struct fd_submit *submit);
|
||||
|
||||
|
|
|
|||
|
|
@ -1091,8 +1091,10 @@ print_raw(FILE *out, const BITSET_WORD *data, size_t size) {
|
|||
}
|
||||
|
||||
void
|
||||
ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out)
|
||||
ir3_shader_disasm_options(struct ir3_shader_variant *so, uint32_t *bin,
|
||||
struct ir3_disasm_options *options)
|
||||
{
|
||||
FILE *out = options->out;
|
||||
struct ir3 *ir = so->ir;
|
||||
struct ir3_register *reg;
|
||||
const char *type = ir3_shader_stage(so);
|
||||
|
|
@ -1243,6 +1245,16 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out)
|
|||
fprintf(out, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out)
|
||||
{
|
||||
struct ir3_disasm_options options = {
|
||||
.out = out,
|
||||
};
|
||||
|
||||
ir3_shader_disasm_options(so, bin, &options);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
ir3_shader_outputs(const struct ir3_shader *so)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -572,6 +572,10 @@ struct ir3_disasm_info {
|
|||
char *disasm;
|
||||
};
|
||||
|
||||
struct ir3_disasm_options {
|
||||
FILE *out;
|
||||
};
|
||||
|
||||
/* Represents half register in regid */
|
||||
#define HALF_REG_ID 0x100
|
||||
|
||||
|
|
@ -1185,6 +1189,8 @@ struct ir3_shader *
|
|||
ir3_shader_passthrough_tcs(struct ir3_shader *vs, unsigned patch_vertices);
|
||||
void ir3_shader_destroy(struct ir3_shader *shader);
|
||||
void ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out);
|
||||
void ir3_shader_disasm_options(struct ir3_shader_variant *so, uint32_t *bin,
|
||||
struct ir3_disasm_options *options);
|
||||
uint64_t ir3_shader_outputs(const struct ir3_shader *so);
|
||||
|
||||
int ir3_glsl_type_size(const struct glsl_type *type, bool bindless);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue