From a25e4ccbe08f11eab54203acea6cfb197b3fc234 Mon Sep 17 00:00:00 2001 From: Ronald Caesar Date: Sun, 26 Oct 2025 14:05:45 -0400 Subject: [PATCH] jit/ir: Add IR types Signed-off-by: Ronald Caesar --- src/jit/CMakeLists.txt | 13 +++++++++++++ src/jit/ir/type.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/jit/CMakeLists.txt create mode 100644 src/jit/ir/type.cpp diff --git a/src/jit/CMakeLists.txt b/src/jit/CMakeLists.txt new file mode 100644 index 0000000..daf58f3 --- /dev/null +++ b/src/jit/CMakeLists.txt @@ -0,0 +1,13 @@ +add_library(jit STATIC) + +target_sources(jit PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/decoder/arm32.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ir/type.cpp +) + +target_link_libraries(jit PRIVATE common host) + +target_include_directories(jit PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. +) diff --git a/src/jit/ir/type.cpp b/src/jit/ir/type.cpp new file mode 100644 index 0000000..133c724 --- /dev/null +++ b/src/jit/ir/type.cpp @@ -0,0 +1,30 @@ +#include "common/passert.h" + +namespace pound::jit::decoder { +typedef enum +{ + IR_TYPE_VOID = 0, + IR_TYPE_U1 = 1 << 0, + IR_TYPE_U8 = 1 << 1, + IR_TYPE_U16 = 1 << 2, + IR_TYPE_U32 = 1 << 3, + IR_TYPE_U64 = 1 << 4, + IR_TYPE_U128 = 1 << 5, + IR_TYPE_A32_REG = 1 << 6, // ARM32 GPR R0-R14 + IR_TYPE_A32_EXT_REG = 1 << 7, // ARM32 Extended Registers (e.g., for + // VFP/NEON, or just R15 if treated specially) + IR_TYPE_A32_CPSR = 1 << 8, // ARM32 CPSR/SPSR + IR_TYPE_COND = 1 << 9, // Condition codes + IR_TYPE_ACC_TYPE = 1 << 10, // Memory access type + IR_TYPE_OPAQUE + = 1 << 11, // Represents a value defined by another IR instruction +} ir_type_t; + +bool +ir_are_types_compatible (const ir_type_t t1, const ir_type_t t2) +{ + const bool is_compatible + = (t1 == t2) || (IR_TYPE_OPAQUE == t1) || (IR_TYPE_OPAQUE == t2); + return is_compatible; +} +}