Skip to content

Commit 18fa5dd

Browse files
committed
jit/ir: Add IR types
Signed-off-by: Ronald Caesar <github43132@proton.me>
1 parent ac95025 commit 18fa5dd

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/jit/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
add_library(jit STATIC)
2+
3+
target_sources(jit PRIVATE
4+
${CMAKE_CURRENT_SOURCE_DIR}/decoder/arm32.cpp
5+
${CMAKE_CURRENT_SOURCE_DIR}/ir/type.cpp
6+
)
7+
8+
target_link_libraries(jit PRIVATE common host)
9+
10+
target_include_directories(jit PUBLIC
11+
${CMAKE_CURRENT_SOURCE_DIR}
12+
${CMAKE_CURRENT_SOURCE_DIR}/..
13+
)

src/jit/ir/type.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace pound::jit::decoder
2+
{
3+
typedef enum {
4+
IR_TYPE_VOID = 0,
5+
IR_TYPE_U1 = 1 << 0,
6+
IR_TYPE_U8 = 1 << 1,
7+
IR_TYPE_U16 = 1 << 2,
8+
IR_TYPE_U32 = 1 << 3,
9+
IR_TYPE_U64 = 1 << 4,
10+
IR_TYPE_U128 = 1 << 5,
11+
IR_TYPE_A32_REG = 1 << 6, // ARM32 GPR R0-R14
12+
IR_TYPE_A32_EXT_REG = 1 << 7, // ARM32 Extended Registers (e.g., for VFP/NEON, or just R15 if treated specially)
13+
IR_TYPE_A32_CPSR = 1 << 8, // ARM32 CPSR/SPSR
14+
IR_TYPE_COND = 1 << 9, // Condition codes
15+
IR_TYPE_ACC_TYPE = 1 << 10, // Memory access type
16+
IR_TYPE_OPAQUE = 1 << 11, // Represents a value defined by another IR instruction
17+
} ir_type_t;
18+
19+
bool ir_are_types_compatible(ir_type_t t1, ir_type_t t2)
20+
{
21+
const bool is_compatible = (t1 == t2) || (IR_TYPE_OPAQUE == t1) || (IR_TYPE_OPAQUE == t2);
22+
return is_compatible;
23+
}
24+
}

0 commit comments

Comments
 (0)