Setting inferred volatile on symbol affected by address-of main::wp = &main::w

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  main::w = $d03
  main::$0 = byte0  *main::wp
  main::screen[0] = main::$0
  main::$1 = byte1  *main::wp
  main::screen[1] = main::$1
  *main::wp = $210c
  main::$2 = byte0  *main::wp
  main::screen[2] = main::$2
  main::$3 = byte1  *main::wp
  main::screen[3] = main::$3
  to:main::@return
main::@return: scope:[main]  from main
  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()
char main::$0
char main::$1
char main::$2
char main::$3
__constant char *main::screen = (char *)$400
__loadstore volatile unsigned int main::w
__constant unsigned int *main::wp = &main::w

Adding number conversion cast (unumber) 0 in main::screen[0] = main::$0
Adding number conversion cast (unumber) 1 in main::screen[1] = main::$1
Adding number conversion cast (unumber) $210c in *main::wp = $210c
Adding number conversion cast (unumber) 2 in main::screen[2] = main::$2
Adding number conversion cast (unumber) 3 in main::screen[3] = main::$3
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *main::wp = (unumber)$210c
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast $210c
Simplifying constant integer cast 2
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Finalized unsigned number type (unsigned int) $210c
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simplifying expression containing zero main::screen in [2] main::screen[0] = main::$0
Successful SSA optimization PassNSimplifyExpressionWithZero
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
Consolidated array index constant in *(main::screen+1)
Consolidated array index constant in *(main::screen+2)
Consolidated array index constant in *(main::screen+3)
Successful SSA optimization Pass2ConstantAdditionElimination
CALL GRAPH

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] main::w = $d03
  [1] main::$0 = byte0  *main::wp
  [2] *main::screen = main::$0
  [3] main::$1 = byte1  *main::wp
  [4] *(main::screen+1) = main::$1
  [5] *main::wp = $210c
  [6] main::$2 = byte0  *main::wp
  [7] *(main::screen+2) = main::$2
  [8] main::$3 = byte1  *main::wp
  [9] *(main::screen+3) = main::$3
  to:main::@return
main::@return: scope:[main]  from main
  [10] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
char main::$0 // 4.0
char main::$1 // 4.0
char main::$2 // 4.0
char main::$3 // 4.0
__loadstore volatile unsigned int main::w // 20.0

Initial phi equivalence classes
Added variable main::w to live range equivalence class [ main::w ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Added variable main::$1 to live range equivalence class [ main::$1 ]
Added variable main::$2 to live range equivalence class [ main::$2 ]
Added variable main::$3 to live range equivalence class [ main::$3 ]
Complete equivalence classes
[ main::w ]
[ main::$0 ]
[ main::$1 ]
[ main::$2 ]
[ main::$3 ]
Allocated zp[2]:2 [ main::w ]
Allocated zp[1]:4 [ main::$0 ]
Allocated zp[1]:5 [ main::$1 ]
Allocated zp[1]:6 [ main::$2 ]
Allocated zp[1]:7 [ main::$3 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] main::w = $d03 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [5] *main::wp = $210c [ ] (  [ ] { }  ) always clobbers reg byte a 
Potential registers zp[2]:2 [ main::w ] : zp[2]:2 , 
Potential registers zp[1]:4 [ main::$0 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:5 [ main::$1 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:6 [ main::$2 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:7 [ main::$3 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 20: zp[2]:2 [ main::w ] 4: zp[1]:4 [ main::$0 ] 4: zp[1]:5 [ main::$1 ] 4: zp[1]:6 [ main::$2 ] 4: zp[1]:7 [ main::$3 ] 
Uplift Scope [] 

Uplifting [main] best 57 combination zp[2]:2 [ main::w ] reg byte a [ main::$0 ] reg byte a [ main::$1 ] reg byte a [ main::$2 ] reg byte a [ main::$3 ] 
Limited combination testing to 100 combinations of 256 possible.
Uplifting [] best 57 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test a constant word pointers (pointing to a word placed on zeropage).
// The result when running is "CML!" on the screen.
  // Upstart
  // Commodore 64 PRG executable file
.file [name="const-word-pointer.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: {
    .label screen = $400
    .label wp = w
    .label w = 2
    // [0] main::w = $d03 -- vwuz1=vwuc1 
    lda #<$d03
    sta.z w
    lda #>$d03
    sta.z w+1
    // [1] main::$0 = byte0  *main::wp -- vbuaa=_byte0__deref_pwuc1 
    lda.z wp
    // [2] *main::screen = main::$0 -- _deref_pbuc1=vbuaa 
    sta screen
    // [3] main::$1 = byte1  *main::wp -- vbuaa=_byte1__deref_pwuc1 
    lda.z wp+1
    // [4] *(main::screen+1) = main::$1 -- _deref_pbuc1=vbuaa 
    sta screen+1
    // [5] *main::wp = $210c -- _deref_pwuc1=vwuc2 
    lda #<$210c
    sta.z wp
    lda #>$210c
    sta.z wp+1
    // [6] main::$2 = byte0  *main::wp -- vbuaa=_byte0__deref_pwuc1 
    lda.z wp
    // [7] *(main::screen+2) = main::$2 -- _deref_pbuc1=vbuaa 
    sta screen+2
    // [8] main::$3 = byte1  *main::wp -- vbuaa=_byte1__deref_pwuc1 
    lda.z wp+1
    // [9] *(main::screen+3) = main::$3 -- _deref_pbuc1=vbuaa 
    sta screen+3
    jmp __breturn
    // main::@return
  __breturn:
    // [10] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
void main()
char main::$0 // reg byte a 4.0
char main::$1 // reg byte a 4.0
char main::$2 // reg byte a 4.0
char main::$3 // reg byte a 4.0
__constant char *main::screen = (char *) 1024
__loadstore volatile unsigned int main::w // zp[2]:2 20.0
__constant unsigned int *main::wp = &main::w

zp[2]:2 [ main::w ]
reg byte a [ main::$0 ]
reg byte a [ main::$1 ]
reg byte a [ main::$2 ]
reg byte a [ main::$3 ]


FINAL ASSEMBLER
Score: 54

  // File Comments
// Test a constant word pointers (pointing to a word placed on zeropage).
// The result when running is "CML!" on the screen.
  // Upstart
  // Commodore 64 PRG executable file
.file [name="const-word-pointer.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: {
    .label screen = $400
    .label wp = w
    .label w = 2
    // word w = $0d03
    // [0] main::w = $d03 -- vwuz1=vwuc1 
    lda #<$d03
    sta.z w
    lda #>$d03
    sta.z w+1
    // BYTE0(*wp)
    // [1] main::$0 = byte0  *main::wp -- vbuaa=_byte0__deref_pwuc1 
    lda.z wp
    // screen[0] = BYTE0(*wp)
    // [2] *main::screen = main::$0 -- _deref_pbuc1=vbuaa 
    sta screen
    // BYTE1(*wp)
    // [3] main::$1 = byte1  *main::wp -- vbuaa=_byte1__deref_pwuc1 
    lda.z wp+1
    // screen[1] = BYTE1(*wp)
    // [4] *(main::screen+1) = main::$1 -- _deref_pbuc1=vbuaa 
    sta screen+1
    // *wp = $210c
    // [5] *main::wp = $210c -- _deref_pwuc1=vwuc2 
    lda #<$210c
    sta.z wp
    lda #>$210c
    sta.z wp+1
    // BYTE0(*wp)
    // [6] main::$2 = byte0  *main::wp -- vbuaa=_byte0__deref_pwuc1 
    lda.z wp
    // screen[2] = BYTE0(*wp)
    // [7] *(main::screen+2) = main::$2 -- _deref_pbuc1=vbuaa 
    sta screen+2
    // BYTE1(*wp)
    // [8] main::$3 = byte1  *main::wp -- vbuaa=_byte1__deref_pwuc1 
    lda.z wp+1
    // screen[3] = BYTE1(*wp)
    // [9] *(main::screen+3) = main::$3 -- _deref_pbuc1=vbuaa 
    sta screen+3
    // main::@return
    // }
    // [10] return 
    rts
}
  // File Data

