#include "mir/MIR.h" #include namespace mir { Operand::Operand(Kind kind, PhysReg reg, int imm, VRegClass vreg_class, std::string symbol) : kind_(kind), reg_(reg), imm_(imm), symbol_(std::move(symbol)), vreg_class_(vreg_class) {} Operand Operand::Reg(PhysReg reg) { return Operand(Kind::Reg, reg, 0); } Operand Operand::VReg(int id, VRegClass vreg_class) { return Operand(Kind::VReg, PhysReg::W0, id, vreg_class); } Operand Operand::Imm(int value) { return Operand(Kind::Imm, PhysReg::W0, value); } Operand Operand::FrameIndex(int index) { return Operand(Kind::FrameIndex, PhysReg::W0, index); } Operand Operand::Label(int label_id) { return Operand(Kind::Label, PhysReg::W0, label_id); } Operand Operand::Symbol(std::string symbol) { return Operand(Kind::Symbol, PhysReg::W0, 0, VRegClass::Int, std::move(symbol)); } MachineInstr::MachineInstr(Opcode opcode, std::vector operands) : opcode_(opcode), operands_(std::move(operands)) {} } // namespace mir