Revert "可以处理生成加法的IR"

This commit is contained in:
jing
2025-12-29 15:49:30 +08:00
parent e941cced9b
commit 8903bf73f9
42 changed files with 158 additions and 919 deletions

View File

@@ -1,19 +1,4 @@
#include "ir/IR.h"
// IR 构建工具:
// - 管理插入点(当前基本块/位置)
// - 提供创建各类指令的便捷接口,降低 IRGen 复杂度
namespace ir {
ConstantInt* IRBuilder::CreateConstInt(int v) {
// 常量不需要挂在基本块里,直接返回局部对象指针。
return new ConstantInt(v);
}
BinaryInst* IRBuilder::CreateBinary(Opcode op, Value* lhs, Value* rhs,
const std::string& name) {
return insertBlock_->Append<BinaryInst>(op, Type::Int32(), lhs, rhs, name);
}
ReturnInst* IRBuilder::CreateRet(Value* v) {
return insertBlock_->Append<ReturnInst>(v);
}
} // namespace ir