阶段 B 步骤 4:compiler 配置驱动化,去除 isa 依赖。
- Project.h 自带 IoBinding;Stb.h/cpp:compiler 侧 .stb 规范(常量/ConstEntry/FNV/StbView/读写/sidecar) - Codec.h/cpp:指令字 pack/字段/配置驱动 disasm(format 表驱动) - Codegen:opcode 全查 MachineConfig(E_* 发射器)、常量 tag 查配置类型、初值按基元宽度写、 映像拼装用 Stb 常量;codegen_project 增加 cfg 参数 - main.cpp:--machine <path>(编译/反汇编必填),--disasm 用 StbView+Codec - CMake:compiler 不再链接 isa(仅 toml++ 私有);测试补链 isa(自身断言用) - 验证:20 用例字节不变(hash 0xc3fe4ae74ad45900 相同)、ctest 12/12、缺 --machine 报错退出
This commit is contained in:
@@ -119,8 +119,13 @@ namespace {
|
||||
std::printf("FAIL %s type: %s\n", dir, err.c_str());
|
||||
return false;
|
||||
}
|
||||
MachineConfig cfg;
|
||||
if (!cfg.load(std::string(REPO_ROOT) + "/compiler/machine.toml", &err)) {
|
||||
std::printf("FAIL %s machine load\n", dir);
|
||||
return false;
|
||||
}
|
||||
std::vector<uint8_t> img;
|
||||
if (!codegen_project(p, units, link, &img, &err)) {
|
||||
if (!codegen_project(p, units, link, cfg, &img, &err)) {
|
||||
if (want == Outcome::CompileError) {
|
||||
++g_checks;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user