mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
isaspec: deocde: Remove generic functions from public interface
This will switch everyone to the isa specific functions. Fixes the output of etnaviv's pre_instr_cb callback if freedreno and etnaviv are build at the same time. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28176>
This commit is contained in:
parent
3f2295d99b
commit
e0ca29e7a3
13 changed files with 51 additions and 58 deletions
|
|
@ -404,6 +404,11 @@ struct decode_scope;
|
|||
|
||||
uint32_t ${prefix}_isa_get_gpu_id(struct decode_scope *scope);
|
||||
|
||||
/**
|
||||
* Allows to use gpu_id in expr functions
|
||||
*/
|
||||
#define ISA_GPU_ID() ${prefix}_isa_get_gpu_id(scope)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -116,10 +116,6 @@ struct isa_decode_options {
|
|||
const struct isa_entrypoint *entrypoints;
|
||||
};
|
||||
|
||||
void isa_disasm(void *bin, int sz, FILE *out, const struct isa_decode_options *options);
|
||||
|
||||
bool isa_decode(void *out, void *bin, const struct isa_decode_options *options);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,16 +51,6 @@ struct isa_enum {
|
|||
*/
|
||||
typedef uint64_t (*isa_expr_t)(struct decode_scope *scope);
|
||||
|
||||
/**
|
||||
* Used by generated decode functions
|
||||
*/
|
||||
uint32_t isa_get_gpu_id(struct decode_scope *scope);
|
||||
|
||||
/**
|
||||
* Allows to use gpu_id in expr functions
|
||||
*/
|
||||
#define ISA_GPU_ID() isa_get_gpu_id(scope)
|
||||
|
||||
/**
|
||||
* For bitset fields, there are some cases where we want to "remap" field
|
||||
* names, essentially allowing one to parameterize a nested bitset when
|
||||
|
|
|
|||
|
|
@ -526,7 +526,7 @@ isa_decode_field(struct decode_scope *scope, const char *field_name)
|
|||
return bitmask_to_uint64_t(val);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
static uint32_t
|
||||
isa_get_gpu_id(struct decode_scope *scope)
|
||||
{
|
||||
return scope->state->options->gpu_id;
|
||||
|
|
@ -950,7 +950,7 @@ cmp_entrypoints(const void *_a, const void *_b)
|
|||
return (int)a->offset - (int)b->offset;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
isa_disasm(void *bin, int sz, FILE *out, const struct isa_decode_options *options)
|
||||
{
|
||||
const struct isa_decode_options default_options = {
|
||||
|
|
@ -1004,7 +1004,7 @@ isa_disasm(void *bin, int sz, FILE *out, const struct isa_decode_options *option
|
|||
ralloc_free(state);
|
||||
}
|
||||
|
||||
bool
|
||||
static bool
|
||||
isa_decode(void *out, void *bin, const struct isa_decode_options *options)
|
||||
{
|
||||
struct decode_state *state = rzalloc_size(NULL, sizeof(*state));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "util/os_file.h"
|
||||
|
||||
#include "isa.h"
|
||||
#include "etnaviv-isa.h"
|
||||
|
||||
static void
|
||||
pre_instr_cb(void *d, unsigned n, void *instr)
|
||||
|
|
@ -22,12 +22,12 @@ main(int argc, char *argv[])
|
|||
size_t sz;
|
||||
void *raw = os_read_file(argv[1], &sz);
|
||||
|
||||
isa_disasm(raw, sz, stdout,
|
||||
&(struct isa_decode_options){
|
||||
.show_errors = true,
|
||||
.branch_labels = true,
|
||||
.pre_instr_cb = pre_instr_cb,
|
||||
});
|
||||
etnaviv_isa_disasm(raw, sz, stdout,
|
||||
&(struct isa_decode_options){
|
||||
.show_errors = true,
|
||||
.branch_labels = true,
|
||||
.pre_instr_cb = pre_instr_cb,
|
||||
});
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* we can disassemble them correctly.
|
||||
*/
|
||||
|
||||
#include "compiler/isaspec/isaspec.h"
|
||||
#include "etnaviv/isa/etnaviv-isa.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
struct disasm_state {
|
||||
|
|
@ -46,7 +46,7 @@ struct DisasmTest : testing::Test, testing::WithParamInterface<disasm_state> {
|
|||
return;
|
||||
}
|
||||
|
||||
isa_disasm((void *)GetParam().bin, 16, fdisasm, &options);
|
||||
etnaviv_isa_disasm((void *)GetParam().bin, 16, fdisasm, &options);
|
||||
fflush(fdisasm);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "freedreno_pm4.h"
|
||||
|
||||
#include "afuc.h"
|
||||
#include "afuc-isa.h"
|
||||
#include "util.h"
|
||||
#include "emu.h"
|
||||
|
||||
|
|
@ -223,7 +224,7 @@ get_decode_options(struct isa_decode_options *options)
|
|||
static void
|
||||
disasm_instr(struct isa_decode_options *options, uint32_t *instrs, unsigned pc)
|
||||
{
|
||||
isa_disasm(&instrs[pc], 4, stdout, options);
|
||||
afuc_isa_disasm(&instrs[pc], 4, stdout, options);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -330,7 +331,7 @@ disasm(struct emu *emu)
|
|||
}
|
||||
|
||||
/* print instructions: */
|
||||
isa_disasm(emu->instrs, MIN2(sizedwords, jumptbl_offset) * 4, stdout, &options);
|
||||
afuc_isa_disasm(emu->instrs, MIN2(sizedwords, jumptbl_offset) * 4, stdout, &options);
|
||||
|
||||
/* print jump table */
|
||||
if (jumptbl_offset != ~0) {
|
||||
|
|
@ -374,7 +375,7 @@ disasm(struct emu *emu)
|
|||
jumptbl_offset = find_jump_table(emu->instrs, sizedwords, emu->jmptbl,
|
||||
ARRAY_SIZE(emu->jmptbl));
|
||||
|
||||
isa_disasm(emu->instrs, MIN2(sizedwords, jumptbl_offset) * 4, stdout, &options);
|
||||
afuc_isa_disasm(emu->instrs, MIN2(sizedwords, jumptbl_offset) * 4, stdout, &options);
|
||||
|
||||
if (jumptbl_offset != ~0) {
|
||||
printf(".align 32\n");
|
||||
|
|
@ -410,7 +411,7 @@ disasm(struct emu *emu)
|
|||
jumptbl_offset = find_jump_table(emu->instrs, emu->sizedwords, emu->jmptbl,
|
||||
ARRAY_SIZE(emu->jmptbl));
|
||||
|
||||
isa_disasm(emu->instrs, MIN2(emu->sizedwords, jumptbl_offset) * 4, stdout, &options);
|
||||
afuc_isa_disasm(emu->instrs, MIN2(emu->sizedwords, jumptbl_offset) * 4, stdout, &options);
|
||||
|
||||
if (jumptbl_offset != ~0) {
|
||||
printf("jumptbl:\n");
|
||||
|
|
@ -434,7 +435,7 @@ disasm_raw(uint32_t *instrs, int sizedwords)
|
|||
get_decode_options(&options);
|
||||
options.cbdata = &state;
|
||||
|
||||
isa_disasm(instrs, sizedwords * 4, stdout, &options);
|
||||
afuc_isa_disasm(instrs, sizedwords * 4, stdout, &options);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -454,7 +455,7 @@ disasm_legacy(uint32_t *buf, int sizedwords)
|
|||
setup_packet_table(&options, jmptbl, 0x80);
|
||||
|
||||
/* print instructions: */
|
||||
isa_disasm(instrs, sizedwords * 4, stdout, &options);
|
||||
afuc_isa_disasm(instrs, sizedwords * 4, stdout, &options);
|
||||
|
||||
/* print jumptable: */
|
||||
if (verbose) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include "freedreno_pm4.h"
|
||||
|
||||
#include "isaspec.h"
|
||||
#include "afuc-isa.h"
|
||||
|
||||
#include "emu.h"
|
||||
#include "util.h"
|
||||
|
|
@ -370,11 +370,11 @@ void
|
|||
emu_step(struct emu *emu)
|
||||
{
|
||||
struct afuc_instr *instr;
|
||||
bool decoded = isa_decode((void *)&instr,
|
||||
(void *)&emu->instrs[emu->gpr_regs.pc],
|
||||
&(struct isa_decode_options) {
|
||||
.gpu_id = gpuver,
|
||||
});
|
||||
bool decoded =
|
||||
afuc_isa_decode((void *)&instr, (void *)&emu->instrs[emu->gpr_regs.pc],
|
||||
&(struct isa_decode_options){
|
||||
.gpu_id = gpuver,
|
||||
});
|
||||
|
||||
if (!decoded) {
|
||||
uint32_t instr_val = emu->instrs[emu->gpr_regs.pc];
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include <util/log.h>
|
||||
#include <util/u_debug.h>
|
||||
|
||||
#include "isa/isa.h"
|
||||
#include "freedreno/isa/ir3-isa.h"
|
||||
|
||||
#include "disasm.h"
|
||||
#include "instr-a3xx.h"
|
||||
|
|
@ -604,7 +604,7 @@ disasm_a3xx_stat(uint32_t *dwords, int sizedwords, int level, FILE *out,
|
|||
|
||||
decode_options.cbdata = &ctx;
|
||||
|
||||
isa_disasm(dwords, sizedwords * 4, out, &decode_options);
|
||||
ir3_isa_disasm(dwords, sizedwords * 4, out, &decode_options);
|
||||
|
||||
disasm_handle_last(&ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "ir3_parser.h"
|
||||
#include "ir3_shader.h"
|
||||
|
||||
#include "freedreno/isa/ir3-isa.h"
|
||||
#include "isa/isa.h"
|
||||
|
||||
#include "disasm.h"
|
||||
|
|
@ -840,13 +841,13 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out)
|
|||
const_state->immediates[i * 4 + 3]);
|
||||
}
|
||||
|
||||
isa_disasm(bin, so->info.sizedwords * 4, out,
|
||||
&(struct isa_decode_options){
|
||||
.gpu_id = ir->compiler->gen * 100,
|
||||
.show_errors = true,
|
||||
.branch_labels = true,
|
||||
.no_match_cb = print_raw,
|
||||
});
|
||||
ir3_isa_disasm(bin, so->info.sizedwords * 4, out,
|
||||
&(struct isa_decode_options){
|
||||
.gpu_id = ir->compiler->gen * 100,
|
||||
.show_errors = true,
|
||||
.branch_labels = true,
|
||||
.no_match_cb = print_raw,
|
||||
});
|
||||
|
||||
fprintf(out, "; %s: outputs:", type);
|
||||
for (i = 0; i < so->outputs_count; i++) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
#include "ir3_assembler.h"
|
||||
#include "ir3_shader.h"
|
||||
|
||||
#include "isa/isa.h"
|
||||
#include "freedreno/isa/ir3-isa.h"
|
||||
|
||||
/* clang-format off */
|
||||
/* Note: @anholt's 4xx disasm was done on an a418 Nexus 5x */
|
||||
|
|
@ -513,12 +513,12 @@ main(int argc, char **argv)
|
|||
strtoll(&test->instr[9], NULL, 16),
|
||||
strtoll(&test->instr[0], NULL, 16),
|
||||
};
|
||||
isa_disasm(code, 8, fdisasm,
|
||||
&(struct isa_decode_options){
|
||||
.gpu_id = dev_info->chip * 100,
|
||||
.show_errors = true,
|
||||
.no_match_cb = print_raw,
|
||||
});
|
||||
ir3_isa_disasm(code, 8, fdisasm,
|
||||
&(struct isa_decode_options){
|
||||
.gpu_id = dev_info->chip * 100,
|
||||
.show_errors = true,
|
||||
.no_match_cb = print_raw,
|
||||
});
|
||||
fflush(fdisasm);
|
||||
|
||||
trim(disasm_output);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "util/os_file.h"
|
||||
|
||||
#include "isa.h"
|
||||
#include "ir3-isa.h"
|
||||
|
||||
|
||||
static void
|
||||
|
|
@ -47,7 +47,7 @@ main(int argc, char **argv)
|
|||
size_t sz;
|
||||
void *raw = os_read_file(argv[1], &sz);
|
||||
|
||||
isa_disasm(raw, sz, stdout, &(struct isa_decode_options) {
|
||||
ir3_isa_disasm(raw, sz, stdout, &(struct isa_decode_options) {
|
||||
.show_errors = true,
|
||||
.branch_labels = true,
|
||||
.pre_instr_cb = disasm_instr_cb,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <isa/isa.h>
|
||||
#include <etnaviv/isa/etnaviv-isa.h>
|
||||
|
||||
#include "etnaviv_disasm.h"
|
||||
|
||||
|
|
@ -49,5 +49,5 @@ etna_disasm(uint32_t *dwords, int sizedwords, enum debug_t debug)
|
|||
if (debug & PRINT_RAW)
|
||||
options.pre_instr_cb = pre_instr_cb;
|
||||
|
||||
isa_disasm(dwords, sizedwords * sizeof(uint32_t), stdout, &options);
|
||||
etnaviv_isa_disasm(dwords, sizedwords * sizeof(uint32_t), stdout, &options);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue