-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. [RESOURCE]::add cfg optimized examples
- Loading branch information
Showing
4 changed files
with
149 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,11 @@ | ||
```mermaid | ||
graph TD | ||
subgraph L0 | ||
Q0[".def dec1: args=1 ,locals=1;"] | ||
Q1["t0 = @0;"] | ||
Q2["t1 = 1 ;"] | ||
Q3["t0 SUB t1;"] | ||
Q4["ret;"] | ||
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,59 @@ | ||
```mermaid | ||
graph TD | ||
subgraph L9 | ||
Q0["t0 = 7 ;"] | ||
Q1["jmp L3;"] | ||
end | ||
subgraph L8 | ||
Q2["t0 = 'break' ;"] | ||
Q3["call print(args:1);"] | ||
Q4["t0 = @0;"] | ||
Q5["call dec1(args:1);"] | ||
Q6["@0 = t0;"] | ||
Q7["jmp L4;"] | ||
end | ||
subgraph L7 | ||
Q8["t0 = @0;"] | ||
Q9["call print(args:1);"] | ||
Q10["t0 = @0;"] | ||
Q11["t1 = 7 ;"] | ||
Q12["t0 EQ t1;"] | ||
Q13["jmpIf t0,L9,L8;"] | ||
end | ||
subgraph L6 | ||
Q14["t0 = 0 ;"] | ||
end | ||
subgraph L5 | ||
Q15["t0 = @0;"] | ||
Q16["t1 = 5 ;"] | ||
Q17["t0 GT t1;"] | ||
Q18["jmpIf t0,L7,L8;"] | ||
end | ||
subgraph L4 | ||
Q19["t0 = @0;"] | ||
Q20["t1 = 0 ;"] | ||
Q21["t0 GT t1;"] | ||
Q22["jmpIf t0,L5,L6;"] | ||
end | ||
subgraph L3 | ||
Q23["halt;"] | ||
end | ||
subgraph L2 | ||
Q24[".def main: args=0 ,locals=1;"] | ||
Q25["t0 = 10 ;"] | ||
Q26["@0 = t0;"] | ||
end | ||
L2 --> L4 | ||
L4 --> L6 | ||
L4 --> L5 | ||
L5 --> L8 | ||
L5 --> L7 | ||
L7 --> L8 | ||
L7 --> L9 | ||
L9 --> L3 | ||
L9 --> L8 | ||
L8 --> L4 | ||
L8 --> L6 | ||
L6 --> L3 | ||
``` |
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 @@ | ||
```mermaid | ||
graph TD | ||
subgraph L1 | ||
Q0["ret;"] | ||
end | ||
subgraph L0 | ||
Q1[".def dec1: args=1 ,locals=1;"] | ||
Q2["t0 = @0;"] | ||
Q3["t1 = 1 ;"] | ||
Q4["t0 SUB t1;"] | ||
Q5["jmp L1;"] | ||
end | ||
L0 --> L1 | ||
L0 --> L1 | ||
``` |
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,63 @@ | ||
```mermaid | ||
graph TD | ||
subgraph L9 | ||
Q0["t0 = 7 ;"] | ||
Q1["jmp L3;"] | ||
end | ||
subgraph L8 | ||
Q2["t0 = 'break' ;"] | ||
Q3["call print(args:1);"] | ||
Q4["t0 = @0;"] | ||
Q5["call dec1(args:1);"] | ||
Q6["@0 = t0;"] | ||
Q7["jmp L4;"] | ||
end | ||
subgraph L7 | ||
Q8["t0 = @0;"] | ||
Q9["call print(args:1);"] | ||
Q10["t0 = @0;"] | ||
Q11["t1 = 7 ;"] | ||
Q12["t0 EQ t1;"] | ||
Q13["jmpIf t0,L9,L8;"] | ||
end | ||
subgraph L6 | ||
Q14["t0 = 0 ;"] | ||
Q15["jmp L3;"] | ||
end | ||
subgraph L5 | ||
Q16["t0 = @0;"] | ||
Q17["t1 = 5 ;"] | ||
Q18["t0 GT t1;"] | ||
Q19["jmpIf t0,L7,L8;"] | ||
end | ||
subgraph L4 | ||
Q20["t0 = @0;"] | ||
Q21["t1 = 0 ;"] | ||
Q22["t0 GT t1;"] | ||
Q23["jmpIf t0,L5,L6;"] | ||
end | ||
subgraph L3 | ||
Q24["halt;"] | ||
end | ||
subgraph L2 | ||
Q25[".def main: args=0 ,locals=1;"] | ||
Q26["t0 = 10 ;"] | ||
Q27["@0 = t0;"] | ||
Q28["jmp L4;"] | ||
end | ||
L2 --> L4 | ||
L2 --> L4 | ||
L4 --> L6 | ||
L4 --> L5 | ||
L5 --> L8 | ||
L5 --> L7 | ||
L7 --> L8 | ||
L7 --> L9 | ||
L9 --> L3 | ||
L9 --> L8 | ||
L8 --> L4 | ||
L8 --> L6 | ||
L6 --> L3 | ||
L6 --> L3 | ||
``` |