
CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  output::dw#0 = main::dw
  call output
  to:main::@1
main::@1: scope:[main]  from main
  to:main::@return
main::@return: scope:[main]  from main::@1
  return 
  to:@return

void output(unsigned long dw)
output: scope:[output]  from main
  output::dw#1 = phi( main/output::dw#0 )
  *screen = output::dw#1
  to:output::@return
output::@return: scope:[output]  from output
  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()
__constant unsigned long main::dw = (unsigned long)main::msg
__constant const char main::msg[] = "camelot"
void output(unsigned long dw)
unsigned long output::dw
unsigned long output::dw#0
unsigned long output::dw#1
__constant unsigned long * const screen = (char *)$400

Simplifying constant pointer cast (char *) 1024
Successful SSA optimization PassNCastSimplification
Identical Phi Values output::dw#1 output::dw#0
Successful SSA optimization Pass2IdenticalPhiElimination
Constant output::dw#0 = main::dw
Successful SSA optimization Pass2ConstantIdentification
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 inlined output::dw#0 = main::dw
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
CALL GRAPH
Calls in [main] to output:1 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block label main::@1
Adding NOP phi() at start of main

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  [1] call output
  to:main::@return
main::@return: scope:[main]  from main
  [2] return 
  to:@return

void output(unsigned long dw)
output: scope:[output]  from main
  [3] *screen = main::dw
  to:output::@return
output::@return: scope:[output]  from output
  [4] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
void output(unsigned long dw)
unsigned long output::dw

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [3] *screen = main::dw [ ] ( output:1 [ ] { }  ) always clobbers reg byte a 

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

Uplifting [main] best 48 combination 
Uplifting [output] best 48 combination 
Uplifting [] best 48 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test casting the address of an inline string to a dword.
  // Upstart
  // Commodore 64 PRG executable file
.file [name="inline-string-4.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
  .label screen = $400
.segment Code
  // main
main: {
    .label dw = msg
    // [1] call output
    jsr output
    jmp __breturn
    // main::@return
  __breturn:
    // [2] return 
    rts
  .segment Data
    msg: .text "camelot"
    .byte 0
}
.segment Code
  // output
// void output(unsigned long dw)
output: {
    // [3] *screen = main::dw -- _deref_pduc1=vduc2 
    lda #<main.dw
    sta screen
    lda #>main.dw
    sta screen+1
    lda #<main.dw>>$10
    sta screen+2
    lda #>main.dw>>$10
    sta screen+3
    jmp __breturn
    // output::@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
void main()
__constant unsigned long main::dw = (unsigned long)main::msg
__constant const char main::msg[] = "camelot"
void output(unsigned long dw)
unsigned long output::dw
__constant unsigned long * const screen = (char *) 1024



FINAL ASSEMBLER
Score: 42

  // File Comments
// Test casting the address of an inline string to a dword.
  // Upstart
  // Commodore 64 PRG executable file
.file [name="inline-string-4.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
  .label screen = $400
.segment Code
  // main
main: {
    .label dw = msg
    // output(dw)
    // [1] call output
    jsr output
    // main::@return
    // }
    // [2] return 
    rts
  .segment Data
    msg: .text "camelot"
    .byte 0
}
.segment Code
  // output
// void output(unsigned long dw)
output: {
    // *screen = dw
    // [3] *screen = main::dw -- _deref_pduc1=vduc2 
    lda #<main.dw
    sta screen
    lda #>main.dw
    sta screen+1
    lda #<main.dw>>$10
    sta screen+2
    lda #>main.dw>>$10
    sta screen+3
    // output::@return
    // }
    // [4] return 
    rts
}
  // File Data

