IR设计
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
// IR 指令体系:
|
||||
// - 二元运算/比较、load/store、call、br/condbr、ret、phi、alloca 等
|
||||
// - 指令操作数与结果类型管理,支持打印与优化
|
||||
#include "ir/IR.h"
|
||||
|
||||
namespace ir {
|
||||
|
||||
BinaryInst::BinaryInst(Opcode op, std::shared_ptr<Type> ty, Value* lhs,
|
||||
Value* rhs, std::string name)
|
||||
: Instruction(op, std::move(ty), std::move(name)), lhs_(lhs), rhs_(rhs) {}
|
||||
|
||||
ReturnInst::ReturnInst(Value* val)
|
||||
: Instruction(Opcode::Ret, Type::Void(), ""), value_(val) {}
|
||||
|
||||
} // namespace ir
|
||||
|
||||
Reference in New Issue
Block a user