
CONTROL FLOW GRAPH SSA

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

void print(char *str)
print: scope:[print]  from main
  print::str#1 = phi( main/print::str#0 )
  *((char **)$80) = (char *)print::str#1
  to:print::@return
print::@return: scope:[print]  from print
  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 char main::str[4] = "qwe"
void print(char *str)
char *print::str
char *print::str#0
char *print::str#1

Simplifying constant integer cast print::str#1
Simplifying constant pointer cast (char **) 128
Successful SSA optimization PassNCastSimplification
Identical Phi Values print::str#1 print::str#0
Successful SSA optimization Pass2IdenticalPhiElimination
Constant print::str#0 = main::str
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 print::str#0 = main::str
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 print: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 print
  to:main::@return
main::@return: scope:[main]  from main
  [2] return 
  to:@return

void print(char *str)
print: scope:[print]  from main
  [3] *((char **) 128) = main::str
  to:print::@return
print::@return: scope:[print]  from print
  [4] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
void print(char *str)
char *print::str

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [3] *((char **) 128) = main::str [ ] ( print:1 [ ] { }  ) always clobbers reg byte a 

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

Uplifting [main] best 36 combination 
Uplifting [print] best 36 combination 
Uplifting [] best 36 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests assigning a literal word pointer
  // Upstart
  // Commodore 64 PRG executable file
.file [name="literal-word-pointer-0.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: {
    // [1] call print
    jsr print
    jmp __breturn
    // main::@return
  __breturn:
    // [2] return 
    rts
  .segment Data
    str: .text "qwe"
    .byte 0
}
.segment Code
  // print
// void print(char *str)
print: {
    // [3] *((char **) 128) = main::str -- _deref_qbuc1=pbuc2 
    lda #<main.str
    sta $80
    lda #>main.str
    sta $80+1
    jmp __breturn
    // print::@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 char main::str[4] = "qwe"
void print(char *str)
char *print::str



FINAL ASSEMBLER
Score: 30

  // File Comments
// Tests assigning a literal word pointer
  // Upstart
  // Commodore 64 PRG executable file
.file [name="literal-word-pointer-0.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: {
    // print("qwe")
    // [1] call print
    jsr print
    // main::@return
    // }
    // [2] return 
    rts
  .segment Data
    str: .text "qwe"
    .byte 0
}
.segment Code
  // print
// void print(char *str)
print: {
    // *(char**)0x80 = (char*)str
    // [3] *((char **) 128) = main::str -- _deref_qbuc1=pbuc2 
    lda #<main.str
    sta $80
    lda #>main.str
    sta $80+1
    // print::@return
    // }
    // [4] return 
    rts
}
  // File Data

