[IR]指令构造器更新
This commit is contained in:
@@ -333,15 +333,11 @@ class IRBuilder {
|
||||
block->getInstructions().emplace(position, inst);
|
||||
return inst;
|
||||
} ///< 创建store指令
|
||||
PhiInst * createPhiInst(Type *type, Value *lhs, BasicBlock *parent, const std::string &name = "") {
|
||||
auto predNum = parent->getNumPredecessors();
|
||||
std::vector<Value *> rhs;
|
||||
for (size_t i = 0; i < predNum; i++) {
|
||||
rhs.push_back(lhs);
|
||||
}
|
||||
auto inst = new PhiInst(type, lhs, rhs, lhs, parent, name);
|
||||
PhiInst * createPhiInst(Type *type, const std::vector<Value*> &vals = {}, const std::vector<BasicBlock*> &blks = {}, const std::string &name = "") {
|
||||
auto predNum = block->getNumPredecessors();
|
||||
auto inst = new PhiInst(type, vals, blks, block, name);
|
||||
assert(inst);
|
||||
parent->getInstructions().emplace(parent->begin(), inst);
|
||||
block->getInstructions().emplace(block->begin(), inst);
|
||||
return inst;
|
||||
} ///< 创建Phi指令
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user