mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
intel/compiler: Get rid of struct gen_disasm
It's just a container around a devinfo. The one useful purpose it did serve is that gen_disasm_create initialized the compaction table singletons. Now that those no longer exist, this isn't necessary. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6244>
This commit is contained in:
parent
54ba0daa28
commit
372774367c
8 changed files with 19 additions and 55 deletions
|
|
@ -42,6 +42,7 @@ gen_batch_decode_ctx_init(struct gen_batch_decode_ctx *ctx,
|
|||
{
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
|
||||
ctx->devinfo = *devinfo;
|
||||
ctx->get_bo = get_bo;
|
||||
ctx->get_state_size = get_state_size;
|
||||
ctx->user_data = user_data;
|
||||
|
|
@ -54,14 +55,12 @@ gen_batch_decode_ctx_init(struct gen_batch_decode_ctx *ctx,
|
|||
ctx->spec = gen_spec_load(devinfo);
|
||||
else
|
||||
ctx->spec = gen_spec_load_from_path(devinfo, xml_path);
|
||||
ctx->disasm = gen_disasm_create(devinfo);
|
||||
}
|
||||
|
||||
void
|
||||
gen_batch_decode_ctx_finish(struct gen_batch_decode_ctx *ctx)
|
||||
{
|
||||
gen_spec_destroy(ctx->spec);
|
||||
gen_disasm_destroy(ctx->disasm);
|
||||
}
|
||||
|
||||
#define CSI "\e["
|
||||
|
|
@ -138,7 +137,7 @@ ctx_disassemble_program(struct gen_batch_decode_ctx *ctx,
|
|||
return;
|
||||
|
||||
fprintf(ctx->fp, "\nReferenced %s:\n", type);
|
||||
gen_disasm_disassemble(ctx->disasm, bo.map, 0, ctx->fp);
|
||||
gen_disassemble(&ctx->devinfo, bo.map, 0, ctx->fp);
|
||||
}
|
||||
|
||||
/* Heuristic to determine whether a uint32_t is probably actually a float
|
||||
|
|
|
|||
|
|
@ -236,11 +236,10 @@ struct gen_batch_decode_ctx {
|
|||
void *user_data;
|
||||
|
||||
FILE *fp;
|
||||
struct gen_device_info devinfo;
|
||||
struct gen_spec *spec;
|
||||
enum gen_batch_decode_flags flags;
|
||||
|
||||
struct gen_disasm *disasm;
|
||||
|
||||
uint64_t surface_base;
|
||||
uint64_t dynamic_base;
|
||||
uint64_t instruction_base;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,6 @@
|
|||
|
||||
#include "gen_disasm.h"
|
||||
|
||||
struct gen_disasm {
|
||||
struct gen_device_info devinfo;
|
||||
};
|
||||
|
||||
static bool
|
||||
is_send(uint32_t opcode)
|
||||
{
|
||||
|
|
@ -42,10 +38,9 @@ is_send(uint32_t opcode)
|
|||
}
|
||||
|
||||
static int
|
||||
gen_disasm_find_end(struct gen_disasm *disasm,
|
||||
gen_disasm_find_end(const struct gen_device_info *devinfo,
|
||||
const void *assembly, int start)
|
||||
{
|
||||
struct gen_device_info *devinfo = &disasm->devinfo;
|
||||
int offset = start;
|
||||
|
||||
/* This loop exits when send-with-EOT or when opcode is 0 */
|
||||
|
|
@ -69,11 +64,10 @@ gen_disasm_find_end(struct gen_disasm *disasm,
|
|||
}
|
||||
|
||||
void
|
||||
gen_disasm_disassemble(struct gen_disasm *disasm, const void *assembly,
|
||||
int start, FILE *out)
|
||||
gen_disassemble(const struct gen_device_info *devinfo,
|
||||
const void *assembly, int start, FILE *out)
|
||||
{
|
||||
struct gen_device_info *devinfo = &disasm->devinfo;
|
||||
int end = gen_disasm_find_end(disasm, assembly, start);
|
||||
int end = gen_disasm_find_end(devinfo, assembly, start);
|
||||
|
||||
/* Make a dummy disasm structure that brw_validate_instructions
|
||||
* can work from.
|
||||
|
|
@ -111,23 +105,3 @@ gen_disasm_disassemble(struct gen_disasm *disasm, const void *assembly,
|
|||
ralloc_free(mem_ctx);
|
||||
ralloc_free(disasm_info);
|
||||
}
|
||||
|
||||
struct gen_disasm *
|
||||
gen_disasm_create(const struct gen_device_info *devinfo)
|
||||
{
|
||||
struct gen_disasm *gd;
|
||||
|
||||
gd = malloc(sizeof *gd);
|
||||
if (gd == NULL)
|
||||
return NULL;
|
||||
|
||||
gd->devinfo = *devinfo;
|
||||
|
||||
return gd;
|
||||
}
|
||||
|
||||
void
|
||||
gen_disasm_destroy(struct gen_disasm *disasm)
|
||||
{
|
||||
free(disasm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct gen_disasm;
|
||||
|
||||
struct gen_disasm *gen_disasm_create(const struct gen_device_info *devinfo);
|
||||
void gen_disasm_disassemble(struct gen_disasm *disasm,
|
||||
const void *assembly, int start, FILE *out);
|
||||
|
||||
void gen_disasm_destroy(struct gen_disasm *disasm);
|
||||
void gen_disassemble(const struct gen_device_info *devinfo,
|
||||
const void *assembly, int start, FILE *out);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ struct aub_file {
|
|||
/* Device state */
|
||||
struct gen_device_info devinfo;
|
||||
struct gen_spec *spec;
|
||||
struct gen_disasm *disasm;
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
@ -131,7 +130,6 @@ handle_info(void *user_data, int pci_id, const char *app_name)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
file->spec = gen_spec_load(&file->devinfo);
|
||||
file->disasm = gen_disasm_create(&file->devinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -394,9 +392,9 @@ new_shader_window(struct aub_mem *mem, uint64_t address, const char *desc)
|
|||
if (shader_bo.map) {
|
||||
FILE *f = open_memstream(&window->shader, &window->shader_size);
|
||||
if (f) {
|
||||
gen_disasm_disassemble(context.file->disasm,
|
||||
(const uint8_t *) shader_bo.map +
|
||||
(address - shader_bo.addr), 0, f);
|
||||
gen_disassemble(&context.file->devinfo,
|
||||
(const uint8_t *) shader_bo.map +
|
||||
(address - shader_bo.addr), 0, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
|
@ -818,8 +816,8 @@ new_batch_window(int exec_idx)
|
|||
aub_viewer_decode_ctx_init(&window->decode_ctx,
|
||||
&context.cfg,
|
||||
&window->decode_cfg,
|
||||
&context.file->devinfo,
|
||||
context.file->spec,
|
||||
context.file->disasm,
|
||||
batch_get_bo,
|
||||
NULL,
|
||||
window);
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ struct aub_viewer_decode_ctx {
|
|||
|
||||
void *user_data;
|
||||
|
||||
const struct gen_device_info *devinfo;
|
||||
struct gen_spec *spec;
|
||||
struct gen_disasm *disasm;
|
||||
enum drm_i915_gem_engine_class engine;
|
||||
|
||||
struct aub_viewer_cfg *cfg;
|
||||
|
|
@ -89,8 +89,8 @@ struct aub_viewer_decode_ctx {
|
|||
void aub_viewer_decode_ctx_init(struct aub_viewer_decode_ctx *ctx,
|
||||
struct aub_viewer_cfg *cfg,
|
||||
struct aub_viewer_decode_cfg *decode_cfg,
|
||||
const struct gen_device_info *devinfo,
|
||||
struct gen_spec *spec,
|
||||
struct gen_disasm *disasm,
|
||||
struct gen_batch_decode_bo (*get_bo)(void *, bool, uint64_t),
|
||||
unsigned (*get_state_size)(void *, uint32_t),
|
||||
void *user_data);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ void
|
|||
aub_viewer_decode_ctx_init(struct aub_viewer_decode_ctx *ctx,
|
||||
struct aub_viewer_cfg *cfg,
|
||||
struct aub_viewer_decode_cfg *decode_cfg,
|
||||
const struct gen_device_info *devinfo,
|
||||
struct gen_spec *spec,
|
||||
struct gen_disasm *disasm,
|
||||
struct gen_batch_decode_bo (*get_bo)(void *, bool, uint64_t),
|
||||
unsigned (*get_state_size)(void *, uint32_t),
|
||||
void *user_data)
|
||||
|
|
@ -42,12 +42,12 @@ aub_viewer_decode_ctx_init(struct aub_viewer_decode_ctx *ctx,
|
|||
ctx->get_bo = get_bo;
|
||||
ctx->get_state_size = get_state_size;
|
||||
ctx->user_data = user_data;
|
||||
ctx->devinfo = devinfo;
|
||||
ctx->engine = I915_ENGINE_CLASS_RENDER;
|
||||
|
||||
ctx->cfg = cfg;
|
||||
ctx->decode_cfg = decode_cfg;
|
||||
ctx->spec = spec;
|
||||
ctx->disasm = disasm;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -1186,9 +1186,8 @@ anv_pipeline_add_executable(struct anv_pipeline *pipeline,
|
|||
/* Creating this is far cheaper than it looks. It's perfectly fine to
|
||||
* do it for every binary.
|
||||
*/
|
||||
struct gen_disasm *d = gen_disasm_create(&pipeline->device->info);
|
||||
gen_disasm_disassemble(d, stage->code, code_offset, stream);
|
||||
gen_disasm_destroy(d);
|
||||
gen_disassemble(&pipeline->device->info,
|
||||
stage->code, code_offset, stream);
|
||||
|
||||
fclose(stream);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue