1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-10 10:29:36 +00:00
kickc/src/test/ref/irq-kernel.log
2020-12-30 01:55:04 +01:00

334 lines
9.2 KiB
Plaintext

Resolved forward reference irq to __interrupt(rom_sys_c64) void irq()
CONTROL FLOW GRAPH SSA
void main()
main: scope:[main] from __start
asm { sei }
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR
*VICII_CONTROL = *VICII_CONTROL | $80
*RASTER = 0
*IRQ_ENABLE = IRQ_RASTER
*KERNEL_IRQ = &irq
asm { cli }
to:main::@return
main::@return: scope:[main] from main
return
to:@return
__interrupt(rom_sys_c64) void irq()
irq: scope:[irq] from
*BG_COLOR = WHITE
*BG_COLOR = BLACK
*IRQ_STATUS = IRQ_RASTER
to:irq::@return
irq::@return: scope:[irq] from irq
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
const nomodify byte* BG_COLOR = (byte*)$d020
const nomodify byte BLACK = 0
const nomodify byte* CIA1_INTERRUPT = (byte*)$dc0d
const nomodify byte CIA_INTERRUPT_CLEAR = $7f
const nomodify byte* IRQ_ENABLE = (byte*)$d01a
const nomodify byte IRQ_RASTER = 1
const nomodify byte* IRQ_STATUS = (byte*)$d019
const nomodify void()** KERNEL_IRQ = (void()**)$314
const nomodify byte* RASTER = (byte*)$d012
const nomodify byte* VICII_CONTROL = (byte*)$d011
const nomodify byte WHITE = 1
void __start()
__interrupt(rom_sys_c64) void irq()
void main()
Adding number conversion cast (unumber) $80 in *VICII_CONTROL = *VICII_CONTROL | $80
Adding number conversion cast (unumber) 0 in *RASTER = 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *RASTER = (unumber)0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (void()**) 788
Simplifying constant pointer cast (byte*) 53266
Simplifying constant pointer cast (byte*) 53265
Simplifying constant pointer cast (byte*) 53273
Simplifying constant pointer cast (byte*) 53274
Simplifying constant pointer cast (byte*) 53280
Simplifying constant pointer cast (byte*) 56333
Simplifying constant integer cast $80
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $80
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
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
CALL GRAPH
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
FINAL CONTROL FLOW GRAPH
__interrupt(rom_sys_c64) void irq()
irq: scope:[irq] from
[0] *BG_COLOR = WHITE
[1] *BG_COLOR = BLACK
[2] *IRQ_STATUS = IRQ_RASTER
to:irq::@return
irq::@return: scope:[irq] from irq
[3] return
to:@return
void main()
main: scope:[main] from
asm { sei }
[5] *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR
[6] *VICII_CONTROL = *VICII_CONTROL | $80
[7] *RASTER = 0
[8] *IRQ_ENABLE = IRQ_RASTER
[9] *KERNEL_IRQ = &irq
asm { cli }
to:main::@return
main::@return: scope:[main] from main
[11] return
to:@return
VARIABLE REGISTER WEIGHTS
__interrupt(rom_sys_c64) void irq()
void main()
Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *BG_COLOR = WHITE [ ] ( [ ] { } ) always clobbers reg byte a
Statement [1] *BG_COLOR = BLACK [ ] ( [ ] { } ) always clobbers reg byte a
Statement [2] *IRQ_STATUS = IRQ_RASTER [ ] ( [ ] { } ) always clobbers reg byte a
Statement [5] *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR [ ] ( [ ] { } ) always clobbers reg byte a
Statement [6] *VICII_CONTROL = *VICII_CONTROL | $80 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [7] *RASTER = 0 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [8] *IRQ_ENABLE = IRQ_RASTER [ ] ( [ ] { } ) always clobbers reg byte a
Statement [9] *KERNEL_IRQ = &irq [ ] ( [ ] { } ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [main]
Uplift Scope [irq]
Uplift Scope []
Uplifting [main] best 104 combination
Uplifting [irq] best 104 combination
Uplifting [] best 104 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// A minimal working raster IRQ
// Upstart
// Commodore 64 PRG executable file
.file [name="irq-kernel.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
// Global Constants & labels
.const IRQ_RASTER = 1
.const WHITE = 1
.const BLACK = 0
.const CIA_INTERRUPT_CLEAR = $7f
.label KERNEL_IRQ = $314
.label RASTER = $d012
.label VICII_CONTROL = $d011
.label IRQ_STATUS = $d019
.label IRQ_ENABLE = $d01a
.label BG_COLOR = $d020
.label CIA1_INTERRUPT = $dc0d
.segment Code
// irq
// Interrupt Routine
irq: {
// interrupt(isr_rom_sys_c64_entry) -- isr_rom_sys_c64_entry
// [0] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
sta BG_COLOR
// [1] *BG_COLOR = BLACK -- _deref_pbuc1=vbuc2
lda #BLACK
sta BG_COLOR
// [2] *IRQ_STATUS = IRQ_RASTER -- _deref_pbuc1=vbuc2
// Acknowledge the IRQ
lda #IRQ_RASTER
sta IRQ_STATUS
jmp __breturn
// irq::@return
__breturn:
// [3] return
// interrupt(isr_rom_sys_c64_exit) -- isr_rom_sys_c64_exit
jmp $ea31
}
// main
main: {
// asm { sei }
sei
// [5] *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
// Disable CIA 1 Timer IRQ
lda #CIA_INTERRUPT_CLEAR
sta CIA1_INTERRUPT
// [6] *VICII_CONTROL = *VICII_CONTROL | $80 -- _deref_pbuc1=_deref_pbuc1_bor_vbuc2
// Set raster line to $100
lda #$80
ora VICII_CONTROL
sta VICII_CONTROL
// [7] *RASTER = 0 -- _deref_pbuc1=vbuc2
lda #0
sta RASTER
// [8] *IRQ_ENABLE = IRQ_RASTER -- _deref_pbuc1=vbuc2
// Enable Raster Interrupt
lda #IRQ_RASTER
sta IRQ_ENABLE
// [9] *KERNEL_IRQ = &irq -- _deref_qprc1=pprc2
// Set the IRQ routine
lda #<irq
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// asm { cli }
cli
jmp __breturn
// main::@return
__breturn:
// [11] return
rts
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
const nomodify byte* BG_COLOR = (byte*) 53280
const nomodify byte BLACK = 0
const nomodify byte* CIA1_INTERRUPT = (byte*) 56333
const nomodify byte CIA_INTERRUPT_CLEAR = $7f
const nomodify byte* IRQ_ENABLE = (byte*) 53274
const nomodify byte IRQ_RASTER = 1
const nomodify byte* IRQ_STATUS = (byte*) 53273
const nomodify void()** KERNEL_IRQ = (void()**) 788
const nomodify byte* RASTER = (byte*) 53266
const nomodify byte* VICII_CONTROL = (byte*) 53265
const nomodify byte WHITE = 1
__interrupt(rom_sys_c64) void irq()
void main()
FINAL ASSEMBLER
Score: 98
// File Comments
// A minimal working raster IRQ
// Upstart
// Commodore 64 PRG executable file
.file [name="irq-kernel.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
// Global Constants & labels
.const IRQ_RASTER = 1
.const WHITE = 1
.const BLACK = 0
.const CIA_INTERRUPT_CLEAR = $7f
.label KERNEL_IRQ = $314
.label RASTER = $d012
.label VICII_CONTROL = $d011
.label IRQ_STATUS = $d019
.label IRQ_ENABLE = $d01a
.label BG_COLOR = $d020
.label CIA1_INTERRUPT = $dc0d
.segment Code
// irq
// Interrupt Routine
irq: {
// interrupt(isr_rom_sys_c64_entry) -- isr_rom_sys_c64_entry
// *BG_COLOR = WHITE
// [0] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
sta BG_COLOR
// *BG_COLOR = BLACK
// [1] *BG_COLOR = BLACK -- _deref_pbuc1=vbuc2
lda #BLACK
sta BG_COLOR
// *IRQ_STATUS = IRQ_RASTER
// [2] *IRQ_STATUS = IRQ_RASTER -- _deref_pbuc1=vbuc2
// Acknowledge the IRQ
lda #IRQ_RASTER
sta IRQ_STATUS
// irq::@return
// }
// [3] return
// interrupt(isr_rom_sys_c64_exit) -- isr_rom_sys_c64_exit
jmp $ea31
}
// main
main: {
// asm
// asm { sei }
sei
// *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR
// [5] *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
// Disable CIA 1 Timer IRQ
lda #CIA_INTERRUPT_CLEAR
sta CIA1_INTERRUPT
// *VICII_CONTROL |=$80
// [6] *VICII_CONTROL = *VICII_CONTROL | $80 -- _deref_pbuc1=_deref_pbuc1_bor_vbuc2
// Set raster line to $100
lda #$80
ora VICII_CONTROL
sta VICII_CONTROL
// *RASTER = $00
// [7] *RASTER = 0 -- _deref_pbuc1=vbuc2
lda #0
sta RASTER
// *IRQ_ENABLE = IRQ_RASTER
// [8] *IRQ_ENABLE = IRQ_RASTER -- _deref_pbuc1=vbuc2
// Enable Raster Interrupt
lda #IRQ_RASTER
sta IRQ_ENABLE
// *KERNEL_IRQ = &irq
// [9] *KERNEL_IRQ = &irq -- _deref_qprc1=pprc2
// Set the IRQ routine
lda #<irq
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// asm
// asm { cli }
cli
// main::@return
// }
// [11] return
rts
}
// File Data