1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-23 13:31:12 +00:00

Variables used in ASM is now automatically converted to volatile if not const. Beware that char * const var; and char * volatile var; do behave quite differently when used in ASM Closes #554

This commit is contained in:
jespergravgaard 2020-11-01 22:42:09 +01:00
parent 6bec9849b6
commit c920c360a1
55 changed files with 19738 additions and 1202 deletions

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 107d6cfa86 107d6d178e
//KICKC FRAGMENT CACHE 10dedb3bb9 10dedb58e1
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 107d6cfa86 107d6d178e
//KICKC FRAGMENT CACHE 10dedb3bb9 10dedb58e1
//FRAGMENT _deref_pbuc1=vbuc2
lda #{c2}
sta {c1}

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 107d6cfa86 107d6d178e
//KICKC FRAGMENT CACHE 10dedb3bb9 10dedb58e1
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 107d6cfa86 107d6d178e
//KICKC FRAGMENT CACHE 10dedb3bb9 10dedb58e1
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}

View File

@ -276,7 +276,7 @@ public class Compiler {
new PassNAddTypeConversionAssignment(program, true).execute();
new Pass1EarlyConstantIdentification(program).execute();
// new Pass1AsmUsesHandling(program).execute();
new Pass1AsmUsesHandling(program).execute();
new PassNAssertConstantModification(program).execute();
new PassNAssertTypeDeref(program).check();

View File

@ -3335,8 +3335,8 @@ public class TestPrograms {
}
@Test
public void testInlineAsmRefoutIllegal() throws IOException, URISyntaxException {
assertError("inline-asm-refout-illegal.c", "Inline ASM reference is not constant");
public void testInlineAsmRefout() throws IOException, URISyntaxException {
compileAndCompare("inline-asm-refout-illegal.c");
}
@Test
@ -3388,8 +3388,8 @@ public class TestPrograms {
}
@Test
public void testInlineAsmRefout() throws IOException, URISyntaxException {
compileAndCompare("inline-asm-refout.c");
public void testInlineAsmRefoutVar() throws IOException, URISyntaxException {
compileAndCompare("inline-asm-refout-var.c");
}
@Test

View File

@ -22,11 +22,11 @@ void fn2() {
*r = 2;
}
void enableDLI(__ma void *dliptr) {
void enableDLI(void *dliptr) {
asm {
lda #<dliptr
lda dliptr
sta dlivec
lda #>dliptr
lda dliptr+1
sta dlivec+1
jmp !+

View File

@ -11,11 +11,11 @@ void fn1() {
*r = 1;
}
void enableDLI(__ma void *dliptr) {
void enableDLI(void *dliptr) {
asm {
lda #<dliptr
lda dliptr
sta dlivec
lda #>dliptr
lda dliptr+1
sta dlivec+1
jmp !+

View File

@ -1,9 +1,9 @@
// Illustrates how inline assembler referencing variables is illegal
// Illustrates how inline assembler referencing variables is automatically converted to __ma
byte* const SCREEN = $400;
void main() {
for( __ssa byte i: 0..10) {
for(byte i: 0..10) {
asm {
lda #'a'
ldx i

View File

@ -21,9 +21,9 @@ void main() {
// foo(b, a);
}
void foo(__mem uint8_t *x1, uint8_t *x2) {
__ma volatile uint8_t * v1;
__ma uint8_t * v2;
void foo(uint8_t *x1, uint8_t *x2) {
volatile uint8_t * v1;
uint8_t * v2;
uint8_t a1 = 1;
uint8_t a2 = 2;
v1 = x1;

View File

@ -31,7 +31,7 @@ main::@return: scope:[main] from main::@2
[11] return
to:@return
void print(byte print::ch)
void print(volatile byte print::ch)
print: scope:[print] from main main::@1 main::@2
asm { ldxidx ldach staSCREEN,x incidx }
to:print::@return

View File

@ -1,3 +1,4 @@
Setting inferred volatile on symbol affected by address-of: print::ch in asm { ldxidx ldach staSCREEN,x incidx }
Inlined call call __init
CONTROL FLOW GRAPH SSA
@ -21,7 +22,7 @@ main::@return: scope:[main] from main::@3
return
to:@return
void print(byte print::ch)
void print(volatile byte print::ch)
print: scope:[print] from main main::@1 main::@2
asm { ldxidx ldach staSCREEN,x incidx }
to:print::@return
@ -49,8 +50,8 @@ const nomodify byte* SCREEN = (byte*)$400
void __start()
volatile byte idx loadstore !zp[-1]:3
void main()
void print(byte print::ch)
byte print::ch loadstore !zp[-1]:2
void print(volatile byte print::ch)
volatile byte print::ch loadstore !zp[-1]:2
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
@ -103,7 +104,7 @@ main::@return: scope:[main] from main::@2
[11] return
to:@return
void print(byte print::ch)
void print(volatile byte print::ch)
print: scope:[print] from main main::@1 main::@2
asm { ldxidx ldach staSCREEN,x incidx }
to:print::@return
@ -116,8 +117,8 @@ VARIABLE REGISTER WEIGHTS
void __start()
volatile byte idx loadstore !zp[-1]:3 0.2222222222222222
void main()
void print(byte print::ch)
byte print::ch loadstore !zp[-1]:2 11.0
void print(volatile byte print::ch)
volatile byte print::ch loadstore !zp[-1]:2 11.0
Initial phi equivalence classes
Added variable idx to live range equivalence class [ idx ]
@ -252,8 +253,8 @@ const nomodify byte* SCREEN = (byte*) 1024
void __start()
volatile byte idx loadstore !zp[-1]:3 zp[1]:3 0.2222222222222222
void main()
void print(byte print::ch)
byte print::ch loadstore !zp[-1]:2 zp[1]:2 11.0
void print(volatile byte print::ch)
volatile byte print::ch loadstore !zp[-1]:2 zp[1]:2 11.0
zp[1]:3 [ idx ]
zp[1]:2 [ print::ch ]

View File

@ -2,8 +2,8 @@ const nomodify byte* SCREEN = (byte*) 1024
void __start()
volatile byte idx loadstore !zp[-1]:3 zp[1]:3 0.2222222222222222
void main()
void print(byte print::ch)
byte print::ch loadstore !zp[-1]:2 zp[1]:2 11.0
void print(volatile byte print::ch)
volatile byte print::ch loadstore !zp[-1]:2 zp[1]:2 11.0
zp[1]:3 [ idx ]
zp[1]:2 [ print::ch ]

View File

@ -31,7 +31,7 @@ main::@return: scope:[main] from main::@2
[11] return
to:@return
void print(byte print::ch)
void print(volatile byte print::ch)
print: scope:[print] from main main::@1 main::@2
asm { ldxidx ldach staSCREEN,x incidx }
to:print::@return

View File

@ -1,3 +1,4 @@
Setting inferred volatile on symbol affected by address-of: print::ch in asm { ldxidx ldach staSCREEN,x incidx }
Inlined call call __init
CONTROL FLOW GRAPH SSA
@ -21,7 +22,7 @@ main::@return: scope:[main] from main::@3
return
to:@return
void print(byte print::ch)
void print(volatile byte print::ch)
print: scope:[print] from main main::@1 main::@2
asm { ldxidx ldach staSCREEN,x incidx }
to:print::@return
@ -49,8 +50,8 @@ const nomodify byte* SCREEN = (byte*)$400
void __start()
volatile byte idx loadstore !mem[-1]:12288
void main()
void print(byte print::ch)
byte print::ch loadstore !mem[-1]:12289
void print(volatile byte print::ch)
volatile byte print::ch loadstore !mem[-1]:12289
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
@ -103,7 +104,7 @@ main::@return: scope:[main] from main::@2
[11] return
to:@return
void print(byte print::ch)
void print(volatile byte print::ch)
print: scope:[print] from main main::@1 main::@2
asm { ldxidx ldach staSCREEN,x incidx }
to:print::@return
@ -116,8 +117,8 @@ VARIABLE REGISTER WEIGHTS
void __start()
volatile byte idx loadstore !mem[-1]:12288 0.2222222222222222
void main()
void print(byte print::ch)
byte print::ch loadstore !mem[-1]:12289 11.0
void print(volatile byte print::ch)
volatile byte print::ch loadstore !mem[-1]:12289 11.0
Initial phi equivalence classes
Added variable idx to live range equivalence class [ idx ]
@ -252,8 +253,8 @@ const nomodify byte* SCREEN = (byte*) 1024
void __start()
volatile byte idx loadstore !mem[-1]:12288 mem[1]:12288 0.2222222222222222
void main()
void print(byte print::ch)
byte print::ch loadstore !mem[-1]:12289 mem[1]:12289 11.0
void print(volatile byte print::ch)
volatile byte print::ch loadstore !mem[-1]:12289 mem[1]:12289 11.0
mem[1]:12288 [ idx ]
mem[1]:12289 [ print::ch ]

View File

@ -2,8 +2,8 @@ const nomodify byte* SCREEN = (byte*) 1024
void __start()
volatile byte idx loadstore !mem[-1]:12288 mem[1]:12288 0.2222222222222222
void main()
void print(byte print::ch)
byte print::ch loadstore !mem[-1]:12289 mem[1]:12289 11.0
void print(volatile byte print::ch)
volatile byte print::ch loadstore !mem[-1]:12289 mem[1]:12289 11.0
mem[1]:12288 [ idx ]
mem[1]:12289 [ print::ch ]

View File

@ -1116,10 +1116,10 @@ cputc: {
// Allocates memory and returns a pointer to it. Sets allocated memory to zero.
// - nitems This is the number of elements to be allocated.
// - size This is the size of elements.
// calloc(word zp($5a) nitems)
// calloc(word zp($5d) nitems)
calloc: {
.label return = $36
.label nitems = $5a
.label nitems = $5d
// malloc(nitems*size)
lda.z nitems
sta.z malloc.size
@ -1137,12 +1137,12 @@ calloc: {
}
// Copy block of memory (forwards)
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// memcpy(void* zp($5a) destination, byte* zp($2c) source, word zp(2) num)
// memcpy(void* zp($5d) destination, byte* zp($2c) source, word zp(2) num)
memcpy: {
.label src_end = $57
.label dst = $5a
.label src_end = $5a
.label dst = $5d
.label src = $2c
.label destination = $5a
.label destination = $5d
.label source = $2c
.label num = 2
// src_end = (char*)source+num
@ -1312,6 +1312,8 @@ leftRotate: {
sta.z rotateLeft.p
lda #>p
sta.z rotateLeft.p+1
lda.z r
sta.z rotateLeft.r
jsr rotateLeft
jmp __b5
}
@ -1371,7 +1373,7 @@ mod16: {
mul3: {
.label __1 = $2c
.label return = $2c
.label __2 = $5a
.label __2 = $5d
// ((uint16_t) a) * 3
sta.z __1
lda #0
@ -1396,7 +1398,7 @@ mul3: {
mul5: {
.label __1 = $2c
.label return = $2c
.label __2 = $57
.label __2 = $5d
// ((uint16_t) a) * 5
sta.z __1
lda #0
@ -1421,7 +1423,7 @@ mul5: {
}
// Puts a character to the screen a the current location. Uses internal screencode. Deals with storing the old cursor value
putchar: {
.label loc = $57
.label loc = $5a
// **OLDADR = *OLDCHR
lda OLDCHR
ldy OLDADR
@ -1447,7 +1449,7 @@ putchar: {
}
// Handles cursor movement, displaying it if required, and inverting character it is over if there is one (and enabled)
setcursor: {
.label loc = $57
.label loc = $5a
// **OLDADR = *OLDCHR
// save the current oldchr into oldadr
lda OLDCHR
@ -1570,12 +1572,12 @@ malloc: {
rts
}
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zp($2e) str, word zp($5a) num)
// memset(void* zp($2e) str, word zp($5d) num)
memset: {
.label end = $5a
.label end = $5d
.label dst = $2e
.label str = $2e
.label num = $5a
.label num = $5d
// if(num>0)
lda.z num
bne !+
@ -1620,7 +1622,7 @@ memset: {
// - radix : The radix to convert the number to (from the enum RADIX)
// uctoa(byte register(X) value, byte* zp($2e) buffer)
uctoa: {
.label digit_value = $59
.label digit_value = $5c
.label buffer = $2e
.label digit = $30
.label started = $31
@ -1785,10 +1787,10 @@ move16Left: {
// }
rts
}
// rotateLeft(byte* zp($57) p, byte zp($49) r)
// rotateLeft(byte* zp($57) p, byte zp($59) r)
rotateLeft: {
.label p = $57
.label r = $49
.label r = $59
// kickasm
ldx #r
!s:
@ -1825,12 +1827,12 @@ move8Left: {
}
// Return a pointer to the location of the cursor
cursorLocation: {
.label __0 = $57
.label __1 = $57
.label __3 = $57
.label return = $57
.label __4 = $5a
.label __5 = $57
.label __0 = $5a
.label __1 = $5a
.label __3 = $5a
.label return = $5a
.label __4 = $5d
.label __5 = $5a
// (word)(*ROWCRS)*CONIO_WIDTH
lda ROWCRS
sta.z __3
@ -1884,10 +1886,10 @@ cursorLocation: {
// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased.
// (For decimal the subs used are 10000, 1000, 100, 10, 1)
// returns : the value reduced by sub * digit so that it is less than sub.
// uctoa_append(byte* zp($2e) buffer, byte register(X) value, byte zp($59) sub)
// uctoa_append(byte* zp($2e) buffer, byte register(X) value, byte zp($5c) sub)
uctoa_append: {
.label buffer = $2e
.label sub = $59
.label sub = $5c
ldy #0
__b1:
// while (value >= sub)
@ -1910,11 +1912,11 @@ uctoa_append: {
jmp __b1
}
// Print a padding char a number of times
// printf_padding(byte zp($59) pad, byte zp($31) length)
// printf_padding(byte zp($5c) pad, byte zp($31) length)
printf_padding: {
.label i = $32
.label length = $31
.label pad = $59
.label pad = $5c
lda #0
sta.z i
__b1:

View File

@ -780,7 +780,7 @@ move16Left::@return: scope:[move16Left] from move16Left
[373] return
to:@return
void rotateLeft(byte* rotateLeft::p , byte rotateLeft::r)
void rotateLeft(volatile byte* rotateLeft::p , volatile byte rotateLeft::r)
rotateLeft: scope:[rotateLeft] from leftRotate::@1 leftRotate::@10 leftRotate::@11
kickasm( uses rotateLeft::p uses rotateLeft::r) {{ ldx #r
!s:

View File

@ -20,6 +20,32 @@ Added struct type cast to parameter value list call printf_uchar print32::dp[3]
Added struct type cast to parameter value list call printf_uchar md5::i (struct printf_format_number){ 2, 0, 0, 0, 0, HEXADECIMAL }
Added struct type cast to parameter value list call printf_uchar md5::g (struct printf_format_number){ 2, 0, 0, 0, 0, HEXADECIMAL }
Added struct type cast to parameter value list call printf_uchar md5::r[md5::i] (struct printf_format_number){ 2, 0, 0, 0, 0, HEXADECIMAL }
Setting inferred volatile on symbol affected by address-of: rotateLeft::p in kickasm( uses rotateLeft::p uses rotateLeft::r) {{ ldx #r
!s:
asl p+3
rol p+2
rol p+1
rol p
bcc !+
lda p+3
adc #0
!:
dex
bne !s-
}}
Setting inferred volatile on symbol affected by address-of: rotateLeft::r in kickasm( uses rotateLeft::p uses rotateLeft::r) {{ ldx #r
!s:
asl p+3
rol p+2
rol p+1
rol p
bcc !+
lda p+3
adc #0
!:
dex
bne !s-
}}
Inlined call cputc::$4 = call convertToScreenCode &cputc::c
Inlined call call BREAK
Inlined call call BREAK
@ -1198,7 +1224,7 @@ move16Left::@return: scope:[move16Left] from move16Left
return
to:@return
void rotateLeft(byte* rotateLeft::p , byte rotateLeft::r)
void rotateLeft(volatile byte* rotateLeft::p , volatile byte rotateLeft::r)
rotateLeft: scope:[rotateLeft] from leftRotate::@1 leftRotate::@12 leftRotate::@15
kickasm( uses rotateLeft::p uses rotateLeft::r) {{ ldx #r
!s:
@ -4344,9 +4370,9 @@ const byte* rawmap[$100] = kickasm {{ .var ht = Hashtable().put(0,64, 1,0, 2,32
.byte mask | ht.get(idx)
}
}}
void rotateLeft(byte* rotateLeft::p , byte rotateLeft::r)
byte* rotateLeft::p loadstore
byte rotateLeft::r loadstore
void rotateLeft(volatile byte* rotateLeft::p , volatile byte rotateLeft::r)
volatile byte* rotateLeft::p loadstore
volatile byte rotateLeft::r loadstore
void setcursor()
byte*~ setcursor::$0
bool~ setcursor::$1
@ -7130,7 +7156,7 @@ move16Left::@return: scope:[move16Left] from move16Left
[373] return
to:@return
void rotateLeft(byte* rotateLeft::p , byte rotateLeft::r)
void rotateLeft(volatile byte* rotateLeft::p , volatile byte rotateLeft::r)
rotateLeft: scope:[rotateLeft] from leftRotate::@1 leftRotate::@10 leftRotate::@11
kickasm( uses rotateLeft::p uses rotateLeft::r) {{ ldx #r
!s:
@ -7710,9 +7736,9 @@ byte* putchar::loc
byte* putchar::loc#0 1.000000000001E12
byte putchar::newChar
byte putchar::newChar#0 1.5000000000015E12
void rotateLeft(byte* rotateLeft::p , byte rotateLeft::r)
byte* rotateLeft::p loadstore 5000.5
byte rotateLeft::r loadstore 10001.0
void rotateLeft(volatile byte* rotateLeft::p , volatile byte rotateLeft::r)
volatile byte* rotateLeft::p loadstore 5000.5
volatile byte rotateLeft::r loadstore 10001.0
void setcursor()
byte setcursor::c
byte setcursor::c#0 7.50000000000075E12
@ -8885,7 +8911,6 @@ Coalescing zero page register [ zp[2]:90 [ md5::$2 ] ] with [ zp[2]:92 [ md5::$3
Coalescing zero page register [ zp[2]:98 [ calloc::return#2 ] ] with [ zp[2]:100 [ md5::msg#1 ] ] - score: 1
Coalescing zero page register [ zp[2]:98 [ calloc::return#2 md5::msg#1 ] ] with [ zp[2]:206 [ calloc::return#0 ] ] - score: 1
Coalescing zero page register [ zp[4]:126 [ md5::$66 ] ] with [ zp[4]:130 [ md5::$67 ] ] - score: 1
Coalescing zero page register [ zp[1]:138 [ leftRotate::r#0 ] ] with [ zp[1]:215 [ rotateLeft::r ] ] - score: 1
Coalescing zero page register [ zp[4]:139 [ leftRotate::return#2 ] ] with [ zp[4]:143 [ md5::lr#0 ] ] - score: 1
Coalescing zero page register [ zp[4]:139 [ leftRotate::return#2 md5::lr#0 ] ] with [ zp[4]:216 [ leftRotate::return#0 ] ] - score: 1
Coalescing zero page register [ zp[2]:168 [ mul3::return#2 ] ] with [ zp[2]:238 [ mul3::return#0 ] ] - score: 1
@ -8926,15 +8951,14 @@ Coalescing zero page register [ zp[2]:62 [ memset::num#2 memset::num#0 calloc::n
Coalescing zero page register [ zp[2]:71 [ uctoa::buffer#11 uctoa::buffer#14 uctoa::buffer#4 uctoa::buffer#3 uctoa_append::buffer#0 ] ] with [ zp[2]:64 [ memset::str#3 memset::str#0 memset::str#8 memset::dst#2 memset::dst#4 memset::dst#1 memset::str#1 newline::start#0 ] ]
Coalescing zero page register [ zp[1]:74 [ printf_number_buffer::padding#10 printf_number_buffer::padding#1 ] ] with [ zp[1]:68 [ uctoa::digit#2 uctoa::digit#1 ] ]
Coalescing zero page register [ zp[1]:77 [ printf_padding::length#4 printf_padding::length#1 printf_padding::length#0 ] ] with [ zp[1]:70 [ uctoa::started#2 uctoa::started#4 ] ]
Coalescing zero page register [ zp[1]:138 [ leftRotate::r#0 rotateLeft::r ] ] with [ zp[1]:59 [ printf_uchar::format_zero_padding#10 printf_number_buffer::format_zero_padding#0 ] ]
Coalescing zero page register [ zp[2]:213 [ rotateLeft::p ] ] with [ zp[2]:208 [ memcpy::src_end#0 ] ]
Coalescing zero page register [ zp[2]:236 [ mul3::$2 ] ] with [ zp[2]:223 [ mul7::$2 mul7::$3 mul7::$4 ] ]
Coalescing zero page register [ zp[2]:246 [ cursorLocation::return#0 putchar::loc#0 cursorLocation::return#1 cursorLocation::return#3 setcursor::loc#0 cursorLocation::$0 cursorLocation::$1 cursorLocation::$3 cursorLocation::$5 ] ] with [ zp[2]:242 [ mul5::$2 ] ]
Coalescing zero page register [ zp[1]:138 [ leftRotate::r#0 ] ] with [ zp[1]:59 [ printf_uchar::format_zero_padding#10 printf_number_buffer::format_zero_padding#0 ] ]
Coalescing zero page register [ zp[2]:223 [ mul7::$2 mul7::$3 mul7::$4 ] ] with [ zp[2]:208 [ memcpy::src_end#0 ] ]
Coalescing zero page register [ zp[2]:242 [ mul5::$2 ] ] with [ zp[2]:236 [ mul3::$2 ] ]
Coalescing zero page register [ zp[1]:269 [ uctoa::digit_value#0 uctoa_append::sub#0 ] ] with [ zp[1]:78 [ printf_padding::pad#5 ] ]
Coalescing zero page register [ zp[2]:102 [ md5::$74 ] ] with [ zp[2]:4 [ strlen::str#3 strlen::str#5 strlen::str#0 cputs::s#10 cputs::s#11 cputs::s#0 ] ]
Coalescing zero page register [ zp[2]:236 [ mul3::$2 mul7::$2 mul7::$3 mul7::$4 ] ] with [ zp[2]:62 [ memset::num#2 memset::num#0 calloc::nitems#0 memset::end#0 memcpy::destination#3 memcpy::destination#7 memcpy::destination#8 memcpy::destination#0 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 memcpy::destination#2 ] ]
Coalescing zero page register [ zp[2]:246 [ cursorLocation::return#0 putchar::loc#0 cursorLocation::return#1 cursorLocation::return#3 setcursor::loc#0 cursorLocation::$0 cursorLocation::$1 cursorLocation::$3 cursorLocation::$5 mul5::$2 ] ] with [ zp[2]:213 [ rotateLeft::p memcpy::src_end#0 ] ]
Coalescing zero page register [ zp[2]:283 [ cursorLocation::$4 ] ] with [ zp[2]:236 [ mul3::$2 mul7::$2 mul7::$3 mul7::$4 memset::num#2 memset::num#0 calloc::nitems#0 memset::end#0 memcpy::destination#3 memcpy::destination#7 memcpy::destination#8 memcpy::destination#0 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 memcpy::destination#2 ] ]
Coalescing zero page register [ zp[2]:242 [ mul5::$2 mul3::$2 ] ] with [ zp[2]:62 [ memset::num#2 memset::num#0 calloc::nitems#0 memset::end#0 memcpy::destination#3 memcpy::destination#7 memcpy::destination#8 memcpy::destination#0 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 memcpy::destination#2 ] ]
Coalescing zero page register [ zp[2]:246 [ cursorLocation::return#0 putchar::loc#0 cursorLocation::return#1 cursorLocation::return#3 setcursor::loc#0 cursorLocation::$0 cursorLocation::$1 cursorLocation::$3 cursorLocation::$5 ] ] with [ zp[2]:223 [ mul7::$2 mul7::$3 mul7::$4 memcpy::src_end#0 ] ]
Coalescing zero page register [ zp[2]:283 [ cursorLocation::$4 ] ] with [ zp[2]:242 [ mul5::$2 mul3::$2 memset::num#2 memset::num#0 calloc::nitems#0 memset::end#0 memcpy::destination#3 memcpy::destination#7 memcpy::destination#8 memcpy::destination#0 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 memcpy::destination#2 ] ]
Allocated (was zp[2]:6) zp[2]:2 [ strlen::len#2 strlen::len#1 strlen::return#3 strlen::return#2 memcpy::num#3 memcpy::num#1 md5::initial_len#0 printf_number_buffer::$19 md5::$8 ]
Allocated (was zp[2]:8) zp[2]:4 [ md5::offset#2 md5::offset#1 ]
Allocated (was zp[4]:10) zp[4]:6 [ h0#10 h0#3 ]
@ -8962,14 +8986,16 @@ Allocated (was zp[2]:112) zp[2]:62 [ md5::w#0 ]
Allocated (was zp[4]:114) zp[4]:64 [ print32::l ]
Allocated (was zp[1]:121) zp[1]:68 [ md5::$72 ]
Allocated (was zp[4]:134) zp[4]:69 [ leftRotate::a ]
Allocated (was zp[1]:138) zp[1]:73 [ leftRotate::r#0 rotateLeft::r printf_uchar::format_zero_padding#10 printf_number_buffer::format_zero_padding#0 ]
Allocated (was zp[1]:138) zp[1]:73 [ leftRotate::r#0 printf_uchar::format_zero_padding#10 printf_number_buffer::format_zero_padding#0 ]
Allocated (was zp[4]:139) zp[4]:74 [ leftRotate::return#2 md5::lr#0 leftRotate::return#0 md5::b#1 ]
Allocated (was zp[4]:177) zp[4]:78 [ md5::$31 md5::$32 ]
Allocated (was zp[4]:195) zp[4]:82 [ md5::$27 md5::$28 ]
Allocated (was zp[1]:210) zp[1]:86 [ printf_number_buffer::buffer_sign#0 ]
Allocated (was zp[2]:246) zp[2]:87 [ cursorLocation::return#0 putchar::loc#0 cursorLocation::return#1 cursorLocation::return#3 setcursor::loc#0 cursorLocation::$0 cursorLocation::$1 cursorLocation::$3 cursorLocation::$5 mul5::$2 rotateLeft::p memcpy::src_end#0 ]
Allocated (was zp[1]:269) zp[1]:89 [ uctoa::digit_value#0 uctoa_append::sub#0 printf_padding::pad#5 ]
Allocated (was zp[2]:283) zp[2]:90 [ cursorLocation::$4 mul3::$2 mul7::$2 mul7::$3 mul7::$4 memset::num#2 memset::num#0 calloc::nitems#0 memset::end#0 memcpy::destination#3 memcpy::destination#7 memcpy::destination#8 memcpy::destination#0 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 memcpy::destination#2 ]
Allocated (was zp[2]:213) zp[2]:87 [ rotateLeft::p ]
Allocated (was zp[1]:215) zp[1]:89 [ rotateLeft::r ]
Allocated (was zp[2]:246) zp[2]:90 [ cursorLocation::return#0 putchar::loc#0 cursorLocation::return#1 cursorLocation::return#3 setcursor::loc#0 cursorLocation::$0 cursorLocation::$1 cursorLocation::$3 cursorLocation::$5 mul7::$2 mul7::$3 mul7::$4 memcpy::src_end#0 ]
Allocated (was zp[1]:269) zp[1]:92 [ uctoa::digit_value#0 uctoa_append::sub#0 printf_padding::pad#5 ]
Allocated (was zp[2]:283) zp[2]:93 [ cursorLocation::$4 mul5::$2 mul3::$2 memset::num#2 memset::num#0 calloc::nitems#0 memset::end#0 memcpy::destination#3 memcpy::destination#7 memcpy::destination#8 memcpy::destination#0 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 memcpy::destination#2 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -10473,10 +10499,10 @@ cputc: {
// Allocates memory and returns a pointer to it. Sets allocated memory to zero.
// - nitems This is the number of elements to be allocated.
// - size This is the size of elements.
// calloc(word zp($5a) nitems)
// calloc(word zp($5d) nitems)
calloc: {
.label return = $36
.label nitems = $5a
.label nitems = $5d
// [195] malloc::size#0 = calloc::nitems#0 -- vwuz1=vwuz2
lda.z nitems
sta.z malloc.size
@ -10509,12 +10535,12 @@ calloc: {
// memcpy
// Copy block of memory (forwards)
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// memcpy(void* zp($5a) destination, byte* zp($2c) source, word zp(2) num)
// memcpy(void* zp($5d) destination, byte* zp($2c) source, word zp(2) num)
memcpy: {
.label src_end = $57
.label dst = $5a
.label src_end = $5a
.label dst = $5d
.label src = $2c
.label destination = $5a
.label destination = $5d
.label source = $2c
.label num = 2
// [203] memcpy::src_end#0 = (byte*)memcpy::source#3 + memcpy::num#3 -- pbuz1=pbuz2_plus_vwuz3
@ -10797,7 +10823,9 @@ leftRotate: {
sta.z rotateLeft.p
lda #>p
sta.z rotateLeft.p+1
// [255] rotateLeft::r = leftRotate::r#0
// [255] rotateLeft::r = leftRotate::r#0 -- vbuz1=vbuz2
lda.z r
sta.z rotateLeft.r
// [256] call rotateLeft
jsr rotateLeft
jmp __b5
@ -10871,7 +10899,7 @@ mod16: {
mul3: {
.label __1 = $2c
.label return = $2c
.label __2 = $5a
.label __2 = $5d
// [267] mul3::$1 = (word)mul3::a#0 -- vwuz1=_word_vbuaa
sta.z __1
lda #0
@ -10902,7 +10930,7 @@ mul3: {
mul5: {
.label __1 = $2c
.label return = $2c
.label __2 = $57
.label __2 = $5d
// [271] mul5::$1 = (word)mul5::a#0 -- vwuz1=_word_vbuaa
sta.z __1
lda #0
@ -10933,7 +10961,7 @@ mul5: {
// putchar
// Puts a character to the screen a the current location. Uses internal screencode. Deals with storing the old cursor value
putchar: {
.label loc = $57
.label loc = $5a
// [275] *(*OLDADR) = *OLDCHR -- _deref_(_deref_qbuc1)=_deref_pbuc2
lda OLDCHR
ldy OLDADR
@ -10967,7 +10995,7 @@ putchar: {
// setcursor
// Handles cursor movement, displaying it if required, and inverting character it is over if there is one (and enabled)
setcursor: {
.label loc = $57
.label loc = $5a
// [284] *(*OLDADR) = *OLDCHR -- _deref_(_deref_qbuc1)=_deref_pbuc2
// save the current oldchr into oldadr
lda OLDCHR
@ -11141,12 +11169,12 @@ malloc: {
}
// memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zp($2e) str, word zp($5a) num)
// memset(void* zp($2e) str, word zp($5d) num)
memset: {
.label end = $5a
.label end = $5d
.label dst = $2e
.label str = $2e
.label num = $5a
.label num = $5d
// [313] if(memset::num#2<=0) goto memset::@return -- vwuz1_le_0_then_la1
lda.z num
bne !+
@ -11205,7 +11233,7 @@ memset: {
// - radix : The radix to convert the number to (from the enum RADIX)
// uctoa(byte register(X) value, byte* zp($2e) buffer)
uctoa: {
.label digit_value = $59
.label digit_value = $5c
.label buffer = $2e
.label digit = $30
.label started = $31
@ -11504,10 +11532,10 @@ move16Left: {
rts
}
// rotateLeft
// rotateLeft(byte* zp($57) p, byte zp($49) r)
// rotateLeft(byte* zp($57) p, byte zp($59) r)
rotateLeft: {
.label p = $57
.label r = $49
.label r = $59
// kickasm( uses rotateLeft::p uses rotateLeft::r) {{ ldx #r !s: asl p+3 rol p+2 rol p+1 rol p bcc !+ lda p+3 adc #0 !: dex bne !s- }}
ldx #r
!s:
@ -11552,12 +11580,12 @@ move8Left: {
// cursorLocation
// Return a pointer to the location of the cursor
cursorLocation: {
.label __0 = $57
.label __1 = $57
.label __3 = $57
.label return = $57
.label __4 = $5a
.label __5 = $57
.label __0 = $5a
.label __1 = $5a
.label __3 = $5a
.label return = $5a
.label __4 = $5d
.label __5 = $5a
// [382] cursorLocation::$3 = (word)*ROWCRS -- vwuz1=_word__deref_pbuc1
lda ROWCRS
sta.z __3
@ -11618,10 +11646,10 @@ cursorLocation: {
// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased.
// (For decimal the subs used are 10000, 1000, 100, 10, 1)
// returns : the value reduced by sub * digit so that it is less than sub.
// uctoa_append(byte* zp($2e) buffer, byte register(X) value, byte zp($59) sub)
// uctoa_append(byte* zp($2e) buffer, byte register(X) value, byte zp($5c) sub)
uctoa_append: {
.label buffer = $2e
.label sub = $59
.label sub = $5c
// [390] phi from uctoa_append to uctoa_append::@1 [phi:uctoa_append->uctoa_append::@1]
__b1_from_uctoa_append:
// [390] phi uctoa_append::digit#2 = 0 [phi:uctoa_append->uctoa_append::@1#0] -- vbuyy=vbuc1
@ -11662,11 +11690,11 @@ uctoa_append: {
}
// printf_padding
// Print a padding char a number of times
// printf_padding(byte zp($59) pad, byte zp($31) length)
// printf_padding(byte zp($5c) pad, byte zp($31) length)
printf_padding: {
.label i = $32
.label length = $31
.label pad = $59
.label pad = $5c
// [397] phi from printf_padding to printf_padding::@1 [phi:printf_padding->printf_padding::@1]
__b1_from_printf_padding:
// [397] phi printf_padding::i#2 = 0 [phi:printf_padding->printf_padding::@1#0] -- vbuz1=vbuc1
@ -12136,7 +12164,7 @@ const byte SIZEOF_STRUCT_PRINTF_BUFFER_NUMBER = $c
void* calloc(word calloc::nitems , word calloc::size)
void* calloc::mem
word calloc::nitems
word calloc::nitems#0 nitems zp[2]:90 53.25
word calloc::nitems#0 nitems zp[2]:93 53.25
void* calloc::return
void* calloc::return#0 return zp[2]:54 35.5
void* calloc::return#2 return zp[2]:54 22.0
@ -12156,15 +12184,15 @@ to_nomodify byte* cputs::s#0 s zp[2]:56 5.00000005E7
to_nomodify byte* cputs::s#10 s zp[2]:56 1.55000002E8
to_nomodify byte* cputs::s#11 s zp[2]:56 1.0000001E7
byte* cursorLocation()
word~ cursorLocation::$0 zp[2]:87 2.00000000000002E14
byte*~ cursorLocation::$1 zp[2]:87 2.00000000000002E14
word~ cursorLocation::$3 zp[2]:87 1.500000000000015E14
word~ cursorLocation::$4 zp[2]:90 2.00000000000002E14
word~ cursorLocation::$5 zp[2]:87 2.00000000000002E14
word~ cursorLocation::$0 zp[2]:90 2.00000000000002E14
byte*~ cursorLocation::$1 zp[2]:90 2.00000000000002E14
word~ cursorLocation::$3 zp[2]:90 1.500000000000015E14
word~ cursorLocation::$4 zp[2]:93 2.00000000000002E14
word~ cursorLocation::$5 zp[2]:90 2.00000000000002E14
byte* cursorLocation::return
byte* cursorLocation::return#0 return zp[2]:87 2.000000000002E12
byte* cursorLocation::return#1 return zp[2]:87 2.775000000000075E13
byte* cursorLocation::return#3 return zp[2]:87 2.0000000000002E13
byte* cursorLocation::return#0 return zp[2]:90 2.000000000002E12
byte* cursorLocation::return#1 return zp[2]:90 2.775000000000075E13
byte* cursorLocation::return#3 return zp[2]:90 2.0000000000002E13
dword h0
dword h0#10 h0 zp[4]:6 2.312977099236641
dword h0#3 h0 zp[4]:6 40.4
@ -12286,15 +12314,15 @@ dword* md5::w
byte* md5::w#0 w zp[2]:62 0.7829457364341085
void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num)
void* memcpy::destination
void* memcpy::destination#0 destination zp[2]:90 1.000000000001E12
byte* memcpy::destination#2 destination zp[2]:90 11.0
void* memcpy::destination#3 destination zp[2]:90 3.33333333341E11
void* memcpy::destination#7 destination zp[2]:90 22.0
void* memcpy::destination#8 destination zp[2]:90 22.0
void* memcpy::destination#0 destination zp[2]:93 1.000000000001E12
byte* memcpy::destination#2 destination zp[2]:93 11.0
void* memcpy::destination#3 destination zp[2]:93 3.33333333341E11
void* memcpy::destination#7 destination zp[2]:93 22.0
void* memcpy::destination#8 destination zp[2]:93 22.0
byte* memcpy::dst
byte* memcpy::dst#1 dst zp[2]:90 1.0E16
byte* memcpy::dst#2 dst zp[2]:90 1.0003333333333334E16
byte* memcpy::dst#4 dst zp[2]:90 2.0000000000002E13
byte* memcpy::dst#1 dst zp[2]:93 1.0E16
byte* memcpy::dst#2 dst zp[2]:93 1.0003333333333334E16
byte* memcpy::dst#4 dst zp[2]:93 2.0000000000002E13
word memcpy::num
word memcpy::num#1 num zp[2]:2 11.0
word memcpy::num#3 num zp[2]:2 1.0000000000012E13
@ -12308,7 +12336,7 @@ byte* memcpy::src#1 src zp[2]:44 2.0E16
byte* memcpy::src#2 src zp[2]:44 1.00025E16
byte* memcpy::src#4 src zp[2]:44 1.0000000000001E13
byte* memcpy::src_end
byte* memcpy::src_end#0 src_end zp[2]:87 1.25125E15
byte* memcpy::src_end#0 src_end zp[2]:90 1.25125E15
void* memset(void* memset::str , byte memset::c , word memset::num)
byte memset::c
byte* memset::dst
@ -12316,10 +12344,10 @@ byte* memset::dst#1 dst zp[2]:46 2.0E16
byte* memset::dst#2 dst zp[2]:46 1.3336666666666668E16
byte* memset::dst#4 dst zp[2]:46 2.0000000000002E13
byte* memset::end
byte* memset::end#0 end zp[2]:90 1.6683333333333335E15
byte* memset::end#0 end zp[2]:93 1.6683333333333335E15
word memset::num
word memset::num#0 num zp[2]:90 101.0
word memset::num#2 num zp[2]:90 1.00000000000515E13
word memset::num#0 num zp[2]:93 101.0
word memset::num#2 num zp[2]:93 1.00000000000515E13
void* memset::return
void* memset::str
void* memset::str#0 str zp[2]:46 202.0
@ -12351,7 +12379,7 @@ byte move8Left::t
byte move8Left::t#0 reg byte x 50000.5
word mul3(byte mul3::a)
word~ mul3::$1 zp[2]:44 15001.5
word~ mul3::$2 zp[2]:90 20002.0
word~ mul3::$2 zp[2]:93 20002.0
byte mul3::a
byte mul3::a#0 reg byte a 1001.0
word mul3::return
@ -12359,7 +12387,7 @@ word mul3::return#0 return zp[2]:44 3667.333333333333
word mul3::return#2 return zp[2]:44 2002.0
word mul5(byte mul5::a)
word~ mul5::$1 zp[2]:44 15001.5
word~ mul5::$2 zp[2]:87 20002.0
word~ mul5::$2 zp[2]:93 20002.0
byte mul5::a
byte mul5::a#0 reg byte a 1001.0
word mul5::return
@ -12415,7 +12443,7 @@ byte printf_padding::length#0 length zp[1]:49 2000002.0
byte printf_padding::length#1 length zp[1]:49 2000002.0
byte printf_padding::length#4 length zp[1]:49 1.6670000005E9
byte printf_padding::pad
byte printf_padding::pad#5 pad zp[1]:89 1.6666666668333333E9
byte printf_padding::pad#5 pad zp[1]:92 1.6666666668333333E9
void printf_uchar(byte printf_uchar::uvalue , byte printf_uchar::format_min_length , byte printf_uchar::format_justify_left , byte printf_uchar::format_sign_always , byte printf_uchar::format_zero_padding , byte printf_uchar::format_upper_case , byte printf_uchar::format_radix)
struct printf_format_number printf_uchar::format
byte printf_uchar::format_justify_left
@ -12437,7 +12465,7 @@ byte printf_uchar::uvalue#6 reg byte x 2002.0
void putchar(byte putchar::code)
byte putchar::code
byte* putchar::loc
byte* putchar::loc#0 loc zp[2]:87 1.000000000001E12
byte* putchar::loc#0 loc zp[2]:90 1.000000000001E12
byte putchar::newChar
byte putchar::newChar#0 reg byte a 1.5000000000015E12
const byte* rawmap[$100] = kickasm {{ .var ht = Hashtable().put(0,64, 1,0, 2,32, 3,96) // the table for converting bit 6,7 into ora value
@ -12447,15 +12475,15 @@ const byte* rawmap[$100] = kickasm {{ .var ht = Hashtable().put(0,64, 1,0, 2,32
.byte mask | ht.get(idx)
}
}}
void rotateLeft(byte* rotateLeft::p , byte rotateLeft::r)
byte* rotateLeft::p loadstore zp[2]:87 5000.5
byte rotateLeft::r loadstore zp[1]:73 10001.0
void rotateLeft(volatile byte* rotateLeft::p , volatile byte rotateLeft::r)
volatile byte* rotateLeft::p loadstore zp[2]:87 5000.5
volatile byte rotateLeft::r loadstore zp[1]:89 10001.0
void setcursor()
byte setcursor::c
byte setcursor::c#0 reg byte x 7.50000000000075E12
byte setcursor::c#1 reg byte a 2.0000000000002E13
byte* setcursor::loc
byte* setcursor::loc#0 loc zp[2]:87 1.0000000000001E13
byte* setcursor::loc#0 loc zp[2]:90 1.0000000000001E13
word strlen(byte* strlen::str)
word strlen::len
word strlen::len#1 len zp[2]:2 1.00000001E8
@ -12477,7 +12505,7 @@ byte uctoa::digit
byte uctoa::digit#1 digit zp[1]:48 2.000000002E9
byte uctoa::digit#2 digit zp[1]:48 3.07692308E8
byte uctoa::digit_value
byte uctoa::digit_value#0 digit_value zp[1]:89 6.000000005999999E8
byte uctoa::digit_value#0 digit_value zp[1]:92 6.000000005999999E8
byte* uctoa::digit_values
byte uctoa::max_digits
byte uctoa::radix
@ -12498,7 +12526,7 @@ byte uctoa_append::digit#2 reg byte y 1.000050000000015E14
byte uctoa_append::return
byte uctoa_append::return#0 reg byte x 2.000000002E9
byte uctoa_append::sub
byte uctoa_append::sub#0 sub zp[1]:89 3.33335000000005E13
byte uctoa_append::sub#0 sub zp[1]:92 3.33335000000005E13
byte uctoa_append::value
byte uctoa_append::value#0 reg byte x 3.666666667333333E9
byte uctoa_append::value#1 reg byte x 2.00000000000002E14
@ -12539,7 +12567,7 @@ reg byte a [ md5::$24 ]
reg byte a [ md5::$25 ]
zp[1]:68 [ md5::$72 ]
zp[4]:69 [ leftRotate::a ]
zp[1]:73 [ leftRotate::r#0 rotateLeft::r printf_uchar::format_zero_padding#10 printf_number_buffer::format_zero_padding#0 ]
zp[1]:73 [ leftRotate::r#0 printf_uchar::format_zero_padding#10 printf_number_buffer::format_zero_padding#0 ]
zp[4]:74 [ leftRotate::return#2 md5::lr#0 leftRotate::return#0 md5::b#1 ]
reg byte a [ mul7::a#0 ]
reg byte a [ mod16::return#4 ]
@ -12552,23 +12580,25 @@ zp[4]:82 [ md5::$27 md5::$28 ]
reg byte x [ cputc::convertToScreenCode1_return#0 ]
zp[1]:86 [ printf_number_buffer::buffer_sign#0 ]
reg byte x [ leftRotate::$5 ]
zp[2]:87 [ rotateLeft::p ]
zp[1]:89 [ rotateLeft::r ]
reg byte x [ leftRotate::$9 ]
reg byte a [ mod16::return#0 ]
zp[2]:87 [ cursorLocation::return#0 putchar::loc#0 cursorLocation::return#1 cursorLocation::return#3 setcursor::loc#0 cursorLocation::$0 cursorLocation::$1 cursorLocation::$3 cursorLocation::$5 mul5::$2 rotateLeft::p memcpy::src_end#0 ]
zp[2]:90 [ cursorLocation::return#0 putchar::loc#0 cursorLocation::return#1 cursorLocation::return#3 setcursor::loc#0 cursorLocation::$0 cursorLocation::$1 cursorLocation::$3 cursorLocation::$5 mul7::$2 mul7::$3 mul7::$4 memcpy::src_end#0 ]
reg byte a [ putchar::newChar#0 ]
reg byte x [ setcursor::c#0 ]
reg byte a [ setcursor::c#1 ]
zp[1]:89 [ uctoa::digit_value#0 uctoa_append::sub#0 printf_padding::pad#5 ]
zp[1]:92 [ uctoa::digit_value#0 uctoa_append::sub#0 printf_padding::pad#5 ]
reg byte x [ uctoa_append::return#0 ]
reg byte y [ move16Left::s#0 ]
reg byte x [ move16Left::t#0 ]
reg byte x [ move8Left::t#0 ]
zp[2]:90 [ cursorLocation::$4 mul3::$2 mul7::$2 mul7::$3 mul7::$4 memset::num#2 memset::num#0 calloc::nitems#0 memset::end#0 memcpy::destination#3 memcpy::destination#7 memcpy::destination#8 memcpy::destination#0 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 memcpy::destination#2 ]
zp[2]:93 [ cursorLocation::$4 mul5::$2 mul3::$2 memset::num#2 memset::num#0 calloc::nitems#0 memset::end#0 memcpy::destination#3 memcpy::destination#7 memcpy::destination#8 memcpy::destination#0 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 memcpy::destination#2 ]
mem[12] [ printf_buffer ]
FINAL ASSEMBLER
Score: 652901
Score: 652907
// File Comments
// 8 bit converted md5 calculator
@ -14039,10 +14069,10 @@ cputc: {
// Allocates memory and returns a pointer to it. Sets allocated memory to zero.
// - nitems This is the number of elements to be allocated.
// - size This is the size of elements.
// calloc(word zp($5a) nitems)
// calloc(word zp($5d) nitems)
calloc: {
.label return = $36
.label nitems = $5a
.label nitems = $5d
// malloc(nitems*size)
// [195] malloc::size#0 = calloc::nitems#0 -- vwuz1=vwuz2
lda.z nitems
@ -14073,12 +14103,12 @@ calloc: {
// memcpy
// Copy block of memory (forwards)
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// memcpy(void* zp($5a) destination, byte* zp($2c) source, word zp(2) num)
// memcpy(void* zp($5d) destination, byte* zp($2c) source, word zp(2) num)
memcpy: {
.label src_end = $57
.label dst = $5a
.label src_end = $5a
.label dst = $5d
.label src = $2c
.label destination = $5a
.label destination = $5d
.label source = $2c
.label num = 2
// src_end = (char*)source+num
@ -14342,7 +14372,9 @@ leftRotate: {
sta.z rotateLeft.p
lda #>p
sta.z rotateLeft.p+1
// [255] rotateLeft::r = leftRotate::r#0
// [255] rotateLeft::r = leftRotate::r#0 -- vbuz1=vbuz2
lda.z r
sta.z rotateLeft.r
// [256] call rotateLeft
jsr rotateLeft
jmp __b5
@ -14417,7 +14449,7 @@ mod16: {
mul3: {
.label __1 = $2c
.label return = $2c
.label __2 = $5a
.label __2 = $5d
// ((uint16_t) a) * 3
// [267] mul3::$1 = (word)mul3::a#0 -- vwuz1=_word_vbuaa
sta.z __1
@ -14448,7 +14480,7 @@ mul3: {
mul5: {
.label __1 = $2c
.label return = $2c
.label __2 = $57
.label __2 = $5d
// ((uint16_t) a) * 5
// [271] mul5::$1 = (word)mul5::a#0 -- vwuz1=_word_vbuaa
sta.z __1
@ -14479,7 +14511,7 @@ mul5: {
// putchar
// Puts a character to the screen a the current location. Uses internal screencode. Deals with storing the old cursor value
putchar: {
.label loc = $57
.label loc = $5a
// **OLDADR = *OLDCHR
// [275] *(*OLDADR) = *OLDCHR -- _deref_(_deref_qbuc1)=_deref_pbuc2
lda OLDCHR
@ -14517,7 +14549,7 @@ putchar: {
// setcursor
// Handles cursor movement, displaying it if required, and inverting character it is over if there is one (and enabled)
setcursor: {
.label loc = $57
.label loc = $5a
// **OLDADR = *OLDCHR
// [284] *(*OLDADR) = *OLDCHR -- _deref_(_deref_qbuc1)=_deref_pbuc2
// save the current oldchr into oldadr
@ -14689,12 +14721,12 @@ malloc: {
}
// memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zp($2e) str, word zp($5a) num)
// memset(void* zp($2e) str, word zp($5d) num)
memset: {
.label end = $5a
.label end = $5d
.label dst = $2e
.label str = $2e
.label num = $5a
.label num = $5d
// if(num>0)
// [313] if(memset::num#2<=0) goto memset::@return -- vwuz1_le_0_then_la1
lda.z num
@ -14753,7 +14785,7 @@ memset: {
// - radix : The radix to convert the number to (from the enum RADIX)
// uctoa(byte register(X) value, byte* zp($2e) buffer)
uctoa: {
.label digit_value = $59
.label digit_value = $5c
.label buffer = $2e
.label digit = $30
.label started = $31
@ -15028,10 +15060,10 @@ move16Left: {
rts
}
// rotateLeft
// rotateLeft(byte* zp($57) p, byte zp($49) r)
// rotateLeft(byte* zp($57) p, byte zp($59) r)
rotateLeft: {
.label p = $57
.label r = $49
.label r = $59
// kickasm
// kickasm( uses rotateLeft::p uses rotateLeft::r) {{ ldx #r !s: asl p+3 rol p+2 rol p+1 rol p bcc !+ lda p+3 adc #0 !: dex bne !s- }}
ldx #r
@ -15080,12 +15112,12 @@ move8Left: {
// cursorLocation
// Return a pointer to the location of the cursor
cursorLocation: {
.label __0 = $57
.label __1 = $57
.label __3 = $57
.label return = $57
.label __4 = $5a
.label __5 = $57
.label __0 = $5a
.label __1 = $5a
.label __3 = $5a
.label return = $5a
.label __4 = $5d
.label __5 = $5a
// (word)(*ROWCRS)*CONIO_WIDTH
// [382] cursorLocation::$3 = (word)*ROWCRS -- vwuz1=_word__deref_pbuc1
lda ROWCRS
@ -15148,10 +15180,10 @@ cursorLocation: {
// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased.
// (For decimal the subs used are 10000, 1000, 100, 10, 1)
// returns : the value reduced by sub * digit so that it is less than sub.
// uctoa_append(byte* zp($2e) buffer, byte register(X) value, byte zp($59) sub)
// uctoa_append(byte* zp($2e) buffer, byte register(X) value, byte zp($5c) sub)
uctoa_append: {
.label buffer = $2e
.label sub = $59
.label sub = $5c
// [390] phi from uctoa_append to uctoa_append::@1 [phi:uctoa_append->uctoa_append::@1]
// [390] phi uctoa_append::digit#2 = 0 [phi:uctoa_append->uctoa_append::@1#0] -- vbuyy=vbuc1
ldy #0
@ -15190,11 +15222,11 @@ uctoa_append: {
}
// printf_padding
// Print a padding char a number of times
// printf_padding(byte zp($59) pad, byte zp($31) length)
// printf_padding(byte zp($5c) pad, byte zp($31) length)
printf_padding: {
.label i = $32
.label length = $31
.label pad = $59
.label pad = $5c
// [397] phi from printf_padding to printf_padding::@1 [phi:printf_padding->printf_padding::@1]
// [397] phi printf_padding::i#2 = 0 [phi:printf_padding->printf_padding::@1#0] -- vbuz1=vbuc1
lda #0

View File

@ -16,7 +16,7 @@ const byte SIZEOF_STRUCT_PRINTF_BUFFER_NUMBER = $c
void* calloc(word calloc::nitems , word calloc::size)
void* calloc::mem
word calloc::nitems
word calloc::nitems#0 nitems zp[2]:90 53.25
word calloc::nitems#0 nitems zp[2]:93 53.25
void* calloc::return
void* calloc::return#0 return zp[2]:54 35.5
void* calloc::return#2 return zp[2]:54 22.0
@ -36,15 +36,15 @@ to_nomodify byte* cputs::s#0 s zp[2]:56 5.00000005E7
to_nomodify byte* cputs::s#10 s zp[2]:56 1.55000002E8
to_nomodify byte* cputs::s#11 s zp[2]:56 1.0000001E7
byte* cursorLocation()
word~ cursorLocation::$0 zp[2]:87 2.00000000000002E14
byte*~ cursorLocation::$1 zp[2]:87 2.00000000000002E14
word~ cursorLocation::$3 zp[2]:87 1.500000000000015E14
word~ cursorLocation::$4 zp[2]:90 2.00000000000002E14
word~ cursorLocation::$5 zp[2]:87 2.00000000000002E14
word~ cursorLocation::$0 zp[2]:90 2.00000000000002E14
byte*~ cursorLocation::$1 zp[2]:90 2.00000000000002E14
word~ cursorLocation::$3 zp[2]:90 1.500000000000015E14
word~ cursorLocation::$4 zp[2]:93 2.00000000000002E14
word~ cursorLocation::$5 zp[2]:90 2.00000000000002E14
byte* cursorLocation::return
byte* cursorLocation::return#0 return zp[2]:87 2.000000000002E12
byte* cursorLocation::return#1 return zp[2]:87 2.775000000000075E13
byte* cursorLocation::return#3 return zp[2]:87 2.0000000000002E13
byte* cursorLocation::return#0 return zp[2]:90 2.000000000002E12
byte* cursorLocation::return#1 return zp[2]:90 2.775000000000075E13
byte* cursorLocation::return#3 return zp[2]:90 2.0000000000002E13
dword h0
dword h0#10 h0 zp[4]:6 2.312977099236641
dword h0#3 h0 zp[4]:6 40.4
@ -166,15 +166,15 @@ dword* md5::w
byte* md5::w#0 w zp[2]:62 0.7829457364341085
void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num)
void* memcpy::destination
void* memcpy::destination#0 destination zp[2]:90 1.000000000001E12
byte* memcpy::destination#2 destination zp[2]:90 11.0
void* memcpy::destination#3 destination zp[2]:90 3.33333333341E11
void* memcpy::destination#7 destination zp[2]:90 22.0
void* memcpy::destination#8 destination zp[2]:90 22.0
void* memcpy::destination#0 destination zp[2]:93 1.000000000001E12
byte* memcpy::destination#2 destination zp[2]:93 11.0
void* memcpy::destination#3 destination zp[2]:93 3.33333333341E11
void* memcpy::destination#7 destination zp[2]:93 22.0
void* memcpy::destination#8 destination zp[2]:93 22.0
byte* memcpy::dst
byte* memcpy::dst#1 dst zp[2]:90 1.0E16
byte* memcpy::dst#2 dst zp[2]:90 1.0003333333333334E16
byte* memcpy::dst#4 dst zp[2]:90 2.0000000000002E13
byte* memcpy::dst#1 dst zp[2]:93 1.0E16
byte* memcpy::dst#2 dst zp[2]:93 1.0003333333333334E16
byte* memcpy::dst#4 dst zp[2]:93 2.0000000000002E13
word memcpy::num
word memcpy::num#1 num zp[2]:2 11.0
word memcpy::num#3 num zp[2]:2 1.0000000000012E13
@ -188,7 +188,7 @@ byte* memcpy::src#1 src zp[2]:44 2.0E16
byte* memcpy::src#2 src zp[2]:44 1.00025E16
byte* memcpy::src#4 src zp[2]:44 1.0000000000001E13
byte* memcpy::src_end
byte* memcpy::src_end#0 src_end zp[2]:87 1.25125E15
byte* memcpy::src_end#0 src_end zp[2]:90 1.25125E15
void* memset(void* memset::str , byte memset::c , word memset::num)
byte memset::c
byte* memset::dst
@ -196,10 +196,10 @@ byte* memset::dst#1 dst zp[2]:46 2.0E16
byte* memset::dst#2 dst zp[2]:46 1.3336666666666668E16
byte* memset::dst#4 dst zp[2]:46 2.0000000000002E13
byte* memset::end
byte* memset::end#0 end zp[2]:90 1.6683333333333335E15
byte* memset::end#0 end zp[2]:93 1.6683333333333335E15
word memset::num
word memset::num#0 num zp[2]:90 101.0
word memset::num#2 num zp[2]:90 1.00000000000515E13
word memset::num#0 num zp[2]:93 101.0
word memset::num#2 num zp[2]:93 1.00000000000515E13
void* memset::return
void* memset::str
void* memset::str#0 str zp[2]:46 202.0
@ -231,7 +231,7 @@ byte move8Left::t
byte move8Left::t#0 reg byte x 50000.5
word mul3(byte mul3::a)
word~ mul3::$1 zp[2]:44 15001.5
word~ mul3::$2 zp[2]:90 20002.0
word~ mul3::$2 zp[2]:93 20002.0
byte mul3::a
byte mul3::a#0 reg byte a 1001.0
word mul3::return
@ -239,7 +239,7 @@ word mul3::return#0 return zp[2]:44 3667.333333333333
word mul3::return#2 return zp[2]:44 2002.0
word mul5(byte mul5::a)
word~ mul5::$1 zp[2]:44 15001.5
word~ mul5::$2 zp[2]:87 20002.0
word~ mul5::$2 zp[2]:93 20002.0
byte mul5::a
byte mul5::a#0 reg byte a 1001.0
word mul5::return
@ -295,7 +295,7 @@ byte printf_padding::length#0 length zp[1]:49 2000002.0
byte printf_padding::length#1 length zp[1]:49 2000002.0
byte printf_padding::length#4 length zp[1]:49 1.6670000005E9
byte printf_padding::pad
byte printf_padding::pad#5 pad zp[1]:89 1.6666666668333333E9
byte printf_padding::pad#5 pad zp[1]:92 1.6666666668333333E9
void printf_uchar(byte printf_uchar::uvalue , byte printf_uchar::format_min_length , byte printf_uchar::format_justify_left , byte printf_uchar::format_sign_always , byte printf_uchar::format_zero_padding , byte printf_uchar::format_upper_case , byte printf_uchar::format_radix)
struct printf_format_number printf_uchar::format
byte printf_uchar::format_justify_left
@ -317,7 +317,7 @@ byte printf_uchar::uvalue#6 reg byte x 2002.0
void putchar(byte putchar::code)
byte putchar::code
byte* putchar::loc
byte* putchar::loc#0 loc zp[2]:87 1.000000000001E12
byte* putchar::loc#0 loc zp[2]:90 1.000000000001E12
byte putchar::newChar
byte putchar::newChar#0 reg byte a 1.5000000000015E12
const byte* rawmap[$100] = kickasm {{ .var ht = Hashtable().put(0,64, 1,0, 2,32, 3,96) // the table for converting bit 6,7 into ora value
@ -327,15 +327,15 @@ const byte* rawmap[$100] = kickasm {{ .var ht = Hashtable().put(0,64, 1,0, 2,32
.byte mask | ht.get(idx)
}
}}
void rotateLeft(byte* rotateLeft::p , byte rotateLeft::r)
byte* rotateLeft::p loadstore zp[2]:87 5000.5
byte rotateLeft::r loadstore zp[1]:73 10001.0
void rotateLeft(volatile byte* rotateLeft::p , volatile byte rotateLeft::r)
volatile byte* rotateLeft::p loadstore zp[2]:87 5000.5
volatile byte rotateLeft::r loadstore zp[1]:89 10001.0
void setcursor()
byte setcursor::c
byte setcursor::c#0 reg byte x 7.50000000000075E12
byte setcursor::c#1 reg byte a 2.0000000000002E13
byte* setcursor::loc
byte* setcursor::loc#0 loc zp[2]:87 1.0000000000001E13
byte* setcursor::loc#0 loc zp[2]:90 1.0000000000001E13
word strlen(byte* strlen::str)
word strlen::len
word strlen::len#1 len zp[2]:2 1.00000001E8
@ -357,7 +357,7 @@ byte uctoa::digit
byte uctoa::digit#1 digit zp[1]:48 2.000000002E9
byte uctoa::digit#2 digit zp[1]:48 3.07692308E8
byte uctoa::digit_value
byte uctoa::digit_value#0 digit_value zp[1]:89 6.000000005999999E8
byte uctoa::digit_value#0 digit_value zp[1]:92 6.000000005999999E8
byte* uctoa::digit_values
byte uctoa::max_digits
byte uctoa::radix
@ -378,7 +378,7 @@ byte uctoa_append::digit#2 reg byte y 1.000050000000015E14
byte uctoa_append::return
byte uctoa_append::return#0 reg byte x 2.000000002E9
byte uctoa_append::sub
byte uctoa_append::sub#0 sub zp[1]:89 3.33335000000005E13
byte uctoa_append::sub#0 sub zp[1]:92 3.33335000000005E13
byte uctoa_append::value
byte uctoa_append::value#0 reg byte x 3.666666667333333E9
byte uctoa_append::value#1 reg byte x 2.00000000000002E14
@ -419,7 +419,7 @@ reg byte a [ md5::$24 ]
reg byte a [ md5::$25 ]
zp[1]:68 [ md5::$72 ]
zp[4]:69 [ leftRotate::a ]
zp[1]:73 [ leftRotate::r#0 rotateLeft::r printf_uchar::format_zero_padding#10 printf_number_buffer::format_zero_padding#0 ]
zp[1]:73 [ leftRotate::r#0 printf_uchar::format_zero_padding#10 printf_number_buffer::format_zero_padding#0 ]
zp[4]:74 [ leftRotate::return#2 md5::lr#0 leftRotate::return#0 md5::b#1 ]
reg byte a [ mul7::a#0 ]
reg byte a [ mod16::return#4 ]
@ -432,16 +432,18 @@ zp[4]:82 [ md5::$27 md5::$28 ]
reg byte x [ cputc::convertToScreenCode1_return#0 ]
zp[1]:86 [ printf_number_buffer::buffer_sign#0 ]
reg byte x [ leftRotate::$5 ]
zp[2]:87 [ rotateLeft::p ]
zp[1]:89 [ rotateLeft::r ]
reg byte x [ leftRotate::$9 ]
reg byte a [ mod16::return#0 ]
zp[2]:87 [ cursorLocation::return#0 putchar::loc#0 cursorLocation::return#1 cursorLocation::return#3 setcursor::loc#0 cursorLocation::$0 cursorLocation::$1 cursorLocation::$3 cursorLocation::$5 mul5::$2 rotateLeft::p memcpy::src_end#0 ]
zp[2]:90 [ cursorLocation::return#0 putchar::loc#0 cursorLocation::return#1 cursorLocation::return#3 setcursor::loc#0 cursorLocation::$0 cursorLocation::$1 cursorLocation::$3 cursorLocation::$5 mul7::$2 mul7::$3 mul7::$4 memcpy::src_end#0 ]
reg byte a [ putchar::newChar#0 ]
reg byte x [ setcursor::c#0 ]
reg byte a [ setcursor::c#1 ]
zp[1]:89 [ uctoa::digit_value#0 uctoa_append::sub#0 printf_padding::pad#5 ]
zp[1]:92 [ uctoa::digit_value#0 uctoa_append::sub#0 printf_padding::pad#5 ]
reg byte x [ uctoa_append::return#0 ]
reg byte y [ move16Left::s#0 ]
reg byte x [ move16Left::t#0 ]
reg byte x [ move8Left::t#0 ]
zp[2]:90 [ cursorLocation::$4 mul3::$2 mul7::$2 mul7::$3 mul7::$4 memset::num#2 memset::num#0 calloc::nitems#0 memset::end#0 memcpy::destination#3 memcpy::destination#7 memcpy::destination#8 memcpy::destination#0 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 memcpy::destination#2 ]
zp[2]:93 [ cursorLocation::$4 mul5::$2 mul3::$2 memset::num#2 memset::num#0 calloc::nitems#0 memset::end#0 memcpy::destination#3 memcpy::destination#7 memcpy::destination#8 memcpy::destination#0 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 memcpy::destination#2 ]
mem[12] [ printf_buffer ]

View File

@ -1,6 +1,7 @@
Fixing struct type size struct MOS6532_RIOT to 24
Fixing struct type SIZE_OF struct MOS6532_RIOT to 24
Fixing struct type SIZE_OF struct MOS6532_RIOT to 24
Setting inferred volatile on symbol affected by address-of: p0_xpos in asm { ldap0_xpos staTIA_WSYNC sec !: sbc#$f bcs!- eor#7 asl asl asl asl staTIA_HMP0 staTIA_RESP0 }
Inlined call call __init
CONTROL FLOW GRAPH SSA
@ -305,7 +306,7 @@ byte main::p0_idx#6
byte main::p0_idx#7
byte main::p0_idx#8
byte main::p0_idx#9
byte p0_xpos loadstore
volatile byte p0_xpos loadstore
byte p0_ypos
byte p0_ypos#0
byte p0_ypos#1
@ -685,7 +686,7 @@ byte main::p0_idx
byte main::p0_idx#3 2002.0
byte main::p0_idx#4 500.5
byte main::p0_idx#8 1501.5
byte p0_xpos loadstore 2.452380952380952
volatile byte p0_xpos loadstore 2.452380952380952
byte p0_ypos
byte p0_ypos#0 52.476190476190474
@ -1204,7 +1205,7 @@ byte main::p0_idx
byte main::p0_idx#3 reg byte y 2002.0
byte main::p0_idx#4 reg byte y 500.5
byte main::p0_idx#8 reg byte y 1501.5
byte p0_xpos loadstore zp[1]:130 2.452380952380952
volatile byte p0_xpos loadstore zp[1]:130 2.452380952380952
byte p0_ypos
byte p0_ypos#0 p0_ypos zp[1]:131 52.476190476190474

View File

@ -33,7 +33,7 @@ byte main::p0_idx
byte main::p0_idx#3 reg byte y 2002.0
byte main::p0_idx#4 reg byte y 500.5
byte main::p0_idx#8 reg byte y 1501.5
byte p0_xpos loadstore zp[1]:130 2.452380952380952
volatile byte p0_xpos loadstore zp[1]:130 2.452380952380952
byte p0_ypos
byte p0_ypos#0 p0_ypos zp[1]:131 52.476190476190474

View File

@ -27,13 +27,13 @@
.label CIA1 = $dc00
// The number of bytes on the screen
// The current cursor x-position
.label conio_cursor_x = $10
.label conio_cursor_x = $f
// The current cursor y-position
.label conio_cursor_y = $11
.label conio_cursor_y = $10
// The current text cursor line start
.label conio_line_text = $12
.label conio_line_text = $11
// The current color cursor line start
.label conio_line_color = $14
.label conio_line_color = $13
// The number of found solutions
.label count = 2
__start: {
@ -66,19 +66,20 @@ __start: {
// Generates all valid placements of queens on a NxN board recursively
// Works by generating all legal placements af a queen for a specific row taking into consideration the queens already placed on the rows below
// and then recursively generating all legal placements on the rows above.
// queen(byte zp($17) row)
// queen(byte zp($1e) row)
queen: {
.const OFFSET_STACK_ROW = 0
.label r = $17
.label column = $18
.label __1 = $1c
.label r = $15
.label column = $16
.label __1 = $1a
.label __4 = $17
.label row = $17
.label row = $1e
// }
tsx
lda STACK_BASE+OFFSET_STACK_ROW,x
sta.z row
// r = row
sta.z r
// column=1
lda #1
sta.z column
@ -91,6 +92,10 @@ queen: {
rts
__b2:
// legal(r,column)
lda.z r
sta.z legal.row
lda.z column
sta.z legal.column
jsr legal
// legal(r,column)
// if(legal(r,column))
@ -114,10 +119,12 @@ queen: {
tya
pha
// r+1
inc.z __4
tay
iny
sty.z __4
// queen(r+1)
// Do recursion
lda.z __4
tya
pha
jsr queen
pla
@ -221,15 +228,15 @@ main: {
// If no conflict for desired position returns 1 otherwise returns 0
// legal(byte zp($17) row, byte zp($18) column)
legal: {
.label __0 = $1a
.label __3 = $1b
.label __4 = $d
.label __0 = $1c
.label __3 = $1d
.label __4 = $21
.label row = $17
.label column = $18
// Placement is legal
// The same column is a conflict.
// The same diagonal is a conflict.
.label return = $1c
.label return = $1a
.label i = $19
lda #1
sta.z i
@ -383,8 +390,8 @@ print: {
clrscr: {
.label c = 6
.label line_text = $b
.label line_cols = $e
.label l = $1c
.label line_cols = $d
.label l = $1a
lda #<COLORRAM
sta.z line_cols
lda #>COLORRAM
@ -459,7 +466,7 @@ clrscr: {
// Output a NUL-terminated string at the current cursor position
// cputs(byte* zp($b) s)
cputs: {
.label c = $d
.label c = $21
.label s = $b
__b1:
// while(c=*s++)
@ -512,12 +519,12 @@ printf_uint: {
}
// Initialize time-of-day clock
// This uses the MOS6526 CIA#1
// tod_init(byte zp($16) tod_TENTHS, byte zp($17) tod_SEC, byte zp($18) tod_MIN, byte zp($19) tod_HOURS)
// tod_init(byte zp($18) tod_TENTHS, byte zp($19) tod_SEC, byte zp($1a) tod_MIN, byte zp($1b) tod_HOURS)
tod_init: {
.label tod_TENTHS = $16
.label tod_SEC = $17
.label tod_MIN = $18
.label tod_HOURS = $19
.label tod_TENTHS = $18
.label tod_SEC = $19
.label tod_MIN = $1a
.label tod_HOURS = $1b
// CIA1->TIMER_A_CONTROL |= 0x80
// Set 50hz (this assumes PAL!) (bit7=1)
lda #$80
@ -574,16 +581,16 @@ tod_str: {
.label __1 = $1d
.label __2 = $1c
.label __3 = $1c
.label __4 = $20
.label __5 = $20
.label __4 = $26
.label __5 = $26
.label __6 = $1b
.label __7 = $1b
.label __8 = $21
.label __9 = $21
.label __8 = $1e
.label __9 = $1e
.label __10 = $1a
.label __11 = $1a
.label __12 = $26
.label __13 = $26
.label __12 = $21
.label __13 = $21
.label __14 = $19
.label __15 = $19
.label tod_TENTHS = $19
@ -738,12 +745,12 @@ printf_string: {
rts
}
// Find the absolute difference between two unsigned chars
// diff(byte zp($d) a, byte zp(6) b)
// diff(byte zp($21) a, byte zp(6) b)
diff: {
.label a = $d
.label a = $21
.label b = 6
.label return = $1b
.label return_1 = $d
.label return = $1d
.label return_1 = $21
// if(a<b)
lda.z a
cmp.z b
@ -815,9 +822,9 @@ printf_uchar: {
}
// Output one character at the current cursor position
// Moves the cursor forward. Scrolls the entire screen if needed
// cputc(byte zp($d) c)
// cputc(byte zp($21) c)
cputc: {
.label c = $d
.label c = $21
// if(c=='\n')
lda #'\n'
cmp.z c
@ -849,16 +856,16 @@ cputc: {
// - value : The number to be converted to RADIX
// - buffer : receives the string representing the number and zero-termination.
// - radix : The radix to convert the number to (from the enum RADIX)
// utoa(word zp($e) value, byte* zp($b) buffer)
// utoa(word zp($d) value, byte* zp($b) buffer)
utoa: {
.const max_digits = 5
.label __10 = $1d
.label __11 = $1c
.label digit_value = $1e
.label __10 = $1e
.label __11 = $26
.label digit_value = $1f
.label buffer = $b
.label digit = 6
.label value = $e
.label started = $1a
.label value = $d
.label started = $17
lda #<printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS
sta.z buffer
lda #>printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS
@ -936,16 +943,16 @@ utoa: {
}
// Print the contents of the number buffer using a specific format.
// This handles minimum length, zero-filling, and left/right justification from the format
// printf_number_buffer(byte zp($20) buffer_sign, byte zp($1a) format_min_length, byte zp($1b) format_justify_left, byte zp($1d) format_zero_padding, byte zp($21) format_upper_case)
// printf_number_buffer(byte zp($1c) buffer_sign, byte zp($17) format_min_length, byte zp($18) format_justify_left, byte zp($1b) format_zero_padding, byte zp($1d) format_upper_case)
printf_number_buffer: {
.label __19 = $1e
.label buffer_sign = $20
.label len = $d
.label padding = $1a
.label format_min_length = $1a
.label format_zero_padding = $1d
.label format_justify_left = $1b
.label format_upper_case = $21
.label __19 = $1f
.label buffer_sign = $1c
.label len = $21
.label padding = $17
.label format_min_length = $17
.label format_zero_padding = $1b
.label format_justify_left = $18
.label format_upper_case = $1d
// if(format.min_length)
lda #0
cmp.z format_min_length
@ -1057,13 +1064,13 @@ printf_number_buffer: {
// - radix : The radix to convert the number to (from the enum RADIX)
// ultoa(dword zp(7) value, byte* zp($b) buffer)
ultoa: {
.label __10 = $21
.label __11 = $20
.label __10 = $26
.label __11 = $21
.label digit_value = $22
.label buffer = $b
.label digit = $1b
.label digit = $18
.label value = 7
.label started = $1d
.label started = $1b
lda #<printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS
sta.z buffer
lda #>printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS
@ -1152,13 +1159,13 @@ ultoa: {
// - value : The number to be converted to RADIX
// - buffer : receives the string representing the number and zero-termination.
// - radix : The radix to convert the number to (from the enum RADIX)
// uctoa(byte zp($21) value, byte* zp($e) buffer)
// uctoa(byte zp($1d) value, byte* zp($d) buffer)
uctoa: {
.label digit_value = $26
.label buffer = $e
.label digit = $20
.label value = $21
.label started = $d
.label buffer = $d
.label digit = $1c
.label value = $1d
.label started = $21
lda #<printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS
sta.z buffer
lda #>printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS
@ -1253,13 +1260,13 @@ cputln: {
// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased.
// (For decimal the subs used are 10000, 1000, 100, 10, 1)
// returns : the value reduced by sub * digit so that it is less than sub.
// utoa_append(byte* zp($b) buffer, word zp($e) value, word zp($1e) sub)
// utoa_append(byte* zp($b) buffer, word zp($d) value, word zp($1f) sub)
utoa_append: {
.label buffer = $b
.label value = $e
.label sub = $1e
.label return = $e
.label digit = $1c
.label value = $d
.label sub = $1f
.label return = $d
.label digit = $1a
lda #0
sta.z digit
__b1:
@ -1293,11 +1300,11 @@ utoa_append: {
jmp __b1
}
// Computes the length of the string str up to but not including the terminating null character.
// strlen(byte* zp($e) str)
// strlen(byte* zp($d) str)
strlen: {
.label len = $1e
.label str = $e
.label return = $1e
.label len = $1f
.label str = $d
.label return = $1f
lda #<0
sta.z len
sta.z len+1
@ -1327,11 +1334,11 @@ strlen: {
jmp __b1
}
// Print a padding char a number of times
// printf_padding(byte zp($d) pad, byte zp($1c) length)
// printf_padding(byte zp($21) pad, byte zp($1a) length)
printf_padding: {
.label i = $26
.label length = $1c
.label pad = $d
.label length = $1a
.label pad = $21
lda #0
sta.z i
__b1:
@ -1351,8 +1358,8 @@ printf_padding: {
// Converts a string to uppercase.
strupr: {
.label str = printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS
.label __0 = $1c
.label src = $1e
.label __0 = $1a
.label src = $1f
lda #<str
sta.z src
lda #>str
@ -1451,13 +1458,13 @@ ultoa_append: {
// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased.
// (For decimal the subs used are 10000, 1000, 100, 10, 1)
// returns : the value reduced by sub * digit so that it is less than sub.
// uctoa_append(byte* zp($e) buffer, byte zp($21) value, byte zp($26) sub)
// uctoa_append(byte* zp($d) buffer, byte zp($1d) value, byte zp($26) sub)
uctoa_append: {
.label buffer = $e
.label value = $21
.label buffer = $d
.label value = $1d
.label sub = $26
.label return = $21
.label digit = $1c
.label return = $1d
.label digit = $1a
lda #0
sta.z digit
__b1:
@ -1548,10 +1555,10 @@ cscroll: {
}
// Convert lowercase alphabet to uppercase
// Returns uppercase equivalent to c, if such value exists, else c remains unchanged
// toupper(byte zp($1c) ch)
// toupper(byte zp($1a) ch)
toupper: {
.label return = $1c
.label ch = $1c
.label return = $1a
.label ch = $1a
// if(ch>='a' && ch<='z')
lda.z ch
cmp #'a'
@ -1571,13 +1578,13 @@ toupper: {
}
// Copy block of memory (forwards)
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// memcpy(void* zp($e) destination, void* zp($1e) source)
// memcpy(void* zp($d) destination, void* zp($1f) source)
memcpy: {
.label src_end = $27
.label dst = $e
.label src = $1e
.label source = $1e
.label destination = $e
.label dst = $d
.label src = $1f
.label source = $1f
.label destination = $d
// src_end = (char*)source+num
clc
lda.z source
@ -1613,12 +1620,12 @@ memcpy: {
jmp __b1
}
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zp($e) str, byte zp($16) c)
// memset(void* zp($d) str, byte zp($1e) c)
memset: {
.label end = $27
.label dst = $e
.label str = $e
.label c = $16
.label dst = $d
.label str = $d
.label c = $1e
// end = (char*)str + num
lda #$28
clc

File diff suppressed because it is too large Load Diff

View File

@ -30,29 +30,29 @@ byte clrscr::c
byte clrscr::c#1 c zp[1]:6 20002.0
byte clrscr::c#2 c zp[1]:6 12501.25
byte clrscr::l
byte clrscr::l#1 l zp[1]:28 2002.0
byte clrscr::l#2 l zp[1]:28 333.6666666666667
byte clrscr::l#1 l zp[1]:26 2002.0
byte clrscr::l#2 l zp[1]:26 333.6666666666667
byte* clrscr::line_cols
byte* clrscr::line_cols#1 line_cols zp[2]:14 1001.0
byte* clrscr::line_cols#5 line_cols zp[2]:14 1500.375
byte* clrscr::line_cols#1 line_cols zp[2]:13 1001.0
byte* clrscr::line_cols#5 line_cols zp[2]:13 1500.375
byte* clrscr::line_text
byte* clrscr::line_text#1 line_text zp[2]:11 667.3333333333334
byte* clrscr::line_text#5 line_text zp[2]:11 1714.7142857142858
byte conio_cursor_x loadstore zp[1]:16 8.241758241758241E27
byte conio_cursor_y loadstore zp[1]:17 1.6243654822335025E29
byte* conio_line_color loadstore zp[2]:20 1.1450777202072537E29
byte* conio_line_text loadstore zp[2]:18 1.1333333333333334E29
byte conio_cursor_x loadstore zp[1]:15 8.241758241758241E27
byte conio_cursor_y loadstore zp[1]:16 1.6243654822335025E29
byte* conio_line_color loadstore zp[2]:19 1.1450777202072537E29
byte* conio_line_text loadstore zp[2]:17 1.1333333333333334E29
dword count loadstore zp[4]:2 2.4691358025012344E10
void cputc(byte cputc::c)
byte cputc::c
byte cputc::c#0 c zp[1]:13 2.0E28
byte cputc::c#1 c zp[1]:13 2.0E27
byte cputc::c#2 c zp[1]:13 2.00000000000002E14
byte cputc::c#3 c zp[1]:13 1.0550000000000004E29
byte cputc::c#0 c zp[1]:33 2.0E28
byte cputc::c#1 c zp[1]:33 2.0E27
byte cputc::c#2 c zp[1]:33 2.00000000000002E14
byte cputc::c#3 c zp[1]:33 1.0550000000000004E29
void cputln()
void cputs(to_nomodify byte* cputs::s)
byte cputs::c
byte cputs::c#1 c zp[1]:13 1.0E28
byte cputs::c#1 c zp[1]:33 1.0E28
to_nomodify byte* cputs::s
to_nomodify byte* cputs::s#0 s zp[2]:11 5.0E27
to_nomodify byte* cputs::s#13 s zp[2]:11 1.5000000000000497E28
@ -60,19 +60,19 @@ to_nomodify byte* cputs::s#14 s zp[2]:11 1.000000000000001E15
void cscroll()
byte diff(byte diff::a , byte diff::b)
byte diff::a
byte diff::a#0 a zp[1]:13 1.000000000001E12
byte diff::a#1 a zp[1]:13 1.000000000001E12
byte diff::a#2 a zp[1]:13 1.60000000000025E13
byte diff::a#0 a zp[1]:33 1.000000000001E12
byte diff::a#1 a zp[1]:33 1.000000000001E12
byte diff::a#2 a zp[1]:33 1.60000000000025E13
byte diff::b
byte diff::b#0 b zp[1]:6 2.000000000002E12
byte diff::b#1 b zp[1]:6 2.000000000002E12
byte diff::b#2 b zp[1]:6 1.60000000000025E13
byte diff::return
byte diff::return#0 return zp[1]:27 2.000000000002E12
byte diff::return#1 return_1 zp[1]:13 2.000000000002E12
byte diff::return#2 return_1 zp[1]:13 2.0000000000002E13
byte diff::return#3 return_1 zp[1]:13 2.0000000000002E13
byte diff::return#4 return_1 zp[1]:13 5.500000000001E12
byte diff::return#0 return zp[1]:29 2.000000000002E12
byte diff::return#1 return_1 zp[1]:33 2.000000000002E12
byte diff::return#2 return_1 zp[1]:33 2.0000000000002E13
byte diff::return#3 return_1 zp[1]:33 2.0000000000002E13
byte diff::return#4 return_1 zp[1]:33 5.500000000001E12
void gotoxy(byte gotoxy::x , byte gotoxy::y)
word gotoxy::line_offset
const word gotoxy::line_offset#0 line_offset = (word)gotoxy::y#2*$28
@ -81,17 +81,17 @@ const byte gotoxy::x#2 x = 0
byte gotoxy::y
const byte gotoxy::y#2 y = 5
byte legal(byte legal::row , byte legal::column)
byte~ legal::$0 zp[1]:26 2.000000000002E12
byte~ legal::$3 zp[1]:27 3.333333333336667E11
byte~ legal::$4 zp[1]:13 2.000000000002E12
byte~ legal::$0 zp[1]:28 2.000000000002E12
byte~ legal::$3 zp[1]:29 3.333333333336667E11
byte~ legal::$4 zp[1]:33 2.000000000002E12
byte legal::column
byte legal::column#0 column zp[1]:24 1.6666666666683334E11
byte legal::i
byte legal::i#1 i zp[1]:25 2.000000000002E12
byte legal::i#2 i zp[1]:25 4.0000000000039996E11
byte legal::return
byte legal::return#0 return zp[1]:28 2.000000000002E12
byte legal::return#4 return zp[1]:28 3.333333333336667E11
byte legal::return#0 return zp[1]:26 2.000000000002E12
byte legal::return#4 return zp[1]:26 3.333333333336667E11
byte legal::row
byte legal::row#0 row zp[1]:23 1.5789473684226315E11
void main()
@ -106,34 +106,34 @@ const byte* main::s4[3] = ".
"
void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num)
void* memcpy::destination
void* memcpy::destination#2 destination zp[2]:14
void* memcpy::destination#2 destination zp[2]:13
byte* memcpy::dst
byte* memcpy::dst#1 dst zp[2]:14 1.0E46
byte* memcpy::dst#2 dst zp[2]:14 1.0000000000000033E46
byte* memcpy::dst#4 dst zp[2]:14 2.0E32
byte* memcpy::dst#1 dst zp[2]:13 1.0E46
byte* memcpy::dst#2 dst zp[2]:13 1.0000000000000033E46
byte* memcpy::dst#4 dst zp[2]:13 2.0E32
word memcpy::num
void* memcpy::return
void* memcpy::source
void* memcpy::source#2 source zp[2]:30
void* memcpy::source#2 source zp[2]:31
byte* memcpy::src
byte* memcpy::src#1 src zp[2]:30 2.0E46
byte* memcpy::src#2 src zp[2]:30 1.0000000000000025E46
byte* memcpy::src#4 src zp[2]:30 1.0E32
byte* memcpy::src#1 src zp[2]:31 2.0E46
byte* memcpy::src#2 src zp[2]:31 1.0000000000000025E46
byte* memcpy::src#4 src zp[2]:31 1.0E32
byte* memcpy::src_end
byte* memcpy::src_end#0 src_end zp[2]:39 1.2500000000000125E45
void* memset(void* memset::str , byte memset::c , word memset::num)
byte memset::c
byte memset::c#4 c zp[1]:22 1.4285714285714287E45
byte memset::c#4 c zp[1]:30 1.4285714285714287E45
byte* memset::dst
byte* memset::dst#1 dst zp[2]:14 2.0E46
byte* memset::dst#2 dst zp[2]:14 1.3333333333333366E46
byte* memset::dst#4 dst zp[2]:14 2.0E32
byte* memset::dst#1 dst zp[2]:13 2.0E46
byte* memset::dst#2 dst zp[2]:13 1.3333333333333366E46
byte* memset::dst#4 dst zp[2]:13 2.0E32
byte* memset::end
byte* memset::end#0 end zp[2]:39 1.6666666666666835E45
word memset::num
void* memset::return
void* memset::str
void* memset::str#3 str zp[2]:14
void* memset::str#3 str zp[2]:13
void print()
byte print::i
byte print::i#1 i zp[1]:25 2.000000000002E12
@ -154,43 +154,43 @@ const byte* print::s3[2] = "Q"
const byte* print::s4[2] = "-"
struct printf_buffer_number printf_buffer loadstore mem[12] = {}
void printf_number_buffer(byte printf_number_buffer::buffer_sign , byte* printf_number_buffer::buffer_digits , byte printf_number_buffer::format_min_length , byte printf_number_buffer::format_justify_left , byte printf_number_buffer::format_sign_always , byte printf_number_buffer::format_zero_padding , byte printf_number_buffer::format_upper_case , byte printf_number_buffer::format_radix)
word~ printf_number_buffer::$19 zp[2]:30 1.00000000000001E14
word~ printf_number_buffer::$19 zp[2]:31 1.00000000000001E14
struct printf_buffer_number printf_number_buffer::buffer
byte* printf_number_buffer::buffer_digits
byte printf_number_buffer::buffer_sign
byte printf_number_buffer::buffer_sign#0 buffer_sign zp[1]:32 202.0
byte printf_number_buffer::buffer_sign#1 buffer_sign zp[1]:32 202.0
byte printf_number_buffer::buffer_sign#10 buffer_sign zp[1]:32 1.55000000000103E13
byte printf_number_buffer::buffer_sign#2 buffer_sign zp[1]:32 2.0000000000002E13
byte printf_number_buffer::buffer_sign#0 buffer_sign zp[1]:28 202.0
byte printf_number_buffer::buffer_sign#1 buffer_sign zp[1]:28 202.0
byte printf_number_buffer::buffer_sign#10 buffer_sign zp[1]:28 1.55000000000103E13
byte printf_number_buffer::buffer_sign#2 buffer_sign zp[1]:28 2.0000000000002E13
struct printf_format_number printf_number_buffer::format
byte printf_number_buffer::format_justify_left
byte printf_number_buffer::format_justify_left#10 format_justify_left zp[1]:27 6.451612903225871E12
byte printf_number_buffer::format_justify_left#10 format_justify_left zp[1]:24 6.451612903225871E12
byte printf_number_buffer::format_min_length
byte printf_number_buffer::format_min_length#3 format_min_length zp[1]:26 1.00000000000001E13
byte printf_number_buffer::format_min_length#3 format_min_length zp[1]:23 1.00000000000001E13
byte printf_number_buffer::format_radix
byte printf_number_buffer::format_sign_always
byte printf_number_buffer::format_upper_case
byte printf_number_buffer::format_upper_case#10 format_upper_case zp[1]:33 3.846153846153885E12
byte printf_number_buffer::format_upper_case#10 format_upper_case zp[1]:29 3.846153846153885E12
byte printf_number_buffer::format_zero_padding
byte printf_number_buffer::format_zero_padding#10 format_zero_padding zp[1]:29 9.375000000000094E12
byte printf_number_buffer::format_zero_padding#10 format_zero_padding zp[1]:27 9.375000000000094E12
signed byte printf_number_buffer::len
signed byte printf_number_buffer::len#0 len zp[1]:13 1.500000000000015E14
signed byte printf_number_buffer::len#1 len zp[1]:13 2.00000000000002E14
signed byte printf_number_buffer::len#2 len zp[1]:13 3.00000000000003E14
signed byte printf_number_buffer::len#0 len zp[1]:33 1.500000000000015E14
signed byte printf_number_buffer::len#1 len zp[1]:33 2.00000000000002E14
signed byte printf_number_buffer::len#2 len zp[1]:33 3.00000000000003E14
signed byte printf_number_buffer::padding
signed byte printf_number_buffer::padding#1 padding zp[1]:26 1.00000000000001E14
signed byte printf_number_buffer::padding#10 padding zp[1]:26 1.904761904761924E13
signed byte printf_number_buffer::padding#1 padding zp[1]:23 1.00000000000001E14
signed byte printf_number_buffer::padding#10 padding zp[1]:23 1.904761904761924E13
void printf_padding(byte printf_padding::pad , byte printf_padding::length)
byte printf_padding::i
byte printf_padding::i#1 i zp[1]:38 2.0E27
byte printf_padding::i#2 i zp[1]:38 7.500000000000001E26
byte printf_padding::length
byte printf_padding::length#0 length zp[1]:28 2.00000000000002E14
byte printf_padding::length#1 length zp[1]:28 2.00000000000002E14
byte printf_padding::length#2 length zp[1]:28 2.00000000000002E14
byte printf_padding::length#6 length zp[1]:28 1.6666666666671665E26
byte printf_padding::length#0 length zp[1]:26 2.00000000000002E14
byte printf_padding::length#1 length zp[1]:26 2.00000000000002E14
byte printf_padding::length#2 length zp[1]:26 2.00000000000002E14
byte printf_padding::length#6 length zp[1]:26 1.6666666666671665E26
byte printf_padding::pad
byte printf_padding::pad#7 pad zp[1]:13 1.6666666666666666E26
byte printf_padding::pad#7 pad zp[1]:33 1.6666666666666666E26
void printf_string(byte* printf_string::str , byte printf_string::format_min_length , byte printf_string::format_justify_left)
struct printf_format_string printf_string::format
byte printf_string::format_justify_left
@ -237,41 +237,41 @@ dword printf_ulong::uvalue#0 uvalue zp[4]:2 22.0
dword printf_ulong::uvalue#1 uvalue zp[4]:2 22.0
dword printf_ulong::uvalue#2 uvalue zp[4]:2 61.5
__stackcall void queen(byte queen::row)
byte~ queen::$1 zp[1]:28 2.000000000002E12
byte~ queen::$1 zp[1]:26 2.000000000002E12
byte~ queen::$4 zp[1]:23 2.000000000002E12
const byte queen::OFFSET_STACK_ROW = 0
byte queen::column loadstore zp[1]:24 2.9411764706505884E11
byte queen::r loadstore zp[1]:23 2.10526315795E11
volatile byte queen::column loadstore zp[1]:22 2.9411764706505884E11
volatile byte queen::r loadstore zp[1]:21 2.10526315795E11
byte queen::row
byte queen::row#0 row zp[1]:23 202.0
byte queen::row#0 row zp[1]:30 202.0
word strlen(byte* strlen::str)
word strlen::len
word strlen::len#1 len zp[2]:30 1.0E27
word strlen::len#2 len zp[2]:30 5.00000000000025E26
word strlen::len#1 len zp[2]:31 1.0E27
word strlen::len#2 len zp[2]:31 5.00000000000025E26
word strlen::return
word strlen::return#2 return zp[2]:30 2.00000000000002E14
word strlen::return#2 return zp[2]:31 2.00000000000002E14
byte* strlen::str
byte* strlen::str#0 str zp[2]:14 2.0E27
byte* strlen::str#3 str zp[2]:14 1.0E27
byte* strlen::str#0 str zp[2]:13 2.0E27
byte* strlen::str#3 str zp[2]:13 1.0E27
byte* strupr(byte* strupr::str)
byte~ strupr::$0 zp[1]:28 2.0E27
byte~ strupr::$0 zp[1]:26 2.0E27
byte* strupr::return
byte* strupr::src
byte* strupr::src#1 src zp[2]:30 2.0E27
byte* strupr::src#2 src zp[2]:30 7.142857142857143E26
byte* strupr::src#1 src zp[2]:31 2.0E27
byte* strupr::src#2 src zp[2]:31 7.142857142857143E26
byte* strupr::str
const byte* strupr::str#0 str = (byte*)&printf_buffer+OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS
const byte* tod_buffer[] = "00:00:00:00"
void tod_init(byte tod_init::tod_TENTHS , byte tod_init::tod_SEC , byte tod_init::tod_MIN , byte tod_init::tod_HOURS)
struct TIME_OF_DAY tod_init::tod
byte tod_init::tod_HOURS
byte tod_init::tod_HOURS#0 tod_HOURS zp[1]:25 37.33333333333333
byte tod_init::tod_HOURS#0 tod_HOURS zp[1]:27 37.33333333333333
byte tod_init::tod_MIN
byte tod_init::tod_MIN#0 tod_MIN zp[1]:24 22.4
byte tod_init::tod_MIN#0 tod_MIN zp[1]:26 22.4
byte tod_init::tod_SEC
byte tod_init::tod_SEC#0 tod_SEC zp[1]:23 16.0
byte tod_init::tod_SEC#0 tod_SEC zp[1]:25 16.0
byte tod_init::tod_TENTHS
byte tod_init::tod_TENTHS#0 tod_TENTHS zp[1]:22 12.444444444444443
byte tod_init::tod_TENTHS#0 tod_TENTHS zp[1]:24 12.444444444444443
struct TIME_OF_DAY tod_read()
byte tod_read::hours
byte tod_read::mins
@ -299,18 +299,18 @@ byte~ tod_str::$0 zp[1]:29 202.0
byte~ tod_str::$1 zp[1]:29 202.0
byte~ tod_str::$10 zp[1]:26 202.0
byte~ tod_str::$11 zp[1]:26 202.0
byte~ tod_str::$12 zp[1]:38 202.0
byte~ tod_str::$13 zp[1]:38 202.0
byte~ tod_str::$12 zp[1]:33 202.0
byte~ tod_str::$13 zp[1]:33 202.0
byte~ tod_str::$14 zp[1]:25 202.0
byte~ tod_str::$15 zp[1]:25 202.0
byte~ tod_str::$2 zp[1]:28 202.0
byte~ tod_str::$3 zp[1]:28 202.0
byte~ tod_str::$4 zp[1]:32 202.0
byte~ tod_str::$5 zp[1]:32 202.0
byte~ tod_str::$4 zp[1]:38 202.0
byte~ tod_str::$5 zp[1]:38 202.0
byte~ tod_str::$6 zp[1]:27 202.0
byte~ tod_str::$7 zp[1]:27 202.0
byte~ tod_str::$8 zp[1]:33 202.0
byte~ tod_str::$9 zp[1]:33 202.0
byte~ tod_str::$8 zp[1]:30 202.0
byte~ tod_str::$9 zp[1]:30 202.0
byte* tod_str::return
struct TIME_OF_DAY tod_str::tod
byte tod_str::tod_HOURS
@ -323,66 +323,66 @@ byte tod_str::tod_TENTHS
byte tod_str::tod_TENTHS#0 tod_TENTHS zp[1]:25 8.52
byte toupper(byte toupper::ch)
byte toupper::ch
byte toupper::ch#0 ch zp[1]:28 1.6999999999999998E28
byte toupper::ch#0 ch zp[1]:26 1.6999999999999998E28
byte toupper::return
byte toupper::return#0 return zp[1]:28 2.0E28
byte toupper::return#2 return zp[1]:28 1.0333333333333333E28
byte toupper::return#3 return zp[1]:28 2.0E27
byte toupper::return#0 return zp[1]:26 2.0E28
byte toupper::return#2 return zp[1]:26 1.0333333333333333E28
byte toupper::return#3 return zp[1]:26 2.0E27
void uctoa(byte uctoa::value , byte* uctoa::buffer , byte uctoa::radix)
byte* uctoa::buffer
byte* uctoa::buffer#11 buffer zp[2]:14 3.3333333333350004E25
byte* uctoa::buffer#14 buffer zp[2]:14 1.5000000000000002E26
byte* uctoa::buffer#3 buffer zp[2]:14 2.00000000000002E14
byte* uctoa::buffer#4 buffer zp[2]:14 2.0E26
byte* uctoa::buffer#11 buffer zp[2]:13 3.3333333333350004E25
byte* uctoa::buffer#14 buffer zp[2]:13 1.5000000000000002E26
byte* uctoa::buffer#3 buffer zp[2]:13 2.00000000000002E14
byte* uctoa::buffer#4 buffer zp[2]:13 2.0E26
byte uctoa::digit
byte uctoa::digit#1 digit zp[1]:32 2.0E26
byte uctoa::digit#2 digit zp[1]:32 3.076923076923077E25
byte uctoa::digit#1 digit zp[1]:28 2.0E26
byte uctoa::digit#2 digit zp[1]:28 3.076923076923077E25
byte uctoa::digit_value
byte uctoa::digit_value#0 digit_value zp[1]:38 6.000000000000001E25
byte* uctoa::digit_values
byte uctoa::max_digits
byte uctoa::radix
byte uctoa::started
byte uctoa::started#2 started zp[1]:13 6.000000000000001E25
byte uctoa::started#4 started zp[1]:13 1.0E26
byte uctoa::started#2 started zp[1]:33 6.000000000000001E25
byte uctoa::started#4 started zp[1]:33 1.0E26
byte uctoa::value
byte uctoa::value#0 value zp[1]:33 1.0E26
byte uctoa::value#1 value zp[1]:33 5.5000000000001E13
byte uctoa::value#2 value zp[1]:33 6.666666666670001E25
byte uctoa::value#6 value zp[1]:33 1.5000000000000002E26
byte uctoa::value#0 value zp[1]:29 1.0E26
byte uctoa::value#1 value zp[1]:29 5.5000000000001E13
byte uctoa::value#2 value zp[1]:29 6.666666666670001E25
byte uctoa::value#6 value zp[1]:29 1.5000000000000002E26
byte uctoa_append(byte* uctoa_append::buffer , byte uctoa_append::value , byte uctoa_append::sub)
byte* uctoa_append::buffer
byte* uctoa_append::buffer#0 buffer zp[2]:14 1.3750000000000001E26
byte* uctoa_append::buffer#0 buffer zp[2]:13 1.3750000000000001E26
byte uctoa_append::digit
byte uctoa_append::digit#1 digit zp[1]:28 1.0E40
byte uctoa_append::digit#2 digit zp[1]:28 1.00000000000005E40
byte uctoa_append::digit#1 digit zp[1]:26 1.0E40
byte uctoa_append::digit#2 digit zp[1]:26 1.00000000000005E40
byte uctoa_append::return
byte uctoa_append::return#0 return zp[1]:33 2.0E26
byte uctoa_append::return#0 return zp[1]:29 2.0E26
byte uctoa_append::sub
byte uctoa_append::sub#0 sub zp[1]:38 3.33333333333335E39
byte uctoa_append::value
byte uctoa_append::value#0 value zp[1]:33 3.666666666666667E26
byte uctoa_append::value#1 value zp[1]:33 2.0E40
byte uctoa_append::value#2 value zp[1]:33 5.0000000000001833E39
byte uctoa_append::value#0 value zp[1]:29 3.666666666666667E26
byte uctoa_append::value#1 value zp[1]:29 2.0E40
byte uctoa_append::value#2 value zp[1]:29 5.0000000000001833E39
void ultoa(dword ultoa::value , byte* ultoa::buffer , byte ultoa::radix)
byte~ ultoa::$10 zp[1]:33 2.00000000000002E14
byte~ ultoa::$11 zp[1]:32 2002.0
byte~ ultoa::$10 zp[1]:38 2.00000000000002E14
byte~ ultoa::$11 zp[1]:33 2002.0
byte* ultoa::buffer
byte* ultoa::buffer#11 buffer zp[2]:11 2.8571428571571855E13
byte* ultoa::buffer#14 buffer zp[2]:11 1.500000000000015E14
byte* ultoa::buffer#3 buffer zp[2]:11 2002.0
byte* ultoa::buffer#4 buffer zp[2]:11 2.00000000000002E14
byte ultoa::digit
byte ultoa::digit#1 digit zp[1]:27 2.00000000000002E14
byte ultoa::digit#2 digit zp[1]:27 2.8571428571428855E13
byte ultoa::digit#1 digit zp[1]:24 2.00000000000002E14
byte ultoa::digit#2 digit zp[1]:24 2.8571428571428855E13
dword ultoa::digit_value
dword ultoa::digit_value#0 digit_value zp[4]:34 6.000000000000059E13
dword* ultoa::digit_values
byte ultoa::max_digits
byte ultoa::radix
byte ultoa::started
byte ultoa::started#2 started zp[1]:29 5.00000000000005E13
byte ultoa::started#4 started zp[1]:29 1.00000000000001E14
byte ultoa::started#2 started zp[1]:27 5.00000000000005E13
byte ultoa::started#4 started zp[1]:27 1.00000000000001E14
dword ultoa::value
dword ultoa::value#0 value zp[4]:7 1.00000000000001E14
dword ultoa::value#1 value zp[4]:7 551.0
@ -403,8 +403,8 @@ dword ultoa_append::value#0 value zp[4]:7 3.666666666666674E14
dword ultoa_append::value#1 value zp[4]:7 2.0E27
dword ultoa_append::value#2 value zp[4]:7 5.0000000000018335E26
void utoa(word utoa::value , byte* utoa::buffer , byte utoa::radix)
byte~ utoa::$10 zp[1]:29 20002.0
byte~ utoa::$11 zp[1]:28 2002.0
byte~ utoa::$10 zp[1]:30 20002.0
byte~ utoa::$11 zp[1]:38 2002.0
byte* utoa::buffer
byte* utoa::buffer#11 buffer zp[2]:11 3000.4285714285716
byte* utoa::buffer#14 buffer zp[2]:11 15001.5
@ -414,56 +414,56 @@ byte utoa::digit
byte utoa::digit#1 digit zp[1]:6 20002.0
byte utoa::digit#2 digit zp[1]:6 2857.4285714285716
word utoa::digit_value
word utoa::digit_value#0 digit_value zp[2]:30 6000.6
word utoa::digit_value#0 digit_value zp[2]:31 6000.6
word* utoa::digit_values
byte utoa::max_digits
const byte utoa::max_digits#1 max_digits = 5
byte utoa::radix
byte utoa::started
byte utoa::started#2 started zp[1]:26 5000.5
byte utoa::started#4 started zp[1]:26 10001.0
byte utoa::started#2 started zp[1]:23 5000.5
byte utoa::started#4 started zp[1]:23 10001.0
word utoa::value
word utoa::value#0 value zp[2]:14 10001.0
word utoa::value#2 value zp[2]:14 5714.857142857143
word utoa::value#6 value zp[2]:14 15001.5
word utoa::value#0 value zp[2]:13 10001.0
word utoa::value#2 value zp[2]:13 5714.857142857143
word utoa::value#6 value zp[2]:13 15001.5
word utoa_append(byte* utoa_append::buffer , word utoa_append::value , word utoa_append::sub)
byte* utoa_append::buffer
byte* utoa_append::buffer#0 buffer zp[2]:11 13750.25
byte utoa_append::digit
byte utoa_append::digit#1 digit zp[1]:28 1.0000001E7
byte utoa_append::digit#2 digit zp[1]:28 1.00500015E7
byte utoa_append::digit#1 digit zp[1]:26 1.0000001E7
byte utoa_append::digit#2 digit zp[1]:26 1.00500015E7
word utoa_append::return
word utoa_append::return#0 return zp[2]:14 20002.0
word utoa_append::return#0 return zp[2]:13 20002.0
word utoa_append::sub
word utoa_append::sub#0 sub zp[2]:30 3335000.5
word utoa_append::sub#0 sub zp[2]:31 3335000.5
word utoa_append::value
word utoa_append::value#0 value zp[2]:14 36667.33333333333
word utoa_append::value#1 value zp[2]:14 2.0000002E7
word utoa_append::value#2 value zp[2]:14 5018334.166666666
word utoa_append::value#0 value zp[2]:13 36667.33333333333
word utoa_append::value#1 value zp[2]:13 2.0000002E7
word utoa_append::value#2 value zp[2]:13 5018334.166666666
zp[4]:2 [ printf_ulong::uvalue#2 printf_ulong::uvalue#0 printf_ulong::uvalue#1 count ]
zp[1]:6 [ utoa::digit#2 utoa::digit#1 diff::b#2 diff::b#0 diff::b#1 clrscr::c#2 clrscr::c#1 print::j#2 print::j#1 ]
zp[4]:7 [ ultoa::value#2 ultoa::value#6 ultoa::value#1 ultoa::value#0 ultoa_append::value#2 ultoa_append::value#0 ultoa_append::value#1 ultoa_append::return#0 ]
zp[2]:11 [ ultoa::buffer#11 ultoa::buffer#14 ultoa::buffer#4 ultoa::buffer#3 ultoa_append::buffer#0 utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 utoa::buffer#3 utoa_append::buffer#0 cputs::s#13 cputs::s#14 cputs::s#0 clrscr::line_text#5 clrscr::line_text#1 ]
zp[1]:13 [ uctoa::started#2 uctoa::started#4 printf_number_buffer::len#2 printf_number_buffer::len#0 printf_number_buffer::len#1 cputc::c#3 cputc::c#0 cputc::c#2 cputc::c#1 printf_padding::pad#7 cputs::c#1 diff::a#2 diff::a#0 diff::a#1 diff::return#4 diff::return#2 diff::return#3 diff::return#1 legal::$4 ]
zp[2]:14 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 memcpy::destination#2 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 strlen::str#3 strlen::str#0 uctoa::buffer#11 uctoa::buffer#14 uctoa::buffer#4 uctoa::buffer#3 uctoa_append::buffer#0 utoa::value#2 utoa::value#6 utoa::value#0 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 utoa_append::return#0 clrscr::line_cols#5 clrscr::line_cols#1 ]
zp[1]:16 [ conio_cursor_x ]
zp[1]:17 [ conio_cursor_y ]
zp[2]:18 [ conio_line_text ]
zp[2]:20 [ conio_line_color ]
zp[1]:22 [ tod_init::tod_TENTHS#0 memset::c#4 ]
zp[1]:23 [ tod_init::tod_SEC#0 queen::row#0 queen::r legal::row#0 queen::$4 ]
zp[1]:24 [ tod_init::tod_MIN#0 queen::column legal::column#0 ]
zp[1]:25 [ tod_read::return_TENTHS#2 tod_str::tod_TENTHS#0 tod_read::return_TENTHS#0 tod_str::$14 tod_str::$15 tod_init::tod_HOURS#0 print::i#2 print::i#1 printf_uchar::uvalue#2 printf_uchar::uvalue#1 printf_uchar::uvalue#0 print::i1#2 print::i1#1 legal::i#2 legal::i#1 ]
zp[1]:26 [ legal::$0 tod_read::return_SEC#2 tod_str::tod_SEC#0 tod_read::return_SEC#0 tod_str::$10 tod_str::$11 printf_number_buffer::format_min_length#3 printf_number_buffer::padding#10 printf_number_buffer::padding#1 utoa::started#2 utoa::started#4 ]
zp[1]:27 [ diff::return#0 legal::$3 tod_read::return_MIN#2 tod_str::tod_MIN#0 tod_read::return_MIN#0 tod_str::$6 tod_str::$7 ultoa::digit#2 ultoa::digit#1 printf_number_buffer::format_justify_left#10 ]
zp[1]:28 [ utoa::$11 tod_read::return_HOURS#2 tod_str::tod_HOURS#0 tod_read::return_HOURS#0 tod_str::$2 tod_str::$3 clrscr::l#2 clrscr::l#1 legal::return#4 legal::return#0 queen::$1 toupper::return#2 toupper::return#0 toupper::ch#0 toupper::return#3 strupr::$0 uctoa_append::digit#2 uctoa_append::digit#1 printf_padding::length#6 printf_padding::length#1 printf_padding::length#2 printf_padding::length#0 utoa_append::digit#2 utoa_append::digit#1 ]
zp[1]:29 [ utoa::$10 tod_str::$0 tod_str::$1 ultoa::started#2 ultoa::started#4 printf_number_buffer::format_zero_padding#10 ]
zp[2]:30 [ utoa::digit_value#0 utoa_append::sub#0 strlen::len#2 strlen::len#1 strlen::return#2 printf_number_buffer::$19 memcpy::source#2 memcpy::src#2 memcpy::src#4 memcpy::src#1 strupr::src#2 strupr::src#1 ]
zp[1]:32 [ ultoa::$11 tod_str::$4 tod_str::$5 uctoa::digit#2 uctoa::digit#1 printf_number_buffer::buffer_sign#10 printf_number_buffer::buffer_sign#2 printf_number_buffer::buffer_sign#1 printf_number_buffer::buffer_sign#0 ]
zp[1]:33 [ ultoa::$10 tod_str::$8 tod_str::$9 uctoa::value#2 uctoa::value#6 uctoa::value#1 uctoa::value#0 uctoa_append::value#2 uctoa_append::value#0 uctoa_append::value#1 uctoa_append::return#0 printf_number_buffer::format_upper_case#10 ]
zp[2]:13 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 memcpy::destination#2 memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 strlen::str#3 strlen::str#0 uctoa::buffer#11 uctoa::buffer#14 uctoa::buffer#4 uctoa::buffer#3 uctoa_append::buffer#0 utoa::value#2 utoa::value#6 utoa::value#0 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 utoa_append::return#0 clrscr::line_cols#5 clrscr::line_cols#1 ]
zp[1]:15 [ conio_cursor_x ]
zp[1]:16 [ conio_cursor_y ]
zp[2]:17 [ conio_line_text ]
zp[2]:19 [ conio_line_color ]
zp[1]:21 [ queen::r ]
zp[1]:22 [ queen::column ]
zp[1]:23 [ queen::$4 legal::row#0 printf_number_buffer::format_min_length#3 printf_number_buffer::padding#10 printf_number_buffer::padding#1 utoa::started#2 utoa::started#4 ]
zp[1]:24 [ tod_init::tod_TENTHS#0 legal::column#0 ultoa::digit#2 ultoa::digit#1 printf_number_buffer::format_justify_left#10 ]
zp[1]:25 [ tod_read::return_TENTHS#2 tod_str::tod_TENTHS#0 tod_read::return_TENTHS#0 tod_str::$14 tod_str::$15 tod_init::tod_SEC#0 print::i#2 print::i#1 printf_uchar::uvalue#2 printf_uchar::uvalue#1 printf_uchar::uvalue#0 print::i1#2 print::i1#1 legal::i#2 legal::i#1 ]
zp[1]:26 [ tod_read::return_SEC#2 tod_str::tod_SEC#0 tod_read::return_SEC#0 tod_str::$10 tod_str::$11 tod_init::tod_MIN#0 clrscr::l#2 clrscr::l#1 legal::return#4 legal::return#0 queen::$1 toupper::return#2 toupper::return#0 toupper::ch#0 toupper::return#3 strupr::$0 uctoa_append::digit#2 uctoa_append::digit#1 printf_padding::length#6 printf_padding::length#1 printf_padding::length#2 printf_padding::length#0 utoa_append::digit#2 utoa_append::digit#1 ]
zp[1]:27 [ tod_read::return_MIN#2 tod_str::tod_MIN#0 tod_read::return_MIN#0 tod_str::$6 tod_str::$7 tod_init::tod_HOURS#0 ultoa::started#2 ultoa::started#4 printf_number_buffer::format_zero_padding#10 ]
zp[1]:28 [ legal::$0 tod_read::return_HOURS#2 tod_str::tod_HOURS#0 tod_read::return_HOURS#0 tod_str::$2 tod_str::$3 uctoa::digit#2 uctoa::digit#1 printf_number_buffer::buffer_sign#10 printf_number_buffer::buffer_sign#2 printf_number_buffer::buffer_sign#1 printf_number_buffer::buffer_sign#0 ]
zp[1]:29 [ tod_str::$0 tod_str::$1 diff::return#0 legal::$3 uctoa::value#2 uctoa::value#6 uctoa::value#1 uctoa::value#0 uctoa_append::value#2 uctoa_append::value#0 uctoa_append::value#1 uctoa_append::return#0 printf_number_buffer::format_upper_case#10 ]
zp[1]:30 [ utoa::$10 tod_str::$8 tod_str::$9 queen::row#0 memset::c#4 ]
zp[2]:31 [ utoa::digit_value#0 utoa_append::sub#0 strlen::len#2 strlen::len#1 strlen::return#2 printf_number_buffer::$19 memcpy::source#2 memcpy::src#2 memcpy::src#4 memcpy::src#1 strupr::src#2 strupr::src#1 ]
zp[1]:33 [ ultoa::$11 tod_str::$12 tod_str::$13 uctoa::started#2 uctoa::started#4 printf_number_buffer::len#2 printf_number_buffer::len#0 printf_number_buffer::len#1 cputc::c#3 cputc::c#0 cputc::c#2 cputc::c#1 printf_padding::pad#7 cputs::c#1 diff::a#2 diff::a#0 diff::a#1 diff::return#4 diff::return#2 diff::return#3 diff::return#1 legal::$4 ]
zp[4]:34 [ ultoa::digit_value#0 ultoa_append::sub#0 ]
zp[1]:38 [ uctoa::digit_value#0 uctoa_append::sub#0 tod_str::$12 tod_str::$13 ultoa_append::digit#2 ultoa_append::digit#1 printf_padding::i#2 printf_padding::i#1 ]
zp[1]:38 [ uctoa::digit_value#0 uctoa_append::sub#0 ultoa::$10 utoa::$11 tod_str::$4 tod_str::$5 ultoa_append::digit#2 ultoa_append::digit#1 printf_padding::i#2 printf_padding::i#1 ]
zp[2]:39 [ memset::end#0 memcpy::src_end#0 ]
mem[12] [ printf_buffer ]
mem[4] [ TOD_ZERO ]

View File

@ -18,7 +18,11 @@ fn1: {
}
main: {
.label f = 2
ldx #0
// f
lda #<0
sta.z f
sta.z f+1
tax
__b2:
// ++i;
inx
@ -28,21 +32,23 @@ main: {
// if((i&1)==0)
cmp #0
beq __b3
// f = &fn2
lda #<fn2
sta.z f
lda #>fn2
sta.z f+1
jmp __b4
__b3:
lda #<fn1
sta.z f
lda #>fn1
sta.z f+1
__b4:
// kickasm
jsr ff
jmp __b2
__b3:
// f = &fn1
lda #<fn1
sta.z f
lda #>fn1
sta.z f+1
jmp __b4
}
// Inline KickAsm function
ff:

View File

@ -17,7 +17,7 @@ fn1::@return: scope:[fn1] from fn1
void main()
main: scope:[main] from
[4] phi()
[4] main::f = (void()*) 0
to:main::@1
main::@1: scope:[main] from main main::@4
[5] main::i#2 = phi( main/0, main::@4/main::i#1 )
@ -26,12 +26,14 @@ main::@2: scope:[main] from main::@1
[6] main::i#1 = ++ main::i#2
[7] main::$0 = main::i#1 & 1
[8] if(main::$0==0) goto main::@3
to:main::@5
main::@5: scope:[main] from main::@2
[9] main::f = &fn2
to:main::@4
main::@3: scope:[main] from main::@2
[9] phi()
to:main::@4
main::@4: scope:[main] from main::@2 main::@3
[10] main::f#3 = phi( main::@3/&fn1, main::@2/&fn2 )
kickasm( uses main::f#3 uses ff) {{ jsr ff
main::@4: scope:[main] from main::@3 main::@5
kickasm( uses main::f uses ff) {{ jsr ff
}}
to:main::@1
main::@3: scope:[main] from main::@2
[11] main::f = &fn1
to:main::@4

View File

@ -1,12 +1,14 @@
Resolved forward reference fn1 to void fn1()
Resolved forward reference fn2 to void fn2()
Resolved forward reference ff to ff
Setting inferred volatile on symbol affected by address-of: main::f in kickasm( uses main::f uses ff) {{ jsr ff
}}
CONTROL FLOW GRAPH SSA
void main()
main: scope:[main] from __start
main::f#0 = (void()*) 0
main::f = (void()*) 0
main::i#0 = 0
to:main::@1
main::@1: scope:[main] from main main::@4
@ -22,16 +24,15 @@ main::@2: scope:[main] from main::@1
to:main::@5
main::@3: scope:[main] from main::@2
main::i#5 = phi( main::@2/main::i#1 )
main::f#1 = &fn1
main::f = &fn1
to:main::@4
main::@5: scope:[main] from main::@2
main::i#6 = phi( main::@2/main::i#1 )
main::f#2 = &fn2
main::f = &fn2
to:main::@4
main::@4: scope:[main] from main::@3 main::@5
main::i#4 = phi( main::@3/main::i#5, main::@5/main::i#6 )
main::f#3 = phi( main::@3/main::f#1, main::@5/main::f#2 )
kickasm( uses main::f#3 uses ff) {{ jsr ff
kickasm( uses main::f uses ff) {{ jsr ff
}}
to:main::@1
main::@return: scope:[main] from main::@1
@ -75,11 +76,7 @@ const nomodify byte* fn2::BG_COLOR = (byte*)$d021
void main()
number~ main::$0
bool~ main::$1
void()* main::f
void()* main::f#0
void()* main::f#1
void()* main::f#2
void()* main::f#3
volatile void()* main::f loadstore
byte main::i
byte main::i#0
byte main::i#1
@ -109,15 +106,10 @@ Alias main::i#1 = main::i#4
Successful SSA optimization Pass2AliasElimination
Simple Condition main::$1 [7] if(main::$0==0) goto main::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant main::f#0 = (void()*) 0
Constant main::i#0 = 0
Constant main::f#1 = &fn1
Constant main::f#2 = &fn2
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [3] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Removing unused procedure __start
@ -126,23 +118,13 @@ Removing unused procedure block __start::@1
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Inlining constant with var siblings main::i#0
Inlining constant with var siblings main::f#1
Inlining constant with var siblings main::f#2
Constant inlined main::i#0 = 0
Constant inlined main::f#2 = &fn2
Constant inlined main::f#1 = &fn1
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@5
Adding NOP phi() at start of main::@3
CALL GRAPH
Created 2 initial phi equivalence classes
Coalesced [12] main::i#7 = main::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block label main::@5
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@3
Created 1 initial phi equivalence classes
Coalesced [11] main::i#7 = main::i#1
Coalesced down to 1 phi equivalence classes
FINAL CONTROL FLOW GRAPH
@ -164,7 +146,7 @@ fn1::@return: scope:[fn1] from fn1
void main()
main: scope:[main] from
[4] phi()
[4] main::f = (void()*) 0
to:main::@1
main::@1: scope:[main] from main main::@4
[5] main::i#2 = phi( main/0, main::@4/main::i#1 )
@ -173,15 +155,17 @@ main::@2: scope:[main] from main::@1
[6] main::i#1 = ++ main::i#2
[7] main::$0 = main::i#1 & 1
[8] if(main::$0==0) goto main::@3
to:main::@5
main::@5: scope:[main] from main::@2
[9] main::f = &fn2
to:main::@4
main::@3: scope:[main] from main::@2
[9] phi()
to:main::@4
main::@4: scope:[main] from main::@2 main::@3
[10] main::f#3 = phi( main::@3/&fn1, main::@2/&fn2 )
kickasm( uses main::f#3 uses ff) {{ jsr ff
main::@4: scope:[main] from main::@3 main::@5
kickasm( uses main::f uses ff) {{ jsr ff
}}
to:main::@1
main::@3: scope:[main] from main::@2
[11] main::f = &fn1
to:main::@4
VARIABLE REGISTER WEIGHTS
@ -189,39 +173,46 @@ void fn1()
void fn2()
void main()
byte~ main::$0 22.0
void()* main::f
void()* main::f#3
volatile void()* main::f loadstore 12.0
byte main::i
byte main::i#1 5.5
byte main::i#2 22.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::f#3 ]
Added variable main::f to live range equivalence class [ main::f ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::f#3 ]
[ main::f ]
[ main::$0 ]
Allocated zp[1]:2 [ main::i#2 main::i#1 ]
Allocated zp[2]:3 [ main::f#3 ]
Allocated zp[2]:3 [ main::f ]
Allocated zp[1]:5 [ main::$0 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[2]:3 [ main::f#3 ] : zp[2]:3 ,
Statement [4] main::f = (void()*) 0 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [9] main::f = &fn2 [ main::f main::i#1 ] ( [ main::f main::i#1 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Statement [11] main::f = &fn1 [ main::f main::i#1 ] ( [ main::f main::i#1 ] { } ) always clobbers reg byte a
Statement [4] main::f = (void()*) 0 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [7] main::$0 = main::i#1 & 1 [ main::i#1 main::$0 ] ( [ main::i#1 main::$0 ] { } ) always clobbers reg byte a
Statement [9] main::f = &fn2 [ main::f main::i#1 ] ( [ main::f main::i#1 ] { } ) always clobbers reg byte a
Statement [11] main::f = &fn1 [ main::f main::i#1 ] ( [ main::f main::i#1 ] { } ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y ,
Potential registers zp[2]:3 [ main::f ] : zp[2]:3 ,
Potential registers zp[1]:5 [ main::$0 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 27.5: zp[1]:2 [ main::i#2 main::i#1 ] 22: zp[1]:5 [ main::$0 ] 0: zp[2]:3 [ main::f#3 ]
Uplift Scope [main] 27.5: zp[1]:2 [ main::i#2 main::i#1 ] 22: zp[1]:5 [ main::$0 ] 12: zp[2]:3 [ main::f ]
Uplift Scope [fn1]
Uplift Scope [fn2]
Uplift Scope []
Uplifting [main] best 3095 combination reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$0 ] zp[2]:3 [ main::f#3 ]
Uplifting [fn1] best 3095 combination
Uplifting [fn2] best 3095 combination
Uplifting [] best 3095 combination
Allocated (was zp[2]:3) zp[2]:2 [ main::f#3 ]
Uplifting [main] best 3105 combination reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$0 ] zp[2]:3 [ main::f ]
Uplifting [fn1] best 3105 combination
Uplifting [fn2] best 3105 combination
Uplifting [] best 3105 combination
Allocated (was zp[2]:3) zp[2]:2 [ main::f ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -256,6 +247,11 @@ fn1: {
// main
main: {
.label f = 2
// [4] main::f = (void()*) 0 -- pprz1=pprc1
lda #<0
sta.z f
lda #>0
sta.z f+1
// [5] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [5] phi main::i#2 = 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
@ -273,37 +269,33 @@ main: {
and #1
// [8] if(main::$0==0) goto main::@3 -- vbuaa_eq_0_then_la1
cmp #0
beq __b3_from___b2
// [10] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
__b4_from___b2:
// [10] phi main::f#3 = &fn2 [phi:main::@2->main::@4#0] -- pprz1=pprc1
beq __b3
jmp __b5
// main::@5
__b5:
// [9] main::f = &fn2 -- pprz1=pprc1
lda #<fn2
sta.z f
lda #>fn2
sta.z f+1
jmp __b4
// [9] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
__b3_from___b2:
jmp __b3
// main::@3
__b3:
// [10] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
__b4_from___b3:
// [10] phi main::f#3 = &fn1 [phi:main::@3->main::@4#0] -- pprz1=pprc1
lda #<fn1
sta.z f
lda #>fn1
sta.z f+1
jmp __b4
// main::@4
__b4:
// kickasm( uses main::f#3 uses ff) {{ jsr ff }}
// kickasm( uses main::f uses ff) {{ jsr ff }}
jsr ff
// [5] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
__b1_from___b4:
// [5] phi main::i#2 = main::i#1 [phi:main::@4->main::@1#0] -- register_copy
jmp __b1
// main::@3
__b3:
// [11] main::f = &fn1 -- pprz1=pprc1
lda #<fn1
sta.z f
lda #>fn1
sta.z f+1
jmp __b4
}
// File Data
// Inline KickAsm function
@ -316,21 +308,21 @@ Removing instruction jmp __breturn
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __b5
Removing instruction jmp __b4
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b3_from___b2 with __b3
Removing instruction lda #>0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __b1 with __b2
Removing instruction __b1:
Removing instruction __b3_from___b2:
Removing instruction __b4_from___b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __breturn:
Removing instruction __breturn:
Removing instruction __b1_from_main:
Removing instruction __b4_from___b2:
Removing instruction __b5:
Removing instruction __b1_from___b4:
Succesful ASM optimization Pass5UnusedLabelElimination
Replacing instruction ldx #0 with TAX
FINAL SYMBOL TABLE
const byte* ff[] = kickasm {{ jmp (main.f)
@ -341,19 +333,18 @@ void fn2()
const nomodify byte* fn2::BG_COLOR = (byte*) 53281
void main()
byte~ main::$0 reg byte a 22.0
void()* main::f
void()* main::f#3 f zp[2]:2
volatile void()* main::f loadstore zp[2]:2 12.0
byte main::i
byte main::i#1 reg byte x 5.5
byte main::i#2 reg byte x 22.0
reg byte x [ main::i#2 main::i#1 ]
zp[2]:2 [ main::f#3 ]
zp[2]:2 [ main::f ]
reg byte a [ main::$0 ]
FINAL ASSEMBLER
Score: 2969
Score: 2977
// File Comments
// Tests creating and assigning pointers to non-args no-return functions - plus inline kickasm-based calling
@ -387,9 +378,14 @@ fn1: {
// main
main: {
.label f = 2
// f
// [4] main::f = (void()*) 0 -- pprz1=pprc1
lda #<0
sta.z f
sta.z f+1
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi main::i#2 = 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
tax
// main::@1
// main::@2
__b2:
@ -404,31 +400,31 @@ main: {
// [8] if(main::$0==0) goto main::@3 -- vbuaa_eq_0_then_la1
cmp #0
beq __b3
// [10] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
// [10] phi main::f#3 = &fn2 [phi:main::@2->main::@4#0] -- pprz1=pprc1
// main::@5
// f = &fn2
// [9] main::f = &fn2 -- pprz1=pprc1
lda #<fn2
sta.z f
lda #>fn2
sta.z f+1
jmp __b4
// [9] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
// main::@3
__b3:
// [10] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
// [10] phi main::f#3 = &fn1 [phi:main::@3->main::@4#0] -- pprz1=pprc1
lda #<fn1
sta.z f
lda #>fn1
sta.z f+1
// main::@4
__b4:
// kickasm
// kickasm( uses main::f#3 uses ff) {{ jsr ff }}
// kickasm( uses main::f uses ff) {{ jsr ff }}
jsr ff
// [5] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
// [5] phi main::i#2 = main::i#1 [phi:main::@4->main::@1#0] -- register_copy
jmp __b2
// main::@3
__b3:
// f = &fn1
// [11] main::f = &fn1 -- pprz1=pprc1
lda #<fn1
sta.z f
lda #>fn1
sta.z f+1
jmp __b4
}
// File Data
// Inline KickAsm function

View File

@ -6,12 +6,11 @@ void fn2()
const nomodify byte* fn2::BG_COLOR = (byte*) 53281
void main()
byte~ main::$0 reg byte a 22.0
void()* main::f
void()* main::f#3 f zp[2]:2
volatile void()* main::f loadstore zp[2]:2 12.0
byte main::i
byte main::i#1 reg byte x 5.5
byte main::i#2 reg byte x 22.0
reg byte x [ main::i#2 main::i#1 ]
zp[2]:2 [ main::f#3 ]
zp[2]:2 [ main::f ]
reg byte a [ main::$0 ]

View File

@ -59,9 +59,9 @@ main: {
enableDLI: {
.label dliptr = $80
// asm
lda #<dliptr
lda dliptr
sta dlivec
lda #>dliptr
lda dliptr+1
sta dlivec+1
jmp !+
dlivec:

View File

@ -28,9 +28,9 @@ main::@return: scope:[main] from main::@1
[8] return
to:@return
void enableDLI(void* enableDLI::dliptr)
void enableDLI(volatile void* enableDLI::dliptr)
enableDLI: scope:[enableDLI] from main main::@1
asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
to:enableDLI::@return
enableDLI::@return: scope:[enableDLI] from enableDLI
[10] return

View File

@ -1,5 +1,6 @@
Resolved forward reference fn1 to void fn1()
Resolved forward reference fn2 to void fn2()
Setting inferred volatile on symbol affected by address-of: enableDLI::dliptr in asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
Inlined call call __init
CONTROL FLOW GRAPH SSA
@ -35,9 +36,9 @@ fn2::@return: scope:[fn2] from fn2
return
to:@return
void enableDLI(void* enableDLI::dliptr)
void enableDLI(volatile void* enableDLI::dliptr)
enableDLI: scope:[enableDLI] from main main::@1
asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
to:enableDLI::@return
enableDLI::@return: scope:[enableDLI] from enableDLI
return
@ -59,8 +60,8 @@ __start::@return: scope:[__start] from __start::@2
SYMBOL TABLE SSA
void __start()
void enableDLI(void* enableDLI::dliptr)
void* enableDLI::dliptr loadstore
void enableDLI(volatile void* enableDLI::dliptr)
volatile void* enableDLI::dliptr loadstore
void fn1()
void fn2()
void main()
@ -125,9 +126,9 @@ main::@return: scope:[main] from main::@1
[8] return
to:@return
void enableDLI(void* enableDLI::dliptr)
void enableDLI(volatile void* enableDLI::dliptr)
enableDLI: scope:[enableDLI] from main main::@1
asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
to:enableDLI::@return
enableDLI::@return: scope:[enableDLI] from enableDLI
[10] return
@ -135,8 +136,8 @@ enableDLI::@return: scope:[enableDLI] from enableDLI
VARIABLE REGISTER WEIGHTS
void enableDLI(void* enableDLI::dliptr)
void* enableDLI::dliptr loadstore 2.0
void enableDLI(volatile void* enableDLI::dliptr)
volatile void* enableDLI::dliptr loadstore 2.0
void fn1()
void fn2()
void main()
@ -151,7 +152,7 @@ Statement [0] *r = 2 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [2] *r = 1 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [4] enableDLI::dliptr = (void*)&fn1 [ enableDLI::dliptr ] ( [ enableDLI::dliptr ] { } ) always clobbers reg byte a
Statement [6] enableDLI::dliptr = (void*)&fn2 [ enableDLI::dliptr ] ( [ enableDLI::dliptr ] { } ) always clobbers reg byte a
Statement asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: } always clobbers reg byte a
Statement asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: } always clobbers reg byte a
Potential registers zp[2]:128 [ enableDLI::dliptr ] : zp[2]:128 ,
REGISTER UPLIFT SCOPES
@ -161,11 +162,11 @@ Uplift Scope [fn1]
Uplift Scope [fn2]
Uplift Scope []
Uplifting [enableDLI] best 98 combination zp[2]:128 [ enableDLI::dliptr ]
Uplifting [main] best 98 combination
Uplifting [fn1] best 98 combination
Uplifting [fn2] best 98 combination
Uplifting [] best 98 combination
Uplifting [enableDLI] best 102 combination zp[2]:128 [ enableDLI::dliptr ]
Uplifting [main] best 102 combination
Uplifting [fn1] best 102 combination
Uplifting [fn2] best 102 combination
Uplifting [] best 102 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -249,10 +250,10 @@ main: {
// enableDLI(void* zp($80) dliptr)
enableDLI: {
.label dliptr = $80
// asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
lda #<dliptr
// asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
lda dliptr
sta dlivec
lda #>dliptr
lda dliptr+1
sta dlivec+1
jmp !+
dlivec:
@ -281,8 +282,8 @@ Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
void enableDLI(void* enableDLI::dliptr)
void* enableDLI::dliptr loadstore zp[2]:128 2.0
void enableDLI(volatile void* enableDLI::dliptr)
volatile void* enableDLI::dliptr loadstore zp[2]:128 2.0
void fn1()
void fn2()
void main()
@ -292,7 +293,7 @@ zp[2]:128 [ enableDLI::dliptr ]
FINAL ASSEMBLER
Score: 83
Score: 87
// File Comments
// Tests trouble passing a function pointer
@ -375,10 +376,10 @@ main: {
enableDLI: {
.label dliptr = $80
// asm
// asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
lda #<dliptr
// asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
lda dliptr
sta dlivec
lda #>dliptr
lda dliptr+1
sta dlivec+1
jmp !+
dlivec:

View File

@ -1,5 +1,5 @@
void enableDLI(void* enableDLI::dliptr)
void* enableDLI::dliptr loadstore zp[2]:128 2.0
void enableDLI(volatile void* enableDLI::dliptr)
volatile void* enableDLI::dliptr loadstore zp[2]:128 2.0
void fn1()
void fn2()
void main()

View File

@ -13,17 +13,21 @@ fn1: {
}
main: {
// enableDLI(&fn1)
lda #<fn1
sta.z enableDLI.dliptr
lda #>fn1
sta.z enableDLI.dliptr+1
jsr enableDLI
// }
rts
}
// enableDLI(void* dliptr)
// enableDLI(void* zp(2) dliptr)
enableDLI: {
.label dliptr = fn1
.label dliptr = 2
// asm
lda #<dliptr
lda dliptr
sta dlivec
lda #>dliptr
lda dliptr+1
sta dlivec+1
jmp !+
dlivec:

View File

@ -9,16 +9,16 @@ fn1::@return: scope:[fn1] from fn1
void main()
main: scope:[main] from
[2] phi()
[2] enableDLI::dliptr = (void*)&fn1
[3] call enableDLI
to:main::@return
main::@return: scope:[main] from main
[4] return
to:@return
void enableDLI(const void* enableDLI::dliptr)
void enableDLI(volatile void* enableDLI::dliptr)
enableDLI: scope:[enableDLI] from main
asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
to:enableDLI::@return
enableDLI::@return: scope:[enableDLI] from enableDLI
[6] return

View File

@ -1,4 +1,5 @@
Resolved forward reference fn1 to void fn1()
Setting inferred volatile on symbol affected by address-of: enableDLI::dliptr in asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
Inlined call call __init
CONTROL FLOW GRAPH SSA
@ -22,9 +23,9 @@ fn1::@return: scope:[fn1] from fn1
return
to:@return
void enableDLI(void* enableDLI::dliptr)
void enableDLI(volatile void* enableDLI::dliptr)
enableDLI: scope:[enableDLI] from main
asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
to:enableDLI::@return
enableDLI::@return: scope:[enableDLI] from enableDLI
return
@ -46,8 +47,8 @@ __start::@return: scope:[__start] from __start::@2
SYMBOL TABLE SSA
void __start()
void enableDLI(void* enableDLI::dliptr)
void* enableDLI::dliptr loadstore
void enableDLI(volatile void* enableDLI::dliptr)
volatile void* enableDLI::dliptr loadstore
void fn1()
void main()
const to_nomodify byte* r = (byte*)$8000
@ -61,8 +62,6 @@ Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant enableDLI::dliptr = (void*)&fn1
Successful SSA optimization Pass2ConstantIdentification
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::__init1
@ -70,7 +69,6 @@ Removing unused procedure block __start::@1
Removing unused procedure block __start::@2
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
CALL GRAPH
Calls in [main] to enableDLI:3
@ -78,7 +76,6 @@ Calls in [main] to enableDLI:3
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block label main::@1
Adding NOP phi() at start of main
FINAL CONTROL FLOW GRAPH
@ -92,16 +89,16 @@ fn1::@return: scope:[fn1] from fn1
void main()
main: scope:[main] from
[2] phi()
[2] enableDLI::dliptr = (void*)&fn1
[3] call enableDLI
to:main::@return
main::@return: scope:[main] from main
[4] return
to:@return
void enableDLI(const void* enableDLI::dliptr)
void enableDLI(volatile void* enableDLI::dliptr)
enableDLI: scope:[enableDLI] from main
asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
to:enableDLI::@return
enableDLI::@return: scope:[enableDLI] from enableDLI
[6] return
@ -109,26 +106,32 @@ enableDLI::@return: scope:[enableDLI] from enableDLI
VARIABLE REGISTER WEIGHTS
void enableDLI(const void* enableDLI::dliptr)
void enableDLI(volatile void* enableDLI::dliptr)
volatile void* enableDLI::dliptr loadstore 2.0
void fn1()
void main()
Initial phi equivalence classes
Added variable enableDLI::dliptr to live range equivalence class [ enableDLI::dliptr ]
Complete equivalence classes
[ enableDLI::dliptr ]
Allocated zp[2]:2 [ enableDLI::dliptr ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *r = 1 [ ] ( [ ] { } ) always clobbers reg byte a
Statement asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: } always clobbers reg byte a
Statement [2] enableDLI::dliptr = (void*)&fn1 [ enableDLI::dliptr ] ( [ enableDLI::dliptr ] { } ) always clobbers reg byte a
Statement asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: } always clobbers reg byte a
Potential registers zp[2]:2 [ enableDLI::dliptr ] : zp[2]:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [enableDLI] 2: zp[2]:2 [ enableDLI::dliptr ]
Uplift Scope [main]
Uplift Scope [fn1]
Uplift Scope [enableDLI]
Uplift Scope []
Uplifting [main] best 54 combination
Uplifting [fn1] best 54 combination
Uplifting [enableDLI] best 54 combination
Uplifting [] best 54 combination
Uplifting [enableDLI] best 68 combination zp[2]:2 [ enableDLI::dliptr ]
Uplifting [main] best 68 combination
Uplifting [fn1] best 68 combination
Uplifting [] best 68 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -153,6 +156,11 @@ fn1: {
}
// main
main: {
// [2] enableDLI::dliptr = (void*)&fn1 -- pvoz1=pvoc1
lda #<fn1
sta.z enableDLI.dliptr
lda #>fn1
sta.z enableDLI.dliptr+1
// [3] call enableDLI
jsr enableDLI
jmp __breturn
@ -162,13 +170,13 @@ main: {
rts
}
// enableDLI
// enableDLI(void* dliptr)
// enableDLI(void* zp(2) dliptr)
enableDLI: {
.label dliptr = fn1
// asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
lda #<dliptr
.label dliptr = 2
// asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
lda dliptr
sta dlivec
lda #>dliptr
lda dliptr+1
sta dlivec+1
jmp !+
dlivec:
@ -193,16 +201,17 @@ Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
void enableDLI(const void* enableDLI::dliptr)
const void* enableDLI::dliptr = (void*)&fn1
void enableDLI(volatile void* enableDLI::dliptr)
volatile void* enableDLI::dliptr loadstore zp[2]:2 2.0
void fn1()
void main()
const to_nomodify byte* r = (byte*) 32768
zp[2]:2 [ enableDLI::dliptr ]
FINAL ASSEMBLER
Score: 45
Score: 59
// File Comments
// The following casuses an exception in pass 2
@ -227,6 +236,11 @@ fn1: {
// main
main: {
// enableDLI(&fn1)
// [2] enableDLI::dliptr = (void*)&fn1 -- pvoz1=pvoc1
lda #<fn1
sta.z enableDLI.dliptr
lda #>fn1
sta.z enableDLI.dliptr+1
// [3] call enableDLI
jsr enableDLI
// main::@return
@ -235,14 +249,14 @@ main: {
rts
}
// enableDLI
// enableDLI(void* dliptr)
// enableDLI(void* zp(2) dliptr)
enableDLI: {
.label dliptr = fn1
.label dliptr = 2
// asm
// asm { lda#<dliptr stadlivec lda#>dliptr stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
lda #<dliptr
// asm { ldadliptr stadlivec ldadliptr+1 stadlivec+1 jmp!+ dlivec: .byte0,0 !: }
lda dliptr
sta dlivec
lda #>dliptr
lda dliptr+1
sta dlivec+1
jmp !+
dlivec:

View File

@ -1,6 +1,7 @@
void enableDLI(const void* enableDLI::dliptr)
const void* enableDLI::dliptr = (void*)&fn1
void enableDLI(volatile void* enableDLI::dliptr)
volatile void* enableDLI::dliptr loadstore zp[2]:2 2.0
void fn1()
void main()
const to_nomodify byte* r = (byte*) 32768
zp[2]:2 [ enableDLI::dliptr ]

View File

@ -1,3 +1,4 @@
Setting inferred volatile on symbol affected by address-of: main::value in asm { lda#$55 eorvalue staSCREEN }
CONTROL FLOW GRAPH SSA
@ -41,7 +42,7 @@ byte main::i#0
byte main::i#1
byte main::i#2
byte main::i#3
byte main::value loadstore
volatile byte main::value loadstore
Adding number conversion cast (unumber) $a in main::$0 = main::i#2 < $a
Successful SSA optimization PassNAddNumberTypeConversions
@ -95,7 +96,7 @@ void main()
byte main::i
byte main::i#1 22.0
byte main::i#2 11.0
byte main::value loadstore 4.0
volatile byte main::value loadstore 4.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
@ -192,7 +193,7 @@ void main()
byte main::i
byte main::i#1 reg byte x 22.0
byte main::i#2 reg byte x 11.0
byte main::value loadstore zp[1]:2 4.0
volatile byte main::value loadstore zp[1]:2 4.0
reg byte x [ main::i#2 main::i#1 ]
zp[1]:2 [ main::value ]

View File

@ -3,7 +3,7 @@ void main()
byte main::i
byte main::i#1 reg byte x 22.0
byte main::i#2 reg byte x 11.0
byte main::value loadstore zp[1]:2 4.0
volatile byte main::value loadstore zp[1]:2 4.0
reg byte x [ main::i#2 main::i#1 ]
zp[1]:2 [ main::value ]

View File

@ -0,0 +1,23 @@
// Illustrates how inline assembler referencing variables is automatically converted to __ma
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
main: {
.label i = 2
// for(byte i: 0..10)
lda #0
sta.z i
__b1:
// asm
lda #'a'
ldx i
sta SCREEN,x
// for(byte i: 0..10)
inc.z i
lda #$b
cmp.z i
bne __b1
// }
rts
}

View File

@ -0,0 +1,13 @@
void main()
main: scope:[main] from
[0] main::i = 0
to:main::@1
main::@1: scope:[main] from main main::@1
asm { lda#'a' ldxi staSCREEN,x }
[2] main::i = ++ main::i
[3] if(main::i!=$b) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
[4] return
to:@return

View File

@ -0,0 +1,187 @@
Setting inferred volatile on symbol affected by address-of: main::i in asm { lda#'a' ldxi staSCREEN,x }
CONTROL FLOW GRAPH SSA
void main()
main: scope:[main] from __start
main::i = 0
to:main::@1
main::@1: scope:[main] from main main::@1
asm { lda#'a' ldxi staSCREEN,x }
main::i = main::i + rangenext(0,$a)
main::$0 = main::i != rangelast(0,$a)
if(main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
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
const nomodify byte* SCREEN = (byte*)$400
void __start()
void main()
bool~ main::$0
volatile byte main::i loadstore
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Simple Condition main::$0 [4] if(main::i!=rangelast(0,$a)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Resolved ranged next value [2] main::i = ++ main::i to ++
Resolved ranged comparison value [4] if(main::i!=rangelast(0,$a)) goto main::@1 to $b
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
Adding number conversion cast (unumber) $b in [3] if(main::i!=$b) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $b
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type $b
Successful SSA optimization PassNFinalizeNumberTypeConversions
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] main::i = 0
to:main::@1
main::@1: scope:[main] from main main::@1
asm { lda#'a' ldxi staSCREEN,x }
[2] main::i = ++ main::i
[3] if(main::i!=$b) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
[4] return
to:@return
VARIABLE REGISTER WEIGHTS
void main()
volatile byte main::i loadstore 8.75
Initial phi equivalence classes
Added variable main::i to live range equivalence class [ main::i ]
Complete equivalence classes
[ main::i ]
Allocated zp[1]:2 [ main::i ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] main::i = 0 [ main::i ] ( [ main::i ] { } ) always clobbers reg byte a
Statement asm { lda#'a' ldxi staSCREEN,x } always clobbers reg byte a reg byte x
Statement [3] if(main::i!=$b) goto main::@1 [ main::i ] ( [ main::i ] { } ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::i ] : zp[1]:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 8.75: zp[1]:2 [ main::i ]
Uplift Scope []
Uplifting [main] best 279 combination zp[1]:2 [ main::i ]
Uplifting [] best 279 combination
Attempting to uplift remaining variables inzp[1]:2 [ main::i ]
Uplifting [main] best 279 combination zp[1]:2 [ main::i ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Illustrates how inline assembler referencing variables is automatically converted to __ma
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
// main
main: {
.label i = 2
// [0] main::i = 0 -- vbuz1=vbuc1
lda #0
sta.z i
jmp __b1
// main::@1
__b1:
// asm { lda#'a' ldxi staSCREEN,x }
lda #'a'
ldx i
sta SCREEN,x
// [2] main::i = ++ main::i -- vbuz1=_inc_vbuz1
inc.z i
// [3] if(main::i!=$b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$b
cmp.z i
bne __b1
jmp __breturn
// main::@return
__breturn:
// [4] return
rts
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
const nomodify byte* SCREEN = (byte*) 1024
void main()
volatile byte main::i loadstore zp[1]:2 8.75
zp[1]:2 [ main::i ]
FINAL ASSEMBLER
Score: 246
// File Comments
// Illustrates how inline assembler referencing variables is automatically converted to __ma
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
// main
main: {
.label i = 2
// for(byte i: 0..10)
// [0] main::i = 0 -- vbuz1=vbuc1
lda #0
sta.z i
// main::@1
__b1:
// asm
// asm { lda#'a' ldxi staSCREEN,x }
lda #'a'
ldx i
sta SCREEN,x
// for(byte i: 0..10)
// [2] main::i = ++ main::i -- vbuz1=_inc_vbuz1
inc.z i
// [3] if(main::i!=$b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$b
cmp.z i
bne __b1
// main::@return
// }
// [4] return
rts
}
// File Data

View File

@ -0,0 +1,5 @@
const nomodify byte* SCREEN = (byte*) 1024
void main()
volatile byte main::i loadstore zp[1]:2 8.75
zp[1]:2 [ main::i ]

View File

@ -1,4 +1,10 @@
Setting inferred volatile on symbol affected by address-of foo::v2 = &foo::a2
Setting inferred volatile on symbol affected by address-of: foo::v1 in kickasm( uses foo::v1 uses foo::v2) {{ lda v1
sta v2
}}
Setting inferred volatile on symbol affected by address-of: foo::v2 in kickasm( uses foo::v1 uses foo::v2) {{ lda v1
sta v2
}}
Inlined call call __init
CONTROL FLOW GRAPH SSA
@ -51,8 +57,8 @@ const to_nomodify byte* OUT = (byte*)$8000
void __start()
void foo(byte* foo::x1 , byte* foo::x2)
volatile byte foo::a2 loadstore
to_volatile byte* foo::v1 loadstore
byte* foo::v2 loadstore
volatile to_volatile byte* foo::v1 loadstore
volatile byte* foo::v2 loadstore
byte* foo::x1
byte* foo::x1#0
byte* foo::x1#1
@ -124,8 +130,8 @@ foo::@return: scope:[foo] from foo
VARIABLE REGISTER WEIGHTS
void foo(byte* foo::x1 , byte* foo::x2)
volatile byte foo::a2 loadstore 5.5
to_volatile byte* foo::v1 loadstore 11.0
byte* foo::v2 loadstore 22.0
volatile to_volatile byte* foo::v1 loadstore 11.0
volatile byte* foo::v2 loadstore 22.0
byte* foo::x1
byte* foo::x2
void main()
@ -266,8 +272,8 @@ FINAL SYMBOL TABLE
const to_nomodify byte* OUT = (byte*) 32768
void foo(byte* foo::x1 , byte* foo::x2)
volatile byte foo::a2 loadstore zp[1]:132 5.5
to_volatile byte* foo::v1 loadstore zp[2]:128 11.0
byte* foo::v2 loadstore zp[2]:130 22.0
volatile to_volatile byte* foo::v1 loadstore zp[2]:128 11.0
volatile byte* foo::v2 loadstore zp[2]:130 22.0
byte* foo::x1
byte* foo::x2
void main()

View File

@ -1,8 +1,8 @@
const to_nomodify byte* OUT = (byte*) 32768
void foo(byte* foo::x1 , byte* foo::x2)
volatile byte foo::a2 loadstore zp[1]:132 5.5
to_volatile byte* foo::v1 loadstore zp[2]:128 11.0
byte* foo::v2 loadstore zp[2]:130 22.0
volatile to_volatile byte* foo::v1 loadstore zp[2]:128 11.0
volatile byte* foo::v2 loadstore zp[2]:130 22.0
byte* foo::x1
byte* foo::x2
void main()

View File

@ -27,7 +27,7 @@ test: {
.label colorMem = $d800
.label other = $c000
.label dst = 6
.label __1 = 6
.label __1 = 4
.label diff = 4
.label videoMem = 4
// dst
@ -44,13 +44,17 @@ test: {
sta.z diff+1
// other + ((unsigned int)diff)
clc
lda.z diff
lda.z __1
adc #<other
sta.z __1
lda.z diff+1
lda.z __1+1
adc #>other
sta.z __1+1
// dst = other + ((unsigned int)diff)
lda.z __1
sta.z dst
lda.z __1+1
sta.z dst+1
// dst[0] = 1
lda #1
ldy #0

View File

@ -1,3 +1,4 @@
Setting inferred volatile on symbol affected by address-of: test::dst in asm { ldy#0 lda#1 sta(dst),y }
Inlined call call __init
CONTROL FLOW GRAPH SSA
@ -63,7 +64,7 @@ byte* test::colorMem#1
byte* test::diff
byte* test::diff#0
byte* test::diff#1
byte* test::dst loadstore
volatile byte* test::dst loadstore
byte* test::other
byte* test::other#0
byte* test::other#1
@ -169,7 +170,7 @@ byte*~ test::$1 202.0
byte* test::colorMem
byte* test::diff
word test::diff#1 101.0
byte* test::dst loadstore 151.5
volatile byte* test::dst loadstore 151.5
byte* test::other
byte* test::videoMem
byte* test::videoMem#0 56.0
@ -217,7 +218,7 @@ Uplifting [] best 172 combination zp[2]:2 [ h1 ]
Uplifting [main] best 172 combination
Uplifting [__start] best 172 combination
Coalescing zero page register [ zp[2]:4 [ test::videoMem#0 ] ] with [ zp[2]:8 [ test::diff#1 ] ] - score: 1
Coalescing zero page register [ zp[2]:6 [ test::dst ] ] with [ zp[2]:10 [ test::$1 ] ] - score: 1
Coalescing zero page register [ zp[2]:4 [ test::videoMem#0 test::diff#1 ] ] with [ zp[2]:10 [ test::$1 ] ] - score: 1
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -273,7 +274,7 @@ test: {
.label colorMem = $d800
.label other = $c000
.label dst = 6
.label __1 = 6
.label __1 = 4
.label diff = 4
.label videoMem = 4
// [8] test::dst = (byte*) 0 -- pbuz1=pbuc1
@ -289,15 +290,19 @@ test: {
lda #>colorMem
sbc.z diff+1
sta.z diff+1
// [10] test::$1 = test::other#0 + (word)(byte*)test::diff#1 -- pbuz1=pbuc1_plus_vwuz2
// [10] test::$1 = test::other#0 + (word)(byte*)test::diff#1 -- pbuz1=pbuc1_plus_vwuz1
clc
lda.z diff
lda.z __1
adc #<other
sta.z __1
lda.z diff+1
lda.z __1+1
adc #>other
sta.z __1+1
// [11] test::dst = test::$1
// [11] test::dst = test::$1 -- pbuz1=pbuz2
lda.z __1
sta.z dst
lda.z __1+1
sta.z dst+1
// [12] *test::dst = 1 -- _deref_pbuz1=vbuc1
lda #1
ldy #0
@ -340,24 +345,24 @@ void __start()
volatile byte* h1 loadstore zp[2]:2 6.5
void main()
void test(byte* test::videoMem , byte* test::colorMem , byte* test::other)
byte*~ test::$1 zp[2]:6 202.0
byte*~ test::$1 zp[2]:4 202.0
byte* test::colorMem
const byte* test::colorMem#0 colorMem = (byte*) 55296
byte* test::diff
word test::diff#1 diff zp[2]:4 101.0
byte* test::dst loadstore zp[2]:6 151.5
volatile byte* test::dst loadstore zp[2]:6 151.5
byte* test::other
const byte* test::other#0 other = (byte*) 49152
byte* test::videoMem
byte* test::videoMem#0 videoMem zp[2]:4 56.0
zp[2]:2 [ h1 ]
zp[2]:4 [ test::videoMem#0 test::diff#1 ]
zp[2]:6 [ test::dst test::$1 ]
zp[2]:4 [ test::videoMem#0 test::diff#1 test::$1 ]
zp[2]:6 [ test::dst ]
FINAL ASSEMBLER
Score: 110
Score: 122
// File Comments
// Demonstrates that a local __ma variable overwrites a parameter§
@ -405,7 +410,7 @@ test: {
.label colorMem = $d800
.label other = $c000
.label dst = 6
.label __1 = 6
.label __1 = 4
.label diff = 4
.label videoMem = 4
// dst
@ -423,16 +428,20 @@ test: {
sbc.z diff+1
sta.z diff+1
// other + ((unsigned int)diff)
// [10] test::$1 = test::other#0 + (word)(byte*)test::diff#1 -- pbuz1=pbuc1_plus_vwuz2
// [10] test::$1 = test::other#0 + (word)(byte*)test::diff#1 -- pbuz1=pbuc1_plus_vwuz1
clc
lda.z diff
lda.z __1
adc #<other
sta.z __1
lda.z diff+1
lda.z __1+1
adc #>other
sta.z __1+1
// dst = other + ((unsigned int)diff)
// [11] test::dst = test::$1
// [11] test::dst = test::$1 -- pbuz1=pbuz2
lda.z __1
sta.z dst
lda.z __1+1
sta.z dst+1
// dst[0] = 1
// [12] *test::dst = 1 -- _deref_pbuz1=vbuc1
lda #1

View File

@ -2,17 +2,17 @@ void __start()
volatile byte* h1 loadstore zp[2]:2 6.5
void main()
void test(byte* test::videoMem , byte* test::colorMem , byte* test::other)
byte*~ test::$1 zp[2]:6 202.0
byte*~ test::$1 zp[2]:4 202.0
byte* test::colorMem
const byte* test::colorMem#0 colorMem = (byte*) 55296
byte* test::diff
word test::diff#1 diff zp[2]:4 101.0
byte* test::dst loadstore zp[2]:6 151.5
volatile byte* test::dst loadstore zp[2]:6 151.5
byte* test::other
const byte* test::other#0 other = (byte*) 49152
byte* test::videoMem
byte* test::videoMem#0 videoMem zp[2]:4 56.0
zp[2]:2 [ h1 ]
zp[2]:4 [ test::videoMem#0 test::diff#1 ]
zp[2]:6 [ test::dst test::$1 ]
zp[2]:4 [ test::videoMem#0 test::diff#1 test::$1 ]
zp[2]:6 [ test::dst ]

View File

@ -16,27 +16,26 @@ __start::@return: scope:[__start] from __start::@1
void main()
main: scope:[main] from __start::@1
[5] phi()
[5] print::ch = 'c'
[6] call print
to:main::@1
main::@1: scope:[main] from main
[7] phi()
[7] print::ch = 'm'
[8] call print
to:main::@2
main::@2: scope:[main] from main::@1
[9] phi()
[9] print::ch = 'l'
[10] call print
to:main::@return
main::@return: scope:[main] from main::@2
[11] return
to:@return
void print(byte print::ch)
void print(volatile byte print::ch)
print: scope:[print] from main main::@1 main::@2
[12] print::ch#3 = phi( main/'c', main::@1/'m', main::@2/'l' )
kickasm( uses print::ch#3) {{ }}
kickasm( uses print::ch) {{ }}
asm { ldxidx staSCREEN,x incidx }
to:print::@return
print::@return: scope:[print] from print
[15] return
[14] return
to:@return

View File

@ -1,18 +1,19 @@
Setting inferred volatile on symbol affected by address-of: print::ch in kickasm( uses print::ch) {{ }}
Inlined call call __init
CONTROL FLOW GRAPH SSA
void main()
main: scope:[main] from __start::@1
print::ch#0 = 'c'
print::ch = 'c'
call print
to:main::@1
main::@1: scope:[main] from main
print::ch#1 = 'm'
print::ch = 'm'
call print
to:main::@2
main::@2: scope:[main] from main::@1
print::ch#2 = 'l'
print::ch = 'l'
call print
to:main::@3
main::@3: scope:[main] from main::@2
@ -21,10 +22,9 @@ main::@return: scope:[main] from main::@3
return
to:@return
void print(byte print::ch)
void print(volatile byte print::ch)
print: scope:[print] from main main::@1 main::@2
print::ch#3 = phi( main/print::ch#0, main::@1/print::ch#1, main::@2/print::ch#2 )
kickasm( uses print::ch#3) {{ }}
kickasm( uses print::ch) {{ }}
asm { ldxidx staSCREEN,x incidx }
to:print::@return
print::@return: scope:[print] from print
@ -51,46 +51,25 @@ const nomodify byte* SCREEN = (byte*)$400
void __start()
volatile byte idx loadstore !zp[-1]:3
void main()
void print(byte print::ch)
byte print::ch !reg byte a
byte print::ch#0 !reg byte a
byte print::ch#1 !reg byte a
byte print::ch#2 !reg byte a
byte print::ch#3 !reg byte a
void print(volatile byte print::ch)
volatile byte print::ch loadstore !reg byte a
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Constant print::ch#0 = 'c'
Constant print::ch#1 = 'm'
Constant print::ch#2 = 'l'
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with var siblings print::ch#0
Inlining constant with var siblings print::ch#1
Inlining constant with var siblings print::ch#2
Constant inlined print::ch#2 = 'l'
Constant inlined print::ch#1 = 'm'
Constant inlined print::ch#0 = 'c'
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of __start
Adding NOP phi() at start of __start::@1
Adding NOP phi() at start of __start::@2
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of main::@3
CALL GRAPH
Calls in [__start] to main:3
Calls in [main] to print:7 print:9 print:11
Created 1 initial phi equivalence classes
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block label __start::@2
Culled Empty Block label main::@3
Adding NOP phi() at start of __start
Adding NOP phi() at start of __start::@1
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
@ -111,61 +90,62 @@ __start::@return: scope:[__start] from __start::@1
void main()
main: scope:[main] from __start::@1
[5] phi()
[5] print::ch = 'c'
[6] call print
to:main::@1
main::@1: scope:[main] from main
[7] phi()
[7] print::ch = 'm'
[8] call print
to:main::@2
main::@2: scope:[main] from main::@1
[9] phi()
[9] print::ch = 'l'
[10] call print
to:main::@return
main::@return: scope:[main] from main::@2
[11] return
to:@return
void print(byte print::ch)
void print(volatile byte print::ch)
print: scope:[print] from main main::@1 main::@2
[12] print::ch#3 = phi( main/'c', main::@1/'m', main::@2/'l' )
kickasm( uses print::ch#3) {{ }}
kickasm( uses print::ch) {{ }}
asm { ldxidx staSCREEN,x incidx }
to:print::@return
print::@return: scope:[print] from print
[15] return
[14] return
to:@return
VARIABLE REGISTER WEIGHTS
void __start()
volatile byte idx loadstore !zp[-1]:3 0.18181818181818182
volatile byte idx loadstore !zp[-1]:3 0.2
void main()
void print(byte print::ch)
byte print::ch !reg byte a
byte print::ch#3 !reg byte a
void print(volatile byte print::ch)
volatile byte print::ch loadstore !reg byte a 11.0
Initial phi equivalence classes
[ print::ch#3 ]
Added variable idx to live range equivalence class [ idx ]
Added variable print::ch to live range equivalence class [ print::ch ]
Complete equivalence classes
[ print::ch#3 ]
[ idx ]
[ print::ch ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] idx = 0 [ idx ] ( [ idx ] { } ) always clobbers reg byte a
Statement [5] print::ch = 'c' [ idx print::ch ] ( main:3 [ idx print::ch ] { } ) always clobbers reg byte a
Statement [7] print::ch = 'm' [ idx print::ch ] ( main:3 [ idx print::ch ] { } ) always clobbers reg byte a
Statement [9] print::ch = 'l' [ idx print::ch ] ( main:3 [ idx print::ch ] { } ) always clobbers reg byte a
Statement asm { ldxidx staSCREEN,x incidx } always clobbers reg byte x
Potential registers reg byte a [ print::ch#3 ] : reg byte a ,
Potential registers zp[1]:3 [ idx ] : zp[1]:3 ,
Potential registers reg byte a [ print::ch ] : reg byte a ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 0.18: zp[1]:3 [ idx ]
Uplift Scope [print] 11: reg byte a [ print::ch ]
Uplift Scope [] 0.2: zp[1]:3 [ idx ]
Uplift Scope [main]
Uplift Scope [print] 0: reg byte a [ print::ch#3 ]
Uplift Scope [__start]
Uplifting [print] best 372 combination reg byte a [ print::ch ]
Uplifting [] best 372 combination zp[1]:3 [ idx ]
Uplifting [main] best 372 combination
Uplifting [print] best 372 combination reg byte a [ print::ch#3 ]
Uplifting [__start] best 372 combination
Attempting to uplift remaining variables inzp[1]:3 [ idx ]
Uplifting [] best 372 combination zp[1]:3 [ idx ]
@ -195,8 +175,6 @@ __start: {
// __start::@1
__b1:
// [3] call main
// [5] phi from __start::@1 to main [phi:__start::@1->main]
main_from___b1:
jsr main
jmp __breturn
// __start::@return
@ -206,33 +184,23 @@ __start: {
}
// main
main: {
// [6] call print
// [12] phi from main to print [phi:main->print]
print_from_main:
// [12] phi print::ch#3 = 'c' [phi:main->print#0] -- vbuaa=vbuc1
// [5] print::ch = 'c' -- vbuaa=vbuc1
lda #'c'
// [6] call print
jsr print
// [7] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
jmp __b1
// main::@1
__b1:
// [8] call print
// [12] phi from main::@1 to print [phi:main::@1->print]
print_from___b1:
// [12] phi print::ch#3 = 'm' [phi:main::@1->print#0] -- vbuaa=vbuc1
// [7] print::ch = 'm' -- vbuaa=vbuc1
lda #'m'
// [8] call print
jsr print
// [9] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
__b2_from___b1:
jmp __b2
// main::@2
__b2:
// [10] call print
// [12] phi from main::@2 to print [phi:main::@2->print]
print_from___b2:
// [12] phi print::ch#3 = 'l' [phi:main::@2->print#0] -- vbuaa=vbuc1
// [9] print::ch = 'l' -- vbuaa=vbuc1
lda #'l'
// [10] call print
jsr print
jmp __breturn
// main::@return
@ -243,7 +211,7 @@ main: {
// print
// print(byte register(A) ch)
print: {
// kickasm( uses print::ch#3) {{ }}
// kickasm( uses print::ch) {{ }}
// Force usage of ch
// asm { ldxidx staSCREEN,x incidx }
@ -253,7 +221,7 @@ print: {
jmp __breturn
// print::@return
__breturn:
// [15] return
// [14] return
rts
}
// File Data
@ -268,16 +236,10 @@ Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from___init1:
Removing instruction main_from___b1:
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 __init1:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction print_from_main:
Removing instruction __b1:
Removing instruction __b2:
Removing instruction __breturn:
@ -287,14 +249,13 @@ Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
const nomodify byte* SCREEN = (byte*) 1024
void __start()
volatile byte idx loadstore !zp[-1]:3 zp[1]:3 0.18181818181818182
volatile byte idx loadstore !zp[-1]:3 zp[1]:3 0.2
void main()
void print(byte print::ch)
byte print::ch !reg byte a
byte print::ch#3 !reg byte a
void print(volatile byte print::ch)
volatile byte print::ch loadstore !reg byte a 11.0
reg byte a [ print::ch#3 ]
zp[1]:3 [ idx ]
reg byte a [ print::ch ]
FINAL ASSEMBLER
@ -320,7 +281,6 @@ __start: {
// [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
// __start::@1
// [3] call main
// [5] phi from __start::@1 to main [phi:__start::@1->main]
jsr main
// __start::@return
// [4] return
@ -329,26 +289,21 @@ __start: {
// main
main: {
// print('c')
// [6] call print
// [12] phi from main to print [phi:main->print]
// [12] phi print::ch#3 = 'c' [phi:main->print#0] -- vbuaa=vbuc1
// [5] print::ch = 'c' -- vbuaa=vbuc1
lda #'c'
// [6] call print
jsr print
// [7] phi from main to main::@1 [phi:main->main::@1]
// main::@1
// print('m')
// [8] call print
// [12] phi from main::@1 to print [phi:main::@1->print]
// [12] phi print::ch#3 = 'm' [phi:main::@1->print#0] -- vbuaa=vbuc1
// [7] print::ch = 'm' -- vbuaa=vbuc1
lda #'m'
// [8] call print
jsr print
// [9] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// main::@2
// print('l')
// [10] call print
// [12] phi from main::@2 to print [phi:main::@2->print]
// [12] phi print::ch#3 = 'l' [phi:main::@2->print#0] -- vbuaa=vbuc1
// [9] print::ch = 'l' -- vbuaa=vbuc1
lda #'l'
// [10] call print
jsr print
// main::@return
// }
@ -359,7 +314,7 @@ main: {
// print(byte register(A) ch)
print: {
// kickasm
// kickasm( uses print::ch#3) {{ }}
// kickasm( uses print::ch) {{ }}
// Force usage of ch
// asm
@ -369,7 +324,7 @@ print: {
inc idx
// print::@return
// }
// [15] return
// [14] return
rts
}
// File Data

View File

@ -1,10 +1,9 @@
const nomodify byte* SCREEN = (byte*) 1024
void __start()
volatile byte idx loadstore !zp[-1]:3 zp[1]:3 0.18181818181818182
volatile byte idx loadstore !zp[-1]:3 zp[1]:3 0.2
void main()
void print(byte print::ch)
byte print::ch !reg byte a
byte print::ch#3 !reg byte a
void print(volatile byte print::ch)
volatile byte print::ch loadstore !reg byte a 11.0
reg byte a [ print::ch#3 ]
zp[1]:3 [ idx ]
reg byte a [ print::ch ]

View File

@ -14,7 +14,7 @@ main::@return: scope:[main] from main::@3
[4] return
to:@return
main::@2: scope:[main] from main::@1
[5] chrout::petscii#0 = MSG1[main::i#2]
[5] chrout::petscii = MSG1[main::i#2]
[6] call chrout
to:main::@4
main::@4: scope:[main] from main::@2
@ -22,12 +22,11 @@ main::@4: scope:[main] from main::@2
[8] main::i#1 = ++ main::i#2
to:main::@1
void chrout(byte chrout::petscii)
void chrout(volatile byte chrout::petscii)
chrout: scope:[chrout] from main::@2
[9] chrout::petscii#1 = phi( main::@2/chrout::petscii#0 )
kickasm( uses chrout::petscii#1) {{ jsr $ffd2
kickasm( uses chrout::petscii) {{ jsr $ffd2
}}
to:chrout::@return
chrout::@return: scope:[chrout] from chrout
[11] return
[10] return
to:@return

View File

@ -1,3 +1,5 @@
Setting inferred volatile on symbol affected by address-of: chrout::petscii in kickasm( uses chrout::petscii) {{ jsr $ffd2
}}
Inlined call call __init
CONTROL FLOW GRAPH SSA
@ -14,7 +16,7 @@ main::@1: scope:[main] from main main::@4
to:main::@3
main::@2: scope:[main] from main::@1
main::i#3 = phi( main::@1/main::i#2 )
chrout::petscii#0 = MSG1[main::i#3]
chrout::petscii = MSG1[main::i#3]
call chrout
to:main::@4
main::@4: scope:[main] from main::@2
@ -29,10 +31,9 @@ main::@return: scope:[main] from main::@3
return
to:@return
void chrout(byte chrout::petscii)
void chrout(volatile byte chrout::petscii)
chrout: scope:[chrout] from main::@2
chrout::petscii#1 = phi( main::@2/chrout::petscii#0 )
kickasm( uses chrout::petscii#1) {{ jsr $ffd2
kickasm( uses chrout::petscii) {{ jsr $ffd2
}}
to:chrout::@return
chrout::@return: scope:[chrout] from chrout
@ -60,10 +61,8 @@ const byte* MSG2[] = "CAMELOT"su
const byte* SCREEN1 = (byte*)$400
const byte* SCREEN2 = (byte*)$428
void __start()
void chrout(byte chrout::petscii)
byte chrout::petscii !reg byte a
byte chrout::petscii#0 !reg byte a
byte chrout::petscii#1 !reg byte a
void chrout(volatile byte chrout::petscii)
volatile byte chrout::petscii loadstore !reg byte a
void main()
bool~ main::$1
byte main::i
@ -109,12 +108,11 @@ Inlining constant with var siblings main::i#0
Constant inlined main::i#0 = 0
Successful SSA optimization Pass2ConstantInlining
CALL GRAPH
Calls in [main] to chrout:7
Calls in [main] to chrout:6
Created 2 initial phi equivalence classes
Coalesced [6] chrout::petscii#2 = chrout::petscii#0
Coalesced [10] main::i#5 = main::i#1
Coalesced down to 2 phi equivalence classes
Created 1 initial phi equivalence classes
Coalesced [9] main::i#5 = main::i#1
Coalesced down to 1 phi equivalence classes
FINAL CONTROL FLOW GRAPH
@ -133,7 +131,7 @@ main::@return: scope:[main] from main::@3
[4] return
to:@return
main::@2: scope:[main] from main::@1
[5] chrout::petscii#0 = MSG1[main::i#2]
[5] chrout::petscii = MSG1[main::i#2]
[6] call chrout
to:main::@4
main::@4: scope:[main] from main::@2
@ -141,22 +139,19 @@ main::@4: scope:[main] from main::@2
[8] main::i#1 = ++ main::i#2
to:main::@1
void chrout(byte chrout::petscii)
void chrout(volatile byte chrout::petscii)
chrout: scope:[chrout] from main::@2
[9] chrout::petscii#1 = phi( main::@2/chrout::petscii#0 )
kickasm( uses chrout::petscii#1) {{ jsr $ffd2
kickasm( uses chrout::petscii) {{ jsr $ffd2
}}
to:chrout::@return
chrout::@return: scope:[chrout] from chrout
[11] return
[10] return
to:@return
VARIABLE REGISTER WEIGHTS
void chrout(byte chrout::petscii)
byte chrout::petscii !reg byte a
byte chrout::petscii#0 !reg byte a 22.0
byte chrout::petscii#1 !reg byte a 11.0
void chrout(volatile byte chrout::petscii)
volatile byte chrout::petscii loadstore !reg byte a 11.0
void main()
byte main::i
byte main::i#1 22.0
@ -164,34 +159,34 @@ byte main::i#2 13.2
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ chrout::petscii#1 chrout::petscii#0 ]
Added variable chrout::petscii to live range equivalence class [ chrout::petscii ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ chrout::petscii#1 chrout::petscii#0 ]
[ chrout::petscii ]
Allocated zp[1]:2 [ main::i#2 main::i#1 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *((byte*) 53272) = $17 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [2] if(0!=MSG1[main::i#2]) goto main::@2 [ main::i#2 ] ( [ main::i#2 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Statement [3] *SCREEN2 = CH [ ] ( [ ] { } ) always clobbers reg byte a
Statement [5] chrout::petscii#0 = MSG1[main::i#2] [ main::i#2 chrout::petscii#0 ] ( [ main::i#2 chrout::petscii#0 ] { { chrout::petscii#0 = chrout::petscii#1 } } ) always clobbers reg byte a
Statement [5] chrout::petscii = MSG1[main::i#2] [ main::i#2 chrout::petscii ] ( [ main::i#2 chrout::petscii ] { } ) always clobbers reg byte a
Statement [7] SCREEN1[main::i#2] = MSG2[main::i#2] [ main::i#2 ] ( [ main::i#2 ] { } ) always clobbers reg byte a
Statement [0] *((byte*) 53272) = $17 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [2] if(0!=MSG1[main::i#2]) goto main::@2 [ main::i#2 ] ( [ main::i#2 ] { } ) always clobbers reg byte a
Statement [3] *SCREEN2 = CH [ ] ( [ ] { } ) always clobbers reg byte a
Statement [5] chrout::petscii#0 = MSG1[main::i#2] [ main::i#2 chrout::petscii#0 ] ( [ main::i#2 chrout::petscii#0 ] { { chrout::petscii#0 = chrout::petscii#1 } } ) always clobbers reg byte a
Statement [5] chrout::petscii = MSG1[main::i#2] [ main::i#2 chrout::petscii ] ( [ main::i#2 chrout::petscii ] { } ) always clobbers reg byte a
Statement [7] SCREEN1[main::i#2] = MSG2[main::i#2] [ main::i#2 ] ( [ main::i#2 ] { } ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y ,
Potential registers reg byte a [ chrout::petscii#1 chrout::petscii#0 ] : reg byte a ,
Potential registers reg byte a [ chrout::petscii ] : reg byte a ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 35.2: zp[1]:2 [ main::i#2 main::i#1 ]
Uplift Scope [chrout] 33: reg byte a [ chrout::petscii#1 chrout::petscii#0 ]
Uplift Scope [chrout] 11: reg byte a [ chrout::petscii ]
Uplift Scope []
Uplifting [main] best 655 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [chrout] best 655 combination reg byte a [ chrout::petscii#1 chrout::petscii#0 ]
Uplifting [] best 655 combination
Uplifting [main] best 736 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [chrout] best 736 combination reg byte a [ chrout::petscii ]
Uplifting [] best 736 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -236,12 +231,9 @@ main: {
rts
// main::@2
__b2:
// [5] chrout::petscii#0 = MSG1[main::i#2] -- vbuaa=pbuc1_derefidx_vbuxx
// [5] chrout::petscii = MSG1[main::i#2] -- vbuaa=pbuc1_derefidx_vbuxx
lda MSG1,x
// [6] call chrout
// [9] phi from main::@2 to chrout [phi:main::@2->chrout]
chrout_from___b2:
// [9] phi chrout::petscii#1 = chrout::petscii#0 [phi:main::@2->chrout#0] -- register_copy
jsr chrout
jmp __b4
// main::@4
@ -259,13 +251,13 @@ main: {
// chrout
// chrout(byte register(A) petscii)
chrout: {
// kickasm( uses chrout::petscii#1) {{ jsr $ffd2 }}
// kickasm( uses chrout::petscii) {{ jsr $ffd2 }}
jsr $ffd2
jmp __breturn
// chrout::@return
__breturn:
// [11] return
// [10] return
rts
}
// File Data
@ -286,7 +278,6 @@ Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from_main:
Removing instruction __b3:
Removing instruction __breturn:
Removing instruction chrout_from___b2:
Removing instruction __b4:
Removing instruction __b1_from___b4:
Removing instruction __breturn:
@ -298,21 +289,19 @@ const byte* MSG1[] = "cAmElot"pm
const byte* MSG2[] = "CAMELOT"su
const byte* SCREEN1 = (byte*) 1024
const byte* SCREEN2 = (byte*) 1064
void chrout(byte chrout::petscii)
byte chrout::petscii !reg byte a
byte chrout::petscii#0 !reg byte a 22.0
byte chrout::petscii#1 !reg byte a 11.0
void chrout(volatile byte chrout::petscii)
volatile byte chrout::petscii loadstore !reg byte a 11.0
void main()
byte main::i
byte main::i#1 reg byte x 22.0
byte main::i#2 reg byte x 13.2
reg byte x [ main::i#2 main::i#1 ]
reg byte a [ chrout::petscii#1 chrout::petscii#0 ]
reg byte a [ chrout::petscii ]
FINAL ASSEMBLER
Score: 586
Score: 640
// File Comments
// Test using some simple supported string escape
@ -355,11 +344,9 @@ main: {
// main::@2
__b2:
// chrout(MSG1[i])
// [5] chrout::petscii#0 = MSG1[main::i#2] -- vbuaa=pbuc1_derefidx_vbuxx
// [5] chrout::petscii = MSG1[main::i#2] -- vbuaa=pbuc1_derefidx_vbuxx
lda MSG1,x
// [6] call chrout
// [9] phi from main::@2 to chrout [phi:main::@2->chrout]
// [9] phi chrout::petscii#1 = chrout::petscii#0 [phi:main::@2->chrout#0] -- register_copy
jsr chrout
// main::@4
// SCREEN1[i] = MSG2[i]
@ -377,12 +364,12 @@ main: {
// chrout(byte register(A) petscii)
chrout: {
// kickasm
// kickasm( uses chrout::petscii#1) {{ jsr $ffd2 }}
// kickasm( uses chrout::petscii) {{ jsr $ffd2 }}
jsr $ffd2
// chrout::@return
// }
// [11] return
// [10] return
rts
}
// File Data

View File

@ -3,14 +3,12 @@ const byte* MSG1[] = "cAmElot"pm
const byte* MSG2[] = "CAMELOT"su
const byte* SCREEN1 = (byte*) 1024
const byte* SCREEN2 = (byte*) 1064
void chrout(byte chrout::petscii)
byte chrout::petscii !reg byte a
byte chrout::petscii#0 !reg byte a 22.0
byte chrout::petscii#1 !reg byte a 11.0
void chrout(volatile byte chrout::petscii)
volatile byte chrout::petscii loadstore !reg byte a 11.0
void main()
byte main::i
byte main::i#1 reg byte x 22.0
byte main::i#2 reg byte x 13.2
reg byte x [ main::i#2 main::i#1 ]
reg byte a [ chrout::petscii#1 chrout::petscii#0 ]
reg byte a [ chrout::petscii ]