refactor(irgen): IR改成alloca和store形式
This commit is contained in:
@@ -18,7 +18,8 @@ ir::Value* IRGenImpl::GenExpr(const ast::Expr& expr) {
|
||||
if (it == locals_.end()) {
|
||||
throw std::runtime_error("变量未找到: " + var->name);
|
||||
}
|
||||
return it->second;
|
||||
std::string name = ir::DefaultContext().NextTemp();
|
||||
return builder_.CreateLoad(it->second, name);
|
||||
}
|
||||
if (auto bin = dynamic_cast<const ast::BinaryExpr*>(&expr)) {
|
||||
auto* lhs = GenExpr(*bin->lhs);
|
||||
|
||||
Reference in New Issue
Block a user