aco,radv: support symbol relocation in aco

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22727>
This commit is contained in:
Qiang Yu
2023-04-25 20:50:48 +08:00
parent 3fc4ddd628
commit 360176b671
8 changed files with 50 additions and 13 deletions

View File

@@ -236,7 +236,8 @@ aco_compile_shader(const struct aco_compiler_options* options,
/* assembly */
std::vector<uint32_t> code;
unsigned exec_size = aco::emit_program(program.get(), code);
std::vector<struct aco_symbol> symbols;
unsigned exec_size = aco::emit_program(program.get(), code, &symbols);
if (program->collect_statistics)
aco::collect_postasm_stats(program.get(), code);
@@ -252,7 +253,8 @@ aco_compile_shader(const struct aco_compiler_options* options,
stats_size = aco_num_statistics * sizeof(uint32_t);
(*build_binary)(binary, &config, llvm_ir.c_str(), llvm_ir.size(), disasm.c_str(), disasm.size(),
program->statistics, stats_size, exec_size, code.data(), code.size());
program->statistics, stats_size, exec_size, code.data(), code.size(),
symbols.data(), symbols.size());
}
void
@@ -282,7 +284,7 @@ aco_compile_rt_prolog(const struct aco_compiler_options* options,
/* assembly */
std::vector<uint32_t> code;
code.reserve(align(program->blocks[0].instructions.size() * 2, 16));
unsigned exec_size = aco::emit_program(program.get(), code);
unsigned exec_size = aco::emit_program(program.get(), code, NULL);
bool get_disasm = options->dump_shader || options->record_ir;
@@ -291,7 +293,7 @@ aco_compile_rt_prolog(const struct aco_compiler_options* options,
disasm = get_disasm_string(program.get(), code, exec_size);
(*build_prolog)(binary, &config, NULL, 0, disasm.c_str(), disasm.size(), program->statistics, 0,
exec_size, code.data(), code.size());
exec_size, code.data(), code.size(), NULL, 0);
}
void
@@ -319,7 +321,7 @@ aco_compile_vs_prolog(const struct aco_compiler_options* options,
/* assembly */
std::vector<uint32_t> code;
code.reserve(align(program->blocks[0].instructions.size() * 2, 16));
unsigned exec_size = aco::emit_program(program.get(), code);
unsigned exec_size = aco::emit_program(program.get(), code, NULL);
bool get_disasm = options->dump_shader || options->record_ir;
@@ -361,7 +363,7 @@ aco_compile_ps_epilog(const struct aco_compiler_options* options,
/* assembly */
std::vector<uint32_t> code;
unsigned exec_size = aco::emit_program(program.get(), code);
unsigned exec_size = aco::emit_program(program.get(), code, NULL);
bool get_disasm = options->dump_shader || options->record_ir;