diff --git a/README.md b/README.md index 8b9cf62..3da90f1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ - - + + + + + diff --git a/src/irgen/CMakeLists.txt b/src/irgen/CMakeLists.txt new file mode 100644 index 0000000..7404f1f --- /dev/null +++ b/src/irgen/CMakeLists.txt @@ -0,0 +1,4 @@ +# src/irgen/ 子模块构建脚本: +# - 编译 IR 生成相关源文件(Driver/Func/Stmt/Exp/Decl) +# - 作为 src/ 的子目标被链接到最终可执行文件(具体组织方式按工程实现选择) + diff --git a/src/irgen/IRGen.cpp b/src/irgen/IRGen.cpp deleted file mode 100644 index 98a6076..0000000 --- a/src/irgen/IRGen.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// AST -> IR(平台无关、LLVM 风格): -// - 将带语义信息的 AST 翻译为 src/ir/* 中的 IR 结构 -// - 负责控制流结构化翻译(基本块、分支、循环) -// - 生成函数与全局对象,翻译表达式求值与调用等 - diff --git a/src/irgen/IRGenDecl.cpp b/src/irgen/IRGenDecl.cpp new file mode 100644 index 0000000..3ff8aec --- /dev/null +++ b/src/irgen/IRGenDecl.cpp @@ -0,0 +1,4 @@ +// 声明翻译模块: +// - 处理全局变量与局部变量声明 +// - 处理数组初始化、空间分配与初值生成等 + diff --git a/src/irgen/IRGenDriver.cpp b/src/irgen/IRGenDriver.cpp new file mode 100644 index 0000000..ca7d479 --- /dev/null +++ b/src/irgen/IRGenDriver.cpp @@ -0,0 +1,4 @@ +// IR 生成驱动(Driver): +// - 驱动 Visitor 遍历 AST,调度各子模块完成翻译 +// - 统一管理模块级翻译入口与上下文(Module/IRBuilder 等) +// - 组织函数/语句/表达式/声明等翻译流程 diff --git a/src/irgen/IRGenExp.cpp b/src/irgen/IRGenExp.cpp new file mode 100644 index 0000000..30a9ff0 --- /dev/null +++ b/src/irgen/IRGenExp.cpp @@ -0,0 +1,4 @@ +// 表达式翻译模块: +// - 处理算术运算、比较、逻辑运算、函数调用等表达式 +// - 生成对应的 IR 指令并返回 SSA 值 + diff --git a/src/irgen/IRGenFunc.cpp b/src/irgen/IRGenFunc.cpp new file mode 100644 index 0000000..aa22700 --- /dev/null +++ b/src/irgen/IRGenFunc.cpp @@ -0,0 +1,4 @@ +// 函数翻译模块: +// - 处理函数定义、参数列表与返回值翻译 +// - 创建并填充对应的 IR Function 对象 + diff --git a/src/irgen/IRGenStmt.cpp b/src/irgen/IRGenStmt.cpp new file mode 100644 index 0000000..63447cf --- /dev/null +++ b/src/irgen/IRGenStmt.cpp @@ -0,0 +1,4 @@ +// 语句翻译模块: +// - 处理 if/while/return 等控制流构造 +// - 负责基本块创建、分支跳转与控制流收束 +