forked from mwillsey/bril
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify brili to properly execute phi instructions
This fixes issue 330: sampsyo#330 The approach (copy the environment at the end of the last basic block) was inspired/copied from the comment on the Bril issue: sampsyo#330 (comment)
- Loading branch information
Showing
3 changed files
with
48 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@main { | ||
i: int = const 5; | ||
one: int = const 1; | ||
zero: int = const 0; | ||
|
||
.l0: | ||
x0: int = const 0; | ||
y0: int = const 1; | ||
jmp .l1; | ||
|
||
.l1: | ||
x1: int = phi .l0 x0 .l1 y1; | ||
y1: int = phi .l0 y0 .l1 x1; | ||
print x1 y1; | ||
|
||
cond: bool = gt i zero; | ||
i: int = sub i one; | ||
br cond .l1 .end; | ||
|
||
.end: | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
0 1 | ||
1 0 | ||
0 1 | ||
1 0 | ||
0 1 | ||
1 0 |