-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add `brili` test cases, since I want to test that no undefined varaibles are used during execution after `from_ssa`.
- Loading branch information
Showing
17 changed files
with
127 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# ARGS: 3 | ||
@main(a: int) { | ||
cond: bool = const true; | ||
br cond .here .there; | ||
.here: | ||
a: int = const 5; | ||
.there: | ||
print a; | ||
} |
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 @@ | ||
5 |
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,14 @@ | ||
@main() { | ||
cond: bool = const true; | ||
br cond .true .false; | ||
.true: | ||
a: int = const 0; | ||
jmp .zexit; | ||
.false: | ||
b: int = const 1; | ||
jmp .zexit; | ||
# zexit to trigger a bug in to_ssa.py that depends on | ||
# the order that basic blocks get renamed. | ||
.zexit: | ||
print a; | ||
} |
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 @@ | ||
0 |
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,17 @@ | ||
# ARGS: true | ||
@main(cond: bool) { | ||
.entry: | ||
a.1: int = const 47; | ||
br cond .left .right; | ||
.left: | ||
a.2: int = add a.1 a.1; | ||
jmp .zexit; | ||
.right: | ||
a.3: int = mul a.1 a.1; | ||
jmp .zexit; | ||
# zexit to trigger a bug in to_ssa.py that depends on | ||
# the order that basic blocks get renamed. | ||
.zexit: | ||
a.4: int = phi .left a.2 .right a.3; | ||
print a.4; | ||
} |
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 @@ | ||
94 |
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,14 @@ | ||
# ARGS: false | ||
@main(cond: bool) { | ||
.entry: | ||
a: int = const 47; | ||
br cond .left .right; | ||
.left: | ||
a: int = add a a; | ||
jmp .exit; | ||
.right: | ||
a: int = mul a a; | ||
jmp .exit; | ||
.exit: | ||
print a; | ||
} |
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 @@ | ||
2209 |
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,24 @@ | ||
@func(): int { | ||
n: int = const 5; | ||
ret n; | ||
} | ||
|
||
@loop(infinite: bool, print: bool) { | ||
.entry: | ||
.loop.header: | ||
br infinite .loop.body .loop.end; | ||
.loop.body: | ||
br print .loop.print .loop.next; | ||
.loop.print: | ||
v: int = call @func; | ||
print v; | ||
.loop.next: | ||
jmp .loop.header; | ||
.loop.end: | ||
} | ||
|
||
@main() { | ||
infinite: bool = const false; | ||
print: bool = const true; | ||
call @loop infinite print; | ||
} |
Empty file.
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,14 @@ | ||
@main { | ||
.entry: | ||
i: int = const 1; | ||
jmp .loop; | ||
.loop: | ||
max: int = const 10; | ||
cond: bool = lt i max; | ||
br cond .body .exit; | ||
.body: | ||
i: int = add i i; | ||
jmp .loop; | ||
.exit: | ||
print i; | ||
} |
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 @@ | ||
16 |
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,14 @@ | ||
@main { | ||
.entry: | ||
one: int = const 1; | ||
zero: int = const 0; | ||
x: int = const 5; | ||
.loop: | ||
x: int = sub x one; | ||
done: bool = eq x zero; | ||
.br: | ||
br done .exit .loop; | ||
.exit: | ||
print x; | ||
ret; | ||
} |
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 @@ | ||
0 |
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 @@ | ||
command = "bril2json < {filename} | python ../../to_ssa.py | python ../../from_ssa.py | brili {args}" |
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,13 @@ | ||
# ARGS: 5 | ||
@main(a: int) { | ||
.while.cond: | ||
zero: int = const 0; | ||
is_term: bool = eq a zero; | ||
br is_term .while.finish .while.body; | ||
.while.body: | ||
one: int = const 1; | ||
a: int = sub a one; | ||
jmp .while.cond; | ||
.while.finish: | ||
print a; | ||
} |
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 @@ | ||
0 |