tests update
This commit is contained in:
1
tests/given/README.MD
Normal file
1
tests/given/README.MD
Normal file
@ -0,0 +1 @@
|
|||||||
|
NOTE: slightly modified from originals, please execute with care. :)
|
3
tests/sprint1/expected/sp1_include.asc.exp
Normal file
3
tests/sprint1/expected/sp1_include.asc.exp
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
001: #include "alpha.h"
|
||||||
|
002: #include "alpha.h"
|
||||||
|
003: #include "alpha.h"
|
6
tests/sprint1/expected/sp1_include.tok.exp
Normal file
6
tests/sprint1/expected/sp1_include.tok.exp
Normal 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""
|
@ -23,6 +23,9 @@ arg : 025000 : 001001 : string
|
|||||||
result : 025000 : 001001 : integer : Primitive Instance
|
result : 025000 : 001001 : integer : Primitive Instance
|
||||||
w : 025000 : 001001 : rec : Record Instance
|
w : 025000 : 001001 : rec : Record Instance
|
||||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
r : 021000 : 001001 : integer : Primitive Instance
|
r : 021000 : 001001 : integer : Primitive Instance
|
||||||
s : 021000 : 001001 : integer : Primitive Instance
|
s : 021000 : 001001 : integer : Primitive Instance
|
||||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
@ -26,6 +26,9 @@ result : 068000 : 001001 : integer
|
|||||||
w : 068000 : 001001 : rec : Record Instance
|
w : 068000 : 001001 : rec : Record Instance
|
||||||
li : 068000 : 001001 : llnode : Record Instance
|
li : 068000 : 001001 : llnode : Record Instance
|
||||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
r : 053000 : 001001 : integer : Primitive Instance
|
r : 053000 : 001001 : integer : Primitive Instance
|
||||||
s : 053000 : 001001 : integer : Primitive Instance
|
s : 053000 : 001001 : integer : Primitive Instance
|
||||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
@ -26,6 +26,10 @@ result : 069000 : 001001 : integer
|
|||||||
w : 069000 : 001001 : rec : Record Instance
|
w : 069000 : 001001 : rec : Record Instance
|
||||||
li : 069000 : 001001 : llnode : Record Instance
|
li : 069000 : 001001 : llnode : Record Instance
|
||||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
r : 054000 : 001001 : integer : Primitive Instance
|
r : 054000 : 001001 : integer : Primitive Instance
|
||||||
s : 054000 : 001001 : integer : Primitive Instance
|
s : 054000 : 001001 : integer : Primitive Instance
|
||||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
@ -14,3 +14,11 @@ a_of_s : 001001 : : 1 -> string
|
|||||||
one_name : 006000 : 001001 : string : Array Instance
|
one_name : 006000 : 001001 : string : Array Instance
|
||||||
another_name : 006000 : 001001 : string : Array Instance
|
another_name : 006000 : 001001 : string : Array Instance
|
||||||
many_names : 006000 : 001001 : a_of_s : Array Instance
|
many_names : 006000 : 001001 : a_of_s : Array Instance
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||||
|
@ -9,5 +9,13 @@ reserve type : 001001 : : integer -> address
|
|||||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||||
release type : 001001 : : address -> integer : Type of Function
|
release type : 001001 : : address -> integer : Type of Function
|
||||||
release : 001001 : : release type : Function not defined before runtime
|
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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
(* TEST: [-st] *)
|
(* TEST: [-st] *)
|
||||||
ype main: string -> integer
|
type main: string -> integer
|
||||||
function entry: main
|
function entry: main
|
||||||
|
|
||||||
type rec: [integer: x; integer: y]
|
type rec: [integer: x; integer: y]
|
||||||
|
@ -57,26 +57,26 @@
|
|||||||
LINE (28:2) ** TYPE ERROR: Undefined variable b
|
LINE (28:2) ** TYPE ERROR: Undefined variable b
|
||||||
029: b := 1 | b;
|
029: b := 1 | b;
|
||||||
LINE (29:12) ** TYPE ERROR: Invalid type passed to assignable.
|
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:11) ** TYPE ERROR: Undefined variable b
|
||||||
LINE (29:2) ** TYPE ERROR: Undefined variable b
|
LINE (29:2) ** TYPE ERROR: Undefined variable b
|
||||||
030: b := b | 1;
|
030: b := b | 1;
|
||||||
LINE (30:12) ** TYPE ERROR: Invalid type passed to assignable.
|
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:7) ** TYPE ERROR: Undefined variable b
|
||||||
LINE (30:2) ** TYPE ERROR: Undefined variable b
|
LINE (30:2) ** TYPE ERROR: Undefined variable b
|
||||||
031: b := b & 1;
|
031: b := b & 1;
|
||||||
LINE (31:12) ** TYPE ERROR: Invalid type passed to assignable.
|
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:7) ** TYPE ERROR: Undefined variable b
|
||||||
LINE (31:2) ** TYPE ERROR: Undefined variable b
|
LINE (31:2) ** TYPE ERROR: Undefined variable b
|
||||||
032: b := 1 & b;
|
032: b := 1 & b;
|
||||||
LINE (32:12) ** TYPE ERROR: Invalid type passed to assignable.
|
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:11) ** TYPE ERROR: Undefined variable b
|
||||||
LINE (32:2) ** TYPE ERROR: Undefined variable b
|
LINE (32:2) ** TYPE ERROR: Undefined variable b
|
||||||
033: b := 1 = 1;
|
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:12) ** TYPE ERROR: Invalid type passed to assignable.
|
||||||
LINE (33:2) ** TYPE ERROR: Undefined variable b
|
LINE (33:2) ** TYPE ERROR: Undefined variable b
|
||||||
034:
|
034:
|
||||||
@ -84,7 +84,7 @@
|
|||||||
036:
|
036:
|
||||||
037: b := 1 = b;
|
037: b := 1 = b;
|
||||||
LINE (37:12) ** TYPE ERROR: Invalid type passed to assignable.
|
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:11) ** TYPE ERROR: Undefined variable b
|
||||||
LINE (37:2) ** TYPE ERROR: Undefined variable b
|
LINE (37:2) ** TYPE ERROR: Undefined variable b
|
||||||
038:
|
038:
|
||||||
|
10
tests/sprint3/expected/sp3_arr_reserve.asc.exp
Normal file
10
tests/sprint3/expected/sp3_arr_reserve.asc.exp
Normal 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: }
|
@ -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
|
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;
|
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: 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 $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 $t6 of type integer must both be the same type
|
LINE (9:23) ** TYPE ERROR: Object arr2 of type address and Object $t7 of type integer must both be the same type
|
||||||
010:
|
010:
|
||||||
011: return 0;
|
011: return 0;
|
||||||
012: }
|
012: }
|
||||||
|
@ -11,20 +11,17 @@
|
|||||||
011:
|
011:
|
||||||
012: one_name := "a string literal";
|
012: one_name := "a string literal";
|
||||||
013: another_name := reserve another_name(4); (* reserve space for an an array of character, with 4 members *)
|
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';
|
014: another_name(0) := 'C';
|
||||||
015: another_name(1) := 'a';
|
015: another_name(1) := 'a';
|
||||||
016: another_name(2) := 'r';
|
016: another_name(2) := 'r';
|
||||||
017: another_name(3) := 'l';
|
017: another_name(3) := 'l';
|
||||||
018: many_names := reserve many_names(3);
|
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;
|
019: many_names(0) := one_name;
|
||||||
020: many_names(1) := another_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 *)
|
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:45) ** SYNTAX ERROR: Incorrect syntax at token ')'
|
||||||
LINE (21:44) ** SYNTAX ERROR: Incorrect syntax at token '6'
|
LINE (21:44) ** SYNTAX ERROR: Incorrect syntax at token '6'
|
||||||
LINE (21:43) ** SYNTAX ERROR: Incorrect syntax at token '('
|
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';
|
022: many_names(2)(0) := 'P';
|
||||||
023: many_names(2)(1) := 'a';
|
023: many_names(2)(1) := 'a';
|
||||||
024: many_names(2)(2) := 'r';
|
024: many_names(2)(2) := 'r';
|
||||||
|
@ -11,15 +11,12 @@
|
|||||||
011: }
|
011: }
|
||||||
012:
|
012:
|
||||||
013: entry (arg) := {
|
013: entry (arg) := {
|
||||||
014: [ integer: result ; rec: w]
|
014: [ integer: r ; integer: s; Boolean: x]
|
||||||
015: if ( result = result ) then {
|
015: (* x := (r < s) & x; *)
|
||||||
016: if ( result < w.y ) then {
|
016: if ( ( r < s ) & (s = r) ) then {
|
||||||
017: result := 8;
|
017: r := 5;
|
||||||
018: } else {
|
018: } else {
|
||||||
019: result := 9;
|
019: r := 7;
|
||||||
020: }(* *)
|
020: }
|
||||||
021: } else {
|
021: return 0;
|
||||||
022: result := bar('c', 7);
|
022: }
|
||||||
023: }
|
|
||||||
024: return 0;
|
|
||||||
025: }
|
|
||||||
|
25
tests/sprint3/expected/sp3_if_else_nested_exp.asc.exp
Normal file
25
tests/sprint3/expected/sp3_if_else_nested_exp.asc.exp
Normal 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: }
|
31
tests/sprint3/expected/sp3_if_else_sse.asc.exp
Normal file
31
tests/sprint3/expected/sp3_if_else_sse.asc.exp
Normal 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: }
|
34
tests/sprint3/expected/sp3_if_else_sse2.asc.exp
Normal file
34
tests/sprint3/expected/sp3_if_else_sse2.asc.exp
Normal 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: }
|
29
tests/sprint3/expected/sp3_while_nested_bools.asc.exp
Normal file
29
tests/sprint3/expected/sp3_while_nested_bools.asc.exp
Normal 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: }
|
27
tests/sprint3/expected/sp3_while_sse.asc.exp
Normal file
27
tests/sprint3/expected/sp3_while_sse.asc.exp
Normal 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: }
|
@ -1,4 +1,4 @@
|
|||||||
|
(* TEST: [-asc -tc] *)
|
||||||
type main: string -> integer
|
type main: string -> integer
|
||||||
function entry: main
|
function entry: main
|
||||||
type t: 3 -> integer
|
type t: 3 -> integer
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
(* TEST: [-asc -tc] *)
|
||||||
type rec: [character: x; integer: y]
|
type rec: [character: x; integer: y]
|
||||||
|
|
||||||
type T2: rec -> integer
|
type T2: rec -> integer
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
(* TEST: [-asc -tc] *)
|
||||||
type rec: [character: x; integer: y]
|
type rec: [character: x; integer: y]
|
||||||
|
|
||||||
type T2: rec -> integer
|
type T2: rec -> integer
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
(* TEST: [-asc -tc] *)
|
||||||
type rec: [character: x; integer: y]
|
type rec: [character: x; integer: y]
|
||||||
|
|
||||||
type T2: rec -> integer
|
type T2: rec -> integer
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
(* TEST: [-asc -tc] *)
|
||||||
type rec: [character: x; integer: y]
|
type rec: [character: x; integer: y]
|
||||||
|
|
||||||
type T2: rec -> integer
|
type T2: rec -> integer
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
(* TEST: [-asc -tc] *)
|
||||||
type rec: [character: x; integer: y]
|
type rec: [character: x; integer: y]
|
||||||
|
|
||||||
type T2: rec -> integer
|
type T2: rec -> integer
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
1: func_dec : entry
|
1: func_dec : entry
|
||||||
2: func : entry
|
2: func : entry
|
||||||
3: $t0 = 1
|
3: $t0 = 1
|
||||||
4: Label : 1
|
4: y = $t0
|
||||||
5: y = $t0
|
5: $t1 = 3
|
||||||
6: $t1 = 3
|
6: x = $t1
|
||||||
7: Label : 2
|
7: $t2 = x + y
|
||||||
8: x = $t1
|
8: y = $t2
|
||||||
9: $t2 = x + y
|
9: param y
|
||||||
10: Label : 3
|
10: call : printInteger 1
|
||||||
11: y = $t2
|
11: result = $t3
|
||||||
12: param y
|
12: return : y
|
||||||
13: call : printInteger 1
|
|
||||||
14: Label : 4
|
|
||||||
15: result = $t3
|
|
||||||
16: return : y
|
|
||||||
|
@ -2,27 +2,23 @@
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $400, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -8(%rbp) #FunctionStart1param end
|
||||||
movl $1, -12(%rbp) #constant assign
|
movl $1, -12(%rbp) #constant assign
|
||||||
.L1:
|
|
||||||
movl -12(%rbp), %eax #assign start
|
movl -12(%rbp), %eax #assign start
|
||||||
movl %eax, -16(%rbp) #assign end
|
movl %eax, -16(%rbp) #assign end
|
||||||
movl $3, -20(%rbp) #constant assign
|
movl $3, -20(%rbp) #constant assign
|
||||||
.L2:
|
|
||||||
movl -20(%rbp), %eax #assign start
|
movl -20(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
|
|
||||||
movl -24(%rbp), %eax #addition start
|
movl -24(%rbp), %eax #addition start
|
||||||
addl -16(%rbp), %eax
|
addl -16(%rbp), %eax
|
||||||
movl %eax, -28(%rbp) #addition end
|
movl %eax, -28(%rbp) #addition end
|
||||||
.L3:
|
|
||||||
movl -28(%rbp), %eax #assign start
|
movl -28(%rbp), %eax #assign start
|
||||||
movl %eax, -16(%rbp) #assign end
|
movl %eax, -16(%rbp) #assign end
|
||||||
movl -16(%rbp), %edi #adding param start
|
movl -16(%rbp), %edi #adding param start
|
||||||
call printInteger
|
call printInteger
|
||||||
movl %eax, -32(%rbp) #store return from call
|
movl %eax, -32(%rbp) #store return from call
|
||||||
.L4:
|
|
||||||
movl -32(%rbp), %eax #assign start
|
movl -32(%rbp), %eax #assign start
|
||||||
movl %eax, -36(%rbp) #assign end
|
movl %eax, -36(%rbp) #assign end
|
||||||
movl -16(%rbp), %eax #return y
|
movl -16(%rbp), %eax #return y
|
||||||
|
@ -35,26 +35,26 @@
|
|||||||
035:
|
035:
|
||||||
036: function entry: string2integer
|
036: function entry: string2integer
|
||||||
037:
|
037:
|
||||||
038:
|
038: type rec: [integer: x; integer: y; integer: z; integer: a; integer: b; integer: c; integer: d]
|
||||||
039: type rec: [integer: x; integer: y; integer: z; integer: a; integer: b; integer: c; integer: d]
|
039: type T2: rec -> integer
|
||||||
040: type T2: rec -> integer
|
040: type T: integer -> integer
|
||||||
041: type T: integer -> integer
|
041: function bar: T2
|
||||||
042: function bar: T2
|
042: function ahh: T
|
||||||
043: function ahh: T
|
043:
|
||||||
044:
|
044: ahh (a) := {
|
||||||
045: ahh (a) := {
|
045: a := printInteger(a);
|
||||||
046: a := printInteger(a);
|
046: return -1;
|
||||||
047: return -1;
|
047: }
|
||||||
048: }
|
048:
|
||||||
049:
|
049: bar (a, b, c,d,e,f,g) := {
|
||||||
050: bar (a, b, c,d,e,f,g) := {
|
050: a := printInteger(g);
|
||||||
051: a := printInteger(g);
|
051: return b;
|
||||||
052: return b;
|
052: }
|
||||||
053: }
|
053:
|
||||||
054:
|
054: entry (arg) := {
|
||||||
055: entry (arg) := {
|
055: [integer:x; integer:y; integer: result; character: a]
|
||||||
056: [integer:x; integer:y; integer: result]
|
056: a := 'a';
|
||||||
057:
|
057: x := printCharacter(a);
|
||||||
058: result := bar(1,2,3,4,5,6,7);
|
058: result := bar(1,2,3,4,5,6,7);
|
||||||
059: return 1;
|
059: return 1;
|
||||||
060: }
|
060: }
|
||||||
|
@ -4,34 +4,36 @@
|
|||||||
4: func : ahh
|
4: func : ahh
|
||||||
5: param a
|
5: param a
|
||||||
6: call : printInteger 1
|
6: call : printInteger 1
|
||||||
7: Label : 1
|
7: a = $t0
|
||||||
8: a = $t0
|
8: $t1 = 1
|
||||||
9: $t1 = 1
|
9: $t2 = -$t1
|
||||||
10: $t2 = -$t1
|
10: return : $t2
|
||||||
11: return : $t2
|
11: func : bar
|
||||||
12: func : bar
|
12: param g
|
||||||
13: param g
|
13: call : printInteger 1
|
||||||
14: call : printInteger 1
|
14: a = $t3
|
||||||
15: Label : 2
|
15: return : b
|
||||||
16: a = $t3
|
16: func : entry
|
||||||
17: return : b
|
17: $t4 = a
|
||||||
18: func : entry
|
18: a = $t4
|
||||||
19: $t4 = 1
|
19: param a
|
||||||
20: $t5 = 2
|
20: call : printCharacter 1
|
||||||
21: $t6 = 3
|
21: x = $t5
|
||||||
22: $t7 = 4
|
22: $t6 = 1
|
||||||
23: $t8 = 5
|
23: $t7 = 2
|
||||||
24: $t9 = 6
|
24: $t8 = 3
|
||||||
25: $t10 = 7
|
25: $t9 = 4
|
||||||
26: param $t10
|
26: $t10 = 5
|
||||||
27: param $t9
|
27: $t11 = 6
|
||||||
28: param $t8
|
28: $t12 = 7
|
||||||
29: param $t7
|
29: param $t12
|
||||||
30: param $t6
|
30: param $t11
|
||||||
31: param $t5
|
31: param $t10
|
||||||
32: param $t4
|
32: param $t9
|
||||||
33: call : bar 7
|
33: param $t8
|
||||||
34: Label : 3
|
34: param $t7
|
||||||
35: result = $t11
|
35: param $t6
|
||||||
36: $t12 = 1
|
36: call : bar 7
|
||||||
37: return : $t12
|
37: result = $t13
|
||||||
|
38: $t14 = 1
|
||||||
|
39: return : $t14
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
ahh:
|
ahh:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $576, %rsp
|
||||||
movl %edi, -4(%rbp) #FunctionStart1param end
|
movl %edi, -4(%rbp) #FunctionStart1param end
|
||||||
movl -4(%rbp), %edi #adding param start
|
movl -4(%rbp), %edi #adding param start
|
||||||
call printInteger
|
call printInteger
|
||||||
movl %eax, -8(%rbp) #store return from call
|
movl %eax, -8(%rbp) #store return from call
|
||||||
.L1:
|
|
||||||
movl -8(%rbp), %eax #assign start
|
movl -8(%rbp), %eax #assign start
|
||||||
movl %eax, -4(%rbp) #assign end
|
movl %eax, -4(%rbp) #assign end
|
||||||
movl $1, -12(%rbp) #constant assign
|
movl $1, -12(%rbp) #constant assign
|
||||||
@ -20,7 +19,7 @@ ahh:
|
|||||||
bar:
|
bar:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $576, %rsp
|
||||||
movl 20(%rbp), %eax #FunctionStart1Param start
|
movl 20(%rbp), %eax #FunctionStart1Param start
|
||||||
movl %eax, -4(%rbp) #FunctionStart1param end
|
movl %eax, -4(%rbp) #FunctionStart1param end
|
||||||
movl %r9d, -12(%rbp) #FunctionStart1param end
|
movl %r9d, -12(%rbp) #FunctionStart1param end
|
||||||
@ -32,7 +31,6 @@ bar:
|
|||||||
movl -32(%rbp), %edi #adding param start
|
movl -32(%rbp), %edi #adding param start
|
||||||
call printInteger
|
call printInteger
|
||||||
movl %eax, -36(%rbp) #store return from call
|
movl %eax, -36(%rbp) #store return from call
|
||||||
.L2:
|
|
||||||
movl -36(%rbp), %eax #assign start
|
movl -36(%rbp), %eax #assign start
|
||||||
movl %eax, -4(%rbp) #assign end
|
movl %eax, -4(%rbp) #assign end
|
||||||
movl -12(%rbp), %eax #return b
|
movl -12(%rbp), %eax #return b
|
||||||
@ -41,29 +39,36 @@ bar:
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $576, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -12(%rbp) #FunctionStart1param end
|
||||||
movl $1, -12(%rbp) #constant assign
|
movl $97, -13(%rbp) #constant assign
|
||||||
movl $2, -16(%rbp) #constant assign
|
movl -13(%rbp), %eax #assign start
|
||||||
movl $3, -20(%rbp) #constant assign
|
movl %eax, -14(%rbp) #assign end
|
||||||
movl $4, -24(%rbp) #constant assign
|
movl -14(%rbp), %edi #adding param start
|
||||||
movl $5, -28(%rbp) #constant assign
|
call printCharacter
|
||||||
movl $6, -32(%rbp) #constant assign
|
movl %eax, -20(%rbp) #store return from call
|
||||||
movl $7, -36(%rbp) #constant assign
|
movl -20(%rbp), %eax #assign start
|
||||||
movl -36(%rbp), %edi #adding param start
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -32(%rbp), %esi #adding param start
|
movl $1, -28(%rbp) #constant assign
|
||||||
movl -28(%rbp), %edx #adding param start
|
movl $2, -32(%rbp) #constant assign
|
||||||
movl -24(%rbp), %ecx #adding param start
|
movl $3, -36(%rbp) #constant assign
|
||||||
movl -20(%rbp), %r8d #adding param start
|
movl $4, -40(%rbp) #constant assign
|
||||||
movl -16(%rbp), %r9d #adding param start
|
movl $5, -44(%rbp) #constant assign
|
||||||
movl -12(%rbp), %eax #adding param start
|
movl $6, -48(%rbp) #constant assign
|
||||||
movl %eax, 88(%rbp) #adding param end
|
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
|
call bar
|
||||||
movl %eax, -44(%rbp) #store return from call
|
movl %eax, -60(%rbp) #store return from call
|
||||||
.L3:
|
movl -60(%rbp), %eax #assign start
|
||||||
movl -44(%rbp), %eax #assign start
|
movl %eax, -64(%rbp) #assign end
|
||||||
movl %eax, -48(%rbp) #assign end
|
movl $1, -68(%rbp) #constant assign
|
||||||
movl $1, -52(%rbp) #constant assign
|
movl -68(%rbp), %eax #return $t14
|
||||||
movl -52(%rbp), %eax #return $t12
|
|
||||||
leave
|
leave
|
||||||
ret
|
ret
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
1: func_dec : entry
|
1: func_dec : entry
|
||||||
2: func : entry
|
2: func : entry
|
||||||
3: $t0 = 24
|
3: $t0 = 24
|
||||||
4: Label : 1
|
4: x = $t0
|
||||||
5: x = $t0
|
5: $t1 = 3
|
||||||
6: $t1 = 3
|
6: y = $t1
|
||||||
7: Label : 2
|
7: $t2 = x / y
|
||||||
8: y = $t1
|
8: y = $t2
|
||||||
9: $t2 = x / y
|
9: param y
|
||||||
10: Label : 3
|
10: call : printInteger 1
|
||||||
11: y = $t2
|
11: result = $t3
|
||||||
12: param y
|
12: return : y
|
||||||
13: call : printInteger 1
|
|
||||||
14: Label : 4
|
|
||||||
15: result = $t3
|
|
||||||
16: return : y
|
|
||||||
|
@ -2,27 +2,23 @@
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $400, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -8(%rbp) #FunctionStart1param end
|
||||||
movl $24, -12(%rbp) #constant assign
|
movl $24, -12(%rbp) #constant assign
|
||||||
.L1:
|
|
||||||
movl -12(%rbp), %eax #assign start
|
movl -12(%rbp), %eax #assign start
|
||||||
movl %eax, -16(%rbp) #assign end
|
movl %eax, -16(%rbp) #assign end
|
||||||
movl $3, -20(%rbp) #constant assign
|
movl $3, -20(%rbp) #constant assign
|
||||||
.L2:
|
|
||||||
movl -20(%rbp), %eax #assign start
|
movl -20(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -16(%rbp), %eax #division start
|
movl -16(%rbp), %eax #division start
|
||||||
cltd
|
cltd
|
||||||
idivl -24(%rbp)
|
idivl -24(%rbp)
|
||||||
movl %eax, -28(%rbp) #division end
|
movl %eax, -28(%rbp) #division end
|
||||||
.L3:
|
|
||||||
movl -28(%rbp), %eax #assign start
|
movl -28(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -24(%rbp), %edi #adding param start
|
movl -24(%rbp), %edi #adding param start
|
||||||
call printInteger
|
call printInteger
|
||||||
movl %eax, -32(%rbp) #store return from call
|
movl %eax, -32(%rbp) #store return from call
|
||||||
.L4:
|
|
||||||
movl -32(%rbp), %eax #assign start
|
movl -32(%rbp), %eax #assign start
|
||||||
movl %eax, -36(%rbp) #assign end
|
movl %eax, -36(%rbp) #assign end
|
||||||
movl -24(%rbp), %eax #return y
|
movl -24(%rbp), %eax #return y
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
1: func_dec : entry
|
1: func_dec : entry
|
||||||
2: func : entry
|
2: func : entry
|
||||||
3: $t0 = 1
|
3: $t0 = 1
|
||||||
4: Label : 1
|
4: x = $t0
|
||||||
5: x = $t0
|
5: $t1 = 2
|
||||||
6: $t1 = 2
|
6: y = $t1
|
||||||
7: Label : 2
|
7: $t2 = x == y
|
||||||
8: y = $t1
|
8: if $t2 True GOTO 1
|
||||||
9: $t2 = x == y
|
9: GOTO : 1
|
||||||
10: Label : 3
|
10: Label : 1
|
||||||
11: b = $t2
|
11: b = $t2
|
||||||
12: param b
|
12: param b
|
||||||
13: call : printBoolean 1
|
13: call : printBoolean 1
|
||||||
14: Label : 4
|
14: result = $t3
|
||||||
15: result = $t3
|
15: $t4 = 1
|
||||||
16: $t4 = 1
|
16: return : $t4
|
||||||
17: return : $t4
|
|
||||||
|
@ -2,30 +2,31 @@
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $416, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -8(%rbp) #FunctionStart1param end
|
||||||
movl $1, -12(%rbp) #constant assign
|
movl $1, -12(%rbp) #constant assign
|
||||||
.L1:
|
|
||||||
movl -12(%rbp), %eax #assign start
|
movl -12(%rbp), %eax #assign start
|
||||||
movl %eax, -16(%rbp) #assign end
|
movl %eax, -16(%rbp) #assign end
|
||||||
movl $2, -20(%rbp) #constant assign
|
movl $2, -20(%rbp) #constant assign
|
||||||
.L2:
|
|
||||||
movl -20(%rbp), %eax #assign start
|
movl -20(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -16(%rbp), %eax #equal to start
|
movl -16(%rbp), %eax #equal to start
|
||||||
cmpl -24(%rbp), %eax
|
cmpl -24(%rbp), %eax
|
||||||
sete %al
|
sete %al
|
||||||
|
movb $0, -25(%rbp)
|
||||||
movb %al, -25(%rbp) #equal to end
|
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 -25(%rbp), %eax #assign start
|
||||||
movl %eax, -26(%rbp) #assign end
|
movl %eax, -26(%rbp) #assign end
|
||||||
movl -26(%rbp), %edi #adding param start
|
movl -26(%rbp), %edi #adding param start
|
||||||
call printBoolean
|
call printBoolean
|
||||||
movl %eax, -30(%rbp) #store return from call
|
movl %eax, -32(%rbp) #store return from call
|
||||||
.L4:
|
movl -32(%rbp), %eax #assign start
|
||||||
movl -30(%rbp), %eax #assign start
|
movl %eax, -36(%rbp) #assign end
|
||||||
movl %eax, -34(%rbp) #assign end
|
movl $1, -40(%rbp) #constant assign
|
||||||
movl $1, -38(%rbp) #constant assign
|
movl -40(%rbp), %eax #return $t4
|
||||||
movl -38(%rbp), %eax #return $t4
|
|
||||||
leave
|
leave
|
||||||
ret
|
ret
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
1: func_dec : entry
|
1: func_dec : entry
|
||||||
2: func : entry
|
2: func : entry
|
||||||
3: $t0 = 1
|
3: $t0 = 1
|
||||||
4: Label : 1
|
4: x = $t0
|
||||||
5: x = $t0
|
5: $t1 = 2
|
||||||
6: $t1 = 2
|
6: y = $t1
|
||||||
7: Label : 2
|
7: $t2 = x < y
|
||||||
8: y = $t1
|
8: if $t2 True GOTO 1
|
||||||
9: $t2 = x < y
|
9: GOTO : 1
|
||||||
10: Label : 3
|
10: Label : 1
|
||||||
11: b = $t2
|
11: b = $t2
|
||||||
12: param b
|
12: param b
|
||||||
13: call : printBoolean 1
|
13: call : printBoolean 1
|
||||||
14: Label : 4
|
14: result = $t3
|
||||||
15: result = $t3
|
15: $t4 = 1
|
||||||
16: $t4 = 1
|
16: return : $t4
|
||||||
17: return : $t4
|
|
||||||
|
@ -2,30 +2,30 @@
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $416, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -8(%rbp) #FunctionStart1param end
|
||||||
movl $1, -12(%rbp) #constant assign
|
movl $1, -12(%rbp) #constant assign
|
||||||
.L1:
|
|
||||||
movl -12(%rbp), %eax #assign start
|
movl -12(%rbp), %eax #assign start
|
||||||
movl %eax, -16(%rbp) #assign end
|
movl %eax, -16(%rbp) #assign end
|
||||||
movl $2, -20(%rbp) #constant assign
|
movl $2, -20(%rbp) #constant assign
|
||||||
.L2:
|
|
||||||
movl -20(%rbp), %eax #assign start
|
movl -20(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -16(%rbp), %eax #less than start
|
movl -16(%rbp), %eax #less than start
|
||||||
cmpl -24(%rbp), %eax
|
cmpl -24(%rbp), %eax
|
||||||
setl %al
|
setl %al
|
||||||
movb %al, -25(%rbp) #less than end
|
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 -25(%rbp), %eax #assign start
|
||||||
movl %eax, -26(%rbp) #assign end
|
movl %eax, -26(%rbp) #assign end
|
||||||
movl -26(%rbp), %edi #adding param start
|
movl -26(%rbp), %edi #adding param start
|
||||||
call printBoolean
|
call printBoolean
|
||||||
movl %eax, -30(%rbp) #store return from call
|
movl %eax, -32(%rbp) #store return from call
|
||||||
.L4:
|
movl -32(%rbp), %eax #assign start
|
||||||
movl -30(%rbp), %eax #assign start
|
movl %eax, -36(%rbp) #assign end
|
||||||
movl %eax, -34(%rbp) #assign end
|
movl $1, -40(%rbp) #constant assign
|
||||||
movl $1, -38(%rbp) #constant assign
|
movl -40(%rbp), %eax #return $t4
|
||||||
movl -38(%rbp), %eax #return $t4
|
|
||||||
leave
|
leave
|
||||||
ret
|
ret
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
1: func_dec : entry
|
1: func_dec : entry
|
||||||
2: func : entry
|
2: func : entry
|
||||||
3: $t0 = 4
|
3: $t0 = 4
|
||||||
4: Label : 1
|
4: x = $t0
|
||||||
5: x = $t0
|
5: $t1 = 20
|
||||||
6: $t1 = 20
|
6: y = $t1
|
||||||
7: Label : 2
|
7: $t2 = y % x
|
||||||
8: y = $t1
|
8: y = $t2
|
||||||
9: $t2 = y % x
|
9: param y
|
||||||
10: Label : 3
|
10: call : printInteger 1
|
||||||
11: y = $t2
|
11: result = $t3
|
||||||
12: param y
|
12: return : y
|
||||||
13: call : printInteger 1
|
|
||||||
14: Label : 4
|
|
||||||
15: result = $t3
|
|
||||||
16: return : y
|
|
||||||
|
@ -2,27 +2,23 @@
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $400, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -8(%rbp) #FunctionStart1param end
|
||||||
movl $4, -12(%rbp) #constant assign
|
movl $4, -12(%rbp) #constant assign
|
||||||
.L1:
|
|
||||||
movl -12(%rbp), %eax #assign start
|
movl -12(%rbp), %eax #assign start
|
||||||
movl %eax, -16(%rbp) #assign end
|
movl %eax, -16(%rbp) #assign end
|
||||||
movl $20, -20(%rbp) #constant assign
|
movl $20, -20(%rbp) #constant assign
|
||||||
.L2:
|
|
||||||
movl -20(%rbp), %eax #assign start
|
movl -20(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -24(%rbp), %eax #mod start
|
movl -24(%rbp), %eax #mod start
|
||||||
cltd
|
cltd
|
||||||
idivl -16(%rbp)
|
idivl -16(%rbp)
|
||||||
movl %edx, -28(%rbp) #mod end
|
movl %edx, -28(%rbp) #mod end
|
||||||
.L3:
|
|
||||||
movl -28(%rbp), %eax #assign start
|
movl -28(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -24(%rbp), %edi #adding param start
|
movl -24(%rbp), %edi #adding param start
|
||||||
call printInteger
|
call printInteger
|
||||||
movl %eax, -32(%rbp) #store return from call
|
movl %eax, -32(%rbp) #store return from call
|
||||||
.L4:
|
|
||||||
movl -32(%rbp), %eax #assign start
|
movl -32(%rbp), %eax #assign start
|
||||||
movl %eax, -36(%rbp) #assign end
|
movl %eax, -36(%rbp) #assign end
|
||||||
movl -24(%rbp), %eax #return y
|
movl -24(%rbp), %eax #return y
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
1: func_dec : entry
|
1: func_dec : entry
|
||||||
2: func : entry
|
2: func : entry
|
||||||
3: $t0 = 3
|
3: $t0 = 3
|
||||||
4: Label : 1
|
4: x = $t0
|
||||||
5: x = $t0
|
5: $t1 = 20
|
||||||
6: $t1 = 20
|
6: y = $t1
|
||||||
7: Label : 2
|
7: $t2 = x * y
|
||||||
8: y = $t1
|
8: y = $t2
|
||||||
9: $t2 = x * y
|
9: param y
|
||||||
10: Label : 3
|
10: call : printInteger 1
|
||||||
11: y = $t2
|
11: result = $t3
|
||||||
12: param y
|
12: return : y
|
||||||
13: call : printInteger 1
|
|
||||||
14: Label : 4
|
|
||||||
15: result = $t3
|
|
||||||
16: return : y
|
|
||||||
|
@ -2,26 +2,22 @@
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $400, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -8(%rbp) #FunctionStart1param end
|
||||||
movl $3, -12(%rbp) #constant assign
|
movl $3, -12(%rbp) #constant assign
|
||||||
.L1:
|
|
||||||
movl -12(%rbp), %eax #assign start
|
movl -12(%rbp), %eax #assign start
|
||||||
movl %eax, -16(%rbp) #assign end
|
movl %eax, -16(%rbp) #assign end
|
||||||
movl $20, -20(%rbp) #constant assign
|
movl $20, -20(%rbp) #constant assign
|
||||||
.L2:
|
|
||||||
movl -20(%rbp), %eax #assign start
|
movl -20(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -16(%rbp), %eax #multiplication start
|
movl -16(%rbp), %eax #multiplication start
|
||||||
imull -24(%rbp), %eax
|
imull -24(%rbp), %eax
|
||||||
movl %eax, -28(%rbp) #multiplication end
|
movl %eax, -28(%rbp) #multiplication end
|
||||||
.L3:
|
|
||||||
movl -28(%rbp), %eax #assign start
|
movl -28(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -24(%rbp), %edi #adding param start
|
movl -24(%rbp), %edi #adding param start
|
||||||
call printInteger
|
call printInteger
|
||||||
movl %eax, -32(%rbp) #store return from call
|
movl %eax, -32(%rbp) #store return from call
|
||||||
.L4:
|
|
||||||
movl -32(%rbp), %eax #assign start
|
movl -32(%rbp), %eax #assign start
|
||||||
movl %eax, -36(%rbp) #assign end
|
movl %eax, -36(%rbp) #assign end
|
||||||
movl -24(%rbp), %eax #return y
|
movl -24(%rbp), %eax #return y
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
1: func_dec : entry
|
1: func_dec : entry
|
||||||
2: func : entry
|
2: func : entry
|
||||||
3: $t0 = 3
|
3: $t0 = 3
|
||||||
4: Label : 1
|
4: x = $t0
|
||||||
5: x = $t0
|
5: $t1 = -x
|
||||||
6: $t1 = -x
|
6: y = $t1
|
||||||
7: Label : 2
|
7: param y
|
||||||
8: y = $t1
|
8: call : printInteger 1
|
||||||
9: param y
|
9: result = $t2
|
||||||
10: call : printInteger 1
|
10: return : y
|
||||||
11: Label : 3
|
|
||||||
12: result = $t2
|
|
||||||
13: return : y
|
|
||||||
|
@ -2,22 +2,19 @@
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $400, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -8(%rbp) #FunctionStart1param end
|
||||||
movl $3, -12(%rbp) #constant assign
|
movl $3, -12(%rbp) #constant assign
|
||||||
.L1:
|
|
||||||
movl -12(%rbp), %eax #assign start
|
movl -12(%rbp), %eax #assign start
|
||||||
movl %eax, -16(%rbp) #assign end
|
movl %eax, -16(%rbp) #assign end
|
||||||
movl -16(%rbp), %eax #negation start
|
movl -16(%rbp), %eax #negation start
|
||||||
negl %eax
|
negl %eax
|
||||||
movl %eax, -20(%rbp) #negation end
|
movl %eax, -20(%rbp) #negation end
|
||||||
.L2:
|
|
||||||
movl -20(%rbp), %eax #assign start
|
movl -20(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -24(%rbp), %edi #adding param start
|
movl -24(%rbp), %edi #adding param start
|
||||||
call printInteger
|
call printInteger
|
||||||
movl %eax, -28(%rbp) #store return from call
|
movl %eax, -28(%rbp) #store return from call
|
||||||
.L3:
|
|
||||||
movl -28(%rbp), %eax #assign start
|
movl -28(%rbp), %eax #assign start
|
||||||
movl %eax, -32(%rbp) #assign end
|
movl %eax, -32(%rbp) #assign end
|
||||||
movl -24(%rbp), %eax #return y
|
movl -24(%rbp), %eax #return y
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
7: d = $t1
|
7: d = $t1
|
||||||
8: param d
|
8: param d
|
||||||
9: call : printBoolean 1
|
9: call : printBoolean 1
|
||||||
10: Label : 3
|
10: result = $t2
|
||||||
11: result = $t2
|
11: $t3 = 1
|
||||||
12: $t3 = 1
|
12: return : $t3
|
||||||
13: return : $t3
|
|
||||||
|
@ -2,20 +2,19 @@
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $400, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -8(%rbp) #FunctionStart1param end
|
||||||
movl $-1, -9(%rbp) #constant assign
|
movl $1, -9(%rbp) #constant assign
|
||||||
.L1:
|
.L1:
|
||||||
movl -9(%rbp), %eax #assign start
|
movl -9(%rbp), %eax #assign start
|
||||||
movl %eax, -10(%rbp) #assign end
|
movl %eax, -10(%rbp) #assign end
|
||||||
.L2:
|
.L2:
|
||||||
movl -11(%rbp), %edi #adding param start
|
movl -11(%rbp), %edi #adding param start
|
||||||
call printBoolean
|
call printBoolean
|
||||||
movl %eax, -15(%rbp) #store return from call
|
movl %eax, -18(%rbp) #store return from call
|
||||||
.L3:
|
movl -18(%rbp), %eax #assign start
|
||||||
movl -15(%rbp), %eax #assign start
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl %eax, -19(%rbp) #assign end
|
movl $1, -28(%rbp) #constant assign
|
||||||
movl $1, -23(%rbp) #constant assign
|
movl -28(%rbp), %eax #return $t3
|
||||||
movl -23(%rbp), %eax #return $t3
|
|
||||||
leave
|
leave
|
||||||
ret
|
ret
|
||||||
|
@ -7,18 +7,16 @@
|
|||||||
7: Label : 2
|
7: Label : 2
|
||||||
8: d = $t1
|
8: d = $t1
|
||||||
9: $t2 = true
|
9: $t2 = true
|
||||||
10: Label : 3
|
10: if c True GOTO 4
|
||||||
11: if c True GOTO 5
|
11: GOTO : 3
|
||||||
12: GOTO : 4
|
12: Label : 3
|
||||||
13: Label : 4
|
13: if d True GOTO 4
|
||||||
14: if d True GOTO 5
|
14: $t2 = false
|
||||||
15: $t2 = false
|
15: GOTO : 4
|
||||||
16: GOTO : 5
|
16: Label : 4
|
||||||
17: Label : 5
|
17: d = $t2
|
||||||
18: d = $t2
|
18: param d
|
||||||
19: param d
|
19: call : printBoolean 1
|
||||||
20: call : printBoolean 1
|
20: result = $t3
|
||||||
21: Label : 6
|
21: $t4 = 1
|
||||||
22: result = $t3
|
22: return : $t4
|
||||||
23: $t4 = 1
|
|
||||||
24: return : $t4
|
|
||||||
|
@ -2,30 +2,34 @@
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $416, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -8(%rbp) #FunctionStart1param end
|
||||||
movl $-1, -9(%rbp) #constant assign
|
movl $1, -9(%rbp) #constant assign
|
||||||
.L1:
|
.L1:
|
||||||
movl -9(%rbp), %eax #assign start
|
movl -9(%rbp), %eax #assign start
|
||||||
movl %eax, -10(%rbp) #assign end
|
movl %eax, -10(%rbp) #assign end
|
||||||
movl $-1, -11(%rbp) #constant assign
|
movl $0, -11(%rbp) #constant assign
|
||||||
.L2:
|
.L2:
|
||||||
movl -11(%rbp), %eax #assign start
|
movl -11(%rbp), %eax #assign start
|
||||||
movl %eax, -12(%rbp) #assign end
|
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:
|
.L3:
|
||||||
|
cmpb $0, -12(%rbp) #if true start
|
||||||
|
jne .L4 #if true end
|
||||||
|
movl $0, -13(%rbp) #constant assign
|
||||||
|
jmp .L4
|
||||||
.L4:
|
.L4:
|
||||||
movl $-1, -13(%rbp) #constant assign
|
|
||||||
.L5:
|
|
||||||
movl -13(%rbp), %eax #assign start
|
movl -13(%rbp), %eax #assign start
|
||||||
movl %eax, -12(%rbp) #assign end
|
movl %eax, -12(%rbp) #assign end
|
||||||
movl -12(%rbp), %edi #adding param start
|
movl -12(%rbp), %edi #adding param start
|
||||||
call printBoolean
|
call printBoolean
|
||||||
movl %eax, -17(%rbp) #store return from call
|
movl %eax, -18(%rbp) #store return from call
|
||||||
.L6:
|
movl -18(%rbp), %eax #assign start
|
||||||
movl -17(%rbp), %eax #assign start
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl %eax, -21(%rbp) #assign end
|
movl $1, -28(%rbp) #constant assign
|
||||||
movl $1, -25(%rbp) #constant assign
|
movl -28(%rbp), %eax #return $t4
|
||||||
movl -25(%rbp), %eax #return $t4
|
|
||||||
leave
|
leave
|
||||||
ret
|
ret
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
1: func_dec : entry
|
1: func_dec : entry
|
||||||
2: func : entry
|
2: func : entry
|
||||||
3: $t0 = 1
|
3: $t0 = 1
|
||||||
4: Label : 1
|
4: y = $t0
|
||||||
5: y = $t0
|
5: $t1 = 3
|
||||||
6: $t1 = 3
|
6: x = $t1
|
||||||
7: Label : 2
|
7: $t2 = x - y
|
||||||
8: x = $t1
|
8: y = $t2
|
||||||
9: $t2 = x - y
|
9: param y
|
||||||
10: Label : 3
|
10: call : printInteger 1
|
||||||
11: y = $t2
|
11: result = $t3
|
||||||
12: param y
|
12: return : y
|
||||||
13: call : printInteger 1
|
|
||||||
14: Label : 4
|
|
||||||
15: result = $t3
|
|
||||||
16: return : y
|
|
||||||
|
@ -2,26 +2,22 @@
|
|||||||
entry:
|
entry:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
subq $128, %rsp
|
subq $400, %rsp
|
||||||
movl %edi, -8(%rbp) #FunctionStart1param end
|
movl %edi, -8(%rbp) #FunctionStart1param end
|
||||||
movl $1, -12(%rbp) #constant assign
|
movl $1, -12(%rbp) #constant assign
|
||||||
.L1:
|
|
||||||
movl -12(%rbp), %eax #assign start
|
movl -12(%rbp), %eax #assign start
|
||||||
movl %eax, -16(%rbp) #assign end
|
movl %eax, -16(%rbp) #assign end
|
||||||
movl $3, -20(%rbp) #constant assign
|
movl $3, -20(%rbp) #constant assign
|
||||||
.L2:
|
|
||||||
movl -20(%rbp), %eax #assign start
|
movl -20(%rbp), %eax #assign start
|
||||||
movl %eax, -24(%rbp) #assign end
|
movl %eax, -24(%rbp) #assign end
|
||||||
movl -24(%rbp), %eax #subtraction start
|
movl -24(%rbp), %eax #subtraction start
|
||||||
subl -16(%rbp), %eax
|
subl -16(%rbp), %eax
|
||||||
movl %eax, -28(%rbp) #subtraction end
|
movl %eax, -28(%rbp) #subtraction end
|
||||||
.L3:
|
|
||||||
movl -28(%rbp), %eax #assign start
|
movl -28(%rbp), %eax #assign start
|
||||||
movl %eax, -16(%rbp) #assign end
|
movl %eax, -16(%rbp) #assign end
|
||||||
movl -16(%rbp), %edi #adding param start
|
movl -16(%rbp), %edi #adding param start
|
||||||
call printInteger
|
call printInteger
|
||||||
movl %eax, -32(%rbp) #store return from call
|
movl %eax, -32(%rbp) #store return from call
|
||||||
.L4:
|
|
||||||
movl -32(%rbp), %eax #assign start
|
movl -32(%rbp), %eax #assign start
|
||||||
movl %eax, -36(%rbp) #assign end
|
movl %eax, -36(%rbp) #assign end
|
||||||
movl -16(%rbp), %eax #return y
|
movl -16(%rbp), %eax #return y
|
||||||
|
Reference in New Issue
Block a user