Culled Empty Block (label) main::@1

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@1
main: scope:[main]  from @1
  (bool*) main::bscreen#0 ← ((bool*)) (number) $400
  *((bool*) main::bscreen#0 + (number) 0) ← true
  *((bool*) main::bscreen#0 + (number) 1) ← false
  (bool*~) main::$0 ← (bool*) main::bscreen#0 + (number) 2
  (bool*) main::bscreen#1 ← (bool*~) main::$0
  *((bool*) main::bscreen#1) ← true
  (bool~) main::$1 ← ! *((bool*) main::bscreen#1)
  if((bool~) main::$1) goto main::@return
  to:main::@2
main::@2: scope:[main]  from main
  (bool*) main::bscreen#3 ← phi( main/(bool*) main::bscreen#1 )
  (bool*) main::bscreen#2 ← ++ (bool*) main::bscreen#3
  *((bool*) main::bscreen#2) ← true
  to:main::@return
main::@return: scope:[main]  from main main::@2
  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
(void()) main()
(bool*~) main::$0
(bool~) main::$1
(label) main::@2
(label) main::@return
(bool*) main::bscreen
(bool*) main::bscreen#0
(bool*) main::bscreen#1
(bool*) main::bscreen#2
(bool*) main::bscreen#3

Adding number conversion cast (unumber) 0 in *((bool*) main::bscreen#0 + (number) 0) ← true
Adding number conversion cast (unumber) 1 in *((bool*) main::bscreen#0 + (number) 1) ← false
Adding number conversion cast (unumber) 2 in (bool*~) main::$0 ← (bool*) main::bscreen#0 + (number) 2
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (bool*) main::bscreen#0 ← (bool*)(number) $400
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (bool*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (bool*) main::bscreen#1 = (bool*~) main::$0 (bool*) main::bscreen#3 
Successful SSA optimization Pass2AliasElimination
Rewriting ! if()-condition to reversed if() [6] (bool~) main::$1 ← ! *((bool*) main::bscreen#1)
Successful SSA optimization Pass2ConditionalAndOrRewriting
Constant (const bool*) main::bscreen#0 = (bool*) 1024
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero main::bscreen#0 in [1] *((const bool*) main::bscreen#0 + (byte) 0) ← true
Successful SSA optimization PassNSimplifyExpressionWithZero
Constant right-side identified [2] (bool*) main::bscreen#1 ← (const bool*) main::bscreen#0 + (byte) 2
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const bool*) main::bscreen#1 = main::bscreen#0+2
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [4] (bool*) main::bscreen#2 ← ++ (const bool*) main::bscreen#1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const bool*) main::bscreen#2 = ++main::bscreen#1
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with different constant siblings (const bool*) main::bscreen#0
Inlining constant with different constant siblings (const bool*) main::bscreen#1
Inlining constant with different constant siblings (const bool*) main::bscreen#2
Constant inlined main::bscreen#2 = ++(bool*) 1024+(byte) 2
Constant inlined main::bscreen#0 = (bool*) 1024
Constant inlined main::bscreen#1 = (bool*) 1024+(byte) 2
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *((bool*) 1024+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Simplifying constant integer increment ++(bool*) 1024+2
Successful SSA optimization Pass2ConstantSimplification
Adding NOP phi() at start of @begin
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
Renumbering block main::@2 to main::@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()
main: scope:[main]  from @1
  [4] *((bool*) 1024) ← true
  [5] *((bool*) 1024+(byte) 1) ← false
  [6] *((bool*) 1024+(byte) 2) ← true
  [7] if(*((bool*) 1024+(byte) 2)) goto main::@1
  to:main::@return
main::@1: scope:[main]  from main
  [8] *((bool*) 1024+(byte) 3) ← true
  to:main::@return
main::@return: scope:[main]  from main main::@1
  [9] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(bool*) main::bscreen

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
  // File Comments
// Tests a pointer to a boolean
  // Basic 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: {
    // [4] *((bool*) 1024) ← true -- _deref_pboc1=vboc2 
    lda #1
    sta $400
    // [5] *((bool*) 1024+(byte) 1) ← false -- _deref_pboc1=vboc2 
    lda #0
    sta $400+1
    // [6] *((bool*) 1024+(byte) 2) ← true -- _deref_pboc1=vboc2 
    lda #1
    sta $400+2
    // [7] if(*((bool*) 1024+(byte) 2)) goto main::@1 -- _deref_pboc1_then_la1 
    lda $400+2
    cmp #0
    bne b1
    jmp breturn
    // main::@1
  b1:
    // [8] *((bool*) 1024+(byte) 3) ← true -- _deref_pboc1=vboc2 
    lda #1
    sta $400+3
    jmp breturn
    // main::@return
  breturn:
    // [9] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((bool*) 1024) ← true [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [5] *((bool*) 1024+(byte) 1) ← false [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [6] *((bool*) 1024+(byte) 2) ← true [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [7] if(*((bool*) 1024+(byte) 2)) goto main::@1 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [8] *((bool*) 1024+(byte) 3) ← true [ ] ( main:2 [ ] ) always clobbers reg byte a 

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

Uplifting [main] best 56 combination 
Uplifting [] best 56 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests a pointer to a boolean
  // Basic 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: {
    // [4] *((bool*) 1024) ← true -- _deref_pboc1=vboc2 
    lda #1
    sta $400
    // [5] *((bool*) 1024+(byte) 1) ← false -- _deref_pboc1=vboc2 
    lda #0
    sta $400+1
    // [6] *((bool*) 1024+(byte) 2) ← true -- _deref_pboc1=vboc2 
    lda #1
    sta $400+2
    // [7] if(*((bool*) 1024+(byte) 2)) goto main::@1 -- _deref_pboc1_then_la1 
    lda $400+2
    cmp #0
    bne b1
    jmp breturn
    // main::@1
  b1:
    // [8] *((bool*) 1024+(byte) 3) ← true -- _deref_pboc1=vboc2 
    lda #1
    sta $400+3
    jmp breturn
    // main::@return
  breturn:
    // [9] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda $400+2
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Replacing jump to rts with rts in jmp breturn
Succesful ASM optimization Pass5DoubleJumpElimination
Removing instruction bbegin:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(label) main::@1
(label) main::@return
(bool*) main::bscreen



FINAL ASSEMBLER
Score: 40

  // File Comments
// Tests a pointer to a boolean
  // Basic 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: {
    // bscreen[0] = true
    // [4] *((bool*) 1024) ← true -- _deref_pboc1=vboc2 
    lda #1
    sta $400
    // bscreen[1] = false
    // [5] *((bool*) 1024+(byte) 1) ← false -- _deref_pboc1=vboc2 
    lda #0
    sta $400+1
    // *bscreen = true
    // [6] *((bool*) 1024+(byte) 2) ← true -- _deref_pboc1=vboc2 
    lda #1
    sta $400+2
    // if(*bscreen)
    // [7] if(*((bool*) 1024+(byte) 2)) goto main::@1 -- _deref_pboc1_then_la1 
    cmp #0
    bne b1
    rts
    // main::@1
  b1:
    // *(++bscreen)= true
    // [8] *((bool*) 1024+(byte) 3) ← true -- _deref_pboc1=vboc2 
    lda #1
    sta $400+3
    // main::@return
    // }
    // [9] return 
    rts
}
  // File Data

