feat(mir): 实现x86-64架构寄存器分配和指令选择优化
- 修改x86_64_isel.h接口,将func_meta替换为func指针,并添加新的isel函数原型 - 添加x86_64_reg_alloc.h头文件,提供架构特定的寄存器分配操作填充函数 - 更新frame_layout.h定义frame_layout上下文结构 - 重构reg_alloc.h中的寄存器分配操作结构体,将ops从指针改为值类型, 并将mark_reg_unused重命名为clean_mark_regs - 扩展scc_mir.h中的函数元数据,添加vregs_count字段和虚拟寄存器管理函数 - 重新定义MIR pass阶段枚举,添加FRAME_LAYOUT和PROLOGUE_EPILOGUE阶段 - 添加win64目标相关头文件和实现,提供Windows x64 ABI降低和寄存器分配填充 - 更新虚拟寄存器表示格式从$到%,修复alloca指令处理 - 重构寄存器分配算法,改进虚拟寄存器到物理寄存器/栈槽的映射机制 - 完善MIR pass调度,支持多阶段处理流程
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <arch/x86_64_isel.h>
|
||||
#include <core_pass/scc_reg_alloc.h>
|
||||
#include <arch/x86_64_reg_alloc.h>
|
||||
|
||||
static void x86_emit_spill(scc_mir_instr_vec_t *ctx, int preg, int slot) {
|
||||
scc_mir_instr_t ins = {
|
||||
@@ -74,13 +74,10 @@ static void x86_get_implicit_regs(void *vctx, int opcode, const int **uses,
|
||||
}
|
||||
}
|
||||
|
||||
/* 组装 hooks 表 */
|
||||
scc_reg_alloc_op_t x86_reg_alloc_hooks = {
|
||||
.emit_spill = x86_emit_spill,
|
||||
.emit_reload = x86_emit_reload,
|
||||
.emit_copy = x86_emit_copy,
|
||||
.acquire_reg = x86_acquire_temp_reg,
|
||||
.release_reg = x86_release_temp_reg,
|
||||
.get_operand_access = x86_get_operand_access,
|
||||
.get_implicit_regs = x86_get_implicit_regs,
|
||||
};
|
||||
void scc_reg_alloc_fill_arch_x86(scc_reg_alloc_op_t *ops) {
|
||||
ops->emit_spill = x86_emit_spill;
|
||||
ops->emit_reload = x86_emit_reload;
|
||||
ops->emit_copy = x86_emit_copy;
|
||||
ops->get_operand_access = x86_get_operand_access;
|
||||
ops->get_implicit_regs = x86_get_implicit_regs;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user