Setting inferred volatile on symbol affected by address-of (word) main::w ← (word)&(byte*) ptr

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte*) ptr ← (byte*)(number) $1000
  to:@1

(void()) main()
main: scope:[main]  from @1
  (word) main::w#0 ← (word)&(byte*) ptr
  (word) main::w#1 ← (word) main::w#0 + (number) $32
  (byte~) main::$0 ← < (word) main::w#1
  *((const byte*) SCREEN + (number) 0) ← (byte~) main::$0
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return
@1: scope:[]  from @begin
  call main 
  to:@2
@2: scope:[]  from @1
  to:@end
@end: scope:[]  from @2

SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*)(number) $400
(void()) main()
(byte~) main::$0
(label) main::@return
(word) main::w
(word) main::w#0
(word) main::w#1
(byte*) ptr loadstore

Adding number conversion cast (unumber) $32 in (word) main::w#1 ← (word) main::w#0 + (number) $32
Adding number conversion cast (unumber) 0 in *((const byte*) SCREEN + (number) 0) ← (byte~) main::$0
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (byte*) 4096
Simplifying constant integer cast $32
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $32
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant (const word) main::w#0 = (word)&ptr
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero SCREEN in [4] *((const byte*) SCREEN + (byte) 0) ← (byte~) main::$0
Successful SSA optimization PassNSimplifyExpressionWithZero
Constant right-side identified [1] (word) main::w#1 ← (const word) main::w#0 + (byte) $32
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const word) main::w#1 = main::w#0+$32
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [1] (byte~) main::$0 ← < (const word) main::w#1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::$0 = <main::w#1
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with different constant siblings (const word) main::w#0
Inlining constant with different constant siblings (const word) main::w#1
Constant inlined main::w#0 = (word)&(byte*) ptr
Constant inlined main::w#1 = (word)&(byte*) ptr+(byte) $32
Constant inlined main::$0 = <(word)&(byte*) ptr+(byte) $32
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2 

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

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] (byte*) ptr ← (byte*) 4096
  to:@1
@1: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @1
  [3] phi()

(void()) main()
main: scope:[main]  from @1
  [4] *((const byte*) SCREEN) ← <(word)&(byte*) ptr+(byte) $32
  to:main::@return
main::@return: scope:[main]  from main
  [5] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(word) main::w
(byte*) ptr loadstore 1.0

Initial phi equivalence classes
Added variable ptr to live range equivalence class [ ptr ]
Complete equivalence classes
[ ptr ]
Allocated zp[2]:2 [ ptr ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label ptr = 2
  // @begin
__bbegin:
  // [0] (byte*) ptr ← (byte*) 4096 -- pbuz1=pbuc1 
  lda #<$1000
  sta.z ptr
  lda #>$1000
  sta.z ptr+1
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    // [4] *((const byte*) SCREEN) ← <(word)&(byte*) ptr+(byte) $32 -- _deref_pbuc1=vbuc2 
    lda #<ptr+$32
    sta SCREEN
    jmp __breturn
    // main::@return
  __breturn:
    // [5] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte*) ptr ← (byte*) 4096 [ ptr ] (  [ ptr ] ) always clobbers reg byte a 
Statement [4] *((const byte*) SCREEN) ← <(word)&(byte*) ptr+(byte) $32 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Potential registers zp[2]:2 [ ptr ] : zp[2]:2 , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 1: zp[2]:2 [ ptr ] 
Uplift Scope [main] 

Uplifting [] best 37 combination zp[2]:2 [ ptr ] 
Uplifting [main] best 37 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label ptr = 2
  // @begin
__bbegin:
  // [0] (byte*) ptr ← (byte*) 4096 -- pbuz1=pbuc1 
  lda #<$1000
  sta.z ptr
  lda #>$1000
  sta.z ptr+1
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    // [4] *((const byte*) SCREEN) ← <(word)&(byte*) ptr+(byte) $32 -- _deref_pbuc1=vbuc2 
    lda #<ptr+$32
    sta SCREEN
    jmp __breturn
    // main::@return
  __breturn:
    // [5] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1:
Removing instruction __bend:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Adding RTS to root block 
Succesful ASM optimization Pass5AddMainRts

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(void()) main()
(label) main::@return
(word) main::w
(byte*) ptr loadstore zp[2]:2 1.0

zp[2]:2 [ ptr ]


FINAL ASSEMBLER
Score: 34

  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label ptr = 2
  // @begin
__bbegin:
  // ptr = 0x1000
  // [0] (byte*) ptr ← (byte*) 4096 -- pbuz1=pbuc1 
  lda #<$1000
  sta.z ptr
  lda #>$1000
  sta.z ptr+1
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  jsr main
  rts
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    // SCREEN[0] = <w
    // [4] *((const byte*) SCREEN) ← <(word)&(byte*) ptr+(byte) $32 -- _deref_pbuc1=vbuc2 
    lda #<ptr+$32
    sta SCREEN
    // main::@return
    // }
    // [5] return 
    rts
}
  // File Data

