refactor(dev): 统一 IR/MIR 接口命名风格

This commit is contained in:
Lane0218
2026-03-12 15:17:02 +08:00
parent f26551a896
commit b1155d8fa9
18 changed files with 170 additions and 167 deletions

View File

@@ -16,7 +16,7 @@ int AlignTo(int value, int align) {
void RunFrameLowering(MachineFunction& function) {
int cursor = 0;
for (const auto& slot : function.frame_slots()) {
for (const auto& slot : function.GetFrameSlots()) {
cursor += slot.size;
if (-cursor < -256) {
throw std::runtime_error(FormatError("mir", "暂不支持过大的栈帧"));
@@ -24,17 +24,17 @@ void RunFrameLowering(MachineFunction& function) {
}
cursor = 0;
for (const auto& slot : function.frame_slots()) {
for (const auto& slot : function.GetFrameSlots()) {
cursor += slot.size;
function.frame_slot(slot.index).offset = -cursor;
function.GetFrameSlot(slot.index).offset = -cursor;
}
function.set_frame_size(AlignTo(cursor, 16));
function.SetFrameSize(AlignTo(cursor, 16));
auto& insts = function.entry().instructions();
auto& insts = function.GetEntry().GetInstructions();
std::vector<MachineInstr> lowered;
lowered.emplace_back(Opcode::Prologue);
for (const auto& inst : insts) {
if (inst.opcode() == Opcode::Ret) {
if (inst.GetOpcode() == Opcode::Ret) {
lowered.emplace_back(Opcode::Epilogue);
}
lowered.push_back(inst);