forked from NUDT-compiler/nudt-compiler-cpp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
564 B
24 lines
564 B
#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
|