Identified constant variable (byte) main::state
Identified constant variable (byte) test::state
Culled Empty Block (label) @1

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@2

(void()) main()
main: scope:[main]  from @2
  *((const byte*) main::SCREEN) ← (const byte) main::state
  call test 
  to:main::@1
main::@1: scope:[main]  from main
  to:main::@return
main::@return: scope:[main]  from main::@1
  return 
  to:@return

(void()) test()
test: scope:[test]  from main
  *((const byte*) test::SCREEN) ← (const byte) test::state
  to:test::@return
test::@return: scope:[test]  from test
  return 
  to:@return
@2: scope:[]  from @begin
  call main 
  to:@3
@3: scope:[]  from @2
  to:@end
@end: scope:[]  from @3

SYMBOL TABLE SSA
(label) @2
(label) @3
(label) @begin
(label) @end
(void()) main()
(label) main::@1
(label) main::@return
(const byte) main::ON = (byte) 1
(const byte*) main::SCREEN = (byte*)(number) $400
(const byte) main::state = (const byte) main::ON
(void()) test()
(label) test::@return
(const byte) test::ON = (byte) 8
(const byte*) test::SCREEN = (byte*)(number) $428
(const byte) test::state = (const byte) test::ON

Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (byte*) 1064
Successful SSA optimization PassNCastSimplification
Constant inlined main::state = (const byte) main::ON
Constant inlined test::state = (const byte) test::ON
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to test:6 

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

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  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*) main::SCREEN) ← (const byte) main::ON
  [5] call test 
  to:main::@return
main::@return: scope:[main]  from main
  [6] return 
  to:@return

(void()) test()
test: scope:[test]  from main
  [7] *((const byte*) test::SCREEN) ← (const byte) test::ON
  to:test::@return
test::@return: scope:[test]  from test
  [8] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(void()) test()

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Test of simple enum - multiple inline enum definitions
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @begin
__bbegin:
  // [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: {
    .const ON = 1
    .label SCREEN = $400
    // [4] *((const byte*) main::SCREEN) ← (const byte) main::ON -- _deref_pbuc1=vbuc2 
    lda #ON
    sta SCREEN
    // [5] call test 
    jsr test
    jmp __breturn
    // main::@return
  __breturn:
    // [6] return 
    rts
}
  // test
test: {
    .const ON = 8
    .label SCREEN = $428
    // [7] *((const byte*) test::SCREEN) ← (const byte) test::ON -- _deref_pbuc1=vbuc2 
    lda #ON
    sta SCREEN
    jmp __breturn
    // test::@return
  __breturn:
    // [8] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((const byte*) main::SCREEN) ← (const byte) main::ON [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [7] *((const byte*) test::SCREEN) ← (const byte) test::ON [ ] ( main:2::test:5 [ ] ) always clobbers reg byte a 

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

Uplifting [main] best 48 combination 
Uplifting [test] best 48 combination 
Uplifting [] best 48 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test of simple enum - multiple inline enum definitions
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @begin
__bbegin:
  // [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: {
    .const ON = 1
    .label SCREEN = $400
    // [4] *((const byte*) main::SCREEN) ← (const byte) main::ON -- _deref_pbuc1=vbuc2 
    lda #ON
    sta SCREEN
    // [5] call test 
    jsr test
    jmp __breturn
    // main::@return
  __breturn:
    // [6] return 
    rts
}
  // test
test: {
    .const ON = 8
    .label SCREEN = $428
    // [7] *((const byte*) test::SCREEN) ← (const byte) test::ON -- _deref_pbuc1=vbuc2 
    lda #ON
    sta SCREEN
    jmp __breturn
    // test::@return
  __breturn:
    // [8] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(label) main::@return
(const byte) main::ON = (byte) 1
(const byte*) main::SCREEN = (byte*) 1024
(void()) test()
(label) test::@return
(const byte) test::ON = (byte) 8
(const byte*) test::SCREEN = (byte*) 1064



FINAL ASSEMBLER
Score: 30

  // File Comments
// Test of simple enum - multiple inline enum definitions
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .const ON = 1
    .label SCREEN = $400
    // *SCREEN = state
    // [4] *((const byte*) main::SCREEN) ← (const byte) main::ON -- _deref_pbuc1=vbuc2 
    lda #ON
    sta SCREEN
    // test()
    // [5] call test 
    jsr test
    // main::@return
    // }
    // [6] return 
    rts
}
  // test
test: {
    .const ON = 8
    .label SCREEN = $428
    // *SCREEN = state
    // [7] *((const byte*) test::SCREEN) ← (const byte) test::ON -- _deref_pbuc1=vbuc2 
    lda #ON
    sta SCREEN
    // test::@return
    // }
    // [8] return 
    rts
}
  // File Data

