Skip to content

Commit fa1f91d

Browse files
committed
jit/ir: Include A32 opcodes
Signed-off-by: Ronald Caesar <github43132@proton.me>
1 parent 304aeed commit fa1f91d

File tree

6 files changed

+825
-13
lines changed

6 files changed

+825
-13
lines changed

src/jit/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ target_sources(jit PRIVATE
44
${CMAKE_CURRENT_SOURCE_DIR}/decoder/arm32.cpp
55
${CMAKE_CURRENT_SOURCE_DIR}/ir/type.cpp
66
${CMAKE_CURRENT_SOURCE_DIR}/ir/value.cpp
7+
${CMAKE_CURRENT_SOURCE_DIR}/ir/opcode.cpp
78
)
89

910
target_link_libraries(jit PRIVATE common host)

src/jit/ir/opcode.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include "opcode.h"
2+
#include "type.h"
3+
#include <stddef.h>
4+
5+
#define LOG_MODULE "jit"
6+
#include "common/logging.h"
7+
8+
namespace pound::jit::ir {
9+
#define OPCODE_ARGS_TYPES_SIZE 4
10+
#define OPCODE_ARRAY_SIZE 386
11+
12+
typedef struct
13+
{
14+
const char *name;
15+
type_t type;
16+
type_t arg_types[OPCODE_ARGS_TYPES_SIZE];
17+
} decoded_opcode_t;
18+
19+
decoded_opcode_t opcodes[OPCODE_ARRAY_SIZE] = {
20+
#define OPCODE(name, type, ...) \
21+
decoded_opcode_t { #name, type, { __VA_ARGS__ } },
22+
#define A32OPC(name, type, ...) \
23+
decoded_opcode_t { #name, type, { __VA_ARGS__ } },
24+
// #define A64OPC(name, type, ...) decoded_opcode_t{#name, type, {__VA_ARGS__}},
25+
#include "./opcode.inc"
26+
#undef OPCODE
27+
// #undef A32OPC
28+
// #undef A64OPC
29+
};
30+
31+
void
32+
opcode_init (void)
33+
{
34+
for (size_t i = 0; i < OPCODE_ARRAY_SIZE; ++i)
35+
{
36+
LOG_TRACE("Opcode Registered: %s", opcodes[i].name);
37+
}
38+
}
39+
} // namespace pound::jit::ir

src/jit/ir/opcode.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace pound::jit::ir {
2+
void opcode_init(void);
3+
}

0 commit comments

Comments
 (0)