Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  main::idx#0 = 0
  SCREEN[main::idx#0] = *pc0
  main::idx#1 = ++ main::idx#0
  SCREEN[main::idx#1] = *pc1
  main::idx#2 = ++ main::idx#1
  SCREEN[main::idx#2] = *pc2
  main::idx#3 = ++ main::idx#2
  SCREEN[main::idx#3] = *cp0
  main::idx#4 = ++ main::idx#3
  SCREEN[main::idx#4] = *cp1
  main::idx#5 = ++ main::idx#4
  SCREEN[main::idx#5] = *cp2
  main::idx#6 = ++ main::idx#5
  SCREEN[main::idx#6] = *cpc0
  main::idx#7 = ++ main::idx#6
  SCREEN[main::idx#7] = *cpc1
  main::idx#8 = ++ main::idx#7
  SCREEN[main::idx#8] = *cpc2
  main::idx#9 = ++ main::idx#8
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  return 
  to:@return

SYMBOL TABLE SSA
__constant char *SCREEN = (char *)$400
void __start()
__constant char * const cp0 = (char *)$400
__constant char * const cp1 = (char *)$400
__constant char * const cp2 = (char *)$400
__constant const char * const cpc0 = (char *)$400
__constant const char * const cpc1 = (char *)$400
__constant const char * const cpc2 = (char *)$400
void main()
char main::idx
char main::idx#0
char main::idx#1
char main::idx#2
char main::idx#3
char main::idx#4
char main::idx#5
char main::idx#6
char main::idx#7
char main::idx#8
char main::idx#9
__constant const char *pc0 = (char *)$400
__constant const char *pc1 = (char *)$400
__constant const char *pc2 = (char *)$400

Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 1024
Successful SSA optimization PassNCastSimplification
Constant main::idx#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero SCREEN in [1] SCREEN[main::idx#0] = *pc0
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable main::idx#9 and assignment [17] main::idx#9 = ++ main::idx#8
Successful SSA optimization PassNEliminateUnusedVars
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::__init1
Removing unused procedure block __start::@1
Removing unused procedure block __start::@2
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Constant right-side identified [1] main::idx#1 = ++ main::idx#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#1 = ++main::idx#0
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [2] main::idx#2 = ++ main::idx#1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#2 = ++main::idx#1
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [3] main::idx#3 = ++ main::idx#2
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#3 = ++main::idx#2
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [4] main::idx#4 = ++ main::idx#3
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#4 = ++main::idx#3
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [5] main::idx#5 = ++ main::idx#4
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#5 = ++main::idx#4
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [6] main::idx#6 = ++ main::idx#5
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#6 = ++main::idx#5
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [7] main::idx#7 = ++ main::idx#6
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#7 = ++main::idx#6
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [8] main::idx#8 = ++ main::idx#7
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#8 = ++main::idx#7
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with different constant siblings main::idx#0
Inlining constant with different constant siblings main::idx#1
Inlining constant with different constant siblings main::idx#2
Inlining constant with different constant siblings main::idx#3
Inlining constant with different constant siblings main::idx#4
Inlining constant with different constant siblings main::idx#5
Inlining constant with different constant siblings main::idx#6
Inlining constant with different constant siblings main::idx#7
Inlining constant with different constant siblings main::idx#8
Constant inlined main::idx#0 = 0
Constant inlined main::idx#1 = ++0
Constant inlined main::idx#2 = ++++0
Constant inlined main::idx#3 = ++++++0
Constant inlined main::idx#4 = ++++++++0
Constant inlined main::idx#5 = ++++++++++0
Constant inlined main::idx#6 = ++++++++++++0
Constant inlined main::idx#7 = ++++++++++++++0
Constant inlined main::idx#8 = ++++++++++++++++0
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(SCREEN+++0)
Consolidated array index constant in *(SCREEN+++++0)
Consolidated array index constant in *(SCREEN+++++++0)
Consolidated array index constant in *(SCREEN+++++++++0)
Consolidated array index constant in *(SCREEN+++++++++++0)
Consolidated array index constant in *(SCREEN+++++++++++++0)
Consolidated array index constant in *(SCREEN+++++++++++++++0)
Consolidated array index constant in *(SCREEN+++++++++++++++++0)
Successful SSA optimization Pass2ConstantAdditionElimination
Simplifying constant integer increment ++0
Simplifying constant integer increment ++0
Simplifying constant integer increment ++1
Simplifying constant integer increment ++2
Simplifying constant integer increment ++3
Simplifying constant integer increment ++4
Simplifying constant integer increment ++5
Simplifying constant integer increment ++6
Successful SSA optimization Pass2ConstantSimplification
Simplifying constant integer increment ++1
Simplifying constant integer increment ++2
Simplifying constant integer increment ++3
Simplifying constant integer increment ++4
Simplifying constant integer increment ++5
Simplifying constant integer increment ++6
Simplifying constant integer increment ++7
Successful SSA optimization Pass2ConstantSimplification
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 = *pc0
  [1] *(SCREEN+1) = *pc1
  [2] *(SCREEN+2) = *pc2
  [3] *(SCREEN+3) = *cp0
  [4] *(SCREEN+4) = *cp1
  [5] *(SCREEN+5) = *cp2
  [6] *(SCREEN+6) = *cpc0
  [7] *(SCREEN+7) = *cpc1
  [8] *(SCREEN+8) = *cpc2
  to:main::@return
main::@return: scope:[main]  from main
  [9] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
char main::idx

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *SCREEN = *pc0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *(SCREEN+1) = *pc1 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] *(SCREEN+2) = *pc2 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] *(SCREEN+3) = *cp0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [4] *(SCREEN+4) = *cp1 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [5] *(SCREEN+5) = *cp2 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [6] *(SCREEN+6) = *cpc0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [7] *(SCREEN+7) = *cpc1 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [8] *(SCREEN+8) = *cpc2 [ ] (  [ ] { }  ) always clobbers reg byte a 

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

Uplifting [main] best 81 combination 
Uplifting [] best 81 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test pointer to const and const pointer combined with typedef
  // Upstart
  // Commodore 64 PRG executable file
.file [name="pointer-const-typedef.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 pointer
  .label cp0 = $400
  .label cp1 = $400
  .label cp2 = $400
  // Const pointer to const
  .label cpc0 = $400
  .label cpc1 = $400
  .label cpc2 = $400
  // Pointer to const
  .label pc0 = $400
  .label pc1 = $400
  .label pc2 = $400
  .label SCREEN = $400
.segment Code
  // main
main: {
    // [0] *SCREEN = *pc0 -- _deref_pbuc1=_deref_pbuc2 
    lda pc0
    sta SCREEN
    // [1] *(SCREEN+1) = *pc1 -- _deref_pbuc1=_deref_pbuc2 
    lda pc1
    sta SCREEN+1
    // [2] *(SCREEN+2) = *pc2 -- _deref_pbuc1=_deref_pbuc2 
    lda pc2
    sta SCREEN+2
    // [3] *(SCREEN+3) = *cp0 -- _deref_pbuc1=_deref_pbuc2 
    lda cp0
    sta SCREEN+3
    // [4] *(SCREEN+4) = *cp1 -- _deref_pbuc1=_deref_pbuc2 
    lda cp1
    sta SCREEN+4
    // [5] *(SCREEN+5) = *cp2 -- _deref_pbuc1=_deref_pbuc2 
    lda cp2
    sta SCREEN+5
    // [6] *(SCREEN+6) = *cpc0 -- _deref_pbuc1=_deref_pbuc2 
    lda cpc0
    sta SCREEN+6
    // [7] *(SCREEN+7) = *cpc1 -- _deref_pbuc1=_deref_pbuc2 
    lda cpc1
    sta SCREEN+7
    // [8] *(SCREEN+8) = *cpc2 -- _deref_pbuc1=_deref_pbuc2 
    lda cpc2
    sta SCREEN+8
    jmp __breturn
    // main::@return
  __breturn:
    // [9] 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 *SCREEN = (char *) 1024
__constant char * const cp0 = (char *) 1024
__constant char * const cp1 = (char *) 1024
__constant char * const cp2 = (char *) 1024
__constant const char * const cpc0 = (char *) 1024
__constant const char * const cpc1 = (char *) 1024
__constant const char * const cpc2 = (char *) 1024
void main()
char main::idx
__constant const char *pc0 = (char *) 1024
__constant const char *pc1 = (char *) 1024
__constant const char *pc2 = (char *) 1024



FINAL ASSEMBLER
Score: 78

  // File Comments
// Test pointer to const and const pointer combined with typedef
  // Upstart
  // Commodore 64 PRG executable file
.file [name="pointer-const-typedef.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 pointer
  .label cp0 = $400
  .label cp1 = $400
  .label cp2 = $400
  // Const pointer to const
  .label cpc0 = $400
  .label cpc1 = $400
  .label cpc2 = $400
  // Pointer to const
  .label pc0 = $400
  .label pc1 = $400
  .label pc2 = $400
  .label SCREEN = $400
.segment Code
  // main
main: {
    // SCREEN[idx++] = *pc0
    // [0] *SCREEN = *pc0 -- _deref_pbuc1=_deref_pbuc2 
    lda pc0
    sta SCREEN
    // SCREEN[idx++] = *pc1
    // [1] *(SCREEN+1) = *pc1 -- _deref_pbuc1=_deref_pbuc2 
    lda pc1
    sta SCREEN+1
    // SCREEN[idx++] = *pc2
    // [2] *(SCREEN+2) = *pc2 -- _deref_pbuc1=_deref_pbuc2 
    lda pc2
    sta SCREEN+2
    // SCREEN[idx++] = *cp0
    // [3] *(SCREEN+3) = *cp0 -- _deref_pbuc1=_deref_pbuc2 
    lda cp0
    sta SCREEN+3
    // SCREEN[idx++] = *cp1
    // [4] *(SCREEN+4) = *cp1 -- _deref_pbuc1=_deref_pbuc2 
    lda cp1
    sta SCREEN+4
    // SCREEN[idx++] = *cp2
    // [5] *(SCREEN+5) = *cp2 -- _deref_pbuc1=_deref_pbuc2 
    lda cp2
    sta SCREEN+5
    // SCREEN[idx++] = *cpc0
    // [6] *(SCREEN+6) = *cpc0 -- _deref_pbuc1=_deref_pbuc2 
    lda cpc0
    sta SCREEN+6
    // SCREEN[idx++] = *cpc1
    // [7] *(SCREEN+7) = *cpc1 -- _deref_pbuc1=_deref_pbuc2 
    lda cpc1
    sta SCREEN+7
    // SCREEN[idx++] = *cpc2
    // [8] *(SCREEN+8) = *cpc2 -- _deref_pbuc1=_deref_pbuc2 
    lda cpc2
    sta SCREEN+8
    // main::@return
    // }
    // [9] return 
    rts
}
  // File Data

