Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  idx#17 = phi( __start::@1/idx#18 )
  call print
  to:main::@1
main::@1: scope:[main]  from main
  idx#9 = phi( main/idx#5 )
  idx#0 = idx#9
  call print
  to:main::@2
main::@2: scope:[main]  from main::@1
  idx#10 = phi( main::@1/idx#5 )
  idx#1 = idx#10
  call print
  to:main::@3
main::@3: scope:[main]  from main::@2
  idx#11 = phi( main::@2/idx#5 )
  idx#2 = idx#11
  to:main::@return
main::@return: scope:[main]  from main::@3
  idx#12 = phi( main::@3/idx#2 )
  idx#3 = idx#12
  return 
  to:@return

void print()
print: scope:[print]  from main main::@1 main::@2
  idx#13 = phi( main/idx#17, main::@1/idx#0, main::@2/idx#1 )
  SCREEN[idx#13] = '.'
  idx#4 = ++ idx#13
  to:print::@return
print::@return: scope:[print]  from print
  idx#14 = phi( print/idx#4 )
  idx#5 = idx#14
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  idx#6 = 0
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  idx#18 = phi( __start::__init1/idx#6 )
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  idx#15 = phi( __start::@1/idx#3 )
  idx#7 = idx#15
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  idx#16 = phi( __start::@2/idx#7 )
  idx#8 = idx#16
  return 
  to:@return

SYMBOL TABLE SSA
__constant char * const SCREEN = (char *)$400
void __start()
char idx
char idx#0
char idx#1
char idx#10
char idx#11
char idx#12
char idx#13
char idx#14
char idx#15
char idx#16
char idx#17
char idx#18
char idx#2
char idx#3
char idx#4
char idx#5
char idx#6
char idx#7
char idx#8
char idx#9
void main()
void print()

Simplifying constant pointer cast (char *) 1024
Successful SSA optimization PassNCastSimplification
Alias idx#0 = idx#9 
Alias idx#1 = idx#10 
Alias idx#11 = idx#2 idx#12 idx#3 
Alias idx#14 = idx#4 idx#5 
Alias idx#18 = idx#6 
Alias idx#15 = idx#7 idx#16 idx#8 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values idx#17 idx#18
Identical Phi Values idx#0 idx#14
Identical Phi Values idx#1 idx#14
Identical Phi Values idx#11 idx#14
Identical Phi Values idx#15 idx#11
Successful SSA optimization Pass2IdenticalPhiElimination
Constant idx#18 = 0
Successful SSA optimization Pass2ConstantIdentification
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
Inlining constant with var siblings idx#18
Constant inlined idx#18 = 0
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@3
CALL GRAPH
Calls in [main] to print:1 print:3 print:5 

Created 1 initial phi equivalence classes
Coalesced [2] idx#19 = idx#14
Coalesced (already) [4] idx#20 = idx#14
Coalesced down to 1 phi equivalence classes
Culled Empty Block label main::@3
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@2

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  [1] call print
  to:main::@1
main::@1: scope:[main]  from main
  [2] phi()
  [3] call print
  to:main::@2
main::@2: scope:[main]  from main::@1
  [4] phi()
  [5] call print
  to:main::@return
main::@return: scope:[main]  from main::@2
  [6] return 
  to:@return

void print()
print: scope:[print]  from main main::@1 main::@2
  [7] idx#13 = phi( main/0, main::@1/idx#14, main::@2/idx#14 )
  [8] SCREEN[idx#13] = '.'
  [9] idx#14 = ++ idx#13
  to:print::@return
print::@return: scope:[print]  from print
  [10] return 
  to:@return


VARIABLE REGISTER WEIGHTS
char idx
char idx#13 // 13.0
char idx#14 // 2.5
void main()
void print()

Initial phi equivalence classes
[ idx#13 idx#14 ]
Complete equivalence classes
[ idx#13 idx#14 ]
Allocated zp[1]:2 [ idx#13 idx#14 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [8] SCREEN[idx#13] = '.' [ idx#13 ] ( print:1 [ idx#13 ] { }  print:3 [ idx#13 ] { { idx#13 = idx#14 } }  print:5 [ idx#13 ] { { idx#13 = idx#14 } }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:2 [ idx#13 idx#14 ]
Statement [8] SCREEN[idx#13] = '.' [ idx#13 ] ( print:1 [ idx#13 ] { }  print:3 [ idx#13 ] { { idx#13 = idx#14 } }  print:5 [ idx#13 ] { { idx#13 = idx#14 } }  ) always clobbers reg byte a 
Potential registers zp[1]:2 [ idx#13 idx#14 ] : zp[1]:2 , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 15.5: zp[1]:2 [ idx#13 idx#14 ] 
Uplift Scope [main] 
Uplift Scope [print] 

Uplifting [] best 53 combination reg byte x [ idx#13 idx#14 ] 
Uplifting [main] best 53 combination 
Uplifting [print] best 53 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test that void-parameter works top specify function takes no parameters
// Output is "..." in the top left corner of the screen
  // Upstart
  // Commodore 64 PRG executable file
.file [name="void-parameter.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: {
    // [1] call print
    // [7] phi from main to print [phi:main->print]
  print_from_main:
    // [7] phi idx#13 = 0 [phi:main->print#0] -- vbuxx=vbuc1 
    ldx #0
    jsr print
    // [2] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    jmp __b1
    // main::@1
  __b1:
    // [3] call print
    // [7] phi from main::@1 to print [phi:main::@1->print]
  print_from___b1:
    // [7] phi idx#13 = idx#14 [phi:main::@1->print#0] -- register_copy 
    jsr print
    // [4] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    jmp __b2
    // main::@2
  __b2:
    // [5] call print
    // [7] phi from main::@2 to print [phi:main::@2->print]
  print_from___b2:
    // [7] phi idx#13 = idx#14 [phi:main::@2->print#0] -- register_copy 
    jsr print
    jmp __breturn
    // main::@return
  __breturn:
    // [6] return 
    rts
}
  // print
print: {
    // [8] SCREEN[idx#13] = '.' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #'.'
    sta SCREEN,x
    // [9] idx#14 = ++ idx#13 -- vbuxx=_inc_vbuxx 
    inx
    jmp __breturn
    // print::@return
  __breturn:
    // [10] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from_main:
Removing instruction print_from___b1:
Removing instruction __b2_from___b1:
Removing instruction print_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction print_from_main:
Removing instruction __b1:
Removing instruction __b2:
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant char * const SCREEN = (char *) 1024
char idx
char idx#13 // reg byte x 13.0
char idx#14 // reg byte x 2.5
void main()
void print()

reg byte x [ idx#13 idx#14 ]


FINAL ASSEMBLER
Score: 41

  // File Comments
// Test that void-parameter works top specify function takes no parameters
// Output is "..." in the top left corner of the screen
  // Upstart
  // Commodore 64 PRG executable file
.file [name="void-parameter.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: {
    // print()
    // [1] call print
    // [7] phi from main to print [phi:main->print]
    // [7] phi idx#13 = 0 [phi:main->print#0] -- vbuxx=vbuc1 
    ldx #0
    jsr print
    // [2] phi from main to main::@1 [phi:main->main::@1]
    // main::@1
    // print()
    // [3] call print
    // [7] phi from main::@1 to print [phi:main::@1->print]
    // [7] phi idx#13 = idx#14 [phi:main::@1->print#0] -- register_copy 
    jsr print
    // [4] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // main::@2
    // print()
    // [5] call print
    // [7] phi from main::@2 to print [phi:main::@2->print]
    // [7] phi idx#13 = idx#14 [phi:main::@2->print#0] -- register_copy 
    jsr print
    // main::@return
    // }
    // [6] return 
    rts
}
  // print
print: {
    // SCREEN[idx++] = '.'
    // [8] SCREEN[idx#13] = '.' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #'.'
    sta SCREEN,x
    // SCREEN[idx++] = '.';
    // [9] idx#14 = ++ idx#13 -- vbuxx=_inc_vbuxx 
    inx
    // print::@return
    // }
    // [10] return 
    rts
}
  // File Data

