fix(ir): 修改了一下context的管理

This commit is contained in:
jing
2026-03-11 23:04:28 +08:00
parent fab6983d40
commit 0e5a75eaf3
13 changed files with 112 additions and 106 deletions

View File

@@ -12,6 +12,10 @@ BasicBlock::BasicBlock(std::string name) : name_(std::move(name)) {}
const std::string& BasicBlock::name() const { return name_; }
Function* BasicBlock::parent() const { return parent_; }
void BasicBlock::set_parent(Function* parent) { parent_ = parent; }
bool BasicBlock::HasTerminator() const {
return !instructions_.empty() && instructions_.back()->IsTerminator();
}
@@ -21,4 +25,12 @@ const std::vector<std::unique_ptr<Instruction>>& BasicBlock::instructions()
return instructions_;
}
const std::vector<BasicBlock*>& BasicBlock::predecessors() const {
return predecessors_;
}
const std::vector<BasicBlock*>& BasicBlock::successors() const {
return successors_;
}
} // namespace ir