mirror of https://gitlab.com/camelot/kickc.git
1471 lines
65 KiB
Plaintext
1471 lines
65 KiB
Plaintext
Inlined call call __init
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void print_str_ln(char *str)
|
|
print_str_ln: scope:[print_str_ln] from game_ready::@1 main::@3
|
|
print_line_cursor#31 = phi( game_ready::@1/print_line_cursor#29, main::@3/print_line_cursor#27 )
|
|
print_char_cursor#33 = phi( game_ready::@1/print_char_cursor#40, main::@3/print_char_cursor#38 )
|
|
print_str_ln::str#2 = phi( game_ready::@1/print_str_ln::str#1, main::@3/print_str_ln::str#0 )
|
|
print_str::str#0 = print_str_ln::str#2
|
|
call print_str
|
|
to:print_str_ln::@1
|
|
print_str_ln::@1: scope:[print_str_ln] from print_str_ln
|
|
print_line_cursor#24 = phi( print_str_ln/print_line_cursor#31 )
|
|
print_char_cursor#17 = phi( print_str_ln/print_char_cursor#4 )
|
|
print_char_cursor#0 = print_char_cursor#17
|
|
call print_ln
|
|
to:print_str_ln::@2
|
|
print_str_ln::@2: scope:[print_str_ln] from print_str_ln::@1
|
|
print_char_cursor#18 = phi( print_str_ln::@1/print_char_cursor#6 )
|
|
print_line_cursor#12 = phi( print_str_ln::@1/print_line_cursor#3 )
|
|
print_line_cursor#0 = print_line_cursor#12
|
|
print_char_cursor#1 = print_char_cursor#18
|
|
to:print_str_ln::@return
|
|
print_str_ln::@return: scope:[print_str_ln] from print_str_ln::@2
|
|
print_line_cursor#13 = phi( print_str_ln::@2/print_line_cursor#0 )
|
|
print_char_cursor#19 = phi( print_str_ln::@2/print_char_cursor#1 )
|
|
print_char_cursor#2 = print_char_cursor#19
|
|
print_line_cursor#1 = print_line_cursor#13
|
|
return
|
|
to:@return
|
|
|
|
void print_str(char *str)
|
|
print_str: scope:[print_str] from print_str_ln
|
|
print_char_cursor#42 = phi( print_str_ln/print_char_cursor#33 )
|
|
print_str::str#5 = phi( print_str_ln/print_str::str#0 )
|
|
to:print_str::@1
|
|
print_str::@1: scope:[print_str] from print_str print_str::@3
|
|
print_char_cursor#35 = phi( print_str/print_char_cursor#42, print_str::@3/print_char_cursor#3 )
|
|
print_str::str#2 = phi( print_str/print_str::str#5, print_str::@3/print_str::str#1 )
|
|
print_str::$1 = 0 != *print_str::str#2
|
|
if(print_str::$1) goto print_str::@2
|
|
to:print_str::@return
|
|
print_str::@2: scope:[print_str] from print_str::@1
|
|
print_char_cursor#34 = phi( print_str::@1/print_char_cursor#35 )
|
|
print_str::str#3 = phi( print_str::@1/print_str::str#2 )
|
|
print_char::ch#0 = *print_str::str#3
|
|
call print_char
|
|
to:print_str::@3
|
|
print_str::@3: scope:[print_str] from print_str::@2
|
|
print_str::str#4 = phi( print_str::@2/print_str::str#3 )
|
|
print_char_cursor#20 = phi( print_str::@2/print_char_cursor#8 )
|
|
print_char_cursor#3 = print_char_cursor#20
|
|
print_str::str#1 = ++ print_str::str#4
|
|
to:print_str::@1
|
|
print_str::@return: scope:[print_str] from print_str::@1
|
|
print_char_cursor#21 = phi( print_str::@1/print_char_cursor#35 )
|
|
print_char_cursor#4 = print_char_cursor#21
|
|
return
|
|
to:@return
|
|
|
|
void print_ln()
|
|
print_ln: scope:[print_ln] from print_str_ln::@1
|
|
print_char_cursor#36 = phi( print_str_ln::@1/print_char_cursor#0 )
|
|
print_line_cursor#25 = phi( print_str_ln::@1/print_line_cursor#24 )
|
|
to:print_ln::@1
|
|
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
|
|
print_char_cursor#22 = phi( print_ln/print_char_cursor#36, print_ln::@1/print_char_cursor#22 )
|
|
print_line_cursor#14 = phi( print_ln/print_line_cursor#25, print_ln::@1/print_line_cursor#2 )
|
|
print_ln::$0 = print_line_cursor#14 + $28
|
|
print_line_cursor#2 = print_ln::$0
|
|
print_ln::$1 = print_line_cursor#2 < print_char_cursor#22
|
|
if(print_ln::$1) goto print_ln::@1
|
|
to:print_ln::@2
|
|
print_ln::@2: scope:[print_ln] from print_ln::@1
|
|
print_line_cursor#15 = phi( print_ln::@1/print_line_cursor#2 )
|
|
print_char_cursor#5 = print_line_cursor#15
|
|
to:print_ln::@return
|
|
print_ln::@return: scope:[print_ln] from print_ln::@2
|
|
print_char_cursor#23 = phi( print_ln::@2/print_char_cursor#5 )
|
|
print_line_cursor#16 = phi( print_ln::@2/print_line_cursor#15 )
|
|
print_line_cursor#3 = print_line_cursor#16
|
|
print_char_cursor#6 = print_char_cursor#23
|
|
return
|
|
to:@return
|
|
|
|
void print_char(char ch)
|
|
print_char: scope:[print_char] from print_str::@2
|
|
print_char_cursor#24 = phi( print_str::@2/print_char_cursor#34 )
|
|
print_char::ch#1 = phi( print_str::@2/print_char::ch#0 )
|
|
*print_char_cursor#24 = print_char::ch#1
|
|
print_char_cursor#7 = ++ print_char_cursor#24
|
|
to:print_char::@return
|
|
print_char::@return: scope:[print_char] from print_char
|
|
print_char_cursor#25 = phi( print_char/print_char_cursor#7 )
|
|
print_char_cursor#8 = print_char_cursor#25
|
|
return
|
|
to:@return
|
|
|
|
void main()
|
|
main: scope:[main] from __start::@1
|
|
action_count#19 = phi( __start::@1/action_count#18 )
|
|
print_line_cursor#32 = phi( __start::@1/print_line_cursor#30 )
|
|
print_char_cursor#43 = phi( __start::@1/print_char_cursor#41 )
|
|
main::i#0 = 0
|
|
to:main::@1
|
|
main::@1: scope:[main] from main main::@2
|
|
main::i#5 = phi( main/main::i#0, main::@2/main::i#1 )
|
|
action_count#15 = phi( main/action_count#19, main::@2/action_count#16 )
|
|
print_line_cursor#26 = phi( main/print_line_cursor#32, main::@2/print_line_cursor#28 )
|
|
print_char_cursor#37 = phi( main/print_char_cursor#43, main::@2/print_char_cursor#39 )
|
|
call game_ready
|
|
game_ready::return#0 = game_ready::return#2
|
|
to:main::@4
|
|
main::@4: scope:[main] from main::@1
|
|
main::i#3 = phi( main::@1/main::i#5 )
|
|
action_count#8 = phi( main::@1/action_count#4 )
|
|
print_line_cursor#17 = phi( main::@1/print_line_cursor#8 )
|
|
print_char_cursor#26 = phi( main::@1/print_char_cursor#13 )
|
|
game_ready::return#3 = phi( main::@1/game_ready::return#0 )
|
|
main::$0 = game_ready::return#3
|
|
print_char_cursor#9 = print_char_cursor#26
|
|
print_line_cursor#4 = print_line_cursor#17
|
|
action_count#0 = action_count#8
|
|
main::$1 = ! main::$0
|
|
if(main::$1) goto main::@2
|
|
to:main::@3
|
|
main::@2: scope:[main] from main::@4 main::@5
|
|
action_count#16 = phi( main::@4/action_count#0, main::@5/action_count#20 )
|
|
print_line_cursor#28 = phi( main::@4/print_line_cursor#4, main::@5/print_line_cursor#5 )
|
|
print_char_cursor#39 = phi( main::@4/print_char_cursor#9, main::@5/print_char_cursor#10 )
|
|
main::i#2 = phi( main::@4/main::i#3, main::@5/main::i#4 )
|
|
main::i#1 = main::i#2 + rangenext(0,5)
|
|
main::$3 = main::i#1 != rangelast(0,5)
|
|
if(main::$3) goto main::@1
|
|
to:main::@return
|
|
main::@3: scope:[main] from main::@4
|
|
action_count#21 = phi( main::@4/action_count#0 )
|
|
main::i#6 = phi( main::@4/main::i#3 )
|
|
print_line_cursor#27 = phi( main::@4/print_line_cursor#4 )
|
|
print_char_cursor#38 = phi( main::@4/print_char_cursor#9 )
|
|
print_str_ln::str#0 = main::str
|
|
call print_str_ln
|
|
to:main::@5
|
|
main::@5: scope:[main] from main::@3
|
|
action_count#20 = phi( main::@3/action_count#21 )
|
|
main::i#4 = phi( main::@3/main::i#6 )
|
|
print_line_cursor#18 = phi( main::@3/print_line_cursor#1 )
|
|
print_char_cursor#27 = phi( main::@3/print_char_cursor#2 )
|
|
print_char_cursor#10 = print_char_cursor#27
|
|
print_line_cursor#5 = print_line_cursor#18
|
|
to:main::@2
|
|
main::@return: scope:[main] from main::@2
|
|
action_count#9 = phi( main::@2/action_count#16 )
|
|
print_line_cursor#19 = phi( main::@2/print_line_cursor#28 )
|
|
print_char_cursor#28 = phi( main::@2/print_char_cursor#39 )
|
|
print_char_cursor#11 = print_char_cursor#28
|
|
print_line_cursor#6 = print_line_cursor#19
|
|
action_count#1 = action_count#9
|
|
return
|
|
to:@return
|
|
|
|
bool game_ready()
|
|
game_ready: scope:[game_ready] from main::@1
|
|
print_line_cursor#33 = phi( main::@1/print_line_cursor#26 )
|
|
print_char_cursor#44 = phi( main::@1/print_char_cursor#37 )
|
|
action_count#10 = phi( main::@1/action_count#15 )
|
|
game_ready::$0 = action_count#10 == 0
|
|
game_ready::$1 = ! game_ready::$0
|
|
if(game_ready::$1) goto game_ready::@1
|
|
to:game_ready::@2
|
|
game_ready::@1: scope:[game_ready] from game_ready game_ready::@2
|
|
action_count#17 = phi( game_ready/action_count#10, game_ready::@2/action_count#3 )
|
|
print_line_cursor#29 = phi( game_ready/print_line_cursor#33, game_ready::@2/print_line_cursor#34 )
|
|
print_char_cursor#40 = phi( game_ready/print_char_cursor#44, game_ready::@2/print_char_cursor#45 )
|
|
print_str_ln::str#1 = game_ready::str
|
|
call print_str_ln
|
|
to:game_ready::@3
|
|
game_ready::@3: scope:[game_ready] from game_ready::@1
|
|
action_count#11 = phi( game_ready::@1/action_count#17 )
|
|
print_line_cursor#20 = phi( game_ready::@1/print_line_cursor#1 )
|
|
print_char_cursor#29 = phi( game_ready::@1/print_char_cursor#2 )
|
|
print_char_cursor#12 = print_char_cursor#29
|
|
print_line_cursor#7 = print_line_cursor#20
|
|
action_count#2 = -- action_count#11
|
|
game_ready::$3 = action_count#2 == 0
|
|
game_ready::return#1 = game_ready::$3
|
|
to:game_ready::@return
|
|
game_ready::@2: scope:[game_ready] from game_ready
|
|
print_line_cursor#34 = phi( game_ready/print_line_cursor#33 )
|
|
print_char_cursor#45 = phi( game_ready/print_char_cursor#44 )
|
|
action_count#3 = READY_FRAMES
|
|
to:game_ready::@1
|
|
game_ready::@return: scope:[game_ready] from game_ready::@3
|
|
action_count#12 = phi( game_ready::@3/action_count#2 )
|
|
print_line_cursor#21 = phi( game_ready::@3/print_line_cursor#7 )
|
|
print_char_cursor#30 = phi( game_ready::@3/print_char_cursor#12 )
|
|
game_ready::return#4 = phi( game_ready::@3/game_ready::return#1 )
|
|
game_ready::return#2 = game_ready::return#4
|
|
print_char_cursor#13 = print_char_cursor#30
|
|
print_line_cursor#8 = print_line_cursor#21
|
|
action_count#4 = action_count#12
|
|
return
|
|
to:@return
|
|
|
|
void __start()
|
|
__start: scope:[__start] from
|
|
to:__start::__init1
|
|
__start::__init1: scope:[__start] from __start
|
|
print_screen#0 = (char *)$400
|
|
print_line_cursor#9 = print_screen#0
|
|
print_char_cursor#14 = print_line_cursor#9
|
|
action_count#5 = 0
|
|
to:__start::@1
|
|
__start::@1: scope:[__start] from __start::__init1
|
|
print_screen#4 = phi( __start::__init1/print_screen#0 )
|
|
action_count#18 = phi( __start::__init1/action_count#5 )
|
|
print_line_cursor#30 = phi( __start::__init1/print_line_cursor#9 )
|
|
print_char_cursor#41 = phi( __start::__init1/print_char_cursor#14 )
|
|
call main
|
|
to:__start::@2
|
|
__start::@2: scope:[__start] from __start::@1
|
|
print_screen#3 = phi( __start::@1/print_screen#4 )
|
|
action_count#13 = phi( __start::@1/action_count#1 )
|
|
print_line_cursor#22 = phi( __start::@1/print_line_cursor#6 )
|
|
print_char_cursor#31 = phi( __start::@1/print_char_cursor#11 )
|
|
print_char_cursor#15 = print_char_cursor#31
|
|
print_line_cursor#10 = print_line_cursor#22
|
|
action_count#6 = action_count#13
|
|
to:__start::@return
|
|
__start::@return: scope:[__start] from __start::@2
|
|
action_count#14 = phi( __start::@2/action_count#6 )
|
|
print_char_cursor#32 = phi( __start::@2/print_char_cursor#15 )
|
|
print_line_cursor#23 = phi( __start::@2/print_line_cursor#10 )
|
|
print_screen#2 = phi( __start::@2/print_screen#3 )
|
|
print_screen#1 = print_screen#2
|
|
print_line_cursor#11 = print_line_cursor#23
|
|
print_char_cursor#16 = print_char_cursor#32
|
|
action_count#7 = action_count#14
|
|
return
|
|
to:@return
|
|
|
|
SYMBOL TABLE SSA
|
|
__constant char RADIX::BINARY = 2
|
|
__constant char RADIX::DECIMAL = $a
|
|
__constant char RADIX::HEXADECIMAL = $10
|
|
__constant char RADIX::OCTAL = 8
|
|
__constant const char READY_FRAMES = 5
|
|
void __start()
|
|
char action_count
|
|
char action_count#0
|
|
char action_count#1
|
|
char action_count#10
|
|
char action_count#11
|
|
char action_count#12
|
|
char action_count#13
|
|
char action_count#14
|
|
char action_count#15
|
|
char action_count#16
|
|
char action_count#17
|
|
char action_count#18
|
|
char action_count#19
|
|
char action_count#2
|
|
char action_count#20
|
|
char action_count#21
|
|
char action_count#3
|
|
char action_count#4
|
|
char action_count#5
|
|
char action_count#6
|
|
char action_count#7
|
|
char action_count#8
|
|
char action_count#9
|
|
bool game_ready()
|
|
bool game_ready::$0
|
|
bool game_ready::$1
|
|
bool game_ready::$3
|
|
bool game_ready::return
|
|
bool game_ready::return#0
|
|
bool game_ready::return#1
|
|
bool game_ready::return#2
|
|
bool game_ready::return#3
|
|
bool game_ready::return#4
|
|
__constant char game_ready::str[6] = "ready"
|
|
void main()
|
|
bool main::$0
|
|
bool main::$1
|
|
bool main::$3
|
|
char main::i
|
|
char main::i#0
|
|
char main::i#1
|
|
char main::i#2
|
|
char main::i#3
|
|
char main::i#4
|
|
char main::i#5
|
|
char main::i#6
|
|
__constant char main::str[7] = "ready!"
|
|
void print_char(char ch)
|
|
char print_char::ch
|
|
char print_char::ch#0
|
|
char print_char::ch#1
|
|
char *print_char_cursor
|
|
char *print_char_cursor#0
|
|
char *print_char_cursor#1
|
|
char *print_char_cursor#10
|
|
char *print_char_cursor#11
|
|
char *print_char_cursor#12
|
|
char *print_char_cursor#13
|
|
char *print_char_cursor#14
|
|
char *print_char_cursor#15
|
|
char *print_char_cursor#16
|
|
char *print_char_cursor#17
|
|
char *print_char_cursor#18
|
|
char *print_char_cursor#19
|
|
char *print_char_cursor#2
|
|
char *print_char_cursor#20
|
|
char *print_char_cursor#21
|
|
char *print_char_cursor#22
|
|
char *print_char_cursor#23
|
|
char *print_char_cursor#24
|
|
char *print_char_cursor#25
|
|
char *print_char_cursor#26
|
|
char *print_char_cursor#27
|
|
char *print_char_cursor#28
|
|
char *print_char_cursor#29
|
|
char *print_char_cursor#3
|
|
char *print_char_cursor#30
|
|
char *print_char_cursor#31
|
|
char *print_char_cursor#32
|
|
char *print_char_cursor#33
|
|
char *print_char_cursor#34
|
|
char *print_char_cursor#35
|
|
char *print_char_cursor#36
|
|
char *print_char_cursor#37
|
|
char *print_char_cursor#38
|
|
char *print_char_cursor#39
|
|
char *print_char_cursor#4
|
|
char *print_char_cursor#40
|
|
char *print_char_cursor#41
|
|
char *print_char_cursor#42
|
|
char *print_char_cursor#43
|
|
char *print_char_cursor#44
|
|
char *print_char_cursor#45
|
|
char *print_char_cursor#5
|
|
char *print_char_cursor#6
|
|
char *print_char_cursor#7
|
|
char *print_char_cursor#8
|
|
char *print_char_cursor#9
|
|
char *print_line_cursor
|
|
char *print_line_cursor#0
|
|
char *print_line_cursor#1
|
|
char *print_line_cursor#10
|
|
char *print_line_cursor#11
|
|
char *print_line_cursor#12
|
|
char *print_line_cursor#13
|
|
char *print_line_cursor#14
|
|
char *print_line_cursor#15
|
|
char *print_line_cursor#16
|
|
char *print_line_cursor#17
|
|
char *print_line_cursor#18
|
|
char *print_line_cursor#19
|
|
char *print_line_cursor#2
|
|
char *print_line_cursor#20
|
|
char *print_line_cursor#21
|
|
char *print_line_cursor#22
|
|
char *print_line_cursor#23
|
|
char *print_line_cursor#24
|
|
char *print_line_cursor#25
|
|
char *print_line_cursor#26
|
|
char *print_line_cursor#27
|
|
char *print_line_cursor#28
|
|
char *print_line_cursor#29
|
|
char *print_line_cursor#3
|
|
char *print_line_cursor#30
|
|
char *print_line_cursor#31
|
|
char *print_line_cursor#32
|
|
char *print_line_cursor#33
|
|
char *print_line_cursor#34
|
|
char *print_line_cursor#4
|
|
char *print_line_cursor#5
|
|
char *print_line_cursor#6
|
|
char *print_line_cursor#7
|
|
char *print_line_cursor#8
|
|
char *print_line_cursor#9
|
|
void print_ln()
|
|
char *print_ln::$0
|
|
bool print_ln::$1
|
|
char *print_screen
|
|
char *print_screen#0
|
|
char *print_screen#1
|
|
char *print_screen#2
|
|
char *print_screen#3
|
|
char *print_screen#4
|
|
void print_str(char *str)
|
|
bool print_str::$1
|
|
char *print_str::str
|
|
char *print_str::str#0
|
|
char *print_str::str#1
|
|
char *print_str::str#2
|
|
char *print_str::str#3
|
|
char *print_str::str#4
|
|
char *print_str::str#5
|
|
void print_str_ln(char *str)
|
|
char *print_str_ln::str
|
|
char *print_str_ln::str#0
|
|
char *print_str_ln::str#1
|
|
char *print_str_ln::str#2
|
|
|
|
Adding number conversion cast (unumber) 0 in print_str::$1 = 0 != *print_str::str#2
|
|
Adding number conversion cast (unumber) $28 in print_ln::$0 = print_line_cursor#14 + $28
|
|
Adding number conversion cast (unumber) 0 in game_ready::$0 = action_count#10 == 0
|
|
Adding number conversion cast (unumber) 0 in game_ready::$3 = action_count#2 == 0
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast $28
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant pointer cast (char *) 1024
|
|
Successful SSA optimization PassNCastSimplification
|
|
Finalized unsigned number type (char) 0
|
|
Finalized unsigned number type (char) $28
|
|
Finalized unsigned number type (char) 0
|
|
Finalized unsigned number type (char) 0
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
Inversing boolean not [73] game_ready::$1 = action_count#10 != 0 from [72] game_ready::$0 = action_count#10 == 0
|
|
Successful SSA optimization Pass2UnaryNotSimplification
|
|
Alias print_line_cursor#24 = print_line_cursor#31
|
|
Alias print_char_cursor#0 = print_char_cursor#17
|
|
Alias print_line_cursor#0 = print_line_cursor#12 print_line_cursor#13 print_line_cursor#1
|
|
Alias print_char_cursor#1 = print_char_cursor#18 print_char_cursor#19 print_char_cursor#2
|
|
Alias print_str::str#2 = print_str::str#3 print_str::str#4
|
|
Alias print_char_cursor#21 = print_char_cursor#34 print_char_cursor#35 print_char_cursor#4
|
|
Alias print_char_cursor#20 = print_char_cursor#3
|
|
Alias print_line_cursor#15 = print_line_cursor#2 print_ln::$0 print_char_cursor#5 print_line_cursor#16 print_char_cursor#23 print_line_cursor#3 print_char_cursor#6
|
|
Alias print_char_cursor#25 = print_char_cursor#7 print_char_cursor#8
|
|
Alias game_ready::return#0 = game_ready::return#3
|
|
Alias main::i#3 = main::i#5 main::i#6 main::i#4
|
|
Alias print_char_cursor#26 = print_char_cursor#9 print_char_cursor#38
|
|
Alias print_line_cursor#17 = print_line_cursor#4 print_line_cursor#27
|
|
Alias action_count#0 = action_count#8 action_count#21 action_count#20
|
|
Alias print_char_cursor#10 = print_char_cursor#27
|
|
Alias print_line_cursor#18 = print_line_cursor#5
|
|
Alias print_char_cursor#11 = print_char_cursor#28 print_char_cursor#39
|
|
Alias print_line_cursor#19 = print_line_cursor#28 print_line_cursor#6
|
|
Alias action_count#1 = action_count#9 action_count#16
|
|
Alias action_count#11 = action_count#17
|
|
Alias print_char_cursor#12 = print_char_cursor#29 print_char_cursor#30 print_char_cursor#13
|
|
Alias print_line_cursor#20 = print_line_cursor#7 print_line_cursor#21 print_line_cursor#8
|
|
Alias game_ready::return#1 = game_ready::$3 game_ready::return#4 game_ready::return#2
|
|
Alias print_char_cursor#44 = print_char_cursor#45
|
|
Alias print_line_cursor#33 = print_line_cursor#34
|
|
Alias action_count#12 = action_count#2 action_count#4
|
|
Alias print_screen#0 = print_line_cursor#9 print_char_cursor#14 print_char_cursor#41 print_line_cursor#30 print_screen#4 print_screen#3 print_screen#2 print_screen#1
|
|
Alias action_count#18 = action_count#5
|
|
Alias print_char_cursor#15 = print_char_cursor#31 print_char_cursor#32 print_char_cursor#16
|
|
Alias print_line_cursor#10 = print_line_cursor#22 print_line_cursor#23 print_line_cursor#11
|
|
Alias action_count#13 = action_count#6 action_count#14 action_count#7
|
|
Successful SSA optimization Pass2AliasElimination
|
|
Alias main::i#2 = main::i#3
|
|
Alias action_count#0 = action_count#1
|
|
Alias print_char_cursor#40 = print_char_cursor#44
|
|
Alias print_line_cursor#29 = print_line_cursor#33
|
|
Successful SSA optimization Pass2AliasElimination
|
|
Identical Phi Values print_char_cursor#0 print_char_cursor#21
|
|
Identical Phi Values print_line_cursor#0 print_line_cursor#15
|
|
Identical Phi Values print_char_cursor#1 print_line_cursor#15
|
|
Identical Phi Values print_str::str#5 print_str::str#0
|
|
Identical Phi Values print_char_cursor#42 print_char_cursor#33
|
|
Identical Phi Values print_char_cursor#20 print_char_cursor#25
|
|
Identical Phi Values print_line_cursor#25 print_line_cursor#24
|
|
Identical Phi Values print_char_cursor#36 print_char_cursor#0
|
|
Identical Phi Values print_char_cursor#22 print_char_cursor#36
|
|
Identical Phi Values print_char::ch#1 print_char::ch#0
|
|
Identical Phi Values print_char_cursor#24 print_char_cursor#21
|
|
Identical Phi Values print_char_cursor#43 print_screen#0
|
|
Identical Phi Values print_line_cursor#32 print_screen#0
|
|
Identical Phi Values action_count#19 action_count#18
|
|
Identical Phi Values print_char_cursor#26 print_char_cursor#12
|
|
Identical Phi Values print_line_cursor#17 print_line_cursor#20
|
|
Identical Phi Values action_count#0 action_count#12
|
|
Identical Phi Values print_char_cursor#10 print_char_cursor#1
|
|
Identical Phi Values print_line_cursor#18 print_line_cursor#0
|
|
Identical Phi Values action_count#10 action_count#15
|
|
Identical Phi Values print_char_cursor#40 print_char_cursor#37
|
|
Identical Phi Values print_line_cursor#29 print_line_cursor#26
|
|
Identical Phi Values print_char_cursor#12 print_char_cursor#1
|
|
Identical Phi Values print_line_cursor#20 print_line_cursor#0
|
|
Identical Phi Values print_char_cursor#15 print_char_cursor#11
|
|
Identical Phi Values print_line_cursor#10 print_line_cursor#19
|
|
Identical Phi Values action_count#13 action_count#0
|
|
Successful SSA optimization Pass2IdenticalPhiElimination
|
|
Identical Phi Values print_char_cursor#11 print_line_cursor#15
|
|
Identical Phi Values print_line_cursor#19 print_line_cursor#15
|
|
Successful SSA optimization Pass2IdenticalPhiElimination
|
|
Simple Condition print_str::$1 [10] if(0!=*print_str::str#2) goto print_str::@2
|
|
Simple Condition print_ln::$1 [20] if(print_line_cursor#15<print_char_cursor#21) goto print_ln::@1
|
|
Simple Condition main::$3 [38] if(main::i#1!=rangelast(0,5)) goto main::@1
|
|
Simple Condition game_ready::$1 [45] if(action_count#15!=0) goto game_ready::@1
|
|
Successful SSA optimization Pass2ConditionalJumpSimplification
|
|
Rewriting ! if()-condition to reversed if() [33] main::$1 = ! main::$0
|
|
Successful SSA optimization Pass2ConditionalAndOrRewriting
|
|
Constant main::i#0 = 0
|
|
Constant print_str_ln::str#0 = main::str
|
|
Constant print_str_ln::str#1 = game_ready::str
|
|
Constant action_count#3 = READY_FRAMES
|
|
Constant print_screen#0 = (char *) 1024
|
|
Constant action_count#18 = 0
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Resolved ranged next value [36] main::i#1 = ++ main::i#2 to ++
|
|
Resolved ranged comparison value [38] if(main::i#1!=rangelast(0,5)) goto main::@1 to 6
|
|
Removing unused procedure __start
|
|
Removing unused procedure block __start
|
|
Removing unused procedure block __start::__init1
|
|
Removing unused procedure block __start::@1
|
|
Removing unused procedure block __start::@2
|
|
Removing unused procedure block __start::@return
|
|
Successful SSA optimization PassNEliminateEmptyStart
|
|
Adding number conversion cast (unumber) 6 in [24] if(main::i#1!=6) goto main::@1
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
Simplifying constant integer cast 6
|
|
Successful SSA optimization PassNCastSimplification
|
|
Finalized unsigned number type (char) 6
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
Inlining constant with var siblings print_str_ln::str#0
|
|
Inlining constant with var siblings print_str_ln::str#1
|
|
Inlining constant with var siblings main::i#0
|
|
Inlining constant with var siblings action_count#3
|
|
Inlining constant with var siblings action_count#18
|
|
Constant inlined print_str_ln::str#1 = game_ready::str
|
|
Constant inlined main::i#0 = 0
|
|
Constant inlined action_count#3 = READY_FRAMES
|
|
Constant inlined print_str_ln::str#0 = main::str
|
|
Constant inlined action_count#18 = 0
|
|
Successful SSA optimization Pass2ConstantInlining
|
|
Finalized unsigned number type (char) 2
|
|
Finalized unsigned number type (char) 8
|
|
Finalized unsigned number type (char) $a
|
|
Finalized unsigned number type (char) $10
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1)
|
|
Added new block during phi lifting main::@6(between main::@2 and main::@1)
|
|
Added new block during phi lifting game_ready::@4(between game_ready and game_ready::@1)
|
|
Adding NOP phi() at start of main
|
|
Adding NOP phi() at start of main::@5
|
|
Adding NOP phi() at start of game_ready::@2
|
|
Adding NOP phi() at start of print_str_ln::@1
|
|
Adding NOP phi() at start of print_str_ln::@2
|
|
Adding NOP phi() at start of print_ln::@2
|
|
CALL GRAPH
|
|
Calls in [main] to game_ready:2 print_str_ln:15
|
|
Calls in [game_ready] to print_str_ln:22
|
|
Calls in [print_str_ln] to print_str:29 print_ln:31
|
|
Calls in [print_str] to print_char:40
|
|
|
|
Created 11 initial phi equivalence classes
|
|
Not coalescing [9] print_char_cursor#50 = print_line_cursor#15
|
|
Coalesced [10] print_line_cursor#39 = print_line_cursor#15
|
|
Coalesced [11] action_count#22 = action_count#12
|
|
Coalesced [12] main::i#7 = main::i#1
|
|
Not coalescing [13] print_char_cursor#47 = print_line_cursor#15
|
|
Coalesced [14] print_line_cursor#36 = print_line_cursor#15
|
|
Coalesced [20] print_char_cursor#46 = print_char_cursor#37
|
|
Coalesced (already) [21] print_line_cursor#35 = print_line_cursor#26
|
|
Coalesced [26] action_count#23 = action_count#15
|
|
Coalesced [34] print_str::str#6 = print_str::str#0
|
|
Coalesced [35] print_char_cursor#48 = print_char_cursor#33
|
|
Coalesced [42] print_str::str#7 = print_str::str#1
|
|
Coalesced [43] print_char_cursor#49 = print_char_cursor#25
|
|
Coalesced [44] print_line_cursor#37 = print_line_cursor#24
|
|
Coalesced (already) [50] print_line_cursor#38 = print_line_cursor#15
|
|
Coalesced down to 6 phi equivalence classes
|
|
Culled Empty Block label main::@5
|
|
Culled Empty Block label game_ready::@2
|
|
Culled Empty Block label print_str_ln::@2
|
|
Culled Empty Block label print_ln::@2
|
|
Culled Empty Block label print_ln::@3
|
|
Renumbering block main::@6 to main::@5
|
|
Renumbering block game_ready::@3 to game_ready::@2
|
|
Renumbering block game_ready::@4 to game_ready::@3
|
|
Adding NOP phi() at start of main
|
|
Adding NOP phi() at start of game_ready::@3
|
|
Adding NOP phi() at start of print_str_ln::@1
|
|
Adding NOP phi() at start of print_str
|
|
Adding NOP phi() at start of print_ln
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
|
|
void main()
|
|
main: scope:[main] from
|
|
[0] phi()
|
|
to:main::@1
|
|
main::@1: scope:[main] from main main::@5
|
|
[1] main::i#2 = phi( main/0, main::@5/main::i#1 )
|
|
[1] action_count#15 = phi( main/0, main::@5/action_count#12 )
|
|
[1] print_line_cursor#26 = phi( main/print_screen#0, main::@5/print_line_cursor#15 )
|
|
[1] print_char_cursor#37 = phi( main/print_screen#0, main::@5/print_char_cursor#50 )
|
|
[2] call game_ready
|
|
[3] game_ready::return#0 = game_ready::return#1
|
|
to:main::@4
|
|
main::@4: scope:[main] from main::@1
|
|
[4] main::$0 = game_ready::return#0
|
|
[5] if(main::$0) goto main::@3
|
|
to:main::@2
|
|
main::@3: scope:[main] from main::@4
|
|
[6] print_char_cursor#47 = print_line_cursor#15
|
|
[7] call print_str_ln
|
|
to:main::@2
|
|
main::@2: scope:[main] from main::@3 main::@4
|
|
[8] main::i#1 = ++ main::i#2
|
|
[9] if(main::i#1!=6) goto main::@5
|
|
to:main::@return
|
|
main::@return: scope:[main] from main::@2
|
|
[10] return
|
|
to:@return
|
|
main::@5: scope:[main] from main::@2
|
|
[11] print_char_cursor#50 = print_line_cursor#15
|
|
to:main::@1
|
|
|
|
bool game_ready()
|
|
game_ready: scope:[game_ready] from main::@1
|
|
[12] if(action_count#15!=0) goto game_ready::@3
|
|
to:game_ready::@1
|
|
game_ready::@3: scope:[game_ready] from game_ready
|
|
[13] phi()
|
|
to:game_ready::@1
|
|
game_ready::@1: scope:[game_ready] from game_ready game_ready::@3
|
|
[14] action_count#11 = phi( game_ready::@3/action_count#15, game_ready/READY_FRAMES )
|
|
[15] call print_str_ln
|
|
to:game_ready::@2
|
|
game_ready::@2: scope:[game_ready] from game_ready::@1
|
|
[16] action_count#12 = -- action_count#11
|
|
[17] game_ready::return#1 = action_count#12 == 0
|
|
to:game_ready::@return
|
|
game_ready::@return: scope:[game_ready] from game_ready::@2
|
|
[18] return
|
|
to:@return
|
|
|
|
void print_str_ln(char *str)
|
|
print_str_ln: scope:[print_str_ln] from game_ready::@1 main::@3
|
|
[19] print_line_cursor#24 = phi( game_ready::@1/print_line_cursor#26, main::@3/print_line_cursor#15 )
|
|
[19] print_char_cursor#33 = phi( game_ready::@1/print_char_cursor#37, main::@3/print_char_cursor#47 )
|
|
[19] print_str_ln::str#2 = phi( game_ready::@1/game_ready::str, main::@3/main::str )
|
|
[20] print_str::str#0 = print_str_ln::str#2
|
|
[21] call print_str
|
|
to:print_str_ln::@1
|
|
print_str_ln::@1: scope:[print_str_ln] from print_str_ln
|
|
[22] phi()
|
|
[23] call print_ln
|
|
to:print_str_ln::@return
|
|
print_str_ln::@return: scope:[print_str_ln] from print_str_ln::@1
|
|
[24] return
|
|
to:@return
|
|
|
|
void print_str(char *str)
|
|
print_str: scope:[print_str] from print_str_ln
|
|
[25] phi()
|
|
to:print_str::@1
|
|
print_str::@1: scope:[print_str] from print_str print_str::@3
|
|
[26] print_char_cursor#21 = phi( print_str/print_char_cursor#33, print_str::@3/print_char_cursor#25 )
|
|
[26] print_str::str#2 = phi( print_str/print_str::str#0, print_str::@3/print_str::str#1 )
|
|
[27] if(0!=*print_str::str#2) goto print_str::@2
|
|
to:print_str::@return
|
|
print_str::@return: scope:[print_str] from print_str::@1
|
|
[28] return
|
|
to:@return
|
|
print_str::@2: scope:[print_str] from print_str::@1
|
|
[29] print_char::ch#0 = *print_str::str#2
|
|
[30] call print_char
|
|
to:print_str::@3
|
|
print_str::@3: scope:[print_str] from print_str::@2
|
|
[31] print_str::str#1 = ++ print_str::str#2
|
|
to:print_str::@1
|
|
|
|
void print_ln()
|
|
print_ln: scope:[print_ln] from print_str_ln::@1
|
|
[32] phi()
|
|
to:print_ln::@1
|
|
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
|
|
[33] print_line_cursor#14 = phi( print_ln/print_line_cursor#24, print_ln::@1/print_line_cursor#15 )
|
|
[34] print_line_cursor#15 = print_line_cursor#14 + $28
|
|
[35] if(print_line_cursor#15<print_char_cursor#21) goto print_ln::@1
|
|
to:print_ln::@return
|
|
print_ln::@return: scope:[print_ln] from print_ln::@1
|
|
[36] return
|
|
to:@return
|
|
|
|
void print_char(char ch)
|
|
print_char: scope:[print_char] from print_str::@2
|
|
[37] *print_char_cursor#21 = print_char::ch#0
|
|
[38] print_char_cursor#25 = ++ print_char_cursor#21
|
|
to:print_char::@return
|
|
print_char::@return: scope:[print_char] from print_char
|
|
[39] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
char action_count
|
|
char action_count#11 // 101.0
|
|
char action_count#12 // 17.75
|
|
char action_count#15 // 71.0
|
|
bool game_ready()
|
|
bool game_ready::return
|
|
bool game_ready::return#0 // 22.0
|
|
bool game_ready::return#1 // 37.33333333333333
|
|
void main()
|
|
bool main::$0 // 22.0
|
|
char main::i
|
|
char main::i#1 // 11.0
|
|
char main::i#2 // 3.142857142857143
|
|
void print_char(char ch)
|
|
char print_char::ch
|
|
char print_char::ch#0 // 1.1000002E7
|
|
char *print_char_cursor
|
|
char *print_char_cursor#21 // 2000909.5454545454
|
|
char *print_char_cursor#25 // 2750000.5
|
|
char *print_char_cursor#33 // 3371.0
|
|
char *print_char_cursor#37 // 28.0
|
|
char *print_char_cursor#47 // 22.0
|
|
char *print_char_cursor#50 // 22.0
|
|
char *print_line_cursor
|
|
char *print_line_cursor#14 // 2010003.0
|
|
char *print_line_cursor#15 // 166669.27777777775
|
|
char *print_line_cursor#24 // 2022.6000000000001
|
|
char *print_line_cursor#26 // 28.0
|
|
void print_ln()
|
|
char *print_screen
|
|
void print_str(char *str)
|
|
char *print_str::str
|
|
char *print_str::str#0 // 5501.0
|
|
char *print_str::str#1 // 2000002.0
|
|
char *print_str::str#2 // 1002501.25
|
|
void print_str_ln(char *str)
|
|
char *print_str_ln::str
|
|
char *print_str_ln::str#2 // 1001.0
|
|
|
|
Initial phi equivalence classes
|
|
[ main::i#2 main::i#1 ]
|
|
[ action_count#11 action_count#15 action_count#12 ]
|
|
[ print_str_ln::str#2 ]
|
|
[ print_str::str#2 print_str::str#0 print_str::str#1 ]
|
|
[ print_char_cursor#21 print_char_cursor#33 print_char_cursor#37 print_char_cursor#50 print_char_cursor#47 print_char_cursor#25 ]
|
|
[ print_line_cursor#14 print_line_cursor#24 print_line_cursor#26 print_line_cursor#15 ]
|
|
Added variable game_ready::return#0 to live range equivalence class [ game_ready::return#0 ]
|
|
Added variable main::$0 to live range equivalence class [ main::$0 ]
|
|
Added variable game_ready::return#1 to live range equivalence class [ game_ready::return#1 ]
|
|
Added variable print_char::ch#0 to live range equivalence class [ print_char::ch#0 ]
|
|
Complete equivalence classes
|
|
[ main::i#2 main::i#1 ]
|
|
[ action_count#11 action_count#15 action_count#12 ]
|
|
[ print_str_ln::str#2 ]
|
|
[ print_str::str#2 print_str::str#0 print_str::str#1 ]
|
|
[ print_char_cursor#21 print_char_cursor#33 print_char_cursor#37 print_char_cursor#50 print_char_cursor#47 print_char_cursor#25 ]
|
|
[ print_line_cursor#14 print_line_cursor#24 print_line_cursor#26 print_line_cursor#15 ]
|
|
[ game_ready::return#0 ]
|
|
[ main::$0 ]
|
|
[ game_ready::return#1 ]
|
|
[ print_char::ch#0 ]
|
|
Allocated zp[1]:2 [ print_char::ch#0 ]
|
|
Allocated zp[2]:3 [ print_char_cursor#21 print_char_cursor#33 print_char_cursor#37 print_char_cursor#50 print_char_cursor#47 print_char_cursor#25 ]
|
|
Allocated zp[2]:5 [ print_str::str#2 print_str::str#0 print_str::str#1 ]
|
|
Allocated zp[2]:7 [ print_line_cursor#14 print_line_cursor#24 print_line_cursor#26 print_line_cursor#15 ]
|
|
Allocated zp[2]:9 [ print_str_ln::str#2 ]
|
|
Allocated zp[1]:11 [ action_count#11 action_count#15 action_count#12 ]
|
|
Allocated zp[1]:12 [ game_ready::return#1 ]
|
|
Allocated zp[1]:13 [ game_ready::return#0 ]
|
|
Allocated zp[1]:14 [ main::$0 ]
|
|
Allocated zp[1]:15 [ main::i#2 main::i#1 ]
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [6] print_char_cursor#47 = print_line_cursor#15 [ main::i#2 print_line_cursor#15 action_count#12 print_char_cursor#47 ] ( [ main::i#2 print_line_cursor#15 action_count#12 print_char_cursor#47 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } } ) always clobbers reg byte a
|
|
Removing always clobbered register reg byte a as potential for zp[1]:15 [ main::i#2 main::i#1 ]
|
|
Removing always clobbered register reg byte a as potential for zp[1]:11 [ action_count#11 action_count#15 action_count#12 ]
|
|
Statement [11] print_char_cursor#50 = print_line_cursor#15 [ print_char_cursor#50 print_line_cursor#15 action_count#12 main::i#1 ] ( [ print_char_cursor#50 print_line_cursor#15 action_count#12 main::i#1 ] { } ) always clobbers reg byte a
|
|
Statement [17] game_ready::return#1 = action_count#12 == 0 [ print_line_cursor#15 action_count#12 game_ready::return#1 ] ( game_ready:2 [ main::i#2 print_line_cursor#15 action_count#12 game_ready::return#1 ] { { game_ready::return#0 = game_ready::return#1 } } ) always clobbers reg byte a
|
|
Statement [20] print_str::str#0 = print_str_ln::str#2 [ print_char_cursor#33 print_line_cursor#24 print_str::str#0 ] ( print_str_ln:7 [ main::i#2 action_count#12 print_char_cursor#33 print_line_cursor#24 print_str::str#0 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } { print_str::str#0 = print_str_ln::str#2 } } game_ready:2::print_str_ln:15 [ main::i#2 action_count#11 print_char_cursor#33 print_line_cursor#24 print_str::str#0 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } { print_str::str#0 = print_str_ln::str#2 } } ) always clobbers reg byte a
|
|
Statement [27] if(0!=*print_str::str#2) goto print_str::@2 [ print_str::str#2 print_char_cursor#21 ] ( print_str_ln:7::print_str:21 [ main::i#2 action_count#12 print_line_cursor#24 print_str::str#2 print_char_cursor#21 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } { print_str::str#0 = print_str_ln::str#2 } } game_ready:2::print_str_ln:15::print_str:21 [ main::i#2 action_count#11 print_line_cursor#24 print_str::str#2 print_char_cursor#21 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } { print_str::str#0 = print_str_ln::str#2 } } ) always clobbers reg byte a reg byte y
|
|
Removing always clobbered register reg byte y as potential for zp[1]:15 [ main::i#2 main::i#1 ]
|
|
Removing always clobbered register reg byte y as potential for zp[1]:11 [ action_count#11 action_count#15 action_count#12 ]
|
|
Statement [29] print_char::ch#0 = *print_str::str#2 [ print_str::str#2 print_char_cursor#21 print_char::ch#0 ] ( print_str_ln:7::print_str:21 [ main::i#2 action_count#12 print_line_cursor#24 print_str::str#2 print_char_cursor#21 print_char::ch#0 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } { print_str::str#0 = print_str_ln::str#2 } } game_ready:2::print_str_ln:15::print_str:21 [ main::i#2 action_count#11 print_line_cursor#24 print_str::str#2 print_char_cursor#21 print_char::ch#0 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } { print_str::str#0 = print_str_ln::str#2 } } ) always clobbers reg byte a reg byte y
|
|
Statement [34] print_line_cursor#15 = print_line_cursor#14 + $28 [ print_line_cursor#15 print_char_cursor#21 ] ( print_str_ln:7::print_ln:23 [ main::i#2 action_count#12 print_line_cursor#15 print_char_cursor#21 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } } game_ready:2::print_str_ln:15::print_ln:23 [ main::i#2 action_count#11 print_line_cursor#15 print_char_cursor#21 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } } ) always clobbers reg byte a
|
|
Statement [35] if(print_line_cursor#15<print_char_cursor#21) goto print_ln::@1 [ print_line_cursor#15 print_char_cursor#21 ] ( print_str_ln:7::print_ln:23 [ main::i#2 action_count#12 print_line_cursor#15 print_char_cursor#21 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } } game_ready:2::print_str_ln:15::print_ln:23 [ main::i#2 action_count#11 print_line_cursor#15 print_char_cursor#21 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } } ) always clobbers reg byte a
|
|
Statement [37] *print_char_cursor#21 = print_char::ch#0 [ print_char_cursor#21 ] ( print_str_ln:7::print_str:21::print_char:30 [ main::i#2 action_count#12 print_line_cursor#24 print_str::str#2 print_char_cursor#21 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } { print_str::str#0 = print_str_ln::str#2 } } game_ready:2::print_str_ln:15::print_str:21::print_char:30 [ main::i#2 action_count#11 print_line_cursor#24 print_str::str#2 print_char_cursor#21 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } { print_str::str#0 = print_str_ln::str#2 } } ) always clobbers reg byte y
|
|
Statement [6] print_char_cursor#47 = print_line_cursor#15 [ main::i#2 print_line_cursor#15 action_count#12 print_char_cursor#47 ] ( [ main::i#2 print_line_cursor#15 action_count#12 print_char_cursor#47 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } } ) always clobbers reg byte a
|
|
Statement [11] print_char_cursor#50 = print_line_cursor#15 [ print_char_cursor#50 print_line_cursor#15 action_count#12 main::i#1 ] ( [ print_char_cursor#50 print_line_cursor#15 action_count#12 main::i#1 ] { } ) always clobbers reg byte a
|
|
Statement [17] game_ready::return#1 = action_count#12 == 0 [ print_line_cursor#15 action_count#12 game_ready::return#1 ] ( game_ready:2 [ main::i#2 print_line_cursor#15 action_count#12 game_ready::return#1 ] { { game_ready::return#0 = game_ready::return#1 } } ) always clobbers reg byte a
|
|
Statement [20] print_str::str#0 = print_str_ln::str#2 [ print_char_cursor#33 print_line_cursor#24 print_str::str#0 ] ( print_str_ln:7 [ main::i#2 action_count#12 print_char_cursor#33 print_line_cursor#24 print_str::str#0 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } { print_str::str#0 = print_str_ln::str#2 } } game_ready:2::print_str_ln:15 [ main::i#2 action_count#11 print_char_cursor#33 print_line_cursor#24 print_str::str#0 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } { print_str::str#0 = print_str_ln::str#2 } } ) always clobbers reg byte a
|
|
Statement [27] if(0!=*print_str::str#2) goto print_str::@2 [ print_str::str#2 print_char_cursor#21 ] ( print_str_ln:7::print_str:21 [ main::i#2 action_count#12 print_line_cursor#24 print_str::str#2 print_char_cursor#21 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } { print_str::str#0 = print_str_ln::str#2 } } game_ready:2::print_str_ln:15::print_str:21 [ main::i#2 action_count#11 print_line_cursor#24 print_str::str#2 print_char_cursor#21 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } { print_str::str#0 = print_str_ln::str#2 } } ) always clobbers reg byte a reg byte y
|
|
Statement [29] print_char::ch#0 = *print_str::str#2 [ print_str::str#2 print_char_cursor#21 print_char::ch#0 ] ( print_str_ln:7::print_str:21 [ main::i#2 action_count#12 print_line_cursor#24 print_str::str#2 print_char_cursor#21 print_char::ch#0 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } { print_str::str#0 = print_str_ln::str#2 } } game_ready:2::print_str_ln:15::print_str:21 [ main::i#2 action_count#11 print_line_cursor#24 print_str::str#2 print_char_cursor#21 print_char::ch#0 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } { print_str::str#0 = print_str_ln::str#2 } } ) always clobbers reg byte a reg byte y
|
|
Statement [34] print_line_cursor#15 = print_line_cursor#14 + $28 [ print_line_cursor#15 print_char_cursor#21 ] ( print_str_ln:7::print_ln:23 [ main::i#2 action_count#12 print_line_cursor#15 print_char_cursor#21 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } } game_ready:2::print_str_ln:15::print_ln:23 [ main::i#2 action_count#11 print_line_cursor#15 print_char_cursor#21 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } } ) always clobbers reg byte a
|
|
Statement [35] if(print_line_cursor#15<print_char_cursor#21) goto print_ln::@1 [ print_line_cursor#15 print_char_cursor#21 ] ( print_str_ln:7::print_ln:23 [ main::i#2 action_count#12 print_line_cursor#15 print_char_cursor#21 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } } game_ready:2::print_str_ln:15::print_ln:23 [ main::i#2 action_count#11 print_line_cursor#15 print_char_cursor#21 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } } ) always clobbers reg byte a
|
|
Statement [37] *print_char_cursor#21 = print_char::ch#0 [ print_char_cursor#21 ] ( print_str_ln:7::print_str:21::print_char:30 [ main::i#2 action_count#12 print_line_cursor#24 print_str::str#2 print_char_cursor#21 ] { { print_char_cursor#33 = print_char_cursor#47 } { print_line_cursor#15 = print_line_cursor#24 } { print_str::str#0 = print_str_ln::str#2 } } game_ready:2::print_str_ln:15::print_str:21::print_char:30 [ main::i#2 action_count#11 print_line_cursor#24 print_str::str#2 print_char_cursor#21 ] { { game_ready::return#0 = game_ready::return#1 } { print_char_cursor#33 = print_char_cursor#37 } { print_line_cursor#24 = print_line_cursor#26 } { print_str::str#0 = print_str_ln::str#2 } } ) always clobbers reg byte y
|
|
Potential registers zp[1]:15 [ main::i#2 main::i#1 ] : zp[1]:15 , reg byte x ,
|
|
Potential registers zp[1]:11 [ action_count#11 action_count#15 action_count#12 ] : zp[1]:11 , reg byte x ,
|
|
Potential registers zp[2]:9 [ print_str_ln::str#2 ] : zp[2]:9 ,
|
|
Potential registers zp[2]:5 [ print_str::str#2 print_str::str#0 print_str::str#1 ] : zp[2]:5 ,
|
|
Potential registers zp[2]:3 [ print_char_cursor#21 print_char_cursor#33 print_char_cursor#37 print_char_cursor#50 print_char_cursor#47 print_char_cursor#25 ] : zp[2]:3 ,
|
|
Potential registers zp[2]:7 [ print_line_cursor#14 print_line_cursor#24 print_line_cursor#26 print_line_cursor#15 ] : zp[2]:7 ,
|
|
Potential registers zp[1]:13 [ game_ready::return#0 ] : zp[1]:13 , reg byte a , reg byte x , reg byte y ,
|
|
Potential registers zp[1]:14 [ main::$0 ] : zp[1]:14 , reg byte a , reg byte x , reg byte y ,
|
|
Potential registers zp[1]:12 [ game_ready::return#1 ] : zp[1]:12 , reg byte a , reg byte x , reg byte y ,
|
|
Potential registers zp[1]:2 [ print_char::ch#0 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y ,
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [print_char] 11,000,002: zp[1]:2 [ print_char::ch#0 ]
|
|
Uplift Scope [] 4,754,353.05: zp[2]:3 [ print_char_cursor#21 print_char_cursor#33 print_char_cursor#37 print_char_cursor#50 print_char_cursor#47 print_char_cursor#25 ] 2,178,722.88: zp[2]:7 [ print_line_cursor#14 print_line_cursor#24 print_line_cursor#26 print_line_cursor#15 ] 189.75: zp[1]:11 [ action_count#11 action_count#15 action_count#12 ]
|
|
Uplift Scope [print_str] 3,008,004.25: zp[2]:5 [ print_str::str#2 print_str::str#0 print_str::str#1 ]
|
|
Uplift Scope [print_str_ln] 1,001: zp[2]:9 [ print_str_ln::str#2 ]
|
|
Uplift Scope [game_ready] 37.33: zp[1]:12 [ game_ready::return#1 ] 22: zp[1]:13 [ game_ready::return#0 ]
|
|
Uplift Scope [main] 22: zp[1]:14 [ main::$0 ] 14.14: zp[1]:15 [ main::i#2 main::i#1 ]
|
|
Uplift Scope [print_ln]
|
|
Uplift Scope [RADIX]
|
|
|
|
Uplifting [print_char] best 10538 combination reg byte a [ print_char::ch#0 ]
|
|
Uplifting [] best 10498 combination zp[2]:3 [ print_char_cursor#21 print_char_cursor#33 print_char_cursor#37 print_char_cursor#50 print_char_cursor#47 print_char_cursor#25 ] zp[2]:7 [ print_line_cursor#14 print_line_cursor#24 print_line_cursor#26 print_line_cursor#15 ] reg byte x [ action_count#11 action_count#15 action_count#12 ]
|
|
Uplifting [print_str] best 10498 combination zp[2]:5 [ print_str::str#2 print_str::str#0 print_str::str#1 ]
|
|
Uplifting [print_str_ln] best 10498 combination zp[2]:9 [ print_str_ln::str#2 ]
|
|
Uplifting [game_ready] best 10405 combination reg byte a [ game_ready::return#1 ] reg byte a [ game_ready::return#0 ]
|
|
Uplifting [main] best 10345 combination reg byte a [ main::$0 ] zp[1]:15 [ main::i#2 main::i#1 ]
|
|
Uplifting [print_ln] best 10345 combination
|
|
Uplifting [RADIX] best 10345 combination
|
|
Attempting to uplift remaining variables inzp[1]:15 [ main::i#2 main::i#1 ]
|
|
Uplifting [main] best 10345 combination zp[1]:15 [ main::i#2 main::i#1 ]
|
|
Coalescing zero page register [ zp[2]:9 [ print_str_ln::str#2 ] ] with [ zp[2]:5 [ print_str::str#2 print_str::str#0 print_str::str#1 ] ] - score: 1
|
|
Allocated (was zp[2]:3) zp[2]:2 [ print_char_cursor#21 print_char_cursor#33 print_char_cursor#37 print_char_cursor#50 print_char_cursor#47 print_char_cursor#25 ]
|
|
Allocated (was zp[2]:9) zp[2]:4 [ print_str_ln::str#2 print_str::str#2 print_str::str#0 print_str::str#1 ]
|
|
Allocated (was zp[2]:7) zp[2]:6 [ print_line_cursor#14 print_line_cursor#24 print_line_cursor#26 print_line_cursor#15 ]
|
|
Allocated (was zp[1]:15) zp[1]:8 [ main::i#2 main::i#1 ]
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Adding a missing word-fragment for Travis Fisher
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="travis1.prg", type="prg", segments="Program"]
|
|
.segmentdef Program [segments="Basic, Code, Data"]
|
|
.segmentdef Basic [start=$0801]
|
|
.segmentdef Code [start=$80d]
|
|
.segmentdef Data [startAfter="Code"]
|
|
.segment Basic
|
|
:BasicUpstart(main)
|
|
// Global Constants & labels
|
|
.const READY_FRAMES = 5
|
|
.label print_screen = $400
|
|
.label print_char_cursor = 2
|
|
.label print_line_cursor = 6
|
|
.segment Code
|
|
// main
|
|
main: {
|
|
.label i = 8
|
|
// [1] phi from main to main::@1 [phi:main->main::@1]
|
|
__b1_from_main:
|
|
// [1] phi main::i#2 = 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
|
|
lda #0
|
|
sta.z i
|
|
// [1] phi action_count#15 = 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
|
|
ldx #0
|
|
// [1] phi print_line_cursor#26 = print_screen#0 [phi:main->main::@1#2] -- pbuz1=pbuc1
|
|
lda #<print_screen
|
|
sta.z print_line_cursor
|
|
lda #>print_screen
|
|
sta.z print_line_cursor+1
|
|
// [1] phi print_char_cursor#37 = print_screen#0 [phi:main->main::@1#3] -- pbuz1=pbuc1
|
|
lda #<print_screen
|
|
sta.z print_char_cursor
|
|
lda #>print_screen
|
|
sta.z print_char_cursor+1
|
|
jmp __b1
|
|
// main::@1
|
|
__b1:
|
|
// [2] call game_ready
|
|
jsr game_ready
|
|
// [3] game_ready::return#0 = game_ready::return#1
|
|
jmp __b4
|
|
// main::@4
|
|
__b4:
|
|
// [4] main::$0 = game_ready::return#0
|
|
// [5] if(main::$0) goto main::@3 -- vboaa_then_la1
|
|
cmp #0
|
|
bne __b3
|
|
jmp __b2
|
|
// main::@3
|
|
__b3:
|
|
// [6] print_char_cursor#47 = print_line_cursor#15 -- pbuz1=pbuz2
|
|
lda.z print_line_cursor
|
|
sta.z print_char_cursor
|
|
lda.z print_line_cursor+1
|
|
sta.z print_char_cursor+1
|
|
// [7] call print_str_ln
|
|
// [19] phi from main::@3 to print_str_ln [phi:main::@3->print_str_ln]
|
|
print_str_ln_from___b3:
|
|
// [19] phi print_line_cursor#24 = print_line_cursor#15 [phi:main::@3->print_str_ln#0] -- register_copy
|
|
// [19] phi print_char_cursor#33 = print_char_cursor#47 [phi:main::@3->print_str_ln#1] -- register_copy
|
|
// [19] phi print_str_ln::str#2 = main::str [phi:main::@3->print_str_ln#2] -- pbuz1=pbuc1
|
|
lda #<str
|
|
sta.z print_str_ln.str
|
|
lda #>str
|
|
sta.z print_str_ln.str+1
|
|
jsr print_str_ln
|
|
jmp __b2
|
|
// main::@2
|
|
__b2:
|
|
// [8] main::i#1 = ++ main::i#2 -- vbuz1=_inc_vbuz1
|
|
inc.z i
|
|
// [9] if(main::i#1!=6) goto main::@5 -- vbuz1_neq_vbuc1_then_la1
|
|
lda #6
|
|
cmp.z i
|
|
bne __b5
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [10] return
|
|
rts
|
|
// main::@5
|
|
__b5:
|
|
// [11] print_char_cursor#50 = print_line_cursor#15 -- pbuz1=pbuz2
|
|
lda.z print_line_cursor
|
|
sta.z print_char_cursor
|
|
lda.z print_line_cursor+1
|
|
sta.z print_char_cursor+1
|
|
// [1] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
|
|
__b1_from___b5:
|
|
// [1] phi main::i#2 = main::i#1 [phi:main::@5->main::@1#0] -- register_copy
|
|
// [1] phi action_count#15 = action_count#12 [phi:main::@5->main::@1#1] -- register_copy
|
|
// [1] phi print_line_cursor#26 = print_line_cursor#15 [phi:main::@5->main::@1#2] -- register_copy
|
|
// [1] phi print_char_cursor#37 = print_char_cursor#50 [phi:main::@5->main::@1#3] -- register_copy
|
|
jmp __b1
|
|
.segment Data
|
|
str: .text "ready!"
|
|
.byte 0
|
|
}
|
|
.segment Code
|
|
// game_ready
|
|
game_ready: {
|
|
// [12] if(action_count#15!=0) goto game_ready::@3 -- vbuxx_neq_0_then_la1
|
|
cpx #0
|
|
bne __b3_from_game_ready
|
|
// [14] phi from game_ready to game_ready::@1 [phi:game_ready->game_ready::@1]
|
|
__b1_from_game_ready:
|
|
// [14] phi action_count#11 = READY_FRAMES [phi:game_ready->game_ready::@1#0] -- vbuxx=vbuc1
|
|
ldx #READY_FRAMES
|
|
jmp __b1
|
|
// [13] phi from game_ready to game_ready::@3 [phi:game_ready->game_ready::@3]
|
|
__b3_from_game_ready:
|
|
jmp __b3
|
|
// game_ready::@3
|
|
__b3:
|
|
// [14] phi from game_ready::@3 to game_ready::@1 [phi:game_ready::@3->game_ready::@1]
|
|
__b1_from___b3:
|
|
// [14] phi action_count#11 = action_count#15 [phi:game_ready::@3->game_ready::@1#0] -- register_copy
|
|
jmp __b1
|
|
// game_ready::@1
|
|
__b1:
|
|
// [15] call print_str_ln
|
|
// [19] phi from game_ready::@1 to print_str_ln [phi:game_ready::@1->print_str_ln]
|
|
print_str_ln_from___b1:
|
|
// [19] phi print_line_cursor#24 = print_line_cursor#26 [phi:game_ready::@1->print_str_ln#0] -- register_copy
|
|
// [19] phi print_char_cursor#33 = print_char_cursor#37 [phi:game_ready::@1->print_str_ln#1] -- register_copy
|
|
// [19] phi print_str_ln::str#2 = game_ready::str [phi:game_ready::@1->print_str_ln#2] -- pbuz1=pbuc1
|
|
lda #<str
|
|
sta.z print_str_ln.str
|
|
lda #>str
|
|
sta.z print_str_ln.str+1
|
|
jsr print_str_ln
|
|
jmp __b2
|
|
// game_ready::@2
|
|
__b2:
|
|
// [16] action_count#12 = -- action_count#11 -- vbuxx=_dec_vbuxx
|
|
dex
|
|
// [17] game_ready::return#1 = action_count#12 == 0 -- vboaa=vbuxx_eq_vbuc1
|
|
lda #1
|
|
cpx #0
|
|
beq !+
|
|
lda #0
|
|
!:
|
|
jmp __breturn
|
|
// game_ready::@return
|
|
__breturn:
|
|
// [18] return
|
|
rts
|
|
.segment Data
|
|
str: .text "ready"
|
|
.byte 0
|
|
}
|
|
.segment Code
|
|
// print_str_ln
|
|
// Print a zero-terminated string followed by a newline
|
|
// void print_str_ln(__zp(4) char *str)
|
|
print_str_ln: {
|
|
.label str = 4
|
|
// [20] print_str::str#0 = print_str_ln::str#2
|
|
// [21] call print_str
|
|
// [25] phi from print_str_ln to print_str [phi:print_str_ln->print_str]
|
|
print_str_from_print_str_ln:
|
|
jsr print_str
|
|
// [22] phi from print_str_ln to print_str_ln::@1 [phi:print_str_ln->print_str_ln::@1]
|
|
__b1_from_print_str_ln:
|
|
jmp __b1
|
|
// print_str_ln::@1
|
|
__b1:
|
|
// [23] call print_ln
|
|
// [32] phi from print_str_ln::@1 to print_ln [phi:print_str_ln::@1->print_ln]
|
|
print_ln_from___b1:
|
|
jsr print_ln
|
|
jmp __breturn
|
|
// print_str_ln::@return
|
|
__breturn:
|
|
// [24] return
|
|
rts
|
|
}
|
|
// print_str
|
|
// Print a zero-terminated string
|
|
// void print_str(__zp(4) char *str)
|
|
print_str: {
|
|
.label str = 4
|
|
// [26] phi from print_str print_str::@3 to print_str::@1 [phi:print_str/print_str::@3->print_str::@1]
|
|
__b1_from_print_str:
|
|
__b1_from___b3:
|
|
// [26] phi print_char_cursor#21 = print_char_cursor#33 [phi:print_str/print_str::@3->print_str::@1#0] -- register_copy
|
|
// [26] phi print_str::str#2 = print_str::str#0 [phi:print_str/print_str::@3->print_str::@1#1] -- register_copy
|
|
jmp __b1
|
|
// print_str::@1
|
|
__b1:
|
|
// [27] if(0!=*print_str::str#2) goto print_str::@2 -- 0_neq__deref_pbuz1_then_la1
|
|
ldy #0
|
|
lda (str),y
|
|
cmp #0
|
|
bne __b2
|
|
jmp __breturn
|
|
// print_str::@return
|
|
__breturn:
|
|
// [28] return
|
|
rts
|
|
// print_str::@2
|
|
__b2:
|
|
// [29] print_char::ch#0 = *print_str::str#2 -- vbuaa=_deref_pbuz1
|
|
ldy #0
|
|
lda (str),y
|
|
// [30] call print_char
|
|
jsr print_char
|
|
jmp __b3
|
|
// print_str::@3
|
|
__b3:
|
|
// [31] print_str::str#1 = ++ print_str::str#2 -- pbuz1=_inc_pbuz1
|
|
inc.z str
|
|
bne !+
|
|
inc.z str+1
|
|
!:
|
|
jmp __b1_from___b3
|
|
}
|
|
// print_ln
|
|
// Print a newline
|
|
print_ln: {
|
|
// [33] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1]
|
|
__b1_from_print_ln:
|
|
__b1_from___b1:
|
|
// [33] phi print_line_cursor#14 = print_line_cursor#24 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy
|
|
jmp __b1
|
|
// print_ln::@1
|
|
__b1:
|
|
// [34] print_line_cursor#15 = print_line_cursor#14 + $28 -- pbuz1=pbuz1_plus_vbuc1
|
|
lda #$28
|
|
clc
|
|
adc.z print_line_cursor
|
|
sta.z print_line_cursor
|
|
bcc !+
|
|
inc.z print_line_cursor+1
|
|
!:
|
|
// [35] if(print_line_cursor#15<print_char_cursor#21) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1
|
|
lda.z print_line_cursor+1
|
|
cmp.z print_char_cursor+1
|
|
bcc __b1_from___b1
|
|
bne !+
|
|
lda.z print_line_cursor
|
|
cmp.z print_char_cursor
|
|
bcc __b1_from___b1
|
|
!:
|
|
jmp __breturn
|
|
// print_ln::@return
|
|
__breturn:
|
|
// [36] return
|
|
rts
|
|
}
|
|
// print_char
|
|
// Print a single char
|
|
// void print_char(__register(A) char ch)
|
|
print_char: {
|
|
// [37] *print_char_cursor#21 = print_char::ch#0 -- _deref_pbuz1=vbuaa
|
|
ldy #0
|
|
sta (print_char_cursor),y
|
|
// [38] print_char_cursor#25 = ++ print_char_cursor#21 -- pbuz1=_inc_pbuz1
|
|
inc.z print_char_cursor
|
|
bne !+
|
|
inc.z print_char_cursor+1
|
|
!:
|
|
jmp __breturn
|
|
// print_char::@return
|
|
__breturn:
|
|
// [39] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __b4
|
|
Removing instruction jmp __b2
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __b3
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __b2
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __b3
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Replacing instruction ldx #0 with TAX
|
|
Replacing label __b3_from_game_ready with __b1
|
|
Replacing label __b1_from___b3 with __b1
|
|
Replacing label __b1_from___b1 with __b1
|
|
Replacing label __b1_from___b1 with __b1
|
|
Removing instruction __b3_from_game_ready:
|
|
Removing instruction __b3:
|
|
Removing instruction __b1_from___b3:
|
|
Removing instruction print_str_ln_from___b1:
|
|
Removing instruction __b1_from_print_str_ln:
|
|
Removing instruction print_ln_from___b1:
|
|
Removing instruction __b1_from_print_str:
|
|
Removing instruction __b1_from___b3:
|
|
Removing instruction __b1_from_print_ln:
|
|
Removing instruction __b1_from___b1:
|
|
Succesful ASM optimization Pass5RedundantLabelElimination
|
|
Removing instruction __b1_from_main:
|
|
Removing instruction __b4:
|
|
Removing instruction print_str_ln_from___b3:
|
|
Removing instruction __breturn:
|
|
Removing instruction __b1_from___b5:
|
|
Removing instruction __b1_from_game_ready:
|
|
Removing instruction __b2:
|
|
Removing instruction __breturn:
|
|
Removing instruction print_str_from_print_str_ln:
|
|
Removing instruction __b1:
|
|
Removing instruction __breturn:
|
|
Removing instruction __breturn:
|
|
Removing instruction __b3:
|
|
Removing instruction __breturn:
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
Removing instruction jmp __b1
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
__constant char RADIX::BINARY = 2
|
|
__constant char RADIX::DECIMAL = $a
|
|
__constant char RADIX::HEXADECIMAL = $10
|
|
__constant char RADIX::OCTAL = 8
|
|
__constant const char READY_FRAMES = 5
|
|
char action_count
|
|
char action_count#11 // reg byte x 101.0
|
|
char action_count#12 // reg byte x 17.75
|
|
char action_count#15 // reg byte x 71.0
|
|
bool game_ready()
|
|
bool game_ready::return
|
|
bool game_ready::return#0 // reg byte a 22.0
|
|
bool game_ready::return#1 // reg byte a 37.33333333333333
|
|
__constant char game_ready::str[6] = "ready"
|
|
void main()
|
|
bool main::$0 // reg byte a 22.0
|
|
char main::i
|
|
char main::i#1 // i zp[1]:8 11.0
|
|
char main::i#2 // i zp[1]:8 3.142857142857143
|
|
__constant char main::str[7] = "ready!"
|
|
void print_char(char ch)
|
|
char print_char::ch
|
|
char print_char::ch#0 // reg byte a 1.1000002E7
|
|
char *print_char_cursor
|
|
char *print_char_cursor#21 // print_char_cursor zp[2]:2 2000909.5454545454
|
|
char *print_char_cursor#25 // print_char_cursor zp[2]:2 2750000.5
|
|
char *print_char_cursor#33 // print_char_cursor zp[2]:2 3371.0
|
|
char *print_char_cursor#37 // print_char_cursor zp[2]:2 28.0
|
|
char *print_char_cursor#47 // print_char_cursor zp[2]:2 22.0
|
|
char *print_char_cursor#50 // print_char_cursor zp[2]:2 22.0
|
|
char *print_line_cursor
|
|
char *print_line_cursor#14 // print_line_cursor zp[2]:6 2010003.0
|
|
char *print_line_cursor#15 // print_line_cursor zp[2]:6 166669.27777777775
|
|
char *print_line_cursor#24 // print_line_cursor zp[2]:6 2022.6000000000001
|
|
char *print_line_cursor#26 // print_line_cursor zp[2]:6 28.0
|
|
void print_ln()
|
|
char *print_screen
|
|
__constant char *print_screen#0 = (char *) 1024 // print_screen
|
|
void print_str(char *str)
|
|
char *print_str::str
|
|
char *print_str::str#0 // str zp[2]:4 5501.0
|
|
char *print_str::str#1 // str zp[2]:4 2000002.0
|
|
char *print_str::str#2 // str zp[2]:4 1002501.25
|
|
void print_str_ln(char *str)
|
|
char *print_str_ln::str
|
|
char *print_str_ln::str#2 // str zp[2]:4 1001.0
|
|
|
|
zp[1]:8 [ main::i#2 main::i#1 ]
|
|
reg byte x [ action_count#11 action_count#15 action_count#12 ]
|
|
zp[2]:4 [ print_str_ln::str#2 print_str::str#2 print_str::str#0 print_str::str#1 ]
|
|
zp[2]:2 [ print_char_cursor#21 print_char_cursor#33 print_char_cursor#37 print_char_cursor#50 print_char_cursor#47 print_char_cursor#25 ]
|
|
zp[2]:6 [ print_line_cursor#14 print_line_cursor#24 print_line_cursor#26 print_line_cursor#15 ]
|
|
reg byte a [ game_ready::return#0 ]
|
|
reg byte a [ main::$0 ]
|
|
reg byte a [ game_ready::return#1 ]
|
|
reg byte a [ print_char::ch#0 ]
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 8716
|
|
|
|
// File Comments
|
|
// Adding a missing word-fragment for Travis Fisher
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="travis1.prg", type="prg", segments="Program"]
|
|
.segmentdef Program [segments="Basic, Code, Data"]
|
|
.segmentdef Basic [start=$0801]
|
|
.segmentdef Code [start=$80d]
|
|
.segmentdef Data [startAfter="Code"]
|
|
.segment Basic
|
|
:BasicUpstart(main)
|
|
// Global Constants & labels
|
|
.const READY_FRAMES = 5
|
|
.label print_screen = $400
|
|
.label print_char_cursor = 2
|
|
.label print_line_cursor = 6
|
|
.segment Code
|
|
// main
|
|
main: {
|
|
.label i = 8
|
|
// [1] phi from main to main::@1 [phi:main->main::@1]
|
|
// [1] phi main::i#2 = 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
|
|
lda #0
|
|
sta.z i
|
|
// [1] phi action_count#15 = 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
|
|
tax
|
|
// [1] phi print_line_cursor#26 = print_screen#0 [phi:main->main::@1#2] -- pbuz1=pbuc1
|
|
lda #<print_screen
|
|
sta.z print_line_cursor
|
|
lda #>print_screen
|
|
sta.z print_line_cursor+1
|
|
// [1] phi print_char_cursor#37 = print_screen#0 [phi:main->main::@1#3] -- pbuz1=pbuc1
|
|
lda #<print_screen
|
|
sta.z print_char_cursor
|
|
lda #>print_screen
|
|
sta.z print_char_cursor+1
|
|
// main::@1
|
|
__b1:
|
|
// game_ready()
|
|
// [2] call game_ready
|
|
jsr game_ready
|
|
// [3] game_ready::return#0 = game_ready::return#1
|
|
// main::@4
|
|
// [4] main::$0 = game_ready::return#0
|
|
// if(game_ready())
|
|
// [5] if(main::$0) goto main::@3 -- vboaa_then_la1
|
|
cmp #0
|
|
bne __b3
|
|
jmp __b2
|
|
// main::@3
|
|
__b3:
|
|
// [6] print_char_cursor#47 = print_line_cursor#15 -- pbuz1=pbuz2
|
|
lda.z print_line_cursor
|
|
sta.z print_char_cursor
|
|
lda.z print_line_cursor+1
|
|
sta.z print_char_cursor+1
|
|
// print_str_ln("ready!")
|
|
// [7] call print_str_ln
|
|
// [19] phi from main::@3 to print_str_ln [phi:main::@3->print_str_ln]
|
|
// [19] phi print_line_cursor#24 = print_line_cursor#15 [phi:main::@3->print_str_ln#0] -- register_copy
|
|
// [19] phi print_char_cursor#33 = print_char_cursor#47 [phi:main::@3->print_str_ln#1] -- register_copy
|
|
// [19] phi print_str_ln::str#2 = main::str [phi:main::@3->print_str_ln#2] -- pbuz1=pbuc1
|
|
lda #<str
|
|
sta.z print_str_ln.str
|
|
lda #>str
|
|
sta.z print_str_ln.str+1
|
|
jsr print_str_ln
|
|
// main::@2
|
|
__b2:
|
|
// for(byte i:0..5)
|
|
// [8] main::i#1 = ++ main::i#2 -- vbuz1=_inc_vbuz1
|
|
inc.z i
|
|
// [9] if(main::i#1!=6) goto main::@5 -- vbuz1_neq_vbuc1_then_la1
|
|
lda #6
|
|
cmp.z i
|
|
bne __b5
|
|
// main::@return
|
|
// }
|
|
// [10] return
|
|
rts
|
|
// main::@5
|
|
__b5:
|
|
// [11] print_char_cursor#50 = print_line_cursor#15 -- pbuz1=pbuz2
|
|
lda.z print_line_cursor
|
|
sta.z print_char_cursor
|
|
lda.z print_line_cursor+1
|
|
sta.z print_char_cursor+1
|
|
// [1] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
|
|
// [1] phi main::i#2 = main::i#1 [phi:main::@5->main::@1#0] -- register_copy
|
|
// [1] phi action_count#15 = action_count#12 [phi:main::@5->main::@1#1] -- register_copy
|
|
// [1] phi print_line_cursor#26 = print_line_cursor#15 [phi:main::@5->main::@1#2] -- register_copy
|
|
// [1] phi print_char_cursor#37 = print_char_cursor#50 [phi:main::@5->main::@1#3] -- register_copy
|
|
jmp __b1
|
|
.segment Data
|
|
str: .text "ready!"
|
|
.byte 0
|
|
}
|
|
.segment Code
|
|
// game_ready
|
|
game_ready: {
|
|
// if (action_count == 0)
|
|
// [12] if(action_count#15!=0) goto game_ready::@3 -- vbuxx_neq_0_then_la1
|
|
cpx #0
|
|
bne __b1
|
|
// [14] phi from game_ready to game_ready::@1 [phi:game_ready->game_ready::@1]
|
|
// [14] phi action_count#11 = READY_FRAMES [phi:game_ready->game_ready::@1#0] -- vbuxx=vbuc1
|
|
ldx #READY_FRAMES
|
|
// [13] phi from game_ready to game_ready::@3 [phi:game_ready->game_ready::@3]
|
|
// game_ready::@3
|
|
// [14] phi from game_ready::@3 to game_ready::@1 [phi:game_ready::@3->game_ready::@1]
|
|
// [14] phi action_count#11 = action_count#15 [phi:game_ready::@3->game_ready::@1#0] -- register_copy
|
|
// game_ready::@1
|
|
__b1:
|
|
// print_str_ln("ready")
|
|
// [15] call print_str_ln
|
|
// [19] phi from game_ready::@1 to print_str_ln [phi:game_ready::@1->print_str_ln]
|
|
// [19] phi print_line_cursor#24 = print_line_cursor#26 [phi:game_ready::@1->print_str_ln#0] -- register_copy
|
|
// [19] phi print_char_cursor#33 = print_char_cursor#37 [phi:game_ready::@1->print_str_ln#1] -- register_copy
|
|
// [19] phi print_str_ln::str#2 = game_ready::str [phi:game_ready::@1->print_str_ln#2] -- pbuz1=pbuc1
|
|
lda #<str
|
|
sta.z print_str_ln.str
|
|
lda #>str
|
|
sta.z print_str_ln.str+1
|
|
jsr print_str_ln
|
|
// game_ready::@2
|
|
// action_count--;
|
|
// [16] action_count#12 = -- action_count#11 -- vbuxx=_dec_vbuxx
|
|
dex
|
|
// action_count==0
|
|
// [17] game_ready::return#1 = action_count#12 == 0 -- vboaa=vbuxx_eq_vbuc1
|
|
lda #1
|
|
cpx #0
|
|
beq !+
|
|
lda #0
|
|
!:
|
|
// game_ready::@return
|
|
// }
|
|
// [18] return
|
|
rts
|
|
.segment Data
|
|
str: .text "ready"
|
|
.byte 0
|
|
}
|
|
.segment Code
|
|
// print_str_ln
|
|
// Print a zero-terminated string followed by a newline
|
|
// void print_str_ln(__zp(4) char *str)
|
|
print_str_ln: {
|
|
.label str = 4
|
|
// print_str(str)
|
|
// [20] print_str::str#0 = print_str_ln::str#2
|
|
// [21] call print_str
|
|
// [25] phi from print_str_ln to print_str [phi:print_str_ln->print_str]
|
|
jsr print_str
|
|
// [22] phi from print_str_ln to print_str_ln::@1 [phi:print_str_ln->print_str_ln::@1]
|
|
// print_str_ln::@1
|
|
// print_ln()
|
|
// [23] call print_ln
|
|
// [32] phi from print_str_ln::@1 to print_ln [phi:print_str_ln::@1->print_ln]
|
|
jsr print_ln
|
|
// print_str_ln::@return
|
|
// }
|
|
// [24] return
|
|
rts
|
|
}
|
|
// print_str
|
|
// Print a zero-terminated string
|
|
// void print_str(__zp(4) char *str)
|
|
print_str: {
|
|
.label str = 4
|
|
// [26] phi from print_str print_str::@3 to print_str::@1 [phi:print_str/print_str::@3->print_str::@1]
|
|
// [26] phi print_char_cursor#21 = print_char_cursor#33 [phi:print_str/print_str::@3->print_str::@1#0] -- register_copy
|
|
// [26] phi print_str::str#2 = print_str::str#0 [phi:print_str/print_str::@3->print_str::@1#1] -- register_copy
|
|
// print_str::@1
|
|
__b1:
|
|
// while(*str)
|
|
// [27] if(0!=*print_str::str#2) goto print_str::@2 -- 0_neq__deref_pbuz1_then_la1
|
|
ldy #0
|
|
lda (str),y
|
|
cmp #0
|
|
bne __b2
|
|
// print_str::@return
|
|
// }
|
|
// [28] return
|
|
rts
|
|
// print_str::@2
|
|
__b2:
|
|
// print_char(*(str++))
|
|
// [29] print_char::ch#0 = *print_str::str#2 -- vbuaa=_deref_pbuz1
|
|
ldy #0
|
|
lda (str),y
|
|
// [30] call print_char
|
|
jsr print_char
|
|
// print_str::@3
|
|
// print_char(*(str++));
|
|
// [31] print_str::str#1 = ++ print_str::str#2 -- pbuz1=_inc_pbuz1
|
|
inc.z str
|
|
bne !+
|
|
inc.z str+1
|
|
!:
|
|
jmp __b1
|
|
}
|
|
// print_ln
|
|
// Print a newline
|
|
print_ln: {
|
|
// [33] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1]
|
|
// [33] phi print_line_cursor#14 = print_line_cursor#24 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy
|
|
// print_ln::@1
|
|
__b1:
|
|
// print_line_cursor + 0x28
|
|
// [34] print_line_cursor#15 = print_line_cursor#14 + $28 -- pbuz1=pbuz1_plus_vbuc1
|
|
lda #$28
|
|
clc
|
|
adc.z print_line_cursor
|
|
sta.z print_line_cursor
|
|
bcc !+
|
|
inc.z print_line_cursor+1
|
|
!:
|
|
// while (print_line_cursor<print_char_cursor)
|
|
// [35] if(print_line_cursor#15<print_char_cursor#21) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1
|
|
lda.z print_line_cursor+1
|
|
cmp.z print_char_cursor+1
|
|
bcc __b1
|
|
bne !+
|
|
lda.z print_line_cursor
|
|
cmp.z print_char_cursor
|
|
bcc __b1
|
|
!:
|
|
// print_ln::@return
|
|
// }
|
|
// [36] return
|
|
rts
|
|
}
|
|
// print_char
|
|
// Print a single char
|
|
// void print_char(__register(A) char ch)
|
|
print_char: {
|
|
// *(print_char_cursor++) = ch
|
|
// [37] *print_char_cursor#21 = print_char::ch#0 -- _deref_pbuz1=vbuaa
|
|
ldy #0
|
|
sta (print_char_cursor),y
|
|
// *(print_char_cursor++) = ch;
|
|
// [38] print_char_cursor#25 = ++ print_char_cursor#21 -- pbuz1=_inc_pbuz1
|
|
inc.z print_char_cursor
|
|
bne !+
|
|
inc.z print_char_cursor+1
|
|
!:
|
|
// print_char::@return
|
|
// }
|
|
// [39] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|