You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Forgetting branch at the end of basic block is a common mistake, that leads to invalid IR.
Describe the solution you'd like
Add 2 builder classes for basic block:
Allows to insert any instruction until branch, then switches to second. If first builder is dropped produce a compile error, as IR is invalid.
Doesn't allow to insert any instruction, because we already have branch. No error on drop
Describe possible drawbacks to your solution
Must explicitly check for return or branch before adding an unknown instruction
Additional context
When I say "branch" I mean branch or return instruction.
The text was updated successfully, but these errors were encountered:
gavrilikhin-d
changed the title
Add builder for basic blocks to ensure branching
Ensure that basic blocks end with branch
Nov 5, 2022
Not sure that there's a good way to do this in inkwell. I think I always expected this sorta thing to be in a higher level abstraction ontop of inkwell. But it's worth exploring I suppose
Not sure that there's a good way to do this in inkwell. I think I always expected this sorta thing to be in a higher level abstraction ontop of inkwell. But it's worth exploring I suppose
I just thought that if inkwell adds type safety on top of llvm_sys, it may add "ir-safety" in some trivial cases as well
Is your feature request related to a problem? Please describe.
Forgetting branch at the end of basic block is a common mistake, that leads to invalid IR.
Describe the solution you'd like
Add 2 builder classes for basic block:
Describe possible drawbacks to your solution
Must explicitly check for return or branch before adding an unknown instruction
Additional context
When I say "branch" I mean branch or return instruction.
The text was updated successfully, but these errors were encountered: