
CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  *((char *)COLORS+OFFSET_STRUCT_SCREEN_COLORS_BORDER) = 0
  *BG_COLOR = 6
  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
__constant char * const BG_COLOR = (char *)(char *)COLORS+OFFSET_STRUCT_SCREEN_COLORS_BG0
__constant struct SCREEN_COLORS * const COLORS = (struct SCREEN_COLORS *)$d020
__constant char OFFSET_STRUCT_SCREEN_COLORS_BG0 = 1
__constant char OFFSET_STRUCT_SCREEN_COLORS_BORDER = 0
void __start()
void main()

Adding number conversion cast (unumber) 0 in *((char *)COLORS+OFFSET_STRUCT_SCREEN_COLORS_BORDER) = 0
Adding number conversion cast (unumber) 6 in *BG_COLOR = 6
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *((char *)COLORS+OFFSET_STRUCT_SCREEN_COLORS_BORDER) = (unumber)0
Inlining cast *BG_COLOR = (unumber)6
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (struct SCREEN_COLORS *) 53280
Simplifying constant integer cast (char *)COLORS+OFFSET_STRUCT_SCREEN_COLORS_BG0
Simplifying constant integer cast 0
Simplifying constant integer cast 6
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 6
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simplifying expression containing zero (char *)COLORS in [0] *((char *)COLORS+OFFSET_STRUCT_SCREEN_COLORS_BORDER) = 0
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant OFFSET_STRUCT_SCREEN_COLORS_BORDER
Successful SSA optimization PassNEliminateUnusedVars
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

void main()
main: scope:[main]  from
  [0] *((char *)COLORS) = 0
  [1] *BG_COLOR = 6
  to:main::@return
main::@return: scope:[main]  from main
  [2] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *((char *)COLORS) = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *BG_COLOR = 6 [ ] (  [ ] { }  ) always clobbers reg byte a 

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

Uplifting [SCREEN_COLORS] best 21 combination 
Uplifting [main] best 21 combination 
Uplifting [] best 21 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Support for pointer to struct member
  // Upstart
  // Commodore 64 PRG executable file
.file [name="struct-pointer-to-member.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 OFFSET_STRUCT_SCREEN_COLORS_BG0 = 1
  // Commodore 64 processor port
  .label COLORS = $d020
  // The background color
  .label BG_COLOR = COLORS+OFFSET_STRUCT_SCREEN_COLORS_BG0
.segment Code
  // main
main: {
    // [0] *((char *)COLORS) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta COLORS
    // [1] *BG_COLOR = 6 -- _deref_pbuc1=vbuc2 
    lda #6
    sta BG_COLOR
    jmp __breturn
    // main::@return
  __breturn:
    // [2] return 
    rts
}
  // File Data

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

FINAL SYMBOL TABLE
__constant char * const BG_COLOR = (char *)COLORS+OFFSET_STRUCT_SCREEN_COLORS_BG0
__constant struct SCREEN_COLORS * const COLORS = (struct SCREEN_COLORS *) 53280
__constant char OFFSET_STRUCT_SCREEN_COLORS_BG0 = 1
void main()



FINAL ASSEMBLER
Score: 18

  // File Comments
// Support for pointer to struct member
  // Upstart
  // Commodore 64 PRG executable file
.file [name="struct-pointer-to-member.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 OFFSET_STRUCT_SCREEN_COLORS_BG0 = 1
  // Commodore 64 processor port
  .label COLORS = $d020
  // The background color
  .label BG_COLOR = COLORS+OFFSET_STRUCT_SCREEN_COLORS_BG0
.segment Code
  // main
main: {
    // COLORS->BORDER = 0
    // [0] *((char *)COLORS) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta COLORS
    // *BG_COLOR = 6
    // [1] *BG_COLOR = 6 -- _deref_pbuc1=vbuc2 
    lda #6
    sta BG_COLOR
    // main::@return
    // }
    // [2] return 
    rts
}
  // File Data

