2021-04-04 22:29:49 +00:00
|
|
|
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
|
|
|
|
void main()
|
|
|
|
main: scope:[main] from __start
|
|
|
|
main::bu = 7
|
|
|
|
main::bs = 7
|
|
|
|
main::wu = $4e20
|
|
|
|
main::ws = -$b1
|
|
|
|
main::du = $1e8480
|
|
|
|
main::ds = -$39a4f1
|
|
|
|
main::ptr = (byte*)0
|
|
|
|
main::i#0 = 0
|
2021-04-05 00:02:30 +00:00
|
|
|
main::SCREEN[main::i#0] = >$11
|
2021-04-04 22:29:49 +00:00
|
|
|
main::i#1 = ++ main::i#0
|
2021-04-05 00:02:30 +00:00
|
|
|
main::SCREEN[main::i#1] = >$179
|
2021-04-04 22:29:49 +00:00
|
|
|
main::i#2 = ++ main::i#1
|
2021-04-05 00:02:30 +00:00
|
|
|
main::$0 = > main::bu
|
|
|
|
main::SCREEN[main::i#2] = main::$0
|
2021-04-04 22:29:49 +00:00
|
|
|
main::i#3 = ++ main::i#2
|
2021-04-05 00:02:30 +00:00
|
|
|
main::$1 = > main::bs
|
|
|
|
main::SCREEN[main::i#3] = main::$1
|
2021-04-04 22:29:49 +00:00
|
|
|
main::i#4 = ++ main::i#3
|
2021-04-05 00:02:30 +00:00
|
|
|
main::$2 = > main::wu
|
|
|
|
main::SCREEN[main::i#4] = main::$2
|
2021-04-04 22:29:49 +00:00
|
|
|
main::i#5 = ++ main::i#4
|
2021-04-05 00:02:30 +00:00
|
|
|
main::$3 = > main::ws
|
|
|
|
main::SCREEN[main::i#5] = main::$3
|
2021-04-04 22:29:49 +00:00
|
|
|
main::i#6 = ++ main::i#5
|
2021-04-05 00:02:30 +00:00
|
|
|
main::$4 = > main::du
|
|
|
|
main::SCREEN[main::i#6] = main::$4
|
2021-04-04 22:29:49 +00:00
|
|
|
main::i#7 = ++ main::i#6
|
2021-04-05 00:02:30 +00:00
|
|
|
main::$5 = > main::ds
|
|
|
|
main::SCREEN[main::i#7] = main::$5
|
2021-04-04 22:29:49 +00:00
|
|
|
main::i#8 = ++ main::i#7
|
2021-04-05 00:02:30 +00:00
|
|
|
main::$6 = > main::ptr
|
|
|
|
main::SCREEN[main::i#8] = main::$6
|
2021-04-04 22:29:49 +00:00
|
|
|
main::i#9 = ++ main::i#8
|
|
|
|
to:main::@return
|
|
|
|
main::@return: scope:[main] from main
|
|
|
|
return
|
|
|
|
to:@return
|
|
|
|
|
|
|
|
void __start()
|
|
|
|
__start: scope:[__start] from
|
|
|
|
call main
|
|
|
|
to:__start::@1
|
|
|
|
__start::@1: scope:[__start] from __start
|
|
|
|
to:__start::@return
|
|
|
|
__start::@return: scope:[__start] from __start::@1
|
|
|
|
return
|
|
|
|
to:@return
|
|
|
|
|
|
|
|
SYMBOL TABLE SSA
|
|
|
|
void __start()
|
|
|
|
void main()
|
|
|
|
byte~ main::$0
|
|
|
|
byte~ main::$1
|
|
|
|
byte~ main::$2
|
|
|
|
byte~ main::$3
|
|
|
|
byte~ main::$4
|
|
|
|
byte~ main::$5
|
|
|
|
byte~ main::$6
|
2021-04-30 15:26:46 +00:00
|
|
|
constant byte* const main::SCREEN = (byte*)$400
|
2021-04-04 22:29:49 +00:00
|
|
|
volatile signed byte main::bs loadstore
|
|
|
|
volatile byte main::bu loadstore
|
|
|
|
volatile signed dword main::ds loadstore
|
|
|
|
volatile dword main::du loadstore
|
|
|
|
byte main::i
|
|
|
|
byte main::i#0
|
|
|
|
byte main::i#1
|
|
|
|
byte main::i#2
|
|
|
|
byte main::i#3
|
|
|
|
byte main::i#4
|
|
|
|
byte main::i#5
|
|
|
|
byte main::i#6
|
|
|
|
byte main::i#7
|
|
|
|
byte main::i#8
|
|
|
|
byte main::i#9
|
2021-04-30 15:26:46 +00:00
|
|
|
byte* volatile main::ptr loadstore
|
2021-04-04 22:29:49 +00:00
|
|
|
volatile signed word main::ws loadstore
|
|
|
|
volatile word main::wu loadstore
|
|
|
|
|
|
|
|
Simplifying constant pointer cast (byte*) 1024
|
|
|
|
Simplifying constant pointer cast (byte*) 0
|
|
|
|
Successful SSA optimization PassNCastSimplification
|
2021-04-05 00:02:30 +00:00
|
|
|
Constant right-side identified [12] main::$0 = > main::bu
|
|
|
|
Constant right-side identified [15] main::$1 = > main::bs
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
|
|
Constant main::i#0 = 0
|
2021-04-05 00:02:30 +00:00
|
|
|
Constant main::$0 = 0
|
|
|
|
Constant main::$1 = 0
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2021-04-05 00:02:30 +00:00
|
|
|
Simplifying constant evaluating to zero >$11 in [8] main::SCREEN[main::i#0] = >$11
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization PassNSimplifyConstantZero
|
2021-04-05 00:02:30 +00:00
|
|
|
Simplifying expression containing zero main::SCREEN in [8] main::SCREEN[main::i#0] = 0
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization PassNSimplifyExpressionWithZero
|
2021-04-04 23:14:35 +00:00
|
|
|
Eliminating unused variable main::bu and assignment [0] main::bu = 7
|
|
|
|
Eliminating unused variable main::bs and assignment [1] main::bs = 7
|
|
|
|
Eliminating unused variable main::i#9 and assignment [29] main::i#9 = ++ main::i#8
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization PassNEliminateUnusedVars
|
|
|
|
Removing unused procedure __start
|
|
|
|
Removing unused procedure block __start
|
|
|
|
Removing unused procedure block __start::@1
|
|
|
|
Removing unused procedure block __start::@return
|
|
|
|
Successful SSA optimization PassNEliminateEmptyStart
|
2021-04-04 23:14:35 +00:00
|
|
|
Constant right-side identified [6] main::i#1 = ++ main::i#0
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
|
|
Constant main::i#1 = ++main::i#0
|
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2021-04-04 23:14:35 +00:00
|
|
|
Constant right-side identified [7] main::i#2 = ++ main::i#1
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
|
|
Constant main::i#2 = ++main::i#1
|
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2021-04-04 23:14:35 +00:00
|
|
|
Constant right-side identified [8] main::i#3 = ++ main::i#2
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
|
|
Constant main::i#3 = ++main::i#2
|
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2021-04-04 23:14:35 +00:00
|
|
|
Constant right-side identified [9] main::i#4 = ++ main::i#3
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
|
|
Constant main::i#4 = ++main::i#3
|
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2021-04-04 23:14:35 +00:00
|
|
|
Constant right-side identified [11] main::i#5 = ++ main::i#4
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
|
|
Constant main::i#5 = ++main::i#4
|
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2021-04-04 23:14:35 +00:00
|
|
|
Constant right-side identified [13] main::i#6 = ++ main::i#5
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
|
|
Constant main::i#6 = ++main::i#5
|
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2021-04-04 23:14:35 +00:00
|
|
|
Constant right-side identified [15] main::i#7 = ++ main::i#6
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
|
|
Constant main::i#7 = ++main::i#6
|
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2021-04-04 23:14:35 +00:00
|
|
|
Constant right-side identified [17] main::i#8 = ++ main::i#7
|
2021-04-04 22:29:49 +00:00
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
|
|
Constant main::i#8 = ++main::i#7
|
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
|
|
Inlining constant with different constant siblings main::i#0
|
|
|
|
Inlining constant with different constant siblings main::i#1
|
|
|
|
Inlining constant with different constant siblings main::i#2
|
|
|
|
Inlining constant with different constant siblings main::i#3
|
|
|
|
Inlining constant with different constant siblings main::i#4
|
|
|
|
Inlining constant with different constant siblings main::i#5
|
|
|
|
Inlining constant with different constant siblings main::i#6
|
|
|
|
Inlining constant with different constant siblings main::i#7
|
|
|
|
Inlining constant with different constant siblings main::i#8
|
|
|
|
Constant inlined main::i#8 = ++++++++++++++++0
|
|
|
|
Constant inlined main::i#7 = ++++++++++++++0
|
2021-04-05 00:02:30 +00:00
|
|
|
Constant inlined main::$1 = 0
|
2021-04-04 22:29:49 +00:00
|
|
|
Constant inlined main::i#4 = ++++++++0
|
|
|
|
Constant inlined main::i#3 = ++++++0
|
|
|
|
Constant inlined main::i#6 = ++++++++++++0
|
2021-04-04 23:14:35 +00:00
|
|
|
Constant inlined main::$0 = 0
|
2021-04-05 00:02:30 +00:00
|
|
|
Constant inlined main::i#5 = ++++++++++0
|
2021-04-04 22:29:49 +00:00
|
|
|
Constant inlined main::i#0 = 0
|
|
|
|
Constant inlined main::i#2 = ++++0
|
|
|
|
Constant inlined main::i#1 = ++0
|
|
|
|
Successful SSA optimization Pass2ConstantInlining
|
|
|
|
Consolidated array index constant in *(main::SCREEN+++0)
|
|
|
|
Consolidated array index constant in *(main::SCREEN+++++0)
|
|
|
|
Consolidated array index constant in *(main::SCREEN+++++++0)
|
|
|
|
Consolidated array index constant in *(main::SCREEN+++++++++0)
|
|
|
|
Consolidated array index constant in *(main::SCREEN+++++++++++0)
|
|
|
|
Consolidated array index constant in *(main::SCREEN+++++++++++++0)
|
|
|
|
Consolidated array index constant in *(main::SCREEN+++++++++++++++0)
|
|
|
|
Consolidated array index constant in *(main::SCREEN+++++++++++++++++0)
|
|
|
|
Successful SSA optimization Pass2ConstantAdditionElimination
|
|
|
|
Simplifying constant integer increment ++0
|
|
|
|
Simplifying constant integer increment ++0
|
|
|
|
Simplifying constant integer increment ++1
|
|
|
|
Simplifying constant integer increment ++2
|
|
|
|
Simplifying constant integer increment ++3
|
|
|
|
Simplifying constant integer increment ++4
|
|
|
|
Simplifying constant integer increment ++5
|
|
|
|
Simplifying constant integer increment ++6
|
|
|
|
Successful SSA optimization Pass2ConstantSimplification
|
|
|
|
Simplifying constant integer increment ++1
|
|
|
|
Simplifying constant integer increment ++2
|
|
|
|
Simplifying constant integer increment ++3
|
|
|
|
Simplifying constant integer increment ++4
|
|
|
|
Simplifying constant integer increment ++5
|
|
|
|
Simplifying constant integer increment ++6
|
|
|
|
Simplifying constant integer increment ++7
|
|
|
|
Successful SSA optimization Pass2ConstantSimplification
|
|
|
|
Finalized unsigned number type (word) $179
|
|
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
|
|
CALL GRAPH
|
|
|
|
|
|
|
|
Created 0 initial phi equivalence classes
|
|
|
|
Coalesced down to 0 phi equivalence classes
|
|
|
|
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
|
|
|
|
|
|
void main()
|
|
|
|
main: scope:[main] from
|
2021-04-04 23:14:35 +00:00
|
|
|
[0] main::wu = $4e20
|
|
|
|
[1] main::ws = -$b1
|
|
|
|
[2] main::du = $1e8480
|
|
|
|
[3] main::ds = -$39a4f1
|
|
|
|
[4] main::ptr = (byte*) 0
|
|
|
|
[5] *main::SCREEN = 0
|
|
|
|
[6] *(main::SCREEN+1) = >$179
|
|
|
|
[7] *(main::SCREEN+2) = 0
|
|
|
|
[8] *(main::SCREEN+3) = 0
|
2021-04-05 00:02:30 +00:00
|
|
|
[9] main::$2 = > main::wu
|
|
|
|
[10] *(main::SCREEN+4) = main::$2
|
|
|
|
[11] main::$3 = > main::ws
|
|
|
|
[12] *(main::SCREEN+5) = main::$3
|
|
|
|
[13] main::$4 = > main::du
|
|
|
|
[14] *(main::SCREEN+6) = main::$4
|
|
|
|
[15] main::$5 = > main::ds
|
|
|
|
[16] *(main::SCREEN+7) = main::$5
|
|
|
|
[17] main::$6 = > main::ptr
|
|
|
|
[18] *(main::SCREEN+8) = main::$6
|
2021-04-04 22:29:49 +00:00
|
|
|
to:main::@return
|
|
|
|
main::@return: scope:[main] from main
|
2021-04-04 23:14:35 +00:00
|
|
|
[19] return
|
2021-04-04 22:29:49 +00:00
|
|
|
to:@return
|
|
|
|
|
|
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
|
|
void main()
|
2021-04-05 00:02:30 +00:00
|
|
|
byte~ main::$2 4.0
|
|
|
|
byte~ main::$3 4.0
|
2021-04-04 22:29:49 +00:00
|
|
|
byte~ main::$4 4.0
|
|
|
|
byte~ main::$5 4.0
|
|
|
|
byte~ main::$6 4.0
|
2021-04-04 23:14:35 +00:00
|
|
|
volatile signed dword main::ds loadstore 0.3333333333333333
|
|
|
|
volatile dword main::du loadstore 0.36363636363636365
|
2021-04-04 22:29:49 +00:00
|
|
|
byte main::i
|
2021-04-30 15:26:46 +00:00
|
|
|
byte* volatile main::ptr loadstore 0.3076923076923077
|
2021-04-04 23:14:35 +00:00
|
|
|
volatile signed word main::ws loadstore 0.4
|
|
|
|
volatile word main::wu loadstore 0.4444444444444444
|
2021-04-04 22:29:49 +00:00
|
|
|
|
|
|
|
Initial phi equivalence classes
|
|
|
|
Added variable main::wu to live range equivalence class [ main::wu ]
|
|
|
|
Added variable main::ws to live range equivalence class [ main::ws ]
|
|
|
|
Added variable main::du to live range equivalence class [ main::du ]
|
|
|
|
Added variable main::ds to live range equivalence class [ main::ds ]
|
|
|
|
Added variable main::ptr to live range equivalence class [ main::ptr ]
|
2021-04-05 00:02:30 +00:00
|
|
|
Added variable main::$2 to live range equivalence class [ main::$2 ]
|
|
|
|
Added variable main::$3 to live range equivalence class [ main::$3 ]
|
2021-04-04 22:29:49 +00:00
|
|
|
Added variable main::$4 to live range equivalence class [ main::$4 ]
|
|
|
|
Added variable main::$5 to live range equivalence class [ main::$5 ]
|
|
|
|
Added variable main::$6 to live range equivalence class [ main::$6 ]
|
|
|
|
Complete equivalence classes
|
|
|
|
[ main::wu ]
|
|
|
|
[ main::ws ]
|
|
|
|
[ main::du ]
|
|
|
|
[ main::ds ]
|
|
|
|
[ main::ptr ]
|
2021-04-05 00:02:30 +00:00
|
|
|
[ main::$2 ]
|
|
|
|
[ main::$3 ]
|
2021-04-04 22:29:49 +00:00
|
|
|
[ main::$4 ]
|
|
|
|
[ main::$5 ]
|
|
|
|
[ main::$6 ]
|
2021-04-04 23:14:35 +00:00
|
|
|
Allocated zp[2]:2 [ main::wu ]
|
|
|
|
Allocated zp[2]:4 [ main::ws ]
|
|
|
|
Allocated zp[4]:6 [ main::du ]
|
|
|
|
Allocated zp[4]:10 [ main::ds ]
|
|
|
|
Allocated zp[2]:14 [ main::ptr ]
|
2021-04-05 00:02:30 +00:00
|
|
|
Allocated zp[1]:16 [ main::$2 ]
|
|
|
|
Allocated zp[1]:17 [ main::$3 ]
|
|
|
|
Allocated zp[1]:18 [ main::$4 ]
|
|
|
|
Allocated zp[1]:19 [ main::$5 ]
|
|
|
|
Allocated zp[1]:20 [ main::$6 ]
|
2021-04-04 22:29:49 +00:00
|
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
2021-04-04 23:14:35 +00:00
|
|
|
Statement [0] main::wu = $4e20 [ main::wu ] ( [ main::wu ] { } ) always clobbers reg byte a
|
|
|
|
Statement [1] main::ws = -$b1 [ main::wu main::ws ] ( [ main::wu main::ws ] { } ) always clobbers reg byte a
|
|
|
|
Statement [2] main::du = $1e8480 [ main::wu main::ws main::du ] ( [ main::wu main::ws main::du ] { } ) always clobbers reg byte a
|
|
|
|
Statement [3] main::ds = -$39a4f1 [ main::wu main::ws main::du main::ds ] ( [ main::wu main::ws main::du main::ds ] { } ) always clobbers reg byte a
|
|
|
|
Statement [4] main::ptr = (byte*) 0 [ main::wu main::ws main::du main::ds main::ptr ] ( [ main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
|
|
|
Statement [5] *main::SCREEN = 0 [ main::wu main::ws main::du main::ds main::ptr ] ( [ main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
|
|
|
Statement [6] *(main::SCREEN+1) = >$179 [ main::wu main::ws main::du main::ds main::ptr ] ( [ main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
|
|
|
Statement [7] *(main::SCREEN+2) = 0 [ main::wu main::ws main::du main::ds main::ptr ] ( [ main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
|
|
|
Statement [8] *(main::SCREEN+3) = 0 [ main::wu main::ws main::du main::ds main::ptr ] ( [ main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
|
|
|
Potential registers zp[2]:2 [ main::wu ] : zp[2]:2 ,
|
|
|
|
Potential registers zp[2]:4 [ main::ws ] : zp[2]:4 ,
|
|
|
|
Potential registers zp[4]:6 [ main::du ] : zp[4]:6 ,
|
|
|
|
Potential registers zp[4]:10 [ main::ds ] : zp[4]:10 ,
|
|
|
|
Potential registers zp[2]:14 [ main::ptr ] : zp[2]:14 ,
|
2021-04-05 00:02:30 +00:00
|
|
|
Potential registers zp[1]:16 [ main::$2 ] : zp[1]:16 , reg byte a , reg byte x , reg byte y ,
|
|
|
|
Potential registers zp[1]:17 [ main::$3 ] : zp[1]:17 , reg byte a , reg byte x , reg byte y ,
|
|
|
|
Potential registers zp[1]:18 [ main::$4 ] : zp[1]:18 , reg byte a , reg byte x , reg byte y ,
|
|
|
|
Potential registers zp[1]:19 [ main::$5 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y ,
|
|
|
|
Potential registers zp[1]:20 [ main::$6 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y ,
|
2021-04-04 22:29:49 +00:00
|
|
|
|
|
|
|
REGISTER UPLIFT SCOPES
|
2021-04-05 00:02:30 +00:00
|
|
|
Uplift Scope [main] 4: zp[1]:16 [ main::$2 ] 4: zp[1]:17 [ main::$3 ] 4: zp[1]:18 [ main::$4 ] 4: zp[1]:19 [ main::$5 ] 4: zp[1]:20 [ main::$6 ] 0.44: zp[2]:2 [ main::wu ] 0.4: zp[2]:4 [ main::ws ] 0.36: zp[4]:6 [ main::du ] 0.33: zp[4]:10 [ main::ds ] 0.31: zp[2]:14 [ main::ptr ]
|
2021-04-04 22:29:49 +00:00
|
|
|
Uplift Scope []
|
|
|
|
|
2021-04-05 00:02:30 +00:00
|
|
|
Uplifting [main] best 144 combination reg byte a [ main::$2 ] reg byte a [ main::$3 ] reg byte a [ main::$4 ] reg byte a [ main::$5 ] zp[1]:20 [ main::$6 ] zp[2]:2 [ main::wu ] zp[2]:4 [ main::ws ] zp[4]:6 [ main::du ] zp[4]:10 [ main::ds ] zp[2]:14 [ main::ptr ]
|
2021-04-04 23:14:35 +00:00
|
|
|
Limited combination testing to 100 combinations of 1024 possible.
|
|
|
|
Uplifting [] best 144 combination
|
2021-04-05 00:02:30 +00:00
|
|
|
Attempting to uplift remaining variables inzp[1]:20 [ main::$6 ]
|
|
|
|
Uplifting [main] best 138 combination reg byte a [ main::$6 ]
|
2021-04-04 22:29:49 +00:00
|
|
|
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
|
|
// File Comments
|
2021-04-04 23:14:35 +00:00
|
|
|
// Test operator BYTE1()
|
2021-04-04 22:29:49 +00:00
|
|
|
// Upstart
|
|
|
|
// Commodore 64 PRG executable file
|
|
|
|
.file [name="operator-byte1.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
|
|
|
|
.segment Code
|
|
|
|
// main
|
|
|
|
main: {
|
|
|
|
.label SCREEN = $400
|
2021-04-04 23:14:35 +00:00
|
|
|
.label wu = 2
|
|
|
|
.label ws = 4
|
|
|
|
.label du = 6
|
|
|
|
.label ds = $a
|
|
|
|
.label ptr = $e
|
|
|
|
// [0] main::wu = $4e20 -- vwuz1=vwuc1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #<$4e20
|
|
|
|
sta.z wu
|
|
|
|
lda #>$4e20
|
|
|
|
sta.z wu+1
|
2021-04-04 23:14:35 +00:00
|
|
|
// [1] main::ws = -$b1 -- vwsz1=vwsc1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #<-$b1
|
|
|
|
sta.z ws
|
|
|
|
lda #>-$b1
|
|
|
|
sta.z ws+1
|
2021-04-04 23:14:35 +00:00
|
|
|
// [2] main::du = $1e8480 -- vduz1=vduc1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #<$1e8480
|
|
|
|
sta.z du
|
|
|
|
lda #>$1e8480
|
|
|
|
sta.z du+1
|
|
|
|
lda #<$1e8480>>$10
|
|
|
|
sta.z du+2
|
|
|
|
lda #>$1e8480>>$10
|
|
|
|
sta.z du+3
|
2021-04-04 23:14:35 +00:00
|
|
|
// [3] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #<-$39a4f1
|
|
|
|
sta.z ds
|
|
|
|
lda #>-$39a4f1
|
|
|
|
sta.z ds+1
|
|
|
|
lda #<-$39a4f1>>$10
|
|
|
|
sta.z ds+2
|
|
|
|
lda #>-$39a4f1>>$10
|
|
|
|
sta.z ds+3
|
2021-04-04 23:14:35 +00:00
|
|
|
// [4] main::ptr = (byte*) 0 -- pbuz1=pbuc1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #<0
|
|
|
|
sta.z ptr
|
|
|
|
lda #>0
|
|
|
|
sta.z ptr+1
|
2021-04-04 23:14:35 +00:00
|
|
|
// [5] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #0
|
|
|
|
sta SCREEN
|
2021-04-04 23:14:35 +00:00
|
|
|
// [6] *(main::SCREEN+1) = >$179 -- _deref_pbuc1=vbuc2
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #>($179)
|
|
|
|
sta SCREEN+1
|
2021-04-04 23:14:35 +00:00
|
|
|
// [7] *(main::SCREEN+2) = 0 -- _deref_pbuc1=vbuc2
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #0
|
|
|
|
sta SCREEN+2
|
2021-04-04 23:14:35 +00:00
|
|
|
// [8] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #0
|
|
|
|
sta SCREEN+3
|
2021-04-05 00:02:30 +00:00
|
|
|
// [9] main::$2 = > main::wu -- vbuaa=_byte1_vwuz1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda.z wu+1
|
2021-04-05 00:02:30 +00:00
|
|
|
// [10] *(main::SCREEN+4) = main::$2 -- _deref_pbuc1=vbuaa
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+4
|
2021-04-05 00:02:30 +00:00
|
|
|
// [11] main::$3 = > main::ws -- vbuaa=_byte1_vwsz1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda.z ws+1
|
2021-04-05 00:02:30 +00:00
|
|
|
// [12] *(main::SCREEN+5) = main::$3 -- _deref_pbuc1=vbuaa
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+5
|
2021-04-05 00:02:30 +00:00
|
|
|
// [13] main::$4 = > main::du -- vbuaa=_byte1_vduz1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda.z du+1
|
2021-04-05 00:02:30 +00:00
|
|
|
// [14] *(main::SCREEN+6) = main::$4 -- _deref_pbuc1=vbuaa
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+6
|
2021-04-05 00:02:30 +00:00
|
|
|
// [15] main::$5 = > main::ds -- vbuaa=_byte1_vdsz1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda.z ds+1
|
2021-04-05 00:02:30 +00:00
|
|
|
// [16] *(main::SCREEN+7) = main::$5 -- _deref_pbuc1=vbuaa
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+7
|
2021-04-05 00:02:30 +00:00
|
|
|
// [17] main::$6 = > main::ptr -- vbuaa=_byte1_pbuz1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda.z ptr+1
|
2021-04-05 00:02:30 +00:00
|
|
|
// [18] *(main::SCREEN+8) = main::$6 -- _deref_pbuc1=vbuaa
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+8
|
|
|
|
jmp __breturn
|
|
|
|
// main::@return
|
|
|
|
__breturn:
|
2021-04-04 23:14:35 +00:00
|
|
|
// [19] return
|
2021-04-04 22:29:49 +00:00
|
|
|
rts
|
|
|
|
}
|
|
|
|
// File Data
|
|
|
|
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
|
|
Removing instruction jmp __breturn
|
|
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
|
|
Removing instruction lda #>0
|
|
|
|
Removing instruction lda #0
|
|
|
|
Removing instruction lda #0
|
|
|
|
Succesful ASM optimization Pass5UnnecesaryLoadElimination
|
|
|
|
Removing instruction __breturn:
|
|
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
|
|
|
|
FINAL SYMBOL TABLE
|
|
|
|
void main()
|
2021-04-05 00:02:30 +00:00
|
|
|
byte~ main::$2 reg byte a 4.0
|
|
|
|
byte~ main::$3 reg byte a 4.0
|
2021-04-04 22:29:49 +00:00
|
|
|
byte~ main::$4 reg byte a 4.0
|
|
|
|
byte~ main::$5 reg byte a 4.0
|
|
|
|
byte~ main::$6 reg byte a 4.0
|
2021-04-30 15:26:46 +00:00
|
|
|
constant byte* const main::SCREEN = (byte*) 1024
|
2021-04-04 23:14:35 +00:00
|
|
|
volatile signed dword main::ds loadstore zp[4]:10 0.3333333333333333
|
|
|
|
volatile dword main::du loadstore zp[4]:6 0.36363636363636365
|
2021-04-04 22:29:49 +00:00
|
|
|
byte main::i
|
2021-04-30 15:26:46 +00:00
|
|
|
byte* volatile main::ptr loadstore zp[2]:14 0.3076923076923077
|
2021-04-04 23:14:35 +00:00
|
|
|
volatile signed word main::ws loadstore zp[2]:4 0.4
|
|
|
|
volatile word main::wu loadstore zp[2]:2 0.4444444444444444
|
2021-04-04 22:29:49 +00:00
|
|
|
|
2021-04-04 23:14:35 +00:00
|
|
|
zp[2]:2 [ main::wu ]
|
|
|
|
zp[2]:4 [ main::ws ]
|
|
|
|
zp[4]:6 [ main::du ]
|
|
|
|
zp[4]:10 [ main::ds ]
|
|
|
|
zp[2]:14 [ main::ptr ]
|
2021-04-05 00:02:30 +00:00
|
|
|
reg byte a [ main::$2 ]
|
|
|
|
reg byte a [ main::$3 ]
|
2021-04-04 22:29:49 +00:00
|
|
|
reg byte a [ main::$4 ]
|
|
|
|
reg byte a [ main::$5 ]
|
|
|
|
reg byte a [ main::$6 ]
|
|
|
|
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
2021-04-04 23:14:35 +00:00
|
|
|
Score: 129
|
2021-04-04 22:29:49 +00:00
|
|
|
|
|
|
|
// File Comments
|
2021-04-04 23:14:35 +00:00
|
|
|
// Test operator BYTE1()
|
2021-04-04 22:29:49 +00:00
|
|
|
// Upstart
|
|
|
|
// Commodore 64 PRG executable file
|
|
|
|
.file [name="operator-byte1.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
|
|
|
|
.segment Code
|
|
|
|
// main
|
|
|
|
main: {
|
|
|
|
.label SCREEN = $400
|
2021-04-04 23:14:35 +00:00
|
|
|
.label wu = 2
|
|
|
|
.label ws = 4
|
|
|
|
.label du = 6
|
|
|
|
.label ds = $a
|
|
|
|
.label ptr = $e
|
2021-05-02 12:28:03 +00:00
|
|
|
// volatile unsigned int wu = 20000
|
2021-04-04 23:14:35 +00:00
|
|
|
// [0] main::wu = $4e20 -- vwuz1=vwuc1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #<$4e20
|
|
|
|
sta.z wu
|
|
|
|
lda #>$4e20
|
|
|
|
sta.z wu+1
|
2021-05-02 12:28:03 +00:00
|
|
|
// volatile signed int ws = -177
|
2021-04-04 23:14:35 +00:00
|
|
|
// [1] main::ws = -$b1 -- vwsz1=vwsc1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #<-$b1
|
|
|
|
sta.z ws
|
|
|
|
lda #>-$b1
|
|
|
|
sta.z ws+1
|
2021-05-02 12:28:03 +00:00
|
|
|
// volatile unsigned long du = 2000000
|
2021-04-04 23:14:35 +00:00
|
|
|
// [2] main::du = $1e8480 -- vduz1=vduc1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #<$1e8480
|
|
|
|
sta.z du
|
|
|
|
lda #>$1e8480
|
|
|
|
sta.z du+1
|
|
|
|
lda #<$1e8480>>$10
|
|
|
|
sta.z du+2
|
|
|
|
lda #>$1e8480>>$10
|
|
|
|
sta.z du+3
|
2021-05-02 12:28:03 +00:00
|
|
|
// volatile signed long ds = -3777777
|
2021-04-04 23:14:35 +00:00
|
|
|
// [3] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #<-$39a4f1
|
|
|
|
sta.z ds
|
|
|
|
lda #>-$39a4f1
|
|
|
|
sta.z ds+1
|
|
|
|
lda #<-$39a4f1>>$10
|
|
|
|
sta.z ds+2
|
|
|
|
lda #>-$39a4f1>>$10
|
|
|
|
sta.z ds+3
|
2021-05-11 11:36:45 +00:00
|
|
|
// char * volatile ptr = (char*)0x0000
|
2021-04-04 23:14:35 +00:00
|
|
|
// [4] main::ptr = (byte*) 0 -- pbuz1=pbuc1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #<0
|
|
|
|
sta.z ptr
|
|
|
|
sta.z ptr+1
|
|
|
|
// SCREEN[i++] = BYTE1(17)
|
2021-04-04 23:14:35 +00:00
|
|
|
// [5] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN
|
|
|
|
// SCREEN[i++] = BYTE1(377)
|
2021-04-04 23:14:35 +00:00
|
|
|
// [6] *(main::SCREEN+1) = >$179 -- _deref_pbuc1=vbuc2
|
2021-04-04 22:29:49 +00:00
|
|
|
lda #>($179)
|
|
|
|
sta SCREEN+1
|
|
|
|
// SCREEN[i++] = BYTE1(bu)
|
2021-04-04 23:14:35 +00:00
|
|
|
// [7] *(main::SCREEN+2) = 0 -- _deref_pbuc1=vbuc2
|
|
|
|
lda #0
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+2
|
|
|
|
// SCREEN[i++] = BYTE1(bs)
|
2021-04-04 23:14:35 +00:00
|
|
|
// [8] *(main::SCREEN+3) = 0 -- _deref_pbuc1=vbuc2
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+3
|
|
|
|
// BYTE1(wu)
|
2021-04-05 00:02:30 +00:00
|
|
|
// [9] main::$2 = > main::wu -- vbuaa=_byte1_vwuz1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda.z wu+1
|
|
|
|
// SCREEN[i++] = BYTE1(wu)
|
2021-04-05 00:02:30 +00:00
|
|
|
// [10] *(main::SCREEN+4) = main::$2 -- _deref_pbuc1=vbuaa
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+4
|
|
|
|
// BYTE1(ws)
|
2021-04-05 00:02:30 +00:00
|
|
|
// [11] main::$3 = > main::ws -- vbuaa=_byte1_vwsz1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda.z ws+1
|
|
|
|
// SCREEN[i++] = BYTE1(ws)
|
2021-04-05 00:02:30 +00:00
|
|
|
// [12] *(main::SCREEN+5) = main::$3 -- _deref_pbuc1=vbuaa
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+5
|
|
|
|
// BYTE1(du)
|
2021-04-05 00:02:30 +00:00
|
|
|
// [13] main::$4 = > main::du -- vbuaa=_byte1_vduz1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda.z du+1
|
|
|
|
// SCREEN[i++] = BYTE1(du)
|
2021-04-05 00:02:30 +00:00
|
|
|
// [14] *(main::SCREEN+6) = main::$4 -- _deref_pbuc1=vbuaa
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+6
|
|
|
|
// BYTE1(ds)
|
2021-04-05 00:02:30 +00:00
|
|
|
// [15] main::$5 = > main::ds -- vbuaa=_byte1_vdsz1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda.z ds+1
|
|
|
|
// SCREEN[i++] = BYTE1(ds)
|
2021-04-05 00:02:30 +00:00
|
|
|
// [16] *(main::SCREEN+7) = main::$5 -- _deref_pbuc1=vbuaa
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+7
|
|
|
|
// BYTE1(ptr)
|
2021-04-05 00:02:30 +00:00
|
|
|
// [17] main::$6 = > main::ptr -- vbuaa=_byte1_pbuz1
|
2021-04-04 22:29:49 +00:00
|
|
|
lda.z ptr+1
|
|
|
|
// SCREEN[i++] = BYTE1(ptr)
|
2021-04-05 00:02:30 +00:00
|
|
|
// [18] *(main::SCREEN+8) = main::$6 -- _deref_pbuc1=vbuaa
|
2021-04-04 22:29:49 +00:00
|
|
|
sta SCREEN+8
|
|
|
|
// main::@return
|
|
|
|
// }
|
2021-04-04 23:14:35 +00:00
|
|
|
// [19] return
|
2021-04-04 22:29:49 +00:00
|
|
|
rts
|
|
|
|
}
|
|
|
|
// File Data
|
|
|
|
|