12.8 切片 1:寄存器码骨架(MOVE/LOADK/RET)。
- Codegen.h/cpp:帧寄存器(0 起声明序)、常量表、函数表、小端映像拼装 - 切片 1 范围:PROGRAM 标量 + 字面量 LOADK + 变量 MOVE + RET;其余构造报 codegen error - codegen_test:23 断言(用例 01 空 MAIN 出 RET、02 LOADK r0/r1 + 常量表),ctest 9/9
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @file Codegen.h
|
||||
* @brief 寄存器码生成(12.8,切片 1:MOVE / LOADK / RET)
|
||||
* @author
|
||||
* @date 2026-08-21
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "compiler/Linker.h"
|
||||
#include "compiler/Parser.h"
|
||||
#include "compiler/Project.h"
|
||||
|
||||
namespace compiler {
|
||||
|
||||
// 编译工程为 .stb 映像字节(在链接 + 类型检查成功后调用)。
|
||||
// 失败返回 false,err 前缀 "codegen error"。
|
||||
bool codegen_project(const Project& proj, const std::vector<SourceUnit>& units,
|
||||
const LinkResult& link, std::vector<uint8_t>* image,
|
||||
std::string* err);
|
||||
}
|
||||
Reference in New Issue
Block a user