mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-08 17:54:40 +00:00
2396 lines
98 KiB
Plaintext
2396 lines
98 KiB
Plaintext
Fixing pointer addition (word*~) bsearch16u::$7 ← (word*) bsearch16u::items + (byte~) bsearch16u::$6
|
|
Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot + (number) 1
|
|
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
|
|
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
|
|
Fixing pointer array-indexing *((dword*) ultoa::digit_values + (byte) ultoa::digit)
|
|
Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
|
|
Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_lines::str)
|
|
Warning! Adding boolean cast to non-boolean condition (byte) print_str_lines::ch
|
|
Warning! Adding boolean cast to non-boolean condition *((byte*) print_str::str)
|
|
Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_at::str)
|
|
Warning! Adding boolean cast to non-boolean sub-expression (byte) print_str_lines::ch
|
|
Warning! Adding boolean cast to non-boolean sub-expression *((byte*) main::sieve_i)
|
|
Warning! Adding boolean cast to non-boolean sub-expression *((byte*) sieve + (word) main::i)
|
|
Identified constant variable (byte*) HEAP_TOP
|
|
Identified constant variable (byte*) sieve
|
|
Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx
|
|
Culled Empty Block (label) @1
|
|
Culled Empty Block (label) @2
|
|
Culled Empty Block (label) memset::@7
|
|
Culled Empty Block (label) memset::@6
|
|
Culled Empty Block (label) memset::@8
|
|
Culled Empty Block (label) memset::@9
|
|
Culled Empty Block (label) memset::@3
|
|
Culled Empty Block (label) @3
|
|
Culled Empty Block (label) @4
|
|
Culled Empty Block (label) @5
|
|
Culled Empty Block (label) @6
|
|
Culled Empty Block (label) @7
|
|
Culled Empty Block (label) @8
|
|
Culled Empty Block (label) @9
|
|
Culled Empty Block (label) @10
|
|
Culled Empty Block (label) @11
|
|
Culled Empty Block (label) @12
|
|
Culled Empty Block (label) @13
|
|
Culled Empty Block (label) @14
|
|
Culled Empty Block (label) @15
|
|
Culled Empty Block (label) @16
|
|
Culled Empty Block (label) @17
|
|
Culled Empty Block (label) @18
|
|
Culled Empty Block (label) @19
|
|
Culled Empty Block (label) @20
|
|
Culled Empty Block (label) @21
|
|
Culled Empty Block (label) @22
|
|
Culled Empty Block (label) @23
|
|
Culled Empty Block (label) @24
|
|
Culled Empty Block (label) @25
|
|
Culled Empty Block (label) @27
|
|
Culled Empty Block (label) @28
|
|
Culled Empty Block (label) @29
|
|
Culled Empty Block (label) @30
|
|
Culled Empty Block (label) @31
|
|
Culled Empty Block (label) @32
|
|
Culled Empty Block (label) @33
|
|
Culled Empty Block (label) @34
|
|
Culled Empty Block (label) @35
|
|
Culled Empty Block (label) @36
|
|
Culled Empty Block (label) @37
|
|
Culled Empty Block (label) @38
|
|
Culled Empty Block (label) @39
|
|
Culled Empty Block (label) @40
|
|
Culled Empty Block (label) @41
|
|
Culled Empty Block (label) @42
|
|
Culled Empty Block (label) @44
|
|
Culled Empty Block (label) @45
|
|
Culled Empty Block (label) @46
|
|
Culled Empty Block (label) @47
|
|
Culled Empty Block (label) @48
|
|
Culled Empty Block (label) @49
|
|
Culled Empty Block (label) main::@11
|
|
Culled Empty Block (label) main::@12
|
|
Culled Empty Block (label) main::@8
|
|
Culled Empty Block (label) main::@7
|
|
Culled Empty Block (label) main::@9
|
|
Culled Empty Block (label) main::@10
|
|
Culled Empty Block (label) main::@14
|
|
Culled Empty Block (label) main::@19
|
|
Culled Empty Block (label) main::@17
|
|
Culled Empty Block (label) main::@20
|
|
Culled Empty Block (label) main::@22
|
|
Culled Empty Block (label) main::@26
|
|
Culled Empty Block (label) main::@25
|
|
Culled Empty Block (label) main::@27
|
|
Culled Empty Block (label) main::@28
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
@begin: scope:[] from
|
|
to:@26
|
|
memset: scope:[memset] from main
|
|
(byte) memset::c#4 ← phi( main/(byte) memset::c#0 )
|
|
(void*) memset::str#3 ← phi( main/(void*) memset::str#0 )
|
|
(word) memset::num#1 ← phi( main/(word) memset::num#0 )
|
|
(bool~) memset::$0 ← (word) memset::num#1 > (number) 0
|
|
(bool~) memset::$1 ← ! (bool~) memset::$0
|
|
if((bool~) memset::$1) goto memset::@1
|
|
to:memset::@2
|
|
memset::@1: scope:[memset] from memset memset::@4
|
|
(void*) memset::str#1 ← phi( memset/(void*) memset::str#3 memset::@4/(void*) memset::str#4 )
|
|
(void*) memset::return#0 ← (void*) memset::str#1
|
|
to:memset::@return
|
|
memset::@2: scope:[memset] from memset
|
|
(byte) memset::c#3 ← phi( memset/(byte) memset::c#4 )
|
|
(word) memset::num#2 ← phi( memset/(word) memset::num#1 )
|
|
(void*) memset::str#2 ← phi( memset/(void*) memset::str#3 )
|
|
(byte*~) memset::$2 ← ((byte*)) (void*) memset::str#2
|
|
(byte*~) memset::$3 ← (byte*~) memset::$2 + (word) memset::num#2
|
|
(byte*) memset::end#0 ← (byte*~) memset::$3
|
|
(byte*) memset::dst#0 ← ((byte*)) (void*) memset::str#2
|
|
to:memset::@4
|
|
memset::@4: scope:[memset] from memset::@2 memset::@5
|
|
(byte) memset::c#2 ← phi( memset::@2/(byte) memset::c#3 memset::@5/(byte) memset::c#1 )
|
|
(void*) memset::str#4 ← phi( memset::@2/(void*) memset::str#2 memset::@5/(void*) memset::str#5 )
|
|
(byte*) memset::end#1 ← phi( memset::@2/(byte*) memset::end#0 memset::@5/(byte*) memset::end#2 )
|
|
(byte*) memset::dst#2 ← phi( memset::@2/(byte*) memset::dst#0 memset::@5/(byte*) memset::dst#1 )
|
|
(bool~) memset::$4 ← (byte*) memset::dst#2 != (byte*) memset::end#1
|
|
if((bool~) memset::$4) goto memset::@5
|
|
to:memset::@1
|
|
memset::@5: scope:[memset] from memset::@4
|
|
(void*) memset::str#5 ← phi( memset::@4/(void*) memset::str#4 )
|
|
(byte*) memset::end#2 ← phi( memset::@4/(byte*) memset::end#1 )
|
|
(byte*) memset::dst#3 ← phi( memset::@4/(byte*) memset::dst#2 )
|
|
(byte) memset::c#1 ← phi( memset::@4/(byte) memset::c#2 )
|
|
*((byte*) memset::dst#3) ← (byte) memset::c#1
|
|
(byte*) memset::dst#1 ← ++ (byte*) memset::dst#3
|
|
to:memset::@4
|
|
memset::@return: scope:[memset] from memset::@1
|
|
(void*) memset::return#3 ← phi( memset::@1/(void*) memset::return#0 )
|
|
(void*) memset::return#1 ← (void*) memset::return#3
|
|
return
|
|
to:@return
|
|
@26: scope:[] from @begin
|
|
(byte*) print_screen#0 ← ((byte*)) (number) $400
|
|
(byte*) print_line_cursor#0 ← (byte*) print_screen#0
|
|
(byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0
|
|
to:@43
|
|
print_word: scope:[print_word] from main::@21
|
|
(byte*) print_char_cursor#25 ← phi( main::@21/(byte*) print_char_cursor#27 )
|
|
(word) print_word::w#1 ← phi( main::@21/(word) print_word::w#0 )
|
|
(byte~) print_word::$0 ← > (word) print_word::w#1
|
|
(byte) print_byte::b#0 ← (byte~) print_word::$0
|
|
call print_byte
|
|
to:print_word::@1
|
|
print_word::@1: scope:[print_word] from print_word
|
|
(word) print_word::w#2 ← phi( print_word/(word) print_word::w#1 )
|
|
(byte*) print_char_cursor#13 ← phi( print_word/(byte*) print_char_cursor#6 )
|
|
(byte*) print_char_cursor#1 ← (byte*) print_char_cursor#13
|
|
(byte~) print_word::$2 ← < (word) print_word::w#2
|
|
(byte) print_byte::b#1 ← (byte~) print_word::$2
|
|
call print_byte
|
|
to:print_word::@2
|
|
print_word::@2: scope:[print_word] from print_word::@1
|
|
(byte*) print_char_cursor#14 ← phi( print_word::@1/(byte*) print_char_cursor#6 )
|
|
(byte*) print_char_cursor#2 ← (byte*) print_char_cursor#14
|
|
to:print_word::@return
|
|
print_word::@return: scope:[print_word] from print_word::@2
|
|
(byte*) print_char_cursor#15 ← phi( print_word::@2/(byte*) print_char_cursor#2 )
|
|
(byte*) print_char_cursor#3 ← (byte*) print_char_cursor#15
|
|
return
|
|
to:@return
|
|
@43: scope:[] from @26
|
|
(byte*) print_char_cursor#34 ← phi( @26/(byte*) print_char_cursor#0 )
|
|
(byte[]) print_hextab#0 ← (const string) $1
|
|
to:@50
|
|
print_byte: scope:[print_byte] from print_word print_word::@1
|
|
(byte*) print_char_cursor#26 ← phi( print_word/(byte*) print_char_cursor#25 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 )
|
|
(byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (number) 4
|
|
(byte) print_char::ch#0 ← *((byte[]) print_hextab#0 + (byte~) print_byte::$0)
|
|
call print_char
|
|
to:print_byte::@1
|
|
print_byte::@1: scope:[print_byte] from print_byte
|
|
(byte) print_byte::b#3 ← phi( print_byte/(byte) print_byte::b#2 )
|
|
(byte*) print_char_cursor#16 ← phi( print_byte/(byte*) print_char_cursor#8 )
|
|
(byte*) print_char_cursor#4 ← (byte*) print_char_cursor#16
|
|
(number~) print_byte::$2 ← (byte) print_byte::b#3 & (number) $f
|
|
(byte) print_char::ch#1 ← *((byte[]) print_hextab#0 + (number~) print_byte::$2)
|
|
call print_char
|
|
to:print_byte::@2
|
|
print_byte::@2: scope:[print_byte] from print_byte::@1
|
|
(byte*) print_char_cursor#17 ← phi( print_byte::@1/(byte*) print_char_cursor#8 )
|
|
(byte*) print_char_cursor#5 ← (byte*) print_char_cursor#17
|
|
to:print_byte::@return
|
|
print_byte::@return: scope:[print_byte] from print_byte::@2
|
|
(byte*) print_char_cursor#18 ← phi( print_byte::@2/(byte*) print_char_cursor#5 )
|
|
(byte*) print_char_cursor#6 ← (byte*) print_char_cursor#18
|
|
return
|
|
to:@return
|
|
print_char: scope:[print_char] from main::@30 print_byte print_byte::@1
|
|
(byte*) print_char_cursor#19 ← phi( main::@30/(byte*) print_char_cursor#9 print_byte/(byte*) print_char_cursor#26 print_byte::@1/(byte*) print_char_cursor#4 )
|
|
(byte) print_char::ch#3 ← phi( main::@30/(byte) print_char::ch#2 print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 )
|
|
*((byte*) print_char_cursor#19) ← (byte) print_char::ch#3
|
|
(byte*) print_char_cursor#7 ← ++ (byte*) print_char_cursor#19
|
|
to:print_char::@return
|
|
print_char::@return: scope:[print_char] from print_char
|
|
(byte*) print_char_cursor#20 ← phi( print_char/(byte*) print_char_cursor#7 )
|
|
(byte*) print_char_cursor#8 ← (byte*) print_char_cursor#20
|
|
return
|
|
to:@return
|
|
@50: scope:[] from @43
|
|
(byte*) print_char_cursor#33 ← phi( @43/(byte*) print_char_cursor#34 )
|
|
(byte*) SCREEN#0 ← ((byte*)) (number) $400
|
|
(word) COUNT#0 ← (number) $4000
|
|
(byte) SQRT_COUNT#0 ← (number) $80
|
|
(byte*) sieve#0 ← ((byte*)) (number) $1000
|
|
to:@51
|
|
main: scope:[main] from @51
|
|
(byte*) print_char_cursor#40 ← phi( @51/(byte*) print_char_cursor#29 )
|
|
(void*) memset::str#0 ← (void*)(byte*) sieve#0
|
|
(byte) memset::c#0 ← (number) 0
|
|
(word) memset::num#0 ← (word) COUNT#0
|
|
call memset
|
|
(void*) memset::return#2 ← (void*) memset::return#1
|
|
to:main::@29
|
|
main::@29: scope:[main] from main
|
|
(byte*) print_char_cursor#38 ← phi( main/(byte*) print_char_cursor#40 )
|
|
(word) main::i#0 ← (number) 2
|
|
(byte*~) main::$1 ← & *((byte*) sieve#0 + (word) main::i#0)
|
|
(byte*) main::sieve_i#0 ← (byte*~) main::$1
|
|
to:main::@1
|
|
main::@1: scope:[main] from main::@29 main::@4
|
|
(byte*) print_char_cursor#37 ← phi( main::@29/(byte*) print_char_cursor#38 main::@4/(byte*) print_char_cursor#39 )
|
|
(byte*) main::sieve_i#4 ← phi( main::@29/(byte*) main::sieve_i#0 main::@4/(byte*) main::sieve_i#1 )
|
|
(word) main::i#4 ← phi( main::@29/(word) main::i#0 main::@4/(word) main::i#2 )
|
|
(bool~) main::$2 ← (word) main::i#4 < (byte) SQRT_COUNT#0
|
|
if((bool~) main::$2) goto main::@2
|
|
to:main::@3
|
|
main::@2: scope:[main] from main::@1
|
|
(byte*) print_char_cursor#41 ← phi( main::@1/(byte*) print_char_cursor#37 )
|
|
(word) main::i#12 ← phi( main::@1/(word) main::i#4 )
|
|
(byte*) main::sieve_i#2 ← phi( main::@1/(byte*) main::sieve_i#4 )
|
|
(bool~) main::$17 ← (number) 0 != *((byte*) main::sieve_i#2)
|
|
(bool~) main::$3 ← ! (bool~) main::$17
|
|
(bool~) main::$4 ← ! (bool~) main::$3
|
|
if((bool~) main::$4) goto main::@4
|
|
to:main::@13
|
|
main::@3: scope:[main] from main::@1
|
|
(byte*) print_char_cursor#36 ← phi( main::@1/(byte*) print_char_cursor#37 )
|
|
(word) main::i#1 ← (number) 2
|
|
to:main::@15
|
|
main::@4: scope:[main] from main::@2 main::@5
|
|
(byte*) print_char_cursor#39 ← phi( main::@2/(byte*) print_char_cursor#41 main::@5/(byte*) print_char_cursor#42 )
|
|
(byte*) main::sieve_i#3 ← phi( main::@2/(byte*) main::sieve_i#2 main::@5/(byte*) main::sieve_i#5 )
|
|
(word) main::i#5 ← phi( main::@2/(word) main::i#12 main::@5/(word) main::i#13 )
|
|
(word) main::i#2 ← ++ (word) main::i#5
|
|
(byte*) main::sieve_i#1 ← ++ (byte*) main::sieve_i#3
|
|
to:main::@1
|
|
main::@13: scope:[main] from main::@2
|
|
(byte*) print_char_cursor#43 ← phi( main::@2/(byte*) print_char_cursor#41 )
|
|
(byte*) main::sieve_i#6 ← phi( main::@2/(byte*) main::sieve_i#2 )
|
|
(word) main::i#6 ← phi( main::@2/(word) main::i#12 )
|
|
(number~) main::$5 ← (word) main::i#6 * (number) 2
|
|
(word) main::j#0 ← (number~) main::$5
|
|
(byte*~) main::$6 ← & *((byte*) sieve#0 + (word) main::j#0)
|
|
(byte*) main::s#0 ← (byte*~) main::$6
|
|
to:main::@5
|
|
main::@5: scope:[main] from main::@13 main::@6
|
|
(byte*) print_char_cursor#42 ← phi( main::@13/(byte*) print_char_cursor#43 main::@6/(byte*) print_char_cursor#44 )
|
|
(byte*) main::s#3 ← phi( main::@13/(byte*) main::s#0 main::@6/(byte*) main::s#1 )
|
|
(byte*) main::sieve_i#5 ← phi( main::@13/(byte*) main::sieve_i#6 main::@6/(byte*) main::sieve_i#7 )
|
|
(word) main::i#13 ← phi( main::@13/(word) main::i#6 main::@6/(word) main::i#7 )
|
|
(word) main::j#2 ← phi( main::@13/(word) main::j#0 main::@6/(word) main::j#1 )
|
|
(bool~) main::$7 ← (word) main::j#2 < (word) COUNT#0
|
|
if((bool~) main::$7) goto main::@6
|
|
to:main::@4
|
|
main::@6: scope:[main] from main::@5
|
|
(byte*) print_char_cursor#44 ← phi( main::@5/(byte*) print_char_cursor#42 )
|
|
(byte*) main::sieve_i#7 ← phi( main::@5/(byte*) main::sieve_i#5 )
|
|
(word) main::j#3 ← phi( main::@5/(word) main::j#2 )
|
|
(word) main::i#7 ← phi( main::@5/(word) main::i#13 )
|
|
(byte*) main::s#2 ← phi( main::@5/(byte*) main::s#3 )
|
|
*((byte*) main::s#2) ← (number) 1
|
|
(byte*) main::s#1 ← (byte*) main::s#2 + (word) main::i#7
|
|
(word) main::j#1 ← (word) main::j#3 + (word) main::i#7
|
|
to:main::@5
|
|
main::@15: scope:[main] from main::@18 main::@3
|
|
(byte*) print_char_cursor#31 ← phi( main::@18/(byte*) print_char_cursor#35 main::@3/(byte*) print_char_cursor#36 )
|
|
(word) main::i#8 ← phi( main::@18/(word) main::i#3 main::@3/(word) main::i#1 )
|
|
(bool~) main::$8 ← (word) main::i#8 < (number) $4c7
|
|
if((bool~) main::$8) goto main::@16
|
|
to:main::@23
|
|
main::@16: scope:[main] from main::@15
|
|
(byte*) print_char_cursor#30 ← phi( main::@15/(byte*) print_char_cursor#31 )
|
|
(word) main::i#9 ← phi( main::@15/(word) main::i#8 )
|
|
(bool~) main::$18 ← (number) 0 != *((byte*) sieve#0 + (word) main::i#9)
|
|
(bool~) main::$9 ← ! (bool~) main::$18
|
|
(bool~) main::$10 ← ! (bool~) main::$9
|
|
if((bool~) main::$10) goto main::@18
|
|
to:main::@21
|
|
main::@18: scope:[main] from main::@16 main::@31
|
|
(byte*) print_char_cursor#35 ← phi( main::@16/(byte*) print_char_cursor#30 main::@31/(byte*) print_char_cursor#10 )
|
|
(word) main::i#10 ← phi( main::@16/(word) main::i#9 main::@31/(word) main::i#14 )
|
|
(word) main::i#3 ← ++ (word) main::i#10
|
|
to:main::@15
|
|
main::@21: scope:[main] from main::@16
|
|
(byte*) print_char_cursor#27 ← phi( main::@16/(byte*) print_char_cursor#30 )
|
|
(word) main::i#11 ← phi( main::@16/(word) main::i#9 )
|
|
(word) print_word::w#0 ← (word) main::i#11
|
|
call print_word
|
|
to:main::@30
|
|
main::@30: scope:[main] from main::@21
|
|
(word) main::i#15 ← phi( main::@21/(word) main::i#11 )
|
|
(byte*) print_char_cursor#21 ← phi( main::@21/(byte*) print_char_cursor#3 )
|
|
(byte*) print_char_cursor#9 ← (byte*) print_char_cursor#21
|
|
(byte) print_char::ch#2 ← (byte) ' '
|
|
call print_char
|
|
to:main::@31
|
|
main::@31: scope:[main] from main::@30
|
|
(word) main::i#14 ← phi( main::@30/(word) main::i#15 )
|
|
(byte*) print_char_cursor#22 ← phi( main::@30/(byte*) print_char_cursor#8 )
|
|
(byte*) print_char_cursor#10 ← (byte*) print_char_cursor#22
|
|
to:main::@18
|
|
main::@23: scope:[main] from main::@15 main::@24
|
|
(byte*) print_char_cursor#28 ← phi( main::@15/(byte*) print_char_cursor#31 main::@24/(byte*) print_char_cursor#32 )
|
|
if(true) goto main::@24
|
|
to:main::@return
|
|
main::@24: scope:[main] from main::@23
|
|
(byte*) print_char_cursor#32 ← phi( main::@23/(byte*) print_char_cursor#28 )
|
|
(byte*~) main::$16 ← (byte*) SCREEN#0 + (number) $3e7
|
|
*((byte*~) main::$16) ← ++ *((byte*~) main::$16)
|
|
to:main::@23
|
|
main::@return: scope:[main] from main::@23
|
|
(byte*) print_char_cursor#23 ← phi( main::@23/(byte*) print_char_cursor#28 )
|
|
(byte*) print_char_cursor#11 ← (byte*) print_char_cursor#23
|
|
return
|
|
to:@return
|
|
@51: scope:[] from @50
|
|
(byte*) print_char_cursor#29 ← phi( @50/(byte*) print_char_cursor#33 )
|
|
call main
|
|
to:@52
|
|
@52: scope:[] from @51
|
|
(byte*) print_char_cursor#24 ← phi( @51/(byte*) print_char_cursor#11 )
|
|
(byte*) print_char_cursor#12 ← (byte*) print_char_cursor#24
|
|
to:@end
|
|
@end: scope:[] from @52
|
|
|
|
SYMBOL TABLE SSA
|
|
(const string) $1 = (string) "0123456789abcdef"z
|
|
(label) @26
|
|
(label) @43
|
|
(label) @50
|
|
(label) @51
|
|
(label) @52
|
|
(label) @begin
|
|
(label) @end
|
|
(word) COUNT
|
|
(word) COUNT#0
|
|
(const byte) RADIX::BINARY = (number) 2
|
|
(const byte) RADIX::DECIMAL = (number) $a
|
|
(const byte) RADIX::HEXADECIMAL = (number) $10
|
|
(const byte) RADIX::OCTAL = (number) 8
|
|
(byte*) SCREEN
|
|
(byte*) SCREEN#0
|
|
(byte) SQRT_COUNT
|
|
(byte) SQRT_COUNT#0
|
|
(void()) main()
|
|
(byte*~) main::$1
|
|
(bool~) main::$10
|
|
(byte*~) main::$16
|
|
(bool~) main::$17
|
|
(bool~) main::$18
|
|
(bool~) main::$2
|
|
(bool~) main::$3
|
|
(bool~) main::$4
|
|
(number~) main::$5
|
|
(byte*~) main::$6
|
|
(bool~) main::$7
|
|
(bool~) main::$8
|
|
(bool~) main::$9
|
|
(label) main::@1
|
|
(label) main::@13
|
|
(label) main::@15
|
|
(label) main::@16
|
|
(label) main::@18
|
|
(label) main::@2
|
|
(label) main::@21
|
|
(label) main::@23
|
|
(label) main::@24
|
|
(label) main::@29
|
|
(label) main::@3
|
|
(label) main::@30
|
|
(label) main::@31
|
|
(label) main::@4
|
|
(label) main::@5
|
|
(label) main::@6
|
|
(label) main::@return
|
|
(word) main::i
|
|
(word) main::i#0
|
|
(word) main::i#1
|
|
(word) main::i#10
|
|
(word) main::i#11
|
|
(word) main::i#12
|
|
(word) main::i#13
|
|
(word) main::i#14
|
|
(word) main::i#15
|
|
(word) main::i#2
|
|
(word) main::i#3
|
|
(word) main::i#4
|
|
(word) main::i#5
|
|
(word) main::i#6
|
|
(word) main::i#7
|
|
(word) main::i#8
|
|
(word) main::i#9
|
|
(word) main::j
|
|
(word) main::j#0
|
|
(word) main::j#1
|
|
(word) main::j#2
|
|
(word) main::j#3
|
|
(byte*) main::s
|
|
(byte*) main::s#0
|
|
(byte*) main::s#1
|
|
(byte*) main::s#2
|
|
(byte*) main::s#3
|
|
(byte*) main::sieve_i
|
|
(byte*) main::sieve_i#0
|
|
(byte*) main::sieve_i#1
|
|
(byte*) main::sieve_i#2
|
|
(byte*) main::sieve_i#3
|
|
(byte*) main::sieve_i#4
|
|
(byte*) main::sieve_i#5
|
|
(byte*) main::sieve_i#6
|
|
(byte*) main::sieve_i#7
|
|
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
|
|
(bool~) memset::$0
|
|
(bool~) memset::$1
|
|
(byte*~) memset::$2
|
|
(byte*~) memset::$3
|
|
(bool~) memset::$4
|
|
(label) memset::@1
|
|
(label) memset::@2
|
|
(label) memset::@4
|
|
(label) memset::@5
|
|
(label) memset::@return
|
|
(byte) memset::c
|
|
(byte) memset::c#0
|
|
(byte) memset::c#1
|
|
(byte) memset::c#2
|
|
(byte) memset::c#3
|
|
(byte) memset::c#4
|
|
(byte*) memset::dst
|
|
(byte*) memset::dst#0
|
|
(byte*) memset::dst#1
|
|
(byte*) memset::dst#2
|
|
(byte*) memset::dst#3
|
|
(byte*) memset::end
|
|
(byte*) memset::end#0
|
|
(byte*) memset::end#1
|
|
(byte*) memset::end#2
|
|
(word) memset::num
|
|
(word) memset::num#0
|
|
(word) memset::num#1
|
|
(word) memset::num#2
|
|
(void*) memset::return
|
|
(void*) memset::return#0
|
|
(void*) memset::return#1
|
|
(void*) memset::return#2
|
|
(void*) memset::return#3
|
|
(void*) memset::str
|
|
(void*) memset::str#0
|
|
(void*) memset::str#1
|
|
(void*) memset::str#2
|
|
(void*) memset::str#3
|
|
(void*) memset::str#4
|
|
(void*) memset::str#5
|
|
(void()) print_byte((byte) print_byte::b)
|
|
(byte~) print_byte::$0
|
|
(number~) print_byte::$2
|
|
(label) print_byte::@1
|
|
(label) print_byte::@2
|
|
(label) print_byte::@return
|
|
(byte) print_byte::b
|
|
(byte) print_byte::b#0
|
|
(byte) print_byte::b#1
|
|
(byte) print_byte::b#2
|
|
(byte) print_byte::b#3
|
|
(void()) print_char((byte) print_char::ch)
|
|
(label) print_char::@return
|
|
(byte) print_char::ch
|
|
(byte) print_char::ch#0
|
|
(byte) print_char::ch#1
|
|
(byte) print_char::ch#2
|
|
(byte) print_char::ch#3
|
|
(byte*) print_char_cursor
|
|
(byte*) print_char_cursor#0
|
|
(byte*) print_char_cursor#1
|
|
(byte*) print_char_cursor#10
|
|
(byte*) print_char_cursor#11
|
|
(byte*) print_char_cursor#12
|
|
(byte*) print_char_cursor#13
|
|
(byte*) print_char_cursor#14
|
|
(byte*) print_char_cursor#15
|
|
(byte*) print_char_cursor#16
|
|
(byte*) print_char_cursor#17
|
|
(byte*) print_char_cursor#18
|
|
(byte*) print_char_cursor#19
|
|
(byte*) print_char_cursor#2
|
|
(byte*) print_char_cursor#20
|
|
(byte*) print_char_cursor#21
|
|
(byte*) print_char_cursor#22
|
|
(byte*) print_char_cursor#23
|
|
(byte*) print_char_cursor#24
|
|
(byte*) print_char_cursor#25
|
|
(byte*) print_char_cursor#26
|
|
(byte*) print_char_cursor#27
|
|
(byte*) print_char_cursor#28
|
|
(byte*) print_char_cursor#29
|
|
(byte*) print_char_cursor#3
|
|
(byte*) print_char_cursor#30
|
|
(byte*) print_char_cursor#31
|
|
(byte*) print_char_cursor#32
|
|
(byte*) print_char_cursor#33
|
|
(byte*) print_char_cursor#34
|
|
(byte*) print_char_cursor#35
|
|
(byte*) print_char_cursor#36
|
|
(byte*) print_char_cursor#37
|
|
(byte*) print_char_cursor#38
|
|
(byte*) print_char_cursor#39
|
|
(byte*) print_char_cursor#4
|
|
(byte*) print_char_cursor#40
|
|
(byte*) print_char_cursor#41
|
|
(byte*) print_char_cursor#42
|
|
(byte*) print_char_cursor#43
|
|
(byte*) print_char_cursor#44
|
|
(byte*) print_char_cursor#5
|
|
(byte*) print_char_cursor#6
|
|
(byte*) print_char_cursor#7
|
|
(byte*) print_char_cursor#8
|
|
(byte*) print_char_cursor#9
|
|
(byte[]) print_hextab
|
|
(byte[]) print_hextab#0
|
|
(byte*) print_line_cursor
|
|
(byte*) print_line_cursor#0
|
|
(byte*) print_screen
|
|
(byte*) print_screen#0
|
|
(void()) print_word((word) print_word::w)
|
|
(byte~) print_word::$0
|
|
(byte~) print_word::$2
|
|
(label) print_word::@1
|
|
(label) print_word::@2
|
|
(label) print_word::@return
|
|
(word) print_word::w
|
|
(word) print_word::w#0
|
|
(word) print_word::w#1
|
|
(word) print_word::w#2
|
|
(byte*) sieve
|
|
(byte*) sieve#0
|
|
|
|
Adding number conversion cast (unumber) 0 in (bool~) memset::$0 ← (word) memset::num#1 > (number) 0
|
|
Adding number conversion cast (unumber) 4 in (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (number) 4
|
|
Adding number conversion cast (unumber) $f in (number~) print_byte::$2 ← (byte) print_byte::b#3 & (number) $f
|
|
Adding number conversion cast (unumber) print_byte::$2 in (number~) print_byte::$2 ← (byte) print_byte::b#3 & (unumber)(number) $f
|
|
Adding number conversion cast (unumber) $4000 in (word) COUNT#0 ← (number) $4000
|
|
Adding number conversion cast (unumber) $80 in (byte) SQRT_COUNT#0 ← (number) $80
|
|
Adding number conversion cast (unumber) 0 in (byte) memset::c#0 ← (number) 0
|
|
Adding number conversion cast (unumber) 2 in (word) main::i#0 ← (number) 2
|
|
Adding number conversion cast (unumber) 0 in (bool~) main::$17 ← (number) 0 != *((byte*) main::sieve_i#2)
|
|
Adding number conversion cast (unumber) 2 in (word) main::i#1 ← (number) 2
|
|
Adding number conversion cast (unumber) 2 in (number~) main::$5 ← (word) main::i#6 * (number) 2
|
|
Adding number conversion cast (unumber) main::$5 in (number~) main::$5 ← (word) main::i#6 * (unumber)(number) 2
|
|
Adding number conversion cast (unumber) 1 in *((byte*) main::s#2) ← (number) 1
|
|
Adding number conversion cast (unumber) $4c7 in (bool~) main::$8 ← (word) main::i#8 < (number) $4c7
|
|
Adding number conversion cast (unumber) 0 in (bool~) main::$18 ← (number) 0 != *((byte*) sieve#0 + (word) main::i#9)
|
|
Adding number conversion cast (unumber) $3e7 in (byte*~) main::$16 ← (byte*) SCREEN#0 + (number) $3e7
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
Inlining cast (byte*~) memset::$2 ← (byte*)(void*) memset::str#2
|
|
Inlining cast (byte*) memset::dst#0 ← (byte*)(void*) memset::str#2
|
|
Inlining cast (byte*) print_screen#0 ← (byte*)(number) $400
|
|
Inlining cast (byte*) SCREEN#0 ← (byte*)(number) $400
|
|
Inlining cast (word) COUNT#0 ← (unumber)(number) $4000
|
|
Inlining cast (byte) SQRT_COUNT#0 ← (unumber)(number) $80
|
|
Inlining cast (byte*) sieve#0 ← (byte*)(number) $1000
|
|
Inlining cast (byte) memset::c#0 ← (unumber)(number) 0
|
|
Inlining cast (word) main::i#0 ← (unumber)(number) 2
|
|
Inlining cast (word) main::i#1 ← (unumber)(number) 2
|
|
Inlining cast *((byte*) main::s#2) ← (unumber)(number) 1
|
|
Successful SSA optimization Pass2InlineCast
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant pointer cast (byte*) 1024
|
|
Simplifying constant integer cast 4
|
|
Simplifying constant integer cast $f
|
|
Simplifying constant pointer cast (byte*) 1024
|
|
Simplifying constant integer cast $4000
|
|
Simplifying constant integer cast $80
|
|
Simplifying constant pointer cast (byte*) 4096
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 2
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 2
|
|
Simplifying constant integer cast 2
|
|
Simplifying constant integer cast 1
|
|
Simplifying constant integer cast $4c7
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast $3e7
|
|
Successful SSA optimization PassNCastSimplification
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (byte) 4
|
|
Finalized unsigned number type (byte) $f
|
|
Finalized unsigned number type (word) $4000
|
|
Finalized unsigned number type (byte) $80
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (byte) 2
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (byte) 2
|
|
Finalized unsigned number type (byte) 2
|
|
Finalized unsigned number type (byte) 1
|
|
Finalized unsigned number type (word) $4c7
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (word) $3e7
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
Inferred type updated to byte in (unumber~) print_byte::$2 ← (byte) print_byte::b#3 & (byte) $f
|
|
Inferred type updated to word in (unumber~) main::$5 ← (word) main::i#6 * (byte) 2
|
|
Inversing boolean not [2] (bool~) memset::$1 ← (word) memset::num#1 <= (byte) 0 from [1] (bool~) memset::$0 ← (word) memset::num#1 > (byte) 0
|
|
Inversing boolean not [79] (bool~) main::$3 ← (byte) 0 == *((byte*) main::sieve_i#2) from [78] (bool~) main::$17 ← (byte) 0 != *((byte*) main::sieve_i#2)
|
|
Inversing boolean not [80] (bool~) main::$4 ← (byte) 0 != *((byte*) main::sieve_i#2) from [79] (bool~) main::$3 ← (byte) 0 == *((byte*) main::sieve_i#2)
|
|
Inversing boolean not [104] (bool~) main::$9 ← (byte) 0 == *((byte*) sieve#0 + (word) main::i#9) from [103] (bool~) main::$18 ← (byte) 0 != *((byte*) sieve#0 + (word) main::i#9)
|
|
Inversing boolean not [105] (bool~) main::$10 ← (byte) 0 != *((byte*) sieve#0 + (word) main::i#9) from [104] (bool~) main::$9 ← (byte) 0 == *((byte*) sieve#0 + (word) main::i#9)
|
|
Successful SSA optimization Pass2UnaryNotSimplification
|
|
Alias (void*) memset::return#0 = (void*) memset::str#1 (void*) memset::return#3 (void*) memset::return#1
|
|
Alias (void*) memset::str#2 = (void*) memset::str#3
|
|
Alias (word) memset::num#1 = (word) memset::num#2
|
|
Alias (byte) memset::c#3 = (byte) memset::c#4
|
|
Alias (byte*) memset::end#0 = (byte*~) memset::$3
|
|
Alias (byte) memset::c#1 = (byte) memset::c#2
|
|
Alias (byte*) memset::dst#2 = (byte*) memset::dst#3
|
|
Alias (byte*) memset::end#1 = (byte*) memset::end#2
|
|
Alias (void*) memset::str#4 = (void*) memset::str#5
|
|
Alias (byte*) print_char_cursor#0 = (byte*) print_line_cursor#0 (byte*) print_screen#0 (byte*) print_char_cursor#34 (byte*) print_char_cursor#33 (byte*) print_char_cursor#29
|
|
Alias (byte) print_byte::b#0 = (byte~) print_word::$0
|
|
Alias (word) print_word::w#1 = (word) print_word::w#2
|
|
Alias (byte*) print_char_cursor#1 = (byte*) print_char_cursor#13
|
|
Alias (byte) print_byte::b#1 = (byte~) print_word::$2
|
|
Alias (byte*) print_char_cursor#14 = (byte*) print_char_cursor#2 (byte*) print_char_cursor#15 (byte*) print_char_cursor#3
|
|
Alias (byte) print_byte::b#2 = (byte) print_byte::b#3
|
|
Alias (byte*) print_char_cursor#16 = (byte*) print_char_cursor#4
|
|
Alias (byte*) print_char_cursor#17 = (byte*) print_char_cursor#5 (byte*) print_char_cursor#18 (byte*) print_char_cursor#6
|
|
Alias (byte*) print_char_cursor#20 = (byte*) print_char_cursor#7 (byte*) print_char_cursor#8
|
|
Alias (byte*) print_char_cursor#38 = (byte*) print_char_cursor#40
|
|
Alias (byte*) main::sieve_i#0 = (byte*~) main::$1
|
|
Alias (byte*) main::sieve_i#2 = (byte*) main::sieve_i#4 (byte*) main::sieve_i#6
|
|
Alias (word) main::i#12 = (word) main::i#4 (word) main::i#6
|
|
Alias (byte*) print_char_cursor#36 = (byte*) print_char_cursor#41 (byte*) print_char_cursor#37 (byte*) print_char_cursor#43
|
|
Alias (word) main::j#0 = (word~) main::$5
|
|
Alias (byte*) main::s#0 = (byte*~) main::$6
|
|
Alias (byte*) main::s#2 = (byte*) main::s#3
|
|
Alias (word) main::i#13 = (word) main::i#7
|
|
Alias (word) main::j#2 = (word) main::j#3
|
|
Alias (byte*) main::sieve_i#5 = (byte*) main::sieve_i#7
|
|
Alias (byte*) print_char_cursor#42 = (byte*) print_char_cursor#44
|
|
Alias (word) main::i#11 = (word) main::i#9 (word) main::i#8 (word) main::i#15 (word) main::i#14
|
|
Alias (byte*) print_char_cursor#27 = (byte*) print_char_cursor#30 (byte*) print_char_cursor#31
|
|
Alias (byte*) print_char_cursor#21 = (byte*) print_char_cursor#9
|
|
Alias (byte*) print_char_cursor#10 = (byte*) print_char_cursor#22
|
|
Alias (byte*) print_char_cursor#11 = (byte*) print_char_cursor#32 (byte*) print_char_cursor#28 (byte*) print_char_cursor#23
|
|
Alias (byte*) print_char_cursor#12 = (byte*) print_char_cursor#24
|
|
Successful SSA optimization Pass2AliasElimination
|
|
Alias (word) main::i#10 = (word) main::i#11
|
|
Successful SSA optimization Pass2AliasElimination
|
|
Identical Phi Values (word) memset::num#1 (word) memset::num#0
|
|
Identical Phi Values (void*) memset::str#2 (void*) memset::str#0
|
|
Identical Phi Values (byte) memset::c#3 (byte) memset::c#0
|
|
Identical Phi Values (byte*) memset::end#1 (byte*) memset::end#0
|
|
Identical Phi Values (void*) memset::str#4 (void*) memset::str#2
|
|
Identical Phi Values (byte) memset::c#1 (byte) memset::c#3
|
|
Identical Phi Values (word) print_word::w#1 (word) print_word::w#0
|
|
Identical Phi Values (byte*) print_char_cursor#25 (byte*) print_char_cursor#27
|
|
Identical Phi Values (byte*) print_char_cursor#1 (byte*) print_char_cursor#17
|
|
Identical Phi Values (byte*) print_char_cursor#14 (byte*) print_char_cursor#17
|
|
Identical Phi Values (byte*) print_char_cursor#16 (byte*) print_char_cursor#20
|
|
Identical Phi Values (byte*) print_char_cursor#17 (byte*) print_char_cursor#20
|
|
Identical Phi Values (byte*) print_char_cursor#38 (byte*) print_char_cursor#0
|
|
Identical Phi Values (word) main::i#13 (word) main::i#12
|
|
Identical Phi Values (byte*) main::sieve_i#5 (byte*) main::sieve_i#2
|
|
Identical Phi Values (byte*) print_char_cursor#42 (byte*) print_char_cursor#36
|
|
Identical Phi Values (byte*) print_char_cursor#21 (byte*) print_char_cursor#14
|
|
Identical Phi Values (byte*) print_char_cursor#10 (byte*) print_char_cursor#20
|
|
Identical Phi Values (byte*) print_char_cursor#11 (byte*) print_char_cursor#27
|
|
Identical Phi Values (byte*) print_char_cursor#12 (byte*) print_char_cursor#11
|
|
Successful SSA optimization Pass2IdenticalPhiElimination
|
|
Identical Phi Values (void*) memset::return#0 (void*) memset::str#0
|
|
Identical Phi Values (word) main::i#5 (word) main::i#12
|
|
Identical Phi Values (byte*) main::sieve_i#3 (byte*) main::sieve_i#2
|
|
Identical Phi Values (byte*) print_char_cursor#39 (byte*) print_char_cursor#36
|
|
Successful SSA optimization Pass2IdenticalPhiElimination
|
|
Identical Phi Values (byte*) print_char_cursor#36 (byte*) print_char_cursor#0
|
|
Successful SSA optimization Pass2IdenticalPhiElimination
|
|
Simple Condition (bool~) memset::$1 [3] if((word) memset::num#0<=(byte) 0) goto memset::@1
|
|
Simple Condition (bool~) memset::$4 [13] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@5
|
|
Simple Condition (bool~) main::$2 [76] if((word) main::i#12<(byte) SQRT_COUNT#0) goto main::@2
|
|
Simple Condition (bool~) main::$4 [81] if((byte) 0!=*((byte*) main::sieve_i#2)) goto main::@4
|
|
Simple Condition (bool~) main::$7 [94] if((word) main::j#2<(word) COUNT#0) goto main::@6
|
|
Simple Condition (bool~) main::$8 [101] if((word) main::i#10<(word) $4c7) goto main::@16
|
|
Simple Condition (bool~) main::$10 [106] if((byte) 0!=*((byte*) sieve#0 + (word) main::i#10)) goto main::@18
|
|
Successful SSA optimization Pass2ConditionalJumpSimplification
|
|
Rewriting array member address-of to pointer addition [72] (byte*) main::sieve_i#0 ← (byte*) sieve#0 + (word) main::i#0
|
|
Rewriting array member address-of to pointer addition [90] (byte*) main::s#0 ← (byte*) sieve#0 + (word) main::j#0
|
|
Successful SSA optimization PassNArrayElementAddressOfRewriting
|
|
Constant (const byte*) print_char_cursor#0 = (byte*) 1024
|
|
Constant (const byte[]) print_hextab#0 = $1
|
|
Constant (const byte*) SCREEN#0 = (byte*) 1024
|
|
Constant (const word) COUNT#0 = $4000
|
|
Constant (const byte) SQRT_COUNT#0 = $80
|
|
Constant (const byte*) sieve#0 = (byte*) 4096
|
|
Constant (const byte) memset::c#0 = 0
|
|
Constant (const word) main::i#0 = 2
|
|
Constant (const word) main::i#1 = 2
|
|
Constant (const byte) print_char::ch#2 = ' '
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant (const word) memset::num#0 = COUNT#0
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant value identified (void*)sieve#0 in [65] (void*) memset::str#0 ← (void*)(const byte*) sieve#0
|
|
Successful SSA optimization Pass2ConstantValues
|
|
if() condition always false - eliminating [3] if((const word) memset::num#0<=(byte) 0) goto memset::@1
|
|
if() condition always true - replacing block destination [119] if(true) goto main::@24
|
|
Successful SSA optimization Pass2ConstantIfs
|
|
De-inlining pointer[w] to *(pointer+w) [106] if((byte) 0!=*((const byte*) sieve#0 + (word) main::i#10)) goto main::@18
|
|
Successful SSA optimization Pass2DeInlineWordDerefIdx
|
|
Eliminating unused variable (void*) memset::return#2 and assignment [27] (void*) memset::return#2 ← (void*) memset::str#0
|
|
Successful SSA optimization PassNEliminateUnusedVars
|
|
Removing unused block main::@return
|
|
Successful SSA optimization Pass2EliminateUnusedBlocks
|
|
Constant right-side identified [27] (byte*) main::sieve_i#0 ← (const byte*) sieve#0 + (const word) main::i#0
|
|
Constant right-side identified [49] (byte*~) main::$16 ← (const byte*) SCREEN#0 + (word) $3e7
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant (const void*) memset::str#0 = (void*)sieve#0
|
|
Constant (const byte*) main::sieve_i#0 = sieve#0+main::i#0
|
|
Constant (const byte*) main::$16 = SCREEN#0+$3e7
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant value identified (byte*)memset::str#0 in [0] (byte*~) memset::$2 ← (byte*)(const void*) memset::str#0
|
|
Constant value identified (byte*)memset::str#0 in [2] (byte*) memset::dst#0 ← (byte*)(const void*) memset::str#0
|
|
Successful SSA optimization Pass2ConstantValues
|
|
Constant (const byte*) memset::$2 = (byte*)memset::str#0
|
|
Constant (const byte*) memset::dst#0 = (byte*)memset::str#0
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [0] (byte*) memset::end#0 ← (const byte*) memset::$2 + (const word) memset::num#0
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant (const byte*) memset::end#0 = memset::$2+memset::num#0
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Rewriting multiplication to use shift [28] (word) main::j#0 ← (word) main::i#12 * (byte) 2
|
|
Successful SSA optimization Pass2MultiplyToShiftRewriting
|
|
Inlining constant with var siblings (const byte*) memset::dst#0
|
|
Inlining constant with var siblings (const byte) print_char::ch#2
|
|
Inlining constant with var siblings (const word) main::i#0
|
|
Inlining constant with var siblings (const word) main::i#1
|
|
Inlining constant with var siblings (const byte*) main::sieve_i#0
|
|
Inlining constant with var siblings (const byte*) print_char_cursor#0
|
|
Constant inlined print_char::ch#2 = (byte) ' '
|
|
Constant inlined print_char_cursor#0 = (byte*) 1024
|
|
Constant inlined memset::$2 = (byte*)(const void*) memset::str#0
|
|
Constant inlined main::$16 = (const byte*) SCREEN#0+(word) $3e7
|
|
Constant inlined main::i#0 = (byte) 2
|
|
Constant inlined memset::dst#0 = (byte*)(const void*) memset::str#0
|
|
Constant inlined memset::num#0 = (const word) COUNT#0
|
|
Constant inlined main::i#1 = (byte) 2
|
|
Constant inlined $1 = (const byte[]) print_hextab#0
|
|
Constant inlined main::sieve_i#0 = (const byte*) sieve#0+(byte) 2
|
|
Successful SSA optimization Pass2ConstantInlining
|
|
Added new block during phi lifting main::@32(between main::@16 and main::@18)
|
|
Adding NOP phi() at start of @begin
|
|
Adding NOP phi() at start of @26
|
|
Adding NOP phi() at start of @43
|
|
Adding NOP phi() at start of @50
|
|
Adding NOP phi() at start of @51
|
|
Adding NOP phi() at start of @52
|
|
Adding NOP phi() at start of @end
|
|
Adding NOP phi() at start of main
|
|
Adding NOP phi() at start of main::@29
|
|
Adding NOP phi() at start of main::@3
|
|
Adding NOP phi() at start of main::@23
|
|
Adding NOP phi() at start of print_word::@2
|
|
Adding NOP phi() at start of print_byte::@2
|
|
Adding NOP phi() at start of memset
|
|
Adding NOP phi() at start of memset::@2
|
|
Adding NOP phi() at start of memset::@1
|
|
CALL GRAPH
|
|
Calls in [] to main:5
|
|
Calls in [main] to memset:9 print_word:21 print_char:23
|
|
Calls in [print_word] to print_byte:53 print_byte:57
|
|
Calls in [print_byte] to print_char:65 print_char:70
|
|
|
|
Created 12 initial phi equivalence classes
|
|
Coalesced [22] print_char_cursor#47 ← print_char_cursor#20
|
|
Coalesced [24] print_char_cursor#52 ← print_char_cursor#20
|
|
Coalesced [27] main::i#17 ← main::i#3
|
|
Coalesced [28] print_char_cursor#50 ← print_char_cursor#35
|
|
Coalesced (already) [29] print_char_cursor#51 ← print_char_cursor#27
|
|
Coalesced [33] main::j#4 ← main::j#0
|
|
Coalesced [34] main::s#4 ← main::s#0
|
|
Coalesced [39] main::i#16 ← main::i#2
|
|
Coalesced [40] main::sieve_i#8 ← main::sieve_i#1
|
|
Coalesced [44] main::j#5 ← main::j#1
|
|
Coalesced [45] main::s#5 ← main::s#1
|
|
Coalesced [51] print_byte::b#4 ← print_byte::b#0
|
|
Coalesced [52] print_char_cursor#45 ← print_char_cursor#27
|
|
Coalesced [55] print_byte::b#5 ← print_byte::b#1
|
|
Coalesced (already) [56] print_char_cursor#46 ← print_char_cursor#20
|
|
Coalesced [63] print_char::ch#4 ← print_char::ch#0
|
|
Coalesced (already) [64] print_char_cursor#48 ← print_char_cursor#26
|
|
Coalesced [68] print_char::ch#5 ← print_char::ch#1
|
|
Coalesced (already) [69] print_char_cursor#49 ← print_char_cursor#20
|
|
Coalesced [81] memset::dst#4 ← memset::dst#1
|
|
Coalesced down to 9 phi equivalence classes
|
|
Culled Empty Block (label) @26
|
|
Culled Empty Block (label) @43
|
|
Culled Empty Block (label) @50
|
|
Culled Empty Block (label) @52
|
|
Culled Empty Block (label) main::@29
|
|
Culled Empty Block (label) main::@3
|
|
Culled Empty Block (label) main::@23
|
|
Culled Empty Block (label) main::@31
|
|
Culled Empty Block (label) main::@32
|
|
Culled Empty Block (label) print_word::@2
|
|
Culled Empty Block (label) print_byte::@2
|
|
Culled Empty Block (label) memset::@2
|
|
Culled Empty Block (label) memset::@1
|
|
Renumbering block @51 to @1
|
|
Renumbering block memset::@4 to memset::@1
|
|
Renumbering block memset::@5 to memset::@2
|
|
Renumbering block main::@4 to main::@3
|
|
Renumbering block main::@5 to main::@4
|
|
Renumbering block main::@6 to main::@5
|
|
Renumbering block main::@13 to main::@6
|
|
Renumbering block main::@15 to main::@7
|
|
Renumbering block main::@16 to main::@8
|
|
Renumbering block main::@18 to main::@9
|
|
Renumbering block main::@21 to main::@10
|
|
Renumbering block main::@24 to main::@11
|
|
Renumbering block main::@30 to main::@12
|
|
Adding NOP phi() at start of @begin
|
|
Adding NOP phi() at start of @1
|
|
Adding NOP phi() at start of @end
|
|
Adding NOP phi() at start of main
|
|
Adding NOP phi() at start of main::@12
|
|
Adding NOP phi() at start of memset
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
@begin: scope:[] from
|
|
[0] phi()
|
|
to:@1
|
|
@1: scope:[] from @begin
|
|
[1] phi()
|
|
[2] call main
|
|
to:@end
|
|
@end: scope:[] from @1
|
|
[3] phi()
|
|
main: scope:[main] from @1
|
|
[4] phi()
|
|
[5] call memset
|
|
to:main::@1
|
|
main::@1: scope:[main] from main main::@3
|
|
[6] (byte*) main::sieve_i#2 ← phi( main/(const byte*) sieve#0+(byte) 2 main::@3/(byte*) main::sieve_i#1 )
|
|
[6] (word) main::i#12 ← phi( main/(byte) 2 main::@3/(word) main::i#2 )
|
|
[7] if((word) main::i#12<(const byte) SQRT_COUNT#0) goto main::@2
|
|
to:main::@7
|
|
main::@7: scope:[main] from main::@1 main::@9
|
|
[8] (byte*) print_char_cursor#27 ← phi( main::@9/(byte*) print_char_cursor#35 main::@1/(byte*) 1024 )
|
|
[8] (word) main::i#10 ← phi( main::@9/(word) main::i#3 main::@1/(byte) 2 )
|
|
[9] if((word) main::i#10<(word) $4c7) goto main::@8
|
|
to:main::@11
|
|
main::@11: scope:[main] from main::@11 main::@7
|
|
[10] *((const byte*) SCREEN#0+(word) $3e7) ← ++ *((const byte*) SCREEN#0+(word) $3e7)
|
|
to:main::@11
|
|
main::@8: scope:[main] from main::@7
|
|
[11] (byte*~) main::$19 ← (const byte*) sieve#0 + (word) main::i#10
|
|
[12] if((byte) 0!=*((byte*~) main::$19)) goto main::@9
|
|
to:main::@10
|
|
main::@10: scope:[main] from main::@8
|
|
[13] (word) print_word::w#0 ← (word) main::i#10
|
|
[14] call print_word
|
|
to:main::@12
|
|
main::@12: scope:[main] from main::@10
|
|
[15] phi()
|
|
[16] call print_char
|
|
to:main::@9
|
|
main::@9: scope:[main] from main::@12 main::@8
|
|
[17] (byte*) print_char_cursor#35 ← phi( main::@8/(byte*) print_char_cursor#27 main::@12/(byte*) print_char_cursor#20 )
|
|
[18] (word) main::i#3 ← ++ (word) main::i#10
|
|
to:main::@7
|
|
main::@2: scope:[main] from main::@1
|
|
[19] if((byte) 0!=*((byte*) main::sieve_i#2)) goto main::@3
|
|
to:main::@6
|
|
main::@6: scope:[main] from main::@2
|
|
[20] (word) main::j#0 ← (word) main::i#12 << (byte) 1
|
|
[21] (byte*) main::s#0 ← (const byte*) sieve#0 + (word) main::j#0
|
|
to:main::@4
|
|
main::@4: scope:[main] from main::@5 main::@6
|
|
[22] (byte*) main::s#2 ← phi( main::@6/(byte*) main::s#0 main::@5/(byte*) main::s#1 )
|
|
[22] (word) main::j#2 ← phi( main::@6/(word) main::j#0 main::@5/(word) main::j#1 )
|
|
[23] if((word) main::j#2<(const word) COUNT#0) goto main::@5
|
|
to:main::@3
|
|
main::@3: scope:[main] from main::@2 main::@4
|
|
[24] (word) main::i#2 ← ++ (word) main::i#12
|
|
[25] (byte*) main::sieve_i#1 ← ++ (byte*) main::sieve_i#2
|
|
to:main::@1
|
|
main::@5: scope:[main] from main::@4
|
|
[26] *((byte*) main::s#2) ← (byte) 1
|
|
[27] (byte*) main::s#1 ← (byte*) main::s#2 + (word) main::i#12
|
|
[28] (word) main::j#1 ← (word) main::j#2 + (word) main::i#12
|
|
to:main::@4
|
|
print_char: scope:[print_char] from main::@12 print_byte print_byte::@1
|
|
[29] (byte*) print_char_cursor#19 ← phi( main::@12/(byte*) print_char_cursor#20 print_byte/(byte*) print_char_cursor#26 print_byte::@1/(byte*) print_char_cursor#20 )
|
|
[29] (byte) print_char::ch#3 ← phi( main::@12/(byte) ' ' print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 )
|
|
[30] *((byte*) print_char_cursor#19) ← (byte) print_char::ch#3
|
|
[31] (byte*) print_char_cursor#20 ← ++ (byte*) print_char_cursor#19
|
|
to:print_char::@return
|
|
print_char::@return: scope:[print_char] from print_char
|
|
[32] return
|
|
to:@return
|
|
print_word: scope:[print_word] from main::@10
|
|
[33] (byte) print_byte::b#0 ← > (word) print_word::w#0
|
|
[34] call print_byte
|
|
to:print_word::@1
|
|
print_word::@1: scope:[print_word] from print_word
|
|
[35] (byte) print_byte::b#1 ← < (word) print_word::w#0
|
|
[36] call print_byte
|
|
to:print_word::@return
|
|
print_word::@return: scope:[print_word] from print_word::@1
|
|
[37] return
|
|
to:@return
|
|
print_byte: scope:[print_byte] from print_word print_word::@1
|
|
[38] (byte*) print_char_cursor#26 ← phi( print_word/(byte*) print_char_cursor#27 print_word::@1/(byte*) print_char_cursor#20 )
|
|
[38] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 )
|
|
[39] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4
|
|
[40] (byte) print_char::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte::$0)
|
|
[41] call print_char
|
|
to:print_byte::@1
|
|
print_byte::@1: scope:[print_byte] from print_byte
|
|
[42] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f
|
|
[43] (byte) print_char::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte::$2)
|
|
[44] call print_char
|
|
to:print_byte::@return
|
|
print_byte::@return: scope:[print_byte] from print_byte::@1
|
|
[45] return
|
|
to:@return
|
|
memset: scope:[memset] from main
|
|
[46] phi()
|
|
to:memset::@1
|
|
memset::@1: scope:[memset] from memset memset::@2
|
|
[47] (byte*) memset::dst#2 ← phi( memset/(byte*)(const void*) memset::str#0 memset::@2/(byte*) memset::dst#1 )
|
|
[48] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2
|
|
to:memset::@return
|
|
memset::@return: scope:[memset] from memset::@1
|
|
[49] return
|
|
to:@return
|
|
memset::@2: scope:[memset] from memset::@1
|
|
[50] *((byte*) memset::dst#2) ← (const byte) memset::c#0
|
|
[51] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2
|
|
to:memset::@1
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
(word) COUNT
|
|
(byte*) SCREEN
|
|
(byte) SQRT_COUNT
|
|
(void()) main()
|
|
(byte*~) main::$19 22.0
|
|
(word) main::i
|
|
(word) main::i#10 6.111111111111112
|
|
(word) main::i#12 24.6
|
|
(word) main::i#2 11.0
|
|
(word) main::i#3 22.0
|
|
(word) main::j
|
|
(word) main::j#0 16.5
|
|
(word) main::j#1 202.0
|
|
(word) main::j#2 78.5
|
|
(byte*) main::s
|
|
(byte*) main::s#0 22.0
|
|
(byte*) main::s#1 101.0
|
|
(byte*) main::s#2 104.66666666666666
|
|
(byte*) main::sieve_i
|
|
(byte*) main::sieve_i#1 22.0
|
|
(byte*) main::sieve_i#2 3.0
|
|
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
|
|
(byte) memset::c
|
|
(byte*) memset::dst
|
|
(byte*) memset::dst#1 22.0
|
|
(byte*) memset::dst#2 14.666666666666666
|
|
(byte*) memset::end
|
|
(word) memset::num
|
|
(void*) memset::return
|
|
(void*) memset::str
|
|
(void()) print_byte((byte) print_byte::b)
|
|
(byte~) print_byte::$0 4.0
|
|
(byte~) print_byte::$2 4.0
|
|
(byte) print_byte::b
|
|
(byte) print_byte::b#0 4.0
|
|
(byte) print_byte::b#1 4.0
|
|
(byte) print_byte::b#2 2.0
|
|
(void()) print_char((byte) print_char::ch)
|
|
(byte) print_char::ch
|
|
(byte) print_char::ch#0 4.0
|
|
(byte) print_char::ch#1 4.0
|
|
(byte) print_char::ch#3 6.0
|
|
(byte*) print_char_cursor
|
|
(byte*) print_char_cursor#19 9.5
|
|
(byte*) print_char_cursor#20 1.9999999999999998
|
|
(byte*) print_char_cursor#26 2.0
|
|
(byte*) print_char_cursor#27 4.0
|
|
(byte*) print_char_cursor#35 16.5
|
|
(byte[]) print_hextab
|
|
(byte*) print_line_cursor
|
|
(byte*) print_screen
|
|
(void()) print_word((word) print_word::w)
|
|
(word) print_word::w
|
|
(word) print_word::w#0 5.0
|
|
(byte*) sieve
|
|
|
|
Initial phi equivalence classes
|
|
[ main::i#12 main::i#2 ]
|
|
[ main::sieve_i#2 main::sieve_i#1 ]
|
|
[ main::i#10 main::i#3 ]
|
|
[ main::j#2 main::j#0 main::j#1 ]
|
|
[ main::s#2 main::s#0 main::s#1 ]
|
|
[ print_char::ch#3 print_char::ch#0 print_char::ch#1 ]
|
|
[ print_char_cursor#19 print_char_cursor#27 print_char_cursor#35 print_char_cursor#20 print_char_cursor#26 ]
|
|
[ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
|
|
[ memset::dst#2 memset::dst#1 ]
|
|
Added variable main::$19 to zero page equivalence class [ main::$19 ]
|
|
Added variable print_word::w#0 to zero page equivalence class [ print_word::w#0 ]
|
|
Added variable print_byte::$0 to zero page equivalence class [ print_byte::$0 ]
|
|
Added variable print_byte::$2 to zero page equivalence class [ print_byte::$2 ]
|
|
Complete equivalence classes
|
|
[ main::i#12 main::i#2 ]
|
|
[ main::sieve_i#2 main::sieve_i#1 ]
|
|
[ main::i#10 main::i#3 ]
|
|
[ main::j#2 main::j#0 main::j#1 ]
|
|
[ main::s#2 main::s#0 main::s#1 ]
|
|
[ print_char::ch#3 print_char::ch#0 print_char::ch#1 ]
|
|
[ print_char_cursor#19 print_char_cursor#27 print_char_cursor#35 print_char_cursor#20 print_char_cursor#26 ]
|
|
[ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
|
|
[ memset::dst#2 memset::dst#1 ]
|
|
[ main::$19 ]
|
|
[ print_word::w#0 ]
|
|
[ print_byte::$0 ]
|
|
[ print_byte::$2 ]
|
|
Allocated zp ZP_WORD:2 [ main::i#12 main::i#2 ]
|
|
Allocated zp ZP_WORD:4 [ main::sieve_i#2 main::sieve_i#1 ]
|
|
Allocated zp ZP_WORD:6 [ main::i#10 main::i#3 ]
|
|
Allocated zp ZP_WORD:8 [ main::j#2 main::j#0 main::j#1 ]
|
|
Allocated zp ZP_WORD:10 [ main::s#2 main::s#0 main::s#1 ]
|
|
Allocated zp ZP_BYTE:12 [ print_char::ch#3 print_char::ch#0 print_char::ch#1 ]
|
|
Allocated zp ZP_WORD:13 [ print_char_cursor#19 print_char_cursor#27 print_char_cursor#35 print_char_cursor#20 print_char_cursor#26 ]
|
|
Allocated zp ZP_BYTE:15 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
|
|
Allocated zp ZP_WORD:16 [ memset::dst#2 memset::dst#1 ]
|
|
Allocated zp ZP_WORD:18 [ main::$19 ]
|
|
Allocated zp ZP_WORD:20 [ print_word::w#0 ]
|
|
Allocated zp ZP_BYTE:22 [ print_byte::$0 ]
|
|
Allocated zp ZP_BYTE:23 [ print_byte::$2 ]
|
|
|
|
INITIAL ASM
|
|
Target platform is c64basic / MOS6502X
|
|
// File Comments
|
|
// Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(bbegin)
|
|
.pc = $80d "Program"
|
|
// Global Constants & labels
|
|
.label SCREEN = $400
|
|
.const COUNT = $4000
|
|
/* Up to what number? */
|
|
.const SQRT_COUNT = $80
|
|
/* Sqrt of COUNT */
|
|
.label sieve = $1000
|
|
.label print_char_cursor = $d
|
|
// @begin
|
|
bbegin:
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
|
b1_from_bbegin:
|
|
jmp b1
|
|
// @1
|
|
b1:
|
|
// [2] call main
|
|
// [4] phi from @1 to main [phi:@1->main]
|
|
main_from_b1:
|
|
jsr main
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
|
bend_from_b1:
|
|
jmp bend
|
|
// @end
|
|
bend:
|
|
// main
|
|
main: {
|
|
.label i = 2
|
|
.label sieve_i = 4
|
|
.label j = 8
|
|
.label s = $a
|
|
.label i_3 = 6
|
|
.label i_10 = 6
|
|
.label _19 = $12
|
|
// [5] call memset
|
|
// [46] phi from main to memset [phi:main->memset]
|
|
memset_from_main:
|
|
jsr memset
|
|
// [6] phi from main to main::@1 [phi:main->main::@1]
|
|
b1_from_main:
|
|
// [6] phi (byte*) main::sieve_i#2 = (const byte*) sieve#0+(byte) 2 [phi:main->main::@1#0] -- pbuz1=pbuc1
|
|
lda #<sieve+2
|
|
sta.z sieve_i
|
|
lda #>sieve+2
|
|
sta.z sieve_i+1
|
|
// [6] phi (word) main::i#12 = (byte) 2 [phi:main->main::@1#1] -- vwuz1=vbuc1
|
|
lda #<2
|
|
sta.z i
|
|
lda #>2
|
|
sta.z i+1
|
|
jmp b1
|
|
// main::@1
|
|
b1:
|
|
// [7] if((word) main::i#12<(const byte) SQRT_COUNT#0) goto main::@2 -- vwuz1_lt_vbuc1_then_la1
|
|
lda.z i+1
|
|
cmp #>SQRT_COUNT
|
|
bcc b2
|
|
bne !+
|
|
lda.z i
|
|
cmp #<SQRT_COUNT
|
|
bcc b2
|
|
!:
|
|
// [8] phi from main::@1 to main::@7 [phi:main::@1->main::@7]
|
|
b7_from_b1:
|
|
// [8] phi (byte*) print_char_cursor#27 = (byte*) 1024 [phi:main::@1->main::@7#0] -- pbuz1=pbuc1
|
|
lda #<$400
|
|
sta.z print_char_cursor
|
|
lda #>$400
|
|
sta.z print_char_cursor+1
|
|
// [8] phi (word) main::i#10 = (byte) 2 [phi:main::@1->main::@7#1] -- vwuz1=vbuc1
|
|
lda #<2
|
|
sta.z i_10
|
|
lda #>2
|
|
sta.z i_10+1
|
|
jmp b7
|
|
// main::@7
|
|
b7:
|
|
// [9] if((word) main::i#10<(word) $4c7) goto main::@8 -- vwuz1_lt_vwuc1_then_la1
|
|
lda.z i_10+1
|
|
cmp #>$4c7
|
|
bcc b8
|
|
bne !+
|
|
lda.z i_10
|
|
cmp #<$4c7
|
|
bcc b8
|
|
!:
|
|
jmp b11
|
|
// main::@11
|
|
b11:
|
|
// [10] *((const byte*) SCREEN#0+(word) $3e7) ← ++ *((const byte*) SCREEN#0+(word) $3e7) -- _deref_pbuc1=_inc__deref_pbuc1
|
|
inc SCREEN+$3e7
|
|
jmp b11
|
|
// main::@8
|
|
b8:
|
|
// [11] (byte*~) main::$19 ← (const byte*) sieve#0 + (word) main::i#10 -- pbuz1=pbuc1_plus_vwuz2
|
|
lda.z i_10
|
|
clc
|
|
adc #<sieve
|
|
sta.z _19
|
|
lda.z i_10+1
|
|
adc #>sieve
|
|
sta.z _19+1
|
|
// [12] if((byte) 0!=*((byte*~) main::$19)) goto main::@9 -- vbuc1_neq__deref_pbuz1_then_la1
|
|
ldy #0
|
|
lda (_19),y
|
|
cmp #0
|
|
bne b9_from_b8
|
|
jmp b10
|
|
// main::@10
|
|
b10:
|
|
// [13] (word) print_word::w#0 ← (word) main::i#10 -- vwuz1=vwuz2
|
|
lda.z i_10
|
|
sta.z print_word.w
|
|
lda.z i_10+1
|
|
sta.z print_word.w+1
|
|
// [14] call print_word
|
|
jsr print_word
|
|
// [15] phi from main::@10 to main::@12 [phi:main::@10->main::@12]
|
|
b12_from_b10:
|
|
jmp b12
|
|
// main::@12
|
|
b12:
|
|
// [16] call print_char
|
|
// [29] phi from main::@12 to print_char [phi:main::@12->print_char]
|
|
print_char_from_b12:
|
|
// [29] phi (byte*) print_char_cursor#19 = (byte*) print_char_cursor#20 [phi:main::@12->print_char#0] -- register_copy
|
|
// [29] phi (byte) print_char::ch#3 = (byte) ' ' [phi:main::@12->print_char#1] -- vbuz1=vbuc1
|
|
lda #' '
|
|
sta.z print_char.ch
|
|
jsr print_char
|
|
// [17] phi from main::@12 main::@8 to main::@9 [phi:main::@12/main::@8->main::@9]
|
|
b9_from_b12:
|
|
b9_from_b8:
|
|
// [17] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#20 [phi:main::@12/main::@8->main::@9#0] -- register_copy
|
|
jmp b9
|
|
// main::@9
|
|
b9:
|
|
// [18] (word) main::i#3 ← ++ (word) main::i#10 -- vwuz1=_inc_vwuz1
|
|
inc.z i_3
|
|
bne !+
|
|
inc.z i_3+1
|
|
!:
|
|
// [8] phi from main::@9 to main::@7 [phi:main::@9->main::@7]
|
|
b7_from_b9:
|
|
// [8] phi (byte*) print_char_cursor#27 = (byte*) print_char_cursor#35 [phi:main::@9->main::@7#0] -- register_copy
|
|
// [8] phi (word) main::i#10 = (word) main::i#3 [phi:main::@9->main::@7#1] -- register_copy
|
|
jmp b7
|
|
// main::@2
|
|
b2:
|
|
// [19] if((byte) 0!=*((byte*) main::sieve_i#2)) goto main::@3 -- vbuc1_neq__deref_pbuz1_then_la1
|
|
ldy #0
|
|
lda (sieve_i),y
|
|
cmp #0
|
|
bne b3
|
|
jmp b6
|
|
// main::@6
|
|
b6:
|
|
// [20] (word) main::j#0 ← (word) main::i#12 << (byte) 1 -- vwuz1=vwuz2_rol_1
|
|
lda.z i
|
|
asl
|
|
sta.z j
|
|
lda.z i+1
|
|
rol
|
|
sta.z j+1
|
|
// [21] (byte*) main::s#0 ← (const byte*) sieve#0 + (word) main::j#0 -- pbuz1=pbuc1_plus_vwuz2
|
|
lda.z j
|
|
clc
|
|
adc #<sieve
|
|
sta.z s
|
|
lda.z j+1
|
|
adc #>sieve
|
|
sta.z s+1
|
|
// [22] phi from main::@5 main::@6 to main::@4 [phi:main::@5/main::@6->main::@4]
|
|
b4_from_b5:
|
|
b4_from_b6:
|
|
// [22] phi (byte*) main::s#2 = (byte*) main::s#1 [phi:main::@5/main::@6->main::@4#0] -- register_copy
|
|
// [22] phi (word) main::j#2 = (word) main::j#1 [phi:main::@5/main::@6->main::@4#1] -- register_copy
|
|
jmp b4
|
|
// main::@4
|
|
b4:
|
|
// [23] if((word) main::j#2<(const word) COUNT#0) goto main::@5 -- vwuz1_lt_vwuc1_then_la1
|
|
lda.z j+1
|
|
cmp #>COUNT
|
|
bcc b5
|
|
bne !+
|
|
lda.z j
|
|
cmp #<COUNT
|
|
bcc b5
|
|
!:
|
|
jmp b3
|
|
// main::@3
|
|
b3:
|
|
// [24] (word) main::i#2 ← ++ (word) main::i#12 -- vwuz1=_inc_vwuz1
|
|
inc.z i
|
|
bne !+
|
|
inc.z i+1
|
|
!:
|
|
// [25] (byte*) main::sieve_i#1 ← ++ (byte*) main::sieve_i#2 -- pbuz1=_inc_pbuz1
|
|
inc.z sieve_i
|
|
bne !+
|
|
inc.z sieve_i+1
|
|
!:
|
|
// [6] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
|
|
b1_from_b3:
|
|
// [6] phi (byte*) main::sieve_i#2 = (byte*) main::sieve_i#1 [phi:main::@3->main::@1#0] -- register_copy
|
|
// [6] phi (word) main::i#12 = (word) main::i#2 [phi:main::@3->main::@1#1] -- register_copy
|
|
jmp b1
|
|
// main::@5
|
|
b5:
|
|
// [26] *((byte*) main::s#2) ← (byte) 1 -- _deref_pbuz1=vbuc1
|
|
lda #1
|
|
ldy #0
|
|
sta (s),y
|
|
// [27] (byte*) main::s#1 ← (byte*) main::s#2 + (word) main::i#12 -- pbuz1=pbuz1_plus_vwuz2
|
|
lda.z s
|
|
clc
|
|
adc.z i
|
|
sta.z s
|
|
lda.z s+1
|
|
adc.z i+1
|
|
sta.z s+1
|
|
// [28] (word) main::j#1 ← (word) main::j#2 + (word) main::i#12 -- vwuz1=vwuz1_plus_vwuz2
|
|
lda.z j
|
|
clc
|
|
adc.z i
|
|
sta.z j
|
|
lda.z j+1
|
|
adc.z i+1
|
|
sta.z j+1
|
|
jmp b4_from_b5
|
|
}
|
|
// print_char
|
|
// Print a single char
|
|
// print_char(byte zeropage($c) ch)
|
|
print_char: {
|
|
.label ch = $c
|
|
// [30] *((byte*) print_char_cursor#19) ← (byte) print_char::ch#3 -- _deref_pbuz1=vbuz2
|
|
lda.z ch
|
|
ldy #0
|
|
sta (print_char_cursor),y
|
|
// [31] (byte*) print_char_cursor#20 ← ++ (byte*) print_char_cursor#19 -- pbuz1=_inc_pbuz1
|
|
inc.z print_char_cursor
|
|
bne !+
|
|
inc.z print_char_cursor+1
|
|
!:
|
|
jmp breturn
|
|
// print_char::@return
|
|
breturn:
|
|
// [32] return
|
|
rts
|
|
}
|
|
// print_word
|
|
// Print a word as HEX
|
|
// print_word(word zeropage($14) w)
|
|
print_word: {
|
|
.label w = $14
|
|
// [33] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuz1=_hi_vwuz2
|
|
lda.z w+1
|
|
sta.z print_byte.b
|
|
// [34] call print_byte
|
|
// [38] phi from print_word to print_byte [phi:print_word->print_byte]
|
|
print_byte_from_print_word:
|
|
// [38] phi (byte*) print_char_cursor#26 = (byte*) print_char_cursor#27 [phi:print_word->print_byte#0] -- register_copy
|
|
// [38] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy
|
|
jsr print_byte
|
|
jmp b1
|
|
// print_word::@1
|
|
b1:
|
|
// [35] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuz1=_lo_vwuz2
|
|
lda.z w
|
|
sta.z print_byte.b
|
|
// [36] call print_byte
|
|
// [38] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte]
|
|
print_byte_from_b1:
|
|
// [38] phi (byte*) print_char_cursor#26 = (byte*) print_char_cursor#20 [phi:print_word::@1->print_byte#0] -- register_copy
|
|
// [38] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy
|
|
jsr print_byte
|
|
jmp breturn
|
|
// print_word::@return
|
|
breturn:
|
|
// [37] return
|
|
rts
|
|
}
|
|
// print_byte
|
|
// Print a byte as HEX
|
|
// print_byte(byte zeropage($f) b)
|
|
print_byte: {
|
|
.label _0 = $16
|
|
.label _2 = $17
|
|
.label b = $f
|
|
// [39] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuz1=vbuz2_ror_4
|
|
lda.z b
|
|
lsr
|
|
lsr
|
|
lsr
|
|
lsr
|
|
sta.z _0
|
|
// [40] (byte) print_char::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte::$0) -- vbuz1=pbuc1_derefidx_vbuz2
|
|
ldy.z _0
|
|
lda print_hextab,y
|
|
sta.z print_char.ch
|
|
// [41] call print_char
|
|
// [29] phi from print_byte to print_char [phi:print_byte->print_char]
|
|
print_char_from_print_byte:
|
|
// [29] phi (byte*) print_char_cursor#19 = (byte*) print_char_cursor#26 [phi:print_byte->print_char#0] -- register_copy
|
|
// [29] phi (byte) print_char::ch#3 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy
|
|
jsr print_char
|
|
jmp b1
|
|
// print_byte::@1
|
|
b1:
|
|
// [42] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1
|
|
lda #$f
|
|
and.z b
|
|
sta.z _2
|
|
// [43] (byte) print_char::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte::$2) -- vbuz1=pbuc1_derefidx_vbuz2
|
|
ldy.z _2
|
|
lda print_hextab,y
|
|
sta.z print_char.ch
|
|
// [44] call print_char
|
|
// [29] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char]
|
|
print_char_from_b1:
|
|
// [29] phi (byte*) print_char_cursor#19 = (byte*) print_char_cursor#20 [phi:print_byte::@1->print_char#0] -- register_copy
|
|
// [29] phi (byte) print_char::ch#3 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy
|
|
jsr print_char
|
|
jmp breturn
|
|
// print_byte::@return
|
|
breturn:
|
|
// [45] return
|
|
rts
|
|
}
|
|
// memset
|
|
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
|
|
memset: {
|
|
.const c = 0
|
|
.label str = sieve
|
|
.label end = str+COUNT
|
|
.label dst = $10
|
|
// [47] phi from memset to memset::@1 [phi:memset->memset::@1]
|
|
b1_from_memset:
|
|
// [47] phi (byte*) memset::dst#2 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1
|
|
lda #<str
|
|
sta.z dst
|
|
lda #>str
|
|
sta.z dst+1
|
|
jmp b1
|
|
// memset::@1
|
|
b1:
|
|
// [48] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1
|
|
lda.z dst+1
|
|
cmp #>end
|
|
bne b2
|
|
lda.z dst
|
|
cmp #<end
|
|
bne b2
|
|
jmp breturn
|
|
// memset::@return
|
|
breturn:
|
|
// [49] return
|
|
rts
|
|
// memset::@2
|
|
b2:
|
|
// [50] *((byte*) memset::dst#2) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1
|
|
lda #c
|
|
ldy #0
|
|
sta (dst),y
|
|
// [51] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1
|
|
inc.z dst
|
|
bne !+
|
|
inc.z dst+1
|
|
!:
|
|
// [47] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
|
|
b1_from_b2:
|
|
// [47] phi (byte*) memset::dst#2 = (byte*) memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy
|
|
jmp b1
|
|
}
|
|
// File Data
|
|
print_hextab: .text "0123456789abcdef"
|
|
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [7] if((word) main::i#12<(const byte) SQRT_COUNT#0) goto main::@2 [ main::i#12 main::sieve_i#2 ] ( main:2 [ main::i#12 main::sieve_i#2 ] ) always clobbers reg byte a
|
|
Statement [9] if((word) main::i#10<(word) $4c7) goto main::@8 [ main::i#10 print_char_cursor#27 ] ( main:2 [ main::i#10 print_char_cursor#27 ] ) always clobbers reg byte a
|
|
Statement [11] (byte*~) main::$19 ← (const byte*) sieve#0 + (word) main::i#10 [ main::i#10 print_char_cursor#27 main::$19 ] ( main:2 [ main::i#10 print_char_cursor#27 main::$19 ] ) always clobbers reg byte a
|
|
Statement [12] if((byte) 0!=*((byte*~) main::$19)) goto main::@9 [ main::i#10 print_char_cursor#27 ] ( main:2 [ main::i#10 print_char_cursor#27 ] ) always clobbers reg byte a reg byte y
|
|
Statement [13] (word) print_word::w#0 ← (word) main::i#10 [ main::i#10 print_char_cursor#27 print_word::w#0 ] ( main:2 [ main::i#10 print_char_cursor#27 print_word::w#0 ] ) always clobbers reg byte a
|
|
Statement [19] if((byte) 0!=*((byte*) main::sieve_i#2)) goto main::@3 [ main::i#12 main::sieve_i#2 ] ( main:2 [ main::i#12 main::sieve_i#2 ] ) always clobbers reg byte a reg byte y
|
|
Statement [20] (word) main::j#0 ← (word) main::i#12 << (byte) 1 [ main::i#12 main::sieve_i#2 main::j#0 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#0 ] ) always clobbers reg byte a
|
|
Statement [21] (byte*) main::s#0 ← (const byte*) sieve#0 + (word) main::j#0 [ main::i#12 main::sieve_i#2 main::j#0 main::s#0 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#0 main::s#0 ] ) always clobbers reg byte a
|
|
Statement [23] if((word) main::j#2<(const word) COUNT#0) goto main::@5 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] ) always clobbers reg byte a
|
|
Statement [26] *((byte*) main::s#2) ← (byte) 1 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] ) always clobbers reg byte a reg byte y
|
|
Statement [27] (byte*) main::s#1 ← (byte*) main::s#2 + (word) main::i#12 [ main::i#12 main::sieve_i#2 main::j#2 main::s#1 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#2 main::s#1 ] ) always clobbers reg byte a
|
|
Statement [28] (word) main::j#1 ← (word) main::j#2 + (word) main::i#12 [ main::i#12 main::sieve_i#2 main::j#1 main::s#1 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#1 main::s#1 ] ) always clobbers reg byte a
|
|
Statement [30] *((byte*) print_char_cursor#19) ← (byte) print_char::ch#3 [ print_char_cursor#19 ] ( main:2::print_char:16 [ main::i#10 print_char_cursor#19 ] main:2::print_word:14::print_byte:34::print_char:41 [ main::i#10 print_word::w#0 print_byte::b#2 print_char_cursor#19 ] main:2::print_word:14::print_byte:36::print_char:41 [ main::i#10 print_byte::b#2 print_char_cursor#19 ] main:2::print_word:14::print_byte:34::print_char:44 [ main::i#10 print_word::w#0 print_char_cursor#19 ] main:2::print_word:14::print_byte:36::print_char:44 [ main::i#10 print_char_cursor#19 ] ) always clobbers reg byte y
|
|
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:15 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
|
|
Statement [33] (byte) print_byte::b#0 ← > (word) print_word::w#0 [ print_char_cursor#27 print_word::w#0 print_byte::b#0 ] ( main:2::print_word:14 [ main::i#10 print_char_cursor#27 print_word::w#0 print_byte::b#0 ] ) always clobbers reg byte a
|
|
Statement [35] (byte) print_byte::b#1 ← < (word) print_word::w#0 [ print_char_cursor#20 print_byte::b#1 ] ( main:2::print_word:14 [ main::i#10 print_char_cursor#20 print_byte::b#1 ] ) always clobbers reg byte a
|
|
Statement [39] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [ print_char_cursor#26 print_byte::b#2 print_byte::$0 ] ( main:2::print_word:14::print_byte:34 [ main::i#10 print_word::w#0 print_char_cursor#26 print_byte::b#2 print_byte::$0 ] main:2::print_word:14::print_byte:36 [ main::i#10 print_char_cursor#26 print_byte::b#2 print_byte::$0 ] ) always clobbers reg byte a
|
|
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:15 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
|
|
Statement [42] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [ print_char_cursor#20 print_byte::$2 ] ( main:2::print_word:14::print_byte:34 [ main::i#10 print_word::w#0 print_char_cursor#20 print_byte::$2 ] main:2::print_word:14::print_byte:36 [ main::i#10 print_char_cursor#20 print_byte::$2 ] ) always clobbers reg byte a
|
|
Statement [48] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 [ memset::dst#2 ] ( main:2::memset:5 [ memset::dst#2 ] ) always clobbers reg byte a
|
|
Statement [50] *((byte*) memset::dst#2) ← (const byte) memset::c#0 [ memset::dst#2 ] ( main:2::memset:5 [ memset::dst#2 ] ) always clobbers reg byte a reg byte y
|
|
Statement [7] if((word) main::i#12<(const byte) SQRT_COUNT#0) goto main::@2 [ main::i#12 main::sieve_i#2 ] ( main:2 [ main::i#12 main::sieve_i#2 ] ) always clobbers reg byte a
|
|
Statement [9] if((word) main::i#10<(word) $4c7) goto main::@8 [ main::i#10 print_char_cursor#27 ] ( main:2 [ main::i#10 print_char_cursor#27 ] ) always clobbers reg byte a
|
|
Statement [11] (byte*~) main::$19 ← (const byte*) sieve#0 + (word) main::i#10 [ main::i#10 print_char_cursor#27 main::$19 ] ( main:2 [ main::i#10 print_char_cursor#27 main::$19 ] ) always clobbers reg byte a
|
|
Statement [12] if((byte) 0!=*((byte*~) main::$19)) goto main::@9 [ main::i#10 print_char_cursor#27 ] ( main:2 [ main::i#10 print_char_cursor#27 ] ) always clobbers reg byte a reg byte y
|
|
Statement [13] (word) print_word::w#0 ← (word) main::i#10 [ main::i#10 print_char_cursor#27 print_word::w#0 ] ( main:2 [ main::i#10 print_char_cursor#27 print_word::w#0 ] ) always clobbers reg byte a
|
|
Statement [19] if((byte) 0!=*((byte*) main::sieve_i#2)) goto main::@3 [ main::i#12 main::sieve_i#2 ] ( main:2 [ main::i#12 main::sieve_i#2 ] ) always clobbers reg byte a reg byte y
|
|
Statement [20] (word) main::j#0 ← (word) main::i#12 << (byte) 1 [ main::i#12 main::sieve_i#2 main::j#0 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#0 ] ) always clobbers reg byte a
|
|
Statement [21] (byte*) main::s#0 ← (const byte*) sieve#0 + (word) main::j#0 [ main::i#12 main::sieve_i#2 main::j#0 main::s#0 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#0 main::s#0 ] ) always clobbers reg byte a
|
|
Statement [23] if((word) main::j#2<(const word) COUNT#0) goto main::@5 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] ) always clobbers reg byte a
|
|
Statement [26] *((byte*) main::s#2) ← (byte) 1 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] ) always clobbers reg byte a reg byte y
|
|
Statement [27] (byte*) main::s#1 ← (byte*) main::s#2 + (word) main::i#12 [ main::i#12 main::sieve_i#2 main::j#2 main::s#1 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#2 main::s#1 ] ) always clobbers reg byte a
|
|
Statement [28] (word) main::j#1 ← (word) main::j#2 + (word) main::i#12 [ main::i#12 main::sieve_i#2 main::j#1 main::s#1 ] ( main:2 [ main::i#12 main::sieve_i#2 main::j#1 main::s#1 ] ) always clobbers reg byte a
|
|
Statement [30] *((byte*) print_char_cursor#19) ← (byte) print_char::ch#3 [ print_char_cursor#19 ] ( main:2::print_char:16 [ main::i#10 print_char_cursor#19 ] main:2::print_word:14::print_byte:34::print_char:41 [ main::i#10 print_word::w#0 print_byte::b#2 print_char_cursor#19 ] main:2::print_word:14::print_byte:36::print_char:41 [ main::i#10 print_byte::b#2 print_char_cursor#19 ] main:2::print_word:14::print_byte:34::print_char:44 [ main::i#10 print_word::w#0 print_char_cursor#19 ] main:2::print_word:14::print_byte:36::print_char:44 [ main::i#10 print_char_cursor#19 ] ) always clobbers reg byte y
|
|
Statement [33] (byte) print_byte::b#0 ← > (word) print_word::w#0 [ print_char_cursor#27 print_word::w#0 print_byte::b#0 ] ( main:2::print_word:14 [ main::i#10 print_char_cursor#27 print_word::w#0 print_byte::b#0 ] ) always clobbers reg byte a
|
|
Statement [35] (byte) print_byte::b#1 ← < (word) print_word::w#0 [ print_char_cursor#20 print_byte::b#1 ] ( main:2::print_word:14 [ main::i#10 print_char_cursor#20 print_byte::b#1 ] ) always clobbers reg byte a
|
|
Statement [39] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [ print_char_cursor#26 print_byte::b#2 print_byte::$0 ] ( main:2::print_word:14::print_byte:34 [ main::i#10 print_word::w#0 print_char_cursor#26 print_byte::b#2 print_byte::$0 ] main:2::print_word:14::print_byte:36 [ main::i#10 print_char_cursor#26 print_byte::b#2 print_byte::$0 ] ) always clobbers reg byte a
|
|
Statement [42] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [ print_char_cursor#20 print_byte::$2 ] ( main:2::print_word:14::print_byte:34 [ main::i#10 print_word::w#0 print_char_cursor#20 print_byte::$2 ] main:2::print_word:14::print_byte:36 [ main::i#10 print_char_cursor#20 print_byte::$2 ] ) always clobbers reg byte a
|
|
Statement [48] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 [ memset::dst#2 ] ( main:2::memset:5 [ memset::dst#2 ] ) always clobbers reg byte a
|
|
Statement [50] *((byte*) memset::dst#2) ← (const byte) memset::c#0 [ memset::dst#2 ] ( main:2::memset:5 [ memset::dst#2 ] ) always clobbers reg byte a reg byte y
|
|
Potential registers zp ZP_WORD:2 [ main::i#12 main::i#2 ] : zp ZP_WORD:2 ,
|
|
Potential registers zp ZP_WORD:4 [ main::sieve_i#2 main::sieve_i#1 ] : zp ZP_WORD:4 ,
|
|
Potential registers zp ZP_WORD:6 [ main::i#10 main::i#3 ] : zp ZP_WORD:6 ,
|
|
Potential registers zp ZP_WORD:8 [ main::j#2 main::j#0 main::j#1 ] : zp ZP_WORD:8 ,
|
|
Potential registers zp ZP_WORD:10 [ main::s#2 main::s#0 main::s#1 ] : zp ZP_WORD:10 ,
|
|
Potential registers zp ZP_BYTE:12 [ print_char::ch#3 print_char::ch#0 print_char::ch#1 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y ,
|
|
Potential registers zp ZP_WORD:13 [ print_char_cursor#19 print_char_cursor#27 print_char_cursor#35 print_char_cursor#20 print_char_cursor#26 ] : zp ZP_WORD:13 ,
|
|
Potential registers zp ZP_BYTE:15 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] : zp ZP_BYTE:15 , reg byte x ,
|
|
Potential registers zp ZP_WORD:16 [ memset::dst#2 memset::dst#1 ] : zp ZP_WORD:16 ,
|
|
Potential registers zp ZP_WORD:18 [ main::$19 ] : zp ZP_WORD:18 ,
|
|
Potential registers zp ZP_WORD:20 [ print_word::w#0 ] : zp ZP_WORD:20 ,
|
|
Potential registers zp ZP_BYTE:22 [ print_byte::$0 ] : zp ZP_BYTE:22 , reg byte a , reg byte x , reg byte y ,
|
|
Potential registers zp ZP_BYTE:23 [ print_byte::$2 ] : zp ZP_BYTE:23 , reg byte a , reg byte x , reg byte y ,
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [main] 297: zp ZP_WORD:8 [ main::j#2 main::j#0 main::j#1 ] 227.67: zp ZP_WORD:10 [ main::s#2 main::s#0 main::s#1 ] 35.6: zp ZP_WORD:2 [ main::i#12 main::i#2 ] 28.11: zp ZP_WORD:6 [ main::i#10 main::i#3 ] 25: zp ZP_WORD:4 [ main::sieve_i#2 main::sieve_i#1 ] 22: zp ZP_WORD:18 [ main::$19 ]
|
|
Uplift Scope [memset] 36.67: zp ZP_WORD:16 [ memset::dst#2 memset::dst#1 ]
|
|
Uplift Scope [] 34: zp ZP_WORD:13 [ print_char_cursor#19 print_char_cursor#27 print_char_cursor#35 print_char_cursor#20 print_char_cursor#26 ]
|
|
Uplift Scope [print_byte] 10: zp ZP_BYTE:15 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] 4: zp ZP_BYTE:22 [ print_byte::$0 ] 4: zp ZP_BYTE:23 [ print_byte::$2 ]
|
|
Uplift Scope [print_char] 14: zp ZP_BYTE:12 [ print_char::ch#3 print_char::ch#0 print_char::ch#1 ]
|
|
Uplift Scope [print_word] 5: zp ZP_WORD:20 [ print_word::w#0 ]
|
|
Uplift Scope [RADIX]
|
|
|
|
Uplifting [main] best 10809 combination zp ZP_WORD:8 [ main::j#2 main::j#0 main::j#1 ] zp ZP_WORD:10 [ main::s#2 main::s#0 main::s#1 ] zp ZP_WORD:2 [ main::i#12 main::i#2 ] zp ZP_WORD:6 [ main::i#10 main::i#3 ] zp ZP_WORD:4 [ main::sieve_i#2 main::sieve_i#1 ] zp ZP_WORD:18 [ main::$19 ]
|
|
Uplifting [memset] best 10809 combination zp ZP_WORD:16 [ memset::dst#2 memset::dst#1 ]
|
|
Uplifting [] best 10809 combination zp ZP_WORD:13 [ print_char_cursor#19 print_char_cursor#27 print_char_cursor#35 print_char_cursor#20 print_char_cursor#26 ]
|
|
Uplifting [print_byte] best 10795 combination reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte a [ print_byte::$0 ] reg byte x [ print_byte::$2 ]
|
|
Uplifting [print_char] best 10783 combination reg byte a [ print_char::ch#3 print_char::ch#0 print_char::ch#1 ]
|
|
Uplifting [print_word] best 10783 combination zp ZP_WORD:20 [ print_word::w#0 ]
|
|
Uplifting [RADIX] best 10783 combination
|
|
Coalescing zero page register [ zp ZP_WORD:6 [ main::i#10 main::i#3 ] ] with [ zp ZP_WORD:20 [ print_word::w#0 ] ] - score: 1
|
|
Coalescing zero page register [ zp ZP_WORD:13 [ print_char_cursor#19 print_char_cursor#27 print_char_cursor#35 print_char_cursor#20 print_char_cursor#26 ] ] with [ zp ZP_WORD:2 [ main::i#12 main::i#2 ] ]
|
|
Coalescing zero page register [ zp ZP_WORD:16 [ memset::dst#2 memset::dst#1 ] ] with [ zp ZP_WORD:4 [ main::sieve_i#2 main::sieve_i#1 ] ]
|
|
Allocated (was zp ZP_WORD:6) zp ZP_WORD:2 [ main::i#10 main::i#3 print_word::w#0 ]
|
|
Allocated (was zp ZP_WORD:8) zp ZP_WORD:4 [ main::j#2 main::j#0 main::j#1 ]
|
|
Allocated (was zp ZP_WORD:10) zp ZP_WORD:6 [ main::s#2 main::s#0 main::s#1 ]
|
|
Allocated (was zp ZP_WORD:13) zp ZP_WORD:8 [ print_char_cursor#19 print_char_cursor#27 print_char_cursor#35 print_char_cursor#20 print_char_cursor#26 main::i#12 main::i#2 ]
|
|
Allocated (was zp ZP_WORD:16) zp ZP_WORD:10 [ memset::dst#2 memset::dst#1 main::sieve_i#2 main::sieve_i#1 ]
|
|
Allocated (was zp ZP_WORD:18) zp ZP_WORD:12 [ main::$19 ]
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(bbegin)
|
|
.pc = $80d "Program"
|
|
// Global Constants & labels
|
|
.label SCREEN = $400
|
|
.const COUNT = $4000
|
|
/* Up to what number? */
|
|
.const SQRT_COUNT = $80
|
|
/* Sqrt of COUNT */
|
|
.label sieve = $1000
|
|
.label print_char_cursor = 8
|
|
// @begin
|
|
bbegin:
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
|
b1_from_bbegin:
|
|
jmp b1
|
|
// @1
|
|
b1:
|
|
// [2] call main
|
|
// [4] phi from @1 to main [phi:@1->main]
|
|
main_from_b1:
|
|
jsr main
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
|
bend_from_b1:
|
|
jmp bend
|
|
// @end
|
|
bend:
|
|
// main
|
|
main: {
|
|
.label i = 8
|
|
.label sieve_i = $a
|
|
.label j = 4
|
|
.label s = 6
|
|
.label i_3 = 2
|
|
.label i_10 = 2
|
|
.label _19 = $c
|
|
// [5] call memset
|
|
// [46] phi from main to memset [phi:main->memset]
|
|
memset_from_main:
|
|
jsr memset
|
|
// [6] phi from main to main::@1 [phi:main->main::@1]
|
|
b1_from_main:
|
|
// [6] phi (byte*) main::sieve_i#2 = (const byte*) sieve#0+(byte) 2 [phi:main->main::@1#0] -- pbuz1=pbuc1
|
|
lda #<sieve+2
|
|
sta.z sieve_i
|
|
lda #>sieve+2
|
|
sta.z sieve_i+1
|
|
// [6] phi (word) main::i#12 = (byte) 2 [phi:main->main::@1#1] -- vwuz1=vbuc1
|
|
lda #<2
|
|
sta.z i
|
|
lda #>2
|
|
sta.z i+1
|
|
jmp b1
|
|
// main::@1
|
|
b1:
|
|
// [7] if((word) main::i#12<(const byte) SQRT_COUNT#0) goto main::@2 -- vwuz1_lt_vbuc1_then_la1
|
|
lda.z i+1
|
|
cmp #>SQRT_COUNT
|
|
bcc b2
|
|
bne !+
|
|
lda.z i
|
|
cmp #<SQRT_COUNT
|
|
bcc b2
|
|
!:
|
|
// [8] phi from main::@1 to main::@7 [phi:main::@1->main::@7]
|
|
b7_from_b1:
|
|
// [8] phi (byte*) print_char_cursor#27 = (byte*) 1024 [phi:main::@1->main::@7#0] -- pbuz1=pbuc1
|
|
lda #<$400
|
|
sta.z print_char_cursor
|
|
lda #>$400
|
|
sta.z print_char_cursor+1
|
|
// [8] phi (word) main::i#10 = (byte) 2 [phi:main::@1->main::@7#1] -- vwuz1=vbuc1
|
|
lda #<2
|
|
sta.z i_10
|
|
lda #>2
|
|
sta.z i_10+1
|
|
jmp b7
|
|
// main::@7
|
|
b7:
|
|
// [9] if((word) main::i#10<(word) $4c7) goto main::@8 -- vwuz1_lt_vwuc1_then_la1
|
|
lda.z i_10+1
|
|
cmp #>$4c7
|
|
bcc b8
|
|
bne !+
|
|
lda.z i_10
|
|
cmp #<$4c7
|
|
bcc b8
|
|
!:
|
|
jmp b11
|
|
// main::@11
|
|
b11:
|
|
// [10] *((const byte*) SCREEN#0+(word) $3e7) ← ++ *((const byte*) SCREEN#0+(word) $3e7) -- _deref_pbuc1=_inc__deref_pbuc1
|
|
inc SCREEN+$3e7
|
|
jmp b11
|
|
// main::@8
|
|
b8:
|
|
// [11] (byte*~) main::$19 ← (const byte*) sieve#0 + (word) main::i#10 -- pbuz1=pbuc1_plus_vwuz2
|
|
lda.z i_10
|
|
clc
|
|
adc #<sieve
|
|
sta.z _19
|
|
lda.z i_10+1
|
|
adc #>sieve
|
|
sta.z _19+1
|
|
// [12] if((byte) 0!=*((byte*~) main::$19)) goto main::@9 -- vbuc1_neq__deref_pbuz1_then_la1
|
|
ldy #0
|
|
lda (_19),y
|
|
cmp #0
|
|
bne b9_from_b8
|
|
jmp b10
|
|
// main::@10
|
|
b10:
|
|
// [13] (word) print_word::w#0 ← (word) main::i#10
|
|
// [14] call print_word
|
|
jsr print_word
|
|
// [15] phi from main::@10 to main::@12 [phi:main::@10->main::@12]
|
|
b12_from_b10:
|
|
jmp b12
|
|
// main::@12
|
|
b12:
|
|
// [16] call print_char
|
|
// [29] phi from main::@12 to print_char [phi:main::@12->print_char]
|
|
print_char_from_b12:
|
|
// [29] phi (byte*) print_char_cursor#19 = (byte*) print_char_cursor#20 [phi:main::@12->print_char#0] -- register_copy
|
|
// [29] phi (byte) print_char::ch#3 = (byte) ' ' [phi:main::@12->print_char#1] -- vbuaa=vbuc1
|
|
lda #' '
|
|
jsr print_char
|
|
// [17] phi from main::@12 main::@8 to main::@9 [phi:main::@12/main::@8->main::@9]
|
|
b9_from_b12:
|
|
b9_from_b8:
|
|
// [17] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#20 [phi:main::@12/main::@8->main::@9#0] -- register_copy
|
|
jmp b9
|
|
// main::@9
|
|
b9:
|
|
// [18] (word) main::i#3 ← ++ (word) main::i#10 -- vwuz1=_inc_vwuz1
|
|
inc.z i_3
|
|
bne !+
|
|
inc.z i_3+1
|
|
!:
|
|
// [8] phi from main::@9 to main::@7 [phi:main::@9->main::@7]
|
|
b7_from_b9:
|
|
// [8] phi (byte*) print_char_cursor#27 = (byte*) print_char_cursor#35 [phi:main::@9->main::@7#0] -- register_copy
|
|
// [8] phi (word) main::i#10 = (word) main::i#3 [phi:main::@9->main::@7#1] -- register_copy
|
|
jmp b7
|
|
// main::@2
|
|
b2:
|
|
// [19] if((byte) 0!=*((byte*) main::sieve_i#2)) goto main::@3 -- vbuc1_neq__deref_pbuz1_then_la1
|
|
ldy #0
|
|
lda (sieve_i),y
|
|
cmp #0
|
|
bne b3
|
|
jmp b6
|
|
// main::@6
|
|
b6:
|
|
// [20] (word) main::j#0 ← (word) main::i#12 << (byte) 1 -- vwuz1=vwuz2_rol_1
|
|
lda.z i
|
|
asl
|
|
sta.z j
|
|
lda.z i+1
|
|
rol
|
|
sta.z j+1
|
|
// [21] (byte*) main::s#0 ← (const byte*) sieve#0 + (word) main::j#0 -- pbuz1=pbuc1_plus_vwuz2
|
|
lda.z j
|
|
clc
|
|
adc #<sieve
|
|
sta.z s
|
|
lda.z j+1
|
|
adc #>sieve
|
|
sta.z s+1
|
|
// [22] phi from main::@5 main::@6 to main::@4 [phi:main::@5/main::@6->main::@4]
|
|
b4_from_b5:
|
|
b4_from_b6:
|
|
// [22] phi (byte*) main::s#2 = (byte*) main::s#1 [phi:main::@5/main::@6->main::@4#0] -- register_copy
|
|
// [22] phi (word) main::j#2 = (word) main::j#1 [phi:main::@5/main::@6->main::@4#1] -- register_copy
|
|
jmp b4
|
|
// main::@4
|
|
b4:
|
|
// [23] if((word) main::j#2<(const word) COUNT#0) goto main::@5 -- vwuz1_lt_vwuc1_then_la1
|
|
lda.z j+1
|
|
cmp #>COUNT
|
|
bcc b5
|
|
bne !+
|
|
lda.z j
|
|
cmp #<COUNT
|
|
bcc b5
|
|
!:
|
|
jmp b3
|
|
// main::@3
|
|
b3:
|
|
// [24] (word) main::i#2 ← ++ (word) main::i#12 -- vwuz1=_inc_vwuz1
|
|
inc.z i
|
|
bne !+
|
|
inc.z i+1
|
|
!:
|
|
// [25] (byte*) main::sieve_i#1 ← ++ (byte*) main::sieve_i#2 -- pbuz1=_inc_pbuz1
|
|
inc.z sieve_i
|
|
bne !+
|
|
inc.z sieve_i+1
|
|
!:
|
|
// [6] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
|
|
b1_from_b3:
|
|
// [6] phi (byte*) main::sieve_i#2 = (byte*) main::sieve_i#1 [phi:main::@3->main::@1#0] -- register_copy
|
|
// [6] phi (word) main::i#12 = (word) main::i#2 [phi:main::@3->main::@1#1] -- register_copy
|
|
jmp b1
|
|
// main::@5
|
|
b5:
|
|
// [26] *((byte*) main::s#2) ← (byte) 1 -- _deref_pbuz1=vbuc1
|
|
lda #1
|
|
ldy #0
|
|
sta (s),y
|
|
// [27] (byte*) main::s#1 ← (byte*) main::s#2 + (word) main::i#12 -- pbuz1=pbuz1_plus_vwuz2
|
|
lda.z s
|
|
clc
|
|
adc.z i
|
|
sta.z s
|
|
lda.z s+1
|
|
adc.z i+1
|
|
sta.z s+1
|
|
// [28] (word) main::j#1 ← (word) main::j#2 + (word) main::i#12 -- vwuz1=vwuz1_plus_vwuz2
|
|
lda.z j
|
|
clc
|
|
adc.z i
|
|
sta.z j
|
|
lda.z j+1
|
|
adc.z i+1
|
|
sta.z j+1
|
|
jmp b4_from_b5
|
|
}
|
|
// print_char
|
|
// Print a single char
|
|
// print_char(byte register(A) ch)
|
|
print_char: {
|
|
// [30] *((byte*) print_char_cursor#19) ← (byte) print_char::ch#3 -- _deref_pbuz1=vbuaa
|
|
ldy #0
|
|
sta (print_char_cursor),y
|
|
// [31] (byte*) print_char_cursor#20 ← ++ (byte*) print_char_cursor#19 -- pbuz1=_inc_pbuz1
|
|
inc.z print_char_cursor
|
|
bne !+
|
|
inc.z print_char_cursor+1
|
|
!:
|
|
jmp breturn
|
|
// print_char::@return
|
|
breturn:
|
|
// [32] return
|
|
rts
|
|
}
|
|
// print_word
|
|
// Print a word as HEX
|
|
// print_word(word zeropage(2) w)
|
|
print_word: {
|
|
.label w = 2
|
|
// [33] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuxx=_hi_vwuz1
|
|
lda.z w+1
|
|
tax
|
|
// [34] call print_byte
|
|
// [38] phi from print_word to print_byte [phi:print_word->print_byte]
|
|
print_byte_from_print_word:
|
|
// [38] phi (byte*) print_char_cursor#26 = (byte*) print_char_cursor#27 [phi:print_word->print_byte#0] -- register_copy
|
|
// [38] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy
|
|
jsr print_byte
|
|
jmp b1
|
|
// print_word::@1
|
|
b1:
|
|
// [35] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuxx=_lo_vwuz1
|
|
lda.z w
|
|
tax
|
|
// [36] call print_byte
|
|
// [38] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte]
|
|
print_byte_from_b1:
|
|
// [38] phi (byte*) print_char_cursor#26 = (byte*) print_char_cursor#20 [phi:print_word::@1->print_byte#0] -- register_copy
|
|
// [38] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy
|
|
jsr print_byte
|
|
jmp breturn
|
|
// print_word::@return
|
|
breturn:
|
|
// [37] return
|
|
rts
|
|
}
|
|
// print_byte
|
|
// Print a byte as HEX
|
|
// print_byte(byte register(X) b)
|
|
print_byte: {
|
|
// [39] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuaa=vbuxx_ror_4
|
|
txa
|
|
lsr
|
|
lsr
|
|
lsr
|
|
lsr
|
|
// [40] (byte) print_char::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte::$0) -- vbuaa=pbuc1_derefidx_vbuaa
|
|
tay
|
|
lda print_hextab,y
|
|
// [41] call print_char
|
|
// [29] phi from print_byte to print_char [phi:print_byte->print_char]
|
|
print_char_from_print_byte:
|
|
// [29] phi (byte*) print_char_cursor#19 = (byte*) print_char_cursor#26 [phi:print_byte->print_char#0] -- register_copy
|
|
// [29] phi (byte) print_char::ch#3 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy
|
|
jsr print_char
|
|
jmp b1
|
|
// print_byte::@1
|
|
b1:
|
|
// [42] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuxx=vbuxx_band_vbuc1
|
|
lda #$f
|
|
axs #0
|
|
// [43] (byte) print_char::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte::$2) -- vbuaa=pbuc1_derefidx_vbuxx
|
|
lda print_hextab,x
|
|
// [44] call print_char
|
|
// [29] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char]
|
|
print_char_from_b1:
|
|
// [29] phi (byte*) print_char_cursor#19 = (byte*) print_char_cursor#20 [phi:print_byte::@1->print_char#0] -- register_copy
|
|
// [29] phi (byte) print_char::ch#3 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy
|
|
jsr print_char
|
|
jmp breturn
|
|
// print_byte::@return
|
|
breturn:
|
|
// [45] return
|
|
rts
|
|
}
|
|
// memset
|
|
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
|
|
memset: {
|
|
.const c = 0
|
|
.label str = sieve
|
|
.label end = str+COUNT
|
|
.label dst = $a
|
|
// [47] phi from memset to memset::@1 [phi:memset->memset::@1]
|
|
b1_from_memset:
|
|
// [47] phi (byte*) memset::dst#2 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1
|
|
lda #<str
|
|
sta.z dst
|
|
lda #>str
|
|
sta.z dst+1
|
|
jmp b1
|
|
// memset::@1
|
|
b1:
|
|
// [48] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1
|
|
lda.z dst+1
|
|
cmp #>end
|
|
bne b2
|
|
lda.z dst
|
|
cmp #<end
|
|
bne b2
|
|
jmp breturn
|
|
// memset::@return
|
|
breturn:
|
|
// [49] return
|
|
rts
|
|
// memset::@2
|
|
b2:
|
|
// [50] *((byte*) memset::dst#2) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1
|
|
lda #c
|
|
ldy #0
|
|
sta (dst),y
|
|
// [51] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1
|
|
inc.z dst
|
|
bne !+
|
|
inc.z dst+1
|
|
!:
|
|
// [47] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
|
|
b1_from_b2:
|
|
// [47] phi (byte*) memset::dst#2 = (byte*) memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy
|
|
jmp b1
|
|
}
|
|
// File Data
|
|
print_hextab: .text "0123456789abcdef"
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp b1
|
|
Removing instruction jmp bend
|
|
Removing instruction jmp b1
|
|
Removing instruction jmp b7
|
|
Removing instruction jmp b11
|
|
Removing instruction jmp b10
|
|
Removing instruction jmp b12
|
|
Removing instruction jmp b9
|
|
Removing instruction jmp b6
|
|
Removing instruction jmp b4
|
|
Removing instruction jmp b3
|
|
Removing instruction jmp breturn
|
|
Removing instruction jmp b1
|
|
Removing instruction jmp breturn
|
|
Removing instruction jmp b1
|
|
Removing instruction jmp breturn
|
|
Removing instruction jmp b1
|
|
Removing instruction jmp breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Replacing label b9_from_b8 with b9
|
|
Replacing label b4_from_b5 with b4
|
|
Removing instruction b1_from_bbegin:
|
|
Removing instruction b1:
|
|
Removing instruction main_from_b1:
|
|
Removing instruction bend_from_b1:
|
|
Removing instruction b12_from_b10:
|
|
Removing instruction print_char_from_b12:
|
|
Removing instruction b9_from_b12:
|
|
Removing instruction b9_from_b8:
|
|
Removing instruction b4_from_b5:
|
|
Removing instruction b4_from_b6:
|
|
Succesful ASM optimization Pass5RedundantLabelElimination
|
|
Removing instruction bend:
|
|
Removing instruction memset_from_main:
|
|
Removing instruction b1_from_main:
|
|
Removing instruction b7_from_b1:
|
|
Removing instruction b10:
|
|
Removing instruction b12:
|
|
Removing instruction b7_from_b9:
|
|
Removing instruction b6:
|
|
Removing instruction b1_from_b3:
|
|
Removing instruction breturn:
|
|
Removing instruction print_byte_from_print_word:
|
|
Removing instruction b1:
|
|
Removing instruction print_byte_from_b1:
|
|
Removing instruction breturn:
|
|
Removing instruction print_char_from_print_byte:
|
|
Removing instruction b1:
|
|
Removing instruction print_char_from_b1:
|
|
Removing instruction breturn:
|
|
Removing instruction b1_from_memset:
|
|
Removing instruction breturn:
|
|
Removing instruction b1_from_b2:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
Updating BasicUpstart to call main directly
|
|
Removing instruction jsr main
|
|
Succesful ASM optimization Pass5SkipBegin
|
|
Removing instruction bbegin:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
(label) @1
|
|
(label) @begin
|
|
(label) @end
|
|
(word) COUNT
|
|
(const word) COUNT#0 COUNT = (word) $4000
|
|
(const byte) RADIX::BINARY BINARY = (number) 2
|
|
(const byte) RADIX::DECIMAL DECIMAL = (number) $a
|
|
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (number) $10
|
|
(const byte) RADIX::OCTAL OCTAL = (number) 8
|
|
(byte*) SCREEN
|
|
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
|
|
(byte) SQRT_COUNT
|
|
(const byte) SQRT_COUNT#0 SQRT_COUNT = (byte) $80
|
|
(void()) main()
|
|
(byte*~) main::$19 $19 zp ZP_WORD:12 22.0
|
|
(label) main::@1
|
|
(label) main::@10
|
|
(label) main::@11
|
|
(label) main::@12
|
|
(label) main::@2
|
|
(label) main::@3
|
|
(label) main::@4
|
|
(label) main::@5
|
|
(label) main::@6
|
|
(label) main::@7
|
|
(label) main::@8
|
|
(label) main::@9
|
|
(word) main::i
|
|
(word) main::i#10 i#10 zp ZP_WORD:2 6.111111111111112
|
|
(word) main::i#12 i zp ZP_WORD:8 24.6
|
|
(word) main::i#2 i zp ZP_WORD:8 11.0
|
|
(word) main::i#3 i#3 zp ZP_WORD:2 22.0
|
|
(word) main::j
|
|
(word) main::j#0 j zp ZP_WORD:4 16.5
|
|
(word) main::j#1 j zp ZP_WORD:4 202.0
|
|
(word) main::j#2 j zp ZP_WORD:4 78.5
|
|
(byte*) main::s
|
|
(byte*) main::s#0 s zp ZP_WORD:6 22.0
|
|
(byte*) main::s#1 s zp ZP_WORD:6 101.0
|
|
(byte*) main::s#2 s zp ZP_WORD:6 104.66666666666666
|
|
(byte*) main::sieve_i
|
|
(byte*) main::sieve_i#1 sieve_i zp ZP_WORD:10 22.0
|
|
(byte*) main::sieve_i#2 sieve_i zp ZP_WORD:10 3.0
|
|
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
|
|
(label) memset::@1
|
|
(label) memset::@2
|
|
(label) memset::@return
|
|
(byte) memset::c
|
|
(const byte) memset::c#0 c = (byte) 0
|
|
(byte*) memset::dst
|
|
(byte*) memset::dst#1 dst zp ZP_WORD:10 22.0
|
|
(byte*) memset::dst#2 dst zp ZP_WORD:10 14.666666666666666
|
|
(byte*) memset::end
|
|
(const byte*) memset::end#0 end = (byte*)(const void*) memset::str#0+(const word) COUNT#0
|
|
(word) memset::num
|
|
(void*) memset::return
|
|
(void*) memset::str
|
|
(const void*) memset::str#0 str = (void*)(const byte*) sieve#0
|
|
(void()) print_byte((byte) print_byte::b)
|
|
(byte~) print_byte::$0 reg byte a 4.0
|
|
(byte~) print_byte::$2 reg byte x 4.0
|
|
(label) print_byte::@1
|
|
(label) print_byte::@return
|
|
(byte) print_byte::b
|
|
(byte) print_byte::b#0 reg byte x 4.0
|
|
(byte) print_byte::b#1 reg byte x 4.0
|
|
(byte) print_byte::b#2 reg byte x 2.0
|
|
(void()) print_char((byte) print_char::ch)
|
|
(label) print_char::@return
|
|
(byte) print_char::ch
|
|
(byte) print_char::ch#0 reg byte a 4.0
|
|
(byte) print_char::ch#1 reg byte a 4.0
|
|
(byte) print_char::ch#3 reg byte a 6.0
|
|
(byte*) print_char_cursor
|
|
(byte*) print_char_cursor#19 print_char_cursor zp ZP_WORD:8 9.5
|
|
(byte*) print_char_cursor#20 print_char_cursor zp ZP_WORD:8 1.9999999999999998
|
|
(byte*) print_char_cursor#26 print_char_cursor zp ZP_WORD:8 2.0
|
|
(byte*) print_char_cursor#27 print_char_cursor zp ZP_WORD:8 4.0
|
|
(byte*) print_char_cursor#35 print_char_cursor zp ZP_WORD:8 16.5
|
|
(byte[]) print_hextab
|
|
(const byte[]) print_hextab#0 print_hextab = (string) "0123456789abcdef"z
|
|
(byte*) print_line_cursor
|
|
(byte*) print_screen
|
|
(void()) print_word((word) print_word::w)
|
|
(label) print_word::@1
|
|
(label) print_word::@return
|
|
(word) print_word::w
|
|
(word) print_word::w#0 w zp ZP_WORD:2 5.0
|
|
(byte*) sieve
|
|
(const byte*) sieve#0 sieve = (byte*) 4096
|
|
|
|
zp ZP_WORD:2 [ main::i#10 main::i#3 print_word::w#0 ]
|
|
zp ZP_WORD:4 [ main::j#2 main::j#0 main::j#1 ]
|
|
zp ZP_WORD:6 [ main::s#2 main::s#0 main::s#1 ]
|
|
reg byte a [ print_char::ch#3 print_char::ch#0 print_char::ch#1 ]
|
|
zp ZP_WORD:8 [ print_char_cursor#19 print_char_cursor#27 print_char_cursor#35 print_char_cursor#20 print_char_cursor#26 main::i#12 main::i#2 ]
|
|
reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
|
|
zp ZP_WORD:10 [ memset::dst#2 memset::dst#1 main::sieve_i#2 main::sieve_i#1 ]
|
|
zp ZP_WORD:12 [ main::$19 ]
|
|
reg byte a [ print_byte::$0 ]
|
|
reg byte x [ print_byte::$2 ]
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 9766
|
|
|
|
// File Comments
|
|
// Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(main)
|
|
.pc = $80d "Program"
|
|
// Global Constants & labels
|
|
.label SCREEN = $400
|
|
.const COUNT = $4000
|
|
/* Up to what number? */
|
|
.const SQRT_COUNT = $80
|
|
/* Sqrt of COUNT */
|
|
.label sieve = $1000
|
|
.label print_char_cursor = 8
|
|
// @begin
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
|
// @1
|
|
// [2] call main
|
|
// [4] phi from @1 to main [phi:@1->main]
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
|
// @end
|
|
// main
|
|
main: {
|
|
.label i = 8
|
|
.label sieve_i = $a
|
|
.label j = 4
|
|
.label s = 6
|
|
.label i_3 = 2
|
|
.label i_10 = 2
|
|
.label _19 = $c
|
|
// memset(sieve, 0, COUNT)
|
|
// [5] call memset
|
|
// [46] phi from main to memset [phi:main->memset]
|
|
jsr memset
|
|
// [6] phi from main to main::@1 [phi:main->main::@1]
|
|
// [6] phi (byte*) main::sieve_i#2 = (const byte*) sieve#0+(byte) 2 [phi:main->main::@1#0] -- pbuz1=pbuc1
|
|
lda #<sieve+2
|
|
sta.z sieve_i
|
|
lda #>sieve+2
|
|
sta.z sieve_i+1
|
|
// [6] phi (word) main::i#12 = (byte) 2 [phi:main->main::@1#1] -- vwuz1=vbuc1
|
|
lda #<2
|
|
sta.z i
|
|
lda #>2
|
|
sta.z i+1
|
|
// main::@1
|
|
b1:
|
|
// while (i < SQRT_COUNT)
|
|
// [7] if((word) main::i#12<(const byte) SQRT_COUNT#0) goto main::@2 -- vwuz1_lt_vbuc1_then_la1
|
|
lda.z i+1
|
|
cmp #>SQRT_COUNT
|
|
bcc b2
|
|
bne !+
|
|
lda.z i
|
|
cmp #<SQRT_COUNT
|
|
bcc b2
|
|
!:
|
|
// [8] phi from main::@1 to main::@7 [phi:main::@1->main::@7]
|
|
// [8] phi (byte*) print_char_cursor#27 = (byte*) 1024 [phi:main::@1->main::@7#0] -- pbuz1=pbuc1
|
|
lda #<$400
|
|
sta.z print_char_cursor
|
|
lda #>$400
|
|
sta.z print_char_cursor+1
|
|
// [8] phi (word) main::i#10 = (byte) 2 [phi:main::@1->main::@7#1] -- vwuz1=vbuc1
|
|
lda #<2
|
|
sta.z i_10
|
|
lda #>2
|
|
sta.z i_10+1
|
|
// main::@7
|
|
b7:
|
|
// for (i = 2; i < 0x04c7; ++i)
|
|
// [9] if((word) main::i#10<(word) $4c7) goto main::@8 -- vwuz1_lt_vwuc1_then_la1
|
|
lda.z i_10+1
|
|
cmp #>$4c7
|
|
bcc b8
|
|
bne !+
|
|
lda.z i_10
|
|
cmp #<$4c7
|
|
bcc b8
|
|
!:
|
|
// main::@11
|
|
b11:
|
|
// (*(SCREEN+999))++;
|
|
// [10] *((const byte*) SCREEN#0+(word) $3e7) ← ++ *((const byte*) SCREEN#0+(word) $3e7) -- _deref_pbuc1=_inc__deref_pbuc1
|
|
inc SCREEN+$3e7
|
|
jmp b11
|
|
// main::@8
|
|
b8:
|
|
// if (!sieve[i])
|
|
// [11] (byte*~) main::$19 ← (const byte*) sieve#0 + (word) main::i#10 -- pbuz1=pbuc1_plus_vwuz2
|
|
lda.z i_10
|
|
clc
|
|
adc #<sieve
|
|
sta.z _19
|
|
lda.z i_10+1
|
|
adc #>sieve
|
|
sta.z _19+1
|
|
// [12] if((byte) 0!=*((byte*~) main::$19)) goto main::@9 -- vbuc1_neq__deref_pbuz1_then_la1
|
|
ldy #0
|
|
lda (_19),y
|
|
cmp #0
|
|
bne b9
|
|
// main::@10
|
|
// print_word(i)
|
|
// [13] (word) print_word::w#0 ← (word) main::i#10
|
|
// [14] call print_word
|
|
jsr print_word
|
|
// [15] phi from main::@10 to main::@12 [phi:main::@10->main::@12]
|
|
// main::@12
|
|
// print_char(' ')
|
|
// [16] call print_char
|
|
// [29] phi from main::@12 to print_char [phi:main::@12->print_char]
|
|
// [29] phi (byte*) print_char_cursor#19 = (byte*) print_char_cursor#20 [phi:main::@12->print_char#0] -- register_copy
|
|
// [29] phi (byte) print_char::ch#3 = (byte) ' ' [phi:main::@12->print_char#1] -- vbuaa=vbuc1
|
|
lda #' '
|
|
jsr print_char
|
|
// [17] phi from main::@12 main::@8 to main::@9 [phi:main::@12/main::@8->main::@9]
|
|
// [17] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#20 [phi:main::@12/main::@8->main::@9#0] -- register_copy
|
|
// main::@9
|
|
b9:
|
|
// for (i = 2; i < 0x04c7; ++i)
|
|
// [18] (word) main::i#3 ← ++ (word) main::i#10 -- vwuz1=_inc_vwuz1
|
|
inc.z i_3
|
|
bne !+
|
|
inc.z i_3+1
|
|
!:
|
|
// [8] phi from main::@9 to main::@7 [phi:main::@9->main::@7]
|
|
// [8] phi (byte*) print_char_cursor#27 = (byte*) print_char_cursor#35 [phi:main::@9->main::@7#0] -- register_copy
|
|
// [8] phi (word) main::i#10 = (word) main::i#3 [phi:main::@9->main::@7#1] -- register_copy
|
|
jmp b7
|
|
// main::@2
|
|
b2:
|
|
// if (!*sieve_i)
|
|
// [19] if((byte) 0!=*((byte*) main::sieve_i#2)) goto main::@3 -- vbuc1_neq__deref_pbuz1_then_la1
|
|
ldy #0
|
|
lda (sieve_i),y
|
|
cmp #0
|
|
bne b3
|
|
// main::@6
|
|
// j = i*2
|
|
// [20] (word) main::j#0 ← (word) main::i#12 << (byte) 1 -- vwuz1=vwuz2_rol_1
|
|
lda.z i
|
|
asl
|
|
sta.z j
|
|
lda.z i+1
|
|
rol
|
|
sta.z j+1
|
|
// s = &sieve[j]
|
|
// [21] (byte*) main::s#0 ← (const byte*) sieve#0 + (word) main::j#0 -- pbuz1=pbuc1_plus_vwuz2
|
|
lda.z j
|
|
clc
|
|
adc #<sieve
|
|
sta.z s
|
|
lda.z j+1
|
|
adc #>sieve
|
|
sta.z s+1
|
|
// [22] phi from main::@5 main::@6 to main::@4 [phi:main::@5/main::@6->main::@4]
|
|
// [22] phi (byte*) main::s#2 = (byte*) main::s#1 [phi:main::@5/main::@6->main::@4#0] -- register_copy
|
|
// [22] phi (word) main::j#2 = (word) main::j#1 [phi:main::@5/main::@6->main::@4#1] -- register_copy
|
|
// main::@4
|
|
b4:
|
|
// while (j < COUNT)
|
|
// [23] if((word) main::j#2<(const word) COUNT#0) goto main::@5 -- vwuz1_lt_vwuc1_then_la1
|
|
lda.z j+1
|
|
cmp #>COUNT
|
|
bcc b5
|
|
bne !+
|
|
lda.z j
|
|
cmp #<COUNT
|
|
bcc b5
|
|
!:
|
|
// main::@3
|
|
b3:
|
|
// i++;
|
|
// [24] (word) main::i#2 ← ++ (word) main::i#12 -- vwuz1=_inc_vwuz1
|
|
inc.z i
|
|
bne !+
|
|
inc.z i+1
|
|
!:
|
|
// sieve_i++;
|
|
// [25] (byte*) main::sieve_i#1 ← ++ (byte*) main::sieve_i#2 -- pbuz1=_inc_pbuz1
|
|
inc.z sieve_i
|
|
bne !+
|
|
inc.z sieve_i+1
|
|
!:
|
|
// [6] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
|
|
// [6] phi (byte*) main::sieve_i#2 = (byte*) main::sieve_i#1 [phi:main::@3->main::@1#0] -- register_copy
|
|
// [6] phi (word) main::i#12 = (word) main::i#2 [phi:main::@3->main::@1#1] -- register_copy
|
|
jmp b1
|
|
// main::@5
|
|
b5:
|
|
// *s = 1
|
|
// [26] *((byte*) main::s#2) ← (byte) 1 -- _deref_pbuz1=vbuc1
|
|
lda #1
|
|
ldy #0
|
|
sta (s),y
|
|
// s += i
|
|
// [27] (byte*) main::s#1 ← (byte*) main::s#2 + (word) main::i#12 -- pbuz1=pbuz1_plus_vwuz2
|
|
lda.z s
|
|
clc
|
|
adc.z i
|
|
sta.z s
|
|
lda.z s+1
|
|
adc.z i+1
|
|
sta.z s+1
|
|
// j += i
|
|
// [28] (word) main::j#1 ← (word) main::j#2 + (word) main::i#12 -- vwuz1=vwuz1_plus_vwuz2
|
|
lda.z j
|
|
clc
|
|
adc.z i
|
|
sta.z j
|
|
lda.z j+1
|
|
adc.z i+1
|
|
sta.z j+1
|
|
jmp b4
|
|
}
|
|
// print_char
|
|
// Print a single char
|
|
// print_char(byte register(A) ch)
|
|
print_char: {
|
|
// *(print_char_cursor++) = ch
|
|
// [30] *((byte*) print_char_cursor#19) ← (byte) print_char::ch#3 -- _deref_pbuz1=vbuaa
|
|
ldy #0
|
|
sta (print_char_cursor),y
|
|
// *(print_char_cursor++) = ch;
|
|
// [31] (byte*) print_char_cursor#20 ← ++ (byte*) print_char_cursor#19 -- pbuz1=_inc_pbuz1
|
|
inc.z print_char_cursor
|
|
bne !+
|
|
inc.z print_char_cursor+1
|
|
!:
|
|
// print_char::@return
|
|
// }
|
|
// [32] return
|
|
rts
|
|
}
|
|
// print_word
|
|
// Print a word as HEX
|
|
// print_word(word zeropage(2) w)
|
|
print_word: {
|
|
.label w = 2
|
|
// print_byte(>w)
|
|
// [33] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuxx=_hi_vwuz1
|
|
lda.z w+1
|
|
tax
|
|
// [34] call print_byte
|
|
// [38] phi from print_word to print_byte [phi:print_word->print_byte]
|
|
// [38] phi (byte*) print_char_cursor#26 = (byte*) print_char_cursor#27 [phi:print_word->print_byte#0] -- register_copy
|
|
// [38] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy
|
|
jsr print_byte
|
|
// print_word::@1
|
|
// print_byte(<w)
|
|
// [35] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuxx=_lo_vwuz1
|
|
lda.z w
|
|
tax
|
|
// [36] call print_byte
|
|
// [38] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte]
|
|
// [38] phi (byte*) print_char_cursor#26 = (byte*) print_char_cursor#20 [phi:print_word::@1->print_byte#0] -- register_copy
|
|
// [38] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy
|
|
jsr print_byte
|
|
// print_word::@return
|
|
// }
|
|
// [37] return
|
|
rts
|
|
}
|
|
// print_byte
|
|
// Print a byte as HEX
|
|
// print_byte(byte register(X) b)
|
|
print_byte: {
|
|
// b>>4
|
|
// [39] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuaa=vbuxx_ror_4
|
|
txa
|
|
lsr
|
|
lsr
|
|
lsr
|
|
lsr
|
|
// print_char(print_hextab[b>>4])
|
|
// [40] (byte) print_char::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte::$0) -- vbuaa=pbuc1_derefidx_vbuaa
|
|
tay
|
|
lda print_hextab,y
|
|
// [41] call print_char
|
|
// [29] phi from print_byte to print_char [phi:print_byte->print_char]
|
|
// [29] phi (byte*) print_char_cursor#19 = (byte*) print_char_cursor#26 [phi:print_byte->print_char#0] -- register_copy
|
|
// [29] phi (byte) print_char::ch#3 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy
|
|
jsr print_char
|
|
// print_byte::@1
|
|
// b&$f
|
|
// [42] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuxx=vbuxx_band_vbuc1
|
|
lda #$f
|
|
axs #0
|
|
// print_char(print_hextab[b&$f])
|
|
// [43] (byte) print_char::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte::$2) -- vbuaa=pbuc1_derefidx_vbuxx
|
|
lda print_hextab,x
|
|
// [44] call print_char
|
|
// [29] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char]
|
|
// [29] phi (byte*) print_char_cursor#19 = (byte*) print_char_cursor#20 [phi:print_byte::@1->print_char#0] -- register_copy
|
|
// [29] phi (byte) print_char::ch#3 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy
|
|
jsr print_char
|
|
// print_byte::@return
|
|
// }
|
|
// [45] return
|
|
rts
|
|
}
|
|
// memset
|
|
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
|
|
memset: {
|
|
.const c = 0
|
|
.label str = sieve
|
|
.label end = str+COUNT
|
|
.label dst = $a
|
|
// [47] phi from memset to memset::@1 [phi:memset->memset::@1]
|
|
// [47] phi (byte*) memset::dst#2 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1
|
|
lda #<str
|
|
sta.z dst
|
|
lda #>str
|
|
sta.z dst+1
|
|
// memset::@1
|
|
b1:
|
|
// for(char* dst = str; dst!=end; dst++)
|
|
// [48] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1
|
|
lda.z dst+1
|
|
cmp #>end
|
|
bne b2
|
|
lda.z dst
|
|
cmp #<end
|
|
bne b2
|
|
// memset::@return
|
|
// }
|
|
// [49] return
|
|
rts
|
|
// memset::@2
|
|
b2:
|
|
// *dst = c
|
|
// [50] *((byte*) memset::dst#2) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1
|
|
lda #c
|
|
ldy #0
|
|
sta (dst),y
|
|
// for(char* dst = str; dst!=end; dst++)
|
|
// [51] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1
|
|
inc.z dst
|
|
bne !+
|
|
inc.z dst+1
|
|
!:
|
|
// [47] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
|
|
// [47] phi (byte*) memset::dst#2 = (byte*) memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy
|
|
jmp b1
|
|
}
|
|
// File Data
|
|
print_hextab: .text "0123456789abcdef"
|
|
|