From 67611e548b0fd07ee4865ee3140b7cee12f4e2e8 Mon Sep 17 00:00:00 2001 From: Jesper Gravgaard Date: Sat, 3 Nov 2018 19:02:59 +0100 Subject: [PATCH] Added print_at methods --- src/main/kc/stdlib/print.kc | 21 + .../dk/camelot64/kickc/test/TestPrograms.java | 5 + .../kc/examples/fastmultiply/fastmultiply8.kc | 79 + src/test/ref/c64dtv-gfxexplorer.cfg | 8 +- src/test/ref/c64dtv-gfxexplorer.log | 246 +- src/test/ref/c64dtv-gfxexplorer.sym | 2 +- src/test/ref/c64dtv-gfxmodes.cfg | 8 +- src/test/ref/c64dtv-gfxmodes.log | 148 +- src/test/ref/c64dtv-gfxmodes.sym | 2 +- src/test/ref/constants.cfg | 8 +- src/test/ref/constants.log | 110 +- src/test/ref/constants.sym | 2 +- src/test/ref/examples/3d/perspective.cfg | 8 +- src/test/ref/examples/3d/perspective.log | 138 +- src/test/ref/examples/3d/perspective.sym | 2 +- .../fastmultiply/fastmultiply8.kc.asm | 204 ++ .../fastmultiply/fastmultiply8.kc.cfg | 135 + .../fastmultiply/fastmultiply8.kc.log | 2426 +++++++++++++++++ .../fastmultiply/fastmultiply8.kc.sym | 115 + .../ref/examples/helloworld/helloworld.cfg | 8 +- .../ref/examples/helloworld/helloworld.log | 94 +- .../ref/examples/helloworld/helloworld.sym | 2 +- .../ref/examples/sinsprites/sinus-sprites.cfg | 8 +- .../ref/examples/sinsprites/sinus-sprites.log | 136 +- .../ref/examples/sinsprites/sinus-sprites.sym | 2 +- src/test/ref/incrementinarray.cfg | 8 +- src/test/ref/incrementinarray.log | 110 +- src/test/ref/incrementinarray.sym | 2 +- src/test/ref/linegen.cfg | 8 +- src/test/ref/linegen.log | 116 +- src/test/ref/linegen.sym | 2 +- src/test/ref/min-fmul-16.cfg | 8 +- src/test/ref/min-fmul-16.log | 154 +- src/test/ref/min-fmul-16.sym | 2 +- src/test/ref/printmsg.cfg | 8 +- src/test/ref/printmsg.log | 106 +- src/test/ref/printmsg.sym | 2 +- src/test/ref/sinus-basic.cfg | 8 +- src/test/ref/sinus-basic.log | 118 +- src/test/ref/sinus-basic.sym | 2 +- src/test/ref/sinusgen16.cfg | 8 +- src/test/ref/sinusgen16.log | 116 +- src/test/ref/sinusgen16.sym | 2 +- src/test/ref/sinusgen16b.cfg | 8 +- src/test/ref/sinusgen16b.log | 116 +- src/test/ref/sinusgen16b.sym | 2 +- src/test/ref/sinusgen8.cfg | 8 +- src/test/ref/sinusgen8.log | 110 +- src/test/ref/sinusgen8.sym | 2 +- src/test/ref/sinusgen8b.cfg | 8 +- src/test/ref/sinusgen8b.log | 116 +- src/test/ref/sinusgen8b.sym | 2 +- src/test/ref/sinusgenscale8.cfg | 8 +- src/test/ref/sinusgenscale8.log | 110 +- src/test/ref/sinusgenscale8.sym | 2 +- src/test/ref/test-comparisons.cfg | 8 +- src/test/ref/test-comparisons.log | 110 +- src/test/ref/test-comparisons.sym | 2 +- src/test/ref/test-division.cfg | 8 +- src/test/ref/test-division.log | 198 +- src/test/ref/test-division.sym | 2 +- src/test/ref/test-lowhigh.cfg | 8 +- src/test/ref/test-lowhigh.log | 110 +- src/test/ref/test-lowhigh.sym | 2 +- src/test/ref/test-multiply-16bit.cfg | 8 +- src/test/ref/test-multiply-16bit.log | 130 +- src/test/ref/test-multiply-16bit.sym | 2 +- src/test/ref/test-multiply-8bit.cfg | 8 +- src/test/ref/test-multiply-8bit.log | 144 +- src/test/ref/test-multiply-8bit.sym | 2 +- 70 files changed, 4458 insertions(+), 1473 deletions(-) create mode 100644 src/test/kc/examples/fastmultiply/fastmultiply8.kc create mode 100644 src/test/ref/examples/fastmultiply/fastmultiply8.kc.asm create mode 100644 src/test/ref/examples/fastmultiply/fastmultiply8.kc.cfg create mode 100644 src/test/ref/examples/fastmultiply/fastmultiply8.kc.log create mode 100644 src/test/ref/examples/fastmultiply/fastmultiply8.kc.sym diff --git a/src/main/kc/stdlib/print.kc b/src/main/kc/stdlib/print.kc index ec3b72a8b..0eb5c13e1 100644 --- a/src/main/kc/stdlib/print.kc +++ b/src/main/kc/stdlib/print.kc @@ -63,6 +63,15 @@ void print_sbyte(signed byte b) { print_byte((byte)b); } +// Print a signed byte as hex at a specific screen position +void print_sbyte_at(signed byte b, byte* at) { + if(b<0) { + print_char_at('-', at); + b = -b; + } + print_byte_at((byte)b, at+1); +} + // Print a word as HEX void print_word(word w) { print_byte(>w); @@ -93,11 +102,23 @@ void print_byte(byte b) { print_char(print_hextab[b&$f]); } +// Print a byte as HEX at a specific position +void print_byte_at(byte b, byte* at) { + // Table of hexadecimal digits + print_char_at(print_hextab[b>>4], at); + print_char_at(print_hextab[b&$f], at+1); +} + // Print a single char void print_char(byte ch) { *(print_char_cursor++) = ch; } +// Print a single char +void print_char_at(byte ch, byte* at) { + *(at) = ch; +} + // Clear the screen. Also resets current line/char cursor. void print_cls() { for(byte* sc=print_screen; sc!=print_screen+1000; sc++) { diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index b3b3784cb..137c08221 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -44,6 +44,11 @@ public class TestPrograms { AsmFragmentTemplateUsages.logUsages(log, false, false, false, false, false, false); } + @Test + public void testFastMultiply8() throws IOException, URISyntaxException { + compileAndCompare("examples/fastmultiply/fastmultiply8.kc"); + } + @Test public void test3DPerspective() throws IOException, URISyntaxException { compileAndCompare("examples/3d/perspective"); diff --git a/src/test/kc/examples/fastmultiply/fastmultiply8.kc b/src/test/kc/examples/fastmultiply/fastmultiply8.kc new file mode 100644 index 000000000..5a87f159f --- /dev/null +++ b/src/test/kc/examples/fastmultiply/fastmultiply8.kc @@ -0,0 +1,79 @@ +// Seriously fast multiply 8-bit version (8bit*8bit=8bit) +// Multiplies two signed 8-bit numbers and results in an 8-bit number +// C=A*B, A in [-64;64], B in [-96;95], C in [-96;95] - 64 acts a 1 (X*64=X) +// Uses the formula a*b = (a+b)^2/4 - (a-b)^2/4 +// See the following for information about the method +// - http://codebase64.org/doku.php?id=base:seriously_fast_multiplication +// - http://codebase64.org/doku.php?id=magazines:chacking16 + +import "print.kc" + +signed byte[] vals = {-95, -64, 0, 64, 95}; + +void main() { + print_cls(); + byte* at_line = $400; + byte* at = at_line+4; + for(byte k: 0..4) { + print_sbyte_at(vals[k], at); + at += 4; + } + for(byte i: 0..4) { + at_line +=40; + at = at_line; + print_sbyte_at(vals[i], at); + for(byte j: 0..4) { + at += 4; + signed byte r = fmul8(vals[i], vals[j]); + print_sbyte_at(r, at); + } + } +} + + +// Pointers to a, b and c=a*b +signed byte* ap = $fd; +signed byte* bp = $fe; +signed byte* cp = $ff; + +signed byte fmul8(signed byte a, signed byte b) { + *ap = a; + *bp = b; + asm { + lda ap + sta A1+1 + eor #$ff + sta A2+1 + ldx bp + sec + A1: lda mulf_sqr1,x + A2: sbc mulf_sqr2,x + sta cp + } + return *cp; +} + + + +// mulf_sqr tables will contain f(x)=int(x*x) and g(x) = f(1-x). +// f(x) = >(( x * x )) +byte* mulf_sqr1 = $2000; +// g(x) = >((( 1 - x ) * ( 1 - x ))) +byte* mulf_sqr2 = $2200; + +kickasm(pc mulf_sqr1) {{ + .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((i*i)/256) } + .if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } + .if(i>351) { .byte round(((512-i)*(512-i))/256) } + } +}} + +kickasm(pc mulf_sqr2) {{ + .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } + .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } + .if(i>351) { .byte round(((i-511)*(i-511))/256) } + } +}} + diff --git a/src/test/ref/c64dtv-gfxexplorer.cfg b/src/test/ref/c64dtv-gfxexplorer.cfg index 960471ec1..74060d22b 100644 --- a/src/test/ref/c64dtv-gfxexplorer.cfg +++ b/src/test/ref/c64dtv-gfxexplorer.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@62 -@62: scope:[] from @begin + to:@65 +@65: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @62 +@end: scope:[] from @65 [3] phi() [ ] ( ) -main: scope:[main] from @62 +main: scope:[main] from @65 asm { sei } [5] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 [ ] ( main:2 [ ] ) [6] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 [ ] ( main:2 [ ] ) diff --git a/src/test/ref/c64dtv-gfxexplorer.log b/src/test/ref/c64dtv-gfxexplorer.log index 96e94853d..1e3337de8 100644 --- a/src/test/ref/c64dtv-gfxexplorer.log +++ b/src/test/ref/c64dtv-gfxexplorer.log @@ -74,7 +74,7 @@ dtvSetCpuBankSegment1::@return: scope:[dtvSetCpuBankSegment1] from dtvSetCpuBan (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@14 + to:@15 print_str_lines: scope:[print_str_lines] from form_mode::@22 form_mode::@25 (byte*) print_line_cursor#45 ← phi( form_mode::@22/(byte*) print_line_cursor#12 form_mode::@25/(byte*) print_line_cursor#15 ) (byte*) print_char_cursor#47 ← phi( form_mode::@22/(byte*) print_char_cursor#13 form_mode::@25/(byte*) print_char_cursor#16 ) @@ -181,12 +181,12 @@ print_ln::@return: scope:[print_ln] from print_ln::@2 (byte*) print_char_cursor#5 ← (byte*) print_char_cursor#24 return to:@return -@14: scope:[] from @4 +@15: scope:[] from @4 (byte*) print_char_cursor#76 ← phi( @4/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#76 ← phi( @4/(byte*) print_line_cursor#0 ) (byte*) print_screen#55 ← phi( @4/(byte*) print_screen#0 ) (byte[]) print_hextab#0 ← (const string) $69 - to:@18 + to:@21 print_cls: scope:[print_cls] from form_mode::@21 form_mode::@24 (byte*) print_screen#9 ← phi( form_mode::@21/(byte*) print_screen#5 form_mode::@24/(byte*) print_screen#6 ) (byte*) print_cls::sc#0 ← (byte*) print_screen#9 @@ -227,10 +227,10 @@ print_set_screen::@return: scope:[print_set_screen] from print_set_screen (byte*) print_char_cursor#9 ← (byte*) print_char_cursor#26 return to:@return -@18: scope:[] from @14 - (byte*) print_char_cursor#75 ← phi( @14/(byte*) print_char_cursor#76 ) - (byte*) print_line_cursor#75 ← phi( @14/(byte*) print_line_cursor#76 ) - (byte*) print_screen#53 ← phi( @14/(byte*) print_screen#55 ) +@21: scope:[] from @15 + (byte*) print_char_cursor#75 ← phi( @15/(byte*) print_char_cursor#76 ) + (byte*) print_line_cursor#75 ← phi( @15/(byte*) print_line_cursor#76 ) + (byte*) print_screen#53 ← phi( @15/(byte*) print_screen#55 ) (byte) KEY_CRSR_RIGHT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2 (byte) KEY_CRSR_DOWN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7 (byte) KEY_LSHIFT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 15 @@ -240,7 +240,7 @@ print_set_screen::@return: scope:[print_set_screen] from print_set_screen (byte) KEY_COMMODORE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 61 (byte[8]) keyboard_matrix_row_bitmask#0 ← { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } (byte[8]) keyboard_matrix_col_bitmask#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } - to:@22 + to:@25 keyboard_init: scope:[keyboard_init] from main *((byte*) CIA1_PORT_A_DDR#0) ← (byte/word/signed word/dword/signed dword) 255 *((byte*) CIA1_PORT_B_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 @@ -260,10 +260,10 @@ keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matri (byte) keyboard_matrix_read::return#1 ← (byte) keyboard_matrix_read::return#3 return to:@return -@22: scope:[] from @18 - (byte*) print_char_cursor#74 ← phi( @18/(byte*) print_char_cursor#75 ) - (byte*) print_line_cursor#74 ← phi( @18/(byte*) print_line_cursor#75 ) - (byte*) print_screen#51 ← phi( @18/(byte*) print_screen#53 ) +@25: scope:[] from @21 + (byte*) print_char_cursor#74 ← phi( @21/(byte*) print_char_cursor#75 ) + (byte*) print_line_cursor#74 ← phi( @21/(byte*) print_line_cursor#75 ) + (byte*) print_screen#51 ← phi( @21/(byte*) print_screen#53 ) (byte[8]) keyboard_events#0 ← { fill( 8, 0) } (byte) keyboard_events_size#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) keyboard_modifiers#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 @@ -274,7 +274,7 @@ keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matri (byte~) $0 ← (byte) KEY_MODIFIER_LSHIFT#0 | (byte) KEY_MODIFIER_RSHIFT#0 (byte) KEY_MODIFIER_SHIFT#0 ← (byte~) $0 (byte[8]) keyboard_scan_values#0 ← { fill( 8, 0) } - to:@25 + to:@28 keyboard_event_scan: scope:[keyboard_event_scan] from form_control::@3 gfx_mode::@21 (byte) keyboard_events_size#110 ← phi( form_control::@3/(byte) keyboard_events_size#48 gfx_mode::@21/(byte) keyboard_events_size#44 ) (byte) keyboard_event_scan::keycode#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 @@ -530,18 +530,18 @@ keyboard_event_get::@return: scope:[keyboard_event_get] from keyboard_event_get (byte) keyboard_events_size#5 ← (byte) keyboard_events_size#24 return to:@return -@25: scope:[] from @22 - (byte) keyboard_modifiers#106 ← phi( @22/(byte) keyboard_modifiers#0 ) - (byte) keyboard_events_size#122 ← phi( @22/(byte) keyboard_events_size#0 ) - (byte*) print_char_cursor#72 ← phi( @22/(byte*) print_char_cursor#74 ) - (byte*) print_line_cursor#72 ← phi( @22/(byte*) print_line_cursor#74 ) - (byte*) print_screen#49 ← phi( @22/(byte*) print_screen#51 ) +@28: scope:[] from @25 + (byte) keyboard_modifiers#106 ← phi( @25/(byte) keyboard_modifiers#0 ) + (byte) keyboard_events_size#122 ← phi( @25/(byte) keyboard_events_size#0 ) + (byte*) print_char_cursor#72 ← phi( @25/(byte*) print_char_cursor#74 ) + (byte*) print_line_cursor#72 ← phi( @25/(byte*) print_line_cursor#74 ) + (byte*) print_screen#49 ← phi( @25/(byte*) print_screen#51 ) (byte[256]) bitmap_plot_xlo#0 ← { fill( 256, 0) } (byte[256]) bitmap_plot_xhi#0 ← { fill( 256, 0) } (byte[256]) bitmap_plot_ylo#0 ← { fill( 256, 0) } (byte[256]) bitmap_plot_yhi#0 ← { fill( 256, 0) } (byte[256]) bitmap_plot_bit#0 ← { fill( 256, 0) } - to:@34 + to:@37 bitmap_init: scope:[bitmap_init] from gfx_init_vic_bitmap (byte*) bitmap_init::bitmap#2 ← phi( gfx_init_vic_bitmap/(byte*) bitmap_init::bitmap#0 ) (byte) bitmap_init::bits#0 ← (byte/word/signed word/dword/signed dword) 128 @@ -1085,15 +1085,15 @@ bitmap_line_ydxd::@3: scope:[bitmap_line_ydxd] from bitmap_line_ydxd::@5 bitmap_line_ydxd::@return: scope:[bitmap_line_ydxd] from bitmap_line_ydxd::@2 return to:@return -main: scope:[main] from @62 - (byte) form_fields_cnt#72 ← phi( @62/(byte) form_fields_cnt#73 ) - (byte) form_field_idx#55 ← phi( @62/(byte) form_field_idx#36 ) - (byte) keyboard_modifiers#94 ← phi( @62/(byte) keyboard_modifiers#53 ) - (byte) keyboard_events_size#101 ← phi( @62/(byte) keyboard_events_size#53 ) - (signed byte) form_cursor_count#47 ← phi( @62/(signed byte) form_cursor_count#26 ) - (byte*) print_char_cursor#63 ← phi( @62/(byte*) print_char_cursor#46 ) - (byte*) print_line_cursor#63 ← phi( @62/(byte*) print_line_cursor#44 ) - (byte*) print_screen#40 ← phi( @62/(byte*) print_screen#25 ) +main: scope:[main] from @65 + (byte) form_fields_cnt#72 ← phi( @65/(byte) form_fields_cnt#73 ) + (byte) form_field_idx#55 ← phi( @65/(byte) form_field_idx#36 ) + (byte) keyboard_modifiers#94 ← phi( @65/(byte) keyboard_modifiers#53 ) + (byte) keyboard_events_size#101 ← phi( @65/(byte) keyboard_events_size#53 ) + (signed byte) form_cursor_count#47 ← phi( @65/(signed byte) form_cursor_count#26 ) + (byte*) print_char_cursor#63 ← phi( @65/(byte*) print_char_cursor#46 ) + (byte*) print_line_cursor#63 ← phi( @65/(byte*) print_line_cursor#44 ) + (byte*) print_screen#40 ← phi( @65/(byte*) print_screen#25 ) asm { sei } *((byte*) PROCPORT_DDR#0) ← (byte) PROCPORT_DDR_MEMORY_MASK#0 *((byte*) PROCPORT#0) ← (byte) PROCPORT_RAM_IO#0 @@ -1190,12 +1190,12 @@ main::@return: scope:[main] from main::@1 (byte) form_field_idx#1 ← (byte) form_field_idx#12 return to:@return -@34: scope:[] from @25 - (byte) keyboard_modifiers#101 ← phi( @25/(byte) keyboard_modifiers#106 ) - (byte) keyboard_events_size#113 ← phi( @25/(byte) keyboard_events_size#122 ) - (byte*) print_char_cursor#69 ← phi( @25/(byte*) print_char_cursor#72 ) - (byte*) print_line_cursor#69 ← phi( @25/(byte*) print_line_cursor#72 ) - (byte*) print_screen#46 ← phi( @25/(byte*) print_screen#49 ) +@37: scope:[] from @28 + (byte) keyboard_modifiers#101 ← phi( @28/(byte) keyboard_modifiers#106 ) + (byte) keyboard_events_size#113 ← phi( @28/(byte) keyboard_events_size#122 ) + (byte*) print_char_cursor#69 ← phi( @28/(byte*) print_char_cursor#72 ) + (byte*) print_line_cursor#69 ← phi( @28/(byte*) print_line_cursor#72 ) + (byte*) print_screen#46 ← phi( @28/(byte*) print_screen#49 ) (byte*) VIC_SCREEN0#0 ← ((byte*)) (word/signed word/dword/signed dword) 16384 (byte*) VIC_SCREEN1#0 ← ((byte*)) (word/signed word/dword/signed dword) 17408 (byte*) VIC_SCREEN2#0 ← ((byte*)) (word/signed word/dword/signed dword) 18432 @@ -1211,7 +1211,7 @@ main::@return: scope:[main] from main::@1 (dword) PLANE_BLANK#0 ← (dword/signed dword) 229376 (dword) PLANE_FULL#0 ← (dword/signed dword) 237568 (dword) PLANE_CHARSET8#0 ← (dword/signed dword) 245760 - to:@37 + to:@40 get_plane: scope:[get_plane] from gfx_mode::@46 gfx_mode::@9 (byte) get_plane::idx#2 ← phi( gfx_mode::@46/(byte) get_plane::idx#1 gfx_mode::@9/(byte) get_plane::idx#0 ) (bool~) get_plane::$0 ← (byte) get_plane::idx#2 == (byte/signed byte/word/signed word/dword/signed dword) 0 @@ -1428,12 +1428,12 @@ get_vic_charset::@return: scope:[get_vic_charset] from get_vic_charset::@1 get_ get_vic_charset::@3: scope:[get_vic_charset] from get_vic_charset::@2 (byte*) get_vic_charset::return#3 ← (byte*) VIC_CHARSET_ROM#0 to:get_vic_charset::@return -@37: scope:[] from @34 - (byte) keyboard_modifiers#95 ← phi( @34/(byte) keyboard_modifiers#101 ) - (byte) keyboard_events_size#102 ← phi( @34/(byte) keyboard_events_size#113 ) - (byte*) print_char_cursor#64 ← phi( @34/(byte*) print_char_cursor#69 ) - (byte*) print_line_cursor#64 ← phi( @34/(byte*) print_line_cursor#69 ) - (byte*) print_screen#41 ← phi( @34/(byte*) print_screen#46 ) +@40: scope:[] from @37 + (byte) keyboard_modifiers#95 ← phi( @37/(byte) keyboard_modifiers#101 ) + (byte) keyboard_events_size#102 ← phi( @37/(byte) keyboard_events_size#113 ) + (byte*) print_char_cursor#64 ← phi( @37/(byte*) print_char_cursor#69 ) + (byte*) print_line_cursor#64 ← phi( @37/(byte*) print_line_cursor#69 ) + (byte*) print_screen#41 ← phi( @37/(byte*) print_screen#46 ) (byte*) FORM_SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) FORM_CHARSET#0 ← ((byte*)) (word/signed word/dword/signed dword) 6144 (string~) $1 ← (const string) $70 + (const string) $71 @@ -1485,7 +1485,7 @@ get_vic_charset::@3: scope:[get_vic_charset] from get_vic_charset::@2 (byte[]) preset_sixsfred#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 9, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 10, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0 } (byte[]) preset_sixsfred2#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 9, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 9, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 10, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0 } (byte[]) preset_8bpppixelcell#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 10, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 11, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0 } - to:@39 + to:@42 apply_preset: scope:[apply_preset] from form_mode::@18 (byte) form_fields_cnt#23 ← phi( form_mode::@18/(byte) form_fields_cnt#37 ) (byte) apply_preset::idx#1 ← phi( form_mode::@18/(byte) apply_preset::idx#0 ) @@ -1722,13 +1722,13 @@ render_preset_name::@45: scope:[render_preset_name] from render_preset_name::@2 render_preset_name::@return: scope:[render_preset_name] from render_preset_name::@45 return to:@return -@39: scope:[] from @37 - (byte) form_fields_cnt#75 ← phi( @37/(byte) form_fields_cnt#0 ) - (byte) keyboard_modifiers#88 ← phi( @37/(byte) keyboard_modifiers#95 ) - (byte) keyboard_events_size#91 ← phi( @37/(byte) keyboard_events_size#102 ) - (byte*) print_char_cursor#62 ← phi( @37/(byte*) print_char_cursor#64 ) - (byte*) print_line_cursor#61 ← phi( @37/(byte*) print_line_cursor#64 ) - (byte*) print_screen#39 ← phi( @37/(byte*) print_screen#41 ) +@42: scope:[] from @40 + (byte) form_fields_cnt#75 ← phi( @40/(byte) form_fields_cnt#0 ) + (byte) keyboard_modifiers#88 ← phi( @40/(byte) keyboard_modifiers#95 ) + (byte) keyboard_events_size#91 ← phi( @40/(byte) keyboard_events_size#102 ) + (byte*) print_char_cursor#62 ← phi( @40/(byte*) print_char_cursor#64 ) + (byte*) print_line_cursor#61 ← phi( @40/(byte*) print_line_cursor#64 ) + (byte*) print_screen#39 ← phi( @40/(byte*) print_screen#41 ) (byte*~) $32 ← (byte[]) form_fields_val#0 + (byte/signed byte/word/signed word/dword/signed dword) 0 (byte*) form_preset#0 ← (byte*~) $32 (byte*~) $33 ← (byte[]) form_fields_val#0 + (byte/signed byte/word/signed word/dword/signed dword) 1 @@ -1801,7 +1801,7 @@ render_preset_name::@return: scope:[render_preset_name] from render_preset_name (byte*) form_vic_bg3_hi#0 ← (byte*~) $66 (byte*~) $67 ← (byte[]) form_fields_val#0 + (byte/signed byte/word/signed word/dword/signed dword) 35 (byte*) form_vic_bg3_lo#0 ← (byte*~) $67 - to:@58 + to:@61 gfx_mode: scope:[gfx_mode] from main::@9 (byte) keyboard_modifiers#139 ← phi( main::@9/(byte) keyboard_modifiers#7 ) (byte) keyboard_events_size#159 ← phi( main::@9/(byte) keyboard_events_size#6 ) @@ -3277,20 +3277,20 @@ form_mode::@33: scope:[form_mode] from form_mode::@32 (byte*) print_line_cursor#50 ← phi( form_mode::@32/(byte*) print_line_cursor#60 ) (byte*) print_screen#30 ← phi( form_mode::@32/(byte*) print_screen#38 ) to:form_mode::@2 -@58: scope:[] from @39 - (byte) form_fields_cnt#74 ← phi( @39/(byte) form_fields_cnt#75 ) - (byte) keyboard_modifiers#77 ← phi( @39/(byte) keyboard_modifiers#88 ) - (byte) keyboard_events_size#77 ← phi( @39/(byte) keyboard_events_size#91 ) - (byte*) print_char_cursor#56 ← phi( @39/(byte*) print_char_cursor#62 ) - (byte*) print_line_cursor#53 ← phi( @39/(byte*) print_line_cursor#61 ) - (byte*) print_screen#33 ← phi( @39/(byte*) print_screen#39 ) +@61: scope:[] from @42 + (byte) form_fields_cnt#74 ← phi( @42/(byte) form_fields_cnt#75 ) + (byte) keyboard_modifiers#77 ← phi( @42/(byte) keyboard_modifiers#88 ) + (byte) keyboard_events_size#77 ← phi( @42/(byte) keyboard_events_size#91 ) + (byte*) print_char_cursor#56 ← phi( @42/(byte*) print_char_cursor#62 ) + (byte*) print_line_cursor#53 ← phi( @42/(byte*) print_line_cursor#61 ) + (byte*) print_screen#33 ← phi( @42/(byte*) print_screen#39 ) (byte[25]) form_line_lo#0 ← { fill( 25, 0) } (byte[25]) form_line_hi#0 ← { fill( 25, 0) } (byte) form_field_idx#4 ← (byte/signed byte/word/signed word/dword/signed dword) 0 (signed byte) FORM_CURSOR_BLINK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 40 (signed word/signed byte/signed dword~) $68 ← (signed byte) FORM_CURSOR_BLINK#0 / (byte/signed byte/word/signed word/dword/signed dword) 2 (signed byte) form_cursor_count#4 ← (signed word/signed byte/signed dword~) $68 - to:@62 + to:@65 form_set_screen: scope:[form_set_screen] from form_mode::@26 (byte*) form_set_screen::screen#1 ← phi( form_mode::@26/(byte*) form_set_screen::screen#0 ) (byte*) form_set_screen::line#0 ← (byte*) form_set_screen::screen#1 @@ -3632,25 +3632,25 @@ form_control::@30: scope:[form_control] from form_control::@9 (signed byte) form_cursor_count#25 ← phi( form_control::@9/(signed byte) form_cursor_count#37 ) (byte) form_control::return#5 ← (byte/word/signed word/dword/signed dword) 255 to:form_control::@return -@62: scope:[] from @58 - (byte) form_fields_cnt#73 ← phi( @58/(byte) form_fields_cnt#74 ) - (byte) form_field_idx#36 ← phi( @58/(byte) form_field_idx#4 ) - (byte) keyboard_modifiers#53 ← phi( @58/(byte) keyboard_modifiers#77 ) - (byte) keyboard_events_size#53 ← phi( @58/(byte) keyboard_events_size#77 ) - (signed byte) form_cursor_count#26 ← phi( @58/(signed byte) form_cursor_count#4 ) - (byte*) print_char_cursor#46 ← phi( @58/(byte*) print_char_cursor#56 ) - (byte*) print_line_cursor#44 ← phi( @58/(byte*) print_line_cursor#53 ) - (byte*) print_screen#25 ← phi( @58/(byte*) print_screen#33 ) +@65: scope:[] from @61 + (byte) form_fields_cnt#73 ← phi( @61/(byte) form_fields_cnt#74 ) + (byte) form_field_idx#36 ← phi( @61/(byte) form_field_idx#4 ) + (byte) keyboard_modifiers#53 ← phi( @61/(byte) keyboard_modifiers#77 ) + (byte) keyboard_events_size#53 ← phi( @61/(byte) keyboard_events_size#77 ) + (signed byte) form_cursor_count#26 ← phi( @61/(signed byte) form_cursor_count#4 ) + (byte*) print_char_cursor#46 ← phi( @61/(byte*) print_char_cursor#56 ) + (byte*) print_line_cursor#44 ← phi( @61/(byte*) print_line_cursor#53 ) + (byte*) print_screen#25 ← phi( @61/(byte*) print_screen#33 ) call main - to:@63 -@63: scope:[] from @62 - (byte) form_field_idx#24 ← phi( @62/(byte) form_field_idx#1 ) - (byte) keyboard_modifiers#33 ← phi( @62/(byte) keyboard_modifiers#9 ) - (byte) keyboard_events_size#36 ← phi( @62/(byte) keyboard_events_size#8 ) - (signed byte) form_cursor_count#17 ← phi( @62/(signed byte) form_cursor_count#1 ) - (byte*) print_char_cursor#36 ← phi( @62/(byte*) print_char_cursor#11 ) - (byte*) print_line_cursor#35 ← phi( @62/(byte*) print_line_cursor#10 ) - (byte*) print_screen#18 ← phi( @62/(byte*) print_screen#4 ) + to:@66 +@66: scope:[] from @65 + (byte) form_field_idx#24 ← phi( @65/(byte) form_field_idx#1 ) + (byte) keyboard_modifiers#33 ← phi( @65/(byte) keyboard_modifiers#9 ) + (byte) keyboard_events_size#36 ← phi( @65/(byte) keyboard_events_size#8 ) + (signed byte) form_cursor_count#17 ← phi( @65/(signed byte) form_cursor_count#1 ) + (byte*) print_char_cursor#36 ← phi( @65/(byte*) print_char_cursor#11 ) + (byte*) print_line_cursor#35 ← phi( @65/(byte*) print_line_cursor#10 ) + (byte*) print_screen#18 ← phi( @65/(byte*) print_screen#4 ) (byte*) print_screen#8 ← (byte*) print_screen#18 (byte*) print_line_cursor#18 ← (byte*) print_line_cursor#35 (byte*) print_char_cursor#19 ← (byte*) print_char_cursor#36 @@ -3659,7 +3659,7 @@ form_control::@30: scope:[form_control] from form_control::@9 (byte) keyboard_modifiers#16 ← (byte) keyboard_modifiers#33 (byte) form_field_idx#10 ← (byte) form_field_idx#24 to:@end -@end: scope:[] from @63 +@end: scope:[] from @66 SYMBOL TABLE SSA (byte~) $0 @@ -3765,18 +3765,18 @@ SYMBOL TABLE SSA (const string) $97 = (string) " nnnnnnnnnnnn mmmmmmmmmm jjjjjjjjj @" (const string) $98 = (string) " nnnnnnnnnnnn mmmmmmmmmm jjjjjjjjj @" (const string) $99 = (string) " nnnnnnnnnnnn mmmmmmmmmm jjjjjjjjj @" -(label) @14 -(label) @18 -(label) @22 +(label) @15 +(label) @21 (label) @25 +(label) @28 (label) @3 -(label) @34 (label) @37 -(label) @39 (label) @4 -(label) @58 -(label) @62 -(label) @63 +(label) @40 +(label) @42 +(label) @61 +(label) @65 +(label) @66 (label) @begin (label) @end (byte*) BGCOL @@ -8371,19 +8371,19 @@ Culled Empty Block (label) @4 Culled Empty Block (label) print_str_lines::@2 Culled Empty Block (label) print_str_lines::@11 Culled Empty Block (label) print_ln::@2 -Culled Empty Block (label) @14 +Culled Empty Block (label) @15 Culled Empty Block (label) print_cls::@2 -Culled Empty Block (label) @18 -Culled Empty Block (label) @22 +Culled Empty Block (label) @21 +Culled Empty Block (label) @25 Culled Empty Block (label) keyboard_event_scan::@2 Culled Empty Block (label) keyboard_event_scan::@6 Culled Empty Block (label) keyboard_event_scan::@12 Culled Empty Block (label) keyboard_event_get::@1 -Culled Empty Block (label) @25 +Culled Empty Block (label) @28 Culled Empty Block (label) bitmap_init::@6 Culled Empty Block (label) main::@8 Culled Empty Block (label) main::@10 -Culled Empty Block (label) @34 +Culled Empty Block (label) @37 Culled Empty Block (label) get_plane::@1 Culled Empty Block (label) get_plane::@2 Culled Empty Block (label) get_plane::@3 @@ -8405,7 +8405,7 @@ Culled Empty Block (label) get_vic_screen::@4 Culled Empty Block (label) get_vic_screen::@14 Culled Empty Block (label) get_vic_charset::@1 Culled Empty Block (label) get_vic_charset::@5 -Culled Empty Block (label) @37 +Culled Empty Block (label) @40 Culled Empty Block (label) apply_preset::@1 Culled Empty Block (label) apply_preset::@2 Culled Empty Block (label) apply_preset::@3 @@ -8428,7 +8428,7 @@ Culled Empty Block (label) render_preset_name::@8 Culled Empty Block (label) render_preset_name::@9 Culled Empty Block (label) render_preset_name::@10 Culled Empty Block (label) render_preset_name::@11 -Culled Empty Block (label) @39 +Culled Empty Block (label) @42 Culled Empty Block (label) gfx_mode::@12 Culled Empty Block (label) gfx_mode::@34 Culled Empty Block (label) gfx_mode::@17 @@ -8443,13 +8443,13 @@ Culled Empty Block (label) form_mode::@3 Culled Empty Block (label) form_mode::@6 Culled Empty Block (label) form_mode::@9 Culled Empty Block (label) form_mode::@33 -Culled Empty Block (label) @58 +Culled Empty Block (label) @61 Culled Empty Block (label) form_control::@6 Culled Empty Block (label) form_control::@8 Culled Empty Block (label) form_control::@11 Culled Empty Block (label) form_control::@13 Culled Empty Block (label) form_control::@14 -Culled Empty Block (label) @63 +Culled Empty Block (label) @66 Successful SSA optimization Pass2CullEmptyBlocks Alias (word) bitmap_plot::plotter_x#0 = (word~) bitmap_plot::$2 Alias (word) bitmap_plot::plotter_y#0 = (word~) bitmap_plot::$3 @@ -8984,7 +8984,7 @@ Added new block during phi lifting gfx_init_screen1::@6(between gfx_init_screen1 Added new block during phi lifting gfx_init_screen0::@5(between gfx_init_screen0::@3 and gfx_init_screen0::@1) Added new block during phi lifting gfx_init_screen0::@6(between gfx_init_screen0::@2 and gfx_init_screen0::@2) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @62 +Adding NOP phi() at start of @65 Adding NOP phi() at start of @end Adding NOP phi() at start of main::@7 Adding NOP phi() at start of main::@2 @@ -9453,7 +9453,7 @@ Culled Empty Block (label) gfx_init_screen1::@6 Culled Empty Block (label) gfx_init_screen0::@5 Culled Empty Block (label) gfx_init_screen0::@6 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @62 +Adding NOP phi() at start of @65 Adding NOP phi() at start of @end Adding NOP phi() at start of main::@7 Adding NOP phi() at start of main::@2 @@ -9531,14 +9531,14 @@ Adding NOP phi() at start of gfx_init_screen0 FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@62 -@62: scope:[] from @begin + to:@65 +@65: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @62 +@end: scope:[] from @65 [3] phi() [ ] ( ) -main: scope:[main] from @62 +main: scope:[main] from @65 asm { sei } [5] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 [ ] ( main:2 [ ] ) [6] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 [ ] ( main:2 [ ] ) @@ -13053,15 +13053,15 @@ INITIAL ASM .label form_field_idx = $20 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @62 [phi:@begin->@62] -b62_from_bbegin: - jmp b62 -//SEG4 @62 -b62: +//SEG3 [1] phi from @begin to @65 [phi:@begin->@65] +b65_from_bbegin: + jmp b65 +//SEG4 @65 +b65: //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @62 to @end [phi:@62->@end] -bend_from_b62: +//SEG6 [3] phi from @65 to @end [phi:@65->@end] +bend_from_b65: jmp bend //SEG7 @end bend: @@ -20155,15 +20155,15 @@ ASSEMBLER BEFORE OPTIMIZATION .label form_cursor_count = $e //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @62 [phi:@begin->@62] -b62_from_bbegin: - jmp b62 -//SEG4 @62 -b62: +//SEG3 [1] phi from @begin to @65 [phi:@begin->@65] +b65_from_bbegin: + jmp b65 +//SEG4 @65 +b65: //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @62 to @end [phi:@62->@end] -bend_from_b62: +//SEG6 [3] phi from @65 to @end [phi:@65->@end] +bend_from_b65: jmp bend //SEG7 @end bend: @@ -25161,7 +25161,7 @@ keyboard_init: { FORM_COLS: .text "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@"+" @"+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@"+" @"+" nnnnnnnnnnnn mmmmmmmmmm ooooooooo @"+" nnnnnnnnnnnn mmmmmmmmmm ooooooooo @"+" nnnnnnnnnnnn mmmmmmmmmm ooooooooo @"+" nnnnnnnnnnnn mmmmmmmmmm ooooooooo @"+" nnnnnnnnnnnn mmmmmmmmmm @"+" nnnnnnnnnnnn jjjjjjjjj @"+" nnnnnnnnnnnn mmmmmmmmmm jjjjjjjjj @"+" nnnnnnnnnnnn mmmmmmmmmm jjjjjjjjj @"+" nnnnnnnnnnnn mmmmmmmmmm jjjjjjjjj @"+" nnnnnnnnnnnn mmmmmmmmmm jjjjjjjjj @"+" nnnnnnnnnnnn mmmmmmmmmm jjjjjjjjj @"+" nnnnnnnnnnnn mmmmmmmmmm jjjjjjjjj @"+"@" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b62 +Removing instruction jmp b65 Removing instruction jmp bend Removing instruction jmp b7 Removing instruction jmp b1 @@ -25586,8 +25586,8 @@ Replacing label b1_from_b3 with b1 Replacing label b2_from_b2 with b2 Replacing label b1_from_b3 with b1 Removing instruction bbegin: -Removing instruction b62_from_bbegin: -Removing instruction bend_from_b62: +Removing instruction b65_from_bbegin: +Removing instruction bend_from_b65: Removing instruction b7_from_main: Removing instruction gfx_init_from_b7: Removing instruction b1: @@ -25802,7 +25802,7 @@ Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b62: +Removing instruction b65: Removing instruction bend: Removing instruction b7: Removing instruction b1_from_b7: @@ -26232,7 +26232,7 @@ Fixing long branch [722] beq b13 to bne Fixing long branch [1246] bmi b2 to bpl FINAL SYMBOL TABLE -(label) @62 +(label) @65 (label) @begin (label) @end (byte*) BGCOL @@ -27892,11 +27892,11 @@ Score: 11370475 .label keyboard_modifiers = 2 .label form_cursor_count = $e //SEG2 @begin -//SEG3 [1] phi from @begin to @62 [phi:@begin->@62] -//SEG4 @62 +//SEG3 [1] phi from @begin to @65 [phi:@begin->@65] +//SEG4 @65 //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @62 to @end [phi:@62->@end] +//SEG6 [3] phi from @65 to @end [phi:@65->@end] //SEG7 @end //SEG8 main main: { diff --git a/src/test/ref/c64dtv-gfxexplorer.sym b/src/test/ref/c64dtv-gfxexplorer.sym index 31575f4af..162e6495c 100644 --- a/src/test/ref/c64dtv-gfxexplorer.sym +++ b/src/test/ref/c64dtv-gfxexplorer.sym @@ -1,4 +1,4 @@ -(label) @62 +(label) @65 (label) @begin (label) @end (byte*) BGCOL diff --git a/src/test/ref/c64dtv-gfxmodes.cfg b/src/test/ref/c64dtv-gfxmodes.cfg index ebb540958..e128e5bbc 100644 --- a/src/test/ref/c64dtv-gfxmodes.cfg +++ b/src/test/ref/c64dtv-gfxmodes.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@48 -@48: scope:[] from @begin + to:@51 +@51: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @48 +@end: scope:[] from @51 [3] phi() [ ] ( ) -main: scope:[main] from @48 +main: scope:[main] from @51 asm { sei } [5] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 [ ] ( main:2 [ ] ) [6] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 [ ] ( main:2 [ ] ) diff --git a/src/test/ref/c64dtv-gfxmodes.log b/src/test/ref/c64dtv-gfxmodes.log index 038f2bf28..5300f31f4 100644 --- a/src/test/ref/c64dtv-gfxmodes.log +++ b/src/test/ref/c64dtv-gfxmodes.log @@ -75,7 +75,7 @@ dtvSetCpuBankSegment1::@return: scope:[dtvSetCpuBankSegment1] from dtvSetCpuBan (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@18 + to:@21 print_str_lines: scope:[print_str_lines] from menu::@48 (byte*) print_line_cursor#50 ← phi( menu::@48/(byte*) print_line_cursor#12 ) (byte*) print_char_cursor#52 ← phi( menu::@48/(byte*) print_char_cursor#13 ) @@ -202,7 +202,7 @@ print_set_screen::@return: scope:[print_set_screen] from print_set_screen (byte*) print_char_cursor#9 ← (byte*) print_char_cursor#23 return to:@return -@18: scope:[] from @4 +@21: scope:[] from @4 (byte*) print_char_cursor#99 ← phi( @4/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#99 ← phi( @4/(byte*) print_line_cursor#0 ) (byte*) print_screen#80 ← phi( @4/(byte*) print_screen#0 ) @@ -226,7 +226,7 @@ print_set_screen::@return: scope:[print_set_screen] from print_set_screen (byte) KEY_SPACE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 60 (byte[8]) keyboard_matrix_row_bitmask#0 ← { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } (byte[8]) keyboard_matrix_col_bitmask#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } - to:@25 + to:@28 keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_key_pressed (byte) keyboard_matrix_read::rowid#1 ← phi( keyboard_key_pressed/(byte) keyboard_matrix_read::rowid#0 ) *((byte*) CIA1_PORT_A#0) ← *((byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#1) @@ -261,16 +261,16 @@ keyboard_key_pressed::@return: scope:[keyboard_key_pressed] from keyboard_key_p (byte) keyboard_key_pressed::return#1 ← (byte) keyboard_key_pressed::return#22 return to:@return -@25: scope:[] from @18 - (byte*) print_char_cursor#85 ← phi( @18/(byte*) print_char_cursor#99 ) - (byte*) print_line_cursor#85 ← phi( @18/(byte*) print_line_cursor#99 ) - (byte*) print_screen#66 ← phi( @18/(byte*) print_screen#80 ) +@28: scope:[] from @21 + (byte*) print_char_cursor#85 ← phi( @21/(byte*) print_char_cursor#99 ) + (byte*) print_line_cursor#85 ← phi( @21/(byte*) print_line_cursor#99 ) + (byte*) print_screen#66 ← phi( @21/(byte*) print_screen#80 ) (byte[256]) bitmap_plot_xlo#0 ← { fill( 256, 0) } (byte[256]) bitmap_plot_xhi#0 ← { fill( 256, 0) } (byte[256]) bitmap_plot_ylo#0 ← { fill( 256, 0) } (byte[256]) bitmap_plot_yhi#0 ← { fill( 256, 0) } (byte[256]) bitmap_plot_bit#0 ← { fill( 256, 0) } - to:@34 + to:@37 bitmap_init: scope:[bitmap_init] from mode_stdbitmap::@7 (byte*) bitmap_init::bitmap#2 ← phi( mode_stdbitmap::@7/(byte*) bitmap_init::bitmap#0 ) (byte) bitmap_init::bits#0 ← (byte/word/signed word/dword/signed dword) 128 @@ -814,11 +814,11 @@ bitmap_line_ydxd::@3: scope:[bitmap_line_ydxd] from bitmap_line_ydxd::@5 bitmap_line_ydxd::@return: scope:[bitmap_line_ydxd] from bitmap_line_ydxd::@2 return to:@return -main: scope:[main] from @48 - (byte) dtv_control#130 ← phi( @48/(byte) dtv_control#129 ) - (byte*) print_char_cursor#55 ← phi( @48/(byte*) print_char_cursor#51 ) - (byte*) print_line_cursor#52 ← phi( @48/(byte*) print_line_cursor#49 ) - (byte*) print_screen#34 ← phi( @48/(byte*) print_screen#33 ) +main: scope:[main] from @51 + (byte) dtv_control#130 ← phi( @51/(byte) dtv_control#129 ) + (byte*) print_char_cursor#55 ← phi( @51/(byte*) print_char_cursor#51 ) + (byte*) print_line_cursor#52 ← phi( @51/(byte*) print_line_cursor#49 ) + (byte*) print_screen#34 ← phi( @51/(byte*) print_screen#33 ) asm { sei } *((byte*) PROCPORT_DDR#0) ← (byte) PROCPORT_DDR_MEMORY_MASK#0 *((byte*) PROCPORT#0) ← (byte) PROCPORT_RAM_IO#0 @@ -859,10 +859,10 @@ main::@return: scope:[main] from main::@1 (byte) dtv_control#1 ← (byte) dtv_control#56 return to:@return -@34: scope:[] from @25 - (byte*) print_char_cursor#84 ← phi( @25/(byte*) print_char_cursor#85 ) - (byte*) print_line_cursor#83 ← phi( @25/(byte*) print_line_cursor#85 ) - (byte*) print_screen#65 ← phi( @25/(byte*) print_screen#66 ) +@37: scope:[] from @28 + (byte*) print_char_cursor#84 ← phi( @28/(byte*) print_char_cursor#85 ) + (byte*) print_line_cursor#83 ← phi( @28/(byte*) print_line_cursor#85 ) + (byte*) print_screen#65 ← phi( @28/(byte*) print_screen#66 ) (string~) $1 ← (const string) $21 + (const string) $22 (string~) $2 ← (string~) $1 + (const string) $23 (string~) $3 ← (string~) $2 + (const string) $24 @@ -884,7 +884,7 @@ main::@return: scope:[main] from main::@1 (string~) $19 ← (string~) $18 + (const string) $40 (string~) $20 ← (string~) $19 + (const string) $41 (byte[]) MENU_TEXT#0 ← (string~) $20 - to:@35 + to:@38 menu: scope:[menu] from main::@2 (byte) dtv_control#255 ← phi( main::@2/(byte) dtv_control#98 ) (byte*) print_char_cursor#100 ← phi( main::@2/(byte*) print_char_cursor#35 ) @@ -1426,12 +1426,12 @@ menu::@73: scope:[menu] from menu::@44 (byte) dtv_control#69 ← phi( menu::@44/(byte) dtv_control#53 ) (byte) dtv_control#14 ← (byte) dtv_control#69 to:menu::@return -@35: scope:[] from @34 - (byte*) print_char_cursor#70 ← phi( @34/(byte*) print_char_cursor#84 ) - (byte*) print_line_cursor#67 ← phi( @34/(byte*) print_line_cursor#83 ) - (byte*) print_screen#50 ← phi( @34/(byte*) print_screen#65 ) +@38: scope:[] from @37 + (byte*) print_char_cursor#70 ← phi( @37/(byte*) print_char_cursor#84 ) + (byte*) print_line_cursor#67 ← phi( @37/(byte*) print_line_cursor#83 ) + (byte*) print_screen#50 ← phi( @37/(byte*) print_screen#65 ) (byte) dtv_control#15 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:@48 + to:@51 mode_ctrl: scope:[mode_ctrl] from mode_8bppchunkybmm::@11 mode_8bpppixelcell::@14 mode_ecmchar::@6 mode_hicolecmchar::@6 mode_hicolmcchar::@6 mode_hicolstdchar::@6 mode_mcchar::@6 mode_sixsfred2::@14 mode_sixsfred::@14 mode_stdbitmap::@8 mode_stdchar::@6 mode_twoplanebitmap::@18 (byte) dtv_control#145 ← phi( mode_8bppchunkybmm::@11/(byte) dtv_control#128 mode_8bpppixelcell::@14/(byte) dtv_control#127 mode_ecmchar::@6/(byte) dtv_control#118 mode_hicolecmchar::@6/(byte) dtv_control#122 mode_hicolmcchar::@6/(byte) dtv_control#123 mode_hicolstdchar::@6/(byte) dtv_control#121 mode_mcchar::@6/(byte) dtv_control#119 mode_sixsfred2::@14/(byte) dtv_control#126 mode_sixsfred::@14/(byte) dtv_control#125 mode_stdbitmap::@8/(byte) dtv_control#120 mode_stdchar::@6/(byte) dtv_control#117 mode_twoplanebitmap::@18/(byte) dtv_control#124 ) to:mode_ctrl::@1 @@ -3207,24 +3207,24 @@ mode_8bppchunkybmm::@return: scope:[mode_8bppchunkybmm] from mode_8bppchunkybmm (byte) dtv_control#53 ← (byte) dtv_control#96 return to:@return -@48: scope:[] from @35 - (byte) dtv_control#129 ← phi( @35/(byte) dtv_control#15 ) - (byte*) print_char_cursor#51 ← phi( @35/(byte*) print_char_cursor#70 ) - (byte*) print_line_cursor#49 ← phi( @35/(byte*) print_line_cursor#67 ) - (byte*) print_screen#33 ← phi( @35/(byte*) print_screen#50 ) +@51: scope:[] from @38 + (byte) dtv_control#129 ← phi( @38/(byte) dtv_control#15 ) + (byte*) print_char_cursor#51 ← phi( @38/(byte*) print_char_cursor#70 ) + (byte*) print_line_cursor#49 ← phi( @38/(byte*) print_line_cursor#67 ) + (byte*) print_screen#33 ← phi( @38/(byte*) print_screen#50 ) call main - to:@49 -@49: scope:[] from @48 - (byte) dtv_control#97 ← phi( @48/(byte) dtv_control#1 ) - (byte*) print_char_cursor#30 ← phi( @48/(byte*) print_char_cursor#11 ) - (byte*) print_line_cursor#29 ← phi( @48/(byte*) print_line_cursor#10 ) - (byte*) print_screen#16 ← phi( @48/(byte*) print_screen#4 ) + to:@52 +@52: scope:[] from @51 + (byte) dtv_control#97 ← phi( @51/(byte) dtv_control#1 ) + (byte*) print_char_cursor#30 ← phi( @51/(byte*) print_char_cursor#11 ) + (byte*) print_line_cursor#29 ← phi( @51/(byte*) print_line_cursor#10 ) + (byte*) print_screen#16 ← phi( @51/(byte*) print_screen#4 ) (byte*) print_screen#7 ← (byte*) print_screen#16 (byte*) print_line_cursor#15 ← (byte*) print_line_cursor#29 (byte*) print_char_cursor#16 ← (byte*) print_char_cursor#30 (byte) dtv_control#54 ← (byte) dtv_control#97 to:@end -@end: scope:[] from @49 +@end: scope:[] from @52 SYMBOL TABLE SSA (string~) $1 @@ -3268,14 +3268,14 @@ SYMBOL TABLE SSA (string~) $7 (string~) $8 (string~) $9 -(label) @18 -(label) @25 +(label) @21 +(label) @28 (label) @3 -(label) @34 -(label) @35 +(label) @37 +(label) @38 (label) @4 -(label) @48 -(label) @49 +(label) @51 +(label) @52 (label) @begin (label) @end (byte*) BGCOL @@ -7410,11 +7410,11 @@ Culled Empty Block (label) print_str_lines::@2 Culled Empty Block (label) print_str_lines::@11 Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) print_cls::@2 -Culled Empty Block (label) @18 -Culled Empty Block (label) @25 +Culled Empty Block (label) @21 +Culled Empty Block (label) @28 Culled Empty Block (label) bitmap_init::@6 Culled Empty Block (label) main::@7 -Culled Empty Block (label) @34 +Culled Empty Block (label) @37 Culled Empty Block (label) menu::@18 Culled Empty Block (label) menu::@49 Culled Empty Block (label) menu::@3 @@ -7431,7 +7431,7 @@ Culled Empty Block (label) menu::@70 Culled Empty Block (label) menu::@72 Culled Empty Block (label) menu::@17 Culled Empty Block (label) menu::@73 -Culled Empty Block (label) @35 +Culled Empty Block (label) @38 Culled Empty Block (label) mode_ctrl::@2 Culled Empty Block (label) mode_ctrl::@5 Culled Empty Block (label) mode_ctrl::@15 @@ -7456,7 +7456,7 @@ Culled Empty Block (label) mode_8bpppixelcell::@8 Culled Empty Block (label) mode_8bpppixelcell::@15 Culled Empty Block (label) mode_8bppchunkybmm::@9 Culled Empty Block (label) mode_8bppchunkybmm::@12 -Culled Empty Block (label) @49 +Culled Empty Block (label) @52 Successful SSA optimization Pass2CullEmptyBlocks Alias (word) bitmap_plot::plotter_x#0 = (word~) bitmap_plot::$2 Alias (word) bitmap_plot::plotter_y#0 = (word~) bitmap_plot::$3 @@ -8067,7 +8067,7 @@ Added new block during phi lifting print_str_lines::@14(between print_str_lines: Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @48 +Adding NOP phi() at start of @51 Adding NOP phi() at start of @end Adding NOP phi() at start of main::@2 Adding NOP phi() at start of menu::@47 @@ -8506,7 +8506,7 @@ Culled Empty Block (label) print_str_lines::@14 Culled Empty Block (label) print_ln::@3 Culled Empty Block (label) print_cls::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @48 +Adding NOP phi() at start of @51 Adding NOP phi() at start of @end Adding NOP phi() at start of main::@2 Adding NOP phi() at start of menu::@47 @@ -8563,14 +8563,14 @@ Adding NOP phi() at start of print_set_screen FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@48 -@48: scope:[] from @begin + to:@51 +@51: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @48 +@end: scope:[] from @51 [3] phi() [ ] ( ) -main: scope:[main] from @48 +main: scope:[main] from @51 asm { sei } [5] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 [ ] ( main:2 [ ] ) [6] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 [ ] ( main:2 [ ] ) @@ -11810,15 +11810,15 @@ INITIAL ASM .label print_line_cursor = $9d //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @48 [phi:@begin->@48] -b48_from_bbegin: - jmp b48 -//SEG4 @48 -b48: +//SEG3 [1] phi from @begin to @51 [phi:@begin->@51] +b51_from_bbegin: + jmp b51 +//SEG4 @51 +b51: //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @48 to @end [phi:@48->@end] -bend_from_b48: +//SEG6 [3] phi from @51 to @end [phi:@51->@end] +bend_from_b51: jmp bend //SEG7 @end bend: @@ -18430,15 +18430,15 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = $d //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @48 [phi:@begin->@48] -b48_from_bbegin: - jmp b48 -//SEG4 @48 -b48: +//SEG3 [1] phi from @begin to @51 [phi:@begin->@51] +b51_from_bbegin: + jmp b51 +//SEG4 @51 +b51: //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @48 to @end [phi:@48->@end] -bend_from_b48: +//SEG6 [3] phi from @51 to @end [phi:@51->@end] +bend_from_b51: jmp bend //SEG7 @end bend: @@ -22895,7 +22895,7 @@ print_set_screen: { MENU_TEXT: .text "C64DTV Graphics Modes CCLHBME@"+" OHIIMCC@"+" LUNCMMM@"+"----------------------------------------@"+"1. Standard Char (V) 0000000@"+"2. Extended Color Char (V) 0000001@"+"3. Multicolor Char (V) 0000010@"+"4. Standard Bitmap (V) 0000100@"+"5. Multicolor Bitmap (V) 0000110@"+"6. High Color Standard Char (H) 0001000@"+"7. High Extended Color Char (H) 0001001@"+"8. High Multicolor Char (H) 0001010@"+"9. High Multicolor Bitmap (H) 0001110@"+"a. Sixs Fred 2 (D) 0010111@"+"b. Two Plane Bitmap (D) 0011101@"+"c. Sixs Fred (2 Plane MC BM) (D) 0011111@"+"d. 8bpp Pixel Cell (D) 0111011@"+"e. Chunky 8bpp Bitmap (D) 1111011@"+"----------------------------------------@"+" (V) vicII (H) vicII+hicol (D) c64dtv@"+"@" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b48 +Removing instruction jmp b51 Removing instruction jmp bend Removing instruction jmp b2 Removing instruction jmp b1 @@ -23281,8 +23281,8 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b48_from_bbegin: -Removing instruction bend_from_b48: +Removing instruction b51_from_bbegin: +Removing instruction bend_from_b51: Removing instruction b2_from_main: Removing instruction b2_from_b2: Removing instruction b1_from_b1: @@ -23491,7 +23491,7 @@ Removing instruction b1_from_print_ln: Removing instruction b1_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b48: +Removing instruction b51: Removing instruction bend: Removing instruction b1_from_menu: Removing instruction b2_from_b1: @@ -23781,7 +23781,7 @@ Succesful ASM optimization Pass5UnreachableCodeElimination Fixing long branch [227] beq b4 to bne FINAL SYMBOL TABLE -(label) @48 +(label) @51 (label) @begin (label) @end (byte*) BGCOL @@ -25207,11 +25207,11 @@ Score: 2305878 .label dtv_control = 4 .label print_line_cursor = $d //SEG2 @begin -//SEG3 [1] phi from @begin to @48 [phi:@begin->@48] -//SEG4 @48 +//SEG3 [1] phi from @begin to @51 [phi:@begin->@51] +//SEG4 @51 //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @48 to @end [phi:@48->@end] +//SEG6 [3] phi from @51 to @end [phi:@51->@end] //SEG7 @end //SEG8 main main: { diff --git a/src/test/ref/c64dtv-gfxmodes.sym b/src/test/ref/c64dtv-gfxmodes.sym index e0e00d506..0c03b392b 100644 --- a/src/test/ref/c64dtv-gfxmodes.sym +++ b/src/test/ref/c64dtv-gfxmodes.sym @@ -1,4 +1,4 @@ -(label) @48 +(label) @51 (label) @begin (label) @end (byte*) BGCOL diff --git a/src/test/ref/constants.cfg b/src/test/ref/constants.cfg index 9e7c09c61..a9b7a8292 100644 --- a/src/test/ref/constants.cfg +++ b/src/test/ref/constants.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@19 -@19: scope:[] from @begin + to:@22 +@22: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @19 +@end: scope:[] from @22 [3] phi() [ ] ( ) -main: scope:[main] from @19 +main: scope:[main] from @22 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 diff --git a/src/test/ref/constants.log b/src/test/ref/constants.log index 08c1830f3..8dfed1dad 100644 --- a/src/test/ref/constants.log +++ b/src/test/ref/constants.log @@ -4,7 +4,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@14 + to:@17 print_str: scope:[print_str] from assert_byte assert_byte::@1 assert_byte::@3 assert_byte::@5 assert_sbyte assert_sbyte::@1 assert_sbyte::@3 assert_sbyte::@5 (byte*) print_char_cursor#80 ← phi( assert_byte/(byte*) print_char_cursor#70 assert_byte::@1/(byte*) print_char_cursor#71 assert_byte::@3/(byte*) print_char_cursor#72 assert_byte::@5/(byte*) print_char_cursor#15 assert_sbyte/(byte*) print_char_cursor#75 assert_sbyte::@1/(byte*) print_char_cursor#76 assert_sbyte::@3/(byte*) print_char_cursor#77 assert_sbyte::@5/(byte*) print_char_cursor#27 ) (byte*) print_str::str#11 ← phi( assert_byte/(byte*) print_str::str#1 assert_byte::@1/(byte*) print_str::str#3 assert_byte::@3/(byte*) print_str::str#4 assert_byte::@5/(byte*) print_str::str#2 assert_sbyte/(byte*) print_str::str#5 assert_sbyte::@1/(byte*) print_str::str#7 assert_sbyte::@3/(byte*) print_str::str#8 assert_sbyte::@5/(byte*) print_str::str#6 ) @@ -75,18 +75,18 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#6 ← (byte*) print_char_cursor#38 return to:@return -@14: scope:[] from @begin +@17: scope:[] from @begin (byte*) print_screen#6 ← phi( @begin/(byte*) print_screen#0 ) (byte*) print_char_cursor#81 ← phi( @begin/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#58 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53281 (byte) GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 5 (byte) RED#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2 - to:@19 -main: scope:[main] from @19 - (byte*) print_char_cursor#68 ← phi( @19/(byte*) print_char_cursor#79 ) - (byte*) print_line_cursor#48 ← phi( @19/(byte*) print_line_cursor#53 ) - (byte*) print_screen#4 ← phi( @19/(byte*) print_screen#5 ) + to:@22 +main: scope:[main] from @22 + (byte*) print_char_cursor#68 ← phi( @22/(byte*) print_char_cursor#79 ) + (byte*) print_line_cursor#48 ← phi( @22/(byte*) print_line_cursor#53 ) + (byte*) print_screen#4 ← phi( @22/(byte*) print_screen#5 ) call print_cls to:main::@1 main::@1: scope:[main] from main @@ -379,24 +379,24 @@ assert_sbyte::@return: scope:[assert_sbyte] from assert_sbyte::@9 (byte*) print_line_cursor#22 ← (byte*) print_line_cursor#45 return to:@return -@19: scope:[] from @14 - (byte*) print_screen#5 ← phi( @14/(byte*) print_screen#6 ) - (byte*) print_char_cursor#79 ← phi( @14/(byte*) print_char_cursor#81 ) - (byte*) print_line_cursor#53 ← phi( @14/(byte*) print_line_cursor#58 ) +@22: scope:[] from @17 + (byte*) print_screen#5 ← phi( @17/(byte*) print_screen#6 ) + (byte*) print_char_cursor#79 ← phi( @17/(byte*) print_char_cursor#81 ) + (byte*) print_line_cursor#53 ← phi( @17/(byte*) print_line_cursor#58 ) call main - to:@20 -@20: scope:[] from @19 - (byte*) print_char_cursor#65 ← phi( @19/(byte*) print_char_cursor#10 ) - (byte*) print_line_cursor#46 ← phi( @19/(byte*) print_line_cursor#8 ) + to:@23 +@23: scope:[] from @22 + (byte*) print_char_cursor#65 ← phi( @22/(byte*) print_char_cursor#10 ) + (byte*) print_line_cursor#46 ← phi( @22/(byte*) print_line_cursor#8 ) (byte*) print_line_cursor#23 ← (byte*) print_line_cursor#46 (byte*) print_char_cursor#33 ← (byte*) print_char_cursor#65 to:@end -@end: scope:[] from @20 +@end: scope:[] from @23 SYMBOL TABLE SSA -(label) @14 -(label) @19 -(label) @20 +(label) @17 +(label) @22 +(label) @23 (label) @begin (label) @end (byte*) BGCOL @@ -909,7 +909,7 @@ Constant (const byte) assert_byte::b#2 = test_bytes::bd#0 Successful SSA optimization Pass2ConstantIdentification Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) print_cls::@2 -Culled Empty Block (label) @14 +Culled Empty Block (label) @17 Culled Empty Block (label) main::@3 Culled Empty Block (label) test_bytes::@3 Culled Empty Block (label) assert_byte::@7 @@ -919,7 +919,7 @@ Culled Empty Block (label) test_sbytes::@5 Culled Empty Block (label) assert_sbyte::@7 Culled Empty Block (label) assert_sbyte::@8 Culled Empty Block (label) assert_sbyte::@9 -Culled Empty Block (label) @20 +Culled Empty Block (label) @23 Successful SSA optimization Pass2CullEmptyBlocks Inlining constant with var siblings (const byte*) print_str::str#2 Inlining constant with var siblings (const byte*) print_str::str#3 @@ -994,7 +994,7 @@ Successful SSA optimization Pass2ConstantInlining Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @19 +Adding NOP phi() at start of @22 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@2 @@ -1041,7 +1041,7 @@ Coalesced down to 10 phi equivalence classes Culled Empty Block (label) print_ln::@3 Culled Empty Block (label) print_cls::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @19 +Adding NOP phi() at start of @22 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@2 @@ -1062,14 +1062,14 @@ Adding NOP phi() at start of print_cls FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@19 -@19: scope:[] from @begin + to:@22 +@22: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @19 +@end: scope:[] from @22 [3] phi() [ ] ( ) -main: scope:[main] from @19 +main: scope:[main] from @22 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 @@ -1327,17 +1327,17 @@ INITIAL ASM .label print_line_cursor = $a //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @19 [phi:@begin->@19] -b19_from_bbegin: - jmp b19 -//SEG4 @19 -b19: +//SEG3 [1] phi from @begin to @22 [phi:@begin->@22] +b22_from_bbegin: + jmp b22 +//SEG4 @22 +b22: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @19 to main [phi:@19->main] -main_from_b19: +//SEG6 [4] phi from @22 to main [phi:@22->main] +main_from_b22: jsr main -//SEG7 [3] phi from @19 to @end [phi:@19->@end] -bend_from_b19: +//SEG7 [3] phi from @22 to @end [phi:@22->@end] +bend_from_b22: jmp bend //SEG8 @end bend: @@ -1962,17 +1962,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = 7 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @19 [phi:@begin->@19] -b19_from_bbegin: - jmp b19 -//SEG4 @19 -b19: +//SEG3 [1] phi from @begin to @22 [phi:@begin->@22] +b22_from_bbegin: + jmp b22 +//SEG4 @22 +b22: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @19 to main [phi:@19->main] -main_from_b19: +//SEG6 [4] phi from @22 to main [phi:@22->main] +main_from_b22: jsr main -//SEG7 [3] phi from @19 to @end [phi:@19->@end] -bend_from_b19: +//SEG7 [3] phi from @22 to @end [phi:@22->@end] +bend_from_b22: jmp bend //SEG8 @end bend: @@ -2487,7 +2487,7 @@ print_cls: { } ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b19 +Removing instruction jmp b22 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b2 @@ -2527,9 +2527,9 @@ Replacing label b2_from_b1 with b2 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b19_from_bbegin: -Removing instruction main_from_b19: -Removing instruction bend_from_b19: +Removing instruction b22_from_bbegin: +Removing instruction main_from_b22: +Removing instruction bend_from_b22: Removing instruction b2_from_b1: Removing instruction test_sbytes_from_b2: Removing instruction b1_from_test_sbytes: @@ -2560,7 +2560,7 @@ Removing instruction b2_from_b3: Removing instruction print_ln_from_b2: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b19: +Removing instruction b22: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -2600,7 +2600,7 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination FINAL SYMBOL TABLE -(label) @19 +(label) @22 (label) @begin (label) @end (byte*) BGCOL @@ -2735,12 +2735,12 @@ Score: 1846 .label print_char_cursor = 5 .label print_line_cursor = 7 //SEG2 @begin -//SEG3 [1] phi from @begin to @19 [phi:@begin->@19] -//SEG4 @19 +//SEG3 [1] phi from @begin to @22 [phi:@begin->@22] +//SEG4 @22 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @19 to main [phi:@19->main] +//SEG6 [4] phi from @22 to main [phi:@22->main] jsr main -//SEG7 [3] phi from @19 to @end [phi:@19->@end] +//SEG7 [3] phi from @22 to @end [phi:@22->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/constants.sym b/src/test/ref/constants.sym index c1d59c144..b8ca39eaf 100644 --- a/src/test/ref/constants.sym +++ b/src/test/ref/constants.sym @@ -1,4 +1,4 @@ -(label) @19 +(label) @22 (label) @begin (label) @end (byte*) BGCOL diff --git a/src/test/ref/examples/3d/perspective.cfg b/src/test/ref/examples/3d/perspective.cfg index 1da2353d6..7507e0402 100644 --- a/src/test/ref/examples/3d/perspective.cfg +++ b/src/test/ref/examples/3d/perspective.cfg @@ -1,7 +1,7 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@21 -@21: scope:[] from @begin + to:@24 +@24: scope:[] from @begin kickasm(location (const signed byte*) PERSP_Z#0) {{ { .var d = 256.0 .var z0 = 5.0 @@ -16,9 +16,9 @@ }} [2] call main [ ] ( ) to:@end -@end: scope:[] from @21 +@end: scope:[] from @24 [3] phi() [ ] ( ) -main: scope:[main] from @21 +main: scope:[main] from @24 asm { sei } [5] call mulf_init [ ] ( main:2 [ ] ) to:main::@1 diff --git a/src/test/ref/examples/3d/perspective.log b/src/test/ref/examples/3d/perspective.log index 72d4937fa..d0861b32e 100644 --- a/src/test/ref/examples/3d/perspective.log +++ b/src/test/ref/examples/3d/perspective.log @@ -9,7 +9,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@13 + to:@14 print_str: scope:[print_str] from do_perspective do_perspective::@11 do_perspective::@2 do_perspective::@4 do_perspective::@6 do_perspective::@9 (byte*) print_char_cursor#71 ← phi( do_perspective/(byte*) print_char_cursor#68 do_perspective::@11/(byte*) print_char_cursor#27 do_perspective::@2/(byte*) print_char_cursor#19 do_perspective::@4/(byte*) print_char_cursor#21 do_perspective::@6/(byte*) print_char_cursor#23 do_perspective::@9/(byte*) print_char_cursor#25 ) (byte*) print_str::str#9 ← phi( do_perspective/(byte*) print_str::str#1 do_perspective::@11/(byte*) print_str::str#6 do_perspective::@2/(byte*) print_str::str#2 do_perspective::@4/(byte*) print_str::str#3 do_perspective::@6/(byte*) print_str::str#4 do_perspective::@9/(byte*) print_str::str#5 ) @@ -91,12 +91,12 @@ print_sbyte::@return: scope:[print_sbyte] from print_sbyte::@3 (byte*) print_char_cursor#7 ← (byte*) print_char_cursor#38 return to:@return -@13: scope:[] from @3 +@14: scope:[] from @3 (byte*) print_screen#9 ← phi( @3/(byte*) print_screen#0 ) (byte*) print_char_cursor#76 ← phi( @3/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#30 ← phi( @3/(byte*) print_line_cursor#0 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@17 + to:@20 print_byte: scope:[print_byte] from do_perspective::@10 do_perspective::@8 print_sbyte::@1 (byte*) print_char_cursor#66 ← phi( do_perspective::@10/(byte*) print_char_cursor#26 do_perspective::@8/(byte*) print_char_cursor#69 print_sbyte::@1/(byte*) print_char_cursor#64 ) (byte) print_byte::b#3 ← phi( do_perspective::@10/(byte) print_byte::b#2 do_perspective::@8/(byte) print_byte::b#1 print_sbyte::@1/(byte) print_byte::b#0 ) @@ -157,25 +157,25 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#14 ← (byte*) print_char_cursor#44 return to:@return -@17: scope:[] from @13 - (byte*) print_screen#8 ← phi( @13/(byte*) print_screen#9 ) - (byte*) print_char_cursor#75 ← phi( @13/(byte*) print_char_cursor#76 ) - (byte*) print_line_cursor#29 ← phi( @13/(byte*) print_line_cursor#30 ) +@20: scope:[] from @14 + (byte*) print_screen#8 ← phi( @14/(byte*) print_screen#9 ) + (byte*) print_char_cursor#75 ← phi( @14/(byte*) print_char_cursor#76 ) + (byte*) print_line_cursor#29 ← phi( @14/(byte*) print_line_cursor#30 ) (signed byte*) xr#0 ← ((signed byte*)) (byte/word/signed word/dword/signed dword) 240 (signed byte*) yr#0 ← ((signed byte*)) (byte/word/signed word/dword/signed dword) 241 (signed byte*) zr#0 ← ((signed byte*)) (byte/word/signed word/dword/signed dword) 242 (word*) psp1#0 ← ((word*)) (byte/word/signed word/dword/signed dword) 243 (word*) psp2#0 ← ((word*)) (byte/word/signed word/dword/signed dword) 245 - to:@20 -main: scope:[main] from @21 - (signed byte*) zr#12 ← phi( @21/(signed byte*) zr#13 ) - (signed byte*) yr#15 ← phi( @21/(signed byte*) yr#16 ) - (signed byte*) xr#13 ← phi( @21/(signed byte*) xr#14 ) - (byte*) print_char_cursor#73 ← phi( @21/(byte*) print_char_cursor#70 ) - (byte*) print_line_cursor#25 ← phi( @21/(byte*) print_line_cursor#24 ) - (byte*) print_screen#5 ← phi( @21/(byte*) print_screen#6 ) - (word*) psp2#2 ← phi( @21/(word*) psp2#3 ) - (word*) psp1#2 ← phi( @21/(word*) psp1#3 ) + to:@23 +main: scope:[main] from @24 + (signed byte*) zr#12 ← phi( @24/(signed byte*) zr#13 ) + (signed byte*) yr#15 ← phi( @24/(signed byte*) yr#16 ) + (signed byte*) xr#13 ← phi( @24/(signed byte*) xr#14 ) + (byte*) print_char_cursor#73 ← phi( @24/(byte*) print_char_cursor#70 ) + (byte*) print_line_cursor#25 ← phi( @24/(byte*) print_line_cursor#24 ) + (byte*) print_screen#5 ← phi( @24/(byte*) print_screen#6 ) + (word*) psp2#2 ← phi( @24/(word*) psp2#3 ) + (word*) psp1#2 ← phi( @24/(word*) psp1#3 ) asm { sei } call mulf_init to:main::@1 @@ -393,18 +393,18 @@ perspective: scope:[perspective] from do_perspective::@7 perspective::@return: scope:[perspective] from perspective return to:@return -@20: scope:[] from @17 - (signed byte*) zr#14 ← phi( @17/(signed byte*) zr#0 ) - (signed byte*) yr#17 ← phi( @17/(signed byte*) yr#0 ) - (signed byte*) xr#15 ← phi( @17/(signed byte*) xr#0 ) - (byte*) print_screen#7 ← phi( @17/(byte*) print_screen#8 ) - (word*) psp2#4 ← phi( @17/(word*) psp2#0 ) - (word*) psp1#4 ← phi( @17/(word*) psp1#0 ) - (byte*) print_char_cursor#74 ← phi( @17/(byte*) print_char_cursor#75 ) - (byte*) print_line_cursor#27 ← phi( @17/(byte*) print_line_cursor#29 ) +@23: scope:[] from @20 + (signed byte*) zr#14 ← phi( @20/(signed byte*) zr#0 ) + (signed byte*) yr#17 ← phi( @20/(signed byte*) yr#0 ) + (signed byte*) xr#15 ← phi( @20/(signed byte*) xr#0 ) + (byte*) print_screen#7 ← phi( @20/(byte*) print_screen#8 ) + (word*) psp2#4 ← phi( @20/(word*) psp2#0 ) + (word*) psp1#4 ← phi( @20/(word*) psp1#0 ) + (byte*) print_char_cursor#74 ← phi( @20/(byte*) print_char_cursor#75 ) + (byte*) print_line_cursor#27 ← phi( @20/(byte*) print_line_cursor#29 ) (byte[512]) mulf_sqr1#0 ← { fill( 512, 0) } (byte[512]) mulf_sqr2#0 ← { fill( 512, 0) } - to:@21 + to:@24 mulf_init: scope:[mulf_init] from main (signed word) mulf_init::sqr#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 (signed word) mulf_init::add#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1 @@ -443,15 +443,15 @@ mulf_init::@1: scope:[mulf_init] from mulf_init mulf_init::@1 mulf_init::@return: scope:[mulf_init] from mulf_init::@1 return to:@return -@21: scope:[] from @20 - (signed byte*) zr#13 ← phi( @20/(signed byte*) zr#14 ) - (signed byte*) yr#16 ← phi( @20/(signed byte*) yr#17 ) - (signed byte*) xr#14 ← phi( @20/(signed byte*) xr#15 ) - (byte*) print_screen#6 ← phi( @20/(byte*) print_screen#7 ) - (word*) psp2#3 ← phi( @20/(word*) psp2#4 ) - (word*) psp1#3 ← phi( @20/(word*) psp1#4 ) - (byte*) print_char_cursor#70 ← phi( @20/(byte*) print_char_cursor#74 ) - (byte*) print_line_cursor#24 ← phi( @20/(byte*) print_line_cursor#27 ) +@24: scope:[] from @23 + (signed byte*) zr#13 ← phi( @23/(signed byte*) zr#14 ) + (signed byte*) yr#16 ← phi( @23/(signed byte*) yr#17 ) + (signed byte*) xr#14 ← phi( @23/(signed byte*) xr#15 ) + (byte*) print_screen#6 ← phi( @23/(byte*) print_screen#7 ) + (word*) psp2#3 ← phi( @23/(word*) psp2#4 ) + (word*) psp1#3 ← phi( @23/(word*) psp1#4 ) + (byte*) print_char_cursor#70 ← phi( @23/(byte*) print_char_cursor#74 ) + (byte*) print_line_cursor#24 ← phi( @23/(byte*) print_line_cursor#27 ) (signed byte*) PERSP_Z#0 ← ((signed byte*)) (word/signed word/dword/signed dword) 9216 kickasm(location (signed byte*) PERSP_Z#0) {{ { .var d = 256.0 @@ -466,22 +466,22 @@ mulf_init::@return: scope:[mulf_init] from mulf_init::@1 } }} call main - to:@22 -@22: scope:[] from @21 - (byte*) print_char_cursor#61 ← phi( @21/(byte*) print_char_cursor#17 ) - (byte*) print_line_cursor#20 ← phi( @21/(byte*) print_line_cursor#7 ) + to:@25 +@25: scope:[] from @24 + (byte*) print_char_cursor#61 ← phi( @24/(byte*) print_char_cursor#17 ) + (byte*) print_line_cursor#20 ← phi( @24/(byte*) print_line_cursor#7 ) (byte*) print_line_cursor#10 ← (byte*) print_line_cursor#20 (byte*) print_char_cursor#31 ← (byte*) print_char_cursor#61 to:@end -@end: scope:[] from @22 +@end: scope:[] from @25 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" -(label) @13 -(label) @17 +(label) @14 (label) @20 -(label) @21 -(label) @22 +(label) @23 +(label) @24 +(label) @25 (label) @3 (label) @begin (label) @end @@ -1036,14 +1036,14 @@ Resolved ranged comparison value if(mulf_init::i#1!=rangelast(0,128)) goto mulf_ Culled Empty Block (label) @3 Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) print_sbyte::@3 -Culled Empty Block (label) @13 +Culled Empty Block (label) @14 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 -Culled Empty Block (label) @17 +Culled Empty Block (label) @20 Culled Empty Block (label) main::@3 Culled Empty Block (label) do_perspective::@13 -Culled Empty Block (label) @20 -Culled Empty Block (label) @22 +Culled Empty Block (label) @23 +Culled Empty Block (label) @25 Successful SSA optimization Pass2CullEmptyBlocks Alias (byte) mulf_init::i#2 = (byte~) mulf_init::$5 (byte~) mulf_init::$7 Successful SSA optimization Pass2AliasElimination @@ -1166,8 +1166,8 @@ Adding NOP phi() at start of mulf_init FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@21 -@21: scope:[] from @begin + to:@24 +@24: scope:[] from @begin kickasm(location (const signed byte*) PERSP_Z#0) {{ { .var d = 256.0 .var z0 = 5.0 @@ -1182,9 +1182,9 @@ FINAL CONTROL FLOW GRAPH }} [2] call main [ ] ( ) to:@end -@end: scope:[] from @21 +@end: scope:[] from @24 [3] phi() [ ] ( ) -main: scope:[main] from @21 +main: scope:[main] from @24 asm { sei } [5] call mulf_init [ ] ( main:2 [ ] ) to:main::@1 @@ -1524,14 +1524,14 @@ INITIAL ASM .label print_line_cursor = 2 //SEG2 @begin bbegin: - jmp b21 -//SEG3 @21 -b21: + jmp b24 +//SEG3 @24 +b24: //SEG4 kickasm(location (const signed byte*) PERSP_Z#0) {{ { .var d = 256.0 .var z0 = 5.0 .for(var z=0;z<$100;z++) { .if(z>127) { .byte round(d / (z0 - ((z - 256) / 64.0))); } else { .byte round(d / (z0 - (z / 64.0))); } } } }} //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @21 to @end [phi:@21->@end] -bend_from_b21: +//SEG6 [3] phi from @24 to @end [phi:@24->@end] +bend_from_b24: jmp bend //SEG7 @end bend: @@ -2301,14 +2301,14 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = 2 //SEG2 @begin bbegin: - jmp b21 -//SEG3 @21 -b21: + jmp b24 +//SEG3 @24 +b24: //SEG4 kickasm(location (const signed byte*) PERSP_Z#0) {{ { .var d = 256.0 .var z0 = 5.0 .for(var z=0;z<$100;z++) { .if(z>127) { .byte round(d / (z0 - ((z - 256) / 64.0))); } else { .byte round(d / (z0 - (z / 64.0))); } } } }} //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @21 to @end [phi:@21->@end] -bend_from_b21: +//SEG6 [3] phi from @24 to @end [phi:@24->@end] +bend_from_b24: jmp bend //SEG7 @end bend: @@ -2912,7 +2912,7 @@ mulf_init: { ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b21 +Removing instruction jmp b24 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b2 @@ -2965,7 +2965,7 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction bend_from_b21: +Removing instruction bend_from_b24: Removing instruction b2_from_b1: Removing instruction do_perspective_from_b2: Removing instruction b1_from_do_perspective: @@ -2997,7 +2997,7 @@ Removing instruction b1_from_b4: Removing instruction b1_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b21: +Removing instruction b24: Removing instruction bend: Removing instruction mulf_init_from_main: Removing instruction b1: @@ -3044,7 +3044,7 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination FINAL SYMBOL TABLE -(label) @21 +(label) @24 (label) @begin (label) @end (signed byte*) PERSP_Z @@ -3205,11 +3205,11 @@ Score: 3776 .label print_char_cursor = 4 .label print_line_cursor = 2 //SEG2 @begin -//SEG3 @21 +//SEG3 @24 //SEG4 kickasm(location (const signed byte*) PERSP_Z#0) {{ { .var d = 256.0 .var z0 = 5.0 .for(var z=0;z<$100;z++) { .if(z>127) { .byte round(d / (z0 - ((z - 256) / 64.0))); } else { .byte round(d / (z0 - (z / 64.0))); } } } }} //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @21 to @end [phi:@21->@end] +//SEG6 [3] phi from @24 to @end [phi:@24->@end] //SEG7 @end //SEG8 main main: { diff --git a/src/test/ref/examples/3d/perspective.sym b/src/test/ref/examples/3d/perspective.sym index 65db251b5..44f5fd3e3 100644 --- a/src/test/ref/examples/3d/perspective.sym +++ b/src/test/ref/examples/3d/perspective.sym @@ -1,4 +1,4 @@ -(label) @21 +(label) @24 (label) @begin (label) @end (signed byte*) PERSP_Z diff --git a/src/test/ref/examples/fastmultiply/fastmultiply8.kc.asm b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.asm new file mode 100644 index 000000000..7814ebbbd --- /dev/null +++ b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.asm @@ -0,0 +1,204 @@ +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + .label print_screen = $400 + .label ap = $fd + .label bp = $fe + .label cp = $ff + .label mulf_sqr1 = $2000 + .label mulf_sqr2 = $2200 + jsr main +main: { + .label at = 2 + .label at_2 = 4 + .label j = 7 + .label i = 6 + .label at_line = 4 + jsr print_cls + lda #<$400+4 + sta at + lda #>$400+4 + sta at+1 + ldx #0 + b1: + lda vals,x + sta print_sbyte_at.b + jsr print_sbyte_at + lda at + clc + adc #4 + sta at + bcc !+ + inc at+1 + !: + inx + cpx #5 + bne b1 + lda #0 + sta i + lda #<$400 + sta at_line + lda #>$400 + sta at_line+1 + b2: + lda at_2 + clc + adc #$28 + sta at_2 + bcc !+ + inc at_2+1 + !: + ldy i + lda vals,y + sta print_sbyte_at.b + lda at_2 + sta print_sbyte_at.at + lda at_2+1 + sta print_sbyte_at.at+1 + jsr print_sbyte_at + lda at_2 + sta at + lda at_2+1 + sta at+1 + lda #0 + sta j + b3: + lda at + clc + adc #4 + sta at + bcc !+ + inc at+1 + !: + ldy i + lda vals,y + ldx j + ldy vals,x + jsr fmul8 + sta print_sbyte_at.b + jsr print_sbyte_at + inc j + lda j + cmp #5 + bne b3 + inc i + lda i + cmp #5 + bne b2 + rts +} +print_sbyte_at: { + .label b = 8 + .label at = 2 + lda b + cmp #0 + bpl b1 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + lda #'-' + sta print_char_at.ch + jsr print_char_at + lda b + eor #$ff + clc + adc #1 + sta b + b1: + lda at + clc + adc #1 + sta print_byte_at.at + lda at+1 + adc #0 + sta print_byte_at.at+1 + jsr print_byte_at + rts +} +print_byte_at: { + .label at = $a + lda print_sbyte_at.b + lsr + lsr + lsr + lsr + tay + lda print_hextab,y + sta print_char_at.ch + jsr print_char_at + lda #$f + and print_sbyte_at.b + tay + inc print_char_at.at + bne !+ + inc print_char_at.at+1 + !: + lda print_hextab,y + sta print_char_at.ch + jsr print_char_at + rts +} +print_char_at: { + .label at = $a + .label ch = 9 + lda ch + ldy #0 + sta (at),y + rts +} +fmul8: { + sta ap + tya + sta bp + lda ap + sta A1+1 + eor #$ff + sta A2+1 + ldx bp + sec + A1: + lda mulf_sqr1,x + A2: + sbc mulf_sqr2,x + sta cp + rts +} +print_cls: { + .label sc = 2 + lda #print_screen + sta sc+1 + b1: + lda #' ' + ldy #0 + sta (sc),y + inc sc + bne !+ + inc sc+1 + !: + lda sc+1 + cmp #>print_screen+$3e8 + bne b1 + lda sc + cmp #159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } + .if(i>351) { .byte round(((512-i)*(512-i))/256) } + } + +.pc = mulf_sqr2 "Inline" + .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } + .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } + .if(i>351) { .byte round(((i-511)*(i-511))/256) } + } + diff --git a/src/test/ref/examples/fastmultiply/fastmultiply8.kc.cfg b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.cfg new file mode 100644 index 000000000..5fc879b66 --- /dev/null +++ b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.cfg @@ -0,0 +1,135 @@ +@begin: scope:[] from + [0] phi() [ ] ( ) + to:@19 +@19: scope:[] from @begin + kickasm(location (const byte*) mulf_sqr1#0) {{ .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((i*i)/256) } + .if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } + .if(i>351) { .byte round(((512-i)*(512-i))/256) } + } + }} + kickasm(location (const byte*) mulf_sqr2#0) {{ .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } + .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } + .if(i>351) { .byte round(((i-511)*(i-511))/256) } + } + }} + [3] call main [ ] ( ) + to:@end +@end: scope:[] from @19 + [4] phi() [ ] ( ) +main: scope:[main] from @19 + [5] phi() [ ] ( main:3 [ ] ) + [6] call print_cls [ ] ( main:3 [ ] ) + to:main::@1 +main::@1: scope:[main] from main main::@8 + [7] (byte*) main::at#4 ← phi( main/((byte*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 4 main::@8/(byte*) main::at#1 ) [ main::k#2 main::at#4 ] ( main:3 [ main::k#2 main::at#4 ] ) + [7] (byte) main::k#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@8/(byte) main::k#1 ) [ main::k#2 main::at#4 ] ( main:3 [ main::k#2 main::at#4 ] ) + [8] (signed byte) print_sbyte_at::b#1 ← *((const signed byte[]) vals#0 + (byte) main::k#2) [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ) + [9] (byte*) print_sbyte_at::at#0 ← (byte*) main::at#4 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ) + [10] call print_sbyte_at [ main::k#2 main::at#4 ] ( main:3 [ main::k#2 main::at#4 ] ) + to:main::@8 +main::@8: scope:[main] from main::@1 + [11] (byte*) main::at#1 ← (byte*) main::at#4 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::k#2 main::at#1 ] ( main:3 [ main::k#2 main::at#1 ] ) + [12] (byte) main::k#1 ← ++ (byte) main::k#2 [ main::k#1 main::at#1 ] ( main:3 [ main::k#1 main::at#1 ] ) + [13] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@1 [ main::k#1 main::at#1 ] ( main:3 [ main::k#1 main::at#1 ] ) + to:main::@2 +main::@2: scope:[main] from main::@5 main::@8 + [14] (byte) main::i#2 ← phi( main::@8/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@5/(byte) main::i#1 ) [ main::at_line#2 main::i#2 ] ( main:3 [ main::at_line#2 main::i#2 ] ) + [14] (byte*) main::at_line#2 ← phi( main::@8/((byte*))(word/signed word/dword/signed dword) 1024 main::@5/(byte*) main::at#2 ) [ main::at_line#2 main::i#2 ] ( main:3 [ main::at_line#2 main::i#2 ] ) + [15] (byte*) main::at#2 ← (byte*) main::at_line#2 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) + [16] (signed byte) print_sbyte_at::b#2 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ) + [17] (byte*) print_sbyte_at::at#1 ← (byte*) main::at#2 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ) + [18] call print_sbyte_at [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) + [19] (byte*~) main::at#12 ← (byte*) main::at#2 [ main::i#2 main::at#2 main::at#12 ] ( main:3 [ main::i#2 main::at#2 main::at#12 ] ) + to:main::@3 +main::@3: scope:[main] from main::@11 main::@2 + [20] (byte) main::j#2 ← phi( main::@11/(byte) main::j#1 main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ main::i#2 main::at#2 main::at#6 main::j#2 ] ( main:3 [ main::i#2 main::at#2 main::at#6 main::j#2 ] ) + [20] (byte*) main::at#6 ← phi( main::@11/(byte*) main::at#3 main::@2/(byte*~) main::at#12 ) [ main::i#2 main::at#2 main::at#6 main::j#2 ] ( main:3 [ main::i#2 main::at#2 main::at#6 main::j#2 ] ) + [21] (byte*) main::at#3 ← (byte*) main::at#6 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + [22] (signed byte) fmul8::a#0 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 ] ) + [23] (signed byte) fmul8::b#0 ← *((const signed byte[]) vals#0 + (byte) main::j#2) [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 fmul8::b#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 fmul8::b#0 ] ) + [24] call fmul8 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + [25] (signed byte) fmul8::return#0 ← (signed byte) fmul8::return#1 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#0 ] ) + to:main::@10 +main::@10: scope:[main] from main::@3 + [26] (signed byte) main::r#0 ← (signed byte) fmul8::return#0 [ main::i#2 main::at#2 main::j#2 main::at#3 main::r#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 main::r#0 ] ) + [27] (signed byte) print_sbyte_at::b#3 ← (signed byte) main::r#0 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 ] ) + [28] (byte*) print_sbyte_at::at#2 ← (byte*) main::at#3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ) + [29] call print_sbyte_at [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:main::@11 +main::@11: scope:[main] from main::@10 + [30] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) + [31] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) + to:main::@5 +main::@5: scope:[main] from main::@11 + [32] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) + [33] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) + to:main::@return +main::@return: scope:[main] from main::@5 + [34] return [ ] ( main:3 [ ] ) + to:@return +print_sbyte_at: scope:[print_sbyte_at] from main::@1 main::@10 main::@2 + [35] (byte*) print_sbyte_at::at#3 ← phi( main::@1/(byte*) print_sbyte_at::at#0 main::@10/(byte*) print_sbyte_at::at#2 main::@2/(byte*) print_sbyte_at::at#1 ) [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + [35] (signed byte) print_sbyte_at::b#4 ← phi( main::@1/(signed byte) print_sbyte_at::b#1 main::@10/(signed byte) print_sbyte_at::b#3 main::@2/(signed byte) print_sbyte_at::b#2 ) [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + [36] if((signed byte) print_sbyte_at::b#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte_at::@1 [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + to:print_sbyte_at::@2 +print_sbyte_at::@2: scope:[print_sbyte_at] from print_sbyte_at + [37] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#3 [ print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ) + [38] call print_char_at [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + to:print_sbyte_at::@4 +print_sbyte_at::@4: scope:[print_sbyte_at] from print_sbyte_at::@2 + [39] (signed byte) print_sbyte_at::b#0 ← - (signed byte) print_sbyte_at::b#4 [ print_sbyte_at::at#3 print_sbyte_at::b#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::at#3 print_sbyte_at::b#0 ] ) + to:print_sbyte_at::@1 +print_sbyte_at::@1: scope:[print_sbyte_at] from print_sbyte_at print_sbyte_at::@4 + [40] (signed byte) print_sbyte_at::b#5 ← phi( print_sbyte_at/(signed byte) print_sbyte_at::b#4 print_sbyte_at::@4/(signed byte) print_sbyte_at::b#0 ) [ print_sbyte_at::at#3 print_sbyte_at::b#5 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::at#3 print_sbyte_at::b#5 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::at#3 print_sbyte_at::b#5 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::at#3 print_sbyte_at::b#5 ] ) + [41] (byte*) print_byte_at::at#0 ← (byte*) print_sbyte_at::at#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) + [42] call print_byte_at [ ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:print_sbyte_at::@return +print_sbyte_at::@return: scope:[print_sbyte_at] from print_sbyte_at::@1 + [43] return [ ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:@return +print_byte_at: scope:[print_byte_at] from print_sbyte_at::@1 + [44] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#5 >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ) + [45] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] ) + [46] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#0 [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ) + [47] call print_char_at [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) + to:print_byte_at::@1 +print_byte_at::@1: scope:[print_byte_at] from print_byte_at + [48] (byte~) print_byte_at::$2 ← (byte)(signed byte) print_sbyte_at::b#5 & (byte/signed byte/word/signed word/dword/signed dword) 15 [ print_byte_at::at#0 print_byte_at::$2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::at#0 print_byte_at::$2 ] ) + [49] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_byte_at::$2 print_char_at::at#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::$2 print_char_at::at#2 ] ) + [50] (byte) print_char_at::ch#2 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) [ print_char_at::at#2 print_char_at::ch#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_char_at::at#2 print_char_at::ch#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_char_at::at#2 print_char_at::ch#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_char_at::at#2 print_char_at::ch#2 ] ) + [51] call print_char_at [ ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:print_byte_at::@return +print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@1 + [52] return [ ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:@return +print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 print_sbyte_at::@2 + [53] (byte*) print_char_at::at#3 ← phi( print_byte_at/(byte*) print_char_at::at#1 print_byte_at::@1/(byte*) print_char_at::at#2 print_sbyte_at::@2/(byte*) print_char_at::at#0 ) [ print_char_at::ch#3 print_char_at::at#3 ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 print_char_at::ch#3 print_char_at::at#3 ] ) + [53] (byte) print_char_at::ch#3 ← phi( print_byte_at/(byte) print_char_at::ch#1 print_byte_at::@1/(byte) print_char_at::ch#2 print_sbyte_at::@2/(byte) '-' ) [ print_char_at::ch#3 print_char_at::at#3 ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 print_char_at::ch#3 print_char_at::at#3 ] ) + [54] *((byte*) print_char_at::at#3) ← (byte) print_char_at::ch#3 [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:print_char_at::@return +print_char_at::@return: scope:[print_char_at] from print_char_at + [55] return [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:@return +fmul8: scope:[fmul8] from main::@3 + [56] *((const signed byte*) ap#0) ← (signed byte) fmul8::a#0 [ fmul8::b#0 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::b#0 ] ) + [57] *((const signed byte*) bp#0) ← (signed byte) fmul8::b#0 [ ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + asm { ldaap staA1+1 eor#$ff staA2+1 ldxbp sec A1: ldamulf_sqr1,x A2: sbcmulf_sqr2,x stacp } + [59] (signed byte) fmul8::return#1 ← *((const signed byte*) cp#0) [ fmul8::return#1 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + to:fmul8::@return +fmul8::@return: scope:[fmul8] from fmul8 + [60] return [ fmul8::return#1 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + to:@return +print_cls: scope:[print_cls] from main + [61] phi() [ ] ( main:3::print_cls:6 [ ] ) + to:print_cls::@1 +print_cls::@1: scope:[print_cls] from print_cls print_cls::@1 + [62] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_screen#0 print_cls::@1/(byte*) print_cls::sc#1 ) [ print_cls::sc#2 ] ( main:3::print_cls:6 [ print_cls::sc#2 ] ) + [63] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::print_cls:6 [ print_cls::sc#2 ] ) + [64] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) + [65] if((byte*) print_cls::sc#1!=(const byte*) print_screen#0+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) + to:print_cls::@return +print_cls::@return: scope:[print_cls] from print_cls::@1 + [66] return [ ] ( main:3::print_cls:6 [ ] ) + to:@return diff --git a/src/test/ref/examples/fastmultiply/fastmultiply8.kc.log b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.log new file mode 100644 index 000000000..337479730 --- /dev/null +++ b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.log @@ -0,0 +1,2426 @@ + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 + to:@11 +print_sbyte_at: scope:[print_sbyte_at] from main::@1 main::@10 main::@2 + (byte*) print_sbyte_at::at#5 ← phi( main::@1/(byte*) print_sbyte_at::at#0 main::@10/(byte*) print_sbyte_at::at#2 main::@2/(byte*) print_sbyte_at::at#1 ) + (signed byte) print_sbyte_at::b#4 ← phi( main::@1/(signed byte) print_sbyte_at::b#1 main::@10/(signed byte) print_sbyte_at::b#3 main::@2/(signed byte) print_sbyte_at::b#2 ) + (bool~) print_sbyte_at::$0 ← (signed byte) print_sbyte_at::b#4 < (byte/signed byte/word/signed word/dword/signed dword) 0 + (bool~) print_sbyte_at::$1 ← ! (bool~) print_sbyte_at::$0 + if((bool~) print_sbyte_at::$1) goto print_sbyte_at::@1 + to:print_sbyte_at::@2 +print_sbyte_at::@1: scope:[print_sbyte_at] from print_sbyte_at print_sbyte_at::@4 + (byte*) print_sbyte_at::at#3 ← phi( print_sbyte_at/(byte*) print_sbyte_at::at#5 print_sbyte_at::@4/(byte*) print_sbyte_at::at#6 ) + (signed byte) print_sbyte_at::b#5 ← phi( print_sbyte_at/(signed byte) print_sbyte_at::b#4 print_sbyte_at::@4/(signed byte) print_sbyte_at::b#0 ) + (byte~) print_sbyte_at::$4 ← ((byte)) (signed byte) print_sbyte_at::b#5 + (byte*~) print_sbyte_at::$5 ← (byte*) print_sbyte_at::at#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) print_byte_at::b#0 ← (byte~) print_sbyte_at::$4 + (byte*) print_byte_at::at#0 ← (byte*~) print_sbyte_at::$5 + call print_byte_at + to:print_sbyte_at::@3 +print_sbyte_at::@3: scope:[print_sbyte_at] from print_sbyte_at::@1 + to:print_sbyte_at::@return +print_sbyte_at::@2: scope:[print_sbyte_at] from print_sbyte_at + (signed byte) print_sbyte_at::b#7 ← phi( print_sbyte_at/(signed byte) print_sbyte_at::b#4 ) + (byte*) print_sbyte_at::at#4 ← phi( print_sbyte_at/(byte*) print_sbyte_at::at#5 ) + (byte) print_char_at::ch#0 ← (byte) '-' + (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#4 + call print_char_at + to:print_sbyte_at::@4 +print_sbyte_at::@4: scope:[print_sbyte_at] from print_sbyte_at::@2 + (byte*) print_sbyte_at::at#6 ← phi( print_sbyte_at::@2/(byte*) print_sbyte_at::at#4 ) + (signed byte) print_sbyte_at::b#6 ← phi( print_sbyte_at::@2/(signed byte) print_sbyte_at::b#7 ) + (signed byte~) print_sbyte_at::$3 ← - (signed byte) print_sbyte_at::b#6 + (signed byte) print_sbyte_at::b#0 ← (signed byte~) print_sbyte_at::$3 + to:print_sbyte_at::@1 +print_sbyte_at::@return: scope:[print_sbyte_at] from print_sbyte_at::@3 + return + to:@return +@11: scope:[] from @begin + (byte*) print_screen#7 ← phi( @begin/(byte*) print_screen#0 ) + (byte[]) print_hextab#0 ← (const string) $2 + to:@17 +print_byte_at: scope:[print_byte_at] from print_sbyte_at::@1 + (byte*) print_byte_at::at#1 ← phi( print_sbyte_at::@1/(byte*) print_byte_at::at#0 ) + (byte) print_byte_at::b#1 ← phi( print_sbyte_at::@1/(byte) print_byte_at::b#0 ) + (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#1 >> (byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) print_char_at::ch#1 ← *((byte[]) print_hextab#0 + (byte~) print_byte_at::$0) + (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#1 + call print_char_at + to:print_byte_at::@1 +print_byte_at::@1: scope:[print_byte_at] from print_byte_at + (byte*) print_byte_at::at#2 ← phi( print_byte_at/(byte*) print_byte_at::at#1 ) + (byte) print_byte_at::b#2 ← phi( print_byte_at/(byte) print_byte_at::b#1 ) + (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte/signed byte/word/signed word/dword/signed dword) 15 + (byte*~) print_byte_at::$3 ← (byte*) print_byte_at::at#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) print_char_at::ch#2 ← *((byte[]) print_hextab#0 + (byte~) print_byte_at::$2) + (byte*) print_char_at::at#2 ← (byte*~) print_byte_at::$3 + call print_char_at + to:print_byte_at::@2 +print_byte_at::@2: scope:[print_byte_at] from print_byte_at::@1 + to:print_byte_at::@return +print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@2 + return + to:@return +print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 print_sbyte_at::@2 + (byte*) print_char_at::at#3 ← phi( print_byte_at/(byte*) print_char_at::at#1 print_byte_at::@1/(byte*) print_char_at::at#2 print_sbyte_at::@2/(byte*) print_char_at::at#0 ) + (byte) print_char_at::ch#3 ← phi( print_byte_at/(byte) print_char_at::ch#1 print_byte_at::@1/(byte) print_char_at::ch#2 print_sbyte_at::@2/(byte) print_char_at::ch#0 ) + *((byte*) print_char_at::at#3) ← (byte) print_char_at::ch#3 + to:print_char_at::@return +print_char_at::@return: scope:[print_char_at] from print_char_at + return + to:@return +print_cls: scope:[print_cls] from main + (byte*) print_screen#1 ← phi( main/(byte*) print_screen#3 ) + (byte*) print_cls::sc#0 ← (byte*) print_screen#1 + to:print_cls::@1 +print_cls::@1: scope:[print_cls] from print_cls print_cls::@1 + (byte*) print_screen#2 ← phi( print_cls/(byte*) print_screen#1 print_cls::@1/(byte*) print_screen#2 ) + (byte*) print_cls::sc#2 ← phi( print_cls/(byte*) print_cls::sc#0 print_cls::@1/(byte*) print_cls::sc#1 ) + *((byte*) print_cls::sc#2) ← (byte) ' ' + (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 + (byte*~) print_cls::$0 ← (byte*) print_screen#2 + (word/signed word/dword/signed dword) 1000 + (bool~) print_cls::$1 ← (byte*) print_cls::sc#1 != (byte*~) print_cls::$0 + if((bool~) print_cls::$1) goto print_cls::@1 + to:print_cls::@return +print_cls::@return: scope:[print_cls] from print_cls::@1 + return + to:@return +@17: scope:[] from @11 + (byte*) print_screen#6 ← phi( @11/(byte*) print_screen#7 ) + (signed byte/signed word/signed dword~) $0 ← - (byte/signed byte/word/signed word/dword/signed dword) 95 + (signed byte/signed word/signed dword~) $1 ← - (byte/signed byte/word/signed word/dword/signed dword) 64 + (signed byte[]) vals#0 ← { (signed byte/signed word/signed dword~) $0, (signed byte/signed word/signed dword~) $1, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/signed byte/word/signed word/dword/signed dword) 95 } + to:@18 +main: scope:[main] from @19 + (signed byte*) cp#12 ← phi( @19/(signed byte*) cp#13 ) + (signed byte*) bp#12 ← phi( @19/(signed byte*) bp#13 ) + (signed byte*) ap#12 ← phi( @19/(signed byte*) ap#13 ) + (byte*) print_screen#3 ← phi( @19/(byte*) print_screen#4 ) + call print_cls + to:main::@7 +main::@7: scope:[main] from main + (signed byte*) cp#11 ← phi( main/(signed byte*) cp#12 ) + (signed byte*) bp#11 ← phi( main/(signed byte*) bp#12 ) + (signed byte*) ap#11 ← phi( main/(signed byte*) ap#12 ) + (byte*) main::at_line#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 + (byte*~) main::$1 ← (byte*) main::at_line#0 + (byte/signed byte/word/signed word/dword/signed dword) 4 + (byte*) main::at#0 ← (byte*~) main::$1 + (byte) main::k#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@1 +main::@1: scope:[main] from main::@7 main::@8 + (signed byte*) cp#10 ← phi( main::@7/(signed byte*) cp#11 main::@8/(signed byte*) cp#9 ) + (signed byte*) bp#10 ← phi( main::@7/(signed byte*) bp#11 main::@8/(signed byte*) bp#9 ) + (signed byte*) ap#10 ← phi( main::@7/(signed byte*) ap#11 main::@8/(signed byte*) ap#9 ) + (byte*) main::at_line#7 ← phi( main::@7/(byte*) main::at_line#0 main::@8/(byte*) main::at_line#5 ) + (byte*) main::at#4 ← phi( main::@7/(byte*) main::at#0 main::@8/(byte*) main::at#1 ) + (byte) main::k#2 ← phi( main::@7/(byte) main::k#0 main::@8/(byte) main::k#1 ) + (signed byte) print_sbyte_at::b#1 ← *((signed byte[]) vals#0 + (byte) main::k#2) + (byte*) print_sbyte_at::at#0 ← (byte*) main::at#4 + call print_sbyte_at + to:main::@8 +main::@8: scope:[main] from main::@1 + (signed byte*) cp#9 ← phi( main::@1/(signed byte*) cp#10 ) + (signed byte*) bp#9 ← phi( main::@1/(signed byte*) bp#10 ) + (signed byte*) ap#9 ← phi( main::@1/(signed byte*) ap#10 ) + (byte*) main::at_line#5 ← phi( main::@1/(byte*) main::at_line#7 ) + (byte) main::k#3 ← phi( main::@1/(byte) main::k#2 ) + (byte*) main::at#5 ← phi( main::@1/(byte*) main::at#4 ) + (byte*) main::at#1 ← (byte*) main::at#5 + (byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) main::k#1 ← (byte) main::k#3 + rangenext(0,4) + (bool~) main::$3 ← (byte) main::k#1 != rangelast(0,4) + if((bool~) main::$3) goto main::@1 + to:main::@4 +main::@4: scope:[main] from main::@8 + (signed byte*) cp#7 ← phi( main::@8/(signed byte*) cp#9 ) + (signed byte*) bp#7 ← phi( main::@8/(signed byte*) bp#9 ) + (signed byte*) ap#7 ← phi( main::@8/(signed byte*) ap#9 ) + (byte*) main::at_line#3 ← phi( main::@8/(byte*) main::at_line#5 ) + (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@2 +main::@2: scope:[main] from main::@4 main::@5 + (signed byte*) cp#5 ← phi( main::@4/(signed byte*) cp#7 main::@5/(signed byte*) cp#8 ) + (signed byte*) bp#5 ← phi( main::@4/(signed byte*) bp#7 main::@5/(signed byte*) bp#8 ) + (signed byte*) ap#5 ← phi( main::@4/(signed byte*) ap#7 main::@5/(signed byte*) ap#8 ) + (byte) main::i#2 ← phi( main::@4/(byte) main::i#0 main::@5/(byte) main::i#1 ) + (byte*) main::at_line#2 ← phi( main::@4/(byte*) main::at_line#3 main::@5/(byte*) main::at_line#4 ) + (byte*) main::at_line#1 ← (byte*) main::at_line#2 + (byte/signed byte/word/signed word/dword/signed dword) 40 + (byte*) main::at#2 ← (byte*) main::at_line#1 + (signed byte) print_sbyte_at::b#2 ← *((signed byte[]) vals#0 + (byte) main::i#2) + (byte*) print_sbyte_at::at#1 ← (byte*) main::at#2 + call print_sbyte_at + to:main::@9 +main::@9: scope:[main] from main::@2 + (byte*) main::at_line#10 ← phi( main::@2/(byte*) main::at_line#1 ) + (signed byte*) cp#4 ← phi( main::@2/(signed byte*) cp#5 ) + (signed byte*) bp#4 ← phi( main::@2/(signed byte*) bp#5 ) + (signed byte*) ap#4 ← phi( main::@2/(signed byte*) ap#5 ) + (byte) main::i#6 ← phi( main::@2/(byte) main::i#2 ) + (byte*) main::at#9 ← phi( main::@2/(byte*) main::at#2 ) + (byte) main::j#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@3 +main::@3: scope:[main] from main::@11 main::@9 + (byte*) main::at_line#9 ← phi( main::@11/(byte*) main::at_line#6 main::@9/(byte*) main::at_line#10 ) + (signed byte*) cp#2 ← phi( main::@11/(signed byte*) cp#3 main::@9/(signed byte*) cp#4 ) + (signed byte*) bp#2 ← phi( main::@11/(signed byte*) bp#3 main::@9/(signed byte*) bp#4 ) + (signed byte*) ap#2 ← phi( main::@11/(signed byte*) ap#3 main::@9/(signed byte*) ap#4 ) + (byte) main::j#2 ← phi( main::@11/(byte) main::j#1 main::@9/(byte) main::j#0 ) + (byte) main::i#3 ← phi( main::@11/(byte) main::i#5 main::@9/(byte) main::i#6 ) + (byte*) main::at#6 ← phi( main::@11/(byte*) main::at#8 main::@9/(byte*) main::at#9 ) + (byte*) main::at#3 ← (byte*) main::at#6 + (byte/signed byte/word/signed word/dword/signed dword) 4 + (signed byte) fmul8::a#0 ← *((signed byte[]) vals#0 + (byte) main::i#3) + (signed byte) fmul8::b#0 ← *((signed byte[]) vals#0 + (byte) main::j#2) + call fmul8 + (signed byte) fmul8::return#0 ← (signed byte) fmul8::return#2 + to:main::@10 +main::@10: scope:[main] from main::@3 + (byte*) main::at_line#8 ← phi( main::@3/(byte*) main::at_line#9 ) + (signed byte*) cp#6 ← phi( main::@3/(signed byte*) cp#2 ) + (signed byte*) bp#6 ← phi( main::@3/(signed byte*) bp#2 ) + (signed byte*) ap#6 ← phi( main::@3/(signed byte*) ap#2 ) + (byte) main::i#7 ← phi( main::@3/(byte) main::i#3 ) + (byte) main::j#4 ← phi( main::@3/(byte) main::j#2 ) + (byte*) main::at#7 ← phi( main::@3/(byte*) main::at#3 ) + (signed byte) fmul8::return#3 ← phi( main::@3/(signed byte) fmul8::return#0 ) + (signed byte~) main::$5 ← (signed byte) fmul8::return#3 + (signed byte) main::r#0 ← (signed byte~) main::$5 + (signed byte) print_sbyte_at::b#3 ← (signed byte) main::r#0 + (byte*) print_sbyte_at::at#2 ← (byte*) main::at#7 + call print_sbyte_at + to:main::@11 +main::@11: scope:[main] from main::@10 + (byte*) main::at_line#6 ← phi( main::@10/(byte*) main::at_line#8 ) + (signed byte*) cp#3 ← phi( main::@10/(signed byte*) cp#6 ) + (signed byte*) bp#3 ← phi( main::@10/(signed byte*) bp#6 ) + (signed byte*) ap#3 ← phi( main::@10/(signed byte*) ap#6 ) + (byte) main::i#5 ← phi( main::@10/(byte) main::i#7 ) + (byte*) main::at#8 ← phi( main::@10/(byte*) main::at#7 ) + (byte) main::j#3 ← phi( main::@10/(byte) main::j#4 ) + (byte) main::j#1 ← (byte) main::j#3 + rangenext(0,4) + (bool~) main::$7 ← (byte) main::j#1 != rangelast(0,4) + if((bool~) main::$7) goto main::@3 + to:main::@5 +main::@5: scope:[main] from main::@11 + (signed byte*) cp#8 ← phi( main::@11/(signed byte*) cp#3 ) + (signed byte*) bp#8 ← phi( main::@11/(signed byte*) bp#3 ) + (signed byte*) ap#8 ← phi( main::@11/(signed byte*) ap#3 ) + (byte*) main::at_line#4 ← phi( main::@11/(byte*) main::at_line#6 ) + (byte) main::i#4 ← phi( main::@11/(byte) main::i#5 ) + (byte) main::i#1 ← (byte) main::i#4 + rangenext(0,4) + (bool~) main::$8 ← (byte) main::i#1 != rangelast(0,4) + if((bool~) main::$8) goto main::@2 + to:main::@return +main::@return: scope:[main] from main::@5 + return + to:@return +@18: scope:[] from @17 + (byte*) print_screen#5 ← phi( @17/(byte*) print_screen#6 ) + (signed byte*) ap#0 ← ((signed byte*)) (byte/word/signed word/dword/signed dword) 253 + (signed byte*) bp#0 ← ((signed byte*)) (byte/word/signed word/dword/signed dword) 254 + (signed byte*) cp#0 ← ((signed byte*)) (byte/word/signed word/dword/signed dword) 255 + to:@19 +fmul8: scope:[fmul8] from main::@3 + (signed byte*) cp#1 ← phi( main::@3/(signed byte*) cp#2 ) + (signed byte*) bp#1 ← phi( main::@3/(signed byte*) bp#2 ) + (signed byte) fmul8::b#1 ← phi( main::@3/(signed byte) fmul8::b#0 ) + (signed byte*) ap#1 ← phi( main::@3/(signed byte*) ap#2 ) + (signed byte) fmul8::a#1 ← phi( main::@3/(signed byte) fmul8::a#0 ) + *((signed byte*) ap#1) ← (signed byte) fmul8::a#1 + *((signed byte*) bp#1) ← (signed byte) fmul8::b#1 + asm { ldaap staA1+1 eor#$ff staA2+1 ldxbp sec A1: ldamulf_sqr1,x A2: sbcmulf_sqr2,x stacp } + (signed byte) fmul8::return#1 ← *((signed byte*) cp#1) + to:fmul8::@return +fmul8::@return: scope:[fmul8] from fmul8 + (signed byte) fmul8::return#4 ← phi( fmul8/(signed byte) fmul8::return#1 ) + (signed byte) fmul8::return#2 ← (signed byte) fmul8::return#4 + return + to:@return +@19: scope:[] from @18 + (signed byte*) cp#13 ← phi( @18/(signed byte*) cp#0 ) + (signed byte*) bp#13 ← phi( @18/(signed byte*) bp#0 ) + (signed byte*) ap#13 ← phi( @18/(signed byte*) ap#0 ) + (byte*) print_screen#4 ← phi( @18/(byte*) print_screen#5 ) + (byte*) mulf_sqr1#0 ← ((byte*)) (word/signed word/dword/signed dword) 8192 + (byte*) mulf_sqr2#0 ← ((byte*)) (word/signed word/dword/signed dword) 8704 + kickasm(location (byte*) mulf_sqr1#0) {{ .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((i*i)/256) } + .if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } + .if(i>351) { .byte round(((512-i)*(512-i))/256) } + } + }} + kickasm(location (byte*) mulf_sqr2#0) {{ .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } + .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } + .if(i>351) { .byte round(((i-511)*(i-511))/256) } + } + }} + call main + to:@20 +@20: scope:[] from @19 + to:@end +@end: scope:[] from @20 + +SYMBOL TABLE SSA +(signed byte/signed word/signed dword~) $0 +(signed byte/signed word/signed dword~) $1 +(const string) $2 = (string) "0123456789abcdef" +(label) @11 +(label) @17 +(label) @18 +(label) @19 +(label) @20 +(label) @begin +(label) @end +(signed byte*) ap +(signed byte*) ap#0 +(signed byte*) ap#1 +(signed byte*) ap#10 +(signed byte*) ap#11 +(signed byte*) ap#12 +(signed byte*) ap#13 +(signed byte*) ap#2 +(signed byte*) ap#3 +(signed byte*) ap#4 +(signed byte*) ap#5 +(signed byte*) ap#6 +(signed byte*) ap#7 +(signed byte*) ap#8 +(signed byte*) ap#9 +(signed byte*) bp +(signed byte*) bp#0 +(signed byte*) bp#1 +(signed byte*) bp#10 +(signed byte*) bp#11 +(signed byte*) bp#12 +(signed byte*) bp#13 +(signed byte*) bp#2 +(signed byte*) bp#3 +(signed byte*) bp#4 +(signed byte*) bp#5 +(signed byte*) bp#6 +(signed byte*) bp#7 +(signed byte*) bp#8 +(signed byte*) bp#9 +(signed byte*) cp +(signed byte*) cp#0 +(signed byte*) cp#1 +(signed byte*) cp#10 +(signed byte*) cp#11 +(signed byte*) cp#12 +(signed byte*) cp#13 +(signed byte*) cp#2 +(signed byte*) cp#3 +(signed byte*) cp#4 +(signed byte*) cp#5 +(signed byte*) cp#6 +(signed byte*) cp#7 +(signed byte*) cp#8 +(signed byte*) cp#9 +(signed byte()) fmul8((signed byte) fmul8::a , (signed byte) fmul8::b) +(label) fmul8::@return +(signed byte) fmul8::a +(signed byte) fmul8::a#0 +(signed byte) fmul8::a#1 +(signed byte) fmul8::b +(signed byte) fmul8::b#0 +(signed byte) fmul8::b#1 +(signed byte) fmul8::return +(signed byte) fmul8::return#0 +(signed byte) fmul8::return#1 +(signed byte) fmul8::return#2 +(signed byte) fmul8::return#3 +(signed byte) fmul8::return#4 +(void()) main() +(byte*~) main::$1 +(bool~) main::$3 +(signed byte~) main::$5 +(bool~) main::$7 +(bool~) main::$8 +(label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@5 +(label) main::@7 +(label) main::@8 +(label) main::@9 +(label) main::@return +(byte*) main::at +(byte*) main::at#0 +(byte*) main::at#1 +(byte*) main::at#2 +(byte*) main::at#3 +(byte*) main::at#4 +(byte*) main::at#5 +(byte*) main::at#6 +(byte*) main::at#7 +(byte*) main::at#8 +(byte*) main::at#9 +(byte*) main::at_line +(byte*) main::at_line#0 +(byte*) main::at_line#1 +(byte*) main::at_line#10 +(byte*) main::at_line#2 +(byte*) main::at_line#3 +(byte*) main::at_line#4 +(byte*) main::at_line#5 +(byte*) main::at_line#6 +(byte*) main::at_line#7 +(byte*) main::at_line#8 +(byte*) main::at_line#9 +(byte) main::i +(byte) main::i#0 +(byte) main::i#1 +(byte) main::i#2 +(byte) main::i#3 +(byte) main::i#4 +(byte) main::i#5 +(byte) main::i#6 +(byte) main::i#7 +(byte) main::j +(byte) main::j#0 +(byte) main::j#1 +(byte) main::j#2 +(byte) main::j#3 +(byte) main::j#4 +(byte) main::k +(byte) main::k#0 +(byte) main::k#1 +(byte) main::k#2 +(byte) main::k#3 +(signed byte) main::r +(signed byte) main::r#0 +(byte*) mulf_sqr1 +(byte*) mulf_sqr1#0 +(byte*) mulf_sqr2 +(byte*) mulf_sqr2#0 +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 +(byte~) print_byte_at::$2 +(byte*~) print_byte_at::$3 +(label) print_byte_at::@1 +(label) print_byte_at::@2 +(label) print_byte_at::@return +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 +(byte*) print_byte_at::at#1 +(byte*) print_byte_at::at#2 +(byte) print_byte_at::b +(byte) print_byte_at::b#0 +(byte) print_byte_at::b#1 +(byte) print_byte_at::b#2 +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(label) print_char_at::@return +(byte*) print_char_at::at +(byte*) print_char_at::at#0 +(byte*) print_char_at::at#1 +(byte*) print_char_at::at#2 +(byte*) print_char_at::at#3 +(byte) print_char_at::ch +(byte) print_char_at::ch#0 +(byte) print_char_at::ch#1 +(byte) print_char_at::ch#2 +(byte) print_char_at::ch#3 +(void()) print_cls() +(byte*~) print_cls::$0 +(bool~) print_cls::$1 +(label) print_cls::@1 +(label) print_cls::@return +(byte*) print_cls::sc +(byte*) print_cls::sc#0 +(byte*) print_cls::sc#1 +(byte*) print_cls::sc#2 +(byte[]) print_hextab +(byte[]) print_hextab#0 +(void()) print_sbyte_at((signed byte) print_sbyte_at::b , (byte*) print_sbyte_at::at) +(bool~) print_sbyte_at::$0 +(bool~) print_sbyte_at::$1 +(signed byte~) print_sbyte_at::$3 +(byte~) print_sbyte_at::$4 +(byte*~) print_sbyte_at::$5 +(label) print_sbyte_at::@1 +(label) print_sbyte_at::@2 +(label) print_sbyte_at::@3 +(label) print_sbyte_at::@4 +(label) print_sbyte_at::@return +(byte*) print_sbyte_at::at +(byte*) print_sbyte_at::at#0 +(byte*) print_sbyte_at::at#1 +(byte*) print_sbyte_at::at#2 +(byte*) print_sbyte_at::at#3 +(byte*) print_sbyte_at::at#4 +(byte*) print_sbyte_at::at#5 +(byte*) print_sbyte_at::at#6 +(signed byte) print_sbyte_at::b +(signed byte) print_sbyte_at::b#0 +(signed byte) print_sbyte_at::b#1 +(signed byte) print_sbyte_at::b#2 +(signed byte) print_sbyte_at::b#3 +(signed byte) print_sbyte_at::b#4 +(signed byte) print_sbyte_at::b#5 +(signed byte) print_sbyte_at::b#6 +(signed byte) print_sbyte_at::b#7 +(byte*) print_screen +(byte*) print_screen#0 +(byte*) print_screen#1 +(byte*) print_screen#2 +(byte*) print_screen#3 +(byte*) print_screen#4 +(byte*) print_screen#5 +(byte*) print_screen#6 +(byte*) print_screen#7 +(signed byte[]) vals +(signed byte[]) vals#0 + +Culled Empty Block (label) print_sbyte_at::@3 +Culled Empty Block (label) print_byte_at::@2 +Culled Empty Block (label) @20 +Successful SSA optimization Pass2CullEmptyBlocks +Inversing boolean not (bool~) print_sbyte_at::$1 ← (signed byte) print_sbyte_at::b#4 >= (byte/signed byte/word/signed word/dword/signed dword) 0 from (bool~) print_sbyte_at::$0 ← (signed byte) print_sbyte_at::b#4 < (byte/signed byte/word/signed word/dword/signed dword) 0 +Successful SSA optimization Pass2UnaryNotSimplification +Alias (byte) print_byte_at::b#0 = (byte~) print_sbyte_at::$4 +Alias (byte*) print_byte_at::at#0 = (byte*~) print_sbyte_at::$5 +Alias (byte*) print_sbyte_at::at#4 = (byte*) print_sbyte_at::at#5 (byte*) print_sbyte_at::at#6 +Alias (signed byte) print_sbyte_at::b#4 = (signed byte) print_sbyte_at::b#7 (signed byte) print_sbyte_at::b#6 +Alias (signed byte) print_sbyte_at::b#0 = (signed byte~) print_sbyte_at::$3 +Alias (byte*) print_screen#0 = (byte*) print_screen#7 (byte*) print_screen#6 (byte*) print_screen#5 (byte*) print_screen#4 +Alias (byte) print_byte_at::b#1 = (byte) print_byte_at::b#2 +Alias (byte*) print_byte_at::at#1 = (byte*) print_byte_at::at#2 +Alias (byte*) print_char_at::at#2 = (byte*~) print_byte_at::$3 +Alias (signed byte*) ap#11 = (signed byte*) ap#12 +Alias (signed byte*) bp#11 = (signed byte*) bp#12 +Alias (signed byte*) cp#11 = (signed byte*) cp#12 +Alias (byte*) main::at#0 = (byte*~) main::$1 +Alias (byte*) main::at#4 = (byte*) main::at#5 +Alias (byte) main::k#2 = (byte) main::k#3 +Alias (byte*) main::at_line#3 = (byte*) main::at_line#5 (byte*) main::at_line#7 +Alias (signed byte*) ap#10 = (signed byte*) ap#9 (signed byte*) ap#7 +Alias (signed byte*) bp#10 = (signed byte*) bp#9 (signed byte*) bp#7 +Alias (signed byte*) cp#10 = (signed byte*) cp#9 (signed byte*) cp#7 +Alias (byte*) main::at#2 = (byte*) main::at_line#1 (byte*) main::at#9 (byte*) main::at_line#10 +Alias (byte) main::i#2 = (byte) main::i#6 +Alias (signed byte*) ap#4 = (signed byte*) ap#5 +Alias (signed byte*) bp#4 = (signed byte*) bp#5 +Alias (signed byte*) cp#4 = (signed byte*) cp#5 +Alias (signed byte) fmul8::return#0 = (signed byte) fmul8::return#3 +Alias (byte*) main::at#3 = (byte*) main::at#7 (byte*) main::at#8 +Alias (byte) main::j#2 = (byte) main::j#4 (byte) main::j#3 +Alias (byte) main::i#3 = (byte) main::i#7 (byte) main::i#5 (byte) main::i#4 +Alias (signed byte*) ap#2 = (signed byte*) ap#6 (signed byte*) ap#3 (signed byte*) ap#8 +Alias (signed byte*) bp#2 = (signed byte*) bp#6 (signed byte*) bp#3 (signed byte*) bp#8 +Alias (signed byte*) cp#2 = (signed byte*) cp#6 (signed byte*) cp#3 (signed byte*) cp#8 +Alias (byte*) main::at_line#4 = (byte*) main::at_line#8 (byte*) main::at_line#9 (byte*) main::at_line#6 +Alias (signed byte) main::r#0 = (signed byte~) main::$5 +Alias (signed byte) fmul8::return#1 = (signed byte) fmul8::return#4 (signed byte) fmul8::return#2 +Alias (signed byte*) ap#0 = (signed byte*) ap#13 +Alias (signed byte*) bp#0 = (signed byte*) bp#13 +Alias (signed byte*) cp#0 = (signed byte*) cp#13 +Successful SSA optimization Pass2AliasElimination +Alias (byte*) print_sbyte_at::at#3 = (byte*) print_sbyte_at::at#4 +Successful SSA optimization Pass2AliasElimination +Self Phi Eliminated (byte*) print_screen#2 +Self Phi Eliminated (byte*) main::at_line#3 +Self Phi Eliminated (signed byte*) ap#10 +Self Phi Eliminated (signed byte*) bp#10 +Self Phi Eliminated (signed byte*) cp#10 +Self Phi Eliminated (byte) main::i#3 +Self Phi Eliminated (signed byte*) ap#2 +Self Phi Eliminated (signed byte*) bp#2 +Self Phi Eliminated (signed byte*) cp#2 +Self Phi Eliminated (byte*) main::at_line#4 +Successful SSA optimization Pass2SelfPhiElimination +Redundant Phi (byte) print_byte_at::b#1 (byte) print_byte_at::b#0 +Redundant Phi (byte*) print_byte_at::at#1 (byte*) print_byte_at::at#0 +Redundant Phi (byte*) print_screen#1 (byte*) print_screen#3 +Redundant Phi (byte*) print_screen#2 (byte*) print_screen#1 +Redundant Phi (byte*) print_screen#3 (byte*) print_screen#0 +Redundant Phi (signed byte*) ap#11 (signed byte*) ap#0 +Redundant Phi (signed byte*) bp#11 (signed byte*) bp#0 +Redundant Phi (signed byte*) cp#11 (signed byte*) cp#0 +Redundant Phi (byte*) main::at_line#3 (byte*) main::at_line#0 +Redundant Phi (signed byte*) ap#10 (signed byte*) ap#11 +Redundant Phi (signed byte*) bp#10 (signed byte*) bp#11 +Redundant Phi (signed byte*) cp#10 (signed byte*) cp#11 +Redundant Phi (byte) main::i#3 (byte) main::i#2 +Redundant Phi (signed byte*) ap#2 (signed byte*) ap#4 +Redundant Phi (signed byte*) bp#2 (signed byte*) bp#4 +Redundant Phi (signed byte*) cp#2 (signed byte*) cp#4 +Redundant Phi (byte*) main::at_line#4 (byte*) main::at#2 +Redundant Phi (signed byte) fmul8::a#1 (signed byte) fmul8::a#0 +Redundant Phi (signed byte*) ap#1 (signed byte*) ap#2 +Redundant Phi (signed byte) fmul8::b#1 (signed byte) fmul8::b#0 +Redundant Phi (signed byte*) bp#1 (signed byte*) bp#2 +Redundant Phi (signed byte*) cp#1 (signed byte*) cp#2 +Successful SSA optimization Pass2RedundantPhiElimination +Simple Condition (bool~) print_sbyte_at::$1 if((signed byte) print_sbyte_at::b#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte_at::@1 +Simple Condition (bool~) print_cls::$1 if((byte*) print_cls::sc#1!=(byte*~) print_cls::$0) goto print_cls::@1 +Simple Condition (bool~) main::$3 if((byte) main::k#1!=rangelast(0,4)) goto main::@1 +Simple Condition (bool~) main::$7 if((byte) main::j#1!=rangelast(0,4)) goto main::@3 +Simple Condition (bool~) main::$8 if((byte) main::i#1!=rangelast(0,4)) goto main::@2 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant (const byte*) print_screen#0 = ((byte*))1024 +Constant (const byte) print_char_at::ch#0 = '-' +Constant (const byte[]) print_hextab#0 = $2 +Constant (const signed byte/signed word/signed dword) $0 = -95 +Constant (const signed byte/signed word/signed dword) $1 = -64 +Constant (const byte*) main::at_line#0 = ((byte*))1024 +Constant (const byte) main::k#0 = 0 +Constant (const byte) main::i#0 = 0 +Constant (const byte) main::j#0 = 0 +Constant (const signed byte*) ap#0 = ((signed byte*))253 +Constant (const signed byte*) bp#0 = ((signed byte*))254 +Constant (const signed byte*) cp#0 = ((signed byte*))255 +Constant (const byte*) mulf_sqr1#0 = ((byte*))8192 +Constant (const byte*) mulf_sqr2#0 = ((byte*))8704 +Successful SSA optimization Pass2ConstantIdentification +Constant (const byte*) print_cls::sc#0 = print_screen#0 +Constant (const byte*) print_cls::$0 = print_screen#0+1000 +Constant (const signed byte[]) vals#0 = { $0, $1, 0, 64, 95 } +Constant (const byte*) main::at#0 = main::at_line#0+4 +Successful SSA optimization Pass2ConstantIdentification +Eliminating Noop Cast (byte) print_byte_at::b#0 ← ((byte)) (signed byte) print_sbyte_at::b#5 +Successful SSA optimization Pass2NopCastElimination +Resolved ranged next value main::k#1 ← ++ main::k#2 to ++ +Resolved ranged comparison value if(main::k#1!=rangelast(0,4)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 5 +Resolved ranged next value main::j#1 ← ++ main::j#2 to ++ +Resolved ranged comparison value if(main::j#1!=rangelast(0,4)) goto main::@3 to (byte/signed byte/word/signed word/dword/signed dword) 5 +Resolved ranged next value main::i#1 ← ++ main::i#2 to ++ +Resolved ranged comparison value if(main::i#1!=rangelast(0,4)) goto main::@2 to (byte/signed byte/word/signed word/dword/signed dword) 5 +Culled Empty Block (label) @11 +Culled Empty Block (label) @17 +Culled Empty Block (label) main::@7 +Culled Empty Block (label) main::@4 +Culled Empty Block (label) main::@9 +Culled Empty Block (label) @18 +Successful SSA optimization Pass2CullEmptyBlocks +Self Phi Eliminated (signed byte*) ap#4 +Self Phi Eliminated (signed byte*) bp#4 +Self Phi Eliminated (signed byte*) cp#4 +Successful SSA optimization Pass2SelfPhiElimination +Redundant Phi (signed byte*) ap#4 (const signed byte*) ap#0 +Redundant Phi (signed byte*) bp#4 (const signed byte*) bp#0 +Redundant Phi (signed byte*) cp#4 (const signed byte*) cp#0 +Successful SSA optimization Pass2RedundantPhiElimination +Inlining constant with var siblings (const byte) print_char_at::ch#0 +Inlining constant with var siblings (const byte*) print_cls::sc#0 +Inlining constant with var siblings (const byte*) main::at_line#0 +Inlining constant with var siblings (const byte) main::k#0 +Inlining constant with var siblings (const byte) main::i#0 +Inlining constant with var siblings (const byte) main::j#0 +Inlining constant with var siblings (const byte*) main::at#0 +Constant inlined print_cls::$0 = (const byte*) print_screen#0+(word/signed word/dword/signed dword) 1000 +Constant inlined print_char_at::ch#0 = (byte) '-' +Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined main::k#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined main::j#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined $0 = -(byte/signed byte/word/signed word/dword/signed dword) 95 +Constant inlined print_cls::sc#0 = (const byte*) print_screen#0 +Constant inlined $1 = -(byte/signed byte/word/signed word/dword/signed dword) 64 +Constant inlined main::at_line#0 = ((byte*))(word/signed word/dword/signed dword) 1024 +Constant inlined main::at#0 = ((byte*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 4 +Constant inlined $2 = (const byte[]) print_hextab#0 +Successful SSA optimization Pass2ConstantInlining +Added new block during phi lifting main::@12(between main::@8 and main::@1) +Added new block during phi lifting main::@13(between main::@5 and main::@2) +Added new block during phi lifting main::@14(between main::@11 and main::@3) +Added new block during phi lifting print_sbyte_at::@5(between print_sbyte_at and print_sbyte_at::@1) +Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1) +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of print_cls +CALL GRAPH +Calls in [] to main:3 +Calls in [main] to print_cls:6 print_sbyte_at:12 print_sbyte_at:22 fmul8:28 print_sbyte_at:35 +Calls in [print_sbyte_at] to print_char_at:51 print_byte_at:56 +Calls in [print_byte_at] to print_char_at:64 print_char_at:70 + +Created 12 initial phi equivalence classes +Coalesced [10] print_sbyte_at::b#8 ← print_sbyte_at::b#1 +Coalesced [11] print_sbyte_at::at#7 ← print_sbyte_at::at#0 +Coalesced [20] print_sbyte_at::b#10 ← print_sbyte_at::b#2 +Coalesced [21] print_sbyte_at::at#9 ← print_sbyte_at::at#1 +Not coalescing [23] main::at#12 ← main::at#2 +Coalesced [33] print_sbyte_at::b#9 ← print_sbyte_at::b#3 +Coalesced [34] print_sbyte_at::at#8 ← print_sbyte_at::at#2 +Coalesced [41] main::at_line#11 ← main::at#2 +Coalesced [42] main::i#8 ← main::i#1 +Coalesced [43] main::at#11 ← main::at#3 +Coalesced [44] main::j#5 ← main::j#1 +Coalesced [45] main::k#4 ← main::k#1 +Coalesced [46] main::at#10 ← main::at#1 +Coalesced [50] print_char_at::at#6 ← print_char_at::at#0 +Coalesced [53] print_sbyte_at::b#12 ← print_sbyte_at::b#0 +Coalesced [58] print_sbyte_at::b#11 ← print_sbyte_at::b#4 +Coalesced [62] print_char_at::ch#4 ← print_char_at::ch#1 +Coalesced [63] print_char_at::at#4 ← print_char_at::at#1 +Coalesced [68] print_char_at::ch#5 ← print_char_at::ch#2 +Coalesced [69] print_char_at::at#5 ← print_char_at::at#2 +Coalesced [86] print_cls::sc#3 ← print_cls::sc#1 +Coalesced down to 11 phi equivalence classes +Culled Empty Block (label) main::@13 +Culled Empty Block (label) main::@14 +Culled Empty Block (label) main::@12 +Culled Empty Block (label) print_sbyte_at::@5 +Culled Empty Block (label) print_cls::@3 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of print_cls + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() [ ] ( ) + to:@19 +@19: scope:[] from @begin + kickasm(location (const byte*) mulf_sqr1#0) {{ .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((i*i)/256) } + .if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } + .if(i>351) { .byte round(((512-i)*(512-i))/256) } + } + }} + kickasm(location (const byte*) mulf_sqr2#0) {{ .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } + .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } + .if(i>351) { .byte round(((i-511)*(i-511))/256) } + } + }} + [3] call main [ ] ( ) + to:@end +@end: scope:[] from @19 + [4] phi() [ ] ( ) +main: scope:[main] from @19 + [5] phi() [ ] ( main:3 [ ] ) + [6] call print_cls [ ] ( main:3 [ ] ) + to:main::@1 +main::@1: scope:[main] from main main::@8 + [7] (byte*) main::at#4 ← phi( main/((byte*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 4 main::@8/(byte*) main::at#1 ) [ main::k#2 main::at#4 ] ( main:3 [ main::k#2 main::at#4 ] ) + [7] (byte) main::k#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@8/(byte) main::k#1 ) [ main::k#2 main::at#4 ] ( main:3 [ main::k#2 main::at#4 ] ) + [8] (signed byte) print_sbyte_at::b#1 ← *((const signed byte[]) vals#0 + (byte) main::k#2) [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ) + [9] (byte*) print_sbyte_at::at#0 ← (byte*) main::at#4 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ) + [10] call print_sbyte_at [ main::k#2 main::at#4 ] ( main:3 [ main::k#2 main::at#4 ] ) + to:main::@8 +main::@8: scope:[main] from main::@1 + [11] (byte*) main::at#1 ← (byte*) main::at#4 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::k#2 main::at#1 ] ( main:3 [ main::k#2 main::at#1 ] ) + [12] (byte) main::k#1 ← ++ (byte) main::k#2 [ main::k#1 main::at#1 ] ( main:3 [ main::k#1 main::at#1 ] ) + [13] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@1 [ main::k#1 main::at#1 ] ( main:3 [ main::k#1 main::at#1 ] ) + to:main::@2 +main::@2: scope:[main] from main::@5 main::@8 + [14] (byte) main::i#2 ← phi( main::@8/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@5/(byte) main::i#1 ) [ main::at_line#2 main::i#2 ] ( main:3 [ main::at_line#2 main::i#2 ] ) + [14] (byte*) main::at_line#2 ← phi( main::@8/((byte*))(word/signed word/dword/signed dword) 1024 main::@5/(byte*) main::at#2 ) [ main::at_line#2 main::i#2 ] ( main:3 [ main::at_line#2 main::i#2 ] ) + [15] (byte*) main::at#2 ← (byte*) main::at_line#2 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) + [16] (signed byte) print_sbyte_at::b#2 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ) + [17] (byte*) print_sbyte_at::at#1 ← (byte*) main::at#2 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ) + [18] call print_sbyte_at [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) + [19] (byte*~) main::at#12 ← (byte*) main::at#2 [ main::i#2 main::at#2 main::at#12 ] ( main:3 [ main::i#2 main::at#2 main::at#12 ] ) + to:main::@3 +main::@3: scope:[main] from main::@11 main::@2 + [20] (byte) main::j#2 ← phi( main::@11/(byte) main::j#1 main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ main::i#2 main::at#2 main::at#6 main::j#2 ] ( main:3 [ main::i#2 main::at#2 main::at#6 main::j#2 ] ) + [20] (byte*) main::at#6 ← phi( main::@11/(byte*) main::at#3 main::@2/(byte*~) main::at#12 ) [ main::i#2 main::at#2 main::at#6 main::j#2 ] ( main:3 [ main::i#2 main::at#2 main::at#6 main::j#2 ] ) + [21] (byte*) main::at#3 ← (byte*) main::at#6 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + [22] (signed byte) fmul8::a#0 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 ] ) + [23] (signed byte) fmul8::b#0 ← *((const signed byte[]) vals#0 + (byte) main::j#2) [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 fmul8::b#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 fmul8::b#0 ] ) + [24] call fmul8 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + [25] (signed byte) fmul8::return#0 ← (signed byte) fmul8::return#1 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#0 ] ) + to:main::@10 +main::@10: scope:[main] from main::@3 + [26] (signed byte) main::r#0 ← (signed byte) fmul8::return#0 [ main::i#2 main::at#2 main::j#2 main::at#3 main::r#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 main::r#0 ] ) + [27] (signed byte) print_sbyte_at::b#3 ← (signed byte) main::r#0 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 ] ) + [28] (byte*) print_sbyte_at::at#2 ← (byte*) main::at#3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ) + [29] call print_sbyte_at [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:main::@11 +main::@11: scope:[main] from main::@10 + [30] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) + [31] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) + to:main::@5 +main::@5: scope:[main] from main::@11 + [32] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) + [33] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) + to:main::@return +main::@return: scope:[main] from main::@5 + [34] return [ ] ( main:3 [ ] ) + to:@return +print_sbyte_at: scope:[print_sbyte_at] from main::@1 main::@10 main::@2 + [35] (byte*) print_sbyte_at::at#3 ← phi( main::@1/(byte*) print_sbyte_at::at#0 main::@10/(byte*) print_sbyte_at::at#2 main::@2/(byte*) print_sbyte_at::at#1 ) [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + [35] (signed byte) print_sbyte_at::b#4 ← phi( main::@1/(signed byte) print_sbyte_at::b#1 main::@10/(signed byte) print_sbyte_at::b#3 main::@2/(signed byte) print_sbyte_at::b#2 ) [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + [36] if((signed byte) print_sbyte_at::b#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte_at::@1 [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + to:print_sbyte_at::@2 +print_sbyte_at::@2: scope:[print_sbyte_at] from print_sbyte_at + [37] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#3 [ print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ) + [38] call print_char_at [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + to:print_sbyte_at::@4 +print_sbyte_at::@4: scope:[print_sbyte_at] from print_sbyte_at::@2 + [39] (signed byte) print_sbyte_at::b#0 ← - (signed byte) print_sbyte_at::b#4 [ print_sbyte_at::at#3 print_sbyte_at::b#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::at#3 print_sbyte_at::b#0 ] ) + to:print_sbyte_at::@1 +print_sbyte_at::@1: scope:[print_sbyte_at] from print_sbyte_at print_sbyte_at::@4 + [40] (signed byte) print_sbyte_at::b#5 ← phi( print_sbyte_at/(signed byte) print_sbyte_at::b#4 print_sbyte_at::@4/(signed byte) print_sbyte_at::b#0 ) [ print_sbyte_at::at#3 print_sbyte_at::b#5 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::at#3 print_sbyte_at::b#5 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::at#3 print_sbyte_at::b#5 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::at#3 print_sbyte_at::b#5 ] ) + [41] (byte*) print_byte_at::at#0 ← (byte*) print_sbyte_at::at#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) + [42] call print_byte_at [ ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:print_sbyte_at::@return +print_sbyte_at::@return: scope:[print_sbyte_at] from print_sbyte_at::@1 + [43] return [ ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:@return +print_byte_at: scope:[print_byte_at] from print_sbyte_at::@1 + [44] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#5 >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ) + [45] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] ) + [46] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#0 [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ) + [47] call print_char_at [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) + to:print_byte_at::@1 +print_byte_at::@1: scope:[print_byte_at] from print_byte_at + [48] (byte~) print_byte_at::$2 ← (byte)(signed byte) print_sbyte_at::b#5 & (byte/signed byte/word/signed word/dword/signed dword) 15 [ print_byte_at::at#0 print_byte_at::$2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::at#0 print_byte_at::$2 ] ) + [49] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_byte_at::$2 print_char_at::at#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::$2 print_char_at::at#2 ] ) + [50] (byte) print_char_at::ch#2 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) [ print_char_at::at#2 print_char_at::ch#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_char_at::at#2 print_char_at::ch#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_char_at::at#2 print_char_at::ch#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_char_at::at#2 print_char_at::ch#2 ] ) + [51] call print_char_at [ ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:print_byte_at::@return +print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@1 + [52] return [ ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:@return +print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 print_sbyte_at::@2 + [53] (byte*) print_char_at::at#3 ← phi( print_byte_at/(byte*) print_char_at::at#1 print_byte_at::@1/(byte*) print_char_at::at#2 print_sbyte_at::@2/(byte*) print_char_at::at#0 ) [ print_char_at::ch#3 print_char_at::at#3 ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 print_char_at::ch#3 print_char_at::at#3 ] ) + [53] (byte) print_char_at::ch#3 ← phi( print_byte_at/(byte) print_char_at::ch#1 print_byte_at::@1/(byte) print_char_at::ch#2 print_sbyte_at::@2/(byte) '-' ) [ print_char_at::ch#3 print_char_at::at#3 ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 print_char_at::ch#3 print_char_at::at#3 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 print_char_at::ch#3 print_char_at::at#3 ] ) + [54] *((byte*) print_char_at::at#3) ← (byte) print_char_at::ch#3 [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:print_char_at::@return +print_char_at::@return: scope:[print_char_at] from print_char_at + [55] return [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + to:@return +fmul8: scope:[fmul8] from main::@3 + [56] *((const signed byte*) ap#0) ← (signed byte) fmul8::a#0 [ fmul8::b#0 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::b#0 ] ) + [57] *((const signed byte*) bp#0) ← (signed byte) fmul8::b#0 [ ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + asm { ldaap staA1+1 eor#$ff staA2+1 ldxbp sec A1: ldamulf_sqr1,x A2: sbcmulf_sqr2,x stacp } + [59] (signed byte) fmul8::return#1 ← *((const signed byte*) cp#0) [ fmul8::return#1 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + to:fmul8::@return +fmul8::@return: scope:[fmul8] from fmul8 + [60] return [ fmul8::return#1 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + to:@return +print_cls: scope:[print_cls] from main + [61] phi() [ ] ( main:3::print_cls:6 [ ] ) + to:print_cls::@1 +print_cls::@1: scope:[print_cls] from print_cls print_cls::@1 + [62] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_screen#0 print_cls::@1/(byte*) print_cls::sc#1 ) [ print_cls::sc#2 ] ( main:3::print_cls:6 [ print_cls::sc#2 ] ) + [63] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::print_cls:6 [ print_cls::sc#2 ] ) + [64] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) + [65] if((byte*) print_cls::sc#1!=(const byte*) print_screen#0+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) + to:print_cls::@return +print_cls::@return: scope:[print_cls] from print_cls::@1 + [66] return [ ] ( main:3::print_cls:6 [ ] ) + to:@return + + +VARIABLE REGISTER WEIGHTS +(signed byte*) ap +(signed byte*) bp +(signed byte*) cp +(signed byte()) fmul8((signed byte) fmul8::a , (signed byte) fmul8::b) +(signed byte) fmul8::a +(signed byte) fmul8::a#0 51.5 +(signed byte) fmul8::b +(signed byte) fmul8::b#0 51.5 +(signed byte) fmul8::return +(signed byte) fmul8::return#0 202.0 +(signed byte) fmul8::return#1 34.33333333333333 +(void()) main() +(byte*) main::at +(byte*) main::at#1 7.333333333333333 +(byte*~) main::at#12 22.0 +(byte*) main::at#2 2.3157894736842106 +(byte*) main::at#3 27.545454545454547 +(byte*) main::at#4 8.25 +(byte*) main::at#6 213.0 +(byte*) main::at_line +(byte*) main::at_line#2 22.0 +(byte) main::i +(byte) main::i#1 16.5 +(byte) main::i#2 7.444444444444445 +(byte) main::j +(byte) main::j#1 151.5 +(byte) main::j#2 30.299999999999997 +(byte) main::k +(byte) main::k#1 16.5 +(byte) main::k#2 6.6000000000000005 +(signed byte) main::r +(signed byte) main::r#0 202.0 +(byte*) mulf_sqr1 +(byte*) mulf_sqr2 +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 4.0 +(byte~) print_byte_at::$2 2.0 +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 1.0 +(byte) print_byte_at::b +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(byte*) print_char_at::at +(byte*) print_char_at::at#0 4.0 +(byte*) print_char_at::at#1 4.0 +(byte*) print_char_at::at#2 2.0 +(byte*) print_char_at::at#3 8.0 +(byte) print_char_at::ch +(byte) print_char_at::ch#1 2.0 +(byte) print_char_at::ch#2 4.0 +(byte) print_char_at::ch#3 6.0 +(void()) print_cls() +(byte*) print_cls::sc +(byte*) print_cls::sc#1 16.5 +(byte*) print_cls::sc#2 16.5 +(byte[]) print_hextab +(void()) print_sbyte_at((signed byte) print_sbyte_at::b , (byte*) print_sbyte_at::at) +(byte*) print_sbyte_at::at +(byte*) print_sbyte_at::at#0 22.0 +(byte*) print_sbyte_at::at#1 22.0 +(byte*) print_sbyte_at::at#2 202.0 +(byte*) print_sbyte_at::at#3 21.16666666666666 +(signed byte) print_sbyte_at::b +(signed byte) print_sbyte_at::b#0 4.0 +(signed byte) print_sbyte_at::b#1 11.0 +(signed byte) print_sbyte_at::b#2 11.0 +(signed byte) print_sbyte_at::b#3 101.0 +(signed byte) print_sbyte_at::b#4 32.25 +(signed byte) print_sbyte_at::b#5 0.6666666666666666 +(byte*) print_screen +(signed byte[]) vals + +Initial phi equivalence classes +[ main::k#2 main::k#1 ] +[ main::at#4 main::at#1 ] +[ main::at_line#2 main::at#2 ] +[ main::i#2 main::i#1 ] +[ main::at#6 main::at#3 main::at#12 ] +[ main::j#2 main::j#1 ] +[ print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 ] +[ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +[ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +[ print_char_at::at#3 print_char_at::at#1 print_char_at::at#2 print_char_at::at#0 ] +[ print_cls::sc#2 print_cls::sc#1 ] +Added variable fmul8::a#0 to zero page equivalence class [ fmul8::a#0 ] +Added variable fmul8::b#0 to zero page equivalence class [ fmul8::b#0 ] +Added variable fmul8::return#0 to zero page equivalence class [ fmul8::return#0 ] +Added variable main::r#0 to zero page equivalence class [ main::r#0 ] +Added variable print_byte_at::at#0 to zero page equivalence class [ print_byte_at::at#0 ] +Added variable print_byte_at::$0 to zero page equivalence class [ print_byte_at::$0 ] +Added variable print_byte_at::$2 to zero page equivalence class [ print_byte_at::$2 ] +Added variable fmul8::return#1 to zero page equivalence class [ fmul8::return#1 ] +Complete equivalence classes +[ main::k#2 main::k#1 ] +[ main::at#4 main::at#1 ] +[ main::at_line#2 main::at#2 ] +[ main::i#2 main::i#1 ] +[ main::at#6 main::at#3 main::at#12 ] +[ main::j#2 main::j#1 ] +[ print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 ] +[ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +[ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +[ print_char_at::at#3 print_char_at::at#1 print_char_at::at#2 print_char_at::at#0 ] +[ print_cls::sc#2 print_cls::sc#1 ] +[ fmul8::a#0 ] +[ fmul8::b#0 ] +[ fmul8::return#0 ] +[ main::r#0 ] +[ print_byte_at::at#0 ] +[ print_byte_at::$0 ] +[ print_byte_at::$2 ] +[ fmul8::return#1 ] +Allocated zp ZP_BYTE:2 [ main::k#2 main::k#1 ] +Allocated zp ZP_WORD:3 [ main::at#4 main::at#1 ] +Allocated zp ZP_WORD:5 [ main::at_line#2 main::at#2 ] +Allocated zp ZP_BYTE:7 [ main::i#2 main::i#1 ] +Allocated zp ZP_WORD:8 [ main::at#6 main::at#3 main::at#12 ] +Allocated zp ZP_BYTE:10 [ main::j#2 main::j#1 ] +Allocated zp ZP_WORD:11 [ print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 ] +Allocated zp ZP_BYTE:13 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +Allocated zp ZP_BYTE:14 [ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +Allocated zp ZP_WORD:15 [ print_char_at::at#3 print_char_at::at#1 print_char_at::at#2 print_char_at::at#0 ] +Allocated zp ZP_WORD:17 [ print_cls::sc#2 print_cls::sc#1 ] +Allocated zp ZP_BYTE:19 [ fmul8::a#0 ] +Allocated zp ZP_BYTE:20 [ fmul8::b#0 ] +Allocated zp ZP_BYTE:21 [ fmul8::return#0 ] +Allocated zp ZP_BYTE:22 [ main::r#0 ] +Allocated zp ZP_WORD:23 [ print_byte_at::at#0 ] +Allocated zp ZP_BYTE:25 [ print_byte_at::$0 ] +Allocated zp ZP_BYTE:26 [ print_byte_at::$2 ] +Allocated zp ZP_BYTE:27 [ fmul8::return#1 ] + +INITIAL ASM +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label print_screen = $400 + .label ap = $fd + .label bp = $fe + .label cp = $ff + .label mulf_sqr1 = $2000 + .label mulf_sqr2 = $2200 +//SEG2 @begin +bbegin: + jmp b19 +//SEG3 @19 +b19: +//SEG4 kickasm(location (const byte*) mulf_sqr1#0) {{ .for(var i=0;i<$200;i++) { .if(i<=159) { .byte round((i*i)/256) } .if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } .if(i>351) { .byte round(((512-i)*(512-i))/256) } } }} +//SEG5 kickasm(location (const byte*) mulf_sqr2#0) {{ .for(var i=0;i<$200;i++) { .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } .if(i>351) { .byte round(((i-511)*(i-511))/256) } } }} +//SEG6 [3] call main [ ] ( ) +//SEG7 [5] phi from @19 to main [phi:@19->main] +main_from_b19: + jsr main +//SEG8 [4] phi from @19 to @end [phi:@19->@end] +bend_from_b19: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + .label at = 3 + .label k = 2 + .label at_2 = 5 + .label at_3 = 8 + .label r = $16 + .label j = $a + .label i = 7 + .label at_line = 5 + .label at_6 = 8 + .label at_12 = 8 + //SEG11 [6] call print_cls [ ] ( main:3 [ ] ) + //SEG12 [61] phi from main to print_cls [phi:main->print_cls] + print_cls_from_main: + jsr print_cls + //SEG13 [7] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG14 [7] phi (byte*) main::at#4 = ((byte*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #<$400+4 + sta at + lda #>$400+4 + sta at+1 + //SEG15 [7] phi (byte) main::k#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1 + lda #0 + sta k + jmp b1 + //SEG16 [7] phi from main::@8 to main::@1 [phi:main::@8->main::@1] + b1_from_b8: + //SEG17 [7] phi (byte*) main::at#4 = (byte*) main::at#1 [phi:main::@8->main::@1#0] -- register_copy + //SEG18 [7] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@8->main::@1#1] -- register_copy + jmp b1 + //SEG19 main::@1 + b1: + //SEG20 [8] (signed byte) print_sbyte_at::b#1 ← *((const signed byte[]) vals#0 + (byte) main::k#2) [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ) -- vbsz1=pbsc1_derefidx_vbuz2 + ldy k + lda vals,y + sta print_sbyte_at.b + //SEG21 [9] (byte*) print_sbyte_at::at#0 ← (byte*) main::at#4 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ) -- pbuz1=pbuz2 + lda at + sta print_sbyte_at.at + lda at+1 + sta print_sbyte_at.at+1 + //SEG22 [10] call print_sbyte_at [ main::k#2 main::at#4 ] ( main:3 [ main::k#2 main::at#4 ] ) + //SEG23 [35] phi from main::@1 to print_sbyte_at [phi:main::@1->print_sbyte_at] + print_sbyte_at_from_b1: + //SEG24 [35] phi (byte*) print_sbyte_at::at#3 = (byte*) print_sbyte_at::at#0 [phi:main::@1->print_sbyte_at#0] -- register_copy + //SEG25 [35] phi (signed byte) print_sbyte_at::b#4 = (signed byte) print_sbyte_at::b#1 [phi:main::@1->print_sbyte_at#1] -- register_copy + jsr print_sbyte_at + jmp b8 + //SEG26 main::@8 + b8: + //SEG27 [11] (byte*) main::at#1 ← (byte*) main::at#4 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::k#2 main::at#1 ] ( main:3 [ main::k#2 main::at#1 ] ) -- pbuz1=pbuz1_plus_vbuc1 + lda at + clc + adc #4 + sta at + bcc !+ + inc at+1 + !: + //SEG28 [12] (byte) main::k#1 ← ++ (byte) main::k#2 [ main::k#1 main::at#1 ] ( main:3 [ main::k#1 main::at#1 ] ) -- vbuz1=_inc_vbuz1 + inc k + //SEG29 [13] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@1 [ main::k#1 main::at#1 ] ( main:3 [ main::k#1 main::at#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda k + cmp #5 + bne b1_from_b8 + //SEG30 [14] phi from main::@8 to main::@2 [phi:main::@8->main::@2] + b2_from_b8: + //SEG31 [14] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@8->main::@2#0] -- vbuz1=vbuc1 + lda #0 + sta i + //SEG32 [14] phi (byte*) main::at_line#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main::@8->main::@2#1] -- pbuz1=pbuc1 + lda #<$400 + sta at_line + lda #>$400 + sta at_line+1 + jmp b2 + //SEG33 [14] phi from main::@5 to main::@2 [phi:main::@5->main::@2] + b2_from_b5: + //SEG34 [14] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@5->main::@2#0] -- register_copy + //SEG35 [14] phi (byte*) main::at_line#2 = (byte*) main::at#2 [phi:main::@5->main::@2#1] -- register_copy + jmp b2 + //SEG36 main::@2 + b2: + //SEG37 [15] (byte*) main::at#2 ← (byte*) main::at_line#2 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) -- pbuz1=pbuz1_plus_vbuc1 + lda at_2 + clc + adc #$28 + sta at_2 + bcc !+ + inc at_2+1 + !: + //SEG38 [16] (signed byte) print_sbyte_at::b#2 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ) -- vbsz1=pbsc1_derefidx_vbuz2 + ldy i + lda vals,y + sta print_sbyte_at.b + //SEG39 [17] (byte*) print_sbyte_at::at#1 ← (byte*) main::at#2 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ) -- pbuz1=pbuz2 + lda at_2 + sta print_sbyte_at.at + lda at_2+1 + sta print_sbyte_at.at+1 + //SEG40 [18] call print_sbyte_at [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) + //SEG41 [35] phi from main::@2 to print_sbyte_at [phi:main::@2->print_sbyte_at] + print_sbyte_at_from_b2: + //SEG42 [35] phi (byte*) print_sbyte_at::at#3 = (byte*) print_sbyte_at::at#1 [phi:main::@2->print_sbyte_at#0] -- register_copy + //SEG43 [35] phi (signed byte) print_sbyte_at::b#4 = (signed byte) print_sbyte_at::b#2 [phi:main::@2->print_sbyte_at#1] -- register_copy + jsr print_sbyte_at + //SEG44 [19] (byte*~) main::at#12 ← (byte*) main::at#2 [ main::i#2 main::at#2 main::at#12 ] ( main:3 [ main::i#2 main::at#2 main::at#12 ] ) -- pbuz1=pbuz2 + lda at_2 + sta at_12 + lda at_2+1 + sta at_12+1 + //SEG45 [20] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + b3_from_b2: + //SEG46 [20] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->main::@3#0] -- vbuz1=vbuc1 + lda #0 + sta j + //SEG47 [20] phi (byte*) main::at#6 = (byte*~) main::at#12 [phi:main::@2->main::@3#1] -- register_copy + jmp b3 + //SEG48 [20] phi from main::@11 to main::@3 [phi:main::@11->main::@3] + b3_from_b11: + //SEG49 [20] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@11->main::@3#0] -- register_copy + //SEG50 [20] phi (byte*) main::at#6 = (byte*) main::at#3 [phi:main::@11->main::@3#1] -- register_copy + jmp b3 + //SEG51 main::@3 + b3: + //SEG52 [21] (byte*) main::at#3 ← (byte*) main::at#6 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) -- pbuz1=pbuz1_plus_vbuc1 + lda at_3 + clc + adc #4 + sta at_3 + bcc !+ + inc at_3+1 + !: + //SEG53 [22] (signed byte) fmul8::a#0 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 ] ) -- vbsz1=pbsc1_derefidx_vbuz2 + ldy i + lda vals,y + sta fmul8.a + //SEG54 [23] (signed byte) fmul8::b#0 ← *((const signed byte[]) vals#0 + (byte) main::j#2) [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 fmul8::b#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 fmul8::b#0 ] ) -- vbsz1=pbsc1_derefidx_vbuz2 + ldy j + lda vals,y + sta fmul8.b + //SEG55 [24] call fmul8 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + jsr fmul8 + //SEG56 [25] (signed byte) fmul8::return#0 ← (signed byte) fmul8::return#1 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#0 ] ) -- vbsz1=vbsz2 + lda fmul8.return_1 + sta fmul8.return + jmp b10 + //SEG57 main::@10 + b10: + //SEG58 [26] (signed byte) main::r#0 ← (signed byte) fmul8::return#0 [ main::i#2 main::at#2 main::j#2 main::at#3 main::r#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 main::r#0 ] ) -- vbsz1=vbsz2 + lda fmul8.return + sta r + //SEG59 [27] (signed byte) print_sbyte_at::b#3 ← (signed byte) main::r#0 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 ] ) -- vbsz1=vbsz2 + lda r + sta print_sbyte_at.b + //SEG60 [28] (byte*) print_sbyte_at::at#2 ← (byte*) main::at#3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ) -- pbuz1=pbuz2 + lda at_3 + sta print_sbyte_at.at + lda at_3+1 + sta print_sbyte_at.at+1 + //SEG61 [29] call print_sbyte_at [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + //SEG62 [35] phi from main::@10 to print_sbyte_at [phi:main::@10->print_sbyte_at] + print_sbyte_at_from_b10: + //SEG63 [35] phi (byte*) print_sbyte_at::at#3 = (byte*) print_sbyte_at::at#2 [phi:main::@10->print_sbyte_at#0] -- register_copy + //SEG64 [35] phi (signed byte) print_sbyte_at::b#4 = (signed byte) print_sbyte_at::b#3 [phi:main::@10->print_sbyte_at#1] -- register_copy + jsr print_sbyte_at + jmp b11 + //SEG65 main::@11 + b11: + //SEG66 [30] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) -- vbuz1=_inc_vbuz1 + inc j + //SEG67 [31] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda j + cmp #5 + bne b3_from_b11 + jmp b5 + //SEG68 main::@5 + b5: + //SEG69 [32] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG70 [33] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda i + cmp #5 + bne b2_from_b5 + jmp breturn + //SEG71 main::@return + breturn: + //SEG72 [34] return [ ] ( main:3 [ ] ) + rts +} +//SEG73 print_sbyte_at +print_sbyte_at: { + .label b = $d + .label at = $b + //SEG74 [36] if((signed byte) print_sbyte_at::b#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte_at::@1 [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) -- vbsz1_ge_0_then_la1 + lda b + cmp #0 + bpl b1_from_print_sbyte_at + jmp b2 + //SEG75 print_sbyte_at::@2 + b2: + //SEG76 [37] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#3 [ print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ) -- pbuz1=pbuz2 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + //SEG77 [38] call print_char_at [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + //SEG78 [53] phi from print_sbyte_at::@2 to print_char_at [phi:print_sbyte_at::@2->print_char_at] + print_char_at_from_b2: + //SEG79 [53] phi (byte*) print_char_at::at#3 = (byte*) print_char_at::at#0 [phi:print_sbyte_at::@2->print_char_at#0] -- register_copy + //SEG80 [53] phi (byte) print_char_at::ch#3 = (byte) '-' [phi:print_sbyte_at::@2->print_char_at#1] -- vbuz1=vbuc1 + lda #'-' + sta print_char_at.ch + jsr print_char_at + jmp b4 + //SEG81 print_sbyte_at::@4 + b4: + //SEG82 [39] (signed byte) print_sbyte_at::b#0 ← - (signed byte) print_sbyte_at::b#4 [ print_sbyte_at::at#3 print_sbyte_at::b#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::at#3 print_sbyte_at::b#0 ] ) -- vbsz1=_neg_vbsz1 + lda b + eor #$ff + clc + adc #1 + sta b + //SEG83 [40] phi from print_sbyte_at print_sbyte_at::@4 to print_sbyte_at::@1 [phi:print_sbyte_at/print_sbyte_at::@4->print_sbyte_at::@1] + b1_from_print_sbyte_at: + b1_from_b4: + //SEG84 [40] phi (signed byte) print_sbyte_at::b#5 = (signed byte) print_sbyte_at::b#4 [phi:print_sbyte_at/print_sbyte_at::@4->print_sbyte_at::@1#0] -- register_copy + jmp b1 + //SEG85 print_sbyte_at::@1 + b1: + //SEG86 [41] (byte*) print_byte_at::at#0 ← (byte*) print_sbyte_at::at#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) -- pbuz1=pbuz2_plus_1 + lda at + clc + adc #1 + sta print_byte_at.at + lda at+1 + adc #0 + sta print_byte_at.at+1 + //SEG87 [42] call print_byte_at [ ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + jsr print_byte_at + jmp breturn + //SEG88 print_sbyte_at::@return + breturn: + //SEG89 [43] return [ ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + rts +} +//SEG90 print_byte_at +print_byte_at: { + .label _0 = $19 + .label _2 = $1a + .label at = $17 + //SEG91 [44] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#5 >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ) -- vbuz1=vbuz2_ror_4 + lda print_sbyte_at.b + lsr + lsr + lsr + lsr + sta _0 + //SEG92 [45] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] ) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy _0 + lda print_hextab,y + sta print_char_at.ch + //SEG93 [46] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#0 [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ) -- pbuz1=pbuz2 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + //SEG94 [47] call print_char_at [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) + //SEG95 [53] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + print_char_at_from_print_byte_at: + //SEG96 [53] phi (byte*) print_char_at::at#3 = (byte*) print_char_at::at#1 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG97 [53] phi (byte) print_char_at::ch#3 = (byte) print_char_at::ch#1 [phi:print_byte_at->print_char_at#1] -- register_copy + jsr print_char_at + jmp b1 + //SEG98 print_byte_at::@1 + b1: + //SEG99 [48] (byte~) print_byte_at::$2 ← (byte)(signed byte) print_sbyte_at::b#5 & (byte/signed byte/word/signed word/dword/signed dword) 15 [ print_byte_at::at#0 print_byte_at::$2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::at#0 print_byte_at::$2 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #$f + and print_sbyte_at.b + sta _2 + //SEG100 [49] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_byte_at::$2 print_char_at::at#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::$2 print_char_at::at#2 ] ) -- pbuz1=pbuz2_plus_1 + lda at + clc + adc #1 + sta print_char_at.at + lda at+1 + adc #0 + sta print_char_at.at+1 + //SEG101 [50] (byte) print_char_at::ch#2 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) [ print_char_at::at#2 print_char_at::ch#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_char_at::at#2 print_char_at::ch#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_char_at::at#2 print_char_at::ch#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_char_at::at#2 print_char_at::ch#2 ] ) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy _2 + lda print_hextab,y + sta print_char_at.ch + //SEG102 [51] call print_char_at [ ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + //SEG103 [53] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + print_char_at_from_b1: + //SEG104 [53] phi (byte*) print_char_at::at#3 = (byte*) print_char_at::at#2 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG105 [53] phi (byte) print_char_at::ch#3 = (byte) print_char_at::ch#2 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + jsr print_char_at + jmp breturn + //SEG106 print_byte_at::@return + breturn: + //SEG107 [52] return [ ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + rts +} +//SEG108 print_char_at +print_char_at: { + .label at = $f + .label ch = $e + //SEG109 [54] *((byte*) print_char_at::at#3) ← (byte) print_char_at::ch#3 [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) -- _deref_pbuz1=vbuz2 + lda ch + ldy #0 + sta (at),y + jmp breturn + //SEG110 print_char_at::@return + breturn: + //SEG111 [55] return [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + rts +} +//SEG112 fmul8 +fmul8: { + .label a = $13 + .label b = $14 + .label return = $15 + .label return_1 = $1b + //SEG113 [56] *((const signed byte*) ap#0) ← (signed byte) fmul8::a#0 [ fmul8::b#0 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::b#0 ] ) -- _deref_pbsc1=vbsz1 + lda a + sta ap + //SEG114 [57] *((const signed byte*) bp#0) ← (signed byte) fmul8::b#0 [ ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) -- _deref_pbsc1=vbsz1 + lda b + sta bp + //SEG115 asm { ldaap staA1+1 eor#$ff staA2+1 ldxbp sec A1: ldamulf_sqr1,x A2: sbcmulf_sqr2,x stacp } + lda ap + sta A1+1 + eor #$ff + sta A2+1 + ldx bp + sec + A1: + lda mulf_sqr1,x + A2: + sbc mulf_sqr2,x + sta cp + //SEG116 [59] (signed byte) fmul8::return#1 ← *((const signed byte*) cp#0) [ fmul8::return#1 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) -- vbsz1=_deref_pbsc1 + lda cp + sta return_1 + jmp breturn + //SEG117 fmul8::@return + breturn: + //SEG118 [60] return [ fmul8::return#1 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + rts +} +//SEG119 print_cls +print_cls: { + .label sc = $11 + //SEG120 [62] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] + b1_from_print_cls: + //SEG121 [62] phi (byte*) print_cls::sc#2 = (const byte*) print_screen#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 + lda #print_screen + sta sc+1 + jmp b1 + //SEG122 [62] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] + b1_from_b1: + //SEG123 [62] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy + jmp b1 + //SEG124 print_cls::@1 + b1: + //SEG125 [63] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::print_cls:6 [ print_cls::sc#2 ] ) -- _deref_pbuz1=vbuc1 + lda #' ' + ldy #0 + sta (sc),y + //SEG126 [64] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) -- pbuz1=_inc_pbuz1 + inc sc + bne !+ + inc sc+1 + !: + //SEG127 [65] if((byte*) print_cls::sc#1!=(const byte*) print_screen#0+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) -- pbuz1_neq_pbuc1_then_la1 + lda sc+1 + cmp #>print_screen+$3e8 + bne b1_from_b1 + lda sc + cmp #159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } + .if(i>351) { .byte round(((512-i)*(512-i))/256) } + } + +.pc = mulf_sqr2 "Inline" + .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } + .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } + .if(i>351) { .byte round(((i-511)*(i-511))/256) } + } + + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [9] (byte*) print_sbyte_at::at#0 ← (byte*) main::at#4 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::k#2 main::k#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:13 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +Statement [11] (byte*) main::at#1 ← (byte*) main::at#4 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::k#2 main::at#1 ] ( main:3 [ main::k#2 main::at#1 ] ) always clobbers reg byte a +Statement [15] (byte*) main::at#2 ← (byte*) main::at_line#2 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:7 [ main::i#2 main::i#1 ] +Statement [17] (byte*) print_sbyte_at::at#1 ← (byte*) main::at#2 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ) always clobbers reg byte a +Statement [19] (byte*~) main::at#12 ← (byte*) main::at#2 [ main::i#2 main::at#2 main::at#12 ] ( main:3 [ main::i#2 main::at#2 main::at#12 ] ) always clobbers reg byte a +Statement [21] (byte*) main::at#3 ← (byte*) main::at#6 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:10 [ main::j#2 main::j#1 ] +Statement [28] (byte*) print_sbyte_at::at#2 ← (byte*) main::at#3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ) always clobbers reg byte a +Statement [37] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#3 [ print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ) always clobbers reg byte a +Statement [39] (signed byte) print_sbyte_at::b#0 ← - (signed byte) print_sbyte_at::b#4 [ print_sbyte_at::at#3 print_sbyte_at::b#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::at#3 print_sbyte_at::b#0 ] ) always clobbers reg byte a +Statement [41] (byte*) print_byte_at::at#0 ← (byte*) print_sbyte_at::at#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) always clobbers reg byte a +Statement [44] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#5 >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ) always clobbers reg byte a +Statement [46] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#0 [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:14 [ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +Statement [48] (byte~) print_byte_at::$2 ← (byte)(signed byte) print_sbyte_at::b#5 & (byte/signed byte/word/signed word/dword/signed dword) 15 [ print_byte_at::at#0 print_byte_at::$2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::at#0 print_byte_at::$2 ] ) always clobbers reg byte a +Statement [49] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_byte_at::$2 print_char_at::at#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::$2 print_char_at::at#2 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:26 [ print_byte_at::$2 ] +Statement [54] *((byte*) print_char_at::at#3) ← (byte) print_char_at::ch#3 [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ main::k#2 main::k#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:13 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:7 [ main::i#2 main::i#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:10 [ main::j#2 main::j#1 ] +Statement asm { ldaap staA1+1 eor#$ff staA2+1 ldxbp sec A1: ldamulf_sqr1,x A2: sbcmulf_sqr2,x stacp } always clobbers reg byte a reg byte x +Removing always clobbered register reg byte x as potential for zp ZP_BYTE:7 [ main::i#2 main::i#1 ] +Removing always clobbered register reg byte x as potential for zp ZP_BYTE:10 [ main::j#2 main::j#1 ] +Statement [63] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::print_cls:6 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y +Statement [65] if((byte*) print_cls::sc#1!=(const byte*) print_screen#0+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) always clobbers reg byte a +Statement [8] (signed byte) print_sbyte_at::b#1 ← *((const signed byte[]) vals#0 + (byte) main::k#2) [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ) always clobbers reg byte a +Statement [9] (byte*) print_sbyte_at::at#0 ← (byte*) main::at#4 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ) always clobbers reg byte a +Statement [11] (byte*) main::at#1 ← (byte*) main::at#4 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::k#2 main::at#1 ] ( main:3 [ main::k#2 main::at#1 ] ) always clobbers reg byte a +Statement [15] (byte*) main::at#2 ← (byte*) main::at_line#2 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) always clobbers reg byte a +Statement [16] (signed byte) print_sbyte_at::b#2 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ) always clobbers reg byte a +Statement [17] (byte*) print_sbyte_at::at#1 ← (byte*) main::at#2 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ) always clobbers reg byte a +Statement [19] (byte*~) main::at#12 ← (byte*) main::at#2 [ main::i#2 main::at#2 main::at#12 ] ( main:3 [ main::i#2 main::at#2 main::at#12 ] ) always clobbers reg byte a +Statement [21] (byte*) main::at#3 ← (byte*) main::at#6 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) always clobbers reg byte a +Statement [28] (byte*) print_sbyte_at::at#2 ← (byte*) main::at#3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ) always clobbers reg byte a +Statement [31] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) always clobbers reg byte a +Statement [33] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) always clobbers reg byte a +Statement [37] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#3 [ print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ) always clobbers reg byte a +Statement [39] (signed byte) print_sbyte_at::b#0 ← - (signed byte) print_sbyte_at::b#4 [ print_sbyte_at::at#3 print_sbyte_at::b#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::at#3 print_sbyte_at::b#0 ] ) always clobbers reg byte a +Statement [41] (byte*) print_byte_at::at#0 ← (byte*) print_sbyte_at::at#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) always clobbers reg byte a +Statement [44] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#5 >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ) always clobbers reg byte a +Statement [46] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#0 [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ) always clobbers reg byte a +Statement [48] (byte~) print_byte_at::$2 ← (byte)(signed byte) print_sbyte_at::b#5 & (byte/signed byte/word/signed word/dword/signed dword) 15 [ print_byte_at::at#0 print_byte_at::$2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::at#0 print_byte_at::$2 ] ) always clobbers reg byte a +Statement [49] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_byte_at::$2 print_char_at::at#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::$2 print_char_at::at#2 ] ) always clobbers reg byte a +Statement [54] *((byte*) print_char_at::at#3) ← (byte) print_char_at::ch#3 [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) always clobbers reg byte a reg byte y +Statement asm { ldaap staA1+1 eor#$ff staA2+1 ldxbp sec A1: ldamulf_sqr1,x A2: sbcmulf_sqr2,x stacp } always clobbers reg byte a reg byte x +Statement [63] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::print_cls:6 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y +Statement [65] if((byte*) print_cls::sc#1!=(const byte*) print_screen#0+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) always clobbers reg byte a +Potential registers zp ZP_BYTE:2 [ main::k#2 main::k#1 ] : zp ZP_BYTE:2 , reg byte x , +Potential registers zp ZP_WORD:3 [ main::at#4 main::at#1 ] : zp ZP_WORD:3 , +Potential registers zp ZP_WORD:5 [ main::at_line#2 main::at#2 ] : zp ZP_WORD:5 , +Potential registers zp ZP_BYTE:7 [ main::i#2 main::i#1 ] : zp ZP_BYTE:7 , +Potential registers zp ZP_WORD:8 [ main::at#6 main::at#3 main::at#12 ] : zp ZP_WORD:8 , +Potential registers zp ZP_BYTE:10 [ main::j#2 main::j#1 ] : zp ZP_BYTE:10 , +Potential registers zp ZP_WORD:11 [ print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 ] : zp ZP_WORD:11 , +Potential registers zp ZP_BYTE:13 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] : zp ZP_BYTE:13 , reg byte x , +Potential registers zp ZP_BYTE:14 [ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] : zp ZP_BYTE:14 , reg byte x , reg byte y , +Potential registers zp ZP_WORD:15 [ print_char_at::at#3 print_char_at::at#1 print_char_at::at#2 print_char_at::at#0 ] : zp ZP_WORD:15 , +Potential registers zp ZP_WORD:17 [ print_cls::sc#2 print_cls::sc#1 ] : zp ZP_WORD:17 , +Potential registers zp ZP_BYTE:19 [ fmul8::a#0 ] : zp ZP_BYTE:19 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:20 [ fmul8::b#0 ] : zp ZP_BYTE:20 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:21 [ fmul8::return#0 ] : zp ZP_BYTE:21 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:22 [ main::r#0 ] : zp ZP_BYTE:22 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_WORD:23 [ print_byte_at::at#0 ] : zp ZP_WORD:23 , +Potential registers zp ZP_BYTE:25 [ print_byte_at::$0 ] : zp ZP_BYTE:25 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:26 [ print_byte_at::$2 ] : zp ZP_BYTE:26 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:27 [ fmul8::return#1 ] : zp ZP_BYTE:27 , reg byte a , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [main] 262.55: zp ZP_WORD:8 [ main::at#6 main::at#3 main::at#12 ] 202: zp ZP_BYTE:22 [ main::r#0 ] 181.8: zp ZP_BYTE:10 [ main::j#2 main::j#1 ] 24.32: zp ZP_WORD:5 [ main::at_line#2 main::at#2 ] 23.94: zp ZP_BYTE:7 [ main::i#2 main::i#1 ] 23.1: zp ZP_BYTE:2 [ main::k#2 main::k#1 ] 15.58: zp ZP_WORD:3 [ main::at#4 main::at#1 ] +Uplift Scope [print_sbyte_at] 267.17: zp ZP_WORD:11 [ print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 ] 159.92: zp ZP_BYTE:13 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +Uplift Scope [fmul8] 202: zp ZP_BYTE:21 [ fmul8::return#0 ] 51.5: zp ZP_BYTE:19 [ fmul8::a#0 ] 51.5: zp ZP_BYTE:20 [ fmul8::b#0 ] 34.33: zp ZP_BYTE:27 [ fmul8::return#1 ] +Uplift Scope [print_cls] 33: zp ZP_WORD:17 [ print_cls::sc#2 print_cls::sc#1 ] +Uplift Scope [print_char_at] 18: zp ZP_WORD:15 [ print_char_at::at#3 print_char_at::at#1 print_char_at::at#2 print_char_at::at#0 ] 12: zp ZP_BYTE:14 [ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +Uplift Scope [print_byte_at] 4: zp ZP_BYTE:25 [ print_byte_at::$0 ] 2: zp ZP_BYTE:26 [ print_byte_at::$2 ] 1: zp ZP_WORD:23 [ print_byte_at::at#0 ] +Uplift Scope [] + +Uplifting [main] best 12721 combination zp ZP_WORD:8 [ main::at#6 main::at#3 main::at#12 ] reg byte a [ main::r#0 ] zp ZP_BYTE:10 [ main::j#2 main::j#1 ] zp ZP_WORD:5 [ main::at_line#2 main::at#2 ] zp ZP_BYTE:7 [ main::i#2 main::i#1 ] reg byte x [ main::k#2 main::k#1 ] zp ZP_WORD:3 [ main::at#4 main::at#1 ] +Uplifting [print_sbyte_at] best 12721 combination zp ZP_WORD:11 [ print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 ] zp ZP_BYTE:13 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +Uplifting [fmul8] best 11517 combination reg byte a [ fmul8::return#0 ] reg byte a [ fmul8::a#0 ] reg byte y [ fmul8::b#0 ] zp ZP_BYTE:27 [ fmul8::return#1 ] +Limited combination testing to 100 combinations of 256 possible. +Uplifting [print_cls] best 11517 combination zp ZP_WORD:17 [ print_cls::sc#2 print_cls::sc#1 ] +Uplifting [print_char_at] best 11517 combination zp ZP_WORD:15 [ print_char_at::at#3 print_char_at::at#1 print_char_at::at#2 print_char_at::at#0 ] zp ZP_BYTE:14 [ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +Uplifting [print_byte_at] best 11509 combination reg byte a [ print_byte_at::$0 ] reg byte y [ print_byte_at::$2 ] zp ZP_WORD:23 [ print_byte_at::at#0 ] +Uplifting [] best 11509 combination +Attempting to uplift remaining variables inzp ZP_BYTE:10 [ main::j#2 main::j#1 ] +Uplifting [main] best 11509 combination zp ZP_BYTE:10 [ main::j#2 main::j#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:13 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +Uplifting [print_sbyte_at] best 11509 combination zp ZP_BYTE:13 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:27 [ fmul8::return#1 ] +Uplifting [fmul8] best 11206 combination reg byte a [ fmul8::return#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:7 [ main::i#2 main::i#1 ] +Uplifting [main] best 11206 combination zp ZP_BYTE:7 [ main::i#2 main::i#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:14 [ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +Uplifting [print_char_at] best 11206 combination zp ZP_BYTE:14 [ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +Coalescing zero page register with common assignment [ zp ZP_WORD:15 [ print_char_at::at#3 print_char_at::at#1 print_char_at::at#2 print_char_at::at#0 ] ] with [ zp ZP_WORD:23 [ print_byte_at::at#0 ] ] - score: 2 +Coalescing zero page register with common assignment [ zp ZP_WORD:3 [ main::at#4 main::at#1 ] ] with [ zp ZP_WORD:11 [ print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:3 [ main::at#4 main::at#1 print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 ] ] with [ zp ZP_WORD:8 [ main::at#6 main::at#3 main::at#12 ] ] - score: 1 +Coalescing zero page register [ zp ZP_WORD:3 [ main::at#4 main::at#1 print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 main::at#6 main::at#3 main::at#12 ] ] with [ zp ZP_WORD:17 [ print_cls::sc#2 print_cls::sc#1 ] ] +Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ main::at#4 main::at#1 print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 main::at#6 main::at#3 main::at#12 print_cls::sc#2 print_cls::sc#1 ] +Allocated (was zp ZP_WORD:5) zp ZP_WORD:4 [ main::at_line#2 main::at#2 ] +Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:6 [ main::i#2 main::i#1 ] +Allocated (was zp ZP_BYTE:10) zp ZP_BYTE:7 [ main::j#2 main::j#1 ] +Allocated (was zp ZP_BYTE:13) zp ZP_BYTE:8 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +Allocated (was zp ZP_BYTE:14) zp ZP_BYTE:9 [ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +Allocated (was zp ZP_WORD:15) zp ZP_WORD:10 [ print_char_at::at#3 print_char_at::at#1 print_char_at::at#2 print_char_at::at#0 print_byte_at::at#0 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label print_screen = $400 + .label ap = $fd + .label bp = $fe + .label cp = $ff + .label mulf_sqr1 = $2000 + .label mulf_sqr2 = $2200 +//SEG2 @begin +bbegin: + jmp b19 +//SEG3 @19 +b19: +//SEG4 kickasm(location (const byte*) mulf_sqr1#0) {{ .for(var i=0;i<$200;i++) { .if(i<=159) { .byte round((i*i)/256) } .if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } .if(i>351) { .byte round(((512-i)*(512-i))/256) } } }} +//SEG5 kickasm(location (const byte*) mulf_sqr2#0) {{ .for(var i=0;i<$200;i++) { .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } .if(i>351) { .byte round(((i-511)*(i-511))/256) } } }} +//SEG6 [3] call main [ ] ( ) +//SEG7 [5] phi from @19 to main [phi:@19->main] +main_from_b19: + jsr main +//SEG8 [4] phi from @19 to @end [phi:@19->@end] +bend_from_b19: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + .label at = 2 + .label at_2 = 4 + .label j = 7 + .label i = 6 + .label at_line = 4 + //SEG11 [6] call print_cls [ ] ( main:3 [ ] ) + //SEG12 [61] phi from main to print_cls [phi:main->print_cls] + print_cls_from_main: + jsr print_cls + //SEG13 [7] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG14 [7] phi (byte*) main::at#4 = ((byte*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #<$400+4 + sta at + lda #>$400+4 + sta at+1 + //SEG15 [7] phi (byte) main::k#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1 + ldx #0 + jmp b1 + //SEG16 [7] phi from main::@8 to main::@1 [phi:main::@8->main::@1] + b1_from_b8: + //SEG17 [7] phi (byte*) main::at#4 = (byte*) main::at#1 [phi:main::@8->main::@1#0] -- register_copy + //SEG18 [7] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@8->main::@1#1] -- register_copy + jmp b1 + //SEG19 main::@1 + b1: + //SEG20 [8] (signed byte) print_sbyte_at::b#1 ← *((const signed byte[]) vals#0 + (byte) main::k#2) [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ) -- vbsz1=pbsc1_derefidx_vbuxx + lda vals,x + sta print_sbyte_at.b + //SEG21 [9] (byte*) print_sbyte_at::at#0 ← (byte*) main::at#4 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ) + // (byte*) print_sbyte_at::at#0 = (byte*) main::at#4 // register copy zp ZP_WORD:2 + //SEG22 [10] call print_sbyte_at [ main::k#2 main::at#4 ] ( main:3 [ main::k#2 main::at#4 ] ) + //SEG23 [35] phi from main::@1 to print_sbyte_at [phi:main::@1->print_sbyte_at] + print_sbyte_at_from_b1: + //SEG24 [35] phi (byte*) print_sbyte_at::at#3 = (byte*) print_sbyte_at::at#0 [phi:main::@1->print_sbyte_at#0] -- register_copy + //SEG25 [35] phi (signed byte) print_sbyte_at::b#4 = (signed byte) print_sbyte_at::b#1 [phi:main::@1->print_sbyte_at#1] -- register_copy + jsr print_sbyte_at + jmp b8 + //SEG26 main::@8 + b8: + //SEG27 [11] (byte*) main::at#1 ← (byte*) main::at#4 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::k#2 main::at#1 ] ( main:3 [ main::k#2 main::at#1 ] ) -- pbuz1=pbuz1_plus_vbuc1 + lda at + clc + adc #4 + sta at + bcc !+ + inc at+1 + !: + //SEG28 [12] (byte) main::k#1 ← ++ (byte) main::k#2 [ main::k#1 main::at#1 ] ( main:3 [ main::k#1 main::at#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG29 [13] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@1 [ main::k#1 main::at#1 ] ( main:3 [ main::k#1 main::at#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #5 + bne b1_from_b8 + //SEG30 [14] phi from main::@8 to main::@2 [phi:main::@8->main::@2] + b2_from_b8: + //SEG31 [14] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@8->main::@2#0] -- vbuz1=vbuc1 + lda #0 + sta i + //SEG32 [14] phi (byte*) main::at_line#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main::@8->main::@2#1] -- pbuz1=pbuc1 + lda #<$400 + sta at_line + lda #>$400 + sta at_line+1 + jmp b2 + //SEG33 [14] phi from main::@5 to main::@2 [phi:main::@5->main::@2] + b2_from_b5: + //SEG34 [14] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@5->main::@2#0] -- register_copy + //SEG35 [14] phi (byte*) main::at_line#2 = (byte*) main::at#2 [phi:main::@5->main::@2#1] -- register_copy + jmp b2 + //SEG36 main::@2 + b2: + //SEG37 [15] (byte*) main::at#2 ← (byte*) main::at_line#2 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) -- pbuz1=pbuz1_plus_vbuc1 + lda at_2 + clc + adc #$28 + sta at_2 + bcc !+ + inc at_2+1 + !: + //SEG38 [16] (signed byte) print_sbyte_at::b#2 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ) -- vbsz1=pbsc1_derefidx_vbuz2 + ldy i + lda vals,y + sta print_sbyte_at.b + //SEG39 [17] (byte*) print_sbyte_at::at#1 ← (byte*) main::at#2 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ) -- pbuz1=pbuz2 + lda at_2 + sta print_sbyte_at.at + lda at_2+1 + sta print_sbyte_at.at+1 + //SEG40 [18] call print_sbyte_at [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) + //SEG41 [35] phi from main::@2 to print_sbyte_at [phi:main::@2->print_sbyte_at] + print_sbyte_at_from_b2: + //SEG42 [35] phi (byte*) print_sbyte_at::at#3 = (byte*) print_sbyte_at::at#1 [phi:main::@2->print_sbyte_at#0] -- register_copy + //SEG43 [35] phi (signed byte) print_sbyte_at::b#4 = (signed byte) print_sbyte_at::b#2 [phi:main::@2->print_sbyte_at#1] -- register_copy + jsr print_sbyte_at + //SEG44 [19] (byte*~) main::at#12 ← (byte*) main::at#2 [ main::i#2 main::at#2 main::at#12 ] ( main:3 [ main::i#2 main::at#2 main::at#12 ] ) -- pbuz1=pbuz2 + lda at_2 + sta at + lda at_2+1 + sta at+1 + //SEG45 [20] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + b3_from_b2: + //SEG46 [20] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->main::@3#0] -- vbuz1=vbuc1 + lda #0 + sta j + //SEG47 [20] phi (byte*) main::at#6 = (byte*~) main::at#12 [phi:main::@2->main::@3#1] -- register_copy + jmp b3 + //SEG48 [20] phi from main::@11 to main::@3 [phi:main::@11->main::@3] + b3_from_b11: + //SEG49 [20] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@11->main::@3#0] -- register_copy + //SEG50 [20] phi (byte*) main::at#6 = (byte*) main::at#3 [phi:main::@11->main::@3#1] -- register_copy + jmp b3 + //SEG51 main::@3 + b3: + //SEG52 [21] (byte*) main::at#3 ← (byte*) main::at#6 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) -- pbuz1=pbuz1_plus_vbuc1 + lda at + clc + adc #4 + sta at + bcc !+ + inc at+1 + !: + //SEG53 [22] (signed byte) fmul8::a#0 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 ] ) -- vbsaa=pbsc1_derefidx_vbuz1 + ldy i + lda vals,y + //SEG54 [23] (signed byte) fmul8::b#0 ← *((const signed byte[]) vals#0 + (byte) main::j#2) [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 fmul8::b#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 fmul8::b#0 ] ) -- vbsyy=pbsc1_derefidx_vbuz1 + ldx j + ldy vals,x + //SEG55 [24] call fmul8 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + jsr fmul8 + //SEG56 [25] (signed byte) fmul8::return#0 ← (signed byte) fmul8::return#1 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#0 ] ) + // (signed byte) fmul8::return#0 = (signed byte) fmul8::return#1 // register copy reg byte a + jmp b10 + //SEG57 main::@10 + b10: + //SEG58 [26] (signed byte) main::r#0 ← (signed byte) fmul8::return#0 [ main::i#2 main::at#2 main::j#2 main::at#3 main::r#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 main::r#0 ] ) + // (signed byte) main::r#0 = (signed byte) fmul8::return#0 // register copy reg byte a + //SEG59 [27] (signed byte) print_sbyte_at::b#3 ← (signed byte) main::r#0 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 ] ) -- vbsz1=vbsaa + sta print_sbyte_at.b + //SEG60 [28] (byte*) print_sbyte_at::at#2 ← (byte*) main::at#3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ) + // (byte*) print_sbyte_at::at#2 = (byte*) main::at#3 // register copy zp ZP_WORD:2 + //SEG61 [29] call print_sbyte_at [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + //SEG62 [35] phi from main::@10 to print_sbyte_at [phi:main::@10->print_sbyte_at] + print_sbyte_at_from_b10: + //SEG63 [35] phi (byte*) print_sbyte_at::at#3 = (byte*) print_sbyte_at::at#2 [phi:main::@10->print_sbyte_at#0] -- register_copy + //SEG64 [35] phi (signed byte) print_sbyte_at::b#4 = (signed byte) print_sbyte_at::b#3 [phi:main::@10->print_sbyte_at#1] -- register_copy + jsr print_sbyte_at + jmp b11 + //SEG65 main::@11 + b11: + //SEG66 [30] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) -- vbuz1=_inc_vbuz1 + inc j + //SEG67 [31] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda j + cmp #5 + bne b3_from_b11 + jmp b5 + //SEG68 main::@5 + b5: + //SEG69 [32] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG70 [33] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda i + cmp #5 + bne b2_from_b5 + jmp breturn + //SEG71 main::@return + breturn: + //SEG72 [34] return [ ] ( main:3 [ ] ) + rts +} +//SEG73 print_sbyte_at +print_sbyte_at: { + .label b = 8 + .label at = 2 + //SEG74 [36] if((signed byte) print_sbyte_at::b#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte_at::@1 [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) -- vbsz1_ge_0_then_la1 + lda b + cmp #0 + bpl b1_from_print_sbyte_at + jmp b2 + //SEG75 print_sbyte_at::@2 + b2: + //SEG76 [37] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#3 [ print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ) -- pbuz1=pbuz2 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + //SEG77 [38] call print_char_at [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + //SEG78 [53] phi from print_sbyte_at::@2 to print_char_at [phi:print_sbyte_at::@2->print_char_at] + print_char_at_from_b2: + //SEG79 [53] phi (byte*) print_char_at::at#3 = (byte*) print_char_at::at#0 [phi:print_sbyte_at::@2->print_char_at#0] -- register_copy + //SEG80 [53] phi (byte) print_char_at::ch#3 = (byte) '-' [phi:print_sbyte_at::@2->print_char_at#1] -- vbuz1=vbuc1 + lda #'-' + sta print_char_at.ch + jsr print_char_at + jmp b4 + //SEG81 print_sbyte_at::@4 + b4: + //SEG82 [39] (signed byte) print_sbyte_at::b#0 ← - (signed byte) print_sbyte_at::b#4 [ print_sbyte_at::at#3 print_sbyte_at::b#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::at#3 print_sbyte_at::b#0 ] ) -- vbsz1=_neg_vbsz1 + lda b + eor #$ff + clc + adc #1 + sta b + //SEG83 [40] phi from print_sbyte_at print_sbyte_at::@4 to print_sbyte_at::@1 [phi:print_sbyte_at/print_sbyte_at::@4->print_sbyte_at::@1] + b1_from_print_sbyte_at: + b1_from_b4: + //SEG84 [40] phi (signed byte) print_sbyte_at::b#5 = (signed byte) print_sbyte_at::b#4 [phi:print_sbyte_at/print_sbyte_at::@4->print_sbyte_at::@1#0] -- register_copy + jmp b1 + //SEG85 print_sbyte_at::@1 + b1: + //SEG86 [41] (byte*) print_byte_at::at#0 ← (byte*) print_sbyte_at::at#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) -- pbuz1=pbuz2_plus_1 + lda at + clc + adc #1 + sta print_byte_at.at + lda at+1 + adc #0 + sta print_byte_at.at+1 + //SEG87 [42] call print_byte_at [ ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + jsr print_byte_at + jmp breturn + //SEG88 print_sbyte_at::@return + breturn: + //SEG89 [43] return [ ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + rts +} +//SEG90 print_byte_at +print_byte_at: { + .label at = $a + //SEG91 [44] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#5 >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ) -- vbuaa=vbuz1_ror_4 + lda print_sbyte_at.b + lsr + lsr + lsr + lsr + //SEG92 [45] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] ) -- vbuz1=pbuc1_derefidx_vbuaa + tay + lda print_hextab,y + sta print_char_at.ch + //SEG93 [46] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#0 [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ) + // (byte*) print_char_at::at#1 = (byte*) print_byte_at::at#0 // register copy zp ZP_WORD:10 + //SEG94 [47] call print_char_at [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) + //SEG95 [53] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + print_char_at_from_print_byte_at: + //SEG96 [53] phi (byte*) print_char_at::at#3 = (byte*) print_char_at::at#1 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG97 [53] phi (byte) print_char_at::ch#3 = (byte) print_char_at::ch#1 [phi:print_byte_at->print_char_at#1] -- register_copy + jsr print_char_at + jmp b1 + //SEG98 print_byte_at::@1 + b1: + //SEG99 [48] (byte~) print_byte_at::$2 ← (byte)(signed byte) print_sbyte_at::b#5 & (byte/signed byte/word/signed word/dword/signed dword) 15 [ print_byte_at::at#0 print_byte_at::$2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::at#0 print_byte_at::$2 ] ) -- vbuyy=vbuz1_band_vbuc1 + lda #$f + and print_sbyte_at.b + tay + //SEG100 [49] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_byte_at::$2 print_char_at::at#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::$2 print_char_at::at#2 ] ) -- pbuz1=pbuz1_plus_1 + inc print_char_at.at + bne !+ + inc print_char_at.at+1 + !: + //SEG101 [50] (byte) print_char_at::ch#2 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) [ print_char_at::at#2 print_char_at::ch#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_char_at::at#2 print_char_at::ch#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_char_at::at#2 print_char_at::ch#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_char_at::at#2 print_char_at::ch#2 ] ) -- vbuz1=pbuc1_derefidx_vbuyy + lda print_hextab,y + sta print_char_at.ch + //SEG102 [51] call print_char_at [ ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + //SEG103 [53] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + print_char_at_from_b1: + //SEG104 [53] phi (byte*) print_char_at::at#3 = (byte*) print_char_at::at#2 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG105 [53] phi (byte) print_char_at::ch#3 = (byte) print_char_at::ch#2 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + jsr print_char_at + jmp breturn + //SEG106 print_byte_at::@return + breturn: + //SEG107 [52] return [ ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + rts +} +//SEG108 print_char_at +print_char_at: { + .label at = $a + .label ch = 9 + //SEG109 [54] *((byte*) print_char_at::at#3) ← (byte) print_char_at::ch#3 [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) -- _deref_pbuz1=vbuz2 + lda ch + ldy #0 + sta (at),y + jmp breturn + //SEG110 print_char_at::@return + breturn: + //SEG111 [55] return [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + rts +} +//SEG112 fmul8 +fmul8: { + //SEG113 [56] *((const signed byte*) ap#0) ← (signed byte) fmul8::a#0 [ fmul8::b#0 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::b#0 ] ) -- _deref_pbsc1=vbsaa + sta ap + //SEG114 [57] *((const signed byte*) bp#0) ← (signed byte) fmul8::b#0 [ ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) -- _deref_pbsc1=vbsyy + tya + sta bp + //SEG115 asm { ldaap staA1+1 eor#$ff staA2+1 ldxbp sec A1: ldamulf_sqr1,x A2: sbcmulf_sqr2,x stacp } + lda ap + sta A1+1 + eor #$ff + sta A2+1 + ldx bp + sec + A1: + lda mulf_sqr1,x + A2: + sbc mulf_sqr2,x + sta cp + //SEG116 [59] (signed byte) fmul8::return#1 ← *((const signed byte*) cp#0) [ fmul8::return#1 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) -- vbsaa=_deref_pbsc1 + lda cp + jmp breturn + //SEG117 fmul8::@return + breturn: + //SEG118 [60] return [ fmul8::return#1 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + rts +} +//SEG119 print_cls +print_cls: { + .label sc = 2 + //SEG120 [62] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] + b1_from_print_cls: + //SEG121 [62] phi (byte*) print_cls::sc#2 = (const byte*) print_screen#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 + lda #print_screen + sta sc+1 + jmp b1 + //SEG122 [62] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] + b1_from_b1: + //SEG123 [62] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy + jmp b1 + //SEG124 print_cls::@1 + b1: + //SEG125 [63] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::print_cls:6 [ print_cls::sc#2 ] ) -- _deref_pbuz1=vbuc1 + lda #' ' + ldy #0 + sta (sc),y + //SEG126 [64] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) -- pbuz1=_inc_pbuz1 + inc sc + bne !+ + inc sc+1 + !: + //SEG127 [65] if((byte*) print_cls::sc#1!=(const byte*) print_screen#0+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) -- pbuz1_neq_pbuc1_then_la1 + lda sc+1 + cmp #>print_screen+$3e8 + bne b1_from_b1 + lda sc + cmp #159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } + .if(i>351) { .byte round(((512-i)*(512-i))/256) } + } + +.pc = mulf_sqr2 "Inline" + .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } + .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } + .if(i>351) { .byte round(((i-511)*(i-511))/256) } + } + + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b19 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b8 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp b10 +Removing instruction jmp b11 +Removing instruction jmp b5 +Removing instruction jmp breturn +Removing instruction jmp b2 +Removing instruction jmp b4 +Removing instruction jmp b1 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp breturn +Removing instruction jmp breturn +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction lda cp +Succesful ASM optimization Pass5UnnecesaryLoadElimination +Replacing label b1_from_b8 with b1 +Replacing label b3_from_b11 with b3 +Replacing label b2_from_b5 with b2 +Replacing label b1_from_print_sbyte_at with b1 +Replacing label b1_from_b1 with b1 +Replacing label b1_from_b1 with b1 +Removing instruction bbegin: +Removing instruction main_from_b19: +Removing instruction bend_from_b19: +Removing instruction b1_from_b8: +Removing instruction b2_from_b5: +Removing instruction b3_from_b11: +Removing instruction b1_from_print_sbyte_at: +Removing instruction b1_from_b4: +Removing instruction b1_from_b1: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction b19: +Removing instruction bend: +Removing instruction print_cls_from_main: +Removing instruction b1_from_main: +Removing instruction print_sbyte_at_from_b1: +Removing instruction b8: +Removing instruction b2_from_b8: +Removing instruction print_sbyte_at_from_b2: +Removing instruction b3_from_b2: +Removing instruction b10: +Removing instruction print_sbyte_at_from_b10: +Removing instruction b11: +Removing instruction b5: +Removing instruction breturn: +Removing instruction b2: +Removing instruction print_char_at_from_b2: +Removing instruction b4: +Removing instruction breturn: +Removing instruction print_char_at_from_print_byte_at: +Removing instruction b1: +Removing instruction print_char_at_from_b1: +Removing instruction breturn: +Removing instruction breturn: +Removing instruction breturn: +Removing instruction b1_from_print_cls: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp b1 +Succesful ASM optimization Pass5NextJumpElimination + +FINAL SYMBOL TABLE +(label) @19 +(label) @begin +(label) @end +(signed byte*) ap +(const signed byte*) ap#0 ap = ((signed byte*))(byte/word/signed word/dword/signed dword) 253 +(signed byte*) bp +(const signed byte*) bp#0 bp = ((signed byte*))(byte/word/signed word/dword/signed dword) 254 +(signed byte*) cp +(const signed byte*) cp#0 cp = ((signed byte*))(byte/word/signed word/dword/signed dword) 255 +(signed byte()) fmul8((signed byte) fmul8::a , (signed byte) fmul8::b) +(label) fmul8::@return +(signed byte) fmul8::a +(signed byte) fmul8::a#0 reg byte a 51.5 +(signed byte) fmul8::b +(signed byte) fmul8::b#0 reg byte y 51.5 +(signed byte) fmul8::return +(signed byte) fmul8::return#0 reg byte a 202.0 +(signed byte) fmul8::return#1 reg byte a 34.33333333333333 +(void()) main() +(label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@2 +(label) main::@3 +(label) main::@5 +(label) main::@8 +(label) main::@return +(byte*) main::at +(byte*) main::at#1 at zp ZP_WORD:2 7.333333333333333 +(byte*~) main::at#12 at zp ZP_WORD:2 22.0 +(byte*) main::at#2 at#2 zp ZP_WORD:4 2.3157894736842106 +(byte*) main::at#3 at zp ZP_WORD:2 27.545454545454547 +(byte*) main::at#4 at zp ZP_WORD:2 8.25 +(byte*) main::at#6 at zp ZP_WORD:2 213.0 +(byte*) main::at_line +(byte*) main::at_line#2 at_line zp ZP_WORD:4 22.0 +(byte) main::i +(byte) main::i#1 i zp ZP_BYTE:6 16.5 +(byte) main::i#2 i zp ZP_BYTE:6 7.444444444444445 +(byte) main::j +(byte) main::j#1 j zp ZP_BYTE:7 151.5 +(byte) main::j#2 j zp ZP_BYTE:7 30.299999999999997 +(byte) main::k +(byte) main::k#1 reg byte x 16.5 +(byte) main::k#2 reg byte x 6.6000000000000005 +(signed byte) main::r +(signed byte) main::r#0 reg byte a 202.0 +(byte*) mulf_sqr1 +(const byte*) mulf_sqr1#0 mulf_sqr1 = ((byte*))(word/signed word/dword/signed dword) 8192 +(byte*) mulf_sqr2 +(const byte*) mulf_sqr2#0 mulf_sqr2 = ((byte*))(word/signed word/dword/signed dword) 8704 +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 reg byte a 4.0 +(byte~) print_byte_at::$2 reg byte y 2.0 +(label) print_byte_at::@1 +(label) print_byte_at::@return +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 at zp ZP_WORD:10 1.0 +(byte) print_byte_at::b +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(label) print_char_at::@return +(byte*) print_char_at::at +(byte*) print_char_at::at#0 at zp ZP_WORD:10 4.0 +(byte*) print_char_at::at#1 at zp ZP_WORD:10 4.0 +(byte*) print_char_at::at#2 at zp ZP_WORD:10 2.0 +(byte*) print_char_at::at#3 at zp ZP_WORD:10 8.0 +(byte) print_char_at::ch +(byte) print_char_at::ch#1 ch zp ZP_BYTE:9 2.0 +(byte) print_char_at::ch#2 ch zp ZP_BYTE:9 4.0 +(byte) print_char_at::ch#3 ch zp ZP_BYTE:9 6.0 +(void()) print_cls() +(label) print_cls::@1 +(label) print_cls::@return +(byte*) print_cls::sc +(byte*) print_cls::sc#1 sc zp ZP_WORD:2 16.5 +(byte*) print_cls::sc#2 sc zp ZP_WORD:2 16.5 +(byte[]) print_hextab +(const byte[]) print_hextab#0 print_hextab = (string) "0123456789abcdef" +(void()) print_sbyte_at((signed byte) print_sbyte_at::b , (byte*) print_sbyte_at::at) +(label) print_sbyte_at::@1 +(label) print_sbyte_at::@2 +(label) print_sbyte_at::@4 +(label) print_sbyte_at::@return +(byte*) print_sbyte_at::at +(byte*) print_sbyte_at::at#0 at zp ZP_WORD:2 22.0 +(byte*) print_sbyte_at::at#1 at zp ZP_WORD:2 22.0 +(byte*) print_sbyte_at::at#2 at zp ZP_WORD:2 202.0 +(byte*) print_sbyte_at::at#3 at zp ZP_WORD:2 21.16666666666666 +(signed byte) print_sbyte_at::b +(signed byte) print_sbyte_at::b#0 b zp ZP_BYTE:8 4.0 +(signed byte) print_sbyte_at::b#1 b zp ZP_BYTE:8 11.0 +(signed byte) print_sbyte_at::b#2 b zp ZP_BYTE:8 11.0 +(signed byte) print_sbyte_at::b#3 b zp ZP_BYTE:8 101.0 +(signed byte) print_sbyte_at::b#4 b zp ZP_BYTE:8 32.25 +(signed byte) print_sbyte_at::b#5 b zp ZP_BYTE:8 0.6666666666666666 +(byte*) print_screen +(const byte*) print_screen#0 print_screen = ((byte*))(word/signed word/dword/signed dword) 1024 +(signed byte[]) vals +(const signed byte[]) vals#0 vals = { -(byte/signed byte/word/signed word/dword/signed dword) 95, -(byte/signed byte/word/signed word/dword/signed dword) 64, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/signed byte/word/signed word/dword/signed dword) 95 } + +reg byte x [ main::k#2 main::k#1 ] +zp ZP_WORD:2 [ main::at#4 main::at#1 print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 main::at#6 main::at#3 main::at#12 print_cls::sc#2 print_cls::sc#1 ] +zp ZP_WORD:4 [ main::at_line#2 main::at#2 ] +zp ZP_BYTE:6 [ main::i#2 main::i#1 ] +zp ZP_BYTE:7 [ main::j#2 main::j#1 ] +zp ZP_BYTE:8 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +zp ZP_BYTE:9 [ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +zp ZP_WORD:10 [ print_char_at::at#3 print_char_at::at#1 print_char_at::at#2 print_char_at::at#0 print_byte_at::at#0 ] +reg byte a [ fmul8::a#0 ] +reg byte y [ fmul8::b#0 ] +reg byte a [ fmul8::return#0 ] +reg byte a [ main::r#0 ] +reg byte a [ print_byte_at::$0 ] +reg byte y [ print_byte_at::$2 ] +reg byte a [ fmul8::return#1 ] + + +FINAL ASSEMBLER +Score: 8361 + +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label print_screen = $400 + .label ap = $fd + .label bp = $fe + .label cp = $ff + .label mulf_sqr1 = $2000 + .label mulf_sqr2 = $2200 +//SEG2 @begin +//SEG3 @19 +//SEG4 kickasm(location (const byte*) mulf_sqr1#0) {{ .for(var i=0;i<$200;i++) { .if(i<=159) { .byte round((i*i)/256) } .if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } .if(i>351) { .byte round(((512-i)*(512-i))/256) } } }} +//SEG5 kickasm(location (const byte*) mulf_sqr2#0) {{ .for(var i=0;i<$200;i++) { .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } .if(i>351) { .byte round(((i-511)*(i-511))/256) } } }} +//SEG6 [3] call main [ ] ( ) +//SEG7 [5] phi from @19 to main [phi:@19->main] + jsr main +//SEG8 [4] phi from @19 to @end [phi:@19->@end] +//SEG9 @end +//SEG10 main +main: { + .label at = 2 + .label at_2 = 4 + .label j = 7 + .label i = 6 + .label at_line = 4 + //SEG11 [6] call print_cls [ ] ( main:3 [ ] ) + //SEG12 [61] phi from main to print_cls [phi:main->print_cls] + jsr print_cls + //SEG13 [7] phi from main to main::@1 [phi:main->main::@1] + //SEG14 [7] phi (byte*) main::at#4 = ((byte*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #<$400+4 + sta at + lda #>$400+4 + sta at+1 + //SEG15 [7] phi (byte) main::k#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1 + ldx #0 + //SEG16 [7] phi from main::@8 to main::@1 [phi:main::@8->main::@1] + //SEG17 [7] phi (byte*) main::at#4 = (byte*) main::at#1 [phi:main::@8->main::@1#0] -- register_copy + //SEG18 [7] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@8->main::@1#1] -- register_copy + //SEG19 main::@1 + b1: + //SEG20 [8] (signed byte) print_sbyte_at::b#1 ← *((const signed byte[]) vals#0 + (byte) main::k#2) [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 ] ) -- vbsz1=pbsc1_derefidx_vbuxx + lda vals,x + sta print_sbyte_at.b + //SEG21 [9] (byte*) print_sbyte_at::at#0 ← (byte*) main::at#4 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ( main:3 [ main::k#2 main::at#4 print_sbyte_at::b#1 print_sbyte_at::at#0 ] ) + // (byte*) print_sbyte_at::at#0 = (byte*) main::at#4 // register copy zp ZP_WORD:2 + //SEG22 [10] call print_sbyte_at [ main::k#2 main::at#4 ] ( main:3 [ main::k#2 main::at#4 ] ) + //SEG23 [35] phi from main::@1 to print_sbyte_at [phi:main::@1->print_sbyte_at] + //SEG24 [35] phi (byte*) print_sbyte_at::at#3 = (byte*) print_sbyte_at::at#0 [phi:main::@1->print_sbyte_at#0] -- register_copy + //SEG25 [35] phi (signed byte) print_sbyte_at::b#4 = (signed byte) print_sbyte_at::b#1 [phi:main::@1->print_sbyte_at#1] -- register_copy + jsr print_sbyte_at + //SEG26 main::@8 + //SEG27 [11] (byte*) main::at#1 ← (byte*) main::at#4 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::k#2 main::at#1 ] ( main:3 [ main::k#2 main::at#1 ] ) -- pbuz1=pbuz1_plus_vbuc1 + lda at + clc + adc #4 + sta at + bcc !+ + inc at+1 + !: + //SEG28 [12] (byte) main::k#1 ← ++ (byte) main::k#2 [ main::k#1 main::at#1 ] ( main:3 [ main::k#1 main::at#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG29 [13] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@1 [ main::k#1 main::at#1 ] ( main:3 [ main::k#1 main::at#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #5 + bne b1 + //SEG30 [14] phi from main::@8 to main::@2 [phi:main::@8->main::@2] + //SEG31 [14] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@8->main::@2#0] -- vbuz1=vbuc1 + lda #0 + sta i + //SEG32 [14] phi (byte*) main::at_line#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main::@8->main::@2#1] -- pbuz1=pbuc1 + lda #<$400 + sta at_line + lda #>$400 + sta at_line+1 + //SEG33 [14] phi from main::@5 to main::@2 [phi:main::@5->main::@2] + //SEG34 [14] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@5->main::@2#0] -- register_copy + //SEG35 [14] phi (byte*) main::at_line#2 = (byte*) main::at#2 [phi:main::@5->main::@2#1] -- register_copy + //SEG36 main::@2 + b2: + //SEG37 [15] (byte*) main::at#2 ← (byte*) main::at_line#2 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) -- pbuz1=pbuz1_plus_vbuc1 + lda at_2 + clc + adc #$28 + sta at_2 + bcc !+ + inc at_2+1 + !: + //SEG38 [16] (signed byte) print_sbyte_at::b#2 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 ] ) -- vbsz1=pbsc1_derefidx_vbuz2 + ldy i + lda vals,y + sta print_sbyte_at.b + //SEG39 [17] (byte*) print_sbyte_at::at#1 ← (byte*) main::at#2 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ( main:3 [ main::i#2 main::at#2 print_sbyte_at::b#2 print_sbyte_at::at#1 ] ) -- pbuz1=pbuz2 + lda at_2 + sta print_sbyte_at.at + lda at_2+1 + sta print_sbyte_at.at+1 + //SEG40 [18] call print_sbyte_at [ main::i#2 main::at#2 ] ( main:3 [ main::i#2 main::at#2 ] ) + //SEG41 [35] phi from main::@2 to print_sbyte_at [phi:main::@2->print_sbyte_at] + //SEG42 [35] phi (byte*) print_sbyte_at::at#3 = (byte*) print_sbyte_at::at#1 [phi:main::@2->print_sbyte_at#0] -- register_copy + //SEG43 [35] phi (signed byte) print_sbyte_at::b#4 = (signed byte) print_sbyte_at::b#2 [phi:main::@2->print_sbyte_at#1] -- register_copy + jsr print_sbyte_at + //SEG44 [19] (byte*~) main::at#12 ← (byte*) main::at#2 [ main::i#2 main::at#2 main::at#12 ] ( main:3 [ main::i#2 main::at#2 main::at#12 ] ) -- pbuz1=pbuz2 + lda at_2 + sta at + lda at_2+1 + sta at+1 + //SEG45 [20] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + //SEG46 [20] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->main::@3#0] -- vbuz1=vbuc1 + lda #0 + sta j + //SEG47 [20] phi (byte*) main::at#6 = (byte*~) main::at#12 [phi:main::@2->main::@3#1] -- register_copy + //SEG48 [20] phi from main::@11 to main::@3 [phi:main::@11->main::@3] + //SEG49 [20] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@11->main::@3#0] -- register_copy + //SEG50 [20] phi (byte*) main::at#6 = (byte*) main::at#3 [phi:main::@11->main::@3#1] -- register_copy + //SEG51 main::@3 + b3: + //SEG52 [21] (byte*) main::at#3 ← (byte*) main::at#6 + (byte/signed byte/word/signed word/dword/signed dword) 4 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) -- pbuz1=pbuz1_plus_vbuc1 + lda at + clc + adc #4 + sta at + bcc !+ + inc at+1 + !: + //SEG53 [22] (signed byte) fmul8::a#0 ← *((const signed byte[]) vals#0 + (byte) main::i#2) [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 ] ) -- vbsaa=pbsc1_derefidx_vbuz1 + ldy i + lda vals,y + //SEG54 [23] (signed byte) fmul8::b#0 ← *((const signed byte[]) vals#0 + (byte) main::j#2) [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 fmul8::b#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::a#0 fmul8::b#0 ] ) -- vbsyy=pbsc1_derefidx_vbuz1 + ldx j + ldy vals,x + //SEG55 [24] call fmul8 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + jsr fmul8 + //SEG56 [25] (signed byte) fmul8::return#0 ← (signed byte) fmul8::return#1 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#0 ] ) + // (signed byte) fmul8::return#0 = (signed byte) fmul8::return#1 // register copy reg byte a + //SEG57 main::@10 + //SEG58 [26] (signed byte) main::r#0 ← (signed byte) fmul8::return#0 [ main::i#2 main::at#2 main::j#2 main::at#3 main::r#0 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 main::r#0 ] ) + // (signed byte) main::r#0 = (signed byte) fmul8::return#0 // register copy reg byte a + //SEG59 [27] (signed byte) print_sbyte_at::b#3 ← (signed byte) main::r#0 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 ] ) -- vbsz1=vbsaa + sta print_sbyte_at.b + //SEG60 [28] (byte*) print_sbyte_at::at#2 ← (byte*) main::at#3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#3 print_sbyte_at::at#2 ] ) + // (byte*) print_sbyte_at::at#2 = (byte*) main::at#3 // register copy zp ZP_WORD:2 + //SEG61 [29] call print_sbyte_at [ main::i#2 main::at#2 main::j#2 main::at#3 ] ( main:3 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + //SEG62 [35] phi from main::@10 to print_sbyte_at [phi:main::@10->print_sbyte_at] + //SEG63 [35] phi (byte*) print_sbyte_at::at#3 = (byte*) print_sbyte_at::at#2 [phi:main::@10->print_sbyte_at#0] -- register_copy + //SEG64 [35] phi (signed byte) print_sbyte_at::b#4 = (signed byte) print_sbyte_at::b#3 [phi:main::@10->print_sbyte_at#1] -- register_copy + jsr print_sbyte_at + //SEG65 main::@11 + //SEG66 [30] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) -- vbuz1=_inc_vbuz1 + inc j + //SEG67 [31] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ( main:3 [ main::i#2 main::at#2 main::at#3 main::j#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda j + cmp #5 + bne b3 + //SEG68 main::@5 + //SEG69 [32] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG70 [33] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto main::@2 [ main::at#2 main::i#1 ] ( main:3 [ main::at#2 main::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda i + cmp #5 + bne b2 + //SEG71 main::@return + //SEG72 [34] return [ ] ( main:3 [ ] ) + rts +} +//SEG73 print_sbyte_at +print_sbyte_at: { + .label b = 8 + .label at = 2 + //SEG74 [36] if((signed byte) print_sbyte_at::b#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte_at::@1 [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) -- vbsz1_ge_0_then_la1 + lda b + cmp #0 + bpl b1 + //SEG75 print_sbyte_at::@2 + //SEG76 [37] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#3 [ print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 print_char_at::at#0 ] ) -- pbuz1=pbuz2 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + //SEG77 [38] call print_char_at [ print_sbyte_at::b#4 print_sbyte_at::at#3 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] ) + //SEG78 [53] phi from print_sbyte_at::@2 to print_char_at [phi:print_sbyte_at::@2->print_char_at] + //SEG79 [53] phi (byte*) print_char_at::at#3 = (byte*) print_char_at::at#0 [phi:print_sbyte_at::@2->print_char_at#0] -- register_copy + //SEG80 [53] phi (byte) print_char_at::ch#3 = (byte) '-' [phi:print_sbyte_at::@2->print_char_at#1] -- vbuz1=vbuc1 + lda #'-' + sta print_char_at.ch + jsr print_char_at + //SEG81 print_sbyte_at::@4 + //SEG82 [39] (signed byte) print_sbyte_at::b#0 ← - (signed byte) print_sbyte_at::b#4 [ print_sbyte_at::at#3 print_sbyte_at::b#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::at#3 print_sbyte_at::b#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::at#3 print_sbyte_at::b#0 ] ) -- vbsz1=_neg_vbsz1 + lda b + eor #$ff + clc + adc #1 + sta b + //SEG83 [40] phi from print_sbyte_at print_sbyte_at::@4 to print_sbyte_at::@1 [phi:print_sbyte_at/print_sbyte_at::@4->print_sbyte_at::@1] + //SEG84 [40] phi (signed byte) print_sbyte_at::b#5 = (signed byte) print_sbyte_at::b#4 [phi:print_sbyte_at/print_sbyte_at::@4->print_sbyte_at::@1#0] -- register_copy + //SEG85 print_sbyte_at::@1 + b1: + //SEG86 [41] (byte*) print_byte_at::at#0 ← (byte*) print_sbyte_at::at#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) -- pbuz1=pbuz2_plus_1 + lda at + clc + adc #1 + sta print_byte_at.at + lda at+1 + adc #0 + sta print_byte_at.at+1 + //SEG87 [42] call print_byte_at [ ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + jsr print_byte_at + //SEG88 print_sbyte_at::@return + //SEG89 [43] return [ ] ( main:3::print_sbyte_at:10 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + rts +} +//SEG90 print_byte_at +print_byte_at: { + .label at = $a + //SEG91 [44] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#5 >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_byte_at::$0 ] ) -- vbuaa=vbuz1_ror_4 + lda print_sbyte_at.b + lsr + lsr + lsr + lsr + //SEG92 [45] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 ] ) -- vbuz1=pbuc1_derefidx_vbuaa + tay + lda print_hextab,y + sta print_char_at.ch + //SEG93 [46] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#0 [ print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 print_char_at::ch#1 print_char_at::at#1 ] ) + // (byte*) print_char_at::at#1 = (byte*) print_byte_at::at#0 // register copy zp ZP_WORD:10 + //SEG94 [47] call print_char_at [ print_sbyte_at::b#5 print_byte_at::at#0 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] ) + //SEG95 [53] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + //SEG96 [53] phi (byte*) print_char_at::at#3 = (byte*) print_char_at::at#1 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG97 [53] phi (byte) print_char_at::ch#3 = (byte) print_char_at::ch#1 [phi:print_byte_at->print_char_at#1] -- register_copy + jsr print_char_at + //SEG98 print_byte_at::@1 + //SEG99 [48] (byte~) print_byte_at::$2 ← (byte)(signed byte) print_sbyte_at::b#5 & (byte/signed byte/word/signed word/dword/signed dword) 15 [ print_byte_at::at#0 print_byte_at::$2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::at#0 print_byte_at::$2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::at#0 print_byte_at::$2 ] ) -- vbuyy=vbuz1_band_vbuc1 + lda #$f + and print_sbyte_at.b + tay + //SEG100 [49] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0 + (byte/signed byte/word/signed word/dword/signed dword) 1 [ print_byte_at::$2 print_char_at::at#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_byte_at::$2 print_char_at::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_byte_at::$2 print_char_at::at#2 ] ) -- pbuz1=pbuz1_plus_1 + inc print_char_at.at + bne !+ + inc print_char_at.at+1 + !: + //SEG101 [50] (byte) print_char_at::ch#2 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) [ print_char_at::at#2 print_char_at::ch#2 ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 print_char_at::at#2 print_char_at::ch#2 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 print_char_at::at#2 print_char_at::ch#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 print_char_at::at#2 print_char_at::ch#2 ] ) -- vbuz1=pbuc1_derefidx_vbuyy + lda print_hextab,y + sta print_char_at.ch + //SEG102 [51] call print_char_at [ ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + //SEG103 [53] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + //SEG104 [53] phi (byte*) print_char_at::at#3 = (byte*) print_char_at::at#2 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG105 [53] phi (byte) print_char_at::ch#3 = (byte) print_char_at::ch#2 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + jsr print_char_at + //SEG106 print_byte_at::@return + //SEG107 [52] return [ ] ( main:3::print_sbyte_at:10::print_byte_at:42 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + rts +} +//SEG108 print_char_at +print_char_at: { + .label at = $a + .label ch = 9 + //SEG109 [54] *((byte*) print_char_at::at#3) ← (byte) print_char_at::ch#3 [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) -- _deref_pbuz1=vbuz2 + lda ch + ldy #0 + sta (at),y + //SEG110 print_char_at::@return + //SEG111 [55] return [ ] ( main:3::print_sbyte_at:10::print_char_at:38 [ main::k#2 main::at#4 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:18::print_char_at:38 [ main::i#2 main::at#2 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:29::print_char_at:38 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#4 print_sbyte_at::at#3 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:47 [ main::k#2 main::at#4 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:47 [ main::i#2 main::at#2 main::j#2 main::at#3 print_sbyte_at::b#5 print_byte_at::at#0 ] main:3::print_sbyte_at:10::print_byte_at:42::print_char_at:51 [ main::k#2 main::at#4 ] main:3::print_sbyte_at:18::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 ] main:3::print_sbyte_at:29::print_byte_at:42::print_char_at:51 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) + rts +} +//SEG112 fmul8 +fmul8: { + //SEG113 [56] *((const signed byte*) ap#0) ← (signed byte) fmul8::a#0 [ fmul8::b#0 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::b#0 ] ) -- _deref_pbsc1=vbsaa + sta ap + //SEG114 [57] *((const signed byte*) bp#0) ← (signed byte) fmul8::b#0 [ ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 ] ) -- _deref_pbsc1=vbsyy + tya + sta bp + //SEG115 asm { ldaap staA1+1 eor#$ff staA2+1 ldxbp sec A1: ldamulf_sqr1,x A2: sbcmulf_sqr2,x stacp } + lda ap + sta A1+1 + eor #$ff + sta A2+1 + ldx bp + sec + A1: + lda mulf_sqr1,x + A2: + sbc mulf_sqr2,x + sta cp + //SEG116 [59] (signed byte) fmul8::return#1 ← *((const signed byte*) cp#0) [ fmul8::return#1 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) -- vbsaa=_deref_pbsc1 + //SEG117 fmul8::@return + //SEG118 [60] return [ fmul8::return#1 ] ( main:3::fmul8:24 [ main::i#2 main::at#2 main::j#2 main::at#3 fmul8::return#1 ] ) + rts +} +//SEG119 print_cls +print_cls: { + .label sc = 2 + //SEG120 [62] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] + //SEG121 [62] phi (byte*) print_cls::sc#2 = (const byte*) print_screen#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 + lda #print_screen + sta sc+1 + //SEG122 [62] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] + //SEG123 [62] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy + //SEG124 print_cls::@1 + b1: + //SEG125 [63] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::print_cls:6 [ print_cls::sc#2 ] ) -- _deref_pbuz1=vbuc1 + lda #' ' + ldy #0 + sta (sc),y + //SEG126 [64] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) -- pbuz1=_inc_pbuz1 + inc sc + bne !+ + inc sc+1 + !: + //SEG127 [65] if((byte*) print_cls::sc#1!=(const byte*) print_screen#0+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::print_cls:6 [ print_cls::sc#1 ] ) -- pbuz1_neq_pbuc1_then_la1 + lda sc+1 + cmp #>print_screen+$3e8 + bne b1 + lda sc + cmp #159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } + .if(i>351) { .byte round(((512-i)*(512-i))/256) } + } + +.pc = mulf_sqr2 "Inline" + .for(var i=0;i<$200;i++) { + .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } + .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } + .if(i>351) { .byte round(((i-511)*(i-511))/256) } + } + + diff --git a/src/test/ref/examples/fastmultiply/fastmultiply8.kc.sym b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.sym new file mode 100644 index 000000000..faf76fbc3 --- /dev/null +++ b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.sym @@ -0,0 +1,115 @@ +(label) @19 +(label) @begin +(label) @end +(signed byte*) ap +(const signed byte*) ap#0 ap = ((signed byte*))(byte/word/signed word/dword/signed dword) 253 +(signed byte*) bp +(const signed byte*) bp#0 bp = ((signed byte*))(byte/word/signed word/dword/signed dword) 254 +(signed byte*) cp +(const signed byte*) cp#0 cp = ((signed byte*))(byte/word/signed word/dword/signed dword) 255 +(signed byte()) fmul8((signed byte) fmul8::a , (signed byte) fmul8::b) +(label) fmul8::@return +(signed byte) fmul8::a +(signed byte) fmul8::a#0 reg byte a 51.5 +(signed byte) fmul8::b +(signed byte) fmul8::b#0 reg byte y 51.5 +(signed byte) fmul8::return +(signed byte) fmul8::return#0 reg byte a 202.0 +(signed byte) fmul8::return#1 reg byte a 34.33333333333333 +(void()) main() +(label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@2 +(label) main::@3 +(label) main::@5 +(label) main::@8 +(label) main::@return +(byte*) main::at +(byte*) main::at#1 at zp ZP_WORD:2 7.333333333333333 +(byte*~) main::at#12 at zp ZP_WORD:2 22.0 +(byte*) main::at#2 at#2 zp ZP_WORD:4 2.3157894736842106 +(byte*) main::at#3 at zp ZP_WORD:2 27.545454545454547 +(byte*) main::at#4 at zp ZP_WORD:2 8.25 +(byte*) main::at#6 at zp ZP_WORD:2 213.0 +(byte*) main::at_line +(byte*) main::at_line#2 at_line zp ZP_WORD:4 22.0 +(byte) main::i +(byte) main::i#1 i zp ZP_BYTE:6 16.5 +(byte) main::i#2 i zp ZP_BYTE:6 7.444444444444445 +(byte) main::j +(byte) main::j#1 j zp ZP_BYTE:7 151.5 +(byte) main::j#2 j zp ZP_BYTE:7 30.299999999999997 +(byte) main::k +(byte) main::k#1 reg byte x 16.5 +(byte) main::k#2 reg byte x 6.6000000000000005 +(signed byte) main::r +(signed byte) main::r#0 reg byte a 202.0 +(byte*) mulf_sqr1 +(const byte*) mulf_sqr1#0 mulf_sqr1 = ((byte*))(word/signed word/dword/signed dword) 8192 +(byte*) mulf_sqr2 +(const byte*) mulf_sqr2#0 mulf_sqr2 = ((byte*))(word/signed word/dword/signed dword) 8704 +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 reg byte a 4.0 +(byte~) print_byte_at::$2 reg byte y 2.0 +(label) print_byte_at::@1 +(label) print_byte_at::@return +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 at zp ZP_WORD:10 1.0 +(byte) print_byte_at::b +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(label) print_char_at::@return +(byte*) print_char_at::at +(byte*) print_char_at::at#0 at zp ZP_WORD:10 4.0 +(byte*) print_char_at::at#1 at zp ZP_WORD:10 4.0 +(byte*) print_char_at::at#2 at zp ZP_WORD:10 2.0 +(byte*) print_char_at::at#3 at zp ZP_WORD:10 8.0 +(byte) print_char_at::ch +(byte) print_char_at::ch#1 ch zp ZP_BYTE:9 2.0 +(byte) print_char_at::ch#2 ch zp ZP_BYTE:9 4.0 +(byte) print_char_at::ch#3 ch zp ZP_BYTE:9 6.0 +(void()) print_cls() +(label) print_cls::@1 +(label) print_cls::@return +(byte*) print_cls::sc +(byte*) print_cls::sc#1 sc zp ZP_WORD:2 16.5 +(byte*) print_cls::sc#2 sc zp ZP_WORD:2 16.5 +(byte[]) print_hextab +(const byte[]) print_hextab#0 print_hextab = (string) "0123456789abcdef" +(void()) print_sbyte_at((signed byte) print_sbyte_at::b , (byte*) print_sbyte_at::at) +(label) print_sbyte_at::@1 +(label) print_sbyte_at::@2 +(label) print_sbyte_at::@4 +(label) print_sbyte_at::@return +(byte*) print_sbyte_at::at +(byte*) print_sbyte_at::at#0 at zp ZP_WORD:2 22.0 +(byte*) print_sbyte_at::at#1 at zp ZP_WORD:2 22.0 +(byte*) print_sbyte_at::at#2 at zp ZP_WORD:2 202.0 +(byte*) print_sbyte_at::at#3 at zp ZP_WORD:2 21.16666666666666 +(signed byte) print_sbyte_at::b +(signed byte) print_sbyte_at::b#0 b zp ZP_BYTE:8 4.0 +(signed byte) print_sbyte_at::b#1 b zp ZP_BYTE:8 11.0 +(signed byte) print_sbyte_at::b#2 b zp ZP_BYTE:8 11.0 +(signed byte) print_sbyte_at::b#3 b zp ZP_BYTE:8 101.0 +(signed byte) print_sbyte_at::b#4 b zp ZP_BYTE:8 32.25 +(signed byte) print_sbyte_at::b#5 b zp ZP_BYTE:8 0.6666666666666666 +(byte*) print_screen +(const byte*) print_screen#0 print_screen = ((byte*))(word/signed word/dword/signed dword) 1024 +(signed byte[]) vals +(const signed byte[]) vals#0 vals = { -(byte/signed byte/word/signed word/dword/signed dword) 95, -(byte/signed byte/word/signed word/dword/signed dword) 64, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/signed byte/word/signed word/dword/signed dword) 95 } + +reg byte x [ main::k#2 main::k#1 ] +zp ZP_WORD:2 [ main::at#4 main::at#1 print_sbyte_at::at#3 print_sbyte_at::at#0 print_sbyte_at::at#2 print_sbyte_at::at#1 main::at#6 main::at#3 main::at#12 print_cls::sc#2 print_cls::sc#1 ] +zp ZP_WORD:4 [ main::at_line#2 main::at#2 ] +zp ZP_BYTE:6 [ main::i#2 main::i#1 ] +zp ZP_BYTE:7 [ main::j#2 main::j#1 ] +zp ZP_BYTE:8 [ print_sbyte_at::b#5 print_sbyte_at::b#4 print_sbyte_at::b#1 print_sbyte_at::b#3 print_sbyte_at::b#2 print_sbyte_at::b#0 ] +zp ZP_BYTE:9 [ print_char_at::ch#3 print_char_at::ch#1 print_char_at::ch#2 ] +zp ZP_WORD:10 [ print_char_at::at#3 print_char_at::at#1 print_char_at::at#2 print_char_at::at#0 print_byte_at::at#0 ] +reg byte a [ fmul8::a#0 ] +reg byte y [ fmul8::b#0 ] +reg byte a [ fmul8::return#0 ] +reg byte a [ main::r#0 ] +reg byte a [ print_byte_at::$0 ] +reg byte y [ print_byte_at::$2 ] +reg byte a [ fmul8::return#1 ] diff --git a/src/test/ref/examples/helloworld/helloworld.cfg b/src/test/ref/examples/helloworld/helloworld.cfg index 8fa7074cc..3a5362066 100644 --- a/src/test/ref/examples/helloworld/helloworld.cfg +++ b/src/test/ref/examples/helloworld/helloworld.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@15 -@15: scope:[] from @begin + to:@18 +@18: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @15 +@end: scope:[] from @18 [3] phi() [ ] ( ) -main: scope:[main] from @15 +main: scope:[main] from @18 [4] phi() [ ] ( main:2 [ ] ) [5] call print_str [ print_char_cursor#10 ] ( main:2 [ print_char_cursor#10 ] ) to:main::@1 diff --git a/src/test/ref/examples/helloworld/helloworld.log b/src/test/ref/examples/helloworld/helloworld.log index a6255a5ba..277b08af0 100644 --- a/src/test/ref/examples/helloworld/helloworld.log +++ b/src/test/ref/examples/helloworld/helloworld.log @@ -4,7 +4,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@15 + to:@18 print_str: scope:[print_str] from main (byte*) print_char_cursor#21 ← phi( main/(byte*) print_char_cursor#19 ) (byte*) print_str::str#4 ← phi( main/(byte*) print_str::str#1 ) @@ -50,9 +50,9 @@ print_ln::@return: scope:[print_ln] from print_ln::@2 (byte*) print_char_cursor#4 ← (byte*) print_char_cursor#12 return to:@return -main: scope:[main] from @15 - (byte*) print_line_cursor#15 ← phi( @15/(byte*) print_line_cursor#14 ) - (byte*) print_char_cursor#19 ← phi( @15/(byte*) print_char_cursor#20 ) +main: scope:[main] from @18 + (byte*) print_line_cursor#15 ← phi( @18/(byte*) print_line_cursor#14 ) + (byte*) print_char_cursor#19 ← phi( @18/(byte*) print_char_cursor#20 ) (byte*) print_str::str#1 ← (const string) main::str call print_str to:main::@1 @@ -75,22 +75,22 @@ main::@return: scope:[main] from main::@2 (byte*) print_line_cursor#4 ← (byte*) print_line_cursor#10 return to:@return -@15: scope:[] from @begin +@18: scope:[] from @begin (byte*) print_line_cursor#14 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte*) print_char_cursor#20 ← phi( @begin/(byte*) print_char_cursor#0 ) call main - to:@16 -@16: scope:[] from @15 - (byte*) print_line_cursor#11 ← phi( @15/(byte*) print_line_cursor#4 ) - (byte*) print_char_cursor#16 ← phi( @15/(byte*) print_char_cursor#7 ) + to:@19 +@19: scope:[] from @18 + (byte*) print_line_cursor#11 ← phi( @18/(byte*) print_line_cursor#4 ) + (byte*) print_char_cursor#16 ← phi( @18/(byte*) print_char_cursor#7 ) (byte*) print_char_cursor#8 ← (byte*) print_char_cursor#16 (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#11 to:@end -@end: scope:[] from @16 +@end: scope:[] from @19 SYMBOL TABLE SSA -(label) @15 -(label) @16 +(label) @18 +(label) @19 (label) @begin (label) @end (void()) main() @@ -192,7 +192,7 @@ Constant (const byte*) print_str::str#1 = main::str Successful SSA optimization Pass2ConstantIdentification Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) main::@2 -Culled Empty Block (label) @16 +Culled Empty Block (label) @19 Successful SSA optimization Pass2CullEmptyBlocks Inlining constant with var siblings (const byte*) print_str::str#1 Inlining constant with var siblings (const byte*) print_char_cursor#0 @@ -201,7 +201,7 @@ Constant inlined print_str::str#1 = (const string) main::str Successful SSA optimization Pass2ConstantInlining Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @15 +Adding NOP phi() at start of @18 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@1 @@ -218,7 +218,7 @@ Coalesced [23] print_char_cursor#22 ← print_char_cursor#1 Coalesced down to 3 phi equivalence classes Culled Empty Block (label) print_ln::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @15 +Adding NOP phi() at start of @18 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@1 @@ -228,14 +228,14 @@ Adding NOP phi() at start of print_str FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@15 -@15: scope:[] from @begin + to:@18 +@18: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @15 +@end: scope:[] from @18 [3] phi() [ ] ( ) -main: scope:[main] from @15 +main: scope:[main] from @18 [4] phi() [ ] ( main:2 [ ] ) [5] call print_str [ print_char_cursor#10 ] ( main:2 [ print_char_cursor#10 ] ) to:main::@1 @@ -312,17 +312,17 @@ INITIAL ASM .label print_line_cursor = 2 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -b15_from_bbegin: - jmp b15 -//SEG4 @15 -b15: +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +b18_from_bbegin: + jmp b18 +//SEG4 @18 +b18: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] -main_from_b15: +//SEG6 [4] phi from @18 to main [phi:@18->main] +main_from_b18: jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] -bend_from_b15: +//SEG7 [3] phi from @18 to @end [phi:@18->@end] +bend_from_b18: jmp bend //SEG8 @end bend: @@ -471,17 +471,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = 2 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -b15_from_bbegin: - jmp b15 -//SEG4 @15 -b15: +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +b18_from_bbegin: + jmp b18 +//SEG4 @18 +b18: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] -main_from_b15: +//SEG6 [4] phi from @18 to main [phi:@18->main] +main_from_b18: jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] -bend_from_b15: +//SEG7 [3] phi from @18 to @end [phi:@18->@end] +bend_from_b18: jmp bend //SEG8 @end bend: @@ -599,7 +599,7 @@ print_str: { } ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b15 +Removing instruction jmp b18 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp breturn @@ -613,14 +613,14 @@ Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b15_from_bbegin: -Removing instruction main_from_b15: -Removing instruction bend_from_b15: +Removing instruction b18_from_bbegin: +Removing instruction main_from_b18: +Removing instruction bend_from_b18: Removing instruction b1_from_main: Removing instruction print_ln_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b15: +Removing instruction b18: Removing instruction bend: Removing instruction print_str_from_main: Removing instruction b1: @@ -635,7 +635,7 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination FINAL SYMBOL TABLE -(label) @15 +(label) @18 (label) @begin (label) @end (void()) main() @@ -675,12 +675,12 @@ Score: 1241 .label print_char_cursor = 4 .label print_line_cursor = 2 //SEG2 @begin -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -//SEG4 @15 +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +//SEG4 @18 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] +//SEG6 [4] phi from @18 to main [phi:@18->main] jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] +//SEG7 [3] phi from @18 to @end [phi:@18->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/examples/helloworld/helloworld.sym b/src/test/ref/examples/helloworld/helloworld.sym index 9a129c9b0..6dbfaf243 100644 --- a/src/test/ref/examples/helloworld/helloworld.sym +++ b/src/test/ref/examples/helloworld/helloworld.sym @@ -1,4 +1,4 @@ -(label) @15 +(label) @18 (label) @begin (label) @end (void()) main() diff --git a/src/test/ref/examples/sinsprites/sinus-sprites.cfg b/src/test/ref/examples/sinsprites/sinus-sprites.cfg index 35e291457..cc887b0b8 100644 --- a/src/test/ref/examples/sinsprites/sinus-sprites.cfg +++ b/src/test/ref/examples/sinsprites/sinus-sprites.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@54 -@54: scope:[] from @begin + to:@57 +@57: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @54 +@end: scope:[] from @57 [3] phi() [ ] ( ) -main: scope:[main] from @54 +main: scope:[main] from @57 [4] phi() [ ] ( main:2 [ ] ) [5] call init [ ] ( main:2 [ ] ) to:main::@2 diff --git a/src/test/ref/examples/sinsprites/sinus-sprites.log b/src/test/ref/examples/sinsprites/sinus-sprites.log index b25557ce4..d642bdb77 100644 --- a/src/test/ref/examples/sinsprites/sinus-sprites.log +++ b/src/test/ref/examples/sinsprites/sinus-sprites.log @@ -18,7 +18,7 @@ CONTROL FLOW GRAPH SSA @3: scope:[] from @begin (byte*) memLo#0 ← ((byte*)) (byte/word/signed word/dword/signed dword) 254 (byte*) memHi#0 ← ((byte*)) (byte/word/signed word/dword/signed dword) 255 - to:@44 + to:@47 prepareMEM: scope:[prepareMEM] from addMEMtoFAC divMEMbyFAC mulFACbyMEM setFAC setMEMtoFAC (byte*) prepareMEM::mem#5 ← phi( addMEMtoFAC/(byte*) prepareMEM::mem#2 divMEMbyFAC/(byte*) prepareMEM::mem#3 mulFACbyMEM/(byte*) prepareMEM::mem#4 setFAC/(byte*) prepareMEM::mem#0 setMEMtoFAC/(byte*) prepareMEM::mem#1 ) (byte~) prepareMEM::$0 ← < (byte*) prepareMEM::mem#5 @@ -113,19 +113,19 @@ sinFAC: scope:[sinFAC] from gen_sintab::@18 sinFAC::@return: scope:[sinFAC] from sinFAC return to:@return -@44: scope:[] from @3 +@47: scope:[] from @3 (byte) sinlen_x#0 ← (byte/word/signed word/dword/signed dword) 221 (byte[221]) sintab_x#0 ← { fill( 221, 0) } (byte) sinlen_y#0 ← (byte/word/signed word/dword/signed dword) 197 (byte[197]) sintab_y#0 ← { fill( 197, 0) } (byte*) sprites#0 ← ((byte*)) (word/signed word/dword/signed dword) 8192 (byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 - to:@47 -main: scope:[main] from @54 - (byte) sin_idx_y#24 ← phi( @54/(byte) sin_idx_y#17 ) - (byte) sin_idx_x#26 ← phi( @54/(byte) sin_idx_x#16 ) - (byte) progress_idx#30 ← phi( @54/(byte) progress_idx#35 ) - (byte*) progress_cursor#29 ← phi( @54/(byte*) progress_cursor#35 ) + to:@50 +main: scope:[main] from @57 + (byte) sin_idx_y#24 ← phi( @57/(byte) sin_idx_y#17 ) + (byte) sin_idx_x#26 ← phi( @57/(byte) sin_idx_x#16 ) + (byte) progress_idx#30 ← phi( @57/(byte) progress_idx#35 ) + (byte*) progress_cursor#29 ← phi( @57/(byte*) progress_cursor#35 ) call init to:main::@5 main::@5: scope:[main] from main @@ -277,10 +277,10 @@ clear_screen::@1: scope:[clear_screen] from clear_screen clear_screen::@1 clear_screen::@return: scope:[clear_screen] from clear_screen::@1 return to:@return -@47: scope:[] from @44 +@50: scope:[] from @47 (byte*) progress_cursor#7 ← (byte*) SCREEN#0 (byte) progress_idx#7 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:@49 + to:@52 progress_init: scope:[progress_init] from init::@5 init::@7 (byte*) progress_init::line#2 ← phi( init::@5/(byte*) progress_init::line#0 init::@7/(byte*) progress_init::line#1 ) (byte*) progress_cursor#8 ← (byte*) progress_init::line#2 @@ -320,12 +320,12 @@ progress_inc::@return: scope:[progress_inc] from progress_inc::@1 (byte*) progress_cursor#11 ← (byte*) progress_cursor#25 return to:@return -@49: scope:[] from @47 - (byte) progress_idx#39 ← phi( @47/(byte) progress_idx#7 ) - (byte*) progress_cursor#39 ← phi( @47/(byte*) progress_cursor#7 ) +@52: scope:[] from @50 + (byte) progress_idx#39 ← phi( @50/(byte) progress_idx#7 ) + (byte*) progress_cursor#39 ← phi( @50/(byte*) progress_cursor#7 ) (byte) sin_idx_x#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) sin_idx_y#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:@54 + to:@57 anim: scope:[anim] from main::@3 (byte) sin_idx_y#9 ← phi( main::@3/(byte) sin_idx_y#13 ) (byte) sin_idx_x#9 ← phi( main::@3/(byte) sin_idx_x#13 ) @@ -885,32 +885,32 @@ gen_sintab::@return: scope:[gen_sintab] from gen_sintab::@23 (byte*) progress_cursor#13 ← (byte*) progress_cursor#27 return to:@return -@54: scope:[] from @49 - (byte) sin_idx_y#17 ← phi( @49/(byte) sin_idx_y#2 ) - (byte) sin_idx_x#16 ← phi( @49/(byte) sin_idx_x#2 ) - (byte) progress_idx#35 ← phi( @49/(byte) progress_idx#39 ) - (byte*) progress_cursor#35 ← phi( @49/(byte*) progress_cursor#39 ) +@57: scope:[] from @52 + (byte) sin_idx_y#17 ← phi( @52/(byte) sin_idx_y#2 ) + (byte) sin_idx_x#16 ← phi( @52/(byte) sin_idx_x#2 ) + (byte) progress_idx#35 ← phi( @52/(byte) progress_idx#39 ) + (byte*) progress_cursor#35 ← phi( @52/(byte*) progress_cursor#39 ) call main - to:@55 -@55: scope:[] from @54 - (byte) sin_idx_y#12 ← phi( @54/(byte) sin_idx_y#1 ) - (byte) sin_idx_x#12 ← phi( @54/(byte) sin_idx_x#1 ) - (byte) progress_idx#29 ← phi( @54/(byte) progress_idx#1 ) - (byte*) progress_cursor#28 ← phi( @54/(byte*) progress_cursor#1 ) + to:@58 +@58: scope:[] from @57 + (byte) sin_idx_y#12 ← phi( @57/(byte) sin_idx_y#1 ) + (byte) sin_idx_x#12 ← phi( @57/(byte) sin_idx_x#1 ) + (byte) progress_idx#29 ← phi( @57/(byte) progress_idx#1 ) + (byte*) progress_cursor#28 ← phi( @57/(byte*) progress_cursor#1 ) (byte*) progress_cursor#14 ← (byte*) progress_cursor#28 (byte) progress_idx#15 ← (byte) progress_idx#29 (byte) sin_idx_x#6 ← (byte) sin_idx_x#12 (byte) sin_idx_y#6 ← (byte) sin_idx_y#12 to:@end -@end: scope:[] from @55 +@end: scope:[] from @58 SYMBOL TABLE SSA (label) @3 -(label) @44 (label) @47 -(label) @49 -(label) @54 -(label) @55 +(label) @50 +(label) @52 +(label) @57 +(label) @58 (label) @begin (label) @end (byte*) BORDERCOL @@ -1996,16 +1996,16 @@ Resolved ranged comparison value if(gen_chargen_sprite::x#1!=rangelast(0,7)) got Resolved ranged next value gen_chargen_sprite::y#1 ← ++ gen_chargen_sprite::y#10 to ++ Resolved ranged comparison value if(gen_chargen_sprite::y#1!=rangelast(0,7)) goto gen_chargen_sprite::@1 to (byte/signed byte/word/signed word/dword/signed dword) 8 Culled Empty Block (label) @3 -Culled Empty Block (label) @44 +Culled Empty Block (label) @47 Culled Empty Block (label) main::@5 Culled Empty Block (label) main::@1 Culled Empty Block (label) main::@6 Culled Empty Block (label) init::@3 Culled Empty Block (label) init::@10 -Culled Empty Block (label) @47 -Culled Empty Block (label) @49 +Culled Empty Block (label) @50 +Culled Empty Block (label) @52 Culled Empty Block (label) gen_sintab::@13 -Culled Empty Block (label) @55 +Culled Empty Block (label) @58 Successful SSA optimization Pass2CullEmptyBlocks Alias (word) getFAC::return#0 = (word~) getFAC::$0 Alias (byte) init::i#2 = (byte~) init::$1 @@ -2149,7 +2149,7 @@ Added new block during phi lifting gen_chargen_sprite::@13(between gen_chargen_s Added new block during phi lifting gen_chargen_sprite::@14(between gen_chargen_sprite::@4 and gen_chargen_sprite::@5) Added new block during phi lifting place_sprites::@3(between place_sprites::@1 and place_sprites::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @54 +Adding NOP phi() at start of @57 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@3 @@ -2273,7 +2273,7 @@ Culled Empty Block (label) gen_chargen_sprite::@13 Culled Empty Block (label) gen_chargen_sprite::@14 Culled Empty Block (label) place_sprites::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @54 +Adding NOP phi() at start of @57 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@3 @@ -2311,14 +2311,14 @@ Adding NOP phi() at start of gen_chargen_sprite::@6 FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@54 -@54: scope:[] from @begin + to:@57 +@57: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @54 +@end: scope:[] from @57 [3] phi() [ ] ( ) -main: scope:[main] from @54 +main: scope:[main] from @57 [4] phi() [ ] ( main:2 [ ] ) [5] call init [ ] ( main:2 [ ] ) to:main::@2 @@ -3164,17 +3164,17 @@ INITIAL ASM .label sin_idx_y = 3 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @54 [phi:@begin->@54] -b54_from_bbegin: - jmp b54 -//SEG4 @54 -b54: +//SEG3 [1] phi from @begin to @57 [phi:@begin->@57] +b57_from_bbegin: + jmp b57 +//SEG4 @57 +b57: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @54 to main [phi:@54->main] -main_from_b54: +//SEG6 [4] phi from @57 to main [phi:@57->main] +main_from_b57: jsr main -//SEG7 [3] phi from @54 to @end [phi:@54->@end] -bend_from_b54: +//SEG7 [3] phi from @57 to @end [phi:@57->@end] +bend_from_b57: jmp bend //SEG8 @end bend: @@ -4892,17 +4892,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label sin_idx_y = 3 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @54 [phi:@begin->@54] -b54_from_bbegin: - jmp b54 -//SEG4 @54 -b54: +//SEG3 [1] phi from @begin to @57 [phi:@begin->@57] +b57_from_bbegin: + jmp b57 +//SEG4 @57 +b57: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @54 to main [phi:@54->main] -main_from_b54: +//SEG6 [4] phi from @57 to main [phi:@57->main] +main_from_b57: jsr main -//SEG7 [3] phi from @54 to @end [phi:@54->@end] -bend_from_b54: +//SEG7 [3] phi from @57 to @end [phi:@57->@end] +bend_from_b57: jmp bend //SEG8 @end bend: @@ -6178,7 +6178,7 @@ place_sprites: { sintab_y: .fill $c5, 0 ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b54 +Removing instruction jmp b57 Removing instruction jmp bend Removing instruction jmp b2 Removing instruction jmp b3 @@ -6296,9 +6296,9 @@ Replacing label b2_from_b8 with b2 Replacing label b1_from_b9 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b54_from_bbegin: -Removing instruction main_from_b54: -Removing instruction bend_from_b54: +Removing instruction b57_from_bbegin: +Removing instruction main_from_b57: +Removing instruction bend_from_b57: Removing instruction b2_from_b2: Removing instruction b3_from_b2: Removing instruction b1_from_b3: @@ -6365,7 +6365,7 @@ Removing instruction b4_from_b5: Removing instruction b5_from_b4: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b54: +Removing instruction b57: Removing instruction bend: Removing instruction init_from_main: Removing instruction b2_from_main: @@ -6484,7 +6484,7 @@ Removing unreachable instruction jmp b4 Succesful ASM optimization Pass5UnreachableCodeElimination FINAL SYMBOL TABLE -(label) @54 +(label) @57 (label) @begin (label) @end (byte*) BORDERCOL @@ -6852,12 +6852,12 @@ Score: 768747 .label sin_idx_x = 2 .label sin_idx_y = 3 //SEG2 @begin -//SEG3 [1] phi from @begin to @54 [phi:@begin->@54] -//SEG4 @54 +//SEG3 [1] phi from @begin to @57 [phi:@begin->@57] +//SEG4 @57 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @54 to main [phi:@54->main] +//SEG6 [4] phi from @57 to main [phi:@57->main] jsr main -//SEG7 [3] phi from @54 to @end [phi:@54->@end] +//SEG7 [3] phi from @57 to @end [phi:@57->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/examples/sinsprites/sinus-sprites.sym b/src/test/ref/examples/sinsprites/sinus-sprites.sym index dad70b041..ca1bb93ad 100644 --- a/src/test/ref/examples/sinsprites/sinus-sprites.sym +++ b/src/test/ref/examples/sinsprites/sinus-sprites.sym @@ -1,4 +1,4 @@ -(label) @54 +(label) @57 (label) @begin (label) @end (byte*) BORDERCOL diff --git a/src/test/ref/incrementinarray.cfg b/src/test/ref/incrementinarray.cfg index 64d9488dc..837f60b5b 100644 --- a/src/test/ref/incrementinarray.cfg +++ b/src/test/ref/incrementinarray.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@15 -@15: scope:[] from @begin + to:@18 +@18: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @15 +@end: scope:[] from @18 [3] phi() [ ] ( ) -main: scope:[main] from @15 +main: scope:[main] from @18 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 diff --git a/src/test/ref/incrementinarray.log b/src/test/ref/incrementinarray.log index 70e69b9bc..a48568c94 100644 --- a/src/test/ref/incrementinarray.log +++ b/src/test/ref/incrementinarray.log @@ -4,7 +4,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@14 + to:@17 print_str: scope:[print_str] from main::@1 (byte*) print_char_cursor#27 ← phi( main::@1/(byte*) print_char_cursor#25 ) (byte*) print_str::str#4 ← phi( main::@1/(byte*) print_str::str#1 ) @@ -75,16 +75,16 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#6 ← (byte*) print_char_cursor#16 return to:@return -@14: scope:[] from @begin +@17: scope:[] from @begin (byte*) print_screen#6 ← phi( @begin/(byte*) print_screen#0 ) (byte*) print_char_cursor#28 ← phi( @begin/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#22 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte[]) txt#0 ← (const string) $0 - to:@15 -main: scope:[main] from @15 - (byte*) print_char_cursor#24 ← phi( @15/(byte*) print_char_cursor#26 ) - (byte*) print_line_cursor#18 ← phi( @15/(byte*) print_line_cursor#20 ) - (byte*) print_screen#4 ← phi( @15/(byte*) print_screen#5 ) + to:@18 +main: scope:[main] from @18 + (byte*) print_char_cursor#24 ← phi( @18/(byte*) print_char_cursor#26 ) + (byte*) print_line_cursor#18 ← phi( @18/(byte*) print_line_cursor#20 ) + (byte*) print_screen#4 ← phi( @18/(byte*) print_screen#5 ) call print_cls to:main::@3 main::@3: scope:[main] from main @@ -126,25 +126,25 @@ main::@return: scope:[main] from main::@5 (byte*) print_char_cursor#10 ← (byte*) print_char_cursor#20 return to:@return -@15: scope:[] from @14 - (byte*) print_screen#5 ← phi( @14/(byte*) print_screen#6 ) - (byte*) print_char_cursor#26 ← phi( @14/(byte*) print_char_cursor#28 ) - (byte*) print_line_cursor#20 ← phi( @14/(byte*) print_line_cursor#22 ) +@18: scope:[] from @17 + (byte*) print_screen#5 ← phi( @17/(byte*) print_screen#6 ) + (byte*) print_char_cursor#26 ← phi( @17/(byte*) print_char_cursor#28 ) + (byte*) print_line_cursor#20 ← phi( @17/(byte*) print_line_cursor#22 ) call main - to:@16 -@16: scope:[] from @15 - (byte*) print_char_cursor#21 ← phi( @15/(byte*) print_char_cursor#10 ) - (byte*) print_line_cursor#16 ← phi( @15/(byte*) print_line_cursor#7 ) + to:@19 +@19: scope:[] from @18 + (byte*) print_char_cursor#21 ← phi( @18/(byte*) print_char_cursor#10 ) + (byte*) print_line_cursor#16 ← phi( @18/(byte*) print_line_cursor#7 ) (byte*) print_line_cursor#8 ← (byte*) print_line_cursor#16 (byte*) print_char_cursor#11 ← (byte*) print_char_cursor#21 to:@end -@end: scope:[] from @16 +@end: scope:[] from @19 SYMBOL TABLE SSA (const string) $0 = (string) "camelot@" -(label) @14 -(label) @15 -(label) @16 +(label) @17 +(label) @18 +(label) @19 (label) @begin (label) @end (void()) main() @@ -308,9 +308,9 @@ Resolved ranged next value main::i#1 ← ++ main::i#2 to ++ Resolved ranged comparison value if(main::i#1!=rangelast(0,10)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 11 Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) print_cls::@2 -Culled Empty Block (label) @14 +Culled Empty Block (label) @17 Culled Empty Block (label) main::@3 -Culled Empty Block (label) @16 +Culled Empty Block (label) @19 Successful SSA optimization Pass2CullEmptyBlocks Inlining constant with var siblings (const byte*) print_str::str#1 Inlining constant with var siblings (const byte*) print_cls::sc#0 @@ -327,7 +327,7 @@ Added new block during phi lifting main::@6(between main::@5 and main::@1) Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @15 +Adding NOP phi() at start of @18 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@4 @@ -350,7 +350,7 @@ Coalesced down to 5 phi equivalence classes Culled Empty Block (label) print_ln::@3 Culled Empty Block (label) print_cls::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @15 +Adding NOP phi() at start of @18 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@4 @@ -361,14 +361,14 @@ Adding NOP phi() at start of print_cls FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@15 -@15: scope:[] from @begin + to:@18 +@18: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @15 +@end: scope:[] from @18 [3] phi() [ ] ( ) -main: scope:[main] from @15 +main: scope:[main] from @18 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 @@ -488,17 +488,17 @@ INITIAL ASM .label print_line_cursor = 3 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -b15_from_bbegin: - jmp b15 -//SEG4 @15 -b15: +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +b18_from_bbegin: + jmp b18 +//SEG4 @18 +b18: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] -main_from_b15: +//SEG6 [4] phi from @18 to main [phi:@18->main] +main_from_b18: jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] -bend_from_b15: +//SEG7 [3] phi from @18 to @end [phi:@18->@end] +bend_from_b18: jmp bend //SEG8 @end bend: @@ -745,17 +745,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = 2 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -b15_from_bbegin: - jmp b15 -//SEG4 @15 -b15: +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +b18_from_bbegin: + jmp b18 +//SEG4 @18 +b18: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] -main_from_b15: +//SEG6 [4] phi from @18 to main [phi:@18->main] +main_from_b18: jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] -bend_from_b15: +//SEG7 [3] phi from @18 to @end [phi:@18->@end] +bend_from_b18: jmp bend //SEG8 @end bend: @@ -948,7 +948,7 @@ print_cls: { txt: .text "camelot@" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b15 +Removing instruction jmp b18 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b4 @@ -968,9 +968,9 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b15_from_bbegin: -Removing instruction main_from_b15: -Removing instruction bend_from_b15: +Removing instruction b18_from_bbegin: +Removing instruction main_from_b18: +Removing instruction bend_from_b18: Removing instruction print_str_from_b1: Removing instruction b4_from_b1: Removing instruction print_ln_from_b4: @@ -978,7 +978,7 @@ Removing instruction b1_from_print_ln: Removing instruction b1_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b15: +Removing instruction b18: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1_from_main: @@ -997,7 +997,7 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination FINAL SYMBOL TABLE -(label) @15 +(label) @18 (label) @begin (label) @end (void()) main() @@ -1055,12 +1055,12 @@ Score: 11128 .label print_char_cursor = 6 .label print_line_cursor = 2 //SEG2 @begin -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -//SEG4 @15 +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +//SEG4 @18 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] +//SEG6 [4] phi from @18 to main [phi:@18->main] jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] +//SEG7 [3] phi from @18 to @end [phi:@18->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/incrementinarray.sym b/src/test/ref/incrementinarray.sym index 2d3439efb..c176b189d 100644 --- a/src/test/ref/incrementinarray.sym +++ b/src/test/ref/incrementinarray.sym @@ -1,4 +1,4 @@ -(label) @15 +(label) @18 (label) @begin (label) @end (void()) main() diff --git a/src/test/ref/linegen.cfg b/src/test/ref/linegen.cfg index 2094fb88f..32c5d4a38 100644 --- a/src/test/ref/linegen.cfg +++ b/src/test/ref/linegen.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@24 -@24: scope:[] from @begin + to:@27 +@27: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @24 +@end: scope:[] from @27 [3] phi() [ ] ( ) -main: scope:[main] from @24 +main: scope:[main] from @27 [4] phi() [ ] ( main:2 [ ] ) [5] call lin16u_gen [ ] ( main:2 [ ] ) to:main::@3 diff --git a/src/test/ref/linegen.log b/src/test/ref/linegen.log index 41e602cae..d40a0b530 100644 --- a/src/test/ref/linegen.log +++ b/src/test/ref/linegen.log @@ -87,7 +87,7 @@ divr16u::@return: scope:[divr16u] from divr16u::@6 (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@18 + to:@19 print_str: scope:[print_str] from main::@10 main::@14 main::@16 main::@18 main::@2 main::@23 main::@25 main::@6 main::@8 (byte*) print_char_cursor#86 ← phi( main::@10/(byte*) print_char_cursor#19 main::@14/(byte*) print_char_cursor#23 main::@16/(byte*) print_char_cursor#25 main::@18/(byte*) print_char_cursor#27 main::@2/(byte*) print_char_cursor#84 main::@23/(byte*) print_char_cursor#32 main::@25/(byte*) print_char_cursor#34 main::@6/(byte*) print_char_cursor#15 main::@8/(byte*) print_char_cursor#17 ) (byte*) print_str::str#12 ← phi( main::@10/(byte*) print_str::str#3 main::@14/(byte*) print_str::str#4 main::@16/(byte*) print_str::str#5 main::@18/(byte*) print_str::str#6 main::@2/(byte*) print_str::str#7 main::@23/(byte*) print_str::str#8 main::@25/(byte*) print_str::str#9 main::@6/(byte*) print_str::str#1 main::@8/(byte*) print_str::str#2 ) @@ -157,13 +157,13 @@ print_word::@return: scope:[print_word] from print_word::@2 (byte*) print_char_cursor#7 ← (byte*) print_char_cursor#46 return to:@return -@18: scope:[] from @8 +@19: scope:[] from @8 (byte*) print_screen#9 ← phi( @8/(byte*) print_screen#0 ) (byte*) print_char_cursor#88 ← phi( @8/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#31 ← phi( @8/(byte*) print_line_cursor#0 ) (word) rem16u#26 ← phi( @8/(word) rem16u#27 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@24 + to:@27 print_byte: scope:[print_byte] from main::@1 print_word print_word::@1 (byte*) print_char_cursor#81 ← phi( main::@1/(byte*) print_char_cursor#83 print_word/(byte*) print_char_cursor#80 print_word::@1/(byte*) print_char_cursor#5 ) (byte) print_byte::b#3 ← phi( main::@1/(byte) print_byte::b#2 print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) @@ -224,11 +224,11 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#14 ← (byte*) print_char_cursor#52 return to:@return -main: scope:[main] from @24 - (byte*) print_char_cursor#90 ← phi( @24/(byte*) print_char_cursor#85 ) - (byte*) print_line_cursor#36 ← phi( @24/(byte*) print_line_cursor#26 ) - (byte*) print_screen#7 ← phi( @24/(byte*) print_screen#8 ) - (word) rem16u#20 ← phi( @24/(word) rem16u#24 ) +main: scope:[main] from @27 + (byte*) print_char_cursor#90 ← phi( @27/(byte*) print_char_cursor#85 ) + (byte*) print_line_cursor#36 ← phi( @27/(byte*) print_line_cursor#26 ) + (byte*) print_screen#7 ← phi( @27/(byte*) print_screen#8 ) + (word) rem16u#20 ← phi( @27/(word) rem16u#24 ) (word[20]) main::lintab1#0 ← { fill( 20, 0) } (word) lin16u_gen::min#0 ← (word/signed word/dword/signed dword) 557 (word) lin16u_gen::max#0 ← (word/signed word/dword/signed dword) 29793 @@ -554,29 +554,29 @@ lin16u_gen::@return: scope:[lin16u_gen] from lin16u_gen::@1 (word) rem16u#9 ← (word) rem16u#18 return to:@return -@24: scope:[] from @18 - (byte*) print_screen#8 ← phi( @18/(byte*) print_screen#9 ) - (byte*) print_char_cursor#85 ← phi( @18/(byte*) print_char_cursor#88 ) - (byte*) print_line_cursor#26 ← phi( @18/(byte*) print_line_cursor#31 ) - (word) rem16u#24 ← phi( @18/(word) rem16u#26 ) +@27: scope:[] from @19 + (byte*) print_screen#8 ← phi( @19/(byte*) print_screen#9 ) + (byte*) print_char_cursor#85 ← phi( @19/(byte*) print_char_cursor#88 ) + (byte*) print_line_cursor#26 ← phi( @19/(byte*) print_line_cursor#31 ) + (word) rem16u#24 ← phi( @19/(word) rem16u#26 ) call main - to:@25 -@25: scope:[] from @24 - (byte*) print_char_cursor#77 ← phi( @24/(byte*) print_char_cursor#38 ) - (byte*) print_line_cursor#20 ← phi( @24/(byte*) print_line_cursor#9 ) - (word) rem16u#19 ← phi( @24/(word) rem16u#6 ) + to:@28 +@28: scope:[] from @27 + (byte*) print_char_cursor#77 ← phi( @27/(byte*) print_char_cursor#38 ) + (byte*) print_line_cursor#20 ← phi( @27/(byte*) print_line_cursor#9 ) + (word) rem16u#19 ← phi( @27/(word) rem16u#6 ) (word) rem16u#10 ← (word) rem16u#19 (byte*) print_line_cursor#10 ← (byte*) print_line_cursor#20 (byte*) print_char_cursor#39 ← (byte*) print_char_cursor#77 to:@end -@end: scope:[] from @25 +@end: scope:[] from @28 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" -(label) @18 +(label) @19 (label) @2 -(label) @24 -(label) @25 +(label) @27 +(label) @28 (label) @8 (label) @begin (label) @end @@ -1283,12 +1283,12 @@ Culled Empty Block (label) @2 Culled Empty Block (label) @8 Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) print_word::@2 -Culled Empty Block (label) @18 +Culled Empty Block (label) @19 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) main::@13 Culled Empty Block (label) main::@28 -Culled Empty Block (label) @25 +Culled Empty Block (label) @28 Successful SSA optimization Pass2CullEmptyBlocks Alias (dword) lin16u_gen::step#0 = (dword~) lin16u_gen::$9 Alias (dword) lin16u_gen::val#0 = (dword~) lin16u_gen::$10 @@ -1385,7 +1385,7 @@ Added new block during phi lifting divr16u::@8(between divr16u::@3 and divr16u:: Added new block during phi lifting divr16u::@9(between divr16u::@1 and divr16u::@2) Added new block during phi lifting divr16u::@10(between divr16u::@2 and divr16u::@3) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @24 +Adding NOP phi() at start of @27 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@3 @@ -1467,7 +1467,7 @@ Culled Empty Block (label) divr16u::@8 Culled Empty Block (label) divr16u::@10 Culled Empty Block (label) divr16u::@9 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @24 +Adding NOP phi() at start of @27 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@3 @@ -1495,14 +1495,14 @@ Adding NOP phi() at start of print_cls FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@24 -@24: scope:[] from @begin + to:@27 +@27: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @24 +@end: scope:[] from @27 [3] phi() [ ] ( ) -main: scope:[main] from @24 +main: scope:[main] from @27 [4] phi() [ ] ( main:2 [ ] ) [5] call lin16u_gen [ ] ( main:2 [ ] ) to:main::@3 @@ -1982,17 +1982,17 @@ INITIAL ASM .label print_line_cursor = 3 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @24 [phi:@begin->@24] -b24_from_bbegin: - jmp b24 -//SEG4 @24 -b24: +//SEG3 [1] phi from @begin to @27 [phi:@begin->@27] +b27_from_bbegin: + jmp b27 +//SEG4 @27 +b27: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @24 to main [phi:@24->main] -main_from_b24: +//SEG6 [4] phi from @27 to main [phi:@27->main] +main_from_b27: jsr main -//SEG7 [3] phi from @24 to @end [phi:@24->@end] -bend_from_b24: +//SEG7 [3] phi from @27 to @end [phi:@27->@end] +bend_from_b27: jmp bend //SEG8 @end bend: @@ -3100,17 +3100,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = 3 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @24 [phi:@begin->@24] -b24_from_bbegin: - jmp b24 -//SEG4 @24 -b24: +//SEG3 [1] phi from @begin to @27 [phi:@begin->@27] +b27_from_bbegin: + jmp b27 +//SEG4 @27 +b27: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @24 to main [phi:@24->main] -main_from_b24: +//SEG6 [4] phi from @27 to main [phi:@27->main] +main_from_b27: jsr main -//SEG7 [3] phi from @24 to @end [phi:@24->@end] -bend_from_b24: +//SEG7 [3] phi from @27 to @end [phi:@27->@end] +bend_from_b27: jmp bend //SEG8 @end bend: @@ -4016,7 +4016,7 @@ divr16u: { print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b24 +Removing instruction jmp b27 Removing instruction jmp bend Removing instruction jmp b3 Removing instruction jmp b4 @@ -4092,9 +4092,9 @@ Replacing label b3_from_b2 with b3 Replacing label b3_from_b2 with b3 Replacing label b1_from_b3 with b1 Removing instruction bbegin: -Removing instruction b24_from_bbegin: -Removing instruction main_from_b24: -Removing instruction bend_from_b24: +Removing instruction b27_from_bbegin: +Removing instruction main_from_b27: +Removing instruction bend_from_b27: Removing instruction b3_from_main: Removing instruction lin16u_gen_from_b3: Removing instruction b4_from_b3: @@ -4148,7 +4148,7 @@ Removing instruction b2_from_b4: Removing instruction b3_from_b2: Removing instruction b3_from_b5: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b24: +Removing instruction b27: Removing instruction bend: Removing instruction lin16u_gen_from_main: Removing instruction b3: @@ -4215,7 +4215,7 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination FINAL SYMBOL TABLE -(label) @24 +(label) @27 (label) @begin (label) @end (word()) divr16u((word) divr16u::dividend , (word) divr16u::divisor , (word) divr16u::rem) @@ -4422,12 +4422,12 @@ Score: 13533 .label print_char_cursor = 7 .label print_line_cursor = 3 //SEG2 @begin -//SEG3 [1] phi from @begin to @24 [phi:@begin->@24] -//SEG4 @24 +//SEG3 [1] phi from @begin to @27 [phi:@begin->@27] +//SEG4 @27 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @24 to main [phi:@24->main] +//SEG6 [4] phi from @27 to main [phi:@27->main] jsr main -//SEG7 [3] phi from @24 to @end [phi:@24->@end] +//SEG7 [3] phi from @27 to @end [phi:@27->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/linegen.sym b/src/test/ref/linegen.sym index cc67d7f37..b4d114a7c 100644 --- a/src/test/ref/linegen.sym +++ b/src/test/ref/linegen.sym @@ -1,4 +1,4 @@ -(label) @24 +(label) @27 (label) @begin (label) @end (word()) divr16u((word) divr16u::dividend , (word) divr16u::divisor , (word) divr16u::rem) diff --git a/src/test/ref/min-fmul-16.cfg b/src/test/ref/min-fmul-16.cfg index d0b76711e..7c03d77e5 100644 --- a/src/test/ref/min-fmul-16.cfg +++ b/src/test/ref/min-fmul-16.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@17 -@17: scope:[] from @begin + to:@20 +@20: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @17 +@end: scope:[] from @20 [3] phi() [ ] ( ) -main: scope:[main] from @17 +main: scope:[main] from @20 [4] phi() [ ] ( main:2 [ ] ) [5] call mulf_init [ ] ( main:2 [ ] ) to:main::@13 diff --git a/src/test/ref/min-fmul-16.log b/src/test/ref/min-fmul-16.log index 708c2610d..ebdf1322d 100644 --- a/src/test/ref/min-fmul-16.log +++ b/src/test/ref/min-fmul-16.log @@ -4,7 +4,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@10 + to:@11 print_word: scope:[print_word] from print_dword print_dword::@1 (byte*) print_char_cursor#34 ← phi( print_dword/(byte*) print_char_cursor#35 print_dword::@1/(byte*) print_char_cursor#4 ) (word) print_word::w#2 ← phi( print_dword/(word) print_word::w#0 print_dword::@1/(word) print_word::w#1 ) @@ -53,12 +53,12 @@ print_dword::@return: scope:[print_dword] from print_dword::@2 (byte*) print_char_cursor#6 ← (byte*) print_char_cursor#23 return to:@return -@10: scope:[] from @begin +@11: scope:[] from @begin (byte*) print_line_cursor#19 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte*) print_screen#19 ← phi( @begin/(byte*) print_screen#0 ) (byte*) print_char_cursor#46 ← phi( @begin/(byte*) print_char_cursor#0 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@14 + to:@17 print_byte: scope:[print_byte] from print_word print_word::@1 (byte*) print_char_cursor#36 ← phi( print_word/(byte*) print_char_cursor#34 print_word::@1/(byte*) print_char_cursor#1 ) (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) @@ -109,21 +109,21 @@ print_set_screen::@return: scope:[print_set_screen] from print_set_screen (byte*) print_char_cursor#13 ← (byte*) print_char_cursor#29 return to:@return -@14: scope:[] from @10 - (byte*) print_line_cursor#18 ← phi( @10/(byte*) print_line_cursor#19 ) - (byte*) print_screen#18 ← phi( @10/(byte*) print_screen#19 ) - (byte*) print_char_cursor#45 ← phi( @10/(byte*) print_char_cursor#46 ) +@17: scope:[] from @11 + (byte*) print_line_cursor#18 ← phi( @11/(byte*) print_line_cursor#19 ) + (byte*) print_screen#18 ← phi( @11/(byte*) print_screen#19 ) + (byte*) print_char_cursor#45 ← phi( @11/(byte*) print_char_cursor#46 ) (byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266 (byte*) BORDERCOL#0 ← ((byte*)) (word/dword/signed dword) 53280 (byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 - to:@15 -main: scope:[main] from @17 - (byte*) SCREEN#10 ← phi( @17/(byte*) SCREEN#11 ) - (byte*) BORDERCOL#9 ← phi( @17/(byte*) BORDERCOL#11 ) - (byte*) RASTER#7 ← phi( @17/(byte*) RASTER#9 ) - (byte*) print_line_cursor#16 ← phi( @17/(byte*) print_line_cursor#12 ) - (byte*) print_screen#16 ← phi( @17/(byte*) print_screen#12 ) - (byte*) print_char_cursor#43 ← phi( @17/(byte*) print_char_cursor#39 ) + to:@18 +main: scope:[main] from @20 + (byte*) SCREEN#10 ← phi( @20/(byte*) SCREEN#11 ) + (byte*) BORDERCOL#9 ← phi( @20/(byte*) BORDERCOL#11 ) + (byte*) RASTER#7 ← phi( @20/(byte*) RASTER#9 ) + (byte*) print_line_cursor#16 ← phi( @20/(byte*) print_line_cursor#12 ) + (byte*) print_screen#16 ← phi( @20/(byte*) print_screen#12 ) + (byte*) print_char_cursor#43 ← phi( @20/(byte*) print_char_cursor#39 ) call mulf_init to:main::@13 main::@13: scope:[main] from main @@ -246,18 +246,18 @@ main::@return: scope:[main] from main::@1 (byte*) print_line_cursor#4 ← (byte*) print_line_cursor#8 return to:@return -@15: scope:[] from @14 - (byte*) SCREEN#12 ← phi( @14/(byte*) SCREEN#0 ) - (byte*) BORDERCOL#12 ← phi( @14/(byte*) BORDERCOL#0 ) - (byte*) RASTER#12 ← phi( @14/(byte*) RASTER#0 ) - (byte*) print_line_cursor#15 ← phi( @14/(byte*) print_line_cursor#18 ) - (byte*) print_screen#15 ← phi( @14/(byte*) print_screen#18 ) - (byte*) print_char_cursor#42 ← phi( @14/(byte*) print_char_cursor#45 ) +@18: scope:[] from @17 + (byte*) SCREEN#12 ← phi( @17/(byte*) SCREEN#0 ) + (byte*) BORDERCOL#12 ← phi( @17/(byte*) BORDERCOL#0 ) + (byte*) RASTER#12 ← phi( @17/(byte*) RASTER#0 ) + (byte*) print_line_cursor#15 ← phi( @17/(byte*) print_line_cursor#18 ) + (byte*) print_screen#15 ← phi( @17/(byte*) print_screen#18 ) + (byte*) print_char_cursor#42 ← phi( @17/(byte*) print_char_cursor#45 ) (byte[512]) mulf_sqr1_lo#0 ← { fill( 512, 0) } (byte[512]) mulf_sqr1_hi#0 ← { fill( 512, 0) } (byte[512]) mulf_sqr2_lo#0 ← { fill( 512, 0) } (byte[512]) mulf_sqr2_hi#0 ← { fill( 512, 0) } - to:@17 + to:@20 mulf_init: scope:[mulf_init] from main (word) mulf_init::sqr#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) mulf_init::x_2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 @@ -371,32 +371,32 @@ mulf16u::@return: scope:[mulf16u] from mulf16u (dword) mulf16u::return#2 ← (dword) mulf16u::return#4 return to:@return -@17: scope:[] from @15 - (byte*) SCREEN#11 ← phi( @15/(byte*) SCREEN#12 ) - (byte*) BORDERCOL#11 ← phi( @15/(byte*) BORDERCOL#12 ) - (byte*) RASTER#9 ← phi( @15/(byte*) RASTER#12 ) - (byte*) print_line_cursor#12 ← phi( @15/(byte*) print_line_cursor#15 ) - (byte*) print_screen#12 ← phi( @15/(byte*) print_screen#15 ) - (byte*) print_char_cursor#39 ← phi( @15/(byte*) print_char_cursor#42 ) +@20: scope:[] from @18 + (byte*) SCREEN#11 ← phi( @18/(byte*) SCREEN#12 ) + (byte*) BORDERCOL#11 ← phi( @18/(byte*) BORDERCOL#12 ) + (byte*) RASTER#9 ← phi( @18/(byte*) RASTER#12 ) + (byte*) print_line_cursor#12 ← phi( @18/(byte*) print_line_cursor#15 ) + (byte*) print_screen#12 ← phi( @18/(byte*) print_screen#15 ) + (byte*) print_char_cursor#39 ← phi( @18/(byte*) print_char_cursor#42 ) call main - to:@18 -@18: scope:[] from @17 - (byte*) print_line_cursor#9 ← phi( @17/(byte*) print_line_cursor#4 ) - (byte*) print_screen#9 ← phi( @17/(byte*) print_screen#4 ) - (byte*) print_char_cursor#33 ← phi( @17/(byte*) print_char_cursor#16 ) + to:@21 +@21: scope:[] from @20 + (byte*) print_line_cursor#9 ← phi( @20/(byte*) print_line_cursor#4 ) + (byte*) print_screen#9 ← phi( @20/(byte*) print_screen#4 ) + (byte*) print_char_cursor#33 ← phi( @20/(byte*) print_char_cursor#16 ) (byte*) print_char_cursor#17 ← (byte*) print_char_cursor#33 (byte*) print_screen#5 ← (byte*) print_screen#9 (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#9 to:@end -@end: scope:[] from @18 +@end: scope:[] from @21 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" -(label) @10 -(label) @14 -(label) @15 +(label) @11 (label) @17 (label) @18 +(label) @20 +(label) @21 (label) @begin (label) @end (byte*) BORDERCOL @@ -895,15 +895,15 @@ Removing unused block main::@return Successful SSA optimization Pass2EliminateUnusedBlocks Culled Empty Block (label) print_word::@2 Culled Empty Block (label) print_dword::@2 -Culled Empty Block (label) @10 +Culled Empty Block (label) @11 Culled Empty Block (label) print_byte::@2 -Culled Empty Block (label) @14 +Culled Empty Block (label) @17 Culled Empty Block (label) main::@2 Culled Empty Block (label) main::@5 Culled Empty Block (label) main::@16 -Culled Empty Block (label) @15 -Culled Empty Block (label) mulf_init::@6 Culled Empty Block (label) @18 +Culled Empty Block (label) mulf_init::@6 +Culled Empty Block (label) @21 Successful SSA optimization Pass2CullEmptyBlocks Self Phi Eliminated (byte*) RASTER#2 Self Phi Eliminated (byte*) BORDERCOL#4 @@ -963,7 +963,7 @@ Added new block during phi lifting mulf_init::@10(between mulf_init::@1 and mulf Added new block during phi lifting mulf_init::@11(between mulf_init::@4 and mulf_init::@3) Added new block during phi lifting mulf_init::@12(between mulf_init::@3 and mulf_init::@4) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @17 +Adding NOP phi() at start of @20 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@15 @@ -1010,7 +1010,7 @@ Culled Empty Block (label) mulf_init::@11 Culled Empty Block (label) mulf_init::@9 Culled Empty Block (label) mulf_init::@10 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @17 +Adding NOP phi() at start of @20 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@15 @@ -1021,14 +1021,14 @@ Adding NOP phi() at start of mulf_init::@12 FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@17 -@17: scope:[] from @begin + to:@20 +@20: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @17 +@end: scope:[] from @20 [3] phi() [ ] ( ) -main: scope:[main] from @17 +main: scope:[main] from @20 [4] phi() [ ] ( main:2 [ ] ) [5] call mulf_init [ ] ( main:2 [ ] ) to:main::@13 @@ -1345,17 +1345,17 @@ INITIAL ASM .label print_char_cursor = 6 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @17 [phi:@begin->@17] -b17_from_bbegin: - jmp b17 -//SEG4 @17 -b17: +//SEG3 [1] phi from @begin to @20 [phi:@begin->@20] +b20_from_bbegin: + jmp b20 +//SEG4 @20 +b20: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @17 to main [phi:@17->main] -main_from_b17: +//SEG6 [4] phi from @20 to main [phi:@20->main] +main_from_b20: jsr main -//SEG7 [3] phi from @17 to @end [phi:@17->@end] -bend_from_b17: +//SEG7 [3] phi from @20 to @end [phi:@20->@end] +bend_from_b20: jmp bend //SEG8 @end bend: @@ -2070,17 +2070,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_char_cursor = 4 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @17 [phi:@begin->@17] -b17_from_bbegin: - jmp b17 -//SEG4 @17 -b17: +//SEG3 [1] phi from @begin to @20 [phi:@begin->@20] +b20_from_bbegin: + jmp b20 +//SEG4 @20 +b20: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @17 to main [phi:@17->main] -main_from_b17: +//SEG6 [4] phi from @20 to main [phi:@20->main] +main_from_b20: jsr main -//SEG7 [3] phi from @17 to @end [phi:@17->@end] -bend_from_b17: +//SEG7 [3] phi from @20 to @end [phi:@20->@end] +bend_from_b20: jmp bend //SEG8 @end bend: @@ -2609,7 +2609,7 @@ mulf_init: { mulf_sqr2_hi: .fill $200, 0 ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b17 +Removing instruction jmp b20 Removing instruction jmp bend Removing instruction jmp b13 Removing instruction jmp b1 @@ -2648,9 +2648,9 @@ Replacing label b12_from_b3 with b12 Replacing label b3_from_b4 with b3 Replacing label b3_from_b4 with b3 Removing instruction bbegin: -Removing instruction b17_from_bbegin: -Removing instruction main_from_b17: -Removing instruction bend_from_b17: +Removing instruction b20_from_bbegin: +Removing instruction main_from_b20: +Removing instruction bend_from_b20: Removing instruction b1: Removing instruction b15_from_b14: Removing instruction print_set_screen_from_b15: @@ -2661,7 +2661,7 @@ Removing instruction b3_from_b4: Removing instruction b12_from_b3: Removing instruction b4_from_b12: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b17: +Removing instruction b20: Removing instruction bend: Removing instruction mulf_init_from_main: Removing instruction b13: @@ -2703,7 +2703,7 @@ Removing unreachable instruction jmp b4 Succesful ASM optimization Pass5UnreachableCodeElimination FINAL SYMBOL TABLE -(label) @17 +(label) @20 (label) @begin (label) @end (byte*) BORDERCOL @@ -2858,12 +2858,12 @@ Score: 4324 .label SCREEN = $400 .label print_char_cursor = 4 //SEG2 @begin -//SEG3 [1] phi from @begin to @17 [phi:@begin->@17] -//SEG4 @17 +//SEG3 [1] phi from @begin to @20 [phi:@begin->@20] +//SEG4 @20 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @17 to main [phi:@17->main] +//SEG6 [4] phi from @20 to main [phi:@20->main] jsr main -//SEG7 [3] phi from @17 to @end [phi:@17->@end] +//SEG7 [3] phi from @20 to @end [phi:@20->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/min-fmul-16.sym b/src/test/ref/min-fmul-16.sym index f59ef4441..3b1df5562 100644 --- a/src/test/ref/min-fmul-16.sym +++ b/src/test/ref/min-fmul-16.sym @@ -1,4 +1,4 @@ -(label) @17 +(label) @20 (label) @begin (label) @end (byte*) BORDERCOL diff --git a/src/test/ref/printmsg.cfg b/src/test/ref/printmsg.cfg index 82aa65445..bab077abc 100644 --- a/src/test/ref/printmsg.cfg +++ b/src/test/ref/printmsg.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@15 -@15: scope:[] from @begin + to:@18 +@18: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @15 +@end: scope:[] from @18 [3] phi() [ ] ( ) -main: scope:[main] from @15 +main: scope:[main] from @18 [4] phi() [ ] ( main:2 [ ] ) [5] call print_str [ print_char_cursor#13 ] ( main:2 [ print_char_cursor#13 ] ) to:main::@1 diff --git a/src/test/ref/printmsg.log b/src/test/ref/printmsg.log index 58798e29f..388658501 100644 --- a/src/test/ref/printmsg.log +++ b/src/test/ref/printmsg.log @@ -4,7 +4,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@14 + to:@17 print_str: scope:[print_str] from main main::@2 main::@4 (byte*) print_char_cursor#29 ← phi( main/(byte*) print_char_cursor#27 main::@2/(byte*) print_char_cursor#6 main::@4/(byte*) print_char_cursor#8 ) (byte*) print_str::str#6 ← phi( main/(byte*) print_str::str#1 main::@2/(byte*) print_str::str#2 main::@4/(byte*) print_str::str#3 ) @@ -50,16 +50,16 @@ print_ln::@return: scope:[print_ln] from print_ln::@2 (byte*) print_char_cursor#4 ← (byte*) print_char_cursor#16 return to:@return -@14: scope:[] from @begin +@17: scope:[] from @begin (byte*) print_line_cursor#22 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte*) print_char_cursor#30 ← phi( @begin/(byte*) print_char_cursor#0 ) (byte[]) msg#0 ← (const string) $0 (byte[]) msg2#0 ← (const string) $1 (byte[]) msg3#0 ← (const string) $2 - to:@15 -main: scope:[main] from @15 - (byte*) print_line_cursor#21 ← phi( @15/(byte*) print_line_cursor#20 ) - (byte*) print_char_cursor#27 ← phi( @15/(byte*) print_char_cursor#28 ) + to:@18 +main: scope:[main] from @18 + (byte*) print_line_cursor#21 ← phi( @18/(byte*) print_line_cursor#20 ) + (byte*) print_char_cursor#27 ← phi( @18/(byte*) print_char_cursor#28 ) (byte*) print_str::str#1 ← (byte[]) msg#0 call print_str to:main::@1 @@ -110,26 +110,26 @@ main::@return: scope:[main] from main::@6 (byte*) print_line_cursor#6 ← (byte*) print_line_cursor#14 return to:@return -@15: scope:[] from @14 - (byte*) print_line_cursor#20 ← phi( @14/(byte*) print_line_cursor#22 ) - (byte*) print_char_cursor#28 ← phi( @14/(byte*) print_char_cursor#30 ) +@18: scope:[] from @17 + (byte*) print_line_cursor#20 ← phi( @17/(byte*) print_line_cursor#22 ) + (byte*) print_char_cursor#28 ← phi( @17/(byte*) print_char_cursor#30 ) call main - to:@16 -@16: scope:[] from @15 - (byte*) print_line_cursor#15 ← phi( @15/(byte*) print_line_cursor#6 ) - (byte*) print_char_cursor#24 ← phi( @15/(byte*) print_char_cursor#11 ) + to:@19 +@19: scope:[] from @18 + (byte*) print_line_cursor#15 ← phi( @18/(byte*) print_line_cursor#6 ) + (byte*) print_char_cursor#24 ← phi( @18/(byte*) print_char_cursor#11 ) (byte*) print_char_cursor#12 ← (byte*) print_char_cursor#24 (byte*) print_line_cursor#7 ← (byte*) print_line_cursor#15 to:@end -@end: scope:[] from @16 +@end: scope:[] from @19 SYMBOL TABLE SSA (const string) $0 = (string) "hello world! @" (const string) $1 = (string) "hello c64! @" (const string) $2 = (string) "hello 2017! @" -(label) @14 -(label) @15 -(label) @16 +(label) @17 +(label) @18 +(label) @19 (label) @begin (label) @end (void()) main() @@ -273,9 +273,9 @@ Constant (const byte*) print_str::str#2 = msg2#0 Constant (const byte*) print_str::str#3 = msg3#0 Successful SSA optimization Pass2ConstantIdentification Culled Empty Block (label) print_ln::@2 -Culled Empty Block (label) @14 +Culled Empty Block (label) @17 Culled Empty Block (label) main::@6 -Culled Empty Block (label) @16 +Culled Empty Block (label) @19 Successful SSA optimization Pass2CullEmptyBlocks Inlining constant with var siblings (const byte*) print_str::str#1 Inlining constant with var siblings (const byte*) print_str::str#2 @@ -291,7 +291,7 @@ Constant inlined $2 = (const byte[]) msg3#0 Successful SSA optimization Pass2ConstantInlining Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @15 +Adding NOP phi() at start of @18 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@1 @@ -313,7 +313,7 @@ Coalesced [34] print_char_cursor#34 ← print_char_cursor#1 Coalesced down to 3 phi equivalence classes Culled Empty Block (label) print_ln::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @15 +Adding NOP phi() at start of @18 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@1 @@ -323,14 +323,14 @@ Adding NOP phi() at start of main::@5 FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@15 -@15: scope:[] from @begin + to:@18 +@18: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @15 +@end: scope:[] from @18 [3] phi() [ ] ( ) -main: scope:[main] from @15 +main: scope:[main] from @18 [4] phi() [ ] ( main:2 [ ] ) [5] call print_str [ print_char_cursor#13 ] ( main:2 [ print_char_cursor#13 ] ) to:main::@1 @@ -432,17 +432,17 @@ INITIAL ASM .label print_line_cursor = 2 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -b15_from_bbegin: - jmp b15 -//SEG4 @15 -b15: +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +b18_from_bbegin: + jmp b18 +//SEG4 @18 +b18: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] -main_from_b15: +//SEG6 [4] phi from @18 to main [phi:@18->main] +main_from_b18: jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] -bend_from_b15: +//SEG7 [3] phi from @18 to @end [phi:@18->@end] +bend_from_b18: jmp bend //SEG8 @end bend: @@ -646,17 +646,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = 2 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -b15_from_bbegin: - jmp b15 -//SEG4 @15 -b15: +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +b18_from_bbegin: + jmp b18 +//SEG4 @18 +b18: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] -main_from_b15: +//SEG6 [4] phi from @18 to main [phi:@18->main] +main_from_b18: jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] -bend_from_b15: +//SEG7 [3] phi from @18 to @end [phi:@18->@end] +bend_from_b18: jmp bend //SEG8 @end bend: @@ -829,7 +829,7 @@ print_str: { msg3: .text "hello 2017! @" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b15 +Removing instruction jmp b18 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b2 @@ -848,9 +848,9 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b2 with b1 Removing instruction bbegin: -Removing instruction b15_from_bbegin: -Removing instruction main_from_b15: -Removing instruction bend_from_b15: +Removing instruction b18_from_bbegin: +Removing instruction main_from_b18: +Removing instruction bend_from_b18: Removing instruction b1_from_main: Removing instruction print_ln_from_b1: Removing instruction b3_from_b2: @@ -862,7 +862,7 @@ Removing instruction b1_from_b1: Removing instruction b1_from_print_str: Removing instruction b1_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b15: +Removing instruction b18: Removing instruction bend: Removing instruction print_str_from_main: Removing instruction b1: @@ -878,7 +878,7 @@ Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE -(label) @15 +(label) @18 (label) @begin (label) @end (void()) main() @@ -933,12 +933,12 @@ Score: 1039 .label print_char_cursor = 6 .label print_line_cursor = 2 //SEG2 @begin -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -//SEG4 @15 +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +//SEG4 @18 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] +//SEG6 [4] phi from @18 to main [phi:@18->main] jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] +//SEG7 [3] phi from @18 to @end [phi:@18->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/printmsg.sym b/src/test/ref/printmsg.sym index fc7151c86..049c282a0 100644 --- a/src/test/ref/printmsg.sym +++ b/src/test/ref/printmsg.sym @@ -1,4 +1,4 @@ -(label) @15 +(label) @18 (label) @begin (label) @end (void()) main() diff --git a/src/test/ref/sinus-basic.cfg b/src/test/ref/sinus-basic.cfg index 22a59415c..f22485248 100644 --- a/src/test/ref/sinus-basic.cfg +++ b/src/test/ref/sinus-basic.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@42 -@42: scope:[] from @begin + to:@45 +@45: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @42 +@end: scope:[] from @45 [3] phi() [ ] ( ) -main: scope:[main] from @42 +main: scope:[main] from @45 [4] phi() [ ] ( main:2 [ ] ) [5] call setFAC [ ] ( main:2 [ ] ) to:main::@3 diff --git a/src/test/ref/sinus-basic.log b/src/test/ref/sinus-basic.log index c4e8a1f15..941a78831 100644 --- a/src/test/ref/sinus-basic.log +++ b/src/test/ref/sinus-basic.log @@ -4,7 +4,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@10 + to:@11 print_ln: scope:[print_ln] from main::@15 (byte*) print_char_cursor#29 ← phi( main::@15/(byte*) print_char_cursor#11 ) (byte*) print_line_cursor#12 ← phi( main::@15/(byte*) print_line_cursor#13 ) @@ -52,11 +52,11 @@ print_word::@return: scope:[print_word] from print_word::@2 (byte*) print_char_cursor#5 ← (byte*) print_char_cursor#19 return to:@return -@10: scope:[] from @begin +@11: scope:[] from @begin (byte*) print_line_cursor#17 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte*) print_char_cursor#36 ← phi( @begin/(byte*) print_char_cursor#0 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@14 + to:@17 print_byte: scope:[print_byte] from print_word print_word::@1 (byte*) print_char_cursor#31 ← phi( print_word/(byte*) print_char_cursor#30 print_word::@1/(byte*) print_char_cursor#3 ) (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) @@ -92,12 +92,12 @@ print_char::@return: scope:[print_char] from print_char (byte*) print_char_cursor#10 ← (byte*) print_char_cursor#24 return to:@return -@14: scope:[] from @10 - (byte*) print_line_cursor#16 ← phi( @10/(byte*) print_line_cursor#17 ) - (byte*) print_char_cursor#35 ← phi( @10/(byte*) print_char_cursor#36 ) +@17: scope:[] from @11 + (byte*) print_line_cursor#16 ← phi( @11/(byte*) print_line_cursor#17 ) + (byte*) print_char_cursor#35 ← phi( @11/(byte*) print_char_cursor#36 ) (byte*) memLo#0 ← ((byte*)) (byte/word/signed word/dword/signed dword) 254 (byte*) memHi#0 ← ((byte*)) (byte/word/signed word/dword/signed dword) 255 - to:@42 + to:@45 prepareMEM: scope:[prepareMEM] from addMEMtoFAC divMEMbyFAC mulFACbyMEM setFAC setMEMtoFAC (byte*) prepareMEM::mem#5 ← phi( addMEMtoFAC/(byte*) prepareMEM::mem#2 divMEMbyFAC/(byte*) prepareMEM::mem#3 mulFACbyMEM/(byte*) prepareMEM::mem#4 setFAC/(byte*) prepareMEM::mem#0 setMEMtoFAC/(byte*) prepareMEM::mem#1 ) (byte~) prepareMEM::$0 ← < (byte*) prepareMEM::mem#5 @@ -186,9 +186,9 @@ divFACby10: scope:[divFACby10] from main::@3 divFACby10::@return: scope:[divFACby10] from divFACby10 return to:@return -main: scope:[main] from @42 - (byte*) print_line_cursor#30 ← phi( @42/(byte*) print_line_cursor#14 ) - (byte*) print_char_cursor#48 ← phi( @42/(byte*) print_char_cursor#33 ) +main: scope:[main] from @45 + (byte*) print_line_cursor#30 ← phi( @45/(byte*) print_line_cursor#14 ) + (byte*) print_char_cursor#48 ← phi( @45/(byte*) print_char_cursor#33 ) (byte[]) main::f_i#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0 } (byte[]) main::f_127#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0 } (byte*) main::f_2pi#0 ← ((byte*)) (word/dword/signed dword) 58085 @@ -307,25 +307,25 @@ main::@return: scope:[main] from main::@16 (byte*) print_line_cursor#4 ← (byte*) print_line_cursor#10 return to:@return -@42: scope:[] from @14 - (byte*) print_line_cursor#14 ← phi( @14/(byte*) print_line_cursor#16 ) - (byte*) print_char_cursor#33 ← phi( @14/(byte*) print_char_cursor#35 ) +@45: scope:[] from @17 + (byte*) print_line_cursor#14 ← phi( @17/(byte*) print_line_cursor#16 ) + (byte*) print_char_cursor#33 ← phi( @17/(byte*) print_char_cursor#35 ) call main - to:@43 -@43: scope:[] from @42 - (byte*) print_line_cursor#11 ← phi( @42/(byte*) print_line_cursor#4 ) - (byte*) print_char_cursor#28 ← phi( @42/(byte*) print_char_cursor#13 ) + to:@46 +@46: scope:[] from @45 + (byte*) print_line_cursor#11 ← phi( @45/(byte*) print_line_cursor#4 ) + (byte*) print_char_cursor#28 ← phi( @45/(byte*) print_char_cursor#13 ) (byte*) print_char_cursor#14 ← (byte*) print_char_cursor#28 (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#11 to:@end -@end: scope:[] from @43 +@end: scope:[] from @46 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" -(label) @10 -(label) @14 -(label) @42 -(label) @43 +(label) @11 +(label) @17 +(label) @45 +(label) @46 (label) @begin (label) @end (void()) addMEMtoFAC((byte*) addMEMtoFAC::mem) @@ -633,11 +633,11 @@ Resolved ranged next value main::i#1 ← ++ main::i#10 to ++ Resolved ranged comparison value if(main::i#1!=rangelast(1,25)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 26 Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) print_word::@2 -Culled Empty Block (label) @10 +Culled Empty Block (label) @11 Culled Empty Block (label) print_byte::@2 -Culled Empty Block (label) @14 +Culled Empty Block (label) @17 Culled Empty Block (label) main::@5 -Culled Empty Block (label) @43 +Culled Empty Block (label) @46 Successful SSA optimization Pass2CullEmptyBlocks Alias (word) getFAC::return#0 = (word~) getFAC::$0 Successful SSA optimization Pass2AliasElimination @@ -668,7 +668,7 @@ Successful SSA optimization Pass2ConstantInlining Added new block during phi lifting main::@17(between main::@16 and main::@1) Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @42 +Adding NOP phi() at start of @45 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@3 @@ -715,7 +715,7 @@ Coalesced [104] prepareMEM::mem#8 ← prepareMEM::mem#1 Coalesced down to 9 phi equivalence classes Culled Empty Block (label) print_ln::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @42 +Adding NOP phi() at start of @45 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@3 @@ -736,14 +736,14 @@ Adding NOP phi() at start of divMEMbyFAC FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@42 -@42: scope:[] from @begin + to:@45 +@45: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @42 +@end: scope:[] from @45 [3] phi() [ ] ( ) -main: scope:[main] from @42 +main: scope:[main] from @45 [4] phi() [ ] ( main:2 [ ] ) [5] call setFAC [ ] ( main:2 [ ] ) to:main::@3 @@ -1074,17 +1074,17 @@ INITIAL ASM .label print_char_cursor = 7 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @42 [phi:@begin->@42] -b42_from_bbegin: - jmp b42 -//SEG4 @42 -b42: +//SEG3 [1] phi from @begin to @45 [phi:@begin->@45] +b45_from_bbegin: + jmp b45 +//SEG4 @45 +b45: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @42 to main [phi:@42->main] -main_from_b42: +//SEG6 [4] phi from @45 to main [phi:@45->main] +main_from_b45: jsr main -//SEG7 [3] phi from @42 to @end [phi:@42->@end] -bend_from_b42: +//SEG7 [3] phi from @45 to @end [phi:@45->@end] +bend_from_b45: jmp bend //SEG8 @end bend: @@ -1726,17 +1726,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_char_cursor = 5 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @42 [phi:@begin->@42] -b42_from_bbegin: - jmp b42 -//SEG4 @42 -b42: +//SEG3 [1] phi from @begin to @45 [phi:@begin->@45] +b45_from_bbegin: + jmp b45 +//SEG4 @45 +b45: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @42 to main [phi:@42->main] -main_from_b42: +//SEG6 [4] phi from @45 to main [phi:@45->main] +main_from_b45: jsr main -//SEG7 [3] phi from @42 to @end [phi:@42->@end] -bend_from_b42: +//SEG7 [3] phi from @45 to @end [phi:@45->@end] +bend_from_b45: jmp bend //SEG8 @end bend: @@ -2229,7 +2229,7 @@ divFACby10: { print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b42 +Removing instruction jmp b45 Removing instruction jmp bend Removing instruction jmp b3 Removing instruction jmp b4 @@ -2271,9 +2271,9 @@ Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b42_from_bbegin: -Removing instruction main_from_b42: -Removing instruction bend_from_b42: +Removing instruction b45_from_bbegin: +Removing instruction main_from_b45: +Removing instruction bend_from_b45: Removing instruction b3_from_main: Removing instruction b4_from_b3: Removing instruction setMEMtoFAC_from_b4: @@ -2296,7 +2296,7 @@ Removing instruction print_ln_from_b15: Removing instruction b1_from_print_ln: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b42: +Removing instruction b45: Removing instruction bend: Removing instruction setFAC_from_main: Removing instruction b3: @@ -2348,7 +2348,7 @@ Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE -(label) @42 +(label) @45 (label) @begin (label) @end (void()) addMEMtoFAC((byte*) addMEMtoFAC::mem) @@ -2486,12 +2486,12 @@ Score: 4973 .label print_line_cursor = 3 .label print_char_cursor = 5 //SEG2 @begin -//SEG3 [1] phi from @begin to @42 [phi:@begin->@42] -//SEG4 @42 +//SEG3 [1] phi from @begin to @45 [phi:@begin->@45] +//SEG4 @45 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @42 to main [phi:@42->main] +//SEG6 [4] phi from @45 to main [phi:@45->main] jsr main -//SEG7 [3] phi from @42 to @end [phi:@42->@end] +//SEG7 [3] phi from @45 to @end [phi:@45->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/sinus-basic.sym b/src/test/ref/sinus-basic.sym index 4938af911..c2bb12635 100644 --- a/src/test/ref/sinus-basic.sym +++ b/src/test/ref/sinus-basic.sym @@ -1,4 +1,4 @@ -(label) @42 +(label) @45 (label) @begin (label) @end (void()) addMEMtoFAC((byte*) addMEMtoFAC::mem) diff --git a/src/test/ref/sinusgen16.cfg b/src/test/ref/sinusgen16.cfg index 9bc41b0c3..8b6188514 100644 --- a/src/test/ref/sinusgen16.cfg +++ b/src/test/ref/sinusgen16.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@35 -@35: scope:[] from @begin + to:@38 +@38: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @35 +@end: scope:[] from @38 [3] phi() [ ] ( ) -main: scope:[main] from @35 +main: scope:[main] from @38 [4] phi() [ ] ( main:2 [ ] ) [5] call sin16s_gen [ ] ( main:2 [ ] ) to:main::@5 diff --git a/src/test/ref/sinusgen16.log b/src/test/ref/sinusgen16.log index 4bbe5c975..8374e1c88 100644 --- a/src/test/ref/sinusgen16.log +++ b/src/test/ref/sinusgen16.log @@ -381,7 +381,7 @@ mulu16_sel::@return: scope:[mulu16_sel] from mulu16_sel::@2 (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@30 + to:@31 print_str: scope:[print_str] from main::@3 main::@7 (byte*) print_char_cursor#51 ← phi( main::@3/(byte*) print_char_cursor#49 main::@7/(byte*) print_char_cursor#17 ) (byte*) print_str::str#5 ← phi( main::@3/(byte*) print_str::str#2 main::@7/(byte*) print_str::str#1 ) @@ -464,13 +464,13 @@ print_word::@return: scope:[print_word] from print_word::@2 (byte*) print_char_cursor#8 ← (byte*) print_char_cursor#29 return to:@return -@30: scope:[] from @20 +@31: scope:[] from @20 (byte*) print_screen#7 ← phi( @20/(byte*) print_screen#0 ) (byte*) print_char_cursor#55 ← phi( @20/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#15 ← phi( @20/(byte*) print_line_cursor#0 ) (word) rem16u#28 ← phi( @20/(word) rem16u#29 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@35 + to:@38 print_byte: scope:[print_byte] from print_word print_word::@1 (byte*) print_char_cursor#46 ← phi( print_word/(byte*) print_char_cursor#45 print_word::@1/(byte*) print_char_cursor#6 ) (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) @@ -531,11 +531,11 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#15 ← (byte*) print_char_cursor#35 return to:@return -main: scope:[main] from @35 - (byte*) print_char_cursor#53 ← phi( @35/(byte*) print_char_cursor#50 ) - (byte*) print_line_cursor#13 ← phi( @35/(byte*) print_line_cursor#12 ) - (byte*) print_screen#5 ← phi( @35/(byte*) print_screen#6 ) - (word) rem16u#23 ← phi( @35/(word) rem16u#25 ) +main: scope:[main] from @38 + (byte*) print_char_cursor#53 ← phi( @38/(byte*) print_char_cursor#50 ) + (byte*) print_line_cursor#13 ← phi( @38/(byte*) print_line_cursor#12 ) + (byte*) print_screen#5 ← phi( @38/(byte*) print_screen#6 ) + (word) rem16u#23 ← phi( @38/(word) rem16u#25 ) (word) main::wavelength#0 ← (byte/signed byte/word/signed word/dword/signed dword) 120 (signed word[120]) main::sintab1#0 ← { fill( 120, 0) } (signed word*) sin16s_gen::sintab#1 ← (signed word[120]) main::sintab1#0 @@ -633,31 +633,31 @@ main::@return: scope:[main] from main::@8 (byte*) print_char_cursor#20 ← (byte*) print_char_cursor#40 return to:@return -@35: scope:[] from @30 - (byte*) print_screen#6 ← phi( @30/(byte*) print_screen#7 ) - (byte*) print_char_cursor#50 ← phi( @30/(byte*) print_char_cursor#55 ) - (byte*) print_line_cursor#12 ← phi( @30/(byte*) print_line_cursor#15 ) - (word) rem16u#25 ← phi( @30/(word) rem16u#28 ) +@38: scope:[] from @31 + (byte*) print_screen#6 ← phi( @31/(byte*) print_screen#7 ) + (byte*) print_char_cursor#50 ← phi( @31/(byte*) print_char_cursor#55 ) + (byte*) print_line_cursor#12 ← phi( @31/(byte*) print_line_cursor#15 ) + (word) rem16u#25 ← phi( @31/(word) rem16u#28 ) call main - to:@36 -@36: scope:[] from @35 - (byte*) print_char_cursor#41 ← phi( @35/(byte*) print_char_cursor#20 ) - (byte*) print_line_cursor#9 ← phi( @35/(byte*) print_line_cursor#4 ) - (word) rem16u#19 ← phi( @35/(word) rem16u#9 ) + to:@39 +@39: scope:[] from @38 + (byte*) print_char_cursor#41 ← phi( @38/(byte*) print_char_cursor#20 ) + (byte*) print_line_cursor#9 ← phi( @38/(byte*) print_line_cursor#4 ) + (word) rem16u#19 ← phi( @38/(word) rem16u#9 ) (word) rem16u#10 ← (word) rem16u#19 (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#9 (byte*) print_char_cursor#21 ← (byte*) print_char_cursor#41 to:@end -@end: scope:[] from @36 +@end: scope:[] from @39 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" (label) @13 (label) @2 (label) @20 -(label) @30 -(label) @35 -(label) @36 +(label) @31 +(label) @38 +(label) @39 (label) @begin (label) @end (dword) PI2_u4f28 @@ -1494,12 +1494,12 @@ Culled Empty Block (label) @13 Culled Empty Block (label) @20 Culled Empty Block (label) print_sword::@3 Culled Empty Block (label) print_word::@2 -Culled Empty Block (label) @30 +Culled Empty Block (label) @31 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) main::@6 Culled Empty Block (label) main::@9 -Culled Empty Block (label) @36 +Culled Empty Block (label) @39 Successful SSA optimization Pass2CullEmptyBlocks Alias (dword) div32u16u::return#0 = (dword~) div32u16u::$4 Successful SSA optimization Pass2AliasElimination @@ -1573,7 +1573,7 @@ Added new block during phi lifting divr16u::@8(between divr16u::@3 and divr16u:: Added new block during phi lifting divr16u::@9(between divr16u::@1 and divr16u::@2) Added new block during phi lifting divr16u::@10(between divr16u::@2 and divr16u::@3) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @35 +Adding NOP phi() at start of @38 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@5 @@ -1666,7 +1666,7 @@ Culled Empty Block (label) divr16u::@8 Culled Empty Block (label) divr16u::@10 Culled Empty Block (label) divr16u::@9 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @35 +Adding NOP phi() at start of @38 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@5 @@ -1680,14 +1680,14 @@ Adding NOP phi() at start of div32u16u FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@35 -@35: scope:[] from @begin + to:@38 +@38: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @35 +@end: scope:[] from @38 [3] phi() [ ] ( ) -main: scope:[main] from @35 +main: scope:[main] from @38 [4] phi() [ ] ( main:2 [ ] ) [5] call sin16s_gen [ ] ( main:2 [ ] ) to:main::@5 @@ -2378,17 +2378,17 @@ INITIAL ASM .label print_char_cursor = $a //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -b35_from_bbegin: - jmp b35 -//SEG4 @35 -b35: +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +b38_from_bbegin: + jmp b38 +//SEG4 @38 +b38: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @35 to main [phi:@35->main] -main_from_b35: +//SEG6 [4] phi from @38 to main [phi:@38->main] +main_from_b38: jsr main -//SEG7 [3] phi from @35 to @end [phi:@35->@end] -bend_from_b35: +//SEG7 [3] phi from @38 to @end [phi:@38->@end] +bend_from_b38: jmp bend //SEG8 @end bend: @@ -3896,17 +3896,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_char_cursor = 8 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -b35_from_bbegin: - jmp b35 -//SEG4 @35 -b35: +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +b38_from_bbegin: + jmp b38 +//SEG4 @38 +b38: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @35 to main [phi:@35->main] -main_from_b35: +//SEG6 [4] phi from @38 to main [phi:@38->main] +main_from_b38: jsr main -//SEG7 [3] phi from @35 to @end [phi:@35->@end] -bend_from_b35: +//SEG7 [3] phi from @38 to @end [phi:@38->@end] +bend_from_b38: jmp bend //SEG8 @end bend: @@ -4954,7 +4954,7 @@ divr16u: { print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b35 +Removing instruction jmp b38 Removing instruction jmp bend Removing instruction jmp b5 Removing instruction jmp b1 @@ -5038,9 +5038,9 @@ Replacing label b3_from_b2 with b3 Replacing label b3_from_b2 with b3 Replacing label b1_from_b3 with b1 Removing instruction bbegin: -Removing instruction b35_from_bbegin: -Removing instruction main_from_b35: -Removing instruction bend_from_b35: +Removing instruction b38_from_bbegin: +Removing instruction main_from_b38: +Removing instruction bend_from_b38: Removing instruction b5_from_main: Removing instruction print_cls_from_b5: Removing instruction b1_from_b8: @@ -5071,7 +5071,7 @@ Removing instruction b2_from_b4: Removing instruction b3_from_b2: Removing instruction b3_from_b5: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b35: +Removing instruction b38: Removing instruction bend: Removing instruction sin16s_gen_from_main: Removing instruction b5: @@ -5148,7 +5148,7 @@ Removing unreachable instruction jmp b3 Succesful ASM optimization Pass5UnreachableCodeElimination FINAL SYMBOL TABLE -(label) @35 +(label) @38 (label) @begin (label) @end (dword) PI2_u4f28 @@ -5437,12 +5437,12 @@ Score: 20867 .label rem16u = 2 .label print_char_cursor = 8 //SEG2 @begin -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -//SEG4 @35 +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +//SEG4 @38 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @35 to main [phi:@35->main] +//SEG6 [4] phi from @38 to main [phi:@38->main] jsr main -//SEG7 [3] phi from @35 to @end [phi:@35->@end] +//SEG7 [3] phi from @38 to @end [phi:@38->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/sinusgen16.sym b/src/test/ref/sinusgen16.sym index 7dd349995..7549c7bbb 100644 --- a/src/test/ref/sinusgen16.sym +++ b/src/test/ref/sinusgen16.sym @@ -1,4 +1,4 @@ -(label) @35 +(label) @38 (label) @begin (label) @end (dword) PI2_u4f28 diff --git a/src/test/ref/sinusgen16b.cfg b/src/test/ref/sinusgen16b.cfg index a77c65efd..b41febe87 100644 --- a/src/test/ref/sinusgen16b.cfg +++ b/src/test/ref/sinusgen16b.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@37 -@37: scope:[] from @begin + to:@40 +@40: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @37 +@end: scope:[] from @40 [3] phi() [ ] ( ) -main: scope:[main] from @37 +main: scope:[main] from @40 [4] phi() [ ] ( main:2 [ ] ) [5] call sin16s_gen [ ] ( main:2 [ ] ) to:main::@5 diff --git a/src/test/ref/sinusgen16b.log b/src/test/ref/sinusgen16b.log index 8860fb728..5ea534321 100644 --- a/src/test/ref/sinusgen16b.log +++ b/src/test/ref/sinusgen16b.log @@ -559,7 +559,7 @@ sin16sb::@return: scope:[sin16sb] from sin16sb::@3 (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@32 + to:@33 print_str: scope:[print_str] from main::@3 main::@8 (byte*) print_char_cursor#51 ← phi( main::@3/(byte*) print_char_cursor#49 main::@8/(byte*) print_char_cursor#17 ) (byte*) print_str::str#5 ← phi( main::@3/(byte*) print_str::str#2 main::@8/(byte*) print_str::str#1 ) @@ -642,13 +642,13 @@ print_word::@return: scope:[print_word] from print_word::@2 (byte*) print_char_cursor#8 ← (byte*) print_char_cursor#29 return to:@return -@32: scope:[] from @22 +@33: scope:[] from @22 (byte*) print_screen#8 ← phi( @22/(byte*) print_screen#0 ) (byte*) print_char_cursor#55 ← phi( @22/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#15 ← phi( @22/(byte*) print_line_cursor#0 ) (word) rem16u#37 ← phi( @22/(word) rem16u#38 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@37 + to:@40 print_byte: scope:[print_byte] from print_word print_word::@1 (byte*) print_char_cursor#46 ← phi( print_word/(byte*) print_char_cursor#45 print_word::@1/(byte*) print_char_cursor#6 ) (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) @@ -709,11 +709,11 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#15 ← (byte*) print_char_cursor#35 return to:@return -main: scope:[main] from @37 - (byte*) print_char_cursor#56 ← phi( @37/(byte*) print_char_cursor#50 ) - (byte*) print_line_cursor#16 ← phi( @37/(byte*) print_line_cursor#12 ) - (byte*) print_screen#6 ← phi( @37/(byte*) print_screen#7 ) - (word) rem16u#31 ← phi( @37/(word) rem16u#33 ) +main: scope:[main] from @40 + (byte*) print_char_cursor#56 ← phi( @40/(byte*) print_char_cursor#50 ) + (byte*) print_line_cursor#16 ← phi( @40/(byte*) print_line_cursor#12 ) + (byte*) print_screen#6 ← phi( @40/(byte*) print_screen#7 ) + (word) rem16u#31 ← phi( @40/(word) rem16u#33 ) (word) main::wavelength#0 ← (byte/signed byte/word/signed word/dword/signed dword) 120 (signed word[120]) main::sintab1#0 ← { fill( 120, 0) } (signed word[120]) main::sintab2#0 ← { fill( 120, 0) } @@ -831,31 +831,31 @@ main::@return: scope:[main] from main::@9 (byte*) print_char_cursor#20 ← (byte*) print_char_cursor#40 return to:@return -@37: scope:[] from @32 - (byte*) print_screen#7 ← phi( @32/(byte*) print_screen#8 ) - (byte*) print_char_cursor#50 ← phi( @32/(byte*) print_char_cursor#55 ) - (byte*) print_line_cursor#12 ← phi( @32/(byte*) print_line_cursor#15 ) - (word) rem16u#33 ← phi( @32/(word) rem16u#37 ) +@40: scope:[] from @33 + (byte*) print_screen#7 ← phi( @33/(byte*) print_screen#8 ) + (byte*) print_char_cursor#50 ← phi( @33/(byte*) print_char_cursor#55 ) + (byte*) print_line_cursor#12 ← phi( @33/(byte*) print_line_cursor#15 ) + (word) rem16u#33 ← phi( @33/(word) rem16u#37 ) call main - to:@38 -@38: scope:[] from @37 - (byte*) print_char_cursor#41 ← phi( @37/(byte*) print_char_cursor#20 ) - (byte*) print_line_cursor#9 ← phi( @37/(byte*) print_line_cursor#4 ) - (word) rem16u#25 ← phi( @37/(word) rem16u#12 ) + to:@41 +@41: scope:[] from @40 + (byte*) print_char_cursor#41 ← phi( @40/(byte*) print_char_cursor#20 ) + (byte*) print_line_cursor#9 ← phi( @40/(byte*) print_line_cursor#4 ) + (word) rem16u#25 ← phi( @40/(word) rem16u#12 ) (word) rem16u#13 ← (word) rem16u#25 (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#9 (byte*) print_char_cursor#21 ← (byte*) print_char_cursor#41 to:@end -@end: scope:[] from @38 +@end: scope:[] from @41 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" (label) @13 (label) @2 (label) @22 -(label) @32 -(label) @37 -(label) @38 +(label) @33 +(label) @40 +(label) @41 (label) @begin (label) @end (dword) PI2_u4f28 @@ -1954,12 +1954,12 @@ Culled Empty Block (label) @13 Culled Empty Block (label) @22 Culled Empty Block (label) print_sword::@3 Culled Empty Block (label) print_word::@2 -Culled Empty Block (label) @32 +Culled Empty Block (label) @33 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) main::@7 Culled Empty Block (label) main::@10 -Culled Empty Block (label) @38 +Culled Empty Block (label) @41 Successful SSA optimization Pass2CullEmptyBlocks Alias (dword) div32u16u::return#0 = (dword~) div32u16u::$4 Successful SSA optimization Pass2AliasElimination @@ -2076,7 +2076,7 @@ Fixing phi predecessor for sin16s::isUpper#2 to new block ( sin16s -> sin16s::@1 Added new block during phi lifting sin16s::@14(between sin16s::@1 and sin16s::@2) Added new block during phi lifting sin16s::@15(between sin16s::@12 and sin16s::@3) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @37 +Adding NOP phi() at start of @40 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@5 @@ -2195,7 +2195,7 @@ Culled Empty Block (label) sin16s_gen::@5 Culled Empty Block (label) sin16s::@14 Culled Empty Block (label) sin16s::@13 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @37 +Adding NOP phi() at start of @40 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@5 @@ -2211,14 +2211,14 @@ Adding NOP phi() at start of sin16s_gen FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@37 -@37: scope:[] from @begin + to:@40 +@40: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @37 +@end: scope:[] from @40 [3] phi() [ ] ( ) -main: scope:[main] from @37 +main: scope:[main] from @40 [4] phi() [ ] ( main:2 [ ] ) [5] call sin16s_gen [ ] ( main:2 [ ] ) to:main::@5 @@ -3162,17 +3162,17 @@ INITIAL ASM .label print_char_cursor = $d //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @37 [phi:@begin->@37] -b37_from_bbegin: - jmp b37 -//SEG4 @37 -b37: +//SEG3 [1] phi from @begin to @40 [phi:@begin->@40] +b40_from_bbegin: + jmp b40 +//SEG4 @40 +b40: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @37 to main [phi:@37->main] -main_from_b37: +//SEG6 [4] phi from @40 to main [phi:@40->main] +main_from_b40: jsr main -//SEG7 [3] phi from @37 to @end [phi:@37->@end] -bend_from_b37: +//SEG7 [3] phi from @40 to @end [phi:@40->@end] +bend_from_b40: jmp bend //SEG8 @end bend: @@ -5302,17 +5302,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_char_cursor = $b //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @37 [phi:@begin->@37] -b37_from_bbegin: - jmp b37 -//SEG4 @37 -b37: +//SEG3 [1] phi from @begin to @40 [phi:@begin->@40] +b40_from_bbegin: + jmp b40 +//SEG4 @40 +b40: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @37 to main [phi:@37->main] -main_from_b37: +//SEG6 [4] phi from @40 to main [phi:@40->main] +main_from_b40: jsr main -//SEG7 [3] phi from @37 to @end [phi:@37->@end] -bend_from_b37: +//SEG7 [3] phi from @40 to @end [phi:@40->@end] +bend_from_b40: jmp bend //SEG8 @end bend: @@ -6763,7 +6763,7 @@ sin16s: { print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b37 +Removing instruction jmp b40 Removing instruction jmp bend Removing instruction jmp b5 Removing instruction jmp b6 @@ -6870,9 +6870,9 @@ Replacing label b2_from_b1 with b2 Replacing label b2_from_b1 with b2 Replacing label b3_from_b15 with b3 Removing instruction bbegin: -Removing instruction b37_from_bbegin: -Removing instruction main_from_b37: -Removing instruction bend_from_b37: +Removing instruction b40_from_bbegin: +Removing instruction main_from_b40: +Removing instruction bend_from_b40: Removing instruction b5_from_main: Removing instruction sin16s_genb_from_b5: Removing instruction b6_from_b5: @@ -6911,7 +6911,7 @@ Removing instruction b3_from_b15: Removing instruction b3_from_b6: Removing instruction breturn: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b37: +Removing instruction b40: Removing instruction bend: Removing instruction sin16s_gen_from_main: Removing instruction b5: @@ -7013,7 +7013,7 @@ Removing unreachable instruction jmp b3 Succesful ASM optimization Pass5UnreachableCodeElimination FINAL SYMBOL TABLE -(label) @37 +(label) @40 (label) @begin (label) @end (dword) PI2_u4f28 @@ -7395,12 +7395,12 @@ Score: 23127 .label rem16u = 2 .label print_char_cursor = $b //SEG2 @begin -//SEG3 [1] phi from @begin to @37 [phi:@begin->@37] -//SEG4 @37 +//SEG3 [1] phi from @begin to @40 [phi:@begin->@40] +//SEG4 @40 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @37 to main [phi:@37->main] +//SEG6 [4] phi from @40 to main [phi:@40->main] jsr main -//SEG7 [3] phi from @37 to @end [phi:@37->@end] +//SEG7 [3] phi from @40 to @end [phi:@40->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/sinusgen16b.sym b/src/test/ref/sinusgen16b.sym index 38edca6e0..1329a0ce6 100644 --- a/src/test/ref/sinusgen16b.sym +++ b/src/test/ref/sinusgen16b.sym @@ -1,4 +1,4 @@ -(label) @37 +(label) @40 (label) @begin (label) @end (dword) PI2_u4f28 diff --git a/src/test/ref/sinusgen8.cfg b/src/test/ref/sinusgen8.cfg index 78657626a..157518771 100644 --- a/src/test/ref/sinusgen8.cfg +++ b/src/test/ref/sinusgen8.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@35 -@35: scope:[] from @begin + to:@38 +@38: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @35 +@end: scope:[] from @38 [3] phi() [ ] ( ) -main: scope:[main] from @35 +main: scope:[main] from @38 [4] phi() [ ] ( main:2 [ ] ) [5] call sin8s_gen [ ] ( main:2 [ ] ) to:main::@5 diff --git a/src/test/ref/sinusgen8.log b/src/test/ref/sinusgen8.log index 44dd7c7de..906f7e952 100644 --- a/src/test/ref/sinusgen8.log +++ b/src/test/ref/sinusgen8.log @@ -352,7 +352,7 @@ mulu8_sel::@return: scope:[mulu8_sel] from mulu8_sel::@2 (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@30 + to:@31 print_str: scope:[print_str] from main::@3 main::@7 (byte*) print_char_cursor#44 ← phi( main::@3/(byte*) print_char_cursor#42 main::@7/(byte*) print_char_cursor#14 ) (byte*) print_str::str#5 ← phi( main::@3/(byte*) print_str::str#2 main::@7/(byte*) print_str::str#1 ) @@ -411,12 +411,12 @@ print_sbyte::@return: scope:[print_sbyte] from print_sbyte::@3 (byte*) print_char_cursor#5 ← (byte*) print_char_cursor#23 return to:@return -@30: scope:[] from @20 +@31: scope:[] from @20 (byte*) print_screen#7 ← phi( @20/(byte*) print_screen#0 ) (byte*) print_char_cursor#48 ← phi( @20/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#15 ← phi( @20/(byte*) print_line_cursor#0 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@35 + to:@38 print_byte: scope:[print_byte] from print_sbyte::@1 (byte*) print_char_cursor#39 ← phi( print_sbyte::@1/(byte*) print_char_cursor#37 ) (byte) print_byte::b#1 ← phi( print_sbyte::@1/(byte) print_byte::b#0 ) @@ -477,10 +477,10 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#12 ← (byte*) print_char_cursor#29 return to:@return -main: scope:[main] from @35 - (byte*) print_char_cursor#46 ← phi( @35/(byte*) print_char_cursor#43 ) - (byte*) print_line_cursor#13 ← phi( @35/(byte*) print_line_cursor#12 ) - (byte*) print_screen#5 ← phi( @35/(byte*) print_screen#6 ) +main: scope:[main] from @38 + (byte*) print_char_cursor#46 ← phi( @38/(byte*) print_char_cursor#43 ) + (byte*) print_line_cursor#13 ← phi( @38/(byte*) print_line_cursor#12 ) + (byte*) print_screen#5 ← phi( @38/(byte*) print_screen#6 ) (word) main::wavelength#0 ← (byte/word/signed word/dword/signed dword) 192 (signed byte[192]) main::sintab2#0 ← { fill( 192, 0) } (byte[]) main::sintabref#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 12, (byte/signed byte/word/signed word/dword/signed dword) 17, (byte/signed byte/word/signed word/dword/signed dword) 21, (byte/signed byte/word/signed word/dword/signed dword) 25, (byte/signed byte/word/signed word/dword/signed dword) 29, (byte/signed byte/word/signed word/dword/signed dword) 33, (byte/signed byte/word/signed word/dword/signed dword) 37, (byte/signed byte/word/signed word/dword/signed dword) 41, (byte/signed byte/word/signed word/dword/signed dword) 45, (byte/signed byte/word/signed word/dword/signed dword) 49, (byte/signed byte/word/signed word/dword/signed dword) 53, (byte/signed byte/word/signed word/dword/signed dword) 56, (byte/signed byte/word/signed word/dword/signed dword) 60, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/signed byte/word/signed word/dword/signed dword) 67, (byte/signed byte/word/signed word/dword/signed dword) 71, (byte/signed byte/word/signed word/dword/signed dword) 74, (byte/signed byte/word/signed word/dword/signed dword) 78, (byte/signed byte/word/signed word/dword/signed dword) 81, (byte/signed byte/word/signed word/dword/signed dword) 84, (byte/signed byte/word/signed word/dword/signed dword) 87, (byte/signed byte/word/signed word/dword/signed dword) 90, (byte/signed byte/word/signed word/dword/signed dword) 93, (byte/signed byte/word/signed word/dword/signed dword) 96, (byte/signed byte/word/signed word/dword/signed dword) 99, (byte/signed byte/word/signed word/dword/signed dword) 101, (byte/signed byte/word/signed word/dword/signed dword) 104, (byte/signed byte/word/signed word/dword/signed dword) 106, (byte/signed byte/word/signed word/dword/signed dword) 108, (byte/signed byte/word/signed word/dword/signed dword) 110, (byte/signed byte/word/signed word/dword/signed dword) 112, (byte/signed byte/word/signed word/dword/signed dword) 114, (byte/signed byte/word/signed word/dword/signed dword) 116, (byte/signed byte/word/signed word/dword/signed dword) 118, (byte/signed byte/word/signed word/dword/signed dword) 119, (byte/signed byte/word/signed word/dword/signed dword) 121, (byte/signed byte/word/signed word/dword/signed dword) 122, (byte/signed byte/word/signed word/dword/signed dword) 123, (byte/signed byte/word/signed word/dword/signed dword) 124, (byte/signed byte/word/signed word/dword/signed dword) 125, (byte/signed byte/word/signed word/dword/signed dword) 126, (byte/signed byte/word/signed word/dword/signed dword) 126, (byte/signed byte/word/signed word/dword/signed dword) 127, (byte/signed byte/word/signed word/dword/signed dword) 127, (byte/signed byte/word/signed word/dword/signed dword) 127, (byte/word/signed word/dword/signed dword) 128, (byte/signed byte/word/signed word/dword/signed dword) 127, (byte/signed byte/word/signed word/dword/signed dword) 127, (byte/signed byte/word/signed word/dword/signed dword) 127, (byte/signed byte/word/signed word/dword/signed dword) 126, (byte/signed byte/word/signed word/dword/signed dword) 126, (byte/signed byte/word/signed word/dword/signed dword) 125, (byte/signed byte/word/signed word/dword/signed dword) 124, (byte/signed byte/word/signed word/dword/signed dword) 123, (byte/signed byte/word/signed word/dword/signed dword) 122, (byte/signed byte/word/signed word/dword/signed dword) 121, (byte/signed byte/word/signed word/dword/signed dword) 119, (byte/signed byte/word/signed word/dword/signed dword) 118, (byte/signed byte/word/signed word/dword/signed dword) 116, (byte/signed byte/word/signed word/dword/signed dword) 114, (byte/signed byte/word/signed word/dword/signed dword) 112, (byte/signed byte/word/signed word/dword/signed dword) 110, (byte/signed byte/word/signed word/dword/signed dword) 108, (byte/signed byte/word/signed word/dword/signed dword) 106, (byte/signed byte/word/signed word/dword/signed dword) 104, (byte/signed byte/word/signed word/dword/signed dword) 101, (byte/signed byte/word/signed word/dword/signed dword) 99, (byte/signed byte/word/signed word/dword/signed dword) 96, (byte/signed byte/word/signed word/dword/signed dword) 93, (byte/signed byte/word/signed word/dword/signed dword) 90, (byte/signed byte/word/signed word/dword/signed dword) 87, (byte/signed byte/word/signed word/dword/signed dword) 84, (byte/signed byte/word/signed word/dword/signed dword) 81, (byte/signed byte/word/signed word/dword/signed dword) 78, (byte/signed byte/word/signed word/dword/signed dword) 74, (byte/signed byte/word/signed word/dword/signed dword) 71, (byte/signed byte/word/signed word/dword/signed dword) 67, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/signed byte/word/signed word/dword/signed dword) 60, (byte/signed byte/word/signed word/dword/signed dword) 56, (byte/signed byte/word/signed word/dword/signed dword) 53, (byte/signed byte/word/signed word/dword/signed dword) 49, (byte/signed byte/word/signed word/dword/signed dword) 45, (byte/signed byte/word/signed word/dword/signed dword) 41, (byte/signed byte/word/signed word/dword/signed dword) 37, (byte/signed byte/word/signed word/dword/signed dword) 33, (byte/signed byte/word/signed word/dword/signed dword) 29, (byte/signed byte/word/signed word/dword/signed dword) 25, (byte/signed byte/word/signed word/dword/signed dword) 21, (byte/signed byte/word/signed word/dword/signed dword) 17, (byte/signed byte/word/signed word/dword/signed dword) 12, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/word/signed word/dword/signed dword) 252, (byte/word/signed word/dword/signed dword) 248, (byte/word/signed word/dword/signed dword) 244, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 235, (byte/word/signed word/dword/signed dword) 231, (byte/word/signed word/dword/signed dword) 227, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 219, (byte/word/signed word/dword/signed dword) 215, (byte/word/signed word/dword/signed dword) 211, (byte/word/signed word/dword/signed dword) 207, (byte/word/signed word/dword/signed dword) 203, (byte/word/signed word/dword/signed dword) 200, (byte/word/signed word/dword/signed dword) 196, (byte/word/signed word/dword/signed dword) 192, (byte/word/signed word/dword/signed dword) 189, (byte/word/signed word/dword/signed dword) 185, (byte/word/signed word/dword/signed dword) 182, (byte/word/signed word/dword/signed dword) 178, (byte/word/signed word/dword/signed dword) 175, (byte/word/signed word/dword/signed dword) 172, (byte/word/signed word/dword/signed dword) 169, (byte/word/signed word/dword/signed dword) 166, (byte/word/signed word/dword/signed dword) 163, (byte/word/signed word/dword/signed dword) 160, (byte/word/signed word/dword/signed dword) 157, (byte/word/signed word/dword/signed dword) 155, (byte/word/signed word/dword/signed dword) 152, (byte/word/signed word/dword/signed dword) 150, (byte/word/signed word/dword/signed dword) 148, (byte/word/signed word/dword/signed dword) 146, (byte/word/signed word/dword/signed dword) 144, (byte/word/signed word/dword/signed dword) 142, (byte/word/signed word/dword/signed dword) 140, (byte/word/signed word/dword/signed dword) 138, (byte/word/signed word/dword/signed dword) 137, (byte/word/signed word/dword/signed dword) 135, (byte/word/signed word/dword/signed dword) 134, (byte/word/signed word/dword/signed dword) 133, (byte/word/signed word/dword/signed dword) 132, (byte/word/signed word/dword/signed dword) 131, (byte/word/signed word/dword/signed dword) 130, (byte/word/signed word/dword/signed dword) 130, (byte/word/signed word/dword/signed dword) 129, (byte/word/signed word/dword/signed dword) 129, (byte/word/signed word/dword/signed dword) 129, (byte/word/signed word/dword/signed dword) 129, (byte/word/signed word/dword/signed dword) 129, (byte/word/signed word/dword/signed dword) 129, (byte/word/signed word/dword/signed dword) 129, (byte/word/signed word/dword/signed dword) 130, (byte/word/signed word/dword/signed dword) 130, (byte/word/signed word/dword/signed dword) 131, (byte/word/signed word/dword/signed dword) 132, (byte/word/signed word/dword/signed dword) 133, (byte/word/signed word/dword/signed dword) 134, (byte/word/signed word/dword/signed dword) 135, (byte/word/signed word/dword/signed dword) 137, (byte/word/signed word/dword/signed dword) 138, (byte/word/signed word/dword/signed dword) 140, (byte/word/signed word/dword/signed dword) 142, (byte/word/signed word/dword/signed dword) 144, (byte/word/signed word/dword/signed dword) 146, (byte/word/signed word/dword/signed dword) 148, (byte/word/signed word/dword/signed dword) 150, (byte/word/signed word/dword/signed dword) 152, (byte/word/signed word/dword/signed dword) 155, (byte/word/signed word/dword/signed dword) 157, (byte/word/signed word/dword/signed dword) 160, (byte/word/signed word/dword/signed dword) 163, (byte/word/signed word/dword/signed dword) 166, (byte/word/signed word/dword/signed dword) 169, (byte/word/signed word/dword/signed dword) 172, (byte/word/signed word/dword/signed dword) 175, (byte/word/signed word/dword/signed dword) 178, (byte/word/signed word/dword/signed dword) 182, (byte/word/signed word/dword/signed dword) 185, (byte/word/signed word/dword/signed dword) 189, (byte/word/signed word/dword/signed dword) 192, (byte/word/signed word/dword/signed dword) 196, (byte/word/signed word/dword/signed dword) 200, (byte/word/signed word/dword/signed dword) 203, (byte/word/signed word/dword/signed dword) 207, (byte/word/signed word/dword/signed dword) 211, (byte/word/signed word/dword/signed dword) 215, (byte/word/signed word/dword/signed dword) 219, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 227, (byte/word/signed word/dword/signed dword) 231, (byte/word/signed word/dword/signed dword) 235, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 244, (byte/word/signed word/dword/signed dword) 248, (byte/word/signed word/dword/signed dword) 252 } @@ -559,27 +559,27 @@ main::@return: scope:[main] from main::@8 (byte*) print_char_cursor#17 ← (byte*) print_char_cursor#34 return to:@return -@35: scope:[] from @30 - (byte*) print_screen#6 ← phi( @30/(byte*) print_screen#7 ) - (byte*) print_char_cursor#43 ← phi( @30/(byte*) print_char_cursor#48 ) - (byte*) print_line_cursor#12 ← phi( @30/(byte*) print_line_cursor#15 ) +@38: scope:[] from @31 + (byte*) print_screen#6 ← phi( @31/(byte*) print_screen#7 ) + (byte*) print_char_cursor#43 ← phi( @31/(byte*) print_char_cursor#48 ) + (byte*) print_line_cursor#12 ← phi( @31/(byte*) print_line_cursor#15 ) call main - to:@36 -@36: scope:[] from @35 - (byte*) print_char_cursor#35 ← phi( @35/(byte*) print_char_cursor#17 ) - (byte*) print_line_cursor#9 ← phi( @35/(byte*) print_line_cursor#4 ) + to:@39 +@39: scope:[] from @38 + (byte*) print_char_cursor#35 ← phi( @38/(byte*) print_char_cursor#17 ) + (byte*) print_line_cursor#9 ← phi( @38/(byte*) print_line_cursor#4 ) (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#9 (byte*) print_char_cursor#18 ← (byte*) print_char_cursor#35 to:@end -@end: scope:[] from @36 +@end: scope:[] from @39 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" (label) @13 (label) @20 -(label) @30 -(label) @35 -(label) @36 +(label) @31 +(label) @38 +(label) @39 (label) @begin (label) @end (word) PI2_u4f12 @@ -1298,12 +1298,12 @@ Culled Empty Block (label) mul8u::@3 Culled Empty Block (label) @13 Culled Empty Block (label) @20 Culled Empty Block (label) print_sbyte::@3 -Culled Empty Block (label) @30 +Culled Empty Block (label) @31 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) main::@6 Culled Empty Block (label) main::@9 -Culled Empty Block (label) @36 +Culled Empty Block (label) @39 Successful SSA optimization Pass2CullEmptyBlocks Inlining constant with var siblings (const word) divr16u::quotient#0 Inlining constant with var siblings (const byte) divr16u::i#0 @@ -1369,7 +1369,7 @@ Added new block during phi lifting divr16u::@8(between divr16u::@3 and divr16u:: Added new block during phi lifting divr16u::@9(between divr16u::@1 and divr16u::@2) Added new block during phi lifting divr16u::@10(between divr16u::@2 and divr16u::@3) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @35 +Adding NOP phi() at start of @38 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@5 @@ -1458,7 +1458,7 @@ Culled Empty Block (label) divr16u::@8 Culled Empty Block (label) divr16u::@10 Culled Empty Block (label) divr16u::@9 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @35 +Adding NOP phi() at start of @38 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@5 @@ -1473,14 +1473,14 @@ Adding NOP phi() at start of divr16u FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@35 -@35: scope:[] from @begin + to:@38 +@38: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @35 +@end: scope:[] from @38 [3] phi() [ ] ( ) -main: scope:[main] from @35 +main: scope:[main] from @38 [4] phi() [ ] ( main:2 [ ] ) [5] call sin8s_gen [ ] ( main:2 [ ] ) to:main::@5 @@ -2125,17 +2125,17 @@ INITIAL ASM .label print_char_cursor = 7 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -b35_from_bbegin: - jmp b35 -//SEG4 @35 -b35: +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +b38_from_bbegin: + jmp b38 +//SEG4 @38 +b38: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @35 to main [phi:@35->main] -main_from_b35: +//SEG6 [4] phi from @38 to main [phi:@38->main] +main_from_b38: jsr main -//SEG7 [3] phi from @35 to @end [phi:@35->@end] -bend_from_b35: +//SEG7 [3] phi from @38 to @end [phi:@38->@end] +bend_from_b38: jmp bend //SEG8 @end bend: @@ -3340,17 +3340,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_char_cursor = 5 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -b35_from_bbegin: - jmp b35 -//SEG4 @35 -b35: +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +b38_from_bbegin: + jmp b38 +//SEG4 @38 +b38: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @35 to main [phi:@35->main] -main_from_b35: +//SEG6 [4] phi from @38 to main [phi:@38->main] +main_from_b38: jsr main -//SEG7 [3] phi from @35 to @end [phi:@35->@end] -bend_from_b35: +//SEG7 [3] phi from @38 to @end [phi:@38->@end] +bend_from_b38: jmp bend //SEG8 @end bend: @@ -4200,7 +4200,7 @@ divr16u: { print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b35 +Removing instruction jmp b38 Removing instruction jmp bend Removing instruction jmp b5 Removing instruction jmp b1 @@ -4284,9 +4284,9 @@ Replacing label b3_from_b2 with b3 Replacing label b3_from_b2 with b3 Replacing label b1_from_b3 with b1 Removing instruction bbegin: -Removing instruction b35_from_bbegin: -Removing instruction main_from_b35: -Removing instruction bend_from_b35: +Removing instruction b38_from_bbegin: +Removing instruction main_from_b38: +Removing instruction bend_from_b38: Removing instruction b5_from_main: Removing instruction print_cls_from_b5: Removing instruction b1_from_b8: @@ -4319,7 +4319,7 @@ Removing instruction b2_from_b4: Removing instruction b3_from_b2: Removing instruction b3_from_b5: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b35: +Removing instruction b38: Removing instruction bend: Removing instruction sin8s_gen_from_main: Removing instruction b5: @@ -4384,7 +4384,7 @@ Removing instruction lda #<0 Succesful ASM optimization Pass5UnnecesaryLoadElimination FINAL SYMBOL TABLE -(label) @35 +(label) @38 (label) @begin (label) @end (word) PI2_u4f12 @@ -4676,12 +4676,12 @@ Score: 14996 .label print_line_cursor = $400 .label print_char_cursor = 5 //SEG2 @begin -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -//SEG4 @35 +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +//SEG4 @38 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @35 to main [phi:@35->main] +//SEG6 [4] phi from @38 to main [phi:@38->main] jsr main -//SEG7 [3] phi from @35 to @end [phi:@35->@end] +//SEG7 [3] phi from @38 to @end [phi:@38->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/sinusgen8.sym b/src/test/ref/sinusgen8.sym index cc3a5bc47..b52f187b3 100644 --- a/src/test/ref/sinusgen8.sym +++ b/src/test/ref/sinusgen8.sym @@ -1,4 +1,4 @@ -(label) @35 +(label) @38 (label) @begin (label) @end (word) PI2_u4f12 diff --git a/src/test/ref/sinusgen8b.cfg b/src/test/ref/sinusgen8b.cfg index 1e8455428..1ec8e1592 100644 --- a/src/test/ref/sinusgen8b.cfg +++ b/src/test/ref/sinusgen8b.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@35 -@35: scope:[] from @begin + to:@38 +@38: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @35 +@end: scope:[] from @38 [3] phi() [ ] ( ) -main: scope:[main] from @35 +main: scope:[main] from @38 [4] phi() [ ] ( main:2 [ ] ) [5] call sin8s_gen [ ] ( main:2 [ ] ) to:main::@5 diff --git a/src/test/ref/sinusgen8b.log b/src/test/ref/sinusgen8b.log index d746154af..05cc2257e 100644 --- a/src/test/ref/sinusgen8b.log +++ b/src/test/ref/sinusgen8b.log @@ -664,7 +664,7 @@ mulu8_sel::@return: scope:[mulu8_sel] from mulu8_sel::@2 (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@30 + to:@31 print_str: scope:[print_str] from main::@3 main::@8 (byte*) print_char_cursor#44 ← phi( main::@3/(byte*) print_char_cursor#42 main::@8/(byte*) print_char_cursor#14 ) (byte*) print_str::str#5 ← phi( main::@3/(byte*) print_str::str#2 main::@8/(byte*) print_str::str#1 ) @@ -723,13 +723,13 @@ print_sbyte::@return: scope:[print_sbyte] from print_sbyte::@3 (byte*) print_char_cursor#5 ← (byte*) print_char_cursor#23 return to:@return -@30: scope:[] from @20 +@31: scope:[] from @20 (byte*) print_screen#8 ← phi( @20/(byte*) print_screen#0 ) (byte*) print_char_cursor#48 ← phi( @20/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#15 ← phi( @20/(byte*) print_line_cursor#0 ) (word) rem16u#42 ← phi( @20/(word) rem16u#43 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@35 + to:@38 print_byte: scope:[print_byte] from print_sbyte::@1 (byte*) print_char_cursor#39 ← phi( print_sbyte::@1/(byte*) print_char_cursor#37 ) (byte) print_byte::b#1 ← phi( print_sbyte::@1/(byte) print_byte::b#0 ) @@ -790,11 +790,11 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#12 ← (byte*) print_char_cursor#29 return to:@return -main: scope:[main] from @35 - (byte*) print_char_cursor#49 ← phi( @35/(byte*) print_char_cursor#43 ) - (byte*) print_line_cursor#16 ← phi( @35/(byte*) print_line_cursor#12 ) - (byte*) print_screen#6 ← phi( @35/(byte*) print_screen#7 ) - (word) rem16u#36 ← phi( @35/(word) rem16u#38 ) +main: scope:[main] from @38 + (byte*) print_char_cursor#49 ← phi( @38/(byte*) print_char_cursor#43 ) + (byte*) print_line_cursor#16 ← phi( @38/(byte*) print_line_cursor#12 ) + (byte*) print_screen#6 ← phi( @38/(byte*) print_screen#7 ) + (word) rem16u#36 ← phi( @38/(word) rem16u#38 ) (word) main::wavelength#0 ← (byte/word/signed word/dword/signed dword) 192 (signed byte[192]) main::sintabb#0 ← { fill( 192, 0) } (signed byte*) sin8s_gen::sintab#1 ← (signed byte[192]) main::sintabb#0 @@ -901,31 +901,31 @@ main::@return: scope:[main] from main::@9 (byte*) print_char_cursor#17 ← (byte*) print_char_cursor#34 return to:@return -@35: scope:[] from @30 - (byte*) print_screen#7 ← phi( @30/(byte*) print_screen#8 ) - (byte*) print_char_cursor#43 ← phi( @30/(byte*) print_char_cursor#48 ) - (byte*) print_line_cursor#12 ← phi( @30/(byte*) print_line_cursor#15 ) - (word) rem16u#38 ← phi( @30/(word) rem16u#42 ) +@38: scope:[] from @31 + (byte*) print_screen#7 ← phi( @31/(byte*) print_screen#8 ) + (byte*) print_char_cursor#43 ← phi( @31/(byte*) print_char_cursor#48 ) + (byte*) print_line_cursor#12 ← phi( @31/(byte*) print_line_cursor#15 ) + (word) rem16u#38 ← phi( @31/(word) rem16u#42 ) call main - to:@36 -@36: scope:[] from @35 - (byte*) print_char_cursor#35 ← phi( @35/(byte*) print_char_cursor#17 ) - (byte*) print_line_cursor#9 ← phi( @35/(byte*) print_line_cursor#4 ) - (word) rem16u#29 ← phi( @35/(word) rem16u#14 ) + to:@39 +@39: scope:[] from @38 + (byte*) print_char_cursor#35 ← phi( @38/(byte*) print_char_cursor#17 ) + (byte*) print_line_cursor#9 ← phi( @38/(byte*) print_line_cursor#4 ) + (word) rem16u#29 ← phi( @38/(word) rem16u#14 ) (word) rem16u#15 ← (word) rem16u#29 (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#9 (byte*) print_char_cursor#18 ← (byte*) print_char_cursor#35 to:@end -@end: scope:[] from @36 +@end: scope:[] from @39 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" (label) @13 (label) @2 (label) @20 -(label) @30 -(label) @35 -(label) @36 +(label) @31 +(label) @38 +(label) @39 (label) @begin (label) @end (word) PI2_u4f12 @@ -2111,12 +2111,12 @@ Culled Empty Block (label) mul16u::@3 Culled Empty Block (label) @13 Culled Empty Block (label) @20 Culled Empty Block (label) print_sbyte::@3 -Culled Empty Block (label) @30 +Culled Empty Block (label) @31 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) main::@7 Culled Empty Block (label) main::@10 -Culled Empty Block (label) @36 +Culled Empty Block (label) @39 Successful SSA optimization Pass2CullEmptyBlocks Alias (dword) div32u16u::return#0 = (dword~) div32u16u::$4 Successful SSA optimization Pass2AliasElimination @@ -2230,7 +2230,7 @@ Added new block during phi lifting sin8s::@17(between sin8s::@14 and sin8s::@3) Added new block during phi lifting sin8s::@18(between sin8s::@3 and sin8s::@4) Added new block during phi lifting mul8u::@10(between mul8u::@2 and mul8u::@4) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @35 +Adding NOP phi() at start of @38 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@5 @@ -2356,7 +2356,7 @@ Culled Empty Block (label) sin8s::@16 Culled Empty Block (label) sin8s::@15 Culled Empty Block (label) mul8u::@10 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @35 +Adding NOP phi() at start of @38 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@5 @@ -2373,14 +2373,14 @@ Adding NOP phi() at start of div16u FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@35 -@35: scope:[] from @begin + to:@38 +@38: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @35 +@end: scope:[] from @38 [3] phi() [ ] ( ) -main: scope:[main] from @35 +main: scope:[main] from @38 [4] phi() [ ] ( main:2 [ ] ) [5] call sin8s_gen [ ] ( main:2 [ ] ) to:main::@5 @@ -3464,17 +3464,17 @@ INITIAL ASM .label print_char_cursor = 7 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -b35_from_bbegin: - jmp b35 -//SEG4 @35 -b35: +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +b38_from_bbegin: + jmp b38 +//SEG4 @38 +b38: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @35 to main [phi:@35->main] -main_from_b35: +//SEG6 [4] phi from @38 to main [phi:@38->main] +main_from_b38: jsr main -//SEG7 [3] phi from @35 to @end [phi:@35->@end] -bend_from_b35: +//SEG7 [3] phi from @38 to @end [phi:@38->@end] +bend_from_b38: jmp bend //SEG8 @end bend: @@ -5708,17 +5708,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_char_cursor = 5 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -b35_from_bbegin: - jmp b35 -//SEG4 @35 -b35: +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +b38_from_bbegin: + jmp b38 +//SEG4 @38 +b38: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @35 to main [phi:@35->main] -main_from_b35: +//SEG6 [4] phi from @38 to main [phi:@38->main] +main_from_b38: jsr main -//SEG7 [3] phi from @35 to @end [phi:@35->@end] -bend_from_b35: +//SEG7 [3] phi from @38 to @end [phi:@38->@end] +bend_from_b38: jmp bend //SEG8 @end bend: @@ -7225,7 +7225,7 @@ div16u: { print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b35 +Removing instruction jmp b38 Removing instruction jmp bend Removing instruction jmp b5 Removing instruction jmp b6 @@ -7348,9 +7348,9 @@ Replacing label b3_from_b14 with b3 Replacing label b4_from_b18 with b4 Replacing label b4_from_b2 with b4 Removing instruction bbegin: -Removing instruction b35_from_bbegin: -Removing instruction main_from_b35: -Removing instruction bend_from_b35: +Removing instruction b38_from_bbegin: +Removing instruction main_from_b38: +Removing instruction bend_from_b38: Removing instruction b5_from_main: Removing instruction sin16s_gen_from_b5: Removing instruction b6_from_b5: @@ -7393,7 +7393,7 @@ Removing instruction breturn: Removing instruction b4_from_b2: Removing instruction b4_from_b7: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b35: +Removing instruction b38: Removing instruction bend: Removing instruction sin8s_gen_from_main: Removing instruction b5: @@ -7499,7 +7499,7 @@ Removing unreachable instruction jmp b3 Succesful ASM optimization Pass5UnreachableCodeElimination FINAL SYMBOL TABLE -(label) @35 +(label) @38 (label) @begin (label) @end (word) PI2_u4f12 @@ -7954,12 +7954,12 @@ Score: 28323 .label rem16u = 2 .label print_char_cursor = 5 //SEG2 @begin -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -//SEG4 @35 +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +//SEG4 @38 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @35 to main [phi:@35->main] +//SEG6 [4] phi from @38 to main [phi:@38->main] jsr main -//SEG7 [3] phi from @35 to @end [phi:@35->@end] +//SEG7 [3] phi from @38 to @end [phi:@38->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/sinusgen8b.sym b/src/test/ref/sinusgen8b.sym index c5b589ea4..634f72ac0 100644 --- a/src/test/ref/sinusgen8b.sym +++ b/src/test/ref/sinusgen8b.sym @@ -1,4 +1,4 @@ -(label) @35 +(label) @38 (label) @begin (label) @end (word) PI2_u4f12 diff --git a/src/test/ref/sinusgenscale8.cfg b/src/test/ref/sinusgenscale8.cfg index ef856372e..35331f32b 100644 --- a/src/test/ref/sinusgenscale8.cfg +++ b/src/test/ref/sinusgenscale8.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@36 -@36: scope:[] from @begin + to:@39 +@39: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @36 +@end: scope:[] from @39 [3] phi() [ ] ( ) -main: scope:[main] from @36 +main: scope:[main] from @39 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 diff --git a/src/test/ref/sinusgenscale8.log b/src/test/ref/sinusgenscale8.log index cdd64c638..f21357daa 100644 --- a/src/test/ref/sinusgenscale8.log +++ b/src/test/ref/sinusgenscale8.log @@ -345,7 +345,7 @@ mulu8_sel::@return: scope:[mulu8_sel] from mulu8_sel::@2 (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@30 + to:@31 print_str: scope:[print_str] from sin8u_table::@11 sin8u_table::@16 sin8u_table::@18 sin8u_table::@20 sin8u_table::@22 sin8u_table::@3 sin8u_table::@5 sin8u_table::@7 sin8u_table::@9 (byte*) print_char_cursor#102 ← phi( sin8u_table::@11/(byte*) print_char_cursor#31 sin8u_table::@16/(byte*) print_char_cursor#100 sin8u_table::@18/(byte*) print_char_cursor#36 sin8u_table::@20/(byte*) print_char_cursor#38 sin8u_table::@22/(byte*) print_char_cursor#40 sin8u_table::@3/(byte*) print_char_cursor#99 sin8u_table::@5/(byte*) print_char_cursor#25 sin8u_table::@7/(byte*) print_char_cursor#27 sin8u_table::@9/(byte*) print_char_cursor#29 ) (byte*) print_str::str#12 ← phi( sin8u_table::@11/(byte*) print_str::str#5 sin8u_table::@16/(byte*) print_str::str#6 sin8u_table::@18/(byte*) print_str::str#7 sin8u_table::@20/(byte*) print_str::str#8 sin8u_table::@22/(byte*) print_str::str#9 sin8u_table::@3/(byte*) print_str::str#1 sin8u_table::@5/(byte*) print_str::str#2 sin8u_table::@7/(byte*) print_str::str#3 sin8u_table::@9/(byte*) print_str::str#4 ) @@ -487,12 +487,12 @@ print_word::@return: scope:[print_word] from print_word::@2 (byte*) print_char_cursor#13 ← (byte*) print_char_cursor#58 return to:@return -@30: scope:[] from @20 +@31: scope:[] from @20 (byte*) print_screen#6 ← phi( @20/(byte*) print_screen#0 ) (byte*) print_char_cursor#107 ← phi( @20/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#30 ← phi( @20/(byte*) print_line_cursor#0 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@36 + to:@39 print_byte: scope:[print_byte] from print_sbyte::@1 print_word print_word::@1 sin8u_table::@10 sin8u_table::@12 sin8u_table::@23 sin8u_table::@6 sin8u_table::@8 (byte*) print_char_cursor#97 ← phi( print_sbyte::@1/(byte*) print_char_cursor#94 print_word/(byte*) print_char_cursor#96 print_word::@1/(byte*) print_char_cursor#11 sin8u_table::@10/(byte*) print_char_cursor#30 sin8u_table::@12/(byte*) print_char_cursor#32 sin8u_table::@23/(byte*) print_char_cursor#41 sin8u_table::@6/(byte*) print_char_cursor#26 sin8u_table::@8/(byte*) print_char_cursor#28 ) (byte) print_byte::b#8 ← phi( print_sbyte::@1/(byte) print_byte::b#0 print_word/(byte) print_byte::b#1 print_word::@1/(byte) print_byte::b#2 sin8u_table::@10/(byte) print_byte::b#5 sin8u_table::@12/(byte) print_byte::b#6 sin8u_table::@23/(byte) print_byte::b#7 sin8u_table::@6/(byte) print_byte::b#3 sin8u_table::@8/(byte) print_byte::b#4 ) @@ -553,10 +553,10 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#20 ← (byte*) print_char_cursor#64 return to:@return -main: scope:[main] from @36 - (byte*) print_char_cursor#98 ← phi( @36/(byte*) print_char_cursor#101 ) - (byte*) print_line_cursor#24 ← phi( @36/(byte*) print_line_cursor#27 ) - (byte*) print_screen#4 ← phi( @36/(byte*) print_screen#5 ) +main: scope:[main] from @39 + (byte*) print_char_cursor#98 ← phi( @39/(byte*) print_char_cursor#101 ) + (byte*) print_line_cursor#24 ← phi( @39/(byte*) print_line_cursor#27 ) + (byte*) print_screen#4 ← phi( @39/(byte*) print_screen#5 ) (word) main::tabsize#0 ← (byte/signed byte/word/signed word/dword/signed dword) 20 (byte[20]) main::sintab#0 ← { fill( 20, 0) } call print_cls @@ -968,27 +968,27 @@ sin8u_table::@return: scope:[sin8u_table] from sin8u_table::@25 (byte*) print_line_cursor#10 ← (byte*) print_line_cursor#21 return to:@return -@36: scope:[] from @30 - (byte*) print_screen#5 ← phi( @30/(byte*) print_screen#6 ) - (byte*) print_char_cursor#101 ← phi( @30/(byte*) print_char_cursor#107 ) - (byte*) print_line_cursor#27 ← phi( @30/(byte*) print_line_cursor#30 ) +@39: scope:[] from @31 + (byte*) print_screen#5 ← phi( @31/(byte*) print_screen#6 ) + (byte*) print_char_cursor#101 ← phi( @31/(byte*) print_char_cursor#107 ) + (byte*) print_line_cursor#27 ← phi( @31/(byte*) print_line_cursor#30 ) call main - to:@37 -@37: scope:[] from @36 - (byte*) print_char_cursor#89 ← phi( @36/(byte*) print_char_cursor#23 ) - (byte*) print_line_cursor#22 ← phi( @36/(byte*) print_line_cursor#7 ) + to:@40 +@40: scope:[] from @39 + (byte*) print_char_cursor#89 ← phi( @39/(byte*) print_char_cursor#23 ) + (byte*) print_line_cursor#22 ← phi( @39/(byte*) print_line_cursor#7 ) (byte*) print_line_cursor#11 ← (byte*) print_line_cursor#22 (byte*) print_char_cursor#45 ← (byte*) print_char_cursor#89 to:@end -@end: scope:[] from @37 +@end: scope:[] from @40 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" (label) @13 (label) @20 -(label) @30 -(label) @36 -(label) @37 +(label) @31 +(label) @39 +(label) @40 (label) @begin (label) @end (word) PI2_u4f12 @@ -2185,12 +2185,12 @@ Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) print_sword::@3 Culled Empty Block (label) print_sbyte::@3 Culled Empty Block (label) print_word::@2 -Culled Empty Block (label) @30 +Culled Empty Block (label) @31 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) main::@2 Culled Empty Block (label) sin8u_table::@14 -Culled Empty Block (label) @37 +Culled Empty Block (label) @40 Successful SSA optimization Pass2CullEmptyBlocks Inlining constant with var siblings (const word) divr16u::quotient#0 Inlining constant with var siblings (const byte) divr16u::i#0 @@ -2287,7 +2287,7 @@ Added new block during phi lifting divr16u::@9(between divr16u::@1 and divr16u:: Added new block during phi lifting divr16u::@10(between divr16u::@2 and divr16u::@3) Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @36 +Adding NOP phi() at start of @39 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@1 @@ -2411,7 +2411,7 @@ Culled Empty Block (label) divr16u::@10 Culled Empty Block (label) divr16u::@9 Culled Empty Block (label) print_cls::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @36 +Adding NOP phi() at start of @39 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@1 @@ -2438,14 +2438,14 @@ Adding NOP phi() at start of print_cls FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@36 -@36: scope:[] from @begin + to:@39 +@39: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @36 +@end: scope:[] from @39 [3] phi() [ ] ( ) -main: scope:[main] from @36 +main: scope:[main] from @39 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 @@ -3296,17 +3296,17 @@ INITIAL ASM .label print_line_cursor = 8 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @36 [phi:@begin->@36] -b36_from_bbegin: - jmp b36 -//SEG4 @36 -b36: +//SEG3 [1] phi from @begin to @39 [phi:@begin->@39] +b39_from_bbegin: + jmp b39 +//SEG4 @39 +b39: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @36 to main [phi:@36->main] -main_from_b36: +//SEG6 [4] phi from @39 to main [phi:@39->main] +main_from_b39: jsr main -//SEG7 [3] phi from @36 to @end [phi:@36->@end] -bend_from_b36: +//SEG7 [3] phi from @39 to @end [phi:@39->@end] +bend_from_b39: jmp bend //SEG8 @end bend: @@ -4997,17 +4997,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = 8 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @36 [phi:@begin->@36] -b36_from_bbegin: - jmp b36 -//SEG4 @36 -b36: +//SEG3 [1] phi from @begin to @39 [phi:@begin->@39] +b39_from_bbegin: + jmp b39 +//SEG4 @39 +b39: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @36 to main [phi:@36->main] -main_from_b36: +//SEG6 [4] phi from @39 to main [phi:@39->main] +main_from_b39: jsr main -//SEG7 [3] phi from @36 to @end [phi:@36->@end] -bend_from_b36: +//SEG7 [3] phi from @39 to @end [phi:@39->@end] +bend_from_b39: jmp bend //SEG8 @end bend: @@ -6257,7 +6257,7 @@ print_cls: { print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b36 +Removing instruction jmp b39 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp breturn @@ -6370,9 +6370,9 @@ Replacing label b1_from_b3 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b36_from_bbegin: -Removing instruction main_from_b36: -Removing instruction bend_from_b36: +Removing instruction b39_from_bbegin: +Removing instruction main_from_b39: +Removing instruction bend_from_b39: Removing instruction b1_from_main: Removing instruction sin8u_table_from_b1: Removing instruction b5_from_b4: @@ -6433,7 +6433,7 @@ Removing instruction b3_from_b2: Removing instruction b3_from_b5: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b36: +Removing instruction b39: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -6534,7 +6534,7 @@ Fixing long branch [163] bcc b1 to bcs Fixing long branch [169] bcc b1 to bcs FINAL SYMBOL TABLE -(label) @36 +(label) @39 (label) @begin (label) @end (word) PI2_u4f12 @@ -6912,12 +6912,12 @@ Score: 19469 .label print_char_cursor = $d .label print_line_cursor = 8 //SEG2 @begin -//SEG3 [1] phi from @begin to @36 [phi:@begin->@36] -//SEG4 @36 +//SEG3 [1] phi from @begin to @39 [phi:@begin->@39] +//SEG4 @39 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @36 to main [phi:@36->main] +//SEG6 [4] phi from @39 to main [phi:@39->main] jsr main -//SEG7 [3] phi from @36 to @end [phi:@36->@end] +//SEG7 [3] phi from @39 to @end [phi:@39->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/sinusgenscale8.sym b/src/test/ref/sinusgenscale8.sym index 9faa61edd..9ef91d83a 100644 --- a/src/test/ref/sinusgenscale8.sym +++ b/src/test/ref/sinusgenscale8.sym @@ -1,4 +1,4 @@ -(label) @36 +(label) @39 (label) @begin (label) @end (word) PI2_u4f12 diff --git a/src/test/ref/test-comparisons.cfg b/src/test/ref/test-comparisons.cfg index b7911934d..d19749e55 100644 --- a/src/test/ref/test-comparisons.cfg +++ b/src/test/ref/test-comparisons.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@16 -@16: scope:[] from @begin + to:@19 +@19: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @16 +@end: scope:[] from @19 [3] phi() [ ] ( ) -main: scope:[main] from @16 +main: scope:[main] from @19 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 diff --git a/src/test/ref/test-comparisons.log b/src/test/ref/test-comparisons.log index 8b02e861a..8603e7c5f 100644 --- a/src/test/ref/test-comparisons.log +++ b/src/test/ref/test-comparisons.log @@ -4,7 +4,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@10 + to:@11 print_str: scope:[print_str] from printu::@2 (byte*) print_char_cursor#119 ← phi( printu::@2/(byte*) print_char_cursor#40 ) (byte*) print_str::str#4 ← phi( printu::@2/(byte*) print_str::str#1 ) @@ -50,12 +50,12 @@ print_ln::@return: scope:[print_ln] from print_ln::@2 (byte*) print_char_cursor#4 ← (byte*) print_char_cursor#50 return to:@return -@10: scope:[] from @begin +@11: scope:[] from @begin (byte*) print_screen#6 ← phi( @begin/(byte*) print_screen#0 ) (byte*) print_char_cursor#141 ← phi( @begin/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#39 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@16 + to:@19 print_byte: scope:[print_byte] from printu::@1 printu::@3 (byte*) print_char_cursor#94 ← phi( printu::@1/(byte*) print_char_cursor#39 printu::@3/(byte*) print_char_cursor#41 ) (byte) print_byte::b#2 ← phi( printu::@1/(byte) print_byte::b#0 printu::@3/(byte) print_byte::b#1 ) @@ -116,10 +116,10 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#11 ← (byte*) print_char_cursor#56 return to:@return -main: scope:[main] from @16 - (byte*) print_char_cursor#96 ← phi( @16/(byte*) print_char_cursor#118 ) - (byte*) print_line_cursor#26 ← phi( @16/(byte*) print_line_cursor#33 ) - (byte*) print_screen#4 ← phi( @16/(byte*) print_screen#5 ) +main: scope:[main] from @19 + (byte*) print_char_cursor#96 ← phi( @19/(byte*) print_char_cursor#118 ) + (byte*) print_line_cursor#26 ← phi( @19/(byte*) print_line_cursor#33 ) + (byte*) print_screen#4 ← phi( @19/(byte*) print_screen#5 ) call print_cls to:main::@45 main::@45: scope:[main] from main @@ -914,25 +914,25 @@ printu::@return: scope:[printu] from printu::@6 (byte*) print_char_cursor#45 ← (byte*) print_char_cursor#90 return to:@return -@16: scope:[] from @10 - (byte*) print_screen#5 ← phi( @10/(byte*) print_screen#6 ) - (byte*) print_char_cursor#118 ← phi( @10/(byte*) print_char_cursor#141 ) - (byte*) print_line_cursor#33 ← phi( @10/(byte*) print_line_cursor#39 ) +@19: scope:[] from @11 + (byte*) print_screen#5 ← phi( @11/(byte*) print_screen#6 ) + (byte*) print_char_cursor#118 ← phi( @11/(byte*) print_char_cursor#141 ) + (byte*) print_line_cursor#33 ← phi( @11/(byte*) print_line_cursor#39 ) call main - to:@17 -@17: scope:[] from @16 - (byte*) print_char_cursor#91 ← phi( @16/(byte*) print_char_cursor#38 ) - (byte*) print_line_cursor#24 ← phi( @16/(byte*) print_line_cursor#11 ) + to:@20 +@20: scope:[] from @19 + (byte*) print_char_cursor#91 ← phi( @19/(byte*) print_char_cursor#38 ) + (byte*) print_line_cursor#24 ← phi( @19/(byte*) print_line_cursor#11 ) (byte*) print_line_cursor#12 ← (byte*) print_line_cursor#24 (byte*) print_char_cursor#46 ← (byte*) print_char_cursor#91 to:@end -@end: scope:[] from @17 +@end: scope:[] from @20 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" -(label) @10 -(label) @16 -(label) @17 +(label) @11 +(label) @19 +(label) @20 (label) @begin (label) @end (void()) main() @@ -2081,12 +2081,12 @@ Successful SSA optimization Pass2EliminateUnusedBlocks Resolved ranged next value main::i#1 ← ++ main::i#10 to ++ Resolved ranged comparison value if(main::i#1!=rangelast(0,4)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 5 Culled Empty Block (label) print_ln::@2 -Culled Empty Block (label) @10 +Culled Empty Block (label) @11 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) main::@45 Culled Empty Block (label) printu::@6 -Culled Empty Block (label) @17 +Culled Empty Block (label) @20 Successful SSA optimization Pass2CullEmptyBlocks Inlining constant with var siblings (const byte) print_char::ch#2 Inlining constant with var siblings (const byte) print_char::ch#3 @@ -2237,7 +2237,7 @@ Added new block during phi lifting main::@71(between main::@70 and main::@1) Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @16 +Adding NOP phi() at start of @19 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@23 @@ -2376,7 +2376,7 @@ Coalesced down to 32 phi equivalence classes Culled Empty Block (label) print_ln::@3 Culled Empty Block (label) print_cls::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @16 +Adding NOP phi() at start of @19 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@23 @@ -2412,14 +2412,14 @@ Adding NOP phi() at start of print_cls FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@16 -@16: scope:[] from @begin + to:@19 +@19: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @16 +@end: scope:[] from @19 [3] phi() [ ] ( ) -main: scope:[main] from @16 +main: scope:[main] from @19 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 @@ -3072,17 +3072,17 @@ INITIAL ASM .label print_line_cursor = $18 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @16 [phi:@begin->@16] -b16_from_bbegin: - jmp b16 -//SEG4 @16 -b16: +//SEG3 [1] phi from @begin to @19 [phi:@begin->@19] +b19_from_bbegin: + jmp b19 +//SEG4 @19 +b19: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @16 to main [phi:@16->main] -main_from_b16: +//SEG6 [4] phi from @19 to main [phi:@19->main] +main_from_b19: jsr main -//SEG7 [3] phi from @16 to @end [phi:@16->@end] -bend_from_b16: +//SEG7 [3] phi from @19 to @end [phi:@19->@end] +bend_from_b19: jmp bend //SEG8 @end bend: @@ -4731,17 +4731,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = 4 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @16 [phi:@begin->@16] -b16_from_bbegin: - jmp b16 -//SEG4 @16 -b16: +//SEG3 [1] phi from @begin to @19 [phi:@begin->@19] +b19_from_bbegin: + jmp b19 +//SEG4 @19 +b19: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @16 to main [phi:@16->main] -main_from_b16: +//SEG6 [4] phi from @19 to main [phi:@19->main] +main_from_b19: jsr main -//SEG7 [3] phi from @16 to @end [phi:@16->@end] -bend_from_b16: +//SEG7 [3] phi from @19 to @end [phi:@19->@end] +bend_from_b19: jmp bend //SEG8 @end bend: @@ -6034,7 +6034,7 @@ print_cls: { print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b16 +Removing instruction jmp b19 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b23 @@ -6128,9 +6128,9 @@ Replacing label b1_from_b2 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b16_from_bbegin: -Removing instruction main_from_b16: -Removing instruction bend_from_b16: +Removing instruction b19_from_bbegin: +Removing instruction main_from_b19: +Removing instruction bend_from_b19: Removing instruction b23_from_b1: Removing instruction b2_from_b23: Removing instruction b24_from_b46: @@ -6191,7 +6191,7 @@ Removing instruction b1_from_print_str: Removing instruction b1_from_b2: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b16: +Removing instruction b19: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1_from_main: @@ -6307,7 +6307,7 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination FINAL SYMBOL TABLE -(label) @16 +(label) @19 (label) @begin (label) @end (void()) main() @@ -6600,12 +6600,12 @@ Score: 15772 .label print_char_cursor = 9 .label print_line_cursor = 4 //SEG2 @begin -//SEG3 [1] phi from @begin to @16 [phi:@begin->@16] -//SEG4 @16 +//SEG3 [1] phi from @begin to @19 [phi:@begin->@19] +//SEG4 @19 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @16 to main [phi:@16->main] +//SEG6 [4] phi from @19 to main [phi:@19->main] jsr main -//SEG7 [3] phi from @16 to @end [phi:@16->@end] +//SEG7 [3] phi from @19 to @end [phi:@19->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/test-comparisons.sym b/src/test/ref/test-comparisons.sym index 867d93eb0..421b0f7e7 100644 --- a/src/test/ref/test-comparisons.sym +++ b/src/test/ref/test-comparisons.sym @@ -1,4 +1,4 @@ -(label) @16 +(label) @19 (label) @begin (label) @end (void()) main() diff --git a/src/test/ref/test-division.cfg b/src/test/ref/test-division.cfg index 787c36cea..7b6b11562 100644 --- a/src/test/ref/test-division.cfg +++ b/src/test/ref/test-division.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@27 -@27: scope:[] from @begin + to:@30 +@30: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @27 +@end: scope:[] from @30 [3] phi() [ ] ( ) -main: scope:[main] from @27 +main: scope:[main] from @30 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 diff --git a/src/test/ref/test-division.log b/src/test/ref/test-division.log index eda2d4048..5fc352269 100644 --- a/src/test/ref/test-division.log +++ b/src/test/ref/test-division.log @@ -4,7 +4,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@10 + to:@11 print_str: scope:[print_str] from test_16s::@4 test_16s::@6 test_16s::@8 test_16u::@4 test_16u::@6 test_16u::@8 test_8s::@4 test_8s::@6 test_8s::@8 test_8u::@4 test_8u::@6 test_8u::@8 (byte*) print_char_cursor#140 ← phi( test_16s::@4/(byte*) print_char_cursor#54 test_16s::@6/(byte*) print_char_cursor#56 test_16s::@8/(byte*) print_char_cursor#58 test_16u::@4/(byte*) print_char_cursor#36 test_16u::@6/(byte*) print_char_cursor#38 test_16u::@8/(byte*) print_char_cursor#40 test_8s::@4/(byte*) print_char_cursor#45 test_8s::@6/(byte*) print_char_cursor#47 test_8s::@8/(byte*) print_char_cursor#49 test_8u::@4/(byte*) print_char_cursor#27 test_8u::@6/(byte*) print_char_cursor#29 test_8u::@8/(byte*) print_char_cursor#31 ) (byte*) print_str::str#15 ← phi( test_16s::@4/(byte*) print_str::str#10 test_16s::@6/(byte*) print_str::str#11 test_16s::@8/(byte*) print_str::str#12 test_16u::@4/(byte*) print_str::str#4 test_16u::@6/(byte*) print_str::str#5 test_16u::@8/(byte*) print_str::str#6 test_8s::@4/(byte*) print_str::str#7 test_8s::@6/(byte*) print_str::str#8 test_8s::@8/(byte*) print_str::str#9 test_8u::@4/(byte*) print_str::str#1 test_8u::@6/(byte*) print_str::str#2 test_8u::@8/(byte*) print_str::str#3 ) @@ -146,12 +146,12 @@ print_word::@return: scope:[print_word] from print_word::@2 (byte*) print_char_cursor#13 ← (byte*) print_char_cursor#76 return to:@return -@10: scope:[] from @begin +@11: scope:[] from @begin (byte*) print_screen#10 ← phi( @begin/(byte*) print_screen#0 ) (byte*) print_char_cursor#155 ← phi( @begin/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#66 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@14 + to:@17 print_byte: scope:[print_byte] from print_sbyte::@1 print_word print_word::@1 test_8u::@3 test_8u::@5 test_8u::@7 test_8u::@9 (byte*) print_char_cursor#133 ← phi( print_sbyte::@1/(byte*) print_char_cursor#130 print_word/(byte*) print_char_cursor#132 print_word::@1/(byte*) print_char_cursor#11 test_8u::@3/(byte*) print_char_cursor#135 test_8u::@5/(byte*) print_char_cursor#28 test_8u::@7/(byte*) print_char_cursor#30 test_8u::@9/(byte*) print_char_cursor#32 ) (byte) print_byte::b#7 ← phi( print_sbyte::@1/(byte) print_byte::b#0 print_word/(byte) print_byte::b#1 print_word::@1/(byte) print_byte::b#2 test_8u::@3/(byte) print_byte::b#3 test_8u::@5/(byte) print_byte::b#4 test_8u::@7/(byte) print_byte::b#5 test_8u::@9/(byte) print_byte::b#6 ) @@ -212,12 +212,12 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#20 ← (byte*) print_char_cursor#82 return to:@return -@14: scope:[] from @10 - (byte*) print_screen#9 ← phi( @10/(byte*) print_screen#10 ) - (byte*) print_char_cursor#154 ← phi( @10/(byte*) print_char_cursor#155 ) - (byte*) print_line_cursor#61 ← phi( @10/(byte*) print_line_cursor#66 ) +@17: scope:[] from @11 + (byte*) print_screen#9 ← phi( @11/(byte*) print_screen#10 ) + (byte*) print_char_cursor#154 ← phi( @11/(byte*) print_char_cursor#155 ) + (byte*) print_line_cursor#61 ← phi( @11/(byte*) print_line_cursor#66 ) (byte) rem8u#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:@16 + to:@19 div8u: scope:[div8u] from div8s::@4 test_8u::@1 (byte) rem8u#31 ← phi( div8s::@4/(byte) rem8u#32 test_8u::@1/(byte) rem8u#36 ) (byte) div8u::divisor#2 ← phi( div8s::@4/(byte) div8u::divisor#0 test_8u::@1/(byte) div8u::divisor#1 ) @@ -318,13 +318,13 @@ divr8u::@return: scope:[divr8u] from divr8u::@6 (byte) rem8u#4 ← (byte) rem8u#17 return to:@return -@16: scope:[] from @14 - (byte*) print_screen#8 ← phi( @14/(byte*) print_screen#9 ) - (byte) rem8u#55 ← phi( @14/(byte) rem8u#0 ) - (byte*) print_char_cursor#153 ← phi( @14/(byte*) print_char_cursor#154 ) - (byte*) print_line_cursor#56 ← phi( @14/(byte*) print_line_cursor#61 ) +@19: scope:[] from @17 + (byte*) print_screen#8 ← phi( @17/(byte*) print_screen#9 ) + (byte) rem8u#55 ← phi( @17/(byte) rem8u#0 ) + (byte*) print_char_cursor#153 ← phi( @17/(byte*) print_char_cursor#154 ) + (byte*) print_line_cursor#56 ← phi( @17/(byte*) print_line_cursor#61 ) (word) rem16u#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:@19 + to:@22 divr16u: scope:[divr16u] from div16u divr16s::@4 (word) divr16u::divisor#6 ← phi( div16u/(word) divr16u::divisor#0 divr16s::@4/(word) divr16u::divisor#1 ) (word) divr16u::dividend#5 ← phi( div16u/(word) divr16u::dividend#1 divr16s::@4/(word) divr16u::dividend#2 ) @@ -426,14 +426,14 @@ div16u::@return: scope:[div16u] from div16u::@2 (word) rem16u#4 ← (word) rem16u#19 return to:@return -@19: scope:[] from @16 - (byte*) print_screen#7 ← phi( @16/(byte*) print_screen#8 ) - (word) rem16u#55 ← phi( @16/(word) rem16u#0 ) - (byte) rem8u#52 ← phi( @16/(byte) rem8u#55 ) - (byte*) print_char_cursor#148 ← phi( @16/(byte*) print_char_cursor#153 ) - (byte*) print_line_cursor#51 ← phi( @16/(byte*) print_line_cursor#56 ) +@22: scope:[] from @19 + (byte*) print_screen#7 ← phi( @19/(byte*) print_screen#8 ) + (word) rem16u#55 ← phi( @19/(word) rem16u#0 ) + (byte) rem8u#52 ← phi( @19/(byte) rem8u#55 ) + (byte*) print_char_cursor#148 ← phi( @19/(byte*) print_char_cursor#153 ) + (byte*) print_line_cursor#51 ← phi( @19/(byte*) print_line_cursor#56 ) (signed byte) rem8s#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:@20 + to:@23 div8s: scope:[div8s] from test_8s::@1 (byte) rem8u#60 ← phi( test_8s::@1/(byte) rem8u#39 ) (signed byte) div8s::divisor#6 ← phi( test_8s::@1/(signed byte) div8s::divisor#0 ) @@ -535,15 +535,15 @@ div8s::@return: scope:[div8s] from div8s::@11 div8s::@5 (signed byte) rem8s#3 ← (signed byte) rem8s#9 return to:@return -@20: scope:[] from @19 - (byte*) print_screen#6 ← phi( @19/(byte*) print_screen#7 ) - (signed byte) rem8s#26 ← phi( @19/(signed byte) rem8s#0 ) - (word) rem16u#54 ← phi( @19/(word) rem16u#55 ) - (byte) rem8u#50 ← phi( @19/(byte) rem8u#52 ) - (byte*) print_char_cursor#147 ← phi( @19/(byte*) print_char_cursor#148 ) - (byte*) print_line_cursor#50 ← phi( @19/(byte*) print_line_cursor#51 ) +@23: scope:[] from @22 + (byte*) print_screen#6 ← phi( @22/(byte*) print_screen#7 ) + (signed byte) rem8s#26 ← phi( @22/(signed byte) rem8s#0 ) + (word) rem16u#54 ← phi( @22/(word) rem16u#55 ) + (byte) rem8u#50 ← phi( @22/(byte) rem8u#52 ) + (byte*) print_char_cursor#147 ← phi( @22/(byte*) print_char_cursor#148 ) + (byte*) print_line_cursor#50 ← phi( @22/(byte*) print_line_cursor#51 ) (signed word) rem16s#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - to:@27 + to:@30 divr16s: scope:[divr16s] from div16s (word) rem16u#64 ← phi( div16s/(word) rem16u#37 ) (signed word) divr16s::divisor#6 ← phi( div16s/(signed word) divr16s::divisor#0 ) @@ -690,14 +690,14 @@ div16s::@return: scope:[div16s] from div16s::@2 (signed word) rem16s#5 ← (signed word) rem16s#13 return to:@return -main: scope:[main] from @27 - (signed word) rem16s#34 ← phi( @27/(signed word) rem16s#25 ) - (signed byte) rem8s#29 ← phi( @27/(signed byte) rem8s#21 ) - (word) rem16u#57 ← phi( @27/(word) rem16u#45 ) - (byte) rem8u#44 ← phi( @27/(byte) rem8u#41 ) - (byte*) print_char_cursor#134 ← phi( @27/(byte*) print_char_cursor#139 ) - (byte*) print_line_cursor#40 ← phi( @27/(byte*) print_line_cursor#45 ) - (byte*) print_screen#4 ← phi( @27/(byte*) print_screen#5 ) +main: scope:[main] from @30 + (signed word) rem16s#34 ← phi( @30/(signed word) rem16s#25 ) + (signed byte) rem8s#29 ← phi( @30/(signed byte) rem8s#21 ) + (word) rem16u#57 ← phi( @30/(word) rem16u#45 ) + (byte) rem8u#44 ← phi( @30/(byte) rem8u#41 ) + (byte*) print_char_cursor#134 ← phi( @30/(byte*) print_char_cursor#139 ) + (byte*) print_line_cursor#40 ← phi( @30/(byte*) print_line_cursor#45 ) + (byte*) print_screen#4 ← phi( @30/(byte*) print_screen#5 ) call print_cls to:main::@1 main::@1: scope:[main] from main @@ -1303,23 +1303,23 @@ test_16s::@return: scope:[test_16s] from test_16s::@11 (byte*) print_line_cursor#18 ← (byte*) print_line_cursor#37 return to:@return -@27: scope:[] from @20 - (byte*) print_screen#5 ← phi( @20/(byte*) print_screen#6 ) - (signed word) rem16s#25 ← phi( @20/(signed word) rem16s#0 ) - (signed byte) rem8s#21 ← phi( @20/(signed byte) rem8s#26 ) - (word) rem16u#45 ← phi( @20/(word) rem16u#54 ) - (byte) rem8u#41 ← phi( @20/(byte) rem8u#50 ) - (byte*) print_char_cursor#139 ← phi( @20/(byte*) print_char_cursor#147 ) - (byte*) print_line_cursor#45 ← phi( @20/(byte*) print_line_cursor#50 ) +@30: scope:[] from @23 + (byte*) print_screen#5 ← phi( @23/(byte*) print_screen#6 ) + (signed word) rem16s#25 ← phi( @23/(signed word) rem16s#0 ) + (signed byte) rem8s#21 ← phi( @23/(signed byte) rem8s#26 ) + (word) rem16u#45 ← phi( @23/(word) rem16u#54 ) + (byte) rem8u#41 ← phi( @23/(byte) rem8u#50 ) + (byte*) print_char_cursor#139 ← phi( @23/(byte*) print_char_cursor#147 ) + (byte*) print_line_cursor#45 ← phi( @23/(byte*) print_line_cursor#50 ) call main - to:@28 -@28: scope:[] from @27 - (signed word) rem16s#19 ← phi( @27/(signed word) rem16s#7 ) - (signed byte) rem8s#15 ← phi( @27/(signed byte) rem8s#5 ) - (word) rem16u#34 ← phi( @27/(word) rem16u#11 ) - (byte) rem8u#30 ← phi( @27/(byte) rem8u#9 ) - (byte*) print_char_cursor#125 ← phi( @27/(byte*) print_char_cursor#26 ) - (byte*) print_line_cursor#38 ← phi( @27/(byte*) print_line_cursor#10 ) + to:@31 +@31: scope:[] from @30 + (signed word) rem16s#19 ← phi( @30/(signed word) rem16s#7 ) + (signed byte) rem8s#15 ← phi( @30/(signed byte) rem8s#5 ) + (word) rem16u#34 ← phi( @30/(word) rem16u#11 ) + (byte) rem8u#30 ← phi( @30/(byte) rem8u#9 ) + (byte*) print_char_cursor#125 ← phi( @30/(byte*) print_char_cursor#26 ) + (byte*) print_line_cursor#38 ← phi( @30/(byte*) print_line_cursor#10 ) (byte*) print_line_cursor#19 ← (byte*) print_line_cursor#38 (byte*) print_char_cursor#63 ← (byte*) print_char_cursor#125 (byte) rem8u#14 ← (byte) rem8u#30 @@ -1327,17 +1327,17 @@ test_16s::@return: scope:[test_16s] from test_16s::@11 (signed byte) rem8s#8 ← (signed byte) rem8s#15 (signed word) rem16s#10 ← (signed word) rem16s#19 to:@end -@end: scope:[] from @28 +@end: scope:[] from @31 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" -(label) @10 -(label) @14 -(label) @16 +(label) @11 +(label) @17 (label) @19 -(label) @20 -(label) @27 -(label) @28 +(label) @22 +(label) @23 +(label) @30 +(label) @31 (label) @begin (label) @end (signed word()) div16s((signed word) div16s::dividend , (signed word) div16s::divisor) @@ -3027,21 +3027,21 @@ Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) print_sword::@3 Culled Empty Block (label) print_sbyte::@3 Culled Empty Block (label) print_word::@2 -Culled Empty Block (label) @10 +Culled Empty Block (label) @11 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 -Culled Empty Block (label) @14 -Culled Empty Block (label) @16 +Culled Empty Block (label) @17 Culled Empty Block (label) @19 +Culled Empty Block (label) @22 Culled Empty Block (label) div8s::@7 Culled Empty Block (label) div8s::@9 Culled Empty Block (label) div8s::@5 -Culled Empty Block (label) @20 +Culled Empty Block (label) @23 Culled Empty Block (label) divr16s::@7 Culled Empty Block (label) divr16s::@9 Culled Empty Block (label) divr16s::@5 Culled Empty Block (label) main::@5 -Culled Empty Block (label) @28 +Culled Empty Block (label) @31 Culled Empty Block (label) divr16s::@16 Successful SSA optimization Pass2CullEmptyBlocks Simple Condition (bool~) divr16s::$0 if((signed word) divr16s::dividend#0<(byte/signed byte/word/signed word/dword/signed dword) 0) goto divr16s::@1 @@ -3148,7 +3148,7 @@ Added new block during phi lifting test_16u::@12(between test_16u::@11 and test_ Added new block during phi lifting test_8u::@12(between test_8u::@11 and test_8u::@1) Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @27 +Adding NOP phi() at start of @30 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@1 @@ -3314,7 +3314,7 @@ Culled Empty Block (label) divr8u::@9 Culled Empty Block (label) test_16u::@12 Culled Empty Block (label) print_cls::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @27 +Adding NOP phi() at start of @30 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@1 @@ -3349,14 +3349,14 @@ Adding NOP phi() at start of print_cls FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@27 -@27: scope:[] from @begin + to:@30 +@30: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @27 +@end: scope:[] from @30 [3] phi() [ ] ( ) -main: scope:[main] from @27 +main: scope:[main] from @30 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 @@ -4469,17 +4469,17 @@ INITIAL ASM .label rem8u = $64 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @27 [phi:@begin->@27] -b27_from_bbegin: - jmp b27 -//SEG4 @27 -b27: +//SEG3 [1] phi from @begin to @30 [phi:@begin->@30] +b30_from_bbegin: + jmp b30 +//SEG4 @30 +b30: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @27 to main [phi:@27->main] -main_from_b27: +//SEG6 [4] phi from @30 to main [phi:@30->main] +main_from_b30: jsr main -//SEG7 [3] phi from @27 to @end [phi:@27->@end] -bend_from_b27: +//SEG7 [3] phi from @30 to @end [phi:@30->@end] +bend_from_b30: jmp bend //SEG8 @end bend: @@ -6680,17 +6680,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label rem16s = $a //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @27 [phi:@begin->@27] -b27_from_bbegin: - jmp b27 -//SEG4 @27 -b27: +//SEG3 [1] phi from @begin to @30 [phi:@begin->@30] +b30_from_bbegin: + jmp b30 +//SEG4 @30 +b30: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @27 to main [phi:@27->main] -main_from_b27: +//SEG6 [4] phi from @30 to main [phi:@30->main] +main_from_b30: jsr main -//SEG7 [3] phi from @27 to @end [phi:@27->@end] -bend_from_b27: +//SEG7 [3] phi from @30 to @end [phi:@30->@end] +bend_from_b30: jmp bend //SEG8 @end bend: @@ -8290,7 +8290,7 @@ print_cls: { print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b27 +Removing instruction jmp b30 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b2 @@ -8431,9 +8431,9 @@ Replacing label b1_from_b11 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b27_from_bbegin: -Removing instruction main_from_b27: -Removing instruction bend_from_b27: +Removing instruction b30_from_bbegin: +Removing instruction main_from_b30: +Removing instruction bend_from_b30: Removing instruction b1_from_main: Removing instruction test_8u_from_b1: Removing instruction b2_from_b1: @@ -8509,7 +8509,7 @@ Removing instruction b10_from_b9: Removing instruction print_ln_from_b10: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b27: +Removing instruction b30: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -8648,7 +8648,7 @@ Removing unreachable instruction jmp breturn Succesful ASM optimization Pass5UnreachableCodeElimination FINAL SYMBOL TABLE -(label) @27 +(label) @30 (label) @begin (label) @end (signed word()) div16s((signed word) div16s::dividend , (signed word) div16s::divisor) @@ -9119,12 +9119,12 @@ Score: 32556 .label rem16u = $a .label rem16s = $a //SEG2 @begin -//SEG3 [1] phi from @begin to @27 [phi:@begin->@27] -//SEG4 @27 +//SEG3 [1] phi from @begin to @30 [phi:@begin->@30] +//SEG4 @30 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @27 to main [phi:@27->main] +//SEG6 [4] phi from @30 to main [phi:@30->main] jsr main -//SEG7 [3] phi from @27 to @end [phi:@27->@end] +//SEG7 [3] phi from @30 to @end [phi:@30->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/test-division.sym b/src/test/ref/test-division.sym index b5304aace..37813b00e 100644 --- a/src/test/ref/test-division.sym +++ b/src/test/ref/test-division.sym @@ -1,4 +1,4 @@ -(label) @27 +(label) @30 (label) @begin (label) @end (signed word()) div16s((signed word) div16s::dividend , (signed word) div16s::divisor) diff --git a/src/test/ref/test-lowhigh.cfg b/src/test/ref/test-lowhigh.cfg index 90d43a554..fa23d16e2 100644 --- a/src/test/ref/test-lowhigh.cfg +++ b/src/test/ref/test-lowhigh.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@15 -@15: scope:[] from @begin + to:@18 +@18: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @15 +@end: scope:[] from @18 [3] phi() [ ] ( ) -main: scope:[main] from @15 +main: scope:[main] from @18 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 diff --git a/src/test/ref/test-lowhigh.log b/src/test/ref/test-lowhigh.log index 3dfe7cdab..41bfc545d 100644 --- a/src/test/ref/test-lowhigh.log +++ b/src/test/ref/test-lowhigh.log @@ -4,7 +4,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@10 + to:@11 print_ln: scope:[print_ln] from main::@16 (byte*) print_char_cursor#64 ← phi( main::@16/(byte*) print_char_cursor#29 ) (byte*) print_line_cursor#17 ← phi( main::@16/(byte*) print_line_cursor#19 ) @@ -76,12 +76,12 @@ print_dword::@return: scope:[print_dword] from print_dword::@2 (byte*) print_char_cursor#8 ← (byte*) print_char_cursor#40 return to:@return -@10: scope:[] from @begin +@11: scope:[] from @begin (byte*) print_screen#6 ← phi( @begin/(byte*) print_screen#0 ) (byte*) print_char_cursor#71 ← phi( @begin/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#22 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@15 + to:@18 print_byte: scope:[print_byte] from main::@11 main::@13 main::@15 main::@9 print_word print_word::@1 (byte*) print_char_cursor#67 ← phi( main::@11/(byte*) print_char_cursor#24 main::@13/(byte*) print_char_cursor#26 main::@15/(byte*) print_char_cursor#28 main::@9/(byte*) print_char_cursor#22 print_word/(byte*) print_char_cursor#65 print_word::@1/(byte*) print_char_cursor#3 ) (byte) print_byte::b#6 ← phi( main::@11/(byte) print_byte::b#3 main::@13/(byte) print_byte::b#4 main::@15/(byte) print_byte::b#5 main::@9/(byte) print_byte::b#2 print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) @@ -142,10 +142,10 @@ print_cls::@return: scope:[print_cls] from print_cls::@2 (byte*) print_char_cursor#15 ← (byte*) print_char_cursor#46 return to:@return -main: scope:[main] from @15 - (byte*) print_char_cursor#68 ← phi( @15/(byte*) print_char_cursor#70 ) - (byte*) print_line_cursor#18 ← phi( @15/(byte*) print_line_cursor#20 ) - (byte*) print_screen#4 ← phi( @15/(byte*) print_screen#5 ) +main: scope:[main] from @18 + (byte*) print_char_cursor#68 ← phi( @18/(byte*) print_char_cursor#70 ) + (byte*) print_line_cursor#18 ← phi( @18/(byte*) print_line_cursor#20 ) + (byte*) print_screen#4 ← phi( @18/(byte*) print_screen#5 ) call print_cls to:main::@3 main::@3: scope:[main] from main @@ -313,25 +313,25 @@ main::@return: scope:[main] from main::@17 (byte*) print_char_cursor#31 ← (byte*) print_char_cursor#62 return to:@return -@15: scope:[] from @10 - (byte*) print_screen#5 ← phi( @10/(byte*) print_screen#6 ) - (byte*) print_char_cursor#70 ← phi( @10/(byte*) print_char_cursor#71 ) - (byte*) print_line_cursor#20 ← phi( @10/(byte*) print_line_cursor#22 ) +@18: scope:[] from @11 + (byte*) print_screen#5 ← phi( @11/(byte*) print_screen#6 ) + (byte*) print_char_cursor#70 ← phi( @11/(byte*) print_char_cursor#71 ) + (byte*) print_line_cursor#20 ← phi( @11/(byte*) print_line_cursor#22 ) call main - to:@16 -@16: scope:[] from @15 - (byte*) print_char_cursor#63 ← phi( @15/(byte*) print_char_cursor#31 ) - (byte*) print_line_cursor#16 ← phi( @15/(byte*) print_line_cursor#7 ) + to:@19 +@19: scope:[] from @18 + (byte*) print_char_cursor#63 ← phi( @18/(byte*) print_char_cursor#31 ) + (byte*) print_line_cursor#16 ← phi( @18/(byte*) print_line_cursor#7 ) (byte*) print_line_cursor#8 ← (byte*) print_line_cursor#16 (byte*) print_char_cursor#32 ← (byte*) print_char_cursor#63 to:@end -@end: scope:[] from @16 +@end: scope:[] from @19 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" -(label) @10 -(label) @15 -(label) @16 +(label) @11 +(label) @18 +(label) @19 (label) @begin (label) @end (void()) main() @@ -696,11 +696,11 @@ Successful SSA optimization Pass2ConstantIdentification Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) print_word::@2 Culled Empty Block (label) print_dword::@2 -Culled Empty Block (label) @10 +Culled Empty Block (label) @11 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) main::@3 -Culled Empty Block (label) @16 +Culled Empty Block (label) @19 Successful SSA optimization Pass2CullEmptyBlocks Inlining constant with var siblings (const byte) print_char::ch#2 Inlining constant with var siblings (const byte) print_char::ch#3 @@ -727,7 +727,7 @@ Added new block during phi lifting main::@18(between main::@17 and main::@1) Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @15 +Adding NOP phi() at start of @18 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@16 @@ -780,7 +780,7 @@ Coalesced down to 7 phi equivalence classes Culled Empty Block (label) print_ln::@3 Culled Empty Block (label) print_cls::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @15 +Adding NOP phi() at start of @18 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@4 @@ -796,14 +796,14 @@ Adding NOP phi() at start of print_cls FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@15 -@15: scope:[] from @begin + to:@18 +@18: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @15 +@end: scope:[] from @18 [3] phi() [ ] ( ) -main: scope:[main] from @15 +main: scope:[main] from @18 [4] phi() [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 @@ -1093,17 +1093,17 @@ INITIAL ASM .label print_char_cursor = $a //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -b15_from_bbegin: - jmp b15 -//SEG4 @15 -b15: +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +b18_from_bbegin: + jmp b18 +//SEG4 @18 +b18: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] -main_from_b15: +//SEG6 [4] phi from @18 to main [phi:@18->main] +main_from_b18: jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] -bend_from_b15: +//SEG7 [3] phi from @18 to @end [phi:@18->@end] +bend_from_b18: jmp bend //SEG8 @end bend: @@ -1755,17 +1755,17 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_char_cursor = 8 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -b15_from_bbegin: - jmp b15 -//SEG4 @15 -b15: +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +b18_from_bbegin: + jmp b18 +//SEG4 @18 +b18: //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] -main_from_b15: +//SEG6 [4] phi from @18 to main [phi:@18->main] +main_from_b18: jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] -bend_from_b15: +//SEG7 [3] phi from @18 to @end [phi:@18->@end] +bend_from_b18: jmp bend //SEG8 @end bend: @@ -2266,7 +2266,7 @@ print_cls: { print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b15 +Removing instruction jmp b18 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b4 @@ -2304,9 +2304,9 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b15_from_bbegin: -Removing instruction main_from_b15: -Removing instruction bend_from_b15: +Removing instruction b18_from_bbegin: +Removing instruction main_from_b18: +Removing instruction bend_from_b18: Removing instruction b4_from_b1: Removing instruction print_char_from_b4: Removing instruction b6_from_b5: @@ -2325,7 +2325,7 @@ Removing instruction b1_from_print_ln: Removing instruction b1_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b15: +Removing instruction b18: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1_from_main: @@ -2372,7 +2372,7 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination FINAL SYMBOL TABLE -(label) @15 +(label) @18 (label) @begin (label) @end (void()) main() @@ -2486,12 +2486,12 @@ Score: 7440 .label print_line_cursor = 6 .label print_char_cursor = 8 //SEG2 @begin -//SEG3 [1] phi from @begin to @15 [phi:@begin->@15] -//SEG4 @15 +//SEG3 [1] phi from @begin to @18 [phi:@begin->@18] +//SEG4 @18 //SEG5 [2] call main [ ] ( ) -//SEG6 [4] phi from @15 to main [phi:@15->main] +//SEG6 [4] phi from @18 to main [phi:@18->main] jsr main -//SEG7 [3] phi from @15 to @end [phi:@15->@end] +//SEG7 [3] phi from @18 to @end [phi:@18->@end] //SEG8 @end //SEG9 main main: { diff --git a/src/test/ref/test-lowhigh.sym b/src/test/ref/test-lowhigh.sym index ffdba0b9c..33f64c5f0 100644 --- a/src/test/ref/test-lowhigh.sym +++ b/src/test/ref/test-lowhigh.sym @@ -1,4 +1,4 @@ -(label) @15 +(label) @18 (label) @begin (label) @end (void()) main() diff --git a/src/test/ref/test-multiply-16bit.cfg b/src/test/ref/test-multiply-16bit.cfg index 744b18f72..8081d7c2e 100644 --- a/src/test/ref/test-multiply-16bit.cfg +++ b/src/test/ref/test-multiply-16bit.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@35 -@35: scope:[] from @begin + to:@38 +@38: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @35 +@end: scope:[] from @38 [3] phi() [ ] ( ) -main: scope:[main] from @35 +main: scope:[main] from @38 [4] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 5 [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 diff --git a/src/test/ref/test-multiply-16bit.log b/src/test/ref/test-multiply-16bit.log index 013b706dd..fbec1787f 100644 --- a/src/test/ref/test-multiply-16bit.log +++ b/src/test/ref/test-multiply-16bit.log @@ -5,7 +5,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@10 + to:@11 print_str: scope:[print_str] from mul16s_compare::@1 mul16s_compare::@17 mul16s_error mul16s_error::@2 mul16s_error::@4 mul16s_error::@6 mul16s_error::@8 mul16u_compare::@1 mul16u_compare::@17 mul16u_error mul16u_error::@2 mul16u_error::@4 mul16u_error::@6 mul16u_error::@8 (byte*) print_char_cursor#148 ← phi( mul16s_compare::@1/(byte*) print_char_cursor#143 mul16s_compare::@17/(byte*) print_char_cursor#49 mul16s_error/(byte*) print_char_cursor#146 mul16s_error::@2/(byte*) print_char_cursor#53 mul16s_error::@4/(byte*) print_char_cursor#55 mul16s_error::@6/(byte*) print_char_cursor#57 mul16s_error::@8/(byte*) print_char_cursor#59 mul16u_compare::@1/(byte*) print_char_cursor#139 mul16u_compare::@17/(byte*) print_char_cursor#31 mul16u_error/(byte*) print_char_cursor#142 mul16u_error::@2/(byte*) print_char_cursor#35 mul16u_error::@4/(byte*) print_char_cursor#37 mul16u_error::@6/(byte*) print_char_cursor#39 mul16u_error::@8/(byte*) print_char_cursor#41 ) (byte*) print_str::str#17 ← phi( mul16s_compare::@1/(byte*) print_str::str#8 mul16s_compare::@17/(byte*) print_str::str#9 mul16s_error/(byte*) print_str::str#10 mul16s_error::@2/(byte*) print_str::str#11 mul16s_error::@4/(byte*) print_str::str#12 mul16s_error::@6/(byte*) print_str::str#13 mul16s_error::@8/(byte*) print_str::str#14 mul16u_compare::@1/(byte*) print_str::str#1 mul16u_compare::@17/(byte*) print_str::str#2 mul16u_error/(byte*) print_str::str#3 mul16u_error::@2/(byte*) print_str::str#4 mul16u_error::@4/(byte*) print_str::str#5 mul16u_error::@6/(byte*) print_str::str#6 mul16u_error::@8/(byte*) print_str::str#7 ) @@ -171,12 +171,12 @@ print_sdword::@return: scope:[print_sdword] from print_sdword::@3 (byte*) print_char_cursor#16 ← (byte*) print_char_cursor#80 return to:@return -@10: scope:[] from @begin +@11: scope:[] from @begin (byte*) print_screen#8 ← phi( @begin/(byte*) print_screen#0 ) (byte*) print_char_cursor#165 ← phi( @begin/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#71 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@19 + to:@22 print_byte: scope:[print_byte] from print_word print_word::@1 (byte*) print_char_cursor#136 ← phi( print_word/(byte*) print_char_cursor#132 print_word::@1/(byte*) print_char_cursor#8 ) (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) @@ -341,15 +341,15 @@ mul16s::@return: scope:[mul16s] from mul16s::@2 (signed dword) mul16s::return#1 ← (signed dword) mul16s::return#3 return to:@return -@19: scope:[] from @10 - (byte*) print_screen#7 ← phi( @10/(byte*) print_screen#8 ) - (byte*) print_char_cursor#158 ← phi( @10/(byte*) print_char_cursor#165 ) - (byte*) print_line_cursor#62 ← phi( @10/(byte*) print_line_cursor#71 ) +@22: scope:[] from @11 + (byte*) print_screen#7 ← phi( @11/(byte*) print_screen#8 ) + (byte*) print_char_cursor#158 ← phi( @11/(byte*) print_char_cursor#165 ) + (byte*) print_line_cursor#62 ← phi( @11/(byte*) print_line_cursor#71 ) (byte[512]) mulf_sqr1_lo#0 ← { fill( 512, 0) } (byte[512]) mulf_sqr1_hi#0 ← { fill( 512, 0) } (byte[512]) mulf_sqr2_lo#0 ← { fill( 512, 0) } (byte[512]) mulf_sqr2_hi#0 ← { fill( 512, 0) } - to:@28 + to:@31 mulf_init: scope:[mulf_init] from main::@1 (word) mulf_init::sqr#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) mulf_init::x_2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 @@ -520,17 +520,17 @@ mulf16s::@return: scope:[mulf16s] from mulf16s::@2 (signed dword) mulf16s::return#1 ← (signed dword) mulf16s::return#3 return to:@return -@28: scope:[] from @19 - (byte*) print_screen#6 ← phi( @19/(byte*) print_screen#7 ) - (byte*) print_char_cursor#157 ← phi( @19/(byte*) print_char_cursor#158 ) - (byte*) print_line_cursor#61 ← phi( @19/(byte*) print_line_cursor#62 ) +@31: scope:[] from @22 + (byte*) print_screen#6 ← phi( @22/(byte*) print_screen#7 ) + (byte*) print_char_cursor#157 ← phi( @22/(byte*) print_char_cursor#158 ) + (byte*) print_line_cursor#61 ← phi( @22/(byte*) print_line_cursor#62 ) (byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53281 - to:@35 -main: scope:[main] from @35 - (byte*) print_char_cursor#137 ← phi( @35/(byte*) print_char_cursor#147 ) - (byte*) print_line_cursor#44 ← phi( @35/(byte*) print_line_cursor#54 ) - (byte*) print_screen#4 ← phi( @35/(byte*) print_screen#5 ) - (byte*) BGCOL#1 ← phi( @35/(byte*) BGCOL#4 ) + to:@38 +main: scope:[main] from @38 + (byte*) print_char_cursor#137 ← phi( @38/(byte*) print_char_cursor#147 ) + (byte*) print_line_cursor#44 ← phi( @38/(byte*) print_line_cursor#54 ) + (byte*) print_screen#4 ← phi( @38/(byte*) print_screen#5 ) + (byte*) BGCOL#1 ← phi( @38/(byte*) BGCOL#4 ) *((byte*) BGCOL#1) ← (byte/signed byte/word/signed word/dword/signed dword) 5 call print_cls to:main::@1 @@ -1366,28 +1366,28 @@ mul16s_error::@return: scope:[mul16s_error] from mul16s_error::@11 (byte*) print_line_cursor#20 ← (byte*) print_line_cursor#41 return to:@return -@35: scope:[] from @28 - (byte*) print_screen#5 ← phi( @28/(byte*) print_screen#6 ) - (byte*) print_char_cursor#147 ← phi( @28/(byte*) print_char_cursor#157 ) - (byte*) print_line_cursor#54 ← phi( @28/(byte*) print_line_cursor#61 ) - (byte*) BGCOL#4 ← phi( @28/(byte*) BGCOL#0 ) +@38: scope:[] from @31 + (byte*) print_screen#5 ← phi( @31/(byte*) print_screen#6 ) + (byte*) print_char_cursor#147 ← phi( @31/(byte*) print_char_cursor#157 ) + (byte*) print_line_cursor#54 ← phi( @31/(byte*) print_line_cursor#61 ) + (byte*) BGCOL#4 ← phi( @31/(byte*) BGCOL#0 ) call main - to:@36 -@36: scope:[] from @35 - (byte*) print_char_cursor#127 ← phi( @35/(byte*) print_char_cursor#27 ) - (byte*) print_line_cursor#42 ← phi( @35/(byte*) print_line_cursor#8 ) + to:@39 +@39: scope:[] from @38 + (byte*) print_char_cursor#127 ← phi( @38/(byte*) print_char_cursor#27 ) + (byte*) print_line_cursor#42 ← phi( @38/(byte*) print_line_cursor#8 ) (byte*) print_line_cursor#21 ← (byte*) print_line_cursor#42 (byte*) print_char_cursor#64 ← (byte*) print_char_cursor#127 to:@end -@end: scope:[] from @36 +@end: scope:[] from @39 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" -(label) @10 -(label) @19 -(label) @28 -(label) @35 -(label) @36 +(label) @11 +(label) @22 +(label) @31 +(label) @38 +(label) @39 (label) @begin (label) @end (byte*) BGCOL @@ -3107,13 +3107,13 @@ Culled Empty Block (label) print_sword::@3 Culled Empty Block (label) print_word::@2 Culled Empty Block (label) print_dword::@2 Culled Empty Block (label) print_sdword::@3 -Culled Empty Block (label) @10 +Culled Empty Block (label) @11 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) mul16u::@3 -Culled Empty Block (label) @19 +Culled Empty Block (label) @22 Culled Empty Block (label) mulf_init::@6 -Culled Empty Block (label) @28 +Culled Empty Block (label) @31 Culled Empty Block (label) main::@4 Culled Empty Block (label) muls16u::@3 Culled Empty Block (label) muls16s::@1 @@ -3127,7 +3127,7 @@ Culled Empty Block (label) mul16s_compare::@12 Culled Empty Block (label) mul16s_compare::@16 Culled Empty Block (label) mul16s_compare::@19 Culled Empty Block (label) mul16s_error::@11 -Culled Empty Block (label) @36 +Culled Empty Block (label) @39 Successful SSA optimization Pass2CullEmptyBlocks Self Phi Eliminated (byte*) BGCOL#21 Self Phi Eliminated (byte*) print_line_cursor#90 @@ -3271,7 +3271,7 @@ Added new block during phi lifting mulf_init::@11(between mulf_init::@4 and mulf Added new block during phi lifting mulf_init::@12(between mulf_init::@3 and mulf_init::@4) Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @35 +Adding NOP phi() at start of @38 Adding NOP phi() at start of @end Adding NOP phi() at start of main::@1 Adding NOP phi() at start of main::@2 @@ -3461,7 +3461,7 @@ Culled Empty Block (label) mulf_init::@9 Culled Empty Block (label) mulf_init::@10 Culled Empty Block (label) print_cls::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @35 +Adding NOP phi() at start of @38 Adding NOP phi() at start of @end Adding NOP phi() at start of main::@1 Adding NOP phi() at start of main::@2 @@ -3496,14 +3496,14 @@ Adding NOP phi() at start of print_cls FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@35 -@35: scope:[] from @begin + to:@38 +@38: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @35 +@end: scope:[] from @38 [3] phi() [ ] ( ) -main: scope:[main] from @35 +main: scope:[main] from @38 [4] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 5 [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 @@ -4697,15 +4697,15 @@ INITIAL ASM .label print_line_cursor = 9 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -b35_from_bbegin: - jmp b35 -//SEG4 @35 -b35: +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +b38_from_bbegin: + jmp b38 +//SEG4 @38 +b38: //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @35 to @end [phi:@35->@end] -bend_from_b35: +//SEG6 [3] phi from @38 to @end [phi:@38->@end] +bend_from_b38: jmp bend //SEG7 @end bend: @@ -7670,15 +7670,15 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = 7 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -b35_from_bbegin: - jmp b35 -//SEG4 @35 -b35: +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +b38_from_bbegin: + jmp b38 +//SEG4 @38 +b38: //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @35 to @end [phi:@35->@end] -bend_from_b35: +//SEG6 [3] phi from @38 to @end [phi:@38->@end] +bend_from_b38: jmp bend //SEG7 @end bend: @@ -9824,7 +9824,7 @@ print_cls: { mulf_sqr2_hi: .fill $200, 0 ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b35 +Removing instruction jmp b38 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b2 @@ -9990,8 +9990,8 @@ Replacing label b3_from_b4 with b3 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b35_from_bbegin: -Removing instruction bend_from_b35: +Removing instruction b38_from_bbegin: +Removing instruction bend_from_b38: Removing instruction b1_from_main: Removing instruction mulf_init_from_b1: Removing instruction b2_from_b1: @@ -10078,7 +10078,7 @@ Removing instruction b12_from_b3: Removing instruction b4_from_b12: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b35: +Removing instruction b38: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -10236,7 +10236,7 @@ Fixing long branch [109] bne b1 to beq Fixing long branch [811] bne b1 to beq FINAL SYMBOL TABLE -(label) @35 +(label) @38 (label) @begin (label) @end (byte*) BGCOL @@ -10709,11 +10709,11 @@ Score: 444925 .label print_char_cursor = $f .label print_line_cursor = 7 //SEG2 @begin -//SEG3 [1] phi from @begin to @35 [phi:@begin->@35] -//SEG4 @35 +//SEG3 [1] phi from @begin to @38 [phi:@begin->@38] +//SEG4 @38 //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @35 to @end [phi:@35->@end] +//SEG6 [3] phi from @38 to @end [phi:@38->@end] //SEG7 @end //SEG8 main main: { diff --git a/src/test/ref/test-multiply-16bit.sym b/src/test/ref/test-multiply-16bit.sym index ad44bddc0..7a98c4233 100644 --- a/src/test/ref/test-multiply-16bit.sym +++ b/src/test/ref/test-multiply-16bit.sym @@ -1,4 +1,4 @@ -(label) @35 +(label) @38 (label) @begin (label) @end (byte*) BGCOL diff --git a/src/test/ref/test-multiply-8bit.cfg b/src/test/ref/test-multiply-8bit.cfg index ead8882c8..5f085bfaf 100644 --- a/src/test/ref/test-multiply-8bit.cfg +++ b/src/test/ref/test-multiply-8bit.cfg @@ -1,13 +1,13 @@ @begin: scope:[] from [0] phi() [ ] ( ) - to:@37 -@37: scope:[] from @begin + to:@40 +@40: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @37 +@end: scope:[] from @40 [3] phi() [ ] ( ) -main: scope:[main] from @37 +main: scope:[main] from @40 [4] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 5 [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 diff --git a/src/test/ref/test-multiply-8bit.log b/src/test/ref/test-multiply-8bit.log index 52a18cb04..4edbcd679 100644 --- a/src/test/ref/test-multiply-8bit.log +++ b/src/test/ref/test-multiply-8bit.log @@ -5,7 +5,7 @@ CONTROL FLOW GRAPH SSA (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 (byte*) print_line_cursor#0 ← (byte*) print_screen#0 (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 - to:@10 + to:@11 print_str: scope:[print_str] from mul8s_compare::@11 mul8s_error mul8s_error::@2 mul8s_error::@4 mul8s_error::@6 mul8s_error::@8 mul8u_compare::@11 mul8u_error mul8u_error::@2 mul8u_error::@4 mul8u_error::@6 mul8u_error::@8 mulf_tables_cmp::@3 mulf_tables_cmp::@5 mulf_tables_cmp::@7 (byte*) print_char_cursor#149 ← phi( mul8s_compare::@11/(byte*) print_char_cursor#146 mul8s_error/(byte*) print_char_cursor#147 mul8s_error::@2/(byte*) print_char_cursor#54 mul8s_error::@4/(byte*) print_char_cursor#56 mul8s_error::@6/(byte*) print_char_cursor#58 mul8s_error::@8/(byte*) print_char_cursor#60 mul8u_compare::@11/(byte*) print_char_cursor#143 mul8u_error/(byte*) print_char_cursor#144 mul8u_error::@2/(byte*) print_char_cursor#38 mul8u_error::@4/(byte*) print_char_cursor#40 mul8u_error::@6/(byte*) print_char_cursor#42 mul8u_error::@8/(byte*) print_char_cursor#44 mulf_tables_cmp::@3/(byte*) print_char_cursor#140 mulf_tables_cmp::@5/(byte*) print_char_cursor#141 mulf_tables_cmp::@7/(byte*) print_char_cursor#27 ) (byte*) print_str::str#18 ← phi( mul8s_compare::@11/(byte*) print_str::str#10 mul8s_error/(byte*) print_str::str#11 mul8s_error::@2/(byte*) print_str::str#12 mul8s_error::@4/(byte*) print_str::str#13 mul8s_error::@6/(byte*) print_str::str#14 mul8s_error::@8/(byte*) print_str::str#15 mul8u_compare::@11/(byte*) print_str::str#4 mul8u_error/(byte*) print_str::str#5 mul8u_error::@2/(byte*) print_str::str#6 mul8u_error::@4/(byte*) print_str::str#7 mul8u_error::@6/(byte*) print_str::str#8 mul8u_error::@8/(byte*) print_str::str#9 mulf_tables_cmp::@3/(byte*) print_str::str#1 mulf_tables_cmp::@5/(byte*) print_str::str#3 mulf_tables_cmp::@7/(byte*) print_str::str#2 ) @@ -147,12 +147,12 @@ print_word::@return: scope:[print_word] from print_word::@2 (byte*) print_char_cursor#13 ← (byte*) print_char_cursor#78 return to:@return -@10: scope:[] from @begin +@11: scope:[] from @begin (byte*) print_screen#9 ← phi( @begin/(byte*) print_screen#0 ) (byte*) print_char_cursor#173 ← phi( @begin/(byte*) print_char_cursor#0 ) (byte*) print_line_cursor#89 ← phi( @begin/(byte*) print_line_cursor#0 ) (byte[]) print_hextab#0 ← (const string) $0 - to:@19 + to:@22 print_byte: scope:[print_byte] from mul8u_error::@1 mul8u_error::@3 print_sbyte::@1 print_word print_word::@1 (byte*) print_char_cursor#137 ← phi( mul8u_error::@1/(byte*) print_char_cursor#37 mul8u_error::@3/(byte*) print_char_cursor#39 print_sbyte::@1/(byte*) print_char_cursor#134 print_word/(byte*) print_char_cursor#136 print_word::@1/(byte*) print_char_cursor#11 ) (byte) print_byte::b#5 ← phi( mul8u_error::@1/(byte) print_byte::b#3 mul8u_error::@3/(byte) print_byte::b#4 print_sbyte::@1/(byte) print_byte::b#0 print_word/(byte) print_byte::b#1 print_word::@1/(byte) print_byte::b#2 ) @@ -317,15 +317,15 @@ mul8s::@return: scope:[mul8s] from mul8s::@2 (signed word) mul8s::return#1 ← (signed word) mul8s::return#3 return to:@return -@19: scope:[] from @10 - (byte*) print_screen#8 ← phi( @10/(byte*) print_screen#9 ) - (byte*) print_char_cursor#168 ← phi( @10/(byte*) print_char_cursor#173 ) - (byte*) print_line_cursor#78 ← phi( @10/(byte*) print_line_cursor#89 ) +@22: scope:[] from @11 + (byte*) print_screen#8 ← phi( @11/(byte*) print_screen#9 ) + (byte*) print_char_cursor#168 ← phi( @11/(byte*) print_char_cursor#173 ) + (byte*) print_line_cursor#78 ← phi( @11/(byte*) print_line_cursor#89 ) (byte[512]) mulf_sqr1_lo#0 ← { fill( 512, 0) } (byte[512]) mulf_sqr1_hi#0 ← { fill( 512, 0) } (byte[512]) mulf_sqr2_lo#0 ← { fill( 512, 0) } (byte[512]) mulf_sqr2_hi#0 ← { fill( 512, 0) } - to:@28 + to:@31 mulf_init: scope:[mulf_init] from main::@1 (word) mulf_init::sqr#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) mulf_init::x_2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 @@ -549,17 +549,17 @@ mulf8s::@return: scope:[mulf8s] from mulf8s::@4 (signed word) mulf8s::return#1 ← (signed word) mulf8s::return#3 return to:@return -@28: scope:[] from @19 - (byte*) print_screen#7 ← phi( @19/(byte*) print_screen#8 ) - (byte*) print_char_cursor#160 ← phi( @19/(byte*) print_char_cursor#168 ) - (byte*) print_line_cursor#67 ← phi( @19/(byte*) print_line_cursor#78 ) +@31: scope:[] from @22 + (byte*) print_screen#7 ← phi( @22/(byte*) print_screen#8 ) + (byte*) print_char_cursor#160 ← phi( @22/(byte*) print_char_cursor#168 ) + (byte*) print_line_cursor#67 ← phi( @22/(byte*) print_line_cursor#78 ) (byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53281 - to:@31 -main: scope:[main] from @37 - (byte*) print_char_cursor#138 ← phi( @37/(byte*) print_char_cursor#148 ) - (byte*) print_line_cursor#46 ← phi( @37/(byte*) print_line_cursor#56 ) - (byte*) print_screen#4 ← phi( @37/(byte*) print_screen#5 ) - (byte*) BGCOL#1 ← phi( @37/(byte*) BGCOL#5 ) + to:@34 +main: scope:[main] from @40 + (byte*) print_char_cursor#138 ← phi( @40/(byte*) print_char_cursor#148 ) + (byte*) print_line_cursor#46 ← phi( @40/(byte*) print_line_cursor#56 ) + (byte*) print_screen#4 ← phi( @40/(byte*) print_screen#5 ) + (byte*) BGCOL#1 ← phi( @40/(byte*) BGCOL#5 ) *((byte*) BGCOL#1) ← (byte/signed byte/word/signed word/dword/signed dword) 5 call print_cls to:main::@1 @@ -707,16 +707,16 @@ muls8s::@return: scope:[muls8s] from muls8s::@4 (signed word) muls8s::return#1 ← (signed word) muls8s::return#3 return to:@return -@31: scope:[] from @28 - (byte*) print_screen#6 ← phi( @28/(byte*) print_screen#7 ) - (byte*) print_char_cursor#159 ← phi( @28/(byte*) print_char_cursor#160 ) - (byte*) print_line_cursor#66 ← phi( @28/(byte*) print_line_cursor#67 ) - (byte*) BGCOL#15 ← phi( @28/(byte*) BGCOL#0 ) +@34: scope:[] from @31 + (byte*) print_screen#6 ← phi( @31/(byte*) print_screen#7 ) + (byte*) print_char_cursor#159 ← phi( @31/(byte*) print_char_cursor#160 ) + (byte*) print_line_cursor#66 ← phi( @31/(byte*) print_line_cursor#67 ) + (byte*) BGCOL#15 ← phi( @31/(byte*) BGCOL#0 ) (byte[512]) mula_sqr1_lo#0 ← { fill( 512, 0) } (byte[512]) mula_sqr1_hi#0 ← { fill( 512, 0) } (byte[512]) mula_sqr2_lo#0 ← { fill( 512, 0) } (byte[512]) mula_sqr2_hi#0 ← { fill( 512, 0) } - to:@37 + to:@40 mulf_init_asm: scope:[mulf_init_asm] from main::@2 asm { ldx#$00 txa .byte$c9 lb1: tya adc#$00 ml1: stamula_sqr1_hi,x tay cmp#$40 txa ror ml9: adc#$00 staml9+1 inx ml0: stamula_sqr1_lo,x bnelb1 incml0+2 incml1+2 clc iny bnelb1 ldx#$00 ldy#$ff !: ldamula_sqr1_hi+1,x stamula_sqr2_hi+$100,x ldamula_sqr1_hi,x stamula_sqr2_hi,y ldamula_sqr1_lo+1,x stamula_sqr2_lo+$100,x ldamula_sqr1_lo,x stamula_sqr2_lo,y dey inx bne!- } (byte*) mulf_init_asm::mem#0 ← ((byte*)) (byte/word/signed word/dword/signed dword) 255 @@ -1437,29 +1437,29 @@ mul8s_error::@return: scope:[mul8s_error] from mul8s_error::@11 (byte*) print_line_cursor#21 ← (byte*) print_line_cursor#43 return to:@return -@37: scope:[] from @31 - (byte*) print_screen#5 ← phi( @31/(byte*) print_screen#6 ) - (byte*) print_char_cursor#148 ← phi( @31/(byte*) print_char_cursor#159 ) - (byte*) print_line_cursor#56 ← phi( @31/(byte*) print_line_cursor#66 ) - (byte*) BGCOL#5 ← phi( @31/(byte*) BGCOL#15 ) +@40: scope:[] from @34 + (byte*) print_screen#5 ← phi( @34/(byte*) print_screen#6 ) + (byte*) print_char_cursor#148 ← phi( @34/(byte*) print_char_cursor#159 ) + (byte*) print_line_cursor#56 ← phi( @34/(byte*) print_line_cursor#66 ) + (byte*) BGCOL#5 ← phi( @34/(byte*) BGCOL#15 ) call main - to:@38 -@38: scope:[] from @37 - (byte*) print_char_cursor#129 ← phi( @37/(byte*) print_char_cursor#25 ) - (byte*) print_line_cursor#44 ← phi( @37/(byte*) print_line_cursor#9 ) + to:@41 +@41: scope:[] from @40 + (byte*) print_char_cursor#129 ← phi( @40/(byte*) print_char_cursor#25 ) + (byte*) print_line_cursor#44 ← phi( @40/(byte*) print_line_cursor#9 ) (byte*) print_line_cursor#22 ← (byte*) print_line_cursor#44 (byte*) print_char_cursor#65 ← (byte*) print_char_cursor#129 to:@end -@end: scope:[] from @38 +@end: scope:[] from @41 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" -(label) @10 -(label) @19 -(label) @28 +(label) @11 +(label) @22 (label) @31 -(label) @37 -(label) @38 +(label) @34 +(label) @40 +(label) @41 (label) @begin (label) @end (byte*) BGCOL @@ -3232,20 +3232,20 @@ Culled Empty Block (label) print_ln::@2 Culled Empty Block (label) print_sword::@3 Culled Empty Block (label) print_sbyte::@3 Culled Empty Block (label) print_word::@2 -Culled Empty Block (label) @10 +Culled Empty Block (label) @11 Culled Empty Block (label) print_byte::@2 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) mul8u::@3 -Culled Empty Block (label) @19 +Culled Empty Block (label) @22 Culled Empty Block (label) mulf_init::@6 Culled Empty Block (label) mulf8s::@3 -Culled Empty Block (label) @28 +Culled Empty Block (label) @31 Culled Empty Block (label) main::@6 Culled Empty Block (label) muls8u::@3 Culled Empty Block (label) muls8s::@1 Culled Empty Block (label) muls8s::@2 Culled Empty Block (label) muls8s::@7 -Culled Empty Block (label) @31 +Culled Empty Block (label) @34 Culled Empty Block (label) mulf_tables_cmp::@9 Culled Empty Block (label) mulf_tables_cmp::@11 Culled Empty Block (label) mul8u_compare::@15 @@ -3254,7 +3254,7 @@ Culled Empty Block (label) mul8u_error::@11 Culled Empty Block (label) mul8s_compare::@15 Culled Empty Block (label) mul8s_compare::@17 Culled Empty Block (label) mul8s_error::@11 -Culled Empty Block (label) @38 +Culled Empty Block (label) @41 Successful SSA optimization Pass2CullEmptyBlocks Alias (word) mulf8u_prepared::return#0 = (word~) mulf8u_prepared::$0 Successful SSA optimization Pass2AliasElimination @@ -3407,7 +3407,7 @@ Added new block during phi lifting mulf_init::@11(between mulf_init::@4 and mulf Added new block during phi lifting mulf_init::@12(between mulf_init::@3 and mulf_init::@4) Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1) Adding NOP phi() at start of @begin -Adding NOP phi() at start of @37 +Adding NOP phi() at start of @40 Adding NOP phi() at start of @end Adding NOP phi() at start of main::@1 Adding NOP phi() at start of main::@2 @@ -3591,7 +3591,7 @@ Culled Empty Block (label) mulf_init::@9 Culled Empty Block (label) mulf_init::@10 Culled Empty Block (label) print_cls::@3 Adding NOP phi() at start of @begin -Adding NOP phi() at start of @37 +Adding NOP phi() at start of @40 Adding NOP phi() at start of @end Adding NOP phi() at start of main::@1 Adding NOP phi() at start of main::@2 @@ -3632,14 +3632,14 @@ Adding NOP phi() at start of print_cls FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() [ ] ( ) - to:@37 -@37: scope:[] from @begin + to:@40 +@40: scope:[] from @begin [1] phi() [ ] ( ) [2] call main [ ] ( ) to:@end -@end: scope:[] from @37 +@end: scope:[] from @40 [3] phi() [ ] ( ) -main: scope:[main] from @37 +main: scope:[main] from @40 [4] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 5 [ ] ( main:2 [ ] ) [5] call print_cls [ ] ( main:2 [ ] ) to:main::@1 @@ -4908,15 +4908,15 @@ INITIAL ASM .label print_line_cursor = 5 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @37 [phi:@begin->@37] -b37_from_bbegin: - jmp b37 -//SEG4 @37 -b37: +//SEG3 [1] phi from @begin to @40 [phi:@begin->@40] +b40_from_bbegin: + jmp b40 +//SEG4 @40 +b40: //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @37 to @end [phi:@37->@end] -bend_from_b37: +//SEG6 [3] phi from @40 to @end [phi:@40->@end] +bend_from_b40: jmp bend //SEG7 @end bend: @@ -7615,15 +7615,15 @@ ASSEMBLER BEFORE OPTIMIZATION .label print_line_cursor = 4 //SEG2 @begin bbegin: -//SEG3 [1] phi from @begin to @37 [phi:@begin->@37] -b37_from_bbegin: - jmp b37 -//SEG4 @37 -b37: +//SEG3 [1] phi from @begin to @40 [phi:@begin->@40] +b40_from_bbegin: + jmp b40 +//SEG4 @40 +b40: //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @37 to @end [phi:@37->@end] -bend_from_b37: +//SEG6 [3] phi from @40 to @end [phi:@40->@end] +bend_from_b40: jmp bend //SEG7 @end bend: @@ -9629,7 +9629,7 @@ print_cls: { mula_sqr2_hi: .fill $200, 0 ASSEMBLER OPTIMIZATIONS -Removing instruction jmp b37 +Removing instruction jmp b40 Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b2 @@ -9805,8 +9805,8 @@ Replacing label b3_from_b4 with b3 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction bbegin: -Removing instruction b37_from_bbegin: -Removing instruction bend_from_b37: +Removing instruction b40_from_bbegin: +Removing instruction bend_from_b40: Removing instruction b1_from_main: Removing instruction mulf_init_from_b1: Removing instruction b2_from_b1: @@ -9901,7 +9901,7 @@ Removing instruction b12_from_b3: Removing instruction b4_from_b12: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b37: +Removing instruction b40: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -10075,7 +10075,7 @@ Removing unreachable instruction jmp b4 Succesful ASM optimization Pass5UnreachableCodeElimination FINAL SYMBOL TABLE -(label) @37 +(label) @40 (label) @begin (label) @end (byte*) BGCOL @@ -10600,11 +10600,11 @@ Score: 224667 .label print_char_cursor = $a .label print_line_cursor = 4 //SEG2 @begin -//SEG3 [1] phi from @begin to @37 [phi:@begin->@37] -//SEG4 @37 +//SEG3 [1] phi from @begin to @40 [phi:@begin->@40] +//SEG4 @40 //SEG5 [2] call main [ ] ( ) jsr main -//SEG6 [3] phi from @37 to @end [phi:@37->@end] +//SEG6 [3] phi from @40 to @end [phi:@40->@end] //SEG7 @end //SEG8 main main: { diff --git a/src/test/ref/test-multiply-8bit.sym b/src/test/ref/test-multiply-8bit.sym index 386c3776b..b60102b6e 100644 --- a/src/test/ref/test-multiply-8bit.sym +++ b/src/test/ref/test-multiply-8bit.sym @@ -1,4 +1,4 @@ -(label) @37 +(label) @40 (label) @begin (label) @end (byte*) BGCOL