diff --git a/doc/目录结构设计.md b/doc/目录结构设计.md index 61224b7..f34f5fd 100644 --- a/doc/目录结构设计.md +++ b/doc/目录结构设计.md @@ -60,7 +60,12 @@ │ │ ├── SymbolTable.cpp │ │ └── ConstEval.cpp │ ├── irgen/ -│ │ └── IRGen.cpp +│ │ ├── CMakeLists.txt +│ │ ├── IRGenDriver.cpp +│ │ ├── IRGenFunc.cpp +│ │ ├── IRGenStmt.cpp +│ │ ├── IRGenExp.cpp +│ │ └── IRGenDecl.cpp │ ├── ir/ │ │ ├── Context.cpp │ │ ├── Module.cpp @@ -177,9 +182,16 @@ #### 3.2.6 `src/irgen/`:AST → IR(平台无关,LLVM 风格) -- `src/irgen/IRGen.cpp` - - 将“带语义信息的 AST”翻译为平台无关 IR(`src/ir/*`)。 - - 负责控制流结构化翻译(基本块、分支、循环)、表达式求值翻译、函数与全局对象生成等。 +- `src/irgen/IRGenDriver.cpp` + - 驱动 Visitor 遍历 AST,调度各子模块完成翻译。 +- `src/irgen/IRGenFunc.cpp` + - 函数翻译:函数定义、参数列表与返回值翻译;创建对应 IR 函数对象。 +- `src/irgen/IRGenStmt.cpp` + - 语句翻译:if/while/return 等控制流构造,生成基本块与分支。 +- `src/irgen/IRGenExp.cpp` + - 表达式翻译:算术运算、比较、逻辑运算、函数调用等ir指令生成。 +- `src/irgen/IRGenDecl.cpp` + - 声明翻译:处理全局变量、局部变量、数组初始化与空间分配等。 #### 3.2.7 `src/ir/`:LLVM 风格 IR 核心