Merge pull request #65 from UB-CSE443/Dev

Dev
This commit is contained in:
Annie Slenker
2025-05-04 16:45:33 -04:00
committed by GitHub
174 changed files with 996 additions and 664 deletions

View File

@ -0,0 +1,10 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [integer:x; integer:y]
006: y := 1;
007: x := 3;
008: y := x + y;
009: return y;
010: }

View File

@ -0,0 +1,8 @@
1: func : test
2: $t0 = 1
3: y = $t0
4: $t1 = 3
5: x = $t1
6: $t2 = x + y
7: y = $t2
8: return : y

View File

@ -0,0 +1,10 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [Boolean:b; Boolean: c; Boolean: d]
006: c := true;
007: d := false;
008: d := c & d;
009: return 1;
010: }

View File

@ -1,20 +0,0 @@
movl $-1, -4(%rbp) #constant assign
movl -4(%rbp), %eax #assign start
movl %eax, -8(%rbp) #assign end
movl $-1, -12(%rbp) #constant assign
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
cmpl $0, -8(%rbp) #start and
je .L1or2
cmpl $0, -16(%rbp)
je .L1or2
movl $1, %eax
jmp .L1or3
.L1or2:
movl $0, %eax
.L1or3:
movb %al, -20(%rbp)
andb $1, -20(%rbp) #and end
movl -20(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl $1, -24(%rbp) #constant assign

View File

@ -0,0 +1,9 @@
1: func : test
2: $t0 = true
3: c = $t0
4: $t1 = false
5: d = $t1
6: $t2 = c & d
7: d = $t2
8: $t3 = 1
9: return : $t3

View File

@ -0,0 +1,20 @@
movl $-1, -1(%rbp) #constant assign
movl -1(%rbp), %eax #assign start
movl %eax, -2(%rbp) #assign end
movl $-1, -3(%rbp) #constant assign
movl -3(%rbp), %eax #assign start
movl %eax, -4(%rbp) #assign end
cmpl $0, -2(%rbp) #start and
je .L1or2
cmpl $0, -4(%rbp)
je .L1or2
movl $1, %eax
jmp .L1or3
.L1or2:
movl $0, %eax
.L1or3:
movb %al, -5(%rbp)
andb $1, -5(%rbp) #and end
movl -5(%rbp), %eax #assign start
movl %eax, -4(%rbp) #assign end
movl $1, -9(%rbp) #constant assign

View File

@ -0,0 +1,10 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [integer:x; integer:y]
006: y := 1;
007: x := 3;
008: y := x / y;
009: return y;
010: }

View File

@ -0,0 +1,8 @@
1: func : test
2: $t0 = 1
3: y = $t0
4: $t1 = 3
5: x = $t1
6: $t2 = x / y
7: y = $t2
8: return : y

View File

@ -0,0 +1,10 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [Boolean: b; integer: x; integer: y]
006: x := 1;
007: y := 2;
008: b := x = y;
009: return 1;
010: }

View File

@ -0,0 +1,10 @@
1: func : test
2: $t0 = 1
3: x = $t0
4: $t1 = 2
5: y = $t1
6: if ( x = y ) GOTO 0
7: GOTO : 0
8: b = $t2
9: $t3 = 1
10: return : $t3

View File

@ -7,7 +7,5 @@
movl -8(%rbp), %eax #equal to start
cmpl -16(%rbp), %eax
sete %al
movb %al, -20(%rbp) #equal to end
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl $1, -28(%rbp) #constant assign
movb %al, -15(%rbp) #equal to end
movl $1, -20(%rbp) #constant assign

View File

@ -0,0 +1,10 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [Boolean: b; integer: x; integer: y]
006: x := 1;
007: y := 2;
008: b := x < y;
009: return 1;
010: }

View File

@ -0,0 +1,10 @@
1: func : test
2: $t0 = 1
3: x = $t0
4: $t1 = 2
5: y = $t1
6: if ( x < y ) GOTO 0
7: GOTO : 0
8: b = $t2
9: $t3 = 1
10: return : $t3

View File

@ -7,7 +7,5 @@
movl -8(%rbp), %eax #less than start
cmpl -16(%rbp), %eax
setl %al
movb %al, -20(%rbp) #less than end
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl $1, -28(%rbp) #constant assign
movb %al, -15(%rbp) #less than end
movl $1, -20(%rbp) #constant assign

View File

@ -0,0 +1,10 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [integer:x; integer:y]
006: y := 1;
007: x := 3;
008: y := x % y;
009: return y;
010: }

View File

@ -0,0 +1,8 @@
1: func : test
2: $t0 = 1
3: y = $t0
4: $t1 = 3
5: x = $t1
6: $t2 = x % y
7: y = $t2
8: return : y

View File

@ -0,0 +1,10 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [integer:x; integer:y]
006: y := 1;
007: x := 3;
008: y := x * x;
009: return y;
010: }

View File

@ -0,0 +1,8 @@
1: func : test
2: $t0 = 1
3: y = $t0
4: $t1 = 3
5: x = $t1
6: $t2 = x * x
7: y = $t2
8: return : y

View File

@ -0,0 +1,9 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [integer:x; integer:y]
006: x := 3;
007: y := -x;
008: return y;
009: }

View File

@ -0,0 +1,6 @@
1: func : test
2: $t0 = 3
3: x = $t0
4: $t1 = -x
5: y = $t1
6: return : y

View File

@ -0,0 +1,9 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [Boolean: c; Boolean: d]
006: c := true;
007: d := !c;
008: return 1;
009: }

View File

@ -1,13 +0,0 @@
movl $-1, -4(%rbp) #constant assign
movl -4(%rbp), %eax #assign start
movl %eax, -8(%rbp) #assign end
movzbl -8(%rbp), %eax #not start
testl %eax, %eax
setne %al
xorl $1, %eax
movzbl %al, %eax
movb %al, -12(%rbp)
andb $1, -12(%rbp) #not end
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl $1, -20(%rbp) #constant assign

View File

@ -0,0 +1,7 @@
1: func : test
2: $t0 = true
3: c = $t0
4: $t1 = !c
5: d = $t1
6: $t2 = 1
7: return : $t2

View File

@ -0,0 +1,13 @@
movl $-1, -1(%rbp) #constant assign
movl -1(%rbp), %eax #assign start
movl %eax, -2(%rbp) #assign end
movzbl -2(%rbp), %eax #not start
testl %eax, %eax
setne %al
xorl $1, %eax
movzbl %al, %eax
movb %al, -3(%rbp)
andb $1, -3(%rbp) #not end
movl -3(%rbp), %eax #assign start
movl %eax, -4(%rbp) #assign end
movl $1, -8(%rbp) #constant assign

View File

@ -0,0 +1,10 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [Boolean:b; Boolean: c; Boolean: d]
006: c := true;
007: d := false;
008: d := c | d;
009: return 1;
010: }

View File

@ -1,21 +0,0 @@
movl $-1, -4(%rbp) #constant assign
movl -4(%rbp), %eax #assign start
movl %eax, -8(%rbp) #assign end
movl $-1, -12(%rbp) #constant assign
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
cmpl $0, -8(%rbp) #start or
jne .L1or2
cmpl $0, -16(%rbp)
je .L1or3
.L1or2:
movl $1, %eax
jmp .L1or4
.L1or3:
movl $0, %eax
.L1or4:
movb %al, -20(%rbp)
andb $1, -20(%rbp) #or end
movl -20(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl $1, -24(%rbp) #constant assign

View File

@ -0,0 +1,9 @@
1: func : test
2: $t0 = true
3: c = $t0
4: $t1 = false
5: d = $t1
6: $t2 = c | d
7: d = $t2
8: $t3 = 1
9: return : $t3

View File

@ -0,0 +1,21 @@
movl $-1, -1(%rbp) #constant assign
movl -1(%rbp), %eax #assign start
movl %eax, -2(%rbp) #assign end
movl $-1, -3(%rbp) #constant assign
movl -3(%rbp), %eax #assign start
movl %eax, -4(%rbp) #assign end
cmpl $0, -2(%rbp) #start or
jne .L1or2
cmpl $0, -4(%rbp)
je .L1or3
.L1or2:
movl $1, %eax
jmp .L1or4
.L1or3:
movl $0, %eax
.L1or4:
movb %al, -5(%rbp)
andb $1, -5(%rbp) #or end
movl -5(%rbp), %eax #assign start
movl %eax, -4(%rbp) #assign end
movl $1, -9(%rbp) #constant assign

View File

@ -0,0 +1,10 @@
001: type main: integer -> integer
002: function test: main
003:
004: test (a) := {
005: [integer:x; integer:y]
006: y := 1;
007: x := 3;
008: y := x - y;
009: return y;
010: }

View File

@ -0,0 +1,8 @@
1: func : test
2: $t0 = 1
3: y = $t0
4: $t1 = 3
5: x = $t1
6: $t2 = x - y
7: y = $t2
8: return : y

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc -cg -ir] *)
type main: integer -> integer
function test: main