
CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  *SCREEN = 0
  asm { lda#0 staSCREEN+1 lda#0 staSCREEN+2  }
  SCREEN[3] = 0
  asm { lda#0 staSCREEN+4  }
  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 SCREEN = (char *)$400
void __start()
void main()

Adding number conversion cast (unumber) 0 in *SCREEN = 0
Adding number conversion cast (unumber) 0 in SCREEN[3] = 0
Adding number conversion cast (unumber) 3 in SCREEN[3] = ((unumber)) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *SCREEN = (unumber)0
Inlining cast SCREEN[(unumber)3] = (unumber)0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
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
Consolidated array index constant in *(SCREEN+3)
Successful SSA optimization Pass2ConstantAdditionElimination
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] *SCREEN = 0
  asm { lda#0 staSCREEN+1 lda#0 staSCREEN+2  }
  [2] *(SCREEN+3) = 0
  asm { lda#0 staSCREEN+4  }
  to:main::@return
main::@return: scope:[main]  from main
  [4] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *SCREEN = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement asm { lda#0 staSCREEN+1 lda#0 staSCREEN+2  } always clobbers reg byte a 
Statement [2] *(SCREEN+3) = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement asm { lda#0 staSCREEN+4  } always clobbers reg byte a 

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

Uplifting [main] best 39 combination 
Uplifting [] best 39 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests that inline assembler is optimized
  // Upstart
  // Commodore 64 PRG executable file
.file [name="inline-asm-optimized.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
  .label SCREEN = $400
.segment Code
  // main
main: {
    // [0] *SCREEN = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta SCREEN
    // asm { lda#0 staSCREEN+1 lda#0 staSCREEN+2  }
    lda #0
    sta SCREEN+1
    lda #0
    sta SCREEN+2
    // [2] *(SCREEN+3) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta SCREEN+3
    // asm { lda#0 staSCREEN+4  }
    lda #0
    sta SCREEN+4
    jmp __breturn
    // main::@return
  __breturn:
    // [4] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant char * const SCREEN = (char *) 1024
void main()



FINAL ASSEMBLER
Score: 28

  // File Comments
// Tests that inline assembler is optimized
  // Upstart
  // Commodore 64 PRG executable file
.file [name="inline-asm-optimized.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
  .label SCREEN = $400
.segment Code
  // main
main: {
    // *SCREEN = 0
    // [0] *SCREEN = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta SCREEN
    // asm
    // asm { lda#0 staSCREEN+1 lda#0 staSCREEN+2  }
    sta SCREEN+1
    sta SCREEN+2
    // SCREEN[3] = 0
    // [2] *(SCREEN+3) = 0 -- _deref_pbuc1=vbuc2 
    sta SCREEN+3
    // asm
    // asm { lda#0 staSCREEN+4  }
    sta SCREEN+4
    // main::@return
    // }
    // [4] return 
    rts
}
  // File Data

