mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-16 21:07:56 +00:00
Added initial support for special BYTE0() and BYTE1() unary operators giving access to specific bytes. #221
This commit is contained in:
parent
1d4e754f0e
commit
945d8a1113
93
src/test/ref/operator-byte0.asm
Normal file
93
src/test/ref/operator-byte0.asm
Normal file
@ -0,0 +1,93 @@
|
||||
// Test operator BYTE0()
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte0.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)
|
||||
.segment Code
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label bu = 2
|
||||
.label bs = 3
|
||||
.label wu = 4
|
||||
.label ws = 6
|
||||
.label du = 8
|
||||
.label ds = $c
|
||||
.label ptr = $10
|
||||
// bu = 7
|
||||
lda #7
|
||||
sta.z bu
|
||||
// bs = 7
|
||||
sta.z bs
|
||||
// wu = 20000
|
||||
lda #<$4e20
|
||||
sta.z wu
|
||||
lda #>$4e20
|
||||
sta.z wu+1
|
||||
// ws = -177
|
||||
lda #<-$b1
|
||||
sta.z ws
|
||||
lda #>-$b1
|
||||
sta.z ws+1
|
||||
// du = 2000000
|
||||
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
|
||||
// ds = -3777777
|
||||
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
|
||||
// ptr = 0x0000
|
||||
lda #<0
|
||||
sta.z ptr
|
||||
sta.z ptr+1
|
||||
// SCREEN[i++] = BYTE0(17)
|
||||
lda #<($11)
|
||||
sta SCREEN
|
||||
// SCREEN[i++] = BYTE0(377)
|
||||
lda #<($179)
|
||||
sta SCREEN+1
|
||||
// BYTE0(bu)
|
||||
lda.z bu
|
||||
// SCREEN[i++] = BYTE0(bu)
|
||||
sta SCREEN+2
|
||||
// BYTE0(bs)
|
||||
lda.z bs
|
||||
// SCREEN[i++] = BYTE0(bs)
|
||||
sta SCREEN+3
|
||||
// BYTE0(wu)
|
||||
lda.z wu
|
||||
// SCREEN[i++] = BYTE0(wu)
|
||||
sta SCREEN+4
|
||||
// BYTE0(ws)
|
||||
lda.z ws
|
||||
// SCREEN[i++] = BYTE0(ws)
|
||||
sta SCREEN+5
|
||||
// BYTE0(du)
|
||||
lda.z du
|
||||
// SCREEN[i++] = BYTE0(du)
|
||||
sta SCREEN+6
|
||||
// BYTE0(ds)
|
||||
lda.z ds
|
||||
// SCREEN[i++] = BYTE0(ds)
|
||||
sta SCREEN+7
|
||||
// BYTE0(ptr)
|
||||
lda.z ptr
|
||||
// SCREEN[i++] = BYTE0(ptr)
|
||||
sta SCREEN+8
|
||||
// }
|
||||
rts
|
||||
}
|
30
src/test/ref/operator-byte0.cfg
Normal file
30
src/test/ref/operator-byte0.cfg
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
void main()
|
||||
main: scope:[main] from
|
||||
[0] main::bu = 7
|
||||
[1] main::bs = 7
|
||||
[2] main::wu = $4e20
|
||||
[3] main::ws = -$b1
|
||||
[4] main::du = $1e8480
|
||||
[5] main::ds = -$39a4f1
|
||||
[6] main::ptr = (byte*) 0
|
||||
[7] *main::SCREEN = <$11
|
||||
[8] *(main::SCREEN+1) = <$179
|
||||
[9] main::$2 = < main::bu
|
||||
[10] *(main::SCREEN+2) = main::$2
|
||||
[11] main::$3 = < main::bs
|
||||
[12] *(main::SCREEN+3) = main::$3
|
||||
[13] main::$4 = < main::wu
|
||||
[14] *(main::SCREEN+4) = main::$4
|
||||
[15] main::$5 = < main::ws
|
||||
[16] *(main::SCREEN+5) = main::$5
|
||||
[17] main::$6 = < main::du
|
||||
[18] *(main::SCREEN+6) = main::$6
|
||||
[19] main::$7 = < main::ds
|
||||
[20] *(main::SCREEN+7) = main::$7
|
||||
[21] main::$8 = < main::ptr
|
||||
[22] *(main::SCREEN+8) = main::$8
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[23] return
|
||||
to:@return
|
609
src/test/ref/operator-byte0.log
Normal file
609
src/test/ref/operator-byte0.log
Normal file
@ -0,0 +1,609 @@
|
||||
|
||||
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
|
||||
main::$0 = < $11
|
||||
main::SCREEN[main::i#0] = main::$0
|
||||
main::i#1 = ++ main::i#0
|
||||
main::$1 = < $179
|
||||
main::SCREEN[main::i#1] = main::$1
|
||||
main::i#2 = ++ main::i#1
|
||||
main::$2 = < main::bu
|
||||
main::SCREEN[main::i#2] = main::$2
|
||||
main::i#3 = ++ main::i#2
|
||||
main::$3 = < main::bs
|
||||
main::SCREEN[main::i#3] = main::$3
|
||||
main::i#4 = ++ main::i#3
|
||||
main::$4 = < main::wu
|
||||
main::SCREEN[main::i#4] = main::$4
|
||||
main::i#5 = ++ main::i#4
|
||||
main::$5 = < main::ws
|
||||
main::SCREEN[main::i#5] = main::$5
|
||||
main::i#6 = ++ main::i#5
|
||||
main::$6 = < main::du
|
||||
main::SCREEN[main::i#6] = main::$6
|
||||
main::i#7 = ++ main::i#6
|
||||
main::$7 = < main::ds
|
||||
main::SCREEN[main::i#7] = main::$7
|
||||
main::i#8 = ++ main::i#7
|
||||
main::$8 = < main::ptr
|
||||
main::SCREEN[main::i#8] = main::$8
|
||||
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
|
||||
byte~ main::$7
|
||||
byte~ main::$8
|
||||
const nomodify byte* main::SCREEN = (byte*)$400
|
||||
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
|
||||
volatile byte* main::ptr loadstore
|
||||
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
|
||||
Constant right-side identified [8] main::$0 = < $11
|
||||
Constant right-side identified [11] main::$1 = < $179
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#0 = 0
|
||||
Constant main::$0 = <$11
|
||||
Constant main::$1 = <$179
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Simplifying expression containing zero main::SCREEN in [9] main::SCREEN[main::i#0] = main::$0
|
||||
Successful SSA optimization PassNSimplifyExpressionWithZero
|
||||
Eliminating unused variable main::i#9 and assignment [31] main::i#9 = ++ main::i#8
|
||||
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
|
||||
Constant right-side identified [8] main::i#1 = ++ main::i#0
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#1 = ++main::i#0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [9] main::i#2 = ++ main::i#1
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#2 = ++main::i#1
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [11] main::i#3 = ++ main::i#2
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#3 = ++main::i#2
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [13] main::i#4 = ++ main::i#3
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#4 = ++main::i#3
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [15] main::i#5 = ++ main::i#4
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#5 = ++main::i#4
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [17] main::i#6 = ++ main::i#5
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#6 = ++main::i#5
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [19] main::i#7 = ++ main::i#6
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#7 = ++main::i#6
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [21] main::i#8 = ++ main::i#7
|
||||
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
|
||||
Constant inlined main::$1 = <$179
|
||||
Constant inlined main::i#4 = ++++++++0
|
||||
Constant inlined main::i#3 = ++++++0
|
||||
Constant inlined main::i#6 = ++++++++++++0
|
||||
Constant inlined main::$0 = <$11
|
||||
Constant inlined main::i#5 = ++++++++++0
|
||||
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 (byte) $11
|
||||
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
|
||||
[0] main::bu = 7
|
||||
[1] main::bs = 7
|
||||
[2] main::wu = $4e20
|
||||
[3] main::ws = -$b1
|
||||
[4] main::du = $1e8480
|
||||
[5] main::ds = -$39a4f1
|
||||
[6] main::ptr = (byte*) 0
|
||||
[7] *main::SCREEN = <$11
|
||||
[8] *(main::SCREEN+1) = <$179
|
||||
[9] main::$2 = < main::bu
|
||||
[10] *(main::SCREEN+2) = main::$2
|
||||
[11] main::$3 = < main::bs
|
||||
[12] *(main::SCREEN+3) = main::$3
|
||||
[13] main::$4 = < main::wu
|
||||
[14] *(main::SCREEN+4) = main::$4
|
||||
[15] main::$5 = < main::ws
|
||||
[16] *(main::SCREEN+5) = main::$5
|
||||
[17] main::$6 = < main::du
|
||||
[18] *(main::SCREEN+6) = main::$6
|
||||
[19] main::$7 = < main::ds
|
||||
[20] *(main::SCREEN+7) = main::$7
|
||||
[21] main::$8 = < main::ptr
|
||||
[22] *(main::SCREEN+8) = main::$8
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[23] return
|
||||
to:@return
|
||||
|
||||
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
void main()
|
||||
byte~ main::$2 4.0
|
||||
byte~ main::$3 4.0
|
||||
byte~ main::$4 4.0
|
||||
byte~ main::$5 4.0
|
||||
byte~ main::$6 4.0
|
||||
byte~ main::$7 4.0
|
||||
byte~ main::$8 4.0
|
||||
volatile signed byte main::bs loadstore 0.4
|
||||
volatile byte main::bu loadstore 0.4444444444444444
|
||||
volatile signed dword main::ds loadstore 0.2857142857142857
|
||||
volatile dword main::du loadstore 0.3076923076923077
|
||||
byte main::i
|
||||
volatile byte* main::ptr loadstore 0.26666666666666666
|
||||
volatile signed word main::ws loadstore 0.3333333333333333
|
||||
volatile word main::wu loadstore 0.36363636363636365
|
||||
|
||||
Initial phi equivalence classes
|
||||
Added variable main::bu to live range equivalence class [ main::bu ]
|
||||
Added variable main::bs to live range equivalence class [ main::bs ]
|
||||
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 ]
|
||||
Added variable main::$2 to live range equivalence class [ main::$2 ]
|
||||
Added variable main::$3 to live range equivalence class [ main::$3 ]
|
||||
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 ]
|
||||
Added variable main::$7 to live range equivalence class [ main::$7 ]
|
||||
Added variable main::$8 to live range equivalence class [ main::$8 ]
|
||||
Complete equivalence classes
|
||||
[ main::bu ]
|
||||
[ main::bs ]
|
||||
[ main::wu ]
|
||||
[ main::ws ]
|
||||
[ main::du ]
|
||||
[ main::ds ]
|
||||
[ main::ptr ]
|
||||
[ main::$2 ]
|
||||
[ main::$3 ]
|
||||
[ main::$4 ]
|
||||
[ main::$5 ]
|
||||
[ main::$6 ]
|
||||
[ main::$7 ]
|
||||
[ main::$8 ]
|
||||
Allocated zp[1]:2 [ main::bu ]
|
||||
Allocated zp[1]:3 [ main::bs ]
|
||||
Allocated zp[2]:4 [ main::wu ]
|
||||
Allocated zp[2]:6 [ main::ws ]
|
||||
Allocated zp[4]:8 [ main::du ]
|
||||
Allocated zp[4]:12 [ main::ds ]
|
||||
Allocated zp[2]:16 [ main::ptr ]
|
||||
Allocated zp[1]:18 [ main::$2 ]
|
||||
Allocated zp[1]:19 [ main::$3 ]
|
||||
Allocated zp[1]:20 [ main::$4 ]
|
||||
Allocated zp[1]:21 [ main::$5 ]
|
||||
Allocated zp[1]:22 [ main::$6 ]
|
||||
Allocated zp[1]:23 [ main::$7 ]
|
||||
Allocated zp[1]:24 [ main::$8 ]
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [0] main::bu = 7 [ main::bu ] ( [ main::bu ] { } ) always clobbers reg byte a
|
||||
Statement [1] main::bs = 7 [ main::bu main::bs ] ( [ main::bu main::bs ] { } ) always clobbers reg byte a
|
||||
Statement [2] main::wu = $4e20 [ main::bu main::bs main::wu ] ( [ main::bu main::bs main::wu ] { } ) always clobbers reg byte a
|
||||
Statement [3] main::ws = -$b1 [ main::bu main::bs main::wu main::ws ] ( [ main::bu main::bs main::wu main::ws ] { } ) always clobbers reg byte a
|
||||
Statement [4] main::du = $1e8480 [ main::bu main::bs main::wu main::ws main::du ] ( [ main::bu main::bs main::wu main::ws main::du ] { } ) always clobbers reg byte a
|
||||
Statement [5] main::ds = -$39a4f1 [ main::bu main::bs main::wu main::ws main::du main::ds ] ( [ main::bu main::bs main::wu main::ws main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [6] main::ptr = (byte*) 0 [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] ( [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [7] *main::SCREEN = <$11 [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] ( [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [8] *(main::SCREEN+1) = <$179 [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] ( [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [9] main::$2 = < main::bu [ main::bs main::wu main::ws main::du main::ds main::ptr main::$2 ] ( [ main::bs main::wu main::ws main::du main::ds main::ptr main::$2 ] { } ) always clobbers reg byte a
|
||||
Statement [11] main::$3 = < main::bs [ main::wu main::ws main::du main::ds main::ptr main::$3 ] ( [ main::wu main::ws main::du main::ds main::ptr main::$3 ] { } ) always clobbers reg byte a
|
||||
Potential registers zp[1]:2 [ main::bu ] : zp[1]:2 ,
|
||||
Potential registers zp[1]:3 [ main::bs ] : zp[1]:3 ,
|
||||
Potential registers zp[2]:4 [ main::wu ] : zp[2]:4 ,
|
||||
Potential registers zp[2]:6 [ main::ws ] : zp[2]:6 ,
|
||||
Potential registers zp[4]:8 [ main::du ] : zp[4]:8 ,
|
||||
Potential registers zp[4]:12 [ main::ds ] : zp[4]:12 ,
|
||||
Potential registers zp[2]:16 [ main::ptr ] : zp[2]:16 ,
|
||||
Potential registers zp[1]:18 [ main::$2 ] : zp[1]:18 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:19 [ main::$3 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:20 [ main::$4 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:21 [ main::$5 ] : zp[1]:21 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:22 [ main::$6 ] : zp[1]:22 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:23 [ main::$7 ] : zp[1]:23 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:24 [ main::$8 ] : zp[1]:24 , reg byte a , reg byte x , reg byte y ,
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main] 4: zp[1]:18 [ main::$2 ] 4: zp[1]:19 [ main::$3 ] 4: zp[1]:20 [ main::$4 ] 4: zp[1]:21 [ main::$5 ] 4: zp[1]:22 [ main::$6 ] 4: zp[1]:23 [ main::$7 ] 4: zp[1]:24 [ main::$8 ] 0.44: zp[1]:2 [ main::bu ] 0.4: zp[1]:3 [ main::bs ] 0.36: zp[2]:4 [ main::wu ] 0.33: zp[2]:6 [ main::ws ] 0.31: zp[4]:8 [ main::du ] 0.29: zp[4]:12 [ main::ds ] 0.27: zp[2]:16 [ main::ptr ]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 168 combination reg byte a [ main::$2 ] reg byte a [ main::$3 ] reg byte a [ main::$4 ] reg byte a [ main::$5 ] zp[1]:22 [ main::$6 ] zp[1]:23 [ main::$7 ] zp[1]:24 [ main::$8 ] zp[1]:2 [ main::bu ] zp[1]:3 [ main::bs ] zp[2]:4 [ main::wu ] zp[2]:6 [ main::ws ] zp[4]:8 [ main::du ] zp[4]:12 [ main::ds ] zp[2]:16 [ main::ptr ]
|
||||
Limited combination testing to 100 combinations of 16384 possible.
|
||||
Uplifting [] best 168 combination
|
||||
Attempting to uplift remaining variables inzp[1]:22 [ main::$6 ]
|
||||
Uplifting [main] best 162 combination reg byte a [ main::$6 ]
|
||||
Attempting to uplift remaining variables inzp[1]:23 [ main::$7 ]
|
||||
Uplifting [main] best 156 combination reg byte a [ main::$7 ]
|
||||
Attempting to uplift remaining variables inzp[1]:24 [ main::$8 ]
|
||||
Uplifting [main] best 150 combination reg byte a [ main::$8 ]
|
||||
Attempting to uplift remaining variables inzp[1]:2 [ main::bu ]
|
||||
Uplifting [main] best 150 combination zp[1]:2 [ main::bu ]
|
||||
Attempting to uplift remaining variables inzp[1]:3 [ main::bs ]
|
||||
Uplifting [main] best 150 combination zp[1]:3 [ main::bs ]
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
// File Comments
|
||||
// Test operator BYTE0()
|
||||
// Upstart
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte0.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
|
||||
.label bu = 2
|
||||
.label bs = 3
|
||||
.label wu = 4
|
||||
.label ws = 6
|
||||
.label du = 8
|
||||
.label ds = $c
|
||||
.label ptr = $10
|
||||
// [0] main::bu = 7 -- vbuz1=vbuc1
|
||||
lda #7
|
||||
sta.z bu
|
||||
// [1] main::bs = 7 -- vbsz1=vbsc1
|
||||
lda #7
|
||||
sta.z bs
|
||||
// [2] main::wu = $4e20 -- vwuz1=vwuc1
|
||||
lda #<$4e20
|
||||
sta.z wu
|
||||
lda #>$4e20
|
||||
sta.z wu+1
|
||||
// [3] main::ws = -$b1 -- vwsz1=vwsc1
|
||||
lda #<-$b1
|
||||
sta.z ws
|
||||
lda #>-$b1
|
||||
sta.z ws+1
|
||||
// [4] main::du = $1e8480 -- vduz1=vduc1
|
||||
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
|
||||
// [5] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
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
|
||||
// [6] main::ptr = (byte*) 0 -- pbuz1=pbuc1
|
||||
lda #<0
|
||||
sta.z ptr
|
||||
lda #>0
|
||||
sta.z ptr+1
|
||||
// [7] *main::SCREEN = <$11 -- _deref_pbuc1=vbuc2
|
||||
lda #<($11)
|
||||
sta SCREEN
|
||||
// [8] *(main::SCREEN+1) = <$179 -- _deref_pbuc1=vbuc2
|
||||
lda #<($179)
|
||||
sta SCREEN+1
|
||||
// [9] main::$2 = < main::bu -- vbuaa=_byte0_vbuz1
|
||||
lda.z bu
|
||||
// [10] *(main::SCREEN+2) = main::$2 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+2
|
||||
// [11] main::$3 = < main::bs -- vbuaa=_byte0_vbsz1
|
||||
lda.z bs
|
||||
// [12] *(main::SCREEN+3) = main::$3 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+3
|
||||
// [13] main::$4 = < main::wu -- vbuaa=_byte0_vwuz1
|
||||
lda.z wu
|
||||
// [14] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+4
|
||||
// [15] main::$5 = < main::ws -- vbuaa=_byte0_vwsz1
|
||||
lda.z ws
|
||||
// [16] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+5
|
||||
// [17] main::$6 = < main::du -- vbuaa=_byte0_vduz1
|
||||
lda.z du
|
||||
// [18] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+6
|
||||
// [19] main::$7 = < main::ds -- vbuaa=_byte0_vdsz1
|
||||
lda.z ds
|
||||
// [20] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+7
|
||||
// [21] main::$8 = < main::ptr -- vbuaa=_byte0_pbuz1
|
||||
lda.z ptr
|
||||
// [22] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+8
|
||||
jmp __breturn
|
||||
// main::@return
|
||||
__breturn:
|
||||
// [23] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp __breturn
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction lda #7
|
||||
Removing instruction lda #>0
|
||||
Succesful ASM optimization Pass5UnnecesaryLoadElimination
|
||||
Removing instruction __breturn:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
void main()
|
||||
byte~ main::$2 reg byte a 4.0
|
||||
byte~ main::$3 reg byte a 4.0
|
||||
byte~ main::$4 reg byte a 4.0
|
||||
byte~ main::$5 reg byte a 4.0
|
||||
byte~ main::$6 reg byte a 4.0
|
||||
byte~ main::$7 reg byte a 4.0
|
||||
byte~ main::$8 reg byte a 4.0
|
||||
const nomodify byte* main::SCREEN = (byte*) 1024
|
||||
volatile signed byte main::bs loadstore zp[1]:3 0.4
|
||||
volatile byte main::bu loadstore zp[1]:2 0.4444444444444444
|
||||
volatile signed dword main::ds loadstore zp[4]:12 0.2857142857142857
|
||||
volatile dword main::du loadstore zp[4]:8 0.3076923076923077
|
||||
byte main::i
|
||||
volatile byte* main::ptr loadstore zp[2]:16 0.26666666666666666
|
||||
volatile signed word main::ws loadstore zp[2]:6 0.3333333333333333
|
||||
volatile word main::wu loadstore zp[2]:4 0.36363636363636365
|
||||
|
||||
zp[1]:2 [ main::bu ]
|
||||
zp[1]:3 [ main::bs ]
|
||||
zp[2]:4 [ main::wu ]
|
||||
zp[2]:6 [ main::ws ]
|
||||
zp[4]:8 [ main::du ]
|
||||
zp[4]:12 [ main::ds ]
|
||||
zp[2]:16 [ main::ptr ]
|
||||
reg byte a [ main::$2 ]
|
||||
reg byte a [ main::$3 ]
|
||||
reg byte a [ main::$4 ]
|
||||
reg byte a [ main::$5 ]
|
||||
reg byte a [ main::$6 ]
|
||||
reg byte a [ main::$7 ]
|
||||
reg byte a [ main::$8 ]
|
||||
|
||||
|
||||
FINAL ASSEMBLER
|
||||
Score: 143
|
||||
|
||||
// File Comments
|
||||
// Test operator BYTE0()
|
||||
// Upstart
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="operator-byte0.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
|
||||
.label bu = 2
|
||||
.label bs = 3
|
||||
.label wu = 4
|
||||
.label ws = 6
|
||||
.label du = 8
|
||||
.label ds = $c
|
||||
.label ptr = $10
|
||||
// bu = 7
|
||||
// [0] main::bu = 7 -- vbuz1=vbuc1
|
||||
lda #7
|
||||
sta.z bu
|
||||
// bs = 7
|
||||
// [1] main::bs = 7 -- vbsz1=vbsc1
|
||||
sta.z bs
|
||||
// wu = 20000
|
||||
// [2] main::wu = $4e20 -- vwuz1=vwuc1
|
||||
lda #<$4e20
|
||||
sta.z wu
|
||||
lda #>$4e20
|
||||
sta.z wu+1
|
||||
// ws = -177
|
||||
// [3] main::ws = -$b1 -- vwsz1=vwsc1
|
||||
lda #<-$b1
|
||||
sta.z ws
|
||||
lda #>-$b1
|
||||
sta.z ws+1
|
||||
// du = 2000000
|
||||
// [4] main::du = $1e8480 -- vduz1=vduc1
|
||||
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
|
||||
// ds = -3777777
|
||||
// [5] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
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
|
||||
// ptr = 0x0000
|
||||
// [6] main::ptr = (byte*) 0 -- pbuz1=pbuc1
|
||||
lda #<0
|
||||
sta.z ptr
|
||||
sta.z ptr+1
|
||||
// SCREEN[i++] = BYTE0(17)
|
||||
// [7] *main::SCREEN = <$11 -- _deref_pbuc1=vbuc2
|
||||
lda #<($11)
|
||||
sta SCREEN
|
||||
// SCREEN[i++] = BYTE0(377)
|
||||
// [8] *(main::SCREEN+1) = <$179 -- _deref_pbuc1=vbuc2
|
||||
lda #<($179)
|
||||
sta SCREEN+1
|
||||
// BYTE0(bu)
|
||||
// [9] main::$2 = < main::bu -- vbuaa=_byte0_vbuz1
|
||||
lda.z bu
|
||||
// SCREEN[i++] = BYTE0(bu)
|
||||
// [10] *(main::SCREEN+2) = main::$2 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+2
|
||||
// BYTE0(bs)
|
||||
// [11] main::$3 = < main::bs -- vbuaa=_byte0_vbsz1
|
||||
lda.z bs
|
||||
// SCREEN[i++] = BYTE0(bs)
|
||||
// [12] *(main::SCREEN+3) = main::$3 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+3
|
||||
// BYTE0(wu)
|
||||
// [13] main::$4 = < main::wu -- vbuaa=_byte0_vwuz1
|
||||
lda.z wu
|
||||
// SCREEN[i++] = BYTE0(wu)
|
||||
// [14] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+4
|
||||
// BYTE0(ws)
|
||||
// [15] main::$5 = < main::ws -- vbuaa=_byte0_vwsz1
|
||||
lda.z ws
|
||||
// SCREEN[i++] = BYTE0(ws)
|
||||
// [16] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+5
|
||||
// BYTE0(du)
|
||||
// [17] main::$6 = < main::du -- vbuaa=_byte0_vduz1
|
||||
lda.z du
|
||||
// SCREEN[i++] = BYTE0(du)
|
||||
// [18] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+6
|
||||
// BYTE0(ds)
|
||||
// [19] main::$7 = < main::ds -- vbuaa=_byte0_vdsz1
|
||||
lda.z ds
|
||||
// SCREEN[i++] = BYTE0(ds)
|
||||
// [20] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+7
|
||||
// BYTE0(ptr)
|
||||
// [21] main::$8 = < main::ptr -- vbuaa=_byte0_pbuz1
|
||||
lda.z ptr
|
||||
// SCREEN[i++] = BYTE0(ptr)
|
||||
// [22] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+8
|
||||
// main::@return
|
||||
// }
|
||||
// [23] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
|
32
src/test/ref/operator-byte0.sym
Normal file
32
src/test/ref/operator-byte0.sym
Normal file
@ -0,0 +1,32 @@
|
||||
void main()
|
||||
byte~ main::$2 reg byte a 4.0
|
||||
byte~ main::$3 reg byte a 4.0
|
||||
byte~ main::$4 reg byte a 4.0
|
||||
byte~ main::$5 reg byte a 4.0
|
||||
byte~ main::$6 reg byte a 4.0
|
||||
byte~ main::$7 reg byte a 4.0
|
||||
byte~ main::$8 reg byte a 4.0
|
||||
const nomodify byte* main::SCREEN = (byte*) 1024
|
||||
volatile signed byte main::bs loadstore zp[1]:3 0.4
|
||||
volatile byte main::bu loadstore zp[1]:2 0.4444444444444444
|
||||
volatile signed dword main::ds loadstore zp[4]:12 0.2857142857142857
|
||||
volatile dword main::du loadstore zp[4]:8 0.3076923076923077
|
||||
byte main::i
|
||||
volatile byte* main::ptr loadstore zp[2]:16 0.26666666666666666
|
||||
volatile signed word main::ws loadstore zp[2]:6 0.3333333333333333
|
||||
volatile word main::wu loadstore zp[2]:4 0.36363636363636365
|
||||
|
||||
zp[1]:2 [ main::bu ]
|
||||
zp[1]:3 [ main::bs ]
|
||||
zp[2]:4 [ main::wu ]
|
||||
zp[2]:6 [ main::ws ]
|
||||
zp[4]:8 [ main::du ]
|
||||
zp[4]:12 [ main::ds ]
|
||||
zp[2]:16 [ main::ptr ]
|
||||
reg byte a [ main::$2 ]
|
||||
reg byte a [ main::$3 ]
|
||||
reg byte a [ main::$4 ]
|
||||
reg byte a [ main::$5 ]
|
||||
reg byte a [ main::$6 ]
|
||||
reg byte a [ main::$7 ]
|
||||
reg byte a [ main::$8 ]
|
91
src/test/ref/operator-byte1.asm
Normal file
91
src/test/ref/operator-byte1.asm
Normal file
@ -0,0 +1,91 @@
|
||||
// Test operator BYTE0()
|
||||
// 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)
|
||||
.segment Code
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label bu = 2
|
||||
.label bs = 3
|
||||
.label wu = 4
|
||||
.label ws = 6
|
||||
.label du = 8
|
||||
.label ds = $c
|
||||
.label ptr = $10
|
||||
// bu = 7
|
||||
lda #7
|
||||
sta.z bu
|
||||
// bs = 7
|
||||
sta.z bs
|
||||
// wu = 20000
|
||||
lda #<$4e20
|
||||
sta.z wu
|
||||
lda #>$4e20
|
||||
sta.z wu+1
|
||||
// ws = -177
|
||||
lda #<-$b1
|
||||
sta.z ws
|
||||
lda #>-$b1
|
||||
sta.z ws+1
|
||||
// du = 2000000
|
||||
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
|
||||
// ds = -3777777
|
||||
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
|
||||
// ptr = 0x0000
|
||||
lda #<0
|
||||
sta.z ptr
|
||||
sta.z ptr+1
|
||||
// SCREEN[i++] = BYTE1(17)
|
||||
sta SCREEN
|
||||
// SCREEN[i++] = BYTE1(377)
|
||||
lda #>($179)
|
||||
sta SCREEN+1
|
||||
// BYTE1(bu)
|
||||
lda #0
|
||||
// SCREEN[i++] = BYTE1(bu)
|
||||
sta SCREEN+2
|
||||
// BYTE1(bs)
|
||||
// SCREEN[i++] = BYTE1(bs)
|
||||
sta SCREEN+3
|
||||
// BYTE1(wu)
|
||||
lda.z wu+1
|
||||
// SCREEN[i++] = BYTE1(wu)
|
||||
sta SCREEN+4
|
||||
// BYTE1(ws)
|
||||
lda.z ws+1
|
||||
// SCREEN[i++] = BYTE1(ws)
|
||||
sta SCREEN+5
|
||||
// BYTE1(du)
|
||||
lda.z du+1
|
||||
// SCREEN[i++] = BYTE1(du)
|
||||
sta SCREEN+6
|
||||
// BYTE1(ds)
|
||||
lda.z ds+1
|
||||
// SCREEN[i++] = BYTE1(ds)
|
||||
sta SCREEN+7
|
||||
// BYTE1(ptr)
|
||||
lda.z ptr+1
|
||||
// SCREEN[i++] = BYTE1(ptr)
|
||||
sta SCREEN+8
|
||||
// }
|
||||
rts
|
||||
}
|
30
src/test/ref/operator-byte1.cfg
Normal file
30
src/test/ref/operator-byte1.cfg
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
void main()
|
||||
main: scope:[main] from
|
||||
[0] main::bu = 7
|
||||
[1] main::bs = 7
|
||||
[2] main::wu = $4e20
|
||||
[3] main::ws = -$b1
|
||||
[4] main::du = $1e8480
|
||||
[5] main::ds = -$39a4f1
|
||||
[6] main::ptr = (byte*) 0
|
||||
[7] *main::SCREEN = 0
|
||||
[8] *(main::SCREEN+1) = >$179
|
||||
[9] main::$2 = > main::bu
|
||||
[10] *(main::SCREEN+2) = main::$2
|
||||
[11] main::$3 = > main::bs
|
||||
[12] *(main::SCREEN+3) = main::$3
|
||||
[13] main::$4 = > main::wu
|
||||
[14] *(main::SCREEN+4) = main::$4
|
||||
[15] main::$5 = > main::ws
|
||||
[16] *(main::SCREEN+5) = main::$5
|
||||
[17] main::$6 = > main::du
|
||||
[18] *(main::SCREEN+6) = main::$6
|
||||
[19] main::$7 = > main::ds
|
||||
[20] *(main::SCREEN+7) = main::$7
|
||||
[21] main::$8 = > main::ptr
|
||||
[22] *(main::SCREEN+8) = main::$8
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[23] return
|
||||
to:@return
|
608
src/test/ref/operator-byte1.log
Normal file
608
src/test/ref/operator-byte1.log
Normal file
@ -0,0 +1,608 @@
|
||||
|
||||
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
|
||||
main::$0 = > $11
|
||||
main::SCREEN[main::i#0] = main::$0
|
||||
main::i#1 = ++ main::i#0
|
||||
main::$1 = > $179
|
||||
main::SCREEN[main::i#1] = main::$1
|
||||
main::i#2 = ++ main::i#1
|
||||
main::$2 = > main::bu
|
||||
main::SCREEN[main::i#2] = main::$2
|
||||
main::i#3 = ++ main::i#2
|
||||
main::$3 = > main::bs
|
||||
main::SCREEN[main::i#3] = main::$3
|
||||
main::i#4 = ++ main::i#3
|
||||
main::$4 = > main::wu
|
||||
main::SCREEN[main::i#4] = main::$4
|
||||
main::i#5 = ++ main::i#4
|
||||
main::$5 = > main::ws
|
||||
main::SCREEN[main::i#5] = main::$5
|
||||
main::i#6 = ++ main::i#5
|
||||
main::$6 = > main::du
|
||||
main::SCREEN[main::i#6] = main::$6
|
||||
main::i#7 = ++ main::i#6
|
||||
main::$7 = > main::ds
|
||||
main::SCREEN[main::i#7] = main::$7
|
||||
main::i#8 = ++ main::i#7
|
||||
main::$8 = > main::ptr
|
||||
main::SCREEN[main::i#8] = main::$8
|
||||
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
|
||||
byte~ main::$7
|
||||
byte~ main::$8
|
||||
const nomodify byte* main::SCREEN = (byte*)$400
|
||||
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
|
||||
volatile byte* main::ptr loadstore
|
||||
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
|
||||
Constant right-side identified [8] main::$0 = > $11
|
||||
Constant right-side identified [11] main::$1 = > $179
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#0 = 0
|
||||
Constant main::$0 = >$11
|
||||
Constant main::$1 = >$179
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Simplifying constant evaluating to zero >$11 in
|
||||
Successful SSA optimization PassNSimplifyConstantZero
|
||||
Simplifying expression containing zero main::SCREEN in [9] main::SCREEN[main::i#0] = main::$0
|
||||
Successful SSA optimization PassNSimplifyExpressionWithZero
|
||||
Eliminating unused variable main::i#9 and assignment [31] main::i#9 = ++ main::i#8
|
||||
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
|
||||
Constant right-side identified [8] main::i#1 = ++ main::i#0
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#1 = ++main::i#0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [9] main::i#2 = ++ main::i#1
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#2 = ++main::i#1
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [11] main::i#3 = ++ main::i#2
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#3 = ++main::i#2
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [13] main::i#4 = ++ main::i#3
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#4 = ++main::i#3
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [15] main::i#5 = ++ main::i#4
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#5 = ++main::i#4
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [17] main::i#6 = ++ main::i#5
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#6 = ++main::i#5
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [19] main::i#7 = ++ main::i#6
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::i#7 = ++main::i#6
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant right-side identified [21] main::i#8 = ++ main::i#7
|
||||
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
|
||||
Constant inlined main::$1 = >$179
|
||||
Constant inlined main::i#4 = ++++++++0
|
||||
Constant inlined main::i#3 = ++++++0
|
||||
Constant inlined main::i#6 = ++++++++++++0
|
||||
Constant inlined main::$0 = 0
|
||||
Constant inlined main::i#5 = ++++++++++0
|
||||
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
|
||||
[0] main::bu = 7
|
||||
[1] main::bs = 7
|
||||
[2] main::wu = $4e20
|
||||
[3] main::ws = -$b1
|
||||
[4] main::du = $1e8480
|
||||
[5] main::ds = -$39a4f1
|
||||
[6] main::ptr = (byte*) 0
|
||||
[7] *main::SCREEN = 0
|
||||
[8] *(main::SCREEN+1) = >$179
|
||||
[9] main::$2 = > main::bu
|
||||
[10] *(main::SCREEN+2) = main::$2
|
||||
[11] main::$3 = > main::bs
|
||||
[12] *(main::SCREEN+3) = main::$3
|
||||
[13] main::$4 = > main::wu
|
||||
[14] *(main::SCREEN+4) = main::$4
|
||||
[15] main::$5 = > main::ws
|
||||
[16] *(main::SCREEN+5) = main::$5
|
||||
[17] main::$6 = > main::du
|
||||
[18] *(main::SCREEN+6) = main::$6
|
||||
[19] main::$7 = > main::ds
|
||||
[20] *(main::SCREEN+7) = main::$7
|
||||
[21] main::$8 = > main::ptr
|
||||
[22] *(main::SCREEN+8) = main::$8
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[23] return
|
||||
to:@return
|
||||
|
||||
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
void main()
|
||||
byte~ main::$2 4.0
|
||||
byte~ main::$3 4.0
|
||||
byte~ main::$4 4.0
|
||||
byte~ main::$5 4.0
|
||||
byte~ main::$6 4.0
|
||||
byte~ main::$7 4.0
|
||||
byte~ main::$8 4.0
|
||||
volatile signed byte main::bs loadstore 0.4
|
||||
volatile byte main::bu loadstore 0.4444444444444444
|
||||
volatile signed dword main::ds loadstore 0.2857142857142857
|
||||
volatile dword main::du loadstore 0.3076923076923077
|
||||
byte main::i
|
||||
volatile byte* main::ptr loadstore 0.26666666666666666
|
||||
volatile signed word main::ws loadstore 0.3333333333333333
|
||||
volatile word main::wu loadstore 0.36363636363636365
|
||||
|
||||
Initial phi equivalence classes
|
||||
Added variable main::bu to live range equivalence class [ main::bu ]
|
||||
Added variable main::bs to live range equivalence class [ main::bs ]
|
||||
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 ]
|
||||
Added variable main::$2 to live range equivalence class [ main::$2 ]
|
||||
Added variable main::$3 to live range equivalence class [ main::$3 ]
|
||||
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 ]
|
||||
Added variable main::$7 to live range equivalence class [ main::$7 ]
|
||||
Added variable main::$8 to live range equivalence class [ main::$8 ]
|
||||
Complete equivalence classes
|
||||
[ main::bu ]
|
||||
[ main::bs ]
|
||||
[ main::wu ]
|
||||
[ main::ws ]
|
||||
[ main::du ]
|
||||
[ main::ds ]
|
||||
[ main::ptr ]
|
||||
[ main::$2 ]
|
||||
[ main::$3 ]
|
||||
[ main::$4 ]
|
||||
[ main::$5 ]
|
||||
[ main::$6 ]
|
||||
[ main::$7 ]
|
||||
[ main::$8 ]
|
||||
Allocated zp[1]:2 [ main::bu ]
|
||||
Allocated zp[1]:3 [ main::bs ]
|
||||
Allocated zp[2]:4 [ main::wu ]
|
||||
Allocated zp[2]:6 [ main::ws ]
|
||||
Allocated zp[4]:8 [ main::du ]
|
||||
Allocated zp[4]:12 [ main::ds ]
|
||||
Allocated zp[2]:16 [ main::ptr ]
|
||||
Allocated zp[1]:18 [ main::$2 ]
|
||||
Allocated zp[1]:19 [ main::$3 ]
|
||||
Allocated zp[1]:20 [ main::$4 ]
|
||||
Allocated zp[1]:21 [ main::$5 ]
|
||||
Allocated zp[1]:22 [ main::$6 ]
|
||||
Allocated zp[1]:23 [ main::$7 ]
|
||||
Allocated zp[1]:24 [ main::$8 ]
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [0] main::bu = 7 [ main::bu ] ( [ main::bu ] { } ) always clobbers reg byte a
|
||||
Statement [1] main::bs = 7 [ main::bu main::bs ] ( [ main::bu main::bs ] { } ) always clobbers reg byte a
|
||||
Statement [2] main::wu = $4e20 [ main::bu main::bs main::wu ] ( [ main::bu main::bs main::wu ] { } ) always clobbers reg byte a
|
||||
Statement [3] main::ws = -$b1 [ main::bu main::bs main::wu main::ws ] ( [ main::bu main::bs main::wu main::ws ] { } ) always clobbers reg byte a
|
||||
Statement [4] main::du = $1e8480 [ main::bu main::bs main::wu main::ws main::du ] ( [ main::bu main::bs main::wu main::ws main::du ] { } ) always clobbers reg byte a
|
||||
Statement [5] main::ds = -$39a4f1 [ main::bu main::bs main::wu main::ws main::du main::ds ] ( [ main::bu main::bs main::wu main::ws main::du main::ds ] { } ) always clobbers reg byte a
|
||||
Statement [6] main::ptr = (byte*) 0 [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] ( [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [7] *main::SCREEN = 0 [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] ( [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Statement [8] *(main::SCREEN+1) = >$179 [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] ( [ main::bu main::bs main::wu main::ws main::du main::ds main::ptr ] { } ) always clobbers reg byte a
|
||||
Potential registers zp[1]:2 [ main::bu ] : zp[1]:2 ,
|
||||
Potential registers zp[1]:3 [ main::bs ] : zp[1]:3 ,
|
||||
Potential registers zp[2]:4 [ main::wu ] : zp[2]:4 ,
|
||||
Potential registers zp[2]:6 [ main::ws ] : zp[2]:6 ,
|
||||
Potential registers zp[4]:8 [ main::du ] : zp[4]:8 ,
|
||||
Potential registers zp[4]:12 [ main::ds ] : zp[4]:12 ,
|
||||
Potential registers zp[2]:16 [ main::ptr ] : zp[2]:16 ,
|
||||
Potential registers zp[1]:18 [ main::$2 ] : zp[1]:18 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:19 [ main::$3 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:20 [ main::$4 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:21 [ main::$5 ] : zp[1]:21 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:22 [ main::$6 ] : zp[1]:22 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:23 [ main::$7 ] : zp[1]:23 , reg byte a , reg byte x , reg byte y ,
|
||||
Potential registers zp[1]:24 [ main::$8 ] : zp[1]:24 , reg byte a , reg byte x , reg byte y ,
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main] 4: zp[1]:18 [ main::$2 ] 4: zp[1]:19 [ main::$3 ] 4: zp[1]:20 [ main::$4 ] 4: zp[1]:21 [ main::$5 ] 4: zp[1]:22 [ main::$6 ] 4: zp[1]:23 [ main::$7 ] 4: zp[1]:24 [ main::$8 ] 0.44: zp[1]:2 [ main::bu ] 0.4: zp[1]:3 [ main::bs ] 0.36: zp[2]:4 [ main::wu ] 0.33: zp[2]:6 [ main::ws ] 0.31: zp[4]:8 [ main::du ] 0.29: zp[4]:12 [ main::ds ] 0.27: zp[2]:16 [ main::ptr ]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 166 combination reg byte a [ main::$2 ] reg byte a [ main::$3 ] reg byte a [ main::$4 ] reg byte a [ main::$5 ] zp[1]:22 [ main::$6 ] zp[1]:23 [ main::$7 ] zp[1]:24 [ main::$8 ] zp[1]:2 [ main::bu ] zp[1]:3 [ main::bs ] zp[2]:4 [ main::wu ] zp[2]:6 [ main::ws ] zp[4]:8 [ main::du ] zp[4]:12 [ main::ds ] zp[2]:16 [ main::ptr ]
|
||||
Limited combination testing to 100 combinations of 16384 possible.
|
||||
Uplifting [] best 166 combination
|
||||
Attempting to uplift remaining variables inzp[1]:22 [ main::$6 ]
|
||||
Uplifting [main] best 160 combination reg byte a [ main::$6 ]
|
||||
Attempting to uplift remaining variables inzp[1]:23 [ main::$7 ]
|
||||
Uplifting [main] best 154 combination reg byte a [ main::$7 ]
|
||||
Attempting to uplift remaining variables inzp[1]:24 [ main::$8 ]
|
||||
Uplifting [main] best 148 combination reg byte a [ main::$8 ]
|
||||
Attempting to uplift remaining variables inzp[1]:2 [ main::bu ]
|
||||
Uplifting [main] best 148 combination zp[1]:2 [ main::bu ]
|
||||
Attempting to uplift remaining variables inzp[1]:3 [ main::bs ]
|
||||
Uplifting [main] best 148 combination zp[1]:3 [ main::bs ]
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
// File Comments
|
||||
// Test operator BYTE0()
|
||||
// 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
|
||||
.label bu = 2
|
||||
.label bs = 3
|
||||
.label wu = 4
|
||||
.label ws = 6
|
||||
.label du = 8
|
||||
.label ds = $c
|
||||
.label ptr = $10
|
||||
// [0] main::bu = 7 -- vbuz1=vbuc1
|
||||
lda #7
|
||||
sta.z bu
|
||||
// [1] main::bs = 7 -- vbsz1=vbsc1
|
||||
lda #7
|
||||
sta.z bs
|
||||
// [2] main::wu = $4e20 -- vwuz1=vwuc1
|
||||
lda #<$4e20
|
||||
sta.z wu
|
||||
lda #>$4e20
|
||||
sta.z wu+1
|
||||
// [3] main::ws = -$b1 -- vwsz1=vwsc1
|
||||
lda #<-$b1
|
||||
sta.z ws
|
||||
lda #>-$b1
|
||||
sta.z ws+1
|
||||
// [4] main::du = $1e8480 -- vduz1=vduc1
|
||||
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
|
||||
// [5] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
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
|
||||
// [6] main::ptr = (byte*) 0 -- pbuz1=pbuc1
|
||||
lda #<0
|
||||
sta.z ptr
|
||||
lda #>0
|
||||
sta.z ptr+1
|
||||
// [7] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
||||
lda #0
|
||||
sta SCREEN
|
||||
// [8] *(main::SCREEN+1) = >$179 -- _deref_pbuc1=vbuc2
|
||||
lda #>($179)
|
||||
sta SCREEN+1
|
||||
// [9] main::$2 = > main::bu -- vbuaa=_byte1_vbuz1
|
||||
lda #0
|
||||
// [10] *(main::SCREEN+2) = main::$2 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+2
|
||||
// [11] main::$3 = > main::bs -- vbuaa=_byte1_vbsz1
|
||||
lda #0
|
||||
// [12] *(main::SCREEN+3) = main::$3 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+3
|
||||
// [13] main::$4 = > main::wu -- vbuaa=_byte1_vwuz1
|
||||
lda.z wu+1
|
||||
// [14] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+4
|
||||
// [15] main::$5 = > main::ws -- vbuaa=_byte1_vwsz1
|
||||
lda.z ws+1
|
||||
// [16] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+5
|
||||
// [17] main::$6 = > main::du -- vbuaa=_byte1_vduz1
|
||||
lda.z du+1
|
||||
// [18] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+6
|
||||
// [19] main::$7 = > main::ds -- vbuaa=_byte1_vdsz1
|
||||
lda.z ds+1
|
||||
// [20] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+7
|
||||
// [21] main::$8 = > main::ptr -- vbuaa=_byte1_pbuz1
|
||||
lda.z ptr+1
|
||||
// [22] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+8
|
||||
jmp __breturn
|
||||
// main::@return
|
||||
__breturn:
|
||||
// [23] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp __breturn
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction lda #7
|
||||
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()
|
||||
byte~ main::$2 reg byte a 4.0
|
||||
byte~ main::$3 reg byte a 4.0
|
||||
byte~ main::$4 reg byte a 4.0
|
||||
byte~ main::$5 reg byte a 4.0
|
||||
byte~ main::$6 reg byte a 4.0
|
||||
byte~ main::$7 reg byte a 4.0
|
||||
byte~ main::$8 reg byte a 4.0
|
||||
const nomodify byte* main::SCREEN = (byte*) 1024
|
||||
volatile signed byte main::bs loadstore zp[1]:3 0.4
|
||||
volatile byte main::bu loadstore zp[1]:2 0.4444444444444444
|
||||
volatile signed dword main::ds loadstore zp[4]:12 0.2857142857142857
|
||||
volatile dword main::du loadstore zp[4]:8 0.3076923076923077
|
||||
byte main::i
|
||||
volatile byte* main::ptr loadstore zp[2]:16 0.26666666666666666
|
||||
volatile signed word main::ws loadstore zp[2]:6 0.3333333333333333
|
||||
volatile word main::wu loadstore zp[2]:4 0.36363636363636365
|
||||
|
||||
zp[1]:2 [ main::bu ]
|
||||
zp[1]:3 [ main::bs ]
|
||||
zp[2]:4 [ main::wu ]
|
||||
zp[2]:6 [ main::ws ]
|
||||
zp[4]:8 [ main::du ]
|
||||
zp[4]:12 [ main::ds ]
|
||||
zp[2]:16 [ main::ptr ]
|
||||
reg byte a [ main::$2 ]
|
||||
reg byte a [ main::$3 ]
|
||||
reg byte a [ main::$4 ]
|
||||
reg byte a [ main::$5 ]
|
||||
reg byte a [ main::$6 ]
|
||||
reg byte a [ main::$7 ]
|
||||
reg byte a [ main::$8 ]
|
||||
|
||||
|
||||
FINAL ASSEMBLER
|
||||
Score: 137
|
||||
|
||||
// File Comments
|
||||
// Test operator BYTE0()
|
||||
// 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
|
||||
.label bu = 2
|
||||
.label bs = 3
|
||||
.label wu = 4
|
||||
.label ws = 6
|
||||
.label du = 8
|
||||
.label ds = $c
|
||||
.label ptr = $10
|
||||
// bu = 7
|
||||
// [0] main::bu = 7 -- vbuz1=vbuc1
|
||||
lda #7
|
||||
sta.z bu
|
||||
// bs = 7
|
||||
// [1] main::bs = 7 -- vbsz1=vbsc1
|
||||
sta.z bs
|
||||
// wu = 20000
|
||||
// [2] main::wu = $4e20 -- vwuz1=vwuc1
|
||||
lda #<$4e20
|
||||
sta.z wu
|
||||
lda #>$4e20
|
||||
sta.z wu+1
|
||||
// ws = -177
|
||||
// [3] main::ws = -$b1 -- vwsz1=vwsc1
|
||||
lda #<-$b1
|
||||
sta.z ws
|
||||
lda #>-$b1
|
||||
sta.z ws+1
|
||||
// du = 2000000
|
||||
// [4] main::du = $1e8480 -- vduz1=vduc1
|
||||
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
|
||||
// ds = -3777777
|
||||
// [5] main::ds = -$39a4f1 -- vdsz1=vdsc1
|
||||
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
|
||||
// ptr = 0x0000
|
||||
// [6] main::ptr = (byte*) 0 -- pbuz1=pbuc1
|
||||
lda #<0
|
||||
sta.z ptr
|
||||
sta.z ptr+1
|
||||
// SCREEN[i++] = BYTE1(17)
|
||||
// [7] *main::SCREEN = 0 -- _deref_pbuc1=vbuc2
|
||||
sta SCREEN
|
||||
// SCREEN[i++] = BYTE1(377)
|
||||
// [8] *(main::SCREEN+1) = >$179 -- _deref_pbuc1=vbuc2
|
||||
lda #>($179)
|
||||
sta SCREEN+1
|
||||
// BYTE1(bu)
|
||||
// [9] main::$2 = > main::bu -- vbuaa=_byte1_vbuz1
|
||||
lda #0
|
||||
// SCREEN[i++] = BYTE1(bu)
|
||||
// [10] *(main::SCREEN+2) = main::$2 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+2
|
||||
// BYTE1(bs)
|
||||
// [11] main::$3 = > main::bs -- vbuaa=_byte1_vbsz1
|
||||
// SCREEN[i++] = BYTE1(bs)
|
||||
// [12] *(main::SCREEN+3) = main::$3 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+3
|
||||
// BYTE1(wu)
|
||||
// [13] main::$4 = > main::wu -- vbuaa=_byte1_vwuz1
|
||||
lda.z wu+1
|
||||
// SCREEN[i++] = BYTE1(wu)
|
||||
// [14] *(main::SCREEN+4) = main::$4 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+4
|
||||
// BYTE1(ws)
|
||||
// [15] main::$5 = > main::ws -- vbuaa=_byte1_vwsz1
|
||||
lda.z ws+1
|
||||
// SCREEN[i++] = BYTE1(ws)
|
||||
// [16] *(main::SCREEN+5) = main::$5 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+5
|
||||
// BYTE1(du)
|
||||
// [17] main::$6 = > main::du -- vbuaa=_byte1_vduz1
|
||||
lda.z du+1
|
||||
// SCREEN[i++] = BYTE1(du)
|
||||
// [18] *(main::SCREEN+6) = main::$6 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+6
|
||||
// BYTE1(ds)
|
||||
// [19] main::$7 = > main::ds -- vbuaa=_byte1_vdsz1
|
||||
lda.z ds+1
|
||||
// SCREEN[i++] = BYTE1(ds)
|
||||
// [20] *(main::SCREEN+7) = main::$7 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+7
|
||||
// BYTE1(ptr)
|
||||
// [21] main::$8 = > main::ptr -- vbuaa=_byte1_pbuz1
|
||||
lda.z ptr+1
|
||||
// SCREEN[i++] = BYTE1(ptr)
|
||||
// [22] *(main::SCREEN+8) = main::$8 -- _deref_pbuc1=vbuaa
|
||||
sta SCREEN+8
|
||||
// main::@return
|
||||
// }
|
||||
// [23] return
|
||||
rts
|
||||
}
|
||||
// File Data
|
||||
|
32
src/test/ref/operator-byte1.sym
Normal file
32
src/test/ref/operator-byte1.sym
Normal file
@ -0,0 +1,32 @@
|
||||
void main()
|
||||
byte~ main::$2 reg byte a 4.0
|
||||
byte~ main::$3 reg byte a 4.0
|
||||
byte~ main::$4 reg byte a 4.0
|
||||
byte~ main::$5 reg byte a 4.0
|
||||
byte~ main::$6 reg byte a 4.0
|
||||
byte~ main::$7 reg byte a 4.0
|
||||
byte~ main::$8 reg byte a 4.0
|
||||
const nomodify byte* main::SCREEN = (byte*) 1024
|
||||
volatile signed byte main::bs loadstore zp[1]:3 0.4
|
||||
volatile byte main::bu loadstore zp[1]:2 0.4444444444444444
|
||||
volatile signed dword main::ds loadstore zp[4]:12 0.2857142857142857
|
||||
volatile dword main::du loadstore zp[4]:8 0.3076923076923077
|
||||
byte main::i
|
||||
volatile byte* main::ptr loadstore zp[2]:16 0.26666666666666666
|
||||
volatile signed word main::ws loadstore zp[2]:6 0.3333333333333333
|
||||
volatile word main::wu loadstore zp[2]:4 0.36363636363636365
|
||||
|
||||
zp[1]:2 [ main::bu ]
|
||||
zp[1]:3 [ main::bs ]
|
||||
zp[2]:4 [ main::wu ]
|
||||
zp[2]:6 [ main::ws ]
|
||||
zp[4]:8 [ main::du ]
|
||||
zp[4]:12 [ main::ds ]
|
||||
zp[2]:16 [ main::ptr ]
|
||||
reg byte a [ main::$2 ]
|
||||
reg byte a [ main::$3 ]
|
||||
reg byte a [ main::$4 ]
|
||||
reg byte a [ main::$5 ]
|
||||
reg byte a [ main::$6 ]
|
||||
reg byte a [ main::$7 ]
|
||||
reg byte a [ main::$8 ]
|
Loading…
Reference in New Issue
Block a user