Resolved forward reference irq to __interrupt(rom_sys_c64) void irq()

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  kickasm( uses irq uses KERNEL_IRQ) {{ sei
        lda #<irq;
        sta KERNEL_IRQ
        lda #>irq;
        sta KERNEL_IRQ+1
        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
  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
__constant char * const BG_COLOR = (char *)$d021
__constant const char BLACK = 0
__constant void (** const KERNEL_IRQ)() = (void (**)())$314
__constant const char WHITE = 1
void __start()
__interrupt(rom_sys_c64) void irq()
void main()

Simplifying constant pointer cast (void (**)()) 788
Simplifying constant pointer cast (char *) 53281
Successful SSA optimization PassNCastSimplification
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
  to:irq::@return
irq::@return: scope:[irq]  from irq
  [2] return 
  to:@return

void main()
main: scope:[main]  from
  kickasm( uses irq uses KERNEL_IRQ) {{ sei
        lda #<irq;
        sta KERNEL_IRQ
        lda #>irq;
        sta KERNEL_IRQ+1
        cli
     }}
  to:main::@return
main::@return: scope:[main]  from main
  [4] 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 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 
Uplift Scope [irq] 
Uplift Scope [] 

Uplifting [main] best 310 combination 
Uplifting [irq] best 310 combination 
Uplifting [] best 310 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Ensure that an inline kickasm uses-clause is anough to prevent a function from being deleted
  // Upstart
  // Commodore 64 PRG executable file
.file [name="kickasm-uses-prevent-deletion.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 BLACK = 0
  .const WHITE = 1
  .label KERNEL_IRQ = $314
  .label BG_COLOR = $d021
.segment Code
  // irq
// The Interrupt Handler
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
    jmp __breturn
    // irq::@return
  __breturn:
    // [2] return 
    // interrupt(isr_rom_sys_c64_exit) -- isr_rom_sys_c64_exit 
    jmp $ea31
}
  // main
main: {
    // kickasm( uses irq uses KERNEL_IRQ) {{ sei         lda #<irq;         sta KERNEL_IRQ         lda #>irq;         sta KERNEL_IRQ+1         cli      }}
    sei
        lda #<irq;
        sta KERNEL_IRQ
        lda #>irq;
        sta KERNEL_IRQ+1
        cli
    
    jmp __breturn
    // main::@return
  __breturn:
    // [4] 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
__constant char * const BG_COLOR = (char *) 53281
__constant const char BLACK = 0
__constant void (** const KERNEL_IRQ)() = (void (**)()) 788
__constant const char WHITE = 1
__interrupt(rom_sys_c64) void irq()
void main()



FINAL ASSEMBLER
Score: 304

  // File Comments
// Ensure that an inline kickasm uses-clause is anough to prevent a function from being deleted
  // Upstart
  // Commodore 64 PRG executable file
.file [name="kickasm-uses-prevent-deletion.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 BLACK = 0
  .const WHITE = 1
  .label KERNEL_IRQ = $314
  .label BG_COLOR = $d021
.segment Code
  // irq
// The Interrupt Handler
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::@return
    // }
    // [2] return 
    // interrupt(isr_rom_sys_c64_exit) -- isr_rom_sys_c64_exit 
    jmp $ea31
}
  // main
main: {
    // kickasm
    // kickasm( uses irq uses KERNEL_IRQ) {{ sei         lda #<irq;         sta KERNEL_IRQ         lda #>irq;         sta KERNEL_IRQ+1         cli      }}
    sei
        lda #<irq;
        sta KERNEL_IRQ
        lda #>irq;
        sta KERNEL_IRQ+1
        cli
    
    // main::@return
    // }
    // [4] return 
    rts
}
  // File Data

