
CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  main::SCREEN[0] = main::button_color
  main::SCREEN[1] = main::button_size
  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 RED = 2
void __start()
void main()
__constant char * const main::SCREEN = (char *)$400
__constant char main::button_color = RED
__constant char main::button_size = $18

Adding number conversion cast (unumber) 0 in main::SCREEN[0] = main::button_color
Adding number conversion cast (unumber) 1 in main::SCREEN[1] = main::button_size
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simplifying expression containing zero main::SCREEN in [0] main::SCREEN[0] = main::button_color
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
Constant inlined Button::$0::RED = 2
Constant inlined main::button_color = RED
Constant inlined Button::$0::GREEN = 5
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(main::SCREEN+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Finalized unsigned number type (char) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
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::SCREEN = RED
  [1] *(main::SCREEN+1) = main::button_size
  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] *main::SCREEN = RED [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *(main::SCREEN+1) = main::button_size [ ] (  [ ] { }  ) always clobbers reg byte a 

REGISTER UPLIFT SCOPES
Uplift Scope [Button] 
Uplift Scope [Button::$0] 
Uplift Scope [main] 
Uplift Scope [] 

Uplifting [Button] best 21 combination 
Uplifting [Button::$0] best 21 combination 
Uplifting [main] best 21 combination 
Uplifting [] best 21 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test of simple enum - struct with inline anonymous enum
  // Upstart
  // Commodore 64 PRG executable file
.file [name="enum-8.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 RED = 2
.segment Code
  // main
main: {
    .const button_size = $18
    .label SCREEN = $400
    // [0] *main::SCREEN = RED -- _deref_pbuc1=vbuc2 
    lda #RED
    sta SCREEN
    // [1] *(main::SCREEN+1) = main::button_size -- _deref_pbuc1=vbuc2 
    lda #button_size
    sta SCREEN+1
    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 RED = 2
void main()
__constant char * const main::SCREEN = (char *) 1024
__constant char main::button_size = $18



FINAL ASSEMBLER
Score: 18

  // File Comments
// Test of simple enum - struct with inline anonymous enum
  // Upstart
  // Commodore 64 PRG executable file
.file [name="enum-8.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 RED = 2
.segment Code
  // main
main: {
    .const button_size = $18
    .label SCREEN = $400
    // SCREEN[0] = button.color
    // [0] *main::SCREEN = RED -- _deref_pbuc1=vbuc2 
    lda #RED
    sta SCREEN
    // SCREEN[1] = button.size
    // [1] *(main::SCREEN+1) = main::button_size -- _deref_pbuc1=vbuc2 
    lda #button_size
    sta SCREEN+1
    // main::@return
    // }
    // [2] return 
    rts
}
  // File Data

