Skip to content

Commit b4b72f3

Browse files
committed
feat: Add IR generation test tool and update CMakeLists.txt to link necessary LLVM components for IR generation.
1 parent 6e94f87 commit b4b72f3

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (LLVM_FOUND)
2424
link_directories(${LLVM_LIBRARY_DIRS})
2525

2626
# Map generic components to specific libs
27-
llvm_map_components_to_libnames(llvm_libs core support executionengine native ipo)
27+
llvm_map_components_to_libnames(llvm_libs core support executionengine native ipo analysis transformutils bitwriter)
2828
else()
2929
message(WARNING "LLVM not found. Building without LLVM backend.")
3030
set(llvm_libs "")
@@ -37,7 +37,6 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
3737
include_directories(include)
3838
include_directories(src)
3939

40-
4140
# --- Library Sources ---
4241
file(GLOB_RECURSE LIB_SOURCES
4342
"src/*.c"
@@ -74,6 +73,9 @@ if (PROX_STATIC_BUILD)
7473
else()
7574
# Traditional split build
7675
add_library(proxpl_lib SHARED ${LIB_SOURCES})
76+
if (LLVM_FOUND)
77+
target_link_libraries(proxpl_lib PRIVATE ${llvm_libs})
78+
endif()
7779
add_executable(proxpl src/main.c)
7880
target_link_libraries(proxpl PRIVATE proxpl_lib)
7981
endif()

tools/ir_gen_test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ void test_ir(const char* source) {
5959
}
6060

6161
int main() {
62+
initVM(&vm); // Initialize VM for string interning and GC
63+
6264
const char* code =
6365
"let x = 10;\n"
6466
"if (x > 5) {\n"
@@ -73,5 +75,7 @@ int main() {
7375
"return x + z;";
7476

7577
test_ir(code);
78+
79+
freeVM(&vm); // Cleanup
7680
return 0;
7781
}

0 commit comments

Comments
 (0)