[IR gen] debugging

This commit is contained in:
Lixuanwang
2025-06-09 19:30:37 +08:00
parent c47d522e3a
commit 7d08763b2e
2 changed files with 2 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ add_executable(sysyc
SysYIRGenerator.cpp SysYIRGenerator.cpp
Backend.cpp Backend.cpp
LLVMIRGenerator.cpp LLVMIRGenerator.cpp
LLVMIRGenerator_1.cpp
) )
target_include_directories(sysyc PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(sysyc PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_compile_options(sysyc PRIVATE -frtti) target_compile_options(sysyc PRIVATE -frtti)

View File

@@ -171,6 +171,7 @@ std::any LLVMIRGenerator::visitVarDef(SysYParser::VarDefContext* ctx) {
std::string llvmType = getLLVMType(type); std::string llvmType = getLLVMType(type);
std::string allocaName = getNextTemp(); std::string allocaName = getNextTemp();
irStream << " " << allocaName << " = alloca " << llvmType << ", align 4\n"; irStream << " " << allocaName << " = alloca " << llvmType << ", align 4\n";
if (ctx->ASSIGN()) { if (ctx->ASSIGN()) {