Minimize arm64 decoding table

This commit is contained in:
gingerBill
2026-06-14 19:22:31 +01:00
parent 67dfa25696
commit c8de23f678
3 changed files with 17 additions and 21 deletions

View File

@@ -1230,21 +1230,19 @@ DECODE_ENTRIES := [1198]Decode_Entry{
@(rodata)
DECODE_INDEX_OP0 := [16]Decode_Index{
/* 0 */ {0, 75},
/* 1 */ {0, 0},
/* 2 */ {75, 379},
/* 3 */ {0, 0},
/* 4 */ {454, 76},
/* 5 */ {530, 50},
/* 6 */ {580, 8},
/* 7 */ {588, 93},
/* 8 */ {681, 16},
/* 9 */ {697, 34},
/* A */ {731, 98},
/* B */ {829, 21},
/* C */ {850, 150},
/* D */ {1000, 84},
/* E */ {1084, 13},
/* F */ {1097, 101},
0x00 = {0, 75},
0x02 = {75, 379},
0x04 = {454, 76},
0x05 = {530, 50},
0x06 = {580, 8},
0x07 = {588, 93},
0x08 = {681, 16},
0x09 = {697, 34},
0x0A = {731, 98},
0x0B = {829, 21},
0x0C = {850, 150},
0x0D = {1000, 84},
0x0E = {1084, 13},
0x0F = {1097, 101},
}

View File

@@ -26,7 +26,7 @@ package rexcode_arm64
// immediate encoding (N:imms:immr); they're deferred to a follow-up
// turn that adds the bitmask encoder helper.
@(rodata)
ENCODING_TABLE: [Mnemonic][]Encoding = #partial {
ENCODING_TABLE := #partial [Mnemonic][]Encoding{
.INVALID = {},
// =========================================================================

View File

@@ -177,10 +177,8 @@ emit_range_table :: proc(sb: ^strings.Builder, name: string, ranges: []Range) {
fmt.sbprintfln(sb, "@(rodata)")
fmt.sbprintfln(sb, "%s := [%d]Decode_Index{{", name, len(ranges))
for r, i in ranges {
if r.count == 0 {
fmt.sbprintfln(sb, "\t/* %X */ {{0, 0}},", i)
} else {
fmt.sbprintfln(sb, "\t/* %X */ {{%d, %d}},", i, r.start, r.count)
if r.count != 0 {
fmt.sbprintfln(sb, "\t0x%02X = {{%d, %d}},", i, r.start, r.count)
}
}
strings.write_string(sb, "}\n\n")