tests update

This commit is contained in:
Scarlett
2025-05-06 22:35:26 -04:00
parent 6e34758ac9
commit 5a01cb8419
49 changed files with 442 additions and 291 deletions

1
tests/given/README.MD Normal file
View File

@ -0,0 +1 @@
NOTE: slightly modified from originals, please execute with care. :)

View File

@ -0,0 +1,3 @@
001: #include "alpha.h"
002: #include "alpha.h"
003: #include "alpha.h"

View File

@ -0,0 +1,6 @@
1 1 901 "#include"
1 10 304 ""alpha.h""
2 1 901 "#include"
2 10 304 ""alpha.h""
3 1 901 "#include"
3 10 304 ""alpha.h""

View File

@ -23,6 +23,9 @@ arg : 025000 : 001001 : string
result : 025000 : 001001 : integer : Primitive Instance
w : 025000 : 001001 : rec : Record Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
r : 021000 : 001001 : integer : Primitive Instance
s : 021000 : 001001 : integer : Primitive Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:

View File

@ -26,6 +26,9 @@ result : 068000 : 001001 : integer
w : 068000 : 001001 : rec : Record Instance
li : 068000 : 001001 : llnode : Record Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
r : 053000 : 001001 : integer : Primitive Instance
s : 053000 : 001001 : integer : Primitive Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:

View File

@ -26,6 +26,10 @@ result : 069000 : 001001 : integer
w : 069000 : 001001 : rec : Record Instance
li : 069000 : 001001 : llnode : Record Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
r : 054000 : 001001 : integer : Primitive Instance
s : 054000 : 001001 : integer : Primitive Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:

View File

@ -14,3 +14,11 @@ a_of_s : 001001 : : 1 -> string
one_name : 006000 : 001001 : string : Array Instance
another_name : 006000 : 001001 : string : Array Instance
many_names : 006000 : 001001 : a_of_s : Array Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
------------------------------:--------:--------:-----------------------------------:-----------------------------------:

View File

@ -9,5 +9,13 @@ reserve type : 001001 : : integer -> address
reserve : 001001 : : reserve type : Function not defined before runtime
release type : 001001 : : address -> integer : Type of Function
release : 001001 : : release type : Function not defined before runtime
main : 001001 : : string -> integer : Type of Function
entry : 001001 : : main : Function Definition that starts at line 7
rec : 001001 : : Record Type : elements-2 size-8 bytes
T2 : 001001 : : rec -> integer : Type of Function
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
: 000000 : 001001 : : Empty Scope
arg : 007000 : 001001 : string : Array Instance
w : 007000 : 001001 : rec : Record Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
x : 004000 : 001001 : integer : Primitive Instance
y : 004000 : 001001 : integer : Primitive Instance

View File

@ -1,5 +1,5 @@
(* TEST: [-st] *)
ype main: string -> integer
type main: string -> integer
function entry: main
type rec: [integer: x; integer: y]

View File

@ -57,26 +57,26 @@
LINE (28:2) ** TYPE ERROR: Undefined variable b
029: b := 1 | b;
LINE (29:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (29:12) ** TYPE ERROR: Object $t9 of type integer and Object undefined of type undefined must both be Boolean
LINE (29:12) ** TYPE ERROR: Object $t11 of type integer and Object undefined of type undefined must both be Boolean
LINE (29:11) ** TYPE ERROR: Undefined variable b
LINE (29:2) ** TYPE ERROR: Undefined variable b
030: b := b | 1;
LINE (30:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (30:12) ** TYPE ERROR: Object undefined of type undefined and Object $t10 of type integer must both be Boolean
LINE (30:12) ** TYPE ERROR: Object undefined of type undefined and Object $t13 of type integer must both be Boolean
LINE (30:7) ** TYPE ERROR: Undefined variable b
LINE (30:2) ** TYPE ERROR: Undefined variable b
031: b := b & 1;
LINE (31:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (31:12) ** TYPE ERROR: Object undefined of type undefined and Object $t11 of type integer must both be Boolean
LINE (31:12) ** TYPE ERROR: Object undefined of type undefined and Object $t15 of type integer must both be Boolean
LINE (31:7) ** TYPE ERROR: Undefined variable b
LINE (31:2) ** TYPE ERROR: Undefined variable b
032: b := 1 & b;
LINE (32:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (32:12) ** TYPE ERROR: Object $t12 of type integer and Object undefined of type undefined must both be Boolean
LINE (32:12) ** TYPE ERROR: Object $t17 of type integer and Object undefined of type undefined must both be Boolean
LINE (32:11) ** TYPE ERROR: Undefined variable b
LINE (32:2) ** TYPE ERROR: Undefined variable b
033: b := 1 = 1;
LINE (33:12) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t15 of type Boolean
LINE (33:12) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t21 of type Boolean
LINE (33:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (33:2) ** TYPE ERROR: Undefined variable b
034:
@ -84,7 +84,7 @@
036:
037: b := 1 = b;
LINE (37:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (37:12) ** TYPE ERROR: Object $t16 of type integer and Object undefined of type undefined must both be the same type
LINE (37:12) ** TYPE ERROR: Object $t22 of type integer and Object undefined of type undefined must both be the same type
LINE (37:11) ** TYPE ERROR: Undefined variable b
LINE (37:2) ** TYPE ERROR: Undefined variable b
038:

View File

@ -0,0 +1,10 @@
001: type main: string -> integer
002: function entry: main
003: type t: 3 -> integer
004:
005:
006: entry (arg) := {
007: [ t:a]
008: a := reserve a(1, 3, 4);
009: return 0;
010: }

View File

@ -10,8 +10,8 @@
LINE (8:18) ** TYPE ERROR: Object arr of type address and Object $t2 of type integer must both be the same type
009: b1 := 6<7 & arr2=7;
LINE (9:23) ** TYPE ERROR: Assignable Assign Expression - Object b1 of type Boolean != Object undefined of type undefined
LINE (9:23) ** TYPE ERROR: Object $t5 of type Boolean and Object undefined of type undefined must both be Boolean
LINE (9:23) ** TYPE ERROR: Object arr2 of type address and Object $t6 of type integer must both be the same type
LINE (9:23) ** TYPE ERROR: Object $t6 of type Boolean and Object undefined of type undefined must both be Boolean
LINE (9:23) ** TYPE ERROR: Object arr2 of type address and Object $t7 of type integer must both be the same type
010:
011: return 0;
012: }

View File

@ -11,20 +11,17 @@
011:
012: one_name := "a string literal";
013: another_name := reserve another_name(4); (* reserve space for an an array of character, with 4 members *)
LINE (13:44) ** TYPE ERROR: Assignable Assign Expression - Object another_name of type string != Object undefined of type undefined
014: another_name(0) := 'C';
015: another_name(1) := 'a';
016: another_name(2) := 'r';
017: another_name(3) := 'l';
018: many_names := reserve many_names(3);
LINE (18:40) ** TYPE ERROR: Assignable Assign Expression - Object many_names of type a_of_s != Object undefined of type undefined
019: many_names(0) := one_name;
020: many_names(1) := another_name;
021: many_names(2) := reserve many_names(2)(6); (* reserve space for an item of the same type as a_of_s(2), an array of character, with 6 members *)
LINE (21:45) ** SYNTAX ERROR: Incorrect syntax at token ')'
LINE (21:44) ** SYNTAX ERROR: Incorrect syntax at token '6'
LINE (21:43) ** SYNTAX ERROR: Incorrect syntax at token '('
LINE (21:43) ** TYPE ERROR: Assignable Assign Expression - Object $t20 of type string != Object undefined of type undefined
022: many_names(2)(0) := 'P';
023: many_names(2)(1) := 'a';
024: many_names(2)(2) := 'r';

View File

@ -11,15 +11,12 @@
011: }
012:
013: entry (arg) := {
014: [ integer: result ; rec: w]
015: if ( result = result ) then {
016: if ( result < w.y ) then {
017: result := 8;
018: } else {
019: result := 9;
020: }(* *)
021: } else {
022: result := bar('c', 7);
023: }
024: return 0;
025: }
014: [ integer: r ; integer: s; Boolean: x]
015: (* x := (r < s) & x; *)
016: if ( ( r < s ) & (s = r) ) then {
017: r := 5;
018: } else {
019: r := 7;
020: }
021: return 0;
022: }

View File

@ -0,0 +1,25 @@
001: type rec: [character: x; integer: y]
002:
003: type T2: rec -> integer
004:
005: type main: string -> integer
006: function entry: main
007: function bar: T2
008:
009: bar (r,s) := {
010: return 0;
011: }
012:
013: entry (arg) := {
014: [ integer: x ; integer: y; integer: z;integer: t]
015:
016: if ( (x = y) < ( z = t ) ) then {
017: if ( (x < y) = ( z < t ) ) then {
018: x := x;
019: } else {
020: x := 1; (* bar('c', 7); *)
021: }
022: } else {
023: return 0;
024: }
025: }

View File

@ -0,0 +1,31 @@
001: type rec: [character: x; integer: y]
002:
003: type T2: rec -> integer
004:
005: type main: string -> integer
006: function entry: main
007: function bar: T2
008:
009: (*
010: bar (r,s) := {
011: return 0;
012: }
013:
014: *)
015: entry (arg) := {
016: [ Boolean:x ; Boolean:y ; Boolean:z ; Boolean:t]
017: if ( ( x & y ) ) then {
018:
019: (*
020: if ( x<y & !(x=y) ) then {
021: t := 8;
022: } else {
023: }
024: *)
025:
026: z := x < y;
027: } else {
028: y := true; (* bar('c', 7); *)
029: }
030: return 0;
031: }

View File

@ -0,0 +1,34 @@
001: type rec: [character: x; integer: y]
002:
003: type T2: rec -> integer
004:
005: type main: string -> integer
006: function entry: main
007: function bar: T2
008:
009: bar (r,s) := {
010: return 0;
011: }
012:
013: entry (arg) := {
014: [ Boolean:x ; Boolean:y ; Boolean:z ; Boolean:t]
015: (* if ( y & (z | t) ) then { *)
016: if ( ( x = y ) & ( z < t ) ) then {
017: (* y := z < t; *)
018: t:= 0;
019: } else {
020: (* t := z = t; *)
021: z := 1;
022: }
023: (*
024: if ( x & y ) then {
025: t := true;
026: } else {
027: y := true;
028: }
029: *)
030: (* } else { *)
031: (* } *)
032: (* x := x & y; *)
033: return 0;
034: }

View File

@ -0,0 +1,29 @@
001: type rec: [character: x; integer: y]
002:
003: type T2: rec -> integer
004:
005: type main: string -> integer
006: function entry: main
007: function bar: T2
008:
009: bar (r,s) := {
010: return 0;
011: }
012:
013: entry (arg) := {
014: [ Boolean: x ; Boolean: y; Boolean: z;Boolean: t]
015: while ( ((x = y)) < ( z | t ) ) {
016: while ( (x & y) = ( z < t ) ) {
017: y := y;
018: }
019: (*
020: x := x;
021: *)
022: if ( (x = y) = ( z < t ) ) then {
023: x := 1;
024: } else {
025: x := 1;
026: }
027: }
028: return 0;
029: }

View File

@ -0,0 +1,27 @@
001: type rec: [character: x; integer: y]
002:
003: type T2: rec -> integer
004:
005: type main: string -> integer
006: function entry: main
007: function bar: T2
008:
009: bar (r,s) := {
010: return 0;
011: }
012:
013: entry (arg) := {
014: [ Boolean:x ; Boolean:y ; Boolean:z ; Boolean:t]
015: while ( ( x | y ) (* | ( z | t ) *) ) {
016: (*
017: if ( ( x < y ) & ( z = t ) ) then {
018: y := z < t;
019: } else {
020: t := z = t;
021: }
022: *)
023: y := t < z; (* bar('c', 7); *)
024: }
025: (* x := x & y; *)
026: return 0;
027: }

View File

@ -1,4 +1,4 @@
(* TEST: [-asc -tc] *)
type main: string -> integer
function entry: main
type t: 3 -> integer

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type rec: [character: x; integer: y]
type T2: rec -> integer

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type rec: [character: x; integer: y]
type T2: rec -> integer

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type rec: [character: x; integer: y]
type T2: rec -> integer

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type rec: [character: x; integer: y]
type T2: rec -> integer

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type rec: [character: x; integer: y]
type T2: rec -> integer

View File

@ -1,16 +1,12 @@
1: func_dec : entry
2: func : entry
3: $t0 = 1
4: Label : 1
5: y = $t0
6: $t1 = 3
7: Label : 2
8: x = $t1
9: $t2 = x + y
10: Label : 3
11: y = $t2
12: param y
13: call : printInteger 1
14: Label : 4
15: result = $t3
16: return : y
4: y = $t0
5: $t1 = 3
6: x = $t1
7: $t2 = x + y
8: y = $t2
9: param y
10: call : printInteger 1
11: result = $t3
12: return : y

View File

@ -2,27 +2,23 @@
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $400, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $1, -12(%rbp) #constant assign
.L1:
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl $3, -20(%rbp) #constant assign
.L2:
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -24(%rbp), %eax #addition start
addl -16(%rbp), %eax
movl %eax, -28(%rbp) #addition end
.L3:
movl -28(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl -16(%rbp), %edi #adding param start
call printInteger
movl %eax, -32(%rbp) #store return from call
.L4:
movl -32(%rbp), %eax #assign start
movl %eax, -36(%rbp) #assign end
movl -16(%rbp), %eax #return y

View File

@ -35,26 +35,26 @@
035:
036: function entry: string2integer
037:
038:
039: type rec: [integer: x; integer: y; integer: z; integer: a; integer: b; integer: c; integer: d]
040: type T2: rec -> integer
041: type T: integer -> integer
042: function bar: T2
043: function ahh: T
044:
045: ahh (a) := {
046: a := printInteger(a);
047: return -1;
048: }
049:
050: bar (a, b, c,d,e,f,g) := {
051: a := printInteger(g);
052: return b;
053: }
054:
055: entry (arg) := {
056: [integer:x; integer:y; integer: result]
057:
038: type rec: [integer: x; integer: y; integer: z; integer: a; integer: b; integer: c; integer: d]
039: type T2: rec -> integer
040: type T: integer -> integer
041: function bar: T2
042: function ahh: T
043:
044: ahh (a) := {
045: a := printInteger(a);
046: return -1;
047: }
048:
049: bar (a, b, c,d,e,f,g) := {
050: a := printInteger(g);
051: return b;
052: }
053:
054: entry (arg) := {
055: [integer:x; integer:y; integer: result; character: a]
056: a := 'a';
057: x := printCharacter(a);
058: result := bar(1,2,3,4,5,6,7);
059: return 1;
060: }

View File

@ -4,34 +4,36 @@
4: func : ahh
5: param a
6: call : printInteger 1
7: Label : 1
8: a = $t0
9: $t1 = 1
10: $t2 = -$t1
11: return : $t2
12: func : bar
13: param g
14: call : printInteger 1
15: Label : 2
16: a = $t3
17: return : b
18: func : entry
19: $t4 = 1
20: $t5 = 2
21: $t6 = 3
22: $t7 = 4
23: $t8 = 5
24: $t9 = 6
25: $t10 = 7
26: param $t10
27: param $t9
28: param $t8
29: param $t7
30: param $t6
31: param $t5
32: param $t4
33: call : bar 7
34: Label : 3
35: result = $t11
36: $t12 = 1
37: return : $t12
7: a = $t0
8: $t1 = 1
9: $t2 = -$t1
10: return : $t2
11: func : bar
12: param g
13: call : printInteger 1
14: a = $t3
15: return : b
16: func : entry
17: $t4 = a
18: a = $t4
19: param a
20: call : printCharacter 1
21: x = $t5
22: $t6 = 1
23: $t7 = 2
24: $t8 = 3
25: $t9 = 4
26: $t10 = 5
27: $t11 = 6
28: $t12 = 7
29: param $t12
30: param $t11
31: param $t10
32: param $t9
33: param $t8
34: param $t7
35: param $t6
36: call : bar 7
37: result = $t13
38: $t14 = 1
39: return : $t14

View File

@ -2,12 +2,11 @@
ahh:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $576, %rsp
movl %edi, -4(%rbp) #FunctionStart1param end
movl -4(%rbp), %edi #adding param start
call printInteger
movl %eax, -8(%rbp) #store return from call
.L1:
movl -8(%rbp), %eax #assign start
movl %eax, -4(%rbp) #assign end
movl $1, -12(%rbp) #constant assign
@ -20,7 +19,7 @@ ahh:
bar:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $576, %rsp
movl 20(%rbp), %eax #FunctionStart1Param start
movl %eax, -4(%rbp) #FunctionStart1param end
movl %r9d, -12(%rbp) #FunctionStart1param end
@ -32,7 +31,6 @@ bar:
movl -32(%rbp), %edi #adding param start
call printInteger
movl %eax, -36(%rbp) #store return from call
.L2:
movl -36(%rbp), %eax #assign start
movl %eax, -4(%rbp) #assign end
movl -12(%rbp), %eax #return b
@ -41,29 +39,36 @@ bar:
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $1, -12(%rbp) #constant assign
movl $2, -16(%rbp) #constant assign
movl $3, -20(%rbp) #constant assign
movl $4, -24(%rbp) #constant assign
movl $5, -28(%rbp) #constant assign
movl $6, -32(%rbp) #constant assign
movl $7, -36(%rbp) #constant assign
movl -36(%rbp), %edi #adding param start
movl -32(%rbp), %esi #adding param start
movl -28(%rbp), %edx #adding param start
movl -24(%rbp), %ecx #adding param start
movl -20(%rbp), %r8d #adding param start
movl -16(%rbp), %r9d #adding param start
movl -12(%rbp), %eax #adding param start
movl %eax, 88(%rbp) #adding param end
subq $576, %rsp
movl %edi, -12(%rbp) #FunctionStart1param end
movl $97, -13(%rbp) #constant assign
movl -13(%rbp), %eax #assign start
movl %eax, -14(%rbp) #assign end
movl -14(%rbp), %edi #adding param start
call printCharacter
movl %eax, -20(%rbp) #store return from call
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl $1, -28(%rbp) #constant assign
movl $2, -32(%rbp) #constant assign
movl $3, -36(%rbp) #constant assign
movl $4, -40(%rbp) #constant assign
movl $5, -44(%rbp) #constant assign
movl $6, -48(%rbp) #constant assign
movl $7, -52(%rbp) #constant assign
movl -52(%rbp), %edi #adding param start
movl -48(%rbp), %esi #adding param start
movl -44(%rbp), %edx #adding param start
movl -40(%rbp), %ecx #adding param start
movl -36(%rbp), %r8d #adding param start
movl -32(%rbp), %r9d #adding param start
movl -28(%rbp), %eax #adding param start
movl %eax, 152(%rbp) #adding param end
call bar
movl %eax, -44(%rbp) #store return from call
.L3:
movl -44(%rbp), %eax #assign start
movl %eax, -48(%rbp) #assign end
movl $1, -52(%rbp) #constant assign
movl -52(%rbp), %eax #return $t12
movl %eax, -60(%rbp) #store return from call
movl -60(%rbp), %eax #assign start
movl %eax, -64(%rbp) #assign end
movl $1, -68(%rbp) #constant assign
movl -68(%rbp), %eax #return $t14
leave
ret

View File

@ -1,16 +1,12 @@
1: func_dec : entry
2: func : entry
3: $t0 = 24
4: Label : 1
5: x = $t0
6: $t1 = 3
7: Label : 2
8: y = $t1
9: $t2 = x / y
10: Label : 3
11: y = $t2
12: param y
13: call : printInteger 1
14: Label : 4
15: result = $t3
16: return : y
4: x = $t0
5: $t1 = 3
6: y = $t1
7: $t2 = x / y
8: y = $t2
9: param y
10: call : printInteger 1
11: result = $t3
12: return : y

View File

@ -2,27 +2,23 @@
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $400, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $24, -12(%rbp) #constant assign
.L1:
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl $3, -20(%rbp) #constant assign
.L2:
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -16(%rbp), %eax #division start
cltd
idivl -24(%rbp)
movl %eax, -28(%rbp) #division end
.L3:
movl -28(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -24(%rbp), %edi #adding param start
call printInteger
movl %eax, -32(%rbp) #store return from call
.L4:
movl -32(%rbp), %eax #assign start
movl %eax, -36(%rbp) #assign end
movl -24(%rbp), %eax #return y

View File

@ -1,17 +1,16 @@
1: func_dec : entry
2: func : entry
3: $t0 = 1
4: Label : 1
5: x = $t0
6: $t1 = 2
7: Label : 2
8: y = $t1
9: $t2 = x == y
10: Label : 3
4: x = $t0
5: $t1 = 2
6: y = $t1
7: $t2 = x == y
8: if $t2 True GOTO 1
9: GOTO : 1
10: Label : 1
11: b = $t2
12: param b
13: call : printBoolean 1
14: Label : 4
15: result = $t3
16: $t4 = 1
17: return : $t4
14: result = $t3
15: $t4 = 1
16: return : $t4

View File

@ -2,30 +2,31 @@
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $416, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $1, -12(%rbp) #constant assign
.L1:
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl $2, -20(%rbp) #constant assign
.L2:
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -16(%rbp), %eax #equal to start
cmpl -24(%rbp), %eax
sete %al
movb $0, -25(%rbp)
movb %al, -25(%rbp) #equal to end
.L3:
cmpb $0, -25(%rbp) #if true start
jne .L1 #if true end
jmp .L1
.L1:
movl -25(%rbp), %eax #assign start
movl %eax, -26(%rbp) #assign end
movl -26(%rbp), %edi #adding param start
call printBoolean
movl %eax, -30(%rbp) #store return from call
.L4:
movl -30(%rbp), %eax #assign start
movl %eax, -34(%rbp) #assign end
movl $1, -38(%rbp) #constant assign
movl -38(%rbp), %eax #return $t4
movl %eax, -32(%rbp) #store return from call
movl -32(%rbp), %eax #assign start
movl %eax, -36(%rbp) #assign end
movl $1, -40(%rbp) #constant assign
movl -40(%rbp), %eax #return $t4
leave
ret

View File

@ -1,17 +1,16 @@
1: func_dec : entry
2: func : entry
3: $t0 = 1
4: Label : 1
5: x = $t0
6: $t1 = 2
7: Label : 2
8: y = $t1
9: $t2 = x < y
10: Label : 3
4: x = $t0
5: $t1 = 2
6: y = $t1
7: $t2 = x < y
8: if $t2 True GOTO 1
9: GOTO : 1
10: Label : 1
11: b = $t2
12: param b
13: call : printBoolean 1
14: Label : 4
15: result = $t3
16: $t4 = 1
17: return : $t4
14: result = $t3
15: $t4 = 1
16: return : $t4

View File

@ -2,30 +2,30 @@
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $416, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $1, -12(%rbp) #constant assign
.L1:
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl $2, -20(%rbp) #constant assign
.L2:
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -16(%rbp), %eax #less than start
cmpl -24(%rbp), %eax
setl %al
movb %al, -25(%rbp) #less than end
.L3:
cmpb $0, -25(%rbp) #if true start
jne .L1 #if true end
jmp .L1
.L1:
movl -25(%rbp), %eax #assign start
movl %eax, -26(%rbp) #assign end
movl -26(%rbp), %edi #adding param start
call printBoolean
movl %eax, -30(%rbp) #store return from call
.L4:
movl -30(%rbp), %eax #assign start
movl %eax, -34(%rbp) #assign end
movl $1, -38(%rbp) #constant assign
movl -38(%rbp), %eax #return $t4
movl %eax, -32(%rbp) #store return from call
movl -32(%rbp), %eax #assign start
movl %eax, -36(%rbp) #assign end
movl $1, -40(%rbp) #constant assign
movl -40(%rbp), %eax #return $t4
leave
ret

View File

@ -1,16 +1,12 @@
1: func_dec : entry
2: func : entry
3: $t0 = 4
4: Label : 1
5: x = $t0
6: $t1 = 20
7: Label : 2
8: y = $t1
9: $t2 = y % x
10: Label : 3
11: y = $t2
12: param y
13: call : printInteger 1
14: Label : 4
15: result = $t3
16: return : y
4: x = $t0
5: $t1 = 20
6: y = $t1
7: $t2 = y % x
8: y = $t2
9: param y
10: call : printInteger 1
11: result = $t3
12: return : y

View File

@ -2,27 +2,23 @@
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $400, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $4, -12(%rbp) #constant assign
.L1:
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl $20, -20(%rbp) #constant assign
.L2:
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -24(%rbp), %eax #mod start
cltd
idivl -16(%rbp)
movl %edx, -28(%rbp) #mod end
.L3:
movl -28(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -24(%rbp), %edi #adding param start
call printInteger
movl %eax, -32(%rbp) #store return from call
.L4:
movl -32(%rbp), %eax #assign start
movl %eax, -36(%rbp) #assign end
movl -24(%rbp), %eax #return y

View File

@ -1,16 +1,12 @@
1: func_dec : entry
2: func : entry
3: $t0 = 3
4: Label : 1
5: x = $t0
6: $t1 = 20
7: Label : 2
8: y = $t1
9: $t2 = x * y
10: Label : 3
11: y = $t2
12: param y
13: call : printInteger 1
14: Label : 4
15: result = $t3
16: return : y
4: x = $t0
5: $t1 = 20
6: y = $t1
7: $t2 = x * y
8: y = $t2
9: param y
10: call : printInteger 1
11: result = $t3
12: return : y

View File

@ -2,26 +2,22 @@
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $400, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $3, -12(%rbp) #constant assign
.L1:
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl $20, -20(%rbp) #constant assign
.L2:
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -16(%rbp), %eax #multiplication start
imull -24(%rbp), %eax
movl %eax, -28(%rbp) #multiplication end
.L3:
movl -28(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -24(%rbp), %edi #adding param start
call printInteger
movl %eax, -32(%rbp) #store return from call
.L4:
movl -32(%rbp), %eax #assign start
movl %eax, -36(%rbp) #assign end
movl -24(%rbp), %eax #return y

View File

@ -1,13 +1,10 @@
1: func_dec : entry
2: func : entry
3: $t0 = 3
4: Label : 1
5: x = $t0
6: $t1 = -x
7: Label : 2
8: y = $t1
9: param y
10: call : printInteger 1
11: Label : 3
12: result = $t2
13: return : y
4: x = $t0
5: $t1 = -x
6: y = $t1
7: param y
8: call : printInteger 1
9: result = $t2
10: return : y

View File

@ -2,22 +2,19 @@
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $400, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $3, -12(%rbp) #constant assign
.L1:
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl -16(%rbp), %eax #negation start
negl %eax
movl %eax, -20(%rbp) #negation end
.L2:
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -24(%rbp), %edi #adding param start
call printInteger
movl %eax, -28(%rbp) #store return from call
.L3:
movl -28(%rbp), %eax #assign start
movl %eax, -32(%rbp) #assign end
movl -24(%rbp), %eax #return y

View File

@ -7,7 +7,6 @@
7: d = $t1
8: param d
9: call : printBoolean 1
10: Label : 3
11: result = $t2
12: $t3 = 1
13: return : $t3
10: result = $t2
11: $t3 = 1
12: return : $t3

View File

@ -2,20 +2,19 @@
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $400, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $-1, -9(%rbp) #constant assign
movl $1, -9(%rbp) #constant assign
.L1:
movl -9(%rbp), %eax #assign start
movl %eax, -10(%rbp) #assign end
.L2:
movl -11(%rbp), %edi #adding param start
call printBoolean
movl %eax, -15(%rbp) #store return from call
.L3:
movl -15(%rbp), %eax #assign start
movl %eax, -19(%rbp) #assign end
movl $1, -23(%rbp) #constant assign
movl -23(%rbp), %eax #return $t3
movl %eax, -18(%rbp) #store return from call
movl -18(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl $1, -28(%rbp) #constant assign
movl -28(%rbp), %eax #return $t3
leave
ret

View File

@ -7,18 +7,16 @@
7: Label : 2
8: d = $t1
9: $t2 = true
10: Label : 3
11: if c True GOTO 5
12: GOTO : 4
13: Label : 4
14: if d True GOTO 5
15: $t2 = false
16: GOTO : 5
17: Label : 5
18: d = $t2
19: param d
20: call : printBoolean 1
21: Label : 6
22: result = $t3
23: $t4 = 1
24: return : $t4
10: if c True GOTO 4
11: GOTO : 3
12: Label : 3
13: if d True GOTO 4
14: $t2 = false
15: GOTO : 4
16: Label : 4
17: d = $t2
18: param d
19: call : printBoolean 1
20: result = $t3
21: $t4 = 1
22: return : $t4

View File

@ -2,30 +2,34 @@
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $416, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $-1, -9(%rbp) #constant assign
movl $1, -9(%rbp) #constant assign
.L1:
movl -9(%rbp), %eax #assign start
movl %eax, -10(%rbp) #assign end
movl $-1, -11(%rbp) #constant assign
movl $0, -11(%rbp) #constant assign
.L2:
movl -11(%rbp), %eax #assign start
movl %eax, -12(%rbp) #assign end
movl $-1, -13(%rbp) #constant assign
movl $1, -13(%rbp) #constant assign
cmpb $0, -10(%rbp) #if true start
jne .L4 #if true end
jmp .L3
.L3:
cmpb $0, -12(%rbp) #if true start
jne .L4 #if true end
movl $0, -13(%rbp) #constant assign
jmp .L4
.L4:
movl $-1, -13(%rbp) #constant assign
.L5:
movl -13(%rbp), %eax #assign start
movl %eax, -12(%rbp) #assign end
movl -12(%rbp), %edi #adding param start
call printBoolean
movl %eax, -17(%rbp) #store return from call
.L6:
movl -17(%rbp), %eax #assign start
movl %eax, -21(%rbp) #assign end
movl $1, -25(%rbp) #constant assign
movl -25(%rbp), %eax #return $t4
movl %eax, -18(%rbp) #store return from call
movl -18(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl $1, -28(%rbp) #constant assign
movl -28(%rbp), %eax #return $t4
leave
ret

View File

@ -1,16 +1,12 @@
1: func_dec : entry
2: func : entry
3: $t0 = 1
4: Label : 1
5: y = $t0
6: $t1 = 3
7: Label : 2
8: x = $t1
9: $t2 = x - y
10: Label : 3
11: y = $t2
12: param y
13: call : printInteger 1
14: Label : 4
15: result = $t3
16: return : y
4: y = $t0
5: $t1 = 3
6: x = $t1
7: $t2 = x - y
8: y = $t2
9: param y
10: call : printInteger 1
11: result = $t3
12: return : y

View File

@ -2,26 +2,22 @@
entry:
pushq %rbp
movq %rsp, %rbp
subq $128, %rsp
subq $400, %rsp
movl %edi, -8(%rbp) #FunctionStart1param end
movl $1, -12(%rbp) #constant assign
.L1:
movl -12(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl $3, -20(%rbp) #constant assign
.L2:
movl -20(%rbp), %eax #assign start
movl %eax, -24(%rbp) #assign end
movl -24(%rbp), %eax #subtraction start
subl -16(%rbp), %eax
movl %eax, -28(%rbp) #subtraction end
.L3:
movl -28(%rbp), %eax #assign start
movl %eax, -16(%rbp) #assign end
movl -16(%rbp), %edi #adding param start
call printInteger
movl %eax, -32(%rbp) #store return from call
.L4:
movl -32(%rbp), %eax #assign start
movl %eax, -36(%rbp) #assign end
movl -16(%rbp), %eax #return y