start work on word/long handling

This commit is contained in:
Quentin Carbonneaux 2015-08-01 18:17:06 -04:00
parent dff7044a2c
commit cf307002d9
14 changed files with 114 additions and 81 deletions

View file

@ -3,21 +3,21 @@
# handling of looping constructs
@start
%ten = copy 10
%dum = copy 0 # dummy live-through temporary
%ten =w copy 10
%dum =w copy 0 # dummy live-through temporary
@loop
%alt = phi @start 0, @left %alt1, @right %alt1
%cnt = phi @start 100, @left %cnt, @right %cnt1
%alt1 = sub 1, %alt
%alt =w phi @start 0, @left %alt1, @right %alt1
%cnt =w phi @start 100, @left %cnt, @right %cnt1
%alt1 =w sub 1, %alt
jez %alt1, @left, @right
@left
%x = phi @loop 10, @left %x1
%x1 = sub %x, 1
%z = copy %x
%x =w phi @loop 10, @left %x1
%x1 =w sub %x, 1
%z =w copy %x
jez %z, @loop, @left
@right
%cnt1 = sub %cnt, %ten
%cnt1 =w sub %cnt, %ten
jez %cnt1, @end, @loop
@end
%ret = add %cnt, %dum
%ret =w add %cnt, %dum
ret

View file

@ -6,9 +6,9 @@
@start
@loop
%a = phi @start 380, @loop %r
%b = phi @start 747, @loop %a
%r = rem %b, %a
%a =w phi @start 380, @loop %r
%b =w phi @start 747, @loop %a
%r =w rem %b, %a
jez %r, @end, @loop
@end

View file

@ -1,13 +1,13 @@
@start
%x = copy 1
%x =w copy 1
@loop
jez %x, @isz, @noz
@noz
%x = copy 0
%x =w copy 0
jmp @end
@isz
%x = copy 1
%x =w copy 1
jmp @loop
@end
%z = add 10, %x
%z =w add 10, %x
ret

View file

@ -1,13 +1,13 @@
@start
%x = copy 1
%x =w copy 1
@loop
jez %x, @isz, @noz
@noz
%x = copy 0
%x =w copy 0
jez %x, @end, @loop
@isz
%x = copy 1
%x =w copy 1
jmp @loop
@end
%z = add 10, %x
%z =w add 10, %x
ret

View file

@ -6,14 +6,14 @@
# nothing should ever be live at the entry
@start
%b = copy 0
%x = copy 10
%b =w copy 0
%x =w copy 10
jez 0, @left, @loop
@left
jmp @inloop
@loop
%x1 = add %x, 1
%x1 =w add %x, 1
@inloop
%b1 = add %b, 1
%b1 =w add %b, 1
@endloop
jmp @loop

View file

@ -4,10 +4,10 @@
@start
@loop
%s = phi @start 100, @loop %s1
%n = phi @start 0, @loop %n1
%n1 = sub %n, 1
%s1 = add %s, %n
%s =w phi @start 100, @loop %s1
%n =w phi @start 0, @loop %n1
%n1 =w sub %n, 1
%s1 =w add %s, %n
jez %n1, @end, @loop
@end

View file

@ -10,11 +10,11 @@
#
@start
%f = copy 0 # here
%b = copy 1
%c = copy 2
%a = sub %b, %c
%d = copy %b
%e = copy %f # and there
%g = copy %a
%f =w copy 0 # here
%b =w copy 1
%c =w copy 2
%a =w sub %b, %c
%d =w copy %b
%e =w copy %f # and there
%g =w copy %a
ret

View file

@ -1,20 +1,20 @@
# stupid spilling test
@start
%x1 = copy 10
%x2 = add %x1, %x1
%x3 = sub %x2, %x1
%x4 = add %x3, %x1
%x5 = sub %x4, %x1
%x6 = add %x5, %x1
%x7 = sub %x6, %x1
%x8 = add %x7, %x1
%x9 = sub %x8, %x8
%x10 = add %x9, %x7
%x11 = sub %x10, %x6
%x12 = add %x11, %x5
%x13 = sub %x12, %x4
%x14 = add %x13, %x3
%x15 = sub %x14, %x2
%x16 = add %x15, %x1
%x1 =w copy 10
%x2 =w add %x1, %x1
%x3 =w sub %x2, %x1
%x4 =w add %x3, %x1
%x5 =w sub %x4, %x1
%x6 =w add %x5, %x1
%x7 =w sub %x6, %x1
%x8 =w add %x7, %x1
%x9 =w sub %x8, %x8
%x10 =w add %x9, %x7
%x11 =w sub %x10, %x6
%x12 =w add %x11, %x5
%x13 =w sub %x12, %x4
%x14 =w add %x13, %x3
%x15 =w sub %x14, %x2
%x16 =w add %x15, %x1
ret