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.
20 lines
519 B
20 lines
519 B
#include "ir/IR.h"
|
|
|
|
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
|