[midend-reg2mem]增加reg2mem遍,应用未定义值,增加inst迭代器查找方法,通过编译且脚本运行通过率不变

This commit is contained in:
rain2133
2025-07-29 02:01:48 +08:00
parent 535a935bf1
commit 3e4cac089e
6 changed files with 337 additions and 2 deletions

View File

@@ -525,6 +525,10 @@ public:
iterator begin() { return instructions.begin(); }
iterator end() { return instructions.end(); }
iterator terminator() { return std::prev(end()); }
iterator findInstIterator(Instruction *inst) {
return std::find_if(instructions.begin(), instructions.end(),
[inst](const std::unique_ptr<Instruction> &i) { return i.get() == inst; });
} ///< 查找指定指令的迭代器
bool hasSuccessor(BasicBlock *block) const {
return std::find(successors.begin(), successors.end(), block) != successors.end();
} ///< 判断是否有后继块