Add support for self-referencing phi nodes

This commit is contained in:
ReinUsesLisp
2021-02-24 18:30:10 -03:00
parent 9a08dab7ee
commit f6a7130486
2 changed files with 7 additions and 0 deletions

View File

@@ -99,6 +99,10 @@ Id Module::ForwardDeclarationId() {
return Id{++bound};
}
Id Module::CurrentId() const noexcept {
return Id{bound + 1};
}
Id Module::ExchangeCurrentId(Id new_current_id) {
const std::uint32_t old_id = std::exchange(bound, new_current_id.value - 1);
return Id{old_id + 1};