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