Files
archived-pound/src/jit/frontend/decoder/arm32.c
Ronald Caesar b9b62574bf jit: Implement build-time generation of jit infrastructure
generate_jit_assets.py expands the automatated code generation to
include:

- Opcode enumerations in arm32_opcodes.h.
- Decoder lookup tables in arm32_table.c
- Computed-goto jump tables foe the interpreter in handler_table.inc.

Relocates arm32.inc to src/jit/common/a32_instructions.inc.

Implements the primary execution loop in
src/jit/interpreter/arm32/instruction.c. The code is messy and will be
rewritten in the future.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-12-06 00:31:46 -04:00

34 lines
845 B
C

#include "arm32.h"
#include "arm32_table.h"
#include "common/passert.h"
#include <string.h>
#include <stdbool.h>
#define LOG_MODULE "jit"
#include "common/logging.h"
const pvm_jit_decoder_arm32_instruction_info_t *
pvm_jit_decoder_arm32_decode (const uint32_t instruction)
{
/* Extract hash key: Bits [27:20] and [7:4] */
const uint32_t major = (instruction >> 20U) & 0xFFU;
const uint32_t minor = (instruction >> 4U) & 0xFU;
const uint16_t index = (uint16_t)((major << 4U) | minor);
const decode_bucket_t *bucket = &g_decoder_lookup_table[index];
for (size_t i = 0; i < bucket->count; ++i)
{
const pvm_jit_decoder_arm32_instruction_info_t *info = bucket->instructions[i];
if ((instruction & info->mask) == info->expected)
{
return info;
}
}
return NULL;
}