refactor(irgen): IR改成alloca和store形式
This commit is contained in:
@@ -12,4 +12,13 @@ BinaryInst::BinaryInst(Opcode op, std::shared_ptr<Type> ty, Value* lhs,
|
||||
ReturnInst::ReturnInst(Value* val)
|
||||
: Instruction(Opcode::Ret, Type::Void(), ""), value_(val) {}
|
||||
|
||||
AllocaInst::AllocaInst(std::string name)
|
||||
: Instruction(Opcode::Alloca, Type::PtrInt32(), std::move(name)) {}
|
||||
|
||||
LoadInst::LoadInst(Value* ptr, std::string name)
|
||||
: Instruction(Opcode::Load, Type::Int32(), std::move(name)), ptr_(ptr) {}
|
||||
|
||||
StoreInst::StoreInst(Value* val, Value* ptr)
|
||||
: Instruction(Opcode::Store, Type::Void(), ""), value_(val), ptr_(ptr) {}
|
||||
|
||||
} // namespace ir
|
||||
|
||||
Reference in New Issue
Block a user