
CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  *lda = main::jmp
  bne::jsr#0 = main::jmp
  call bne
  to:main::@1
main::@1: scope:[main]  from main
  asm { ldaa jmpa bnea a:  }
  to:main::@return
main::@return: scope:[main]  from main::@1
  return 
  to:@return

void bne(char jsr)
bne: scope:[bne]  from main
  bne::jsr#1 = phi( main/bne::jsr#0 )
  lda[1] = bne::jsr#1
  to:bne::@return
bne::@return: scope:[bne]  from bne
  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
void __start()
void bne(char jsr)
char bne::jsr
char bne::jsr#0
char bne::jsr#1
__constant char * const lda = (char *)$400
void main()
__constant char main::jmp = 1

Adding number conversion cast (unumber) 1 in lda[1] = bne::jsr#1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Identical Phi Values bne::jsr#1 bne::jsr#0
Successful SSA optimization Pass2IdenticalPhiElimination
Constant bne::jsr#0 = main::jmp
Successful SSA optimization Pass2ConstantIdentification
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
Constant inlined bne::jsr#0 = main::jmp
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(lda+1)
Successful SSA optimization Pass2ConstantAdditionElimination
CALL GRAPH
Calls in [main] to bne:1 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] *lda = main::jmp
  [1] call bne
  to:main::@1
main::@1: scope:[main]  from main
  asm { ldaa jmpa bnea a:  }
  to:main::@return
main::@return: scope:[main]  from main::@1
  [3] return 
  to:@return

void bne(char jsr)
bne: scope:[bne]  from main
  [4] *(lda+1) = main::jmp
  to:bne::@return
bne::@return: scope:[bne]  from bne
  [5] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void bne(char jsr)
char bne::jsr
void main()

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *lda = main::jmp [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement asm { ldaa jmpa bnea a:  } always clobbers reg byte a 
Statement [4] *(lda+1) = main::jmp [ ] ( bne:1 [ ] { }  ) always clobbers reg byte a 

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

Uplifting [main] best 48 combination 
Uplifting [bne] best 48 combination 
Uplifting [] best 48 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test using an ASM mnemonic as a C symbol names
// Works if the C-lexer and the ASM-lexer are separated properly
  // Upstart
  // Commodore 64 PRG executable file
.file [name="asm-mnemonic-names.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 lda = $400
.segment Code
  // main
main: {
    .label jmp = 1
    // [0] *lda = main::jmp -- _deref_pbuc1=vbuc2 
    lda #jmp
    sta lda
    // [1] call bne
    jsr bne
    jmp __b1
    // main::@1
  __b1:
    // asm { ldaa jmpa bnea a:  }
    // Inline asm using the mnemonics
    lda a
    jmp a
    bne a
  a:
    jmp __breturn
    // main::@return
  __breturn:
    // [3] return 
    rts
}
  // bne
// void bne(char jsr)
bne: {
    // [4] *(lda+1) = main::jmp -- _deref_pbuc1=vbuc2 
    lda #main.jmp
    sta lda+1
    jmp __breturn
    // bne::@return
  __breturn:
    // [5] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction bne a
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Replacing jump to rts with rts in jmp a
Succesful ASM optimization Pass5DoubleJumpElimination

FINAL SYMBOL TABLE
void bne(char jsr)
char bne::jsr
__constant char * const lda = (char *) 1024
void main()
__constant char main::jmp = 1



FINAL ASSEMBLER
Score: 40

  // File Comments
// Test using an ASM mnemonic as a C symbol names
// Works if the C-lexer and the ASM-lexer are separated properly
  // Upstart
  // Commodore 64 PRG executable file
.file [name="asm-mnemonic-names.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 lda = $400
.segment Code
  // main
main: {
    .label jmp = 1
    // *lda = jmp
    // [0] *lda = main::jmp -- _deref_pbuc1=vbuc2 
    lda #jmp
    sta lda
    // bne(jmp)
    // [1] call bne
    jsr bne
    // main::@1
    // asm
    // asm { ldaa jmpa bnea a:  }
    // Inline asm using the mnemonics
    lda a
    rts
  a:
    // main::@return
    // }
    // [3] return 
    rts
}
  // bne
// void bne(char jsr)
bne: {
    // lda[1] = jsr
    // [4] *(lda+1) = main::jmp -- _deref_pbuc1=vbuc2 
    lda #main.jmp
    sta lda+1
    // bne::@return
    // }
    // [5] return 
    rts
}
  // File Data

