1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-08-07 22:25:13 +00:00
Files
kickc/src/test/ref/complex/ataritempest/ataritempest.log
jespergravgaard 4c443c1034 Updated test data.
2019-12-21 10:38:44 +01:00

516 lines
16 KiB
Plaintext

Loading link script "ataritempest.ld"
Culled Empty Block (label) entryPoint::@2
Culled Empty Block (label) @1
Culled Empty Block (label) @2
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@3
(void()) entryPoint()
entryPoint: scope:[entryPoint] from
(byte) entryPoint::i#0 ← (byte) 0
to:entryPoint::@1
entryPoint::@1: scope:[entryPoint] from entryPoint entryPoint::@1
(byte) entryPoint::i#2 ← phi( entryPoint/(byte) entryPoint::i#0 entryPoint::@1/(byte) entryPoint::i#1 )
*((const byte*) SCREEN + (byte) entryPoint::i#2) ← *((const byte*) MESSAGE + (byte) entryPoint::i#2)
(byte) entryPoint::i#1 ← (byte) entryPoint::i#2 + rangenext(0,$31)
(bool~) entryPoint::$0 ← (byte) entryPoint::i#1 != rangelast(0,$31)
if((bool~) entryPoint::$0) goto entryPoint::@1
to:entryPoint::@return
entryPoint::@return: scope:[entryPoint] from entryPoint::@1
return
to:@return
interrupt(HARDWARE_ALL)(void()) nmiHandler()
nmiHandler: scope:[nmiHandler] from
*((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
to:nmiHandler::@return
nmiHandler::@return: scope:[nmiHandler] from nmiHandler
return
to:@return
(void()) main()
main: scope:[main] from @3
*((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@3: scope:[] from @begin
call main
to:@4
@4: scope:[] from @3
to:@end
@end: scope:[] from @4
SYMBOL TABLE SSA
(label) @3
(label) @4
(label) @begin
(label) @end
(const byte*) BGCOL = (byte*)(number) $c01a
(const byte*) MESSAGE[] = (string) "hello world"
(const byte*) SCREEN[(number) $32] = { fill( $32, 0) }
(const void()**) VECTORS[] = { &interrupt(HARDWARE_ALL)(void()) nmiHandler(), &(void()) entryPoint() }
(void()) entryPoint()
(bool~) entryPoint::$0
(label) entryPoint::@1
(label) entryPoint::@return
(byte) entryPoint::i
(byte) entryPoint::i#0
(byte) entryPoint::i#1
(byte) entryPoint::i#2
(void()) main()
(label) main::@return
interrupt(HARDWARE_ALL)(void()) nmiHandler()
(label) nmiHandler::@return
Simplifying constant pointer cast (byte*) 49178
Successful SSA optimization PassNCastSimplification
Simple Condition (bool~) entryPoint::$0 [5] if((byte) entryPoint::i#1!=rangelast(0,$31)) goto entryPoint::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) entryPoint::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [3] entryPoint::i#1 ← ++ entryPoint::i#2 to ++
Resolved ranged comparison value [5] if(entryPoint::i#1!=rangelast(0,$31)) goto entryPoint::@1 to (number) $32
Adding number conversion cast (unumber) $32 in if((byte) entryPoint::i#1!=(number) $32) goto entryPoint::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $32
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $32
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inlining constant with var siblings (const byte) entryPoint::i#0
Constant inlined entryPoint::i#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting entryPoint::@3(between entryPoint::@1 and entryPoint::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @3
Adding NOP phi() at start of @4
Adding NOP phi() at start of @end
Adding NOP phi() at start of entryPoint
CALL GRAPH
Calls in [] to main:2
Created 1 initial phi equivalence classes
Coalesced [15] entryPoint::i#3 ← entryPoint::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) entryPoint::@3
Renumbering block @3 to @1
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of entryPoint
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
(void()) main()
main: scope:[main] from @1
[4] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
to:main::@return
main::@return: scope:[main] from main
[5] return
to:@return
interrupt(HARDWARE_ALL)(void()) nmiHandler()
nmiHandler: scope:[nmiHandler] from
[6] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
to:nmiHandler::@return
nmiHandler::@return: scope:[nmiHandler] from nmiHandler
[7] return
to:@return
(void()) entryPoint()
entryPoint: scope:[entryPoint] from
[8] phi()
to:entryPoint::@1
entryPoint::@1: scope:[entryPoint] from entryPoint entryPoint::@1
[9] (byte) entryPoint::i#2 ← phi( entryPoint/(byte) 0 entryPoint::@1/(byte) entryPoint::i#1 )
[10] *((const byte*) SCREEN + (byte) entryPoint::i#2) ← *((const byte*) MESSAGE + (byte) entryPoint::i#2)
[11] (byte) entryPoint::i#1 ← ++ (byte) entryPoint::i#2
[12] if((byte) entryPoint::i#1!=(byte) $32) goto entryPoint::@1
to:entryPoint::@return
entryPoint::@return: scope:[entryPoint] from entryPoint::@1
[13] return
to:@return
VARIABLE REGISTER WEIGHTS
(void()) entryPoint()
(byte) entryPoint::i
(byte) entryPoint::i#1 16.5
(byte) entryPoint::i#2 22.0
(void()) main()
interrupt(HARDWARE_ALL)(void()) nmiHandler()
Initial phi equivalence classes
[ entryPoint::i#2 entryPoint::i#1 ]
Complete equivalence classes
[ entryPoint::i#2 entryPoint::i#1 ]
Allocated zp[1]:2 [ entryPoint::i#2 entryPoint::i#1 ]
INITIAL ASM
Target platform is custom / MOS6502X
// File Comments
// Atari Tempest ROM Development Template
// Each function of the kernal is a no-args function
// The functions are placed in the SYSCALLS table surrounded by JMP and NOP
// Upstart
.file [name="ataritempest.bin", type="bin", segments="AtariTempest"]
.segmentdef AtariTempest [segments="Code, RomData, Vectors"]
.segmentdef Code [start=$9000, min=$9000, max=$Fff9]
.segmentdef RomData [startAfter="Code", min=$9000, max=$Fff9]
.segmentdef RamData [start=$200, min=$200, max=$7ff]
.segmentdef Vectors [start=$FFFA, min=$FFFA, max=$FFFF, fill]
.segment Code
init:
// Global Constants & labels
.label BGCOL = $c01a
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
.segment Code
// main
main: {
// [4] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
jmp __breturn
// main::@return
__breturn:
// [5] return
rts
}
// nmiHandler
nmiHandler: {
// entry interrupt(HARDWARE_ALL)
sta rega+1
stx regx+1
sty regy+1
// [6] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
jmp __breturn
// nmiHandler::@return
__breturn:
// [7] return - exit interrupt(HARDWARE_ALL)
rega:
lda #00
regx:
ldx #00
regy:
ldy #00
rti
}
// entryPoint
entryPoint: {
.label i = 2
// [9] phi from entryPoint to entryPoint::@1 [phi:entryPoint->entryPoint::@1]
__b1_from_entryPoint:
// [9] phi (byte) entryPoint::i#2 = (byte) 0 [phi:entryPoint->entryPoint::@1#0] -- vbuz1=vbuc1
lda #0
sta.z i
jmp __b1
// [9] phi from entryPoint::@1 to entryPoint::@1 [phi:entryPoint::@1->entryPoint::@1]
__b1_from___b1:
// [9] phi (byte) entryPoint::i#2 = (byte) entryPoint::i#1 [phi:entryPoint::@1->entryPoint::@1#0] -- register_copy
jmp __b1
// entryPoint::@1
__b1:
// [10] *((const byte*) SCREEN + (byte) entryPoint::i#2) ← *((const byte*) MESSAGE + (byte) entryPoint::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy.z i
lda MESSAGE,y
sta SCREEN,y
// [11] (byte) entryPoint::i#1 ← ++ (byte) entryPoint::i#2 -- vbuz1=_inc_vbuz1
inc.z i
// [12] if((byte) entryPoint::i#1!=(byte) $32) goto entryPoint::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$32
cmp.z i
bne __b1_from___b1
jmp __breturn
// entryPoint::@return
__breturn:
// [13] return
rts
}
// File Data
.segment RomData
MESSAGE: .text "hello world"
.byte 0
.segment RamData
SCREEN: .fill $32, 0
.segment Vectors
VECTORS: .word nmiHandler, entryPoint
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [7] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Statement [10] *((const byte*) SCREEN + (byte) entryPoint::i#2) ← *((const byte*) MESSAGE + (byte) entryPoint::i#2) [ entryPoint::i#2 ] ( [ entryPoint::i#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ entryPoint::i#2 entryPoint::i#1 ]
Statement [7] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Statement [10] *((const byte*) SCREEN + (byte) entryPoint::i#2) ← *((const byte*) MESSAGE + (byte) entryPoint::i#2) [ entryPoint::i#2 ] ( [ entryPoint::i#2 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ entryPoint::i#2 entryPoint::i#1 ] : zp[1]:2 , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [entryPoint] 38.5: zp[1]:2 [ entryPoint::i#2 entryPoint::i#1 ]
Uplift Scope [nmiHandler]
Uplift Scope [main]
Uplift Scope []
Uplifting [entryPoint] best 444 combination reg byte x [ entryPoint::i#2 entryPoint::i#1 ]
Uplifting [nmiHandler] best 444 combination
Uplifting [main] best 444 combination
Uplifting [] best 444 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Atari Tempest ROM Development Template
// Each function of the kernal is a no-args function
// The functions are placed in the SYSCALLS table surrounded by JMP and NOP
// Upstart
.file [name="ataritempest.bin", type="bin", segments="AtariTempest"]
.segmentdef AtariTempest [segments="Code, RomData, Vectors"]
.segmentdef Code [start=$9000, min=$9000, max=$Fff9]
.segmentdef RomData [startAfter="Code", min=$9000, max=$Fff9]
.segmentdef RamData [start=$200, min=$200, max=$7ff]
.segmentdef Vectors [start=$FFFA, min=$FFFA, max=$FFFF, fill]
.segment Code
init:
// Global Constants & labels
.label BGCOL = $c01a
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
.segment Code
// main
main: {
// [4] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
jmp __breturn
// main::@return
__breturn:
// [5] return
rts
}
// nmiHandler
nmiHandler: {
// entry interrupt(HARDWARE_ALL)
sta rega+1
stx regx+1
sty regy+1
// [6] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
jmp __breturn
// nmiHandler::@return
__breturn:
// [7] return - exit interrupt(HARDWARE_ALL)
rega:
lda #00
regx:
ldx #00
regy:
ldy #00
rti
}
// entryPoint
entryPoint: {
// [9] phi from entryPoint to entryPoint::@1 [phi:entryPoint->entryPoint::@1]
__b1_from_entryPoint:
// [9] phi (byte) entryPoint::i#2 = (byte) 0 [phi:entryPoint->entryPoint::@1#0] -- vbuxx=vbuc1
ldx #0
jmp __b1
// [9] phi from entryPoint::@1 to entryPoint::@1 [phi:entryPoint::@1->entryPoint::@1]
__b1_from___b1:
// [9] phi (byte) entryPoint::i#2 = (byte) entryPoint::i#1 [phi:entryPoint::@1->entryPoint::@1#0] -- register_copy
jmp __b1
// entryPoint::@1
__b1:
// [10] *((const byte*) SCREEN + (byte) entryPoint::i#2) ← *((const byte*) MESSAGE + (byte) entryPoint::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda MESSAGE,x
sta SCREEN,x
// [11] (byte) entryPoint::i#1 ← ++ (byte) entryPoint::i#2 -- vbuxx=_inc_vbuxx
inx
// [12] if((byte) entryPoint::i#1!=(byte) $32) goto entryPoint::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$32
bne __b1_from___b1
jmp __breturn
// entryPoint::@return
__breturn:
// [13] return
rts
}
// File Data
.segment RomData
MESSAGE: .text "hello world"
.byte 0
.segment RamData
SCREEN: .fill $32, 0
.segment Vectors
VECTORS: .word nmiHandler, entryPoint
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b1 with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Removing instruction __breturn:
Removing instruction __b1_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1:
Removing instruction __bend:
Removing instruction __breturn:
Removing instruction __b1_from_entryPoint:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte*) BGCOL = (byte*) 49178
(const byte*) MESSAGE[] = (string) "hello world"
(const byte*) SCREEN[(number) $32] = { fill( $32, 0) }
(const void()**) VECTORS[] = { &interrupt(HARDWARE_ALL)(void()) nmiHandler(), &(void()) entryPoint() }
(void()) entryPoint()
(label) entryPoint::@1
(label) entryPoint::@return
(byte) entryPoint::i
(byte) entryPoint::i#1 reg byte x 16.5
(byte) entryPoint::i#2 reg byte x 22.0
(void()) main()
(label) main::@return
interrupt(HARDWARE_ALL)(void()) nmiHandler()
(label) nmiHandler::@return
reg byte x [ entryPoint::i#2 entryPoint::i#1 ]
FINAL ASSEMBLER
Score: 336
// File Comments
// Atari Tempest ROM Development Template
// Each function of the kernal is a no-args function
// The functions are placed in the SYSCALLS table surrounded by JMP and NOP
// Upstart
.file [name="ataritempest.bin", type="bin", segments="AtariTempest"]
.segmentdef AtariTempest [segments="Code, RomData, Vectors"]
.segmentdef Code [start=$9000, min=$9000, max=$Fff9]
.segmentdef RomData [startAfter="Code", min=$9000, max=$Fff9]
.segmentdef RamData [start=$200, min=$200, max=$7ff]
.segmentdef Vectors [start=$FFFA, min=$FFFA, max=$FFFF, fill]
.segment Code
init:
// Global Constants & labels
.label BGCOL = $c01a
// @begin
// [1] phi from @begin to @1 [phi:@begin->@1]
// @1
// [2] call main
// [3] phi from @1 to @end [phi:@1->@end]
// @end
.segment Code
// main
main: {
// (*BGCOL)++;
// [4] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
// main::@return
// }
// [5] return
rts
}
// nmiHandler
nmiHandler: {
// entry interrupt(HARDWARE_ALL)
sta rega+1
stx regx+1
sty regy+1
// (*BGCOL)++;
// [6] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
// nmiHandler::@return
// }
// [7] return - exit interrupt(HARDWARE_ALL)
rega:
lda #00
regx:
ldx #00
regy:
ldy #00
rti
}
// entryPoint
entryPoint: {
// [9] phi from entryPoint to entryPoint::@1 [phi:entryPoint->entryPoint::@1]
// [9] phi (byte) entryPoint::i#2 = (byte) 0 [phi:entryPoint->entryPoint::@1#0] -- vbuxx=vbuc1
ldx #0
// [9] phi from entryPoint::@1 to entryPoint::@1 [phi:entryPoint::@1->entryPoint::@1]
// [9] phi (byte) entryPoint::i#2 = (byte) entryPoint::i#1 [phi:entryPoint::@1->entryPoint::@1#0] -- register_copy
// entryPoint::@1
__b1:
// SCREEN[i] = MESSAGE[i]
// [10] *((const byte*) SCREEN + (byte) entryPoint::i#2) ← *((const byte*) MESSAGE + (byte) entryPoint::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda MESSAGE,x
sta SCREEN,x
// for( char i:0..49)
// [11] (byte) entryPoint::i#1 ← ++ (byte) entryPoint::i#2 -- vbuxx=_inc_vbuxx
inx
// [12] if((byte) entryPoint::i#1!=(byte) $32) goto entryPoint::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$32
bne __b1
// entryPoint::@return
// }
// [13] return
rts
}
// File Data
.segment RomData
MESSAGE: .text "hello world"
.byte 0
.segment RamData
SCREEN: .fill $32, 0
.segment Vectors
VECTORS: .word nmiHandler, entryPoint