Open
Description
I am trying to use LLVM lite to implement a while loop construct. I know the IR for this, but I am having trouble implementing this in Python. I believe that the reason for this is because the current implementation of the if-then
context manager contains the following basic blocks:
entry:
instructions
entry.if:
instrs
entry.endif
instrs
I believe that in order to be able to use this context manager, unless there is another way to do it with the current implementation, it should have the entry block split in two, like so:
entry:
instructions
entry.cond:
instrs
entry.if:
instrs
entry.endif
instrs
This way, users would be able to jump specifically back into the conditional basic block and avoid reinitialising any variables defined outside of the if statement, allowing for code such as:
int main() {
int x = 10;
START: if(x > 0) {
printf("%d\n", x);
x -= 1;
goto START;
}
}
Activity