Mesa (main): freedreno/afuc: Split out helpers to parse labels and packet-table
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 1 00:30:14 UTC 2021
Module: Mesa
Branch: main
Commit: ea2e24419831854fdb6098cca0094b81250d010e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea2e24419831854fdb6098cca0094b81250d010e
Author: Rob Clark <robdclark at chromium.org>
Date: Thu May 27 11:35:21 2021 -0700
freedreno/afuc: Split out helpers to parse labels and packet-table
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
---
src/freedreno/afuc/disasm.c | 43 ++++++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/src/freedreno/afuc/disasm.c b/src/freedreno/afuc/disasm.c
index 78377f0e230..8de7991ebbd 100644
--- a/src/freedreno/afuc/disasm.c
+++ b/src/freedreno/afuc/disasm.c
@@ -709,26 +709,26 @@ disasm_instr(uint32_t *instrs, unsigned pc)
}
static void
-disasm(uint32_t *buf, int sizedwords)
+setup_packet_table(uint32_t *jmptbl, uint32_t sizedwords)
{
- uint32_t *instrs = buf;
- const int jmptbl_start = instrs[1] & 0xffff;
- uint32_t *jmptbl = &buf[jmptbl_start];
- afuc_opc opc;
- bool rep;
- int i;
+ num_jump_labels = 0;
- /* parse jumptable: */
- for (i = 0; i < 0x80; i++) {
+ for (unsigned i = 0; i < sizedwords; i++) {
unsigned offset = jmptbl[i];
unsigned n = i; // + CP_NOP;
add_jump_table_entry(n, offset);
}
+}
- /* do a pre-pass to find instructions that are potential branch targets,
- * and add labels for them:
- */
- for (i = 0; i < jmptbl_start; i++) {
+static void
+setup_labels(uint32_t *instrs, uint32_t sizedwords)
+{
+ afuc_opc opc;
+ bool rep;
+
+ num_label_offsets = 0;
+
+ for (unsigned i = 0; i < sizedwords; i++) {
afuc_instr *instr = (void *)&instrs[i];
afuc_get_opc(instr, &opc, &rep);
@@ -755,6 +755,23 @@ disasm(uint32_t *buf, int sizedwords)
break;
}
}
+}
+
+static void
+disasm(uint32_t *buf, int sizedwords)
+{
+ uint32_t *instrs = buf;
+ const int jmptbl_start = instrs[1] & 0xffff;
+ uint32_t *jmptbl = &buf[jmptbl_start];
+ int i;
+
+ /* parse jumptable: */
+ setup_packet_table(jmptbl, 0x80);
+
+ /* do a pre-pass to find instructions that are potential branch targets,
+ * and add labels for them:
+ */
+ setup_labels(instrs, jmptbl_start);
if (emulator) {
struct emu state = {
More information about the mesa-commit
mailing list