feat(mir): 添加寄存器分配 pass 支持
- 实现了核心寄存器分配接口 scc_reg_alloc.h - 添加 x86_64 架构特定的寄存器分配实现 - 实现基础的虚拟寄存器到物理寄存器分配逻辑 - 支持栈槽分配和重载/存储指令生成 fix(argparse): 修复帮助信息打印中的枚举类型显示 - 将固定大小缓冲区改为动态字符串处理 - 正确显示枚举类型的选项值和可选值列表 - 使用 | 分隔符展示多个可选值 refactor(main): 调整编译流程中的 pass 阶段支持 - 更新配置文件中各编译阶段的名称定义 - 添加对寄存器分配、帧布局等中间表示 pass 的支持 - 重构主流程以支持不同 MIR 阶段的代码输出
This commit is contained in:
@@ -145,24 +145,42 @@ void scc_argparse_print_help(scc_argparse_t *parser, scc_argparse_cmd_t *cmd) {
|
||||
continue;
|
||||
if (opt->short_name == 'h')
|
||||
opt->description = lines[ARGPARSE_SHOW_HELP_MSG];
|
||||
char buf[64];
|
||||
scc_str_t buf;
|
||||
scc_str_init(&buf);
|
||||
int pos = 0;
|
||||
if (opt->short_name) {
|
||||
buf[pos++] = '-';
|
||||
buf[pos++] = opt->short_name;
|
||||
scc_str_append_ch(&buf, '-');
|
||||
scc_str_append_ch(&buf, opt->short_name);
|
||||
if (opt->long_name) {
|
||||
buf[pos++] = ',';
|
||||
buf[pos++] = ' ';
|
||||
scc_str_append_ch(&buf, ',');
|
||||
scc_str_append_ch(&buf, ' ');
|
||||
}
|
||||
}
|
||||
if (opt->long_name) {
|
||||
buf[pos++] = '-';
|
||||
buf[pos++] = '-';
|
||||
for (const char *p = opt->long_name; *p; ++p)
|
||||
buf[pos++] = *p;
|
||||
scc_str_append_ch(&buf, '-');
|
||||
scc_str_append_ch(&buf, '-');
|
||||
scc_str_append_cstr(&buf, opt->long_name,
|
||||
scc_strlen(opt->long_name));
|
||||
}
|
||||
buf[pos] = '\0';
|
||||
scc_printf(" %-25s %s", buf,
|
||||
if (opt->spec.value_type == SCC_ARGPARSE_VAL_TYPE_ENUM) {
|
||||
scc_str_append_ch(&buf, '=');
|
||||
scc_str_append_ch(&buf, '<');
|
||||
for (int j = 0; j < opt->spec.choices.count; j += 1) {
|
||||
if (opt->spec.choices.values[j] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (j != 0) {
|
||||
scc_str_append_ch(&buf, '|');
|
||||
}
|
||||
|
||||
scc_str_append_cstr(
|
||||
&buf, opt->spec.choices.values[j],
|
||||
scc_strlen(opt->spec.choices.values[j]));
|
||||
}
|
||||
scc_str_append_ch(&buf, '>');
|
||||
}
|
||||
scc_printf(" %-25s %s", scc_str_as_cstr(&buf),
|
||||
opt->description ? opt->description : "");
|
||||
// if (opt->spec.default_value)
|
||||
// scc_printf(" (default: %s)", opt->spec.default_value);
|
||||
|
||||
Reference in New Issue
Block a user