feat(mir): 增加 Lab3 AArch64 MVP 后端与 --emit-asm 支持
This commit is contained in:
@@ -1,4 +1,23 @@
|
||||
// 机器指令(MIRInstr):
|
||||
// - opcode + operands(寄存器/立即数/栈槽/符号/标签等)
|
||||
// - 支撑指令选择、寄存器分配与汇编打印
|
||||
#include "mir/MIR.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace mir {
|
||||
|
||||
Operand::Operand(Kind kind, PhysReg reg, int imm)
|
||||
: kind_(kind), reg_(reg), imm_(imm) {}
|
||||
|
||||
Operand Operand::Reg(PhysReg reg) { return Operand(Kind::Reg, reg, 0); }
|
||||
|
||||
Operand Operand::Imm(int value) {
|
||||
return Operand(Kind::Imm, PhysReg::W0, value);
|
||||
}
|
||||
|
||||
Operand Operand::FrameIndex(int index) {
|
||||
return Operand(Kind::FrameIndex, PhysReg::W0, index);
|
||||
}
|
||||
|
||||
MachineInstr::MachineInstr(Opcode opcode, std::vector<Operand> operands)
|
||||
: opcode_(opcode), operands_(std::move(operands)) {}
|
||||
|
||||
} // namespace mir
|
||||
|
||||
Reference in New Issue
Block a user