1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-10-01 16:57:43 +00:00

Added utoa() implementation handling binary/octal/decimal & hexadecimal.

This commit is contained in:
Jesper Gravgaard 2019-07-17 23:38:09 +02:00
parent aefa5c9f49
commit 31ede3c794
32 changed files with 1966 additions and 981 deletions

View File

@ -1,5 +1,4 @@
// Implementation of functions found int C stdlib.h / stdlib.c
import "string"
// Top of the heap used by malloc()
@ -36,10 +35,10 @@ void *calloc(size_t nitems, size_t size) {
// - items - Pointer to the start of the array to search in
// - num - The number of items in the array
// Returns pointer to an entry in the array that matches the search key
word* bsearch16u(word key, word* items, byte num) {
unsigned int* bsearch16u(unsigned int key, unsigned int* items, char num) {
while (num > 0) {
word* pivot = items + (num >> 1);
signed word result = (signed word)key-(signed word)*pivot;
signed int result = (signed int)key-(signed int)*pivot;
if (result == 0)
return pivot;
if (result > 0) {
@ -50,4 +49,99 @@ word* bsearch16u(word key, word* items, byte num) {
}
// not found - return closest lower value
return *items<=key?items:items-1;
}
// The different supported radix
enum RADIX { BINARY, OCTAL, DECIMAL, HEXADECIMAL };
// Awaits fix https://gitlab.com/camelot/kickc/issues/230
// Information about a radix
//struct RadixInfo {
// // Maximal number of digits needed to represent the number in the radix
// char max_digits;
// // Pointer to array containing the 1-value for each digit. The size of the array is max_digits-1.
// unsigned int* digit_values;
//};
// Values of binary digits
unsigned int[] RADIX_BINARY_VALUES = { 0b1000000000000000, 0b0100000000000000, 0b0010000000000000, 0b0001000000000000, 0b0000100000000000, 0b0000010000000000, 0b0000001000000000, 0b0000000100000000, 0b0000000010000000, 0b0000000001000000, 0b0000000000100000, 0b0000000000010000, 0b0000000000001000, 0b0000000000000100, 0b0000000000000010 };
// Information about the hexadecimal radix
// struct RadixInfo RADIXINFO_BINARY = { 16, RADIX_BINARY_VALUES };
// Values of octal digits
unsigned int[] RADIX_OCTAL_VALUES = { 0x8000, 0x1000, 0x200, 0x40, 0x8 };
// Information about the octal radix
// struct RadixInfo RADIXINFO_OCTAL = { 6, RADIX_OCTAL_VALUES };
// Values of decimal digits
unsigned int[] RADIX_DECIMAL_VALUES = { 10000, 1000, 100, 10 };
// Information about the decimal radix
// struct RadixInfo RADIXINFO_DECIMAL = { 5, RADIX_DECIMAL_VALUES };
// Values of hexadecimal digits
unsigned int[] RADIX_HEXADECIMAL_VALUES = { 0x1000, 0x100, 0x10 };
// Information about the hexadecimal radix
// struct RadixInfo RADIXINFO_HEXADECIMAL = { 4, RADIX_HEXADECIMAL_VALUES };
// Awaits fix https://gitlab.com/camelot/kickc/issues/223
// Information about each radix. Can be retrieved using RADIXINFOS[radix]
// struct RadixInfo[] RADIXINFOS = { RADIXINFO_OCTAL, RADIXINFO_OCTAL, RADIXINFO_DECIMAL, RADIXINFO_HEXADECIMAL };
// The digits used for numbers
char[] DIGITS = "0123456789abcdef"z;
// Converts unsigned number value to a string representing it in RADIX format.
// If the leading digits are zero they are not included in the string.
// - 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)
void utoa(unsigned int value, char* buffer, enum RADIX radix){
// struct RadixInfo info = RADIXINFOS[radix] ;
char max_digits;
unsigned int* digit_values;
if(radix==DECIMAL) {
//info = RADIXINFO_DECIMAL;
max_digits = 5;
digit_values = RADIX_DECIMAL_VALUES;
} else if(radix==HEXADECIMAL) {
//info = RADIXINFO_HEXADECIMAL;
max_digits = 4;
digit_values = RADIX_HEXADECIMAL_VALUES;
} else if(radix==OCTAL) {
//info = RADIXINFO_OCTAL;
max_digits = 6;
digit_values = RADIX_OCTAL_VALUES;
} else if(radix==BINARY) {
//info = RADIXINFO_BINARY;
max_digits = 16;
digit_values = RADIX_BINARY_VALUES;
} else {
// Unknown radix
*buffer++ = 'n';
*buffer++ = 'a';
*buffer = 0;
return;
}
byte started = 0;
for( char digit=0; digit<max_digits-1; digit++ ) {
unsigned int digit_value = digit_values[digit];
if (started || value >= digit_value){
value = utoa_append(buffer++, value, digit_value);
started = 1;
}
}
*buffer++ = DIGITS[(char)value];
*buffer = 0;
}
// Used to convert a single digit of an unsigned number value to a string representation
// Counts a single digit up from '0' as long as the value is larger than sub.
// Each time the digit is increased sub is subtracted from value.
// - buffer : pointer to the char that receives the digit
// - value : The value where the digit will be derived from
// - 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.
unsigned int utoa_append(char *buffer, unsigned int value, unsigned int sub){
char digit = 0;
while (value >= sub){ digit++; value -= sub; }
*buffer = DIGITS[digit];
return value;
}

View File

@ -35,6 +35,11 @@ public class TestPrograms {
public TestPrograms() {
}
@Test
public void testProblemPointerInsideStructSizeofRewriting() throws IOException, URISyntaxException {
compileAndCompare("problem-pointer-inside-struct-sizeof-rewriting");
}
/*
@Test
public void testProblemStructPointerParam() throws IOException, URISyntaxException {

View File

@ -0,0 +1,18 @@
// Illustrates a problem with pointer sizeof()-rewriting for pointers inside structs
unsigned int[] RADIX_DECIMAL_VALUES = { 10000, 1000, 100, 10 };
struct RadixInfo {
unsigned int* values;
};
void main() {
const unsigned int* SCREEN = 0x400;
for( byte radix: 0..1) {
struct RadixInfo info = { RADIX_DECIMAL_VALUES };
for( char digit: 0..4 ) {
unsigned int digit_value = info.values[digit];
SCREEN[digit] = digit_value;
}
}
}

View File

@ -14,6 +14,7 @@ word append(byte *dst, word value, word sub){
while (value >= sub){ ++*dst; value -= sub; }
return value;
}
void utoa(word value, byte *dst){
byte bStarted = 0;
if (bStarted == 1 || value >= 10000){ value = append(dst++, value, 10000); bStarted = 1; }

53
src/test/kc/sieve.kc Normal file
View File

@ -0,0 +1,53 @@
import "print"
import "string"
import "time"
typedef unsigned char uint8_t;
typedef unsigned int uint16_t;
const uint16_t COUNT = 16384; /* Up to what number? */
const uint8_t SQRT_COUNT = 128; /* Sqrt of COUNT */
uint8_t* sieve = 0x1000;
void main (void) {
print_str("Sieve benchmark - calculating primes");
print_ln();
print_str("between 2 and ");
print_word(COUNT);
print_ln();
// Fill sieve with zeros
memset(sieve, 0, COUNT);
clock_start();
unsigned int i = 2;
char* sieve_i = sieve+i;
while (i < SQRT_COUNT) {
if (!*sieve_i) {
/* Prime number - mark all multiples */
unsigned int j = i*2;
unsigned char* s = sieve+j;
while (j < COUNT) {
*s = 1;
s += i;
j += i;
}
}
i++;
sieve_i++;
}
clock_t cyclecount = clock()-CLOCKS_PER_INIT;
print_str("Cycles used: ");
print_dword(cyclecount);
print_ln();
for (i = 2; i < 1024; ++i)
if (!sieve[i]) {
print_word(i);
print_char(' ');
}
}

39
src/test/kc/test-utoa.kc Normal file
View File

@ -0,0 +1,39 @@
// Tests the utoa10() function that converts unsigned int to DECIMAL string
import "stdlib"
import "print"
// buffer for number
char[17] buf;
void main() {
print_cls();
print_utoas(0xffff);
print_utoas(59999);
print_utoas(0xaaaa);
print_utoas(0x5555);
print_utoas(9999);
print_utoas(0x0fff);
print_utoas(999);
print_utoas(0x0ff);
print_utoas(99);
print_utoas(0x0f);
print_utoas(1);
utoa(1, buf, 10);
print_str(buf);
print_ln();
}
void print_utoas(unsigned int value) {
utoa(value, buf, HEXADECIMAL);
print_str(buf);
print_char(' ');
utoa(value, buf, DECIMAL);
print_str(buf);
print_char(' ');
utoa(value, buf, OCTAL);
print_str(buf);
print_char(' ');
utoa(value, buf, BINARY);
print_str(buf);
print_ln();
}

View File

@ -8,6 +8,7 @@ Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items -
Fixing pointer increment (word*) init_squares::squares ← ++ (word*) init_squares::squares
Fixing pointer addition (word~) sqrt::$1 ← (word*) sqrt::found - (word*) SQUARES
Fixing pointer addition (struct ProcessingSprite*~) processChars::$2 ← (struct ProcessingSprite[NUM_PROCESSING]) PROCESSING + (byte) processChars::i
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Fixing pointer array-indexing *((word*) SQUARES + (byte) sqr::val)
Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i)
Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i)
@ -124,6 +125,8 @@ Culled Empty Block (label) @7
Culled Empty Block (label) @8
Culled Empty Block (label) @9
Culled Empty Block (label) @10
Culled Empty Block (label) @11
Culled Empty Block (label) @12
Culled Empty Block (label) atan2_16::@9
Culled Empty Block (label) atan2_16::@10
Culled Empty Block (label) atan2_16::@11
@ -136,33 +139,33 @@ Culled Empty Block (label) atan2_16::@23
Culled Empty Block (label) atan2_16::@31
Culled Empty Block (label) atan2_16::@32
Culled Empty Block (label) atan2_16::@14
Culled Empty Block (label) @12
Culled Empty Block (label) @13
Culled Empty Block (label) @14
Culled Empty Block (label) @15
Culled Empty Block (label) @16
Culled Empty Block (label) @17
Culled Empty Block (label) @18
Culled Empty Block (label) @19
Culled Empty Block (label) @20
Culled Empty Block (label) @21
Culled Empty Block (label) @22
Culled Empty Block (label) @23
Culled Empty Block (label) main::@8
Culled Empty Block (label) main::@9
Culled Empty Block (label) main::@10
Culled Empty Block (label) main::@12
Culled Empty Block (label) @23
Culled Empty Block (label) @25
Culled Empty Block (label) getCharToProcess::@6
Culled Empty Block (label) getCharToProcess::@2
Culled Empty Block (label) @24
Culled Empty Block (label) @26
Culled Empty Block (label) startProcessing::@6
Culled Empty Block (label) startProcessing::@7
Culled Empty Block (label) processChars::@10
Culled Empty Block (label) processChars::@12
Culled Empty Block (label) processChars::@1
Culled Empty Block (label) @26
Culled Empty Block (label) @27
Culled Empty Block (label) init_angle_screen::@4
Culled Empty Block (label) @28
Culled Empty Block (label) @29
Culled Empty Block (label) init_angle_screen::@4
Culled Empty Block (label) @30
Culled Empty Block (label) @31
Culled Empty Block (label) setupRasterIrq::@4
Unwinding list assignment { (byte) main::$9_x, (byte) main::$9_y, (byte) main::$9_dist } ← { (byte) getCharToProcess::return_x, (byte) getCharToProcess::return_y, (byte) getCharToProcess::return_dist }
Unwinding list assignment { (byte) getCharToProcess::return_x#0, (byte) getCharToProcess::return_y#0, (byte) getCharToProcess::return_dist#0 } ← { (byte) getCharToProcess::return_x#2, (byte) getCharToProcess::return_y#2, (byte) getCharToProcess::return_dist#2 }
@ -175,10 +178,10 @@ CONTROL FLOW GRAPH SSA
@4: scope:[] from @begin
(byte*) HEAP_TOP#0 ← ((byte*)) (number) $a000
(byte*) heap_head#0 ← (byte*) HEAP_TOP#0
to:@11
malloc: scope:[malloc] from @22 @33
(word) malloc::size#2 ← phi( @22/(word) malloc::size#0 @33/(word) malloc::size#1 )
(byte*) heap_head#5 ← phi( @22/(byte*) heap_head#9 @33/(byte*) heap_head#3 )
to:@13
malloc: scope:[malloc] from @24 @35
(word) malloc::size#2 ← phi( @24/(word) malloc::size#0 @35/(word) malloc::size#1 )
(byte*) heap_head#5 ← phi( @24/(byte*) heap_head#9 @35/(byte*) heap_head#3 )
(byte*~) malloc::$0 ← (byte*) heap_head#5 - (word) malloc::size#2
(byte*) malloc::mem#0 ← (byte*~) malloc::$0
(byte*) heap_head#1 ← (byte*) malloc::mem#0
@ -191,13 +194,13 @@ malloc::@return: scope:[malloc] from malloc
(byte*) heap_head#2 ← (byte*) heap_head#6
return
to:@return
@11: scope:[] from @4
@13: scope:[] from @4
(byte*) heap_head#11 ← phi( @4/(byte*) heap_head#0 )
(byte) CORDIC_ITERATIONS_16#0 ← (number) $f
(word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 ← kickasm {{ .for (var i=0; i<CORDIC_ITERATIONS_16; i++)
.word 256*2*256*atan(1/pow(2,i))/PI/2
}}
to:@18
to:@20
atan2_16: scope:[atan2_16] from init_angle_screen::@2
(signed word) atan2_16::x#9 ← phi( init_angle_screen::@2/(signed word) atan2_16::x#0 )
(signed word) atan2_16::y#1 ← phi( init_angle_screen::@2/(signed word) atan2_16::y#0 )
@ -408,8 +411,8 @@ atan2_16::@return: scope:[atan2_16] from atan2_16::@8
(word) atan2_16::return#1 ← (word) atan2_16::return#3
return
to:@return
@18: scope:[] from @11
(byte*) heap_head#10 ← phi( @11/(byte*) heap_head#11 )
@20: scope:[] from @13
(byte*) heap_head#10 ← phi( @13/(byte*) heap_head#11 )
(byte*) PROCPORT_DDR#0 ← ((byte*)) (number) 0
(byte) PROCPORT_DDR_MEMORY_MASK#0 ← (number) 7
(byte*) PROCPORT#0 ← ((byte*)) (number) 1
@ -443,9 +446,9 @@ atan2_16::@return: scope:[atan2_16] from atan2_16::@8
(byte) WHITE#0 ← (number) 1
(byte) BLUE#0 ← (number) 6
(byte) LIGHT_BLUE#0 ← (number) $e
to:@22
@22: scope:[] from @18
(byte*) heap_head#9 ← phi( @18/(byte*) heap_head#10 )
to:@24
@24: scope:[] from @20
(byte*) heap_head#9 ← phi( @20/(byte*) heap_head#10 )
(bool) DEBUG#0 ← false
(byte*) SCREEN#0 ← ((byte*)) (number) $400
(byte*) SPRITE_DATA#0 ← ((byte*)) (number) $2000
@ -460,31 +463,31 @@ atan2_16::@return: scope:[atan2_16] from atan2_16::@8
(word) malloc::size#0 ← (number) $3e8
call malloc
(void*) malloc::return#2 ← (void*) malloc::return#1
to:@33
@33: scope:[] from @22
(byte*) heap_head#7 ← phi( @22/(byte*) heap_head#2 )
(void*) malloc::return#5 ← phi( @22/(void*) malloc::return#2 )
to:@35
@35: scope:[] from @24
(byte*) heap_head#7 ← phi( @24/(byte*) heap_head#2 )
(void*) malloc::return#5 ← phi( @24/(void*) malloc::return#2 )
(void*~) $0 ← (void*) malloc::return#5
(byte*) heap_head#3 ← (byte*) heap_head#7
(byte*) SCREEN_COPY#0 ← ((byte*)) (void*~) $0
(word) malloc::size#1 ← (number) $3e8
call malloc
(void*) malloc::return#3 ← (void*) malloc::return#1
to:@34
@34: scope:[] from @33
(byte*) SCREEN_COPY#25 ← phi( @33/(byte*) SCREEN_COPY#0 )
(byte*) heap_head#8 ← phi( @33/(byte*) heap_head#2 )
(void*) malloc::return#6 ← phi( @33/(void*) malloc::return#3 )
to:@36
@36: scope:[] from @35
(byte*) SCREEN_COPY#25 ← phi( @35/(byte*) SCREEN_COPY#0 )
(byte*) heap_head#8 ← phi( @35/(byte*) heap_head#2 )
(void*) malloc::return#6 ← phi( @35/(void*) malloc::return#3 )
(void*~) $1 ← (void*) malloc::return#6
(byte*) heap_head#4 ← (byte*) heap_head#8
(byte*) SCREEN_DIST#0 ← ((byte*)) (void*~) $1
(byte) NUM_PROCESSING#0 ← (number) 8
(byte) NOT_FOUND#0 ← (number) $ff
(struct ProcessingSprite[NUM_PROCESSING#0]) PROCESSING#0 ← { fill( NUM_PROCESSING#0, 0) }
to:@25
main: scope:[main] from @32
(byte*) SCREEN_COPY#4 ← phi( @32/(byte*) SCREEN_COPY#7 )
(byte*) SCREEN_DIST#1 ← phi( @32/(byte*) SCREEN_DIST#3 )
to:@27
main: scope:[main] from @34
(byte*) SCREEN_COPY#4 ← phi( @34/(byte*) SCREEN_COPY#7 )
(byte*) SCREEN_DIST#1 ← phi( @34/(byte*) SCREEN_DIST#3 )
(byte*) init_angle_screen::screen#0 ← (byte*) SCREEN_DIST#1
call init_angle_screen
to:main::@13
@ -867,9 +870,9 @@ startProcessing::@10: scope:[startProcessing] from startProcessing::@9
startProcessing::@return: scope:[startProcessing] from startProcessing::@10
return
to:@return
@25: scope:[] from @34
(byte*) SCREEN_COPY#23 ← phi( @34/(byte*) SCREEN_COPY#25 )
(byte*) SCREEN_DIST#13 ← phi( @34/(byte*) SCREEN_DIST#0 )
@27: scope:[] from @36
(byte*) SCREEN_COPY#23 ← phi( @36/(byte*) SCREEN_COPY#25 )
(byte*) SCREEN_DIST#13 ← phi( @36/(byte*) SCREEN_DIST#0 )
(number~) $2 ← (byte) BORDER_XPOS_LEFT#0 - (number) 8
(word~) $3 ← ((word)) (number~) $2
(word~) $4 ← (word~) $3 << (number) 4
@ -884,7 +887,7 @@ startProcessing::@return: scope:[startProcessing] from startProcessing::@10
(word~) $10 ← ((word)) (byte) BORDER_YPOS_BOTTOM#0
(word~) $11 ← (word~) $10 << (number) 4
(word) YPOS_BOTTOMMOST#0 ← (word~) $11
to:@30
to:@32
processChars: scope:[processChars] from irqBottom::@1
(byte) processChars::numActive#0 ← (number) 0
(number~) processChars::$1 ← (byte) NUM_PROCESSING#0 - (number) 1
@ -1193,11 +1196,11 @@ setupRasterIrq::@2: scope:[setupRasterIrq] from setupRasterIrq::@1 setupRasterI
setupRasterIrq::@return: scope:[setupRasterIrq] from setupRasterIrq::@2
return
to:@return
@30: scope:[] from @25
(byte*) SCREEN_COPY#20 ← phi( @25/(byte*) SCREEN_COPY#23 )
(byte*) SCREEN_DIST#10 ← phi( @25/(byte*) SCREEN_DIST#13 )
@32: scope:[] from @27
(byte*) SCREEN_COPY#20 ← phi( @27/(byte*) SCREEN_COPY#23 )
(byte*) SCREEN_DIST#10 ← phi( @27/(byte*) SCREEN_DIST#13 )
(byte) RASTER_IRQ_TOP#0 ← (number) $30
to:@31
to:@33
irqTop: scope:[irqTop] from
(bool~) irqTop::$0 ← ! (bool) DEBUG#0
if((bool~) irqTop::$0) goto irqTop::@1
@ -1235,11 +1238,11 @@ irqTop::@6: scope:[irqTop] from irqTop::@5
irqTop::@return: scope:[irqTop] from irqTop::@1
return
to:@return
@31: scope:[] from @30
(byte*) SCREEN_COPY#14 ← phi( @30/(byte*) SCREEN_COPY#20 )
(byte*) SCREEN_DIST#7 ← phi( @30/(byte*) SCREEN_DIST#10 )
@33: scope:[] from @32
(byte*) SCREEN_COPY#14 ← phi( @32/(byte*) SCREEN_COPY#20 )
(byte*) SCREEN_DIST#7 ← phi( @32/(byte*) SCREEN_DIST#10 )
(byte) RASTER_IRQ_MIDDLE#0 ← (number) $ff
to:@32
to:@34
irqBottom: scope:[irqBottom] from
(bool~) irqBottom::$0 ← ! (bool) DEBUG#0
if((bool~) irqBottom::$0) goto irqBottom::@1
@ -1277,14 +1280,14 @@ irqBottom::@4: scope:[irqBottom] from irqBottom::@7
irqBottom::@return: scope:[irqBottom] from irqBottom::@2
return
to:@return
@32: scope:[] from @31
(byte*) SCREEN_COPY#7 ← phi( @31/(byte*) SCREEN_COPY#14 )
(byte*) SCREEN_DIST#3 ← phi( @31/(byte*) SCREEN_DIST#7 )
@34: scope:[] from @33
(byte*) SCREEN_COPY#7 ← phi( @33/(byte*) SCREEN_COPY#14 )
(byte*) SCREEN_DIST#3 ← phi( @33/(byte*) SCREEN_DIST#7 )
call main
to:@35
@35: scope:[] from @32
to:@37
@37: scope:[] from @34
to:@end
@end: scope:[] from @35
@end: scope:[] from @37
SYMBOL TABLE SSA
(void*~) $0
@ -1299,16 +1302,16 @@ SYMBOL TABLE SSA
(number~) $7
(word~) $8
(word~) $9
(label) @11
(label) @18
(label) @22
(label) @25
(label) @30
(label) @31
(label) @13
(label) @20
(label) @24
(label) @27
(label) @32
(label) @33
(label) @34
(label) @35
(label) @36
(label) @37
(label) @4
(label) @begin
(label) @end
@ -1392,6 +1395,10 @@ SYMBOL TABLE SSA
(word) ProcessingSprite::vy
(word) ProcessingSprite::x
(word) ProcessingSprite::y
(const byte) RADIX::BINARY = (byte) 0
(const byte) RADIX::DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL = (byte) 1
(byte*) RASTER
(byte*) RASTER#0
(byte) RASTER_IRQ_MIDDLE
@ -3694,14 +3701,14 @@ Added new block during phi lifting initSprites::@5(between initSprites::@1 and i
Added new block during phi lifting initSprites::@6(between initSprites::@3 and initSprites::@3)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @4
Adding NOP phi() at start of @11
Adding NOP phi() at start of @18
Adding NOP phi() at start of @22
Adding NOP phi() at start of @25
Adding NOP phi() at start of @30
Adding NOP phi() at start of @31
Adding NOP phi() at start of @13
Adding NOP phi() at start of @20
Adding NOP phi() at start of @24
Adding NOP phi() at start of @27
Adding NOP phi() at start of @32
Adding NOP phi() at start of @35
Adding NOP phi() at start of @33
Adding NOP phi() at start of @34
Adding NOP phi() at start of @37
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of main::@4
@ -3812,12 +3819,12 @@ Coalesced [383] processChars::numActive#15 ← processChars::numActive#3
Coalesced (already) [388] processChars::numActive#16 ← processChars::numActive#10
Coalesced down to 37 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) @11
Culled Empty Block (label) @18
Culled Empty Block (label) @25
Culled Empty Block (label) @30
Culled Empty Block (label) @31
Culled Empty Block (label) @35
Culled Empty Block (label) @13
Culled Empty Block (label) @20
Culled Empty Block (label) @27
Culled Empty Block (label) @32
Culled Empty Block (label) @33
Culled Empty Block (label) @37
Culled Empty Block (label) main::@2
Culled Empty Block (label) main::@15
Culled Empty Block (label) main::@17
@ -3842,10 +3849,10 @@ Culled Empty Block (label) irqBottom::@7
Culled Empty Block (label) processChars::@15
Culled Empty Block (label) processChars::@20
Culled Empty Block (label) processChars::@21
Renumbering block @22 to @1
Renumbering block @32 to @2
Renumbering block @33 to @3
Renumbering block @34 to @4
Renumbering block @24 to @1
Renumbering block @34 to @2
Renumbering block @35 to @3
Renumbering block @36 to @4
Renumbering block atan2_16::@13 to atan2_16::@9
Renumbering block atan2_16::@15 to atan2_16::@10
Renumbering block atan2_16::@16 to atan2_16::@11
@ -8038,6 +8045,7 @@ Uplift Scope [main] 27.5: zp ZP_WORD:2 [ main::src#2 main::src#1 ] 26.67: zp ZP_
Uplift Scope [initSprites] 33: zp ZP_WORD:24 [ initSprites::sp#2 initSprites::sp#1 ] 33: zp ZP_BYTE:26 [ initSprites::i#2 initSprites::i#1 ]
Uplift Scope [] 5: zp ZP_WORD:48 [ heap_head#5 heap_head#1 ] 0.03: zp ZP_WORD:54 [ SCREEN_DIST#0 ] 0.03: zp ZP_WORD:52 [ SCREEN_COPY#0 ]
Uplift Scope [malloc] 0.8: zp ZP_WORD:158 [ malloc::mem#0 ]
Uplift Scope [RADIX]
Uplift Scope [ProcessingChar]
Uplift Scope [ProcessingSprite]
Uplift Scope [ProcessingSprite::$0]
@ -8056,6 +8064,7 @@ Limited combination testing to 100 combinations of 147456 possible.
Uplifting [initSprites] best 1264136 combination zp ZP_WORD:24 [ initSprites::sp#2 initSprites::sp#1 ] reg byte x [ initSprites::i#2 initSprites::i#1 ]
Uplifting [] best 1264136 combination zp ZP_WORD:48 [ heap_head#5 heap_head#1 ] zp ZP_WORD:54 [ SCREEN_DIST#0 ] zp ZP_WORD:52 [ SCREEN_COPY#0 ]
Uplifting [malloc] best 1264136 combination zp ZP_WORD:158 [ malloc::mem#0 ]
Uplifting [RADIX] best 1264136 combination
Uplifting [ProcessingChar] best 1264136 combination
Uplifting [ProcessingSprite] best 1264136 combination
Uplifting [ProcessingSprite::$0] best 1264136 combination
@ -10624,6 +10633,10 @@ FINAL SYMBOL TABLE
(word) ProcessingSprite::vy
(word) ProcessingSprite::x
(word) ProcessingSprite::y
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) RASTER
(const byte*) RASTER#0 RASTER = (byte*) 53266
(byte) RASTER_IRQ_MIDDLE

View File

@ -78,6 +78,10 @@
(word) ProcessingSprite::vy
(word) ProcessingSprite::x
(word) ProcessingSprite::y
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) RASTER
(const byte*) RASTER#0 RASTER = (byte*) 53266
(byte) RASTER_IRQ_MIDDLE

View File

@ -1,6 +1,7 @@
Fixing pointer addition (word*~) bsearch16u::$7 ← (word*) bsearch16u::items + (byte~) bsearch16u::$6
Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot + (number) 1
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
Identified constant variable (byte*) HEAP_TOP
Culled Empty Block (label) @1
@ -10,6 +11,8 @@ Culled Empty Block (label) malloc::@1
Culled Empty Block (label) @5
Culled Empty Block (label) @6
Culled Empty Block (label) @7
Culled Empty Block (label) @8
Culled Empty Block (label) @9
Culled Empty Block (label) main::@2
CONTROL FLOW GRAPH SSA
@ -18,10 +21,10 @@ CONTROL FLOW GRAPH SSA
@4: scope:[] from @begin
(byte*) HEAP_TOP#0 ← ((byte*)) (number) $a000
(byte*) heap_head#0 ← (byte*) HEAP_TOP#0
to:@8
malloc: scope:[malloc] from @8
(word) malloc::size#1 ← phi( @8/(word) malloc::size#0 )
(byte*) heap_head#4 ← phi( @8/(byte*) heap_head#7 )
to:@10
malloc: scope:[malloc] from @10
(word) malloc::size#1 ← phi( @10/(word) malloc::size#0 )
(byte*) heap_head#4 ← phi( @10/(byte*) heap_head#7 )
(byte*~) malloc::$0 ← (byte*) heap_head#4 - (word) malloc::size#1
(byte*) malloc::mem#0 ← (byte*~) malloc::$0
(byte*) heap_head#1 ← (byte*) malloc::mem#0
@ -34,21 +37,21 @@ malloc::@return: scope:[malloc] from malloc
(byte*) heap_head#2 ← (byte*) heap_head#5
return
to:@return
@8: scope:[] from @4
@10: scope:[] from @4
(byte*) heap_head#7 ← phi( @4/(byte*) heap_head#0 )
(word) malloc::size#0 ← (number) $100
call malloc
(void*) malloc::return#2 ← (void*) malloc::return#1
to:@10
@10: scope:[] from @8
(byte*) heap_head#6 ← phi( @8/(byte*) heap_head#2 )
(void*) malloc::return#4 ← phi( @8/(void*) malloc::return#2 )
to:@12
@12: scope:[] from @10
(byte*) heap_head#6 ← phi( @10/(byte*) heap_head#2 )
(void*) malloc::return#4 ← phi( @10/(void*) malloc::return#2 )
(void*~) $0 ← (void*) malloc::return#4
(byte*) heap_head#3 ← (byte*) heap_head#6
(byte*) BYTES#0 ← ((byte*)) (void*~) $0
to:@9
main: scope:[main] from @9
(byte*) BYTES#2 ← phi( @9/(byte*) BYTES#3 )
to:@11
main: scope:[main] from @11
(byte*) BYTES#2 ← phi( @11/(byte*) BYTES#3 )
(byte) main::i#0 ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@1
@ -62,21 +65,21 @@ main::@1: scope:[main] from main main::@1
main::@return: scope:[main] from main::@1
return
to:@return
@9: scope:[] from @10
(byte*) BYTES#3 ← phi( @10/(byte*) BYTES#0 )
@11: scope:[] from @12
(byte*) BYTES#3 ← phi( @12/(byte*) BYTES#0 )
call main
to:@11
@11: scope:[] from @9
to:@13
@13: scope:[] from @11
to:@end
@end: scope:[] from @11
@end: scope:[] from @13
SYMBOL TABLE SSA
(void*~) $0
(label) @10
(label) @11
(label) @12
(label) @13
(label) @4
(label) @8
(label) @9
(label) @begin
(label) @end
(byte*) BYTES
@ -86,6 +89,10 @@ SYMBOL TABLE SSA
(byte*) BYTES#3
(byte*) HEAP_TOP
(byte*) HEAP_TOP#0
(const byte) RADIX::BINARY = (byte) 0
(const byte) RADIX::DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL = (byte) 1
(byte*) heap_head
(byte*) heap_head#0
(byte*) heap_head#1
@ -187,10 +194,10 @@ Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@3(between main::@1 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @4
Adding NOP phi() at start of @8
Adding NOP phi() at start of @10
Adding NOP phi() at start of @9
Adding NOP phi() at start of @12
Adding NOP phi() at start of @11
Adding NOP phi() at start of @13
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of malloc
@ -201,11 +208,11 @@ Created 1 initial phi equivalence classes
Coalesced [15] main::i#3 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) @10
Culled Empty Block (label) @11
Culled Empty Block (label) @12
Culled Empty Block (label) @13
Culled Empty Block (label) main::@3
Renumbering block @8 to @1
Renumbering block @9 to @2
Renumbering block @10 to @1
Renumbering block @11 to @2
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
@ -354,10 +361,12 @@ Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg by
REGISTER UPLIFT SCOPES
Uplift Scope [main] 38.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [malloc]
Uplift Scope [RADIX]
Uplift Scope []
Uplifting [main] best 308 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [malloc] best 308 combination
Uplifting [RADIX] best 308 combination
Uplifting [] best 308 combination
ASSEMBLER BEFORE OPTIMIZATION
@ -475,6 +484,10 @@ FINAL SYMBOL TABLE
(const byte*) BYTES#0 BYTES = (byte*)(const void*) malloc::return#0
(byte*) HEAP_TOP
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) heap_head
(void()) main()
(label) main::@1

View File

@ -6,6 +6,10 @@
(const byte*) BYTES#0 BYTES = (byte*)(const void*) malloc::return#0
(byte*) HEAP_TOP
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) heap_head
(void()) main()
(label) main::@1

View File

@ -2,6 +2,7 @@ Fixing pointer addition (word*~) bsearch16u::$7 ← (word*) bsearch16u::items +
Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot + (number) 1
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
Fixing pointer increment (word*) main::w ← ++ (word*) main::w
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
Identified constant variable (byte*) HEAP_TOP
Culled Empty Block (label) @1
@ -11,6 +12,8 @@ Culled Empty Block (label) malloc::@1
Culled Empty Block (label) @5
Culled Empty Block (label) @6
Culled Empty Block (label) @7
Culled Empty Block (label) @8
Culled Empty Block (label) @9
Culled Empty Block (label) main::@2
CONTROL FLOW GRAPH SSA
@ -19,10 +22,10 @@ CONTROL FLOW GRAPH SSA
@4: scope:[] from @begin
(byte*) HEAP_TOP#0 ← ((byte*)) (number) $a000
(byte*) heap_head#0 ← (byte*) HEAP_TOP#0
to:@8
malloc: scope:[malloc] from @8
(word) malloc::size#1 ← phi( @8/(word) malloc::size#0 )
(byte*) heap_head#4 ← phi( @8/(byte*) heap_head#7 )
to:@10
malloc: scope:[malloc] from @10
(word) malloc::size#1 ← phi( @10/(word) malloc::size#0 )
(byte*) heap_head#4 ← phi( @10/(byte*) heap_head#7 )
(byte*~) malloc::$0 ← (byte*) heap_head#4 - (word) malloc::size#1
(byte*) malloc::mem#0 ← (byte*~) malloc::$0
(byte*) heap_head#1 ← (byte*) malloc::mem#0
@ -35,21 +38,21 @@ malloc::@return: scope:[malloc] from malloc
(byte*) heap_head#2 ← (byte*) heap_head#5
return
to:@return
@8: scope:[] from @4
@10: scope:[] from @4
(byte*) heap_head#7 ← phi( @4/(byte*) heap_head#0 )
(word) malloc::size#0 ← (number) $200
call malloc
(void*) malloc::return#2 ← (void*) malloc::return#1
to:@10
@10: scope:[] from @8
(byte*) heap_head#6 ← phi( @8/(byte*) heap_head#2 )
(void*) malloc::return#4 ← phi( @8/(void*) malloc::return#2 )
to:@12
@12: scope:[] from @10
(byte*) heap_head#6 ← phi( @10/(byte*) heap_head#2 )
(void*) malloc::return#4 ← phi( @10/(void*) malloc::return#2 )
(void*~) $0 ← (void*) malloc::return#4
(byte*) heap_head#3 ← (byte*) heap_head#6
(word*) WORDS#0 ← ((word*)) (void*~) $0
to:@9
main: scope:[main] from @9
(word*) WORDS#1 ← phi( @9/(word*) WORDS#2 )
to:@11
main: scope:[main] from @11
(word*) WORDS#1 ← phi( @11/(word*) WORDS#2 )
(word*) main::w#0 ← (word*) WORDS#1
(byte) main::i#0 ← (byte) 0
to:main::@1
@ -65,25 +68,29 @@ main::@1: scope:[main] from main main::@1
main::@return: scope:[main] from main::@1
return
to:@return
@9: scope:[] from @10
(word*) WORDS#2 ← phi( @10/(word*) WORDS#0 )
@11: scope:[] from @12
(word*) WORDS#2 ← phi( @12/(word*) WORDS#0 )
call main
to:@11
@11: scope:[] from @9
to:@13
@13: scope:[] from @11
to:@end
@end: scope:[] from @11
@end: scope:[] from @13
SYMBOL TABLE SSA
(void*~) $0
(label) @10
(label) @11
(label) @12
(label) @13
(label) @4
(label) @8
(label) @9
(label) @begin
(label) @end
(byte*) HEAP_TOP
(byte*) HEAP_TOP#0
(const byte) RADIX::BINARY = (byte) 0
(const byte) RADIX::DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL = (byte) 1
(const byte) SIZEOF_WORD = (byte) 2
(word*) WORDS
(word*) WORDS#0
@ -195,10 +202,10 @@ Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@3(between main::@1 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @4
Adding NOP phi() at start of @8
Adding NOP phi() at start of @10
Adding NOP phi() at start of @9
Adding NOP phi() at start of @12
Adding NOP phi() at start of @11
Adding NOP phi() at start of @13
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of malloc
@ -210,11 +217,11 @@ Coalesced [16] main::i#3 ← main::i#1
Coalesced [17] main::w#3 ← main::w#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) @10
Culled Empty Block (label) @11
Culled Empty Block (label) @12
Culled Empty Block (label) @13
Culled Empty Block (label) main::@3
Renumbering block @8 to @1
Renumbering block @9 to @2
Renumbering block @10 to @1
Renumbering block @11 to @2
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
@ -397,10 +404,12 @@ Potential registers zp ZP_WORD:3 [ main::w#2 main::w#1 ] : zp ZP_WORD:3 ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 27.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 23.83: zp ZP_WORD:3 [ main::w#2 main::w#1 ]
Uplift Scope [malloc]
Uplift Scope [RADIX]
Uplift Scope []
Uplifting [main] best 713 combination reg byte x [ main::i#2 main::i#1 ] zp ZP_WORD:3 [ main::w#2 main::w#1 ]
Uplifting [malloc] best 713 combination
Uplifting [RADIX] best 713 combination
Uplifting [] best 713 combination
Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ main::w#2 main::w#1 ]
@ -537,6 +546,10 @@ FINAL SYMBOL TABLE
(label) @end
(byte*) HEAP_TOP
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(const byte) SIZEOF_WORD SIZEOF_WORD = (byte) 2
(word*) WORDS
(const word*) WORDS#0 WORDS = (word*)(const void*) malloc::return#0

View File

@ -4,6 +4,10 @@
(label) @end
(byte*) HEAP_TOP
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(const byte) SIZEOF_WORD SIZEOF_WORD = (byte) 2
(word*) WORDS
(const word*) WORDS#0 WORDS = (word*)(const void*) malloc::return#0

View File

@ -1,6 +1,7 @@
Fixing pointer addition (word*~) bsearch16u::$7 ← (word*) bsearch16u::items + (byte~) bsearch16u::$6
Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot + (number) 1
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
Identified constant variable (byte*) HEAP_TOP
Identified constant variable (byte*) main::screen
@ -12,6 +13,8 @@ Culled Empty Block (label) @5
Culled Empty Block (label) @6
Culled Empty Block (label) @7
Culled Empty Block (label) @8
Culled Empty Block (label) @9
Culled Empty Block (label) @10
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
@ -19,7 +22,7 @@ CONTROL FLOW GRAPH SSA
@4: scope:[] from @begin
(byte*) HEAP_TOP#0 ← ((byte*)) (number) $a000
(byte*) heap_head#0 ← (byte*) HEAP_TOP#0
to:@9
to:@11
malloc: scope:[malloc] from main main::@3
(word) malloc::size#2 ← phi( main/(word) malloc::size#0 main::@3/(word) malloc::size#1 )
(byte*) heap_head#7 ← phi( main/(byte*) heap_head#13 main::@3/(byte*) heap_head#3 )
@ -40,8 +43,8 @@ free: scope:[free] from main::@2 main::@5
free::@return: scope:[free] from free
return
to:@return
main: scope:[main] from @9
(byte*) heap_head#13 ← phi( @9/(byte*) heap_head#15 )
main: scope:[main] from @11
(byte*) heap_head#13 ← phi( @11/(byte*) heap_head#15 )
(word) malloc::size#0 ← (number) $64
call malloc
(void*) malloc::return#2 ← (void*) malloc::return#1
@ -104,24 +107,28 @@ main::@return: scope:[main] from main::@6
(byte*) heap_head#5 ← (byte*) heap_head#11
return
to:@return
@9: scope:[] from @4
@11: scope:[] from @4
(byte*) heap_head#15 ← phi( @4/(byte*) heap_head#0 )
call main
to:@10
@10: scope:[] from @9
(byte*) heap_head#12 ← phi( @9/(byte*) heap_head#5 )
to:@12
@12: scope:[] from @11
(byte*) heap_head#12 ← phi( @11/(byte*) heap_head#5 )
(byte*) heap_head#6 ← (byte*) heap_head#12
to:@end
@end: scope:[] from @10
@end: scope:[] from @12
SYMBOL TABLE SSA
(label) @10
(label) @11
(label) @12
(label) @4
(label) @9
(label) @begin
(label) @end
(byte*) HEAP_TOP
(byte*) HEAP_TOP#0
(const byte) RADIX::BINARY = (byte) 0
(const byte) RADIX::DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL = (byte) 1
(void()) free((void*) free::ptr)
(label) free::@return
(void*) free::ptr
@ -295,8 +302,8 @@ Successful SSA optimization Pass2IdenticalPhiElimination
Added new block during phi lifting main::@7(between main::@1 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @4
Adding NOP phi() at start of @9
Adding NOP phi() at start of @10
Adding NOP phi() at start of @11
Adding NOP phi() at start of @12
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@2
@ -312,9 +319,9 @@ Coalesced [25] main::i#3 ← main::i#1
Not coalescing [30] heap_head#1 ← malloc::mem#0
Coalesced down to 3 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) @10
Culled Empty Block (label) @12
Culled Empty Block (label) main::@7
Renumbering block @9 to @1
Renumbering block @11 to @1
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
@ -622,11 +629,13 @@ Uplift Scope [main] 33: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 22: zp ZP_BYTE:9 [
Uplift Scope [] 5: zp ZP_WORD:3 [ heap_head#7 heap_head#1 ]
Uplift Scope [malloc] 0.8: zp ZP_WORD:10 [ malloc::mem#0 ]
Uplift Scope [free]
Uplift Scope [RADIX]
Uplifting [main] best 556 combination reg byte y [ main::i#2 main::i#1 ] reg byte a [ main::$4 ] zp ZP_WORD:7 [ main::buf2#0 ] zp ZP_WORD:5 [ main::buf1#0 ]
Uplifting [] best 556 combination zp ZP_WORD:3 [ heap_head#7 heap_head#1 ]
Uplifting [malloc] best 556 combination zp ZP_WORD:10 [ malloc::mem#0 ]
Uplifting [free] best 556 combination
Uplifting [RADIX] best 556 combination
Coalescing zero page register with common assignment [ zp ZP_WORD:7 [ main::buf2#0 ] ] with [ zp ZP_WORD:10 [ malloc::mem#0 ] ] - score: 1
Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ heap_head#7 heap_head#1 ]
Allocated (was zp ZP_WORD:5) zp ZP_WORD:4 [ main::buf1#0 ]
@ -840,6 +849,10 @@ FINAL SYMBOL TABLE
(label) @end
(byte*) HEAP_TOP
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(void()) free((void*) free::ptr)
(label) free::@return
(void*) free::ptr

View File

@ -3,6 +3,10 @@
(label) @end
(byte*) HEAP_TOP
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(void()) free((void*) free::ptr)
(label) free::@return
(void*) free::ptr

View File

@ -3,6 +3,7 @@ Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot +
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
Fixing pointer increment (word*) init_squares::squares ← ++ (word*) init_squares::squares
Fixing pointer addition (word~) sqrt::$1 ← (word*) sqrt::found - (word*) SQUARES
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Fixing pointer array-indexing *((word*) SQUARES + (byte) sqr::val)
Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i)
Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i)
@ -32,10 +33,12 @@ Culled Empty Block (label) bsearch16u::@16
Culled Empty Block (label) bsearch16u::@17
Culled Empty Block (label) bsearch16u::@4
Culled Empty Block (label) bsearch16u::@5
Culled Empty Block (label) init_squares::@2
Culled Empty Block (label) @12
Culled Empty Block (label) @13
Culled Empty Block (label) init_squares::@2
Culled Empty Block (label) @15
Culled Empty Block (label) sqr::@1
Culled Empty Block (label) @14
Culled Empty Block (label) @16
Culled Empty Block (label) sqrt::@1
Culled Empty Block (label) atan2_16::@9
Culled Empty Block (label) atan2_16::@10
@ -49,9 +52,7 @@ Culled Empty Block (label) atan2_16::@23
Culled Empty Block (label) atan2_16::@31
Culled Empty Block (label) atan2_16::@32
Culled Empty Block (label) atan2_16::@14
Culled Empty Block (label) @16
Culled Empty Block (label) @18
Culled Empty Block (label) @19
Culled Empty Block (label) @20
Culled Empty Block (label) @21
Culled Empty Block (label) @22
@ -70,7 +71,9 @@ Culled Empty Block (label) @34
Culled Empty Block (label) @35
Culled Empty Block (label) @36
Culled Empty Block (label) @37
Culled Empty Block (label) @38
Culled Empty Block (label) @39
Culled Empty Block (label) @41
Culled Empty Block (label) sid_rnd::@1
Culled Empty Block (label) main::toD0181_@1
Culled Empty Block (label) main::toD0182_@1
@ -78,15 +81,15 @@ Culled Empty Block (label) main::@4
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@5
Culled Empty Block (label) main::@6
Culled Empty Block (label) @42
Culled Empty Block (label) @44
Culled Empty Block (label) init_angle_screen::@4
Culled Empty Block (label) @43
Culled Empty Block (label) @45
Culled Empty Block (label) init_dist_screen::@13
Culled Empty Block (label) init_dist_screen::@14
Culled Empty Block (label) init_dist_screen::@9
Culled Empty Block (label) init_dist_screen::@10
Culled Empty Block (label) init_dist_screen::@12
Culled Empty Block (label) @44
Culled Empty Block (label) @46
Culled Empty Block (label) make_plasma_charset::@10
CONTROL FLOW GRAPH SSA
@ -134,10 +137,10 @@ memset::@return: scope:[memset] from memset::@1
@8: scope:[] from @begin
(byte*) HEAP_TOP#0 ← ((byte*)) (number) $a000
(byte*) heap_head#0 ← (byte*) HEAP_TOP#0
to:@12
malloc: scope:[malloc] from @40 @46 init_squares
(word) malloc::size#3 ← phi( @40/(word) malloc::size#1 @46/(word) malloc::size#2 init_squares/(word) malloc::size#0 )
(byte*) heap_head#12 ← phi( @40/(byte*) heap_head#23 @46/(byte*) heap_head#5 init_squares/(byte*) heap_head#24 )
to:@14
malloc: scope:[malloc] from @42 @48 init_squares
(word) malloc::size#3 ← phi( @42/(word) malloc::size#1 @48/(word) malloc::size#2 init_squares/(word) malloc::size#0 )
(byte*) heap_head#12 ← phi( @42/(byte*) heap_head#23 @48/(byte*) heap_head#5 init_squares/(byte*) heap_head#24 )
(byte*~) malloc::$0 ← (byte*) heap_head#12 - (word) malloc::size#3
(byte*) malloc::mem#0 ← (byte*~) malloc::$0
(byte*) heap_head#1 ← (byte*) malloc::mem#0
@ -232,11 +235,11 @@ bsearch16u::@3: scope:[bsearch16u] from bsearch16u::@1 bsearch16u::@2
(word*~) bsearch16u::$4 ← phi( bsearch16u::@1/(word*~) bsearch16u::$3 bsearch16u::@2/(word*~) bsearch16u::$2 )
(word*) bsearch16u::return#2 ← (word*~) bsearch16u::$4
to:bsearch16u::@return
@12: scope:[] from @8
@14: scope:[] from @8
(byte*) heap_head#44 ← phi( @8/(byte*) heap_head#0 )
(byte) NUM_SQUARES#0 ← (number) $ff
(word*) SQUARES#0 ← (word*) 0
to:@15
to:@17
init_squares: scope:[init_squares] from init_dist_screen
(byte*) heap_head#24 ← phi( init_dist_screen/(byte*) heap_head#28 )
(byte) NUM_SQUARES#6 ← phi( init_dist_screen/(byte) NUM_SQUARES#3 )
@ -316,15 +319,15 @@ sqrt::@return: scope:[sqrt] from sqrt::@2
(byte) sqrt::return#1 ← (byte) sqrt::return#3
return
to:@return
@15: scope:[] from @12
(word*) SQUARES#49 ← phi( @12/(word*) SQUARES#0 )
(byte) NUM_SQUARES#42 ← phi( @12/(byte) NUM_SQUARES#0 )
(byte*) heap_head#40 ← phi( @12/(byte*) heap_head#44 )
@17: scope:[] from @14
(word*) SQUARES#49 ← phi( @14/(word*) SQUARES#0 )
(byte) NUM_SQUARES#42 ← phi( @14/(byte) NUM_SQUARES#0 )
(byte*) heap_head#40 ← phi( @14/(byte*) heap_head#44 )
(byte) CORDIC_ITERATIONS_16#0 ← (number) $f
(word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 ← kickasm {{ .for (var i=0; i<CORDIC_ITERATIONS_16; i++)
.word 256*2*256*atan(1/pow(2,i))/PI/2
}}
to:@17
to:@19
atan2_16: scope:[atan2_16] from init_angle_screen::@2
(signed word) atan2_16::x#9 ← phi( init_angle_screen::@2/(signed word) atan2_16::x#0 )
(signed word) atan2_16::y#1 ← phi( init_angle_screen::@2/(signed word) atan2_16::y#0 )
@ -535,14 +538,14 @@ atan2_16::@return: scope:[atan2_16] from atan2_16::@8
(word) atan2_16::return#1 ← (word) atan2_16::return#3
return
to:@return
@17: scope:[] from @15
(word*) SQUARES#47 ← phi( @15/(word*) SQUARES#49 )
(byte) NUM_SQUARES#38 ← phi( @15/(byte) NUM_SQUARES#42 )
(byte*) heap_head#36 ← phi( @15/(byte*) heap_head#40 )
@19: scope:[] from @17
(word*) SQUARES#47 ← phi( @17/(word*) SQUARES#49 )
(byte) NUM_SQUARES#38 ← phi( @17/(byte) NUM_SQUARES#42 )
(byte*) heap_head#36 ← phi( @17/(byte*) heap_head#40 )
(byte*) print_screen#0 ← ((byte*)) (number) $400
(byte*) print_line_cursor#0 ← (byte*) print_screen#0
(byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0
to:@38
to:@40
print_char: scope:[print_char] from make_plasma_charset::@8
(byte*) print_char_cursor#11 ← phi( make_plasma_charset::@8/(byte*) print_char_cursor#20 )
(byte) print_char::ch#1 ← phi( make_plasma_charset::@8/(byte) print_char::ch#0 )
@ -579,18 +582,18 @@ print_cls::@return: scope:[print_cls] from print_cls::@2
(byte*) print_char_cursor#4 ← (byte*) print_char_cursor#13
return
to:@return
@38: scope:[] from @17
(byte*) print_screen#14 ← phi( @17/(byte*) print_screen#0 )
(byte*) print_char_cursor#43 ← phi( @17/(byte*) print_char_cursor#0 )
(byte*) print_line_cursor#38 ← phi( @17/(byte*) print_line_cursor#0 )
(word*) SQUARES#45 ← phi( @17/(word*) SQUARES#47 )
(byte) NUM_SQUARES#35 ← phi( @17/(byte) NUM_SQUARES#38 )
(byte*) heap_head#31 ← phi( @17/(byte*) heap_head#36 )
@40: scope:[] from @19
(byte*) print_screen#14 ← phi( @19/(byte*) print_screen#0 )
(byte*) print_char_cursor#43 ← phi( @19/(byte*) print_char_cursor#0 )
(byte*) print_line_cursor#38 ← phi( @19/(byte*) print_line_cursor#0 )
(word*) SQUARES#45 ← phi( @19/(word*) SQUARES#47 )
(byte) NUM_SQUARES#35 ← phi( @19/(byte) NUM_SQUARES#38 )
(byte*) heap_head#31 ← phi( @19/(byte*) heap_head#36 )
(word*) SID_VOICE3_FREQ#0 ← ((word*)) (number) $d40e
(byte*) SID_VOICE3_CONTROL#0 ← ((byte*)) (number) $d412
(byte) SID_CONTROL_NOISE#0 ← (number) $80
(byte*) SID_VOICE3_OSC#0 ← ((byte*)) (number) $d41b
to:@40
to:@42
sid_rnd_init: scope:[sid_rnd_init] from make_plasma_charset
*((word*) SID_VOICE3_FREQ#0) ← (number) $ffff
*((byte*) SID_VOICE3_CONTROL#0) ← (byte) SID_CONTROL_NOISE#0
@ -606,59 +609,59 @@ sid_rnd::@return: scope:[sid_rnd] from sid_rnd
(byte) sid_rnd::return#1 ← (byte) sid_rnd::return#3
return
to:@return
@40: scope:[] from @38
(byte*) print_screen#13 ← phi( @38/(byte*) print_screen#14 )
(byte*) print_char_cursor#39 ← phi( @38/(byte*) print_char_cursor#43 )
(byte*) print_line_cursor#34 ← phi( @38/(byte*) print_line_cursor#38 )
(word*) SQUARES#43 ← phi( @38/(word*) SQUARES#45 )
(byte) NUM_SQUARES#32 ← phi( @38/(byte) NUM_SQUARES#35 )
(byte*) heap_head#23 ← phi( @38/(byte*) heap_head#31 )
@42: scope:[] from @40
(byte*) print_screen#13 ← phi( @40/(byte*) print_screen#14 )
(byte*) print_char_cursor#39 ← phi( @40/(byte*) print_char_cursor#43 )
(byte*) print_line_cursor#34 ← phi( @40/(byte*) print_line_cursor#38 )
(word*) SQUARES#43 ← phi( @40/(word*) SQUARES#45 )
(byte) NUM_SQUARES#32 ← phi( @40/(byte) NUM_SQUARES#35 )
(byte*) heap_head#23 ← phi( @40/(byte*) heap_head#31 )
(byte[$200]) SINTABLE#0 ← kickasm {{ .for(var i=0;i<$200;i++)
.byte round(127.5+127.5*sin(2*PI*i/256))
}}
(word) malloc::size#1 ← (number) $3e8
call malloc
(void*) malloc::return#3 ← (void*) malloc::return#1
to:@46
@46: scope:[] from @40
(byte*) print_screen#12 ← phi( @40/(byte*) print_screen#13 )
(byte*) print_char_cursor#36 ← phi( @40/(byte*) print_char_cursor#39 )
(byte*) print_line_cursor#31 ← phi( @40/(byte*) print_line_cursor#34 )
(word*) SQUARES#39 ← phi( @40/(word*) SQUARES#43 )
(byte) NUM_SQUARES#28 ← phi( @40/(byte) NUM_SQUARES#32 )
(byte*) heap_head#16 ← phi( @40/(byte*) heap_head#2 )
(void*) malloc::return#7 ← phi( @40/(void*) malloc::return#3 )
to:@48
@48: scope:[] from @42
(byte*) print_screen#12 ← phi( @42/(byte*) print_screen#13 )
(byte*) print_char_cursor#36 ← phi( @42/(byte*) print_char_cursor#39 )
(byte*) print_line_cursor#31 ← phi( @42/(byte*) print_line_cursor#34 )
(word*) SQUARES#39 ← phi( @42/(word*) SQUARES#43 )
(byte) NUM_SQUARES#28 ← phi( @42/(byte) NUM_SQUARES#32 )
(byte*) heap_head#16 ← phi( @42/(byte*) heap_head#2 )
(void*) malloc::return#7 ← phi( @42/(void*) malloc::return#3 )
(void*~) $0 ← (void*) malloc::return#7
(byte*) heap_head#5 ← (byte*) heap_head#16
(byte*) SCREEN_DIST#0 ← ((byte*)) (void*~) $0
(word) malloc::size#2 ← (number) $3e8
call malloc
(void*) malloc::return#4 ← (void*) malloc::return#1
to:@47
@47: scope:[] from @46
(byte*) print_screen#11 ← phi( @46/(byte*) print_screen#12 )
(byte*) print_char_cursor#34 ← phi( @46/(byte*) print_char_cursor#36 )
(byte*) print_line_cursor#28 ← phi( @46/(byte*) print_line_cursor#31 )
(word*) SQUARES#36 ← phi( @46/(word*) SQUARES#39 )
(byte) NUM_SQUARES#25 ← phi( @46/(byte) NUM_SQUARES#28 )
(byte*) heap_head#17 ← phi( @46/(byte*) heap_head#2 )
(void*) malloc::return#8 ← phi( @46/(void*) malloc::return#4 )
to:@49
@49: scope:[] from @48
(byte*) print_screen#11 ← phi( @48/(byte*) print_screen#12 )
(byte*) print_char_cursor#34 ← phi( @48/(byte*) print_char_cursor#36 )
(byte*) print_line_cursor#28 ← phi( @48/(byte*) print_line_cursor#31 )
(word*) SQUARES#36 ← phi( @48/(word*) SQUARES#39 )
(byte) NUM_SQUARES#25 ← phi( @48/(byte) NUM_SQUARES#28 )
(byte*) heap_head#17 ← phi( @48/(byte*) heap_head#2 )
(void*) malloc::return#8 ← phi( @48/(void*) malloc::return#4 )
(void*~) $1 ← (void*) malloc::return#8
(byte*) heap_head#6 ← (byte*) heap_head#17
(byte*) SCREEN_ANGLE#0 ← ((byte*)) (void*~) $1
(byte*) CHARSET#0 ← ((byte*)) (number) $2000
(byte*) SCREEN1#0 ← ((byte*)) (number) $2800
(byte*) SCREEN2#0 ← ((byte*)) (number) $2c00
to:@41
main: scope:[main] from @45
(byte) sin_offset_y#30 ← phi( @45/(byte) sin_offset_y#18 )
(byte) sin_offset_x#30 ← phi( @45/(byte) sin_offset_x#18 )
(byte*) print_screen#8 ← phi( @45/(byte*) print_screen#9 )
(byte*) print_char_cursor#32 ← phi( @45/(byte*) print_char_cursor#25 )
(byte*) print_line_cursor#26 ← phi( @45/(byte*) print_line_cursor#18 )
(word*) SQUARES#21 ← phi( @45/(word*) SQUARES#25 )
(byte*) heap_head#26 ← phi( @45/(byte*) heap_head#30 )
(byte) NUM_SQUARES#14 ← phi( @45/(byte) NUM_SQUARES#17 )
to:@43
main: scope:[main] from @47
(byte) sin_offset_y#30 ← phi( @47/(byte) sin_offset_y#18 )
(byte) sin_offset_x#30 ← phi( @47/(byte) sin_offset_x#18 )
(byte*) print_screen#8 ← phi( @47/(byte*) print_screen#9 )
(byte*) print_char_cursor#32 ← phi( @47/(byte*) print_char_cursor#25 )
(byte*) print_line_cursor#26 ← phi( @47/(byte*) print_line_cursor#18 )
(word*) SQUARES#21 ← phi( @47/(word*) SQUARES#25 )
(byte*) heap_head#26 ← phi( @47/(byte*) heap_head#30 )
(byte) NUM_SQUARES#14 ← phi( @47/(byte) NUM_SQUARES#17 )
(byte*) init_dist_screen::screen#0 ← (byte*) SCREEN_DIST#0
call init_dist_screen
to:main::@9
@ -868,16 +871,16 @@ main::@return: scope:[main] from main::@1
(byte) sin_offset_y#2 ← (byte) sin_offset_y#9
return
to:@return
@41: scope:[] from @47
(byte*) print_screen#10 ← phi( @47/(byte*) print_screen#11 )
(byte*) print_char_cursor#31 ← phi( @47/(byte*) print_char_cursor#34 )
(byte*) print_line_cursor#25 ← phi( @47/(byte*) print_line_cursor#28 )
(word*) SQUARES#33 ← phi( @47/(word*) SQUARES#36 )
(byte*) heap_head#35 ← phi( @47/(byte*) heap_head#6 )
(byte) NUM_SQUARES#22 ← phi( @47/(byte) NUM_SQUARES#25 )
@43: scope:[] from @49
(byte*) print_screen#10 ← phi( @49/(byte*) print_screen#11 )
(byte*) print_char_cursor#31 ← phi( @49/(byte*) print_char_cursor#34 )
(byte*) print_line_cursor#25 ← phi( @49/(byte*) print_line_cursor#28 )
(word*) SQUARES#33 ← phi( @49/(word*) SQUARES#36 )
(byte*) heap_head#35 ← phi( @49/(byte*) heap_head#6 )
(byte) NUM_SQUARES#22 ← phi( @49/(byte) NUM_SQUARES#25 )
(byte) sin_offset_x#3 ← (number) 0
(byte) sin_offset_y#3 ← (number) 0
to:@45
to:@47
doplasma: scope:[doplasma] from main::@2 main::@7
(byte*) doplasma::screen#6 ← phi( main::@2/(byte*) doplasma::screen#0 main::@7/(byte*) doplasma::screen#1 )
(byte) sin_offset_y#10 ← phi( main::@2/(byte) sin_offset_y#14 main::@7/(byte) sin_offset_y#15 )
@ -1369,25 +1372,25 @@ make_plasma_charset::@return: scope:[make_plasma_charset] from make_plasma_char
(byte*) print_char_cursor#9 ← (byte*) print_char_cursor#18
return
to:@return
@45: scope:[] from @41
(byte*) print_screen#9 ← phi( @41/(byte*) print_screen#10 )
(byte) sin_offset_y#18 ← phi( @41/(byte) sin_offset_y#3 )
(byte) sin_offset_x#18 ← phi( @41/(byte) sin_offset_x#3 )
(byte*) print_char_cursor#25 ← phi( @41/(byte*) print_char_cursor#31 )
(byte*) print_line_cursor#18 ← phi( @41/(byte*) print_line_cursor#25 )
(word*) SQUARES#25 ← phi( @41/(word*) SQUARES#33 )
(byte*) heap_head#30 ← phi( @41/(byte*) heap_head#35 )
(byte) NUM_SQUARES#17 ← phi( @41/(byte) NUM_SQUARES#22 )
@47: scope:[] from @43
(byte*) print_screen#9 ← phi( @43/(byte*) print_screen#10 )
(byte) sin_offset_y#18 ← phi( @43/(byte) sin_offset_y#3 )
(byte) sin_offset_x#18 ← phi( @43/(byte) sin_offset_x#3 )
(byte*) print_char_cursor#25 ← phi( @43/(byte*) print_char_cursor#31 )
(byte*) print_line_cursor#18 ← phi( @43/(byte*) print_line_cursor#25 )
(word*) SQUARES#25 ← phi( @43/(word*) SQUARES#33 )
(byte*) heap_head#30 ← phi( @43/(byte*) heap_head#35 )
(byte) NUM_SQUARES#17 ← phi( @43/(byte) NUM_SQUARES#22 )
call main
to:@48
@48: scope:[] from @45
(byte) sin_offset_y#13 ← phi( @45/(byte) sin_offset_y#2 )
(byte) sin_offset_x#13 ← phi( @45/(byte) sin_offset_x#2 )
(byte*) print_char_cursor#19 ← phi( @45/(byte*) print_char_cursor#6 )
(byte*) print_line_cursor#13 ← phi( @45/(byte*) print_line_cursor#4 )
(word*) SQUARES#16 ← phi( @45/(word*) SQUARES#4 )
(byte*) heap_head#22 ← phi( @45/(byte*) heap_head#8 )
(byte) NUM_SQUARES#12 ← phi( @45/(byte) NUM_SQUARES#2 )
to:@50
@50: scope:[] from @47
(byte) sin_offset_y#13 ← phi( @47/(byte) sin_offset_y#2 )
(byte) sin_offset_x#13 ← phi( @47/(byte) sin_offset_x#2 )
(byte*) print_char_cursor#19 ← phi( @47/(byte*) print_char_cursor#6 )
(byte*) print_line_cursor#13 ← phi( @47/(byte*) print_line_cursor#4 )
(word*) SQUARES#16 ← phi( @47/(word*) SQUARES#4 )
(byte*) heap_head#22 ← phi( @47/(byte*) heap_head#8 )
(byte) NUM_SQUARES#12 ← phi( @47/(byte) NUM_SQUARES#2 )
(byte) NUM_SQUARES#5 ← (byte) NUM_SQUARES#12
(byte*) heap_head#11 ← (byte*) heap_head#22
(word*) SQUARES#7 ← (word*) SQUARES#16
@ -1396,21 +1399,21 @@ make_plasma_charset::@return: scope:[make_plasma_charset] from make_plasma_char
(byte) sin_offset_x#6 ← (byte) sin_offset_x#13
(byte) sin_offset_y#6 ← (byte) sin_offset_y#13
to:@end
@end: scope:[] from @48
@end: scope:[] from @50
SYMBOL TABLE SSA
(void*~) $0
(void*~) $1
(label) @12
(label) @15
(label) @14
(label) @17
(label) @38
(label) @19
(label) @40
(label) @41
(label) @45
(label) @46
(label) @42
(label) @43
(label) @47
(label) @48
(label) @49
(label) @50
(label) @8
(label) @begin
(label) @end
@ -1477,6 +1480,10 @@ SYMBOL TABLE SSA
(byte) NUM_SQUARES#7
(byte) NUM_SQUARES#8
(byte) NUM_SQUARES#9
(const byte) RADIX::BINARY = (byte) 0
(const byte) RADIX::DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL = (byte) 1
(byte*) SCREEN1
(byte*) SCREEN1#0
(byte*) SCREEN2
@ -3851,14 +3858,14 @@ Added new block during phi lifting make_plasma_charset::@18(between make_plasma_
Added new block during phi lifting make_plasma_charset::@19(between make_plasma_charset::@7 and make_plasma_charset::@9)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @8
Adding NOP phi() at start of @12
Adding NOP phi() at start of @15
Adding NOP phi() at start of @14
Adding NOP phi() at start of @17
Adding NOP phi() at start of @38
Adding NOP phi() at start of @19
Adding NOP phi() at start of @40
Adding NOP phi() at start of @41
Adding NOP phi() at start of @45
Adding NOP phi() at start of @48
Adding NOP phi() at start of @42
Adding NOP phi() at start of @43
Adding NOP phi() at start of @47
Adding NOP phi() at start of @50
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@10
Adding NOP phi() at start of main::@11
@ -3986,12 +3993,12 @@ Coalesced [355] init_squares::i#3 ← init_squares::i#1
Not coalescing [358] heap_head#1 ← malloc::mem#0
Coalesced down to 46 phi equivalence classes
Culled Empty Block (label) @8
Culled Empty Block (label) @12
Culled Empty Block (label) @15
Culled Empty Block (label) @14
Culled Empty Block (label) @17
Culled Empty Block (label) @38
Culled Empty Block (label) @41
Culled Empty Block (label) @48
Culled Empty Block (label) @19
Culled Empty Block (label) @40
Culled Empty Block (label) @43
Culled Empty Block (label) @50
Culled Empty Block (label) main::@12
Culled Empty Block (label) main::@13
Culled Empty Block (label) main::toD0181_@return
@ -4024,10 +4031,10 @@ Culled Empty Block (label) init_dist_screen::@20
Culled Empty Block (label) bsearch16u::@1
Culled Empty Block (label) bsearch16u::@18
Culled Empty Block (label) init_squares::@4
Renumbering block @40 to @1
Renumbering block @45 to @2
Renumbering block @46 to @3
Renumbering block @47 to @4
Renumbering block @42 to @1
Renumbering block @47 to @2
Renumbering block @48 to @3
Renumbering block @49 to @4
Renumbering block memset::@4 to memset::@1
Renumbering block bsearch16u::@2 to bsearch16u::@1
Renumbering block bsearch16u::@3 to bsearch16u::@2
@ -7600,6 +7607,7 @@ Uplift Scope [] 16.42: zp ZP_WORD:16 [ print_char_cursor#49 print_char_cursor#18
Uplift Scope [memset] 33: zp ZP_WORD:12 [ memset::dst#2 memset::dst#1 ]
Uplift Scope [print_cls] 33: zp ZP_WORD:21 [ print_cls::sc#2 print_cls::sc#1 ]
Uplift Scope [malloc] 2: zp ZP_WORD:64 [ malloc::size#3 ] 0.67: zp ZP_WORD:153 [ malloc::mem#0 ]
Uplift Scope [RADIX]
Uplift Scope [print_char]
Uplift Scope [sid_rnd_init]
Uplift Scope [main]
@ -7622,6 +7630,7 @@ Uplifting [] best 1343814 combination zp ZP_WORD:16 [ print_char_cursor#49 print
Uplifting [memset] best 1343814 combination zp ZP_WORD:12 [ memset::dst#2 memset::dst#1 ]
Uplifting [print_cls] best 1343814 combination zp ZP_WORD:21 [ print_cls::sc#2 print_cls::sc#1 ]
Uplifting [malloc] best 1343814 combination zp ZP_WORD:64 [ malloc::size#3 ] zp ZP_WORD:153 [ malloc::mem#0 ]
Uplifting [RADIX] best 1343814 combination
Uplifting [print_char] best 1343814 combination
Uplifting [sid_rnd_init] best 1343814 combination
Uplifting [main] best 1343814 combination
@ -9732,6 +9741,10 @@ FINAL SYMBOL TABLE
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(byte) NUM_SQUARES
(const byte) NUM_SQUARES#3 NUM_SQUARES = (byte) $30
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) SCREEN1
(const byte*) SCREEN1#0 SCREEN1 = (byte*) 10240
(byte*) SCREEN2
@ -11637,7 +11650,7 @@ bsearch16u: {
lda #0
adc items+1
sta pivot+1
// result = (signed word)key-(signed word)*pivot
// result = (signed int)key-(signed int)*pivot
// [230] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0) -- vwsz1=vwsz2_minus__deref_pwsz3
sec
lda key

View File

@ -22,6 +22,10 @@
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(byte) NUM_SQUARES
(const byte) NUM_SQUARES#3 NUM_SQUARES = (byte) $30
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) SCREEN1
(const byte*) SCREEN1#0 SCREEN1 = (byte*) 10240
(byte*) SCREEN2

View File

@ -0,0 +1,34 @@
// Illustrates a problem with pointer sizeof()-rewriting for pointers inside structs
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
main: {
.label SCREEN = $400
.label digit_value = 3
.label radix = 2
lda #0
sta radix
b1:
ldx #0
b2:
lda RADIX_DECIMAL_VALUES,x
sta digit_value
lda RADIX_DECIMAL_VALUES+1,x
sta digit_value+1
txa
asl
tay
lda digit_value
sta SCREEN,y
lda digit_value+1
sta SCREEN+1,y
inx
cpx #5
bne b2
inc radix
lda #2
cmp radix
bne b1
rts
}
RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a

View File

@ -0,0 +1,30 @@
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::radix#4 ← phi( main/(byte) 0 main::@3/(byte) main::radix#1 )
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
[6] (byte) main::digit#2 ← phi( main::@1/(byte) 0 main::@2/(byte) main::digit#1 )
[7] (word) main::digit_value#0 ← *((const word[]) RADIX_DECIMAL_VALUES#0 + (byte) main::digit#2)
[8] (byte~) main::$2 ← (byte) main::digit#2 << (byte) 1
[9] *((const word*) main::SCREEN#0 + (byte~) main::$2) ← (word) main::digit_value#0
[10] (byte) main::digit#1 ← ++ (byte) main::digit#2
[11] if((byte) main::digit#1!=(byte) 5) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@2
[12] (byte) main::radix#1 ← ++ (byte) main::radix#4
[13] if((byte) main::radix#1!=(byte) 2) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[14] return
to:@return

View File

@ -0,0 +1,569 @@
Fixing pointer array-indexing *((word*) main::SCREEN + (byte) main::digit)
Created struct value member variable (word*) main::info_values
Converted struct value to member variables (struct RadixInfo) main::info
Adding struct value list initializer (word*) main::info_values ← (word[]) RADIX_DECIMAL_VALUES
Replacing struct member reference (struct RadixInfo) main::info.values with member variable reference (word*) main::info_values
Culled Empty Block (label) main::@4
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(word[]) RADIX_DECIMAL_VALUES#0 ← { (number) $2710, (number) $3e8, (number) $64, (number) $a }
to:@1
main: scope:[main] from @1
(word*) main::SCREEN#0 ← ((word*)) (number) $400
(byte) main::radix#0 ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@3
(byte) main::radix#4 ← phi( main/(byte) main::radix#0 main::@3/(byte) main::radix#1 )
(word*) main::info_values#0 ← (word[]) RADIX_DECIMAL_VALUES#0
(byte) main::digit#0 ← (byte) 0
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
(byte) main::radix#3 ← phi( main::@1/(byte) main::radix#4 main::@2/(byte) main::radix#3 )
(byte) main::digit#2 ← phi( main::@1/(byte) main::digit#0 main::@2/(byte) main::digit#1 )
(word*) main::info_values#1 ← phi( main::@1/(word*) main::info_values#0 main::@2/(word*) main::info_values#1 )
(word) main::digit_value#0 ← *((word*) main::info_values#1 + (byte) main::digit#2)
(byte~) main::$2 ← (byte) main::digit#2 * (const byte) SIZEOF_WORD
*((word*) main::SCREEN#0 + (byte~) main::$2) ← (word) main::digit_value#0
(byte) main::digit#1 ← (byte) main::digit#2 + rangenext(0,4)
(bool~) main::$0 ← (byte) main::digit#1 != rangelast(0,4)
if((bool~) main::$0) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@2
(byte) main::radix#2 ← phi( main::@2/(byte) main::radix#3 )
(byte) main::radix#1 ← (byte) main::radix#2 + rangenext(0,1)
(bool~) main::$1 ← (byte) main::radix#1 != rangelast(0,1)
if((bool~) main::$1) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
return
to:@return
@1: scope:[] from @begin
call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(word[]) RADIX_DECIMAL_VALUES
(word[]) RADIX_DECIMAL_VALUES#0
(word*) RadixInfo::values
(const byte) SIZEOF_WORD = (byte) 2
(void()) main()
(bool~) main::$0
(bool~) main::$1
(byte~) main::$2
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(word*) main::SCREEN
(word*) main::SCREEN#0
(byte) main::digit
(byte) main::digit#0
(byte) main::digit#1
(byte) main::digit#2
(word) main::digit_value
(word) main::digit_value#0
(word*) main::info_values
(word*) main::info_values#0
(word*) main::info_values#1
(byte) main::radix
(byte) main::radix#0
(byte) main::radix#1
(byte) main::radix#2
(byte) main::radix#3
(byte) main::radix#4
Adding number conversion cast (word) to elements in (word[]) RADIX_DECIMAL_VALUES#0 ← { (word)(number) $2710, (word)(number) $3e8, (word)(number) $64, (word)(number) $a }
Successful SSA optimization PassNAddArrayNumberTypeConversions
Inlining cast (word*) main::SCREEN#0 ← (word*)(number) $400
Successful SSA optimization Pass2InlineCast
Simplifying constant integer cast $2710
Simplifying constant integer cast $3e8
Simplifying constant integer cast $64
Simplifying constant integer cast $a
Simplifying constant pointer cast (word*) 1024
Successful SSA optimization PassNCastSimplification
Alias (byte) main::radix#2 = (byte) main::radix#3
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (word*) main::info_values#1
Self Phi Eliminated (byte) main::radix#2
Successful SSA optimization Pass2SelfPhiElimination
Identical Phi Values (word*) main::info_values#1 (word*) main::info_values#0
Identical Phi Values (byte) main::radix#2 (byte) main::radix#4
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$0 [12] if((byte) main::digit#1!=rangelast(0,4)) goto main::@2
Simple Condition (bool~) main::$1 [16] if((byte) main::radix#1!=rangelast(0,1)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [0] (word[]) RADIX_DECIMAL_VALUES#0 ← { (word) $2710, (word) $3e8, (word) $64, (word) $a }
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const word[]) RADIX_DECIMAL_VALUES#0 = { $2710, $3e8, $64, $a }
Constant (const word*) main::SCREEN#0 = (word*) 1024
Constant (const byte) main::radix#0 = 0
Constant (const byte) main::digit#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const word*) main::info_values#0 = RADIX_DECIMAL_VALUES#0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [10] main::digit#1 ← ++ main::digit#2 to ++
Resolved ranged comparison value [12] if(main::digit#1!=rangelast(0,4)) goto main::@2 to (number) 5
Resolved ranged next value [14] main::radix#1 ← ++ main::radix#4 to ++
Resolved ranged comparison value [16] if(main::radix#1!=rangelast(0,1)) goto main::@1 to (number) 2
Adding number conversion cast (unumber) 5 in if((byte) main::digit#1!=(number) 5) goto main::@2
Adding number conversion cast (unumber) 2 in if((byte) main::radix#1!=(number) 2) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 5
Simplifying constant integer cast 2
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 5
Finalized unsigned number type (byte) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Rewriting multiplication to use shift [3] (byte~) main::$2 ← (byte) main::digit#2 * (const byte) SIZEOF_WORD
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings (const byte) main::radix#0
Inlining constant with var siblings (const byte) main::digit#0
Constant inlined main::info_values#0 = (const word[]) RADIX_DECIMAL_VALUES#0
Constant inlined main::radix#0 = (byte) 0
Constant inlined main::digit#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Eliminating unused constant (const byte) SIZEOF_WORD
Successful SSA optimization PassNEliminateUnusedVars
Added new block during phi lifting main::@5(between main::@3 and main::@1)
Added new block during phi lifting main::@6(between main::@2 and main::@2)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2
Created 2 initial phi equivalence classes
Coalesced [16] main::radix#5 ← main::radix#1
Coalesced [17] main::digit#3 ← main::digit#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@5
Culled Empty Block (label) main::@6
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::radix#4 ← phi( main/(byte) 0 main::@3/(byte) main::radix#1 )
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
[6] (byte) main::digit#2 ← phi( main::@1/(byte) 0 main::@2/(byte) main::digit#1 )
[7] (word) main::digit_value#0 ← *((const word[]) RADIX_DECIMAL_VALUES#0 + (byte) main::digit#2)
[8] (byte~) main::$2 ← (byte) main::digit#2 << (byte) 1
[9] *((const word*) main::SCREEN#0 + (byte~) main::$2) ← (word) main::digit_value#0
[10] (byte) main::digit#1 ← ++ (byte) main::digit#2
[11] if((byte) main::digit#1!=(byte) 5) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@2
[12] (byte) main::radix#1 ← ++ (byte) main::radix#4
[13] if((byte) main::radix#1!=(byte) 2) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[14] return
to:@return
VARIABLE REGISTER WEIGHTS
(word[]) RADIX_DECIMAL_VALUES
(word*) RadixInfo::values
(void()) main()
(byte~) main::$2 202.0
(word*) main::SCREEN
(byte) main::digit
(byte) main::digit#1 151.5
(byte) main::digit#2 101.0
(word) main::digit_value
(word) main::digit_value#0 101.0
(word*) main::info_values
(byte) main::radix
(byte) main::radix#1 16.5
(byte) main::radix#4 3.142857142857143
Initial phi equivalence classes
[ main::radix#4 main::radix#1 ]
[ main::digit#2 main::digit#1 ]
Added variable main::digit_value#0 to zero page equivalence class [ main::digit_value#0 ]
Added variable main::$2 to zero page equivalence class [ main::$2 ]
Complete equivalence classes
[ main::radix#4 main::radix#1 ]
[ main::digit#2 main::digit#1 ]
[ main::digit_value#0 ]
[ main::$2 ]
Allocated zp ZP_BYTE:2 [ main::radix#4 main::radix#1 ]
Allocated zp ZP_BYTE:3 [ main::digit#2 main::digit#1 ]
Allocated zp ZP_WORD:4 [ main::digit_value#0 ]
Allocated zp ZP_BYTE:6 [ main::$2 ]
INITIAL ASM
// File Comments
// Illustrates a problem with pointer sizeof()-rewriting for pointers inside structs
// Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
// Global Constants & labels
// @begin
bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
// @1
b1:
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
// @end
bend:
// main
main: {
.label SCREEN = $400
.label _2 = 6
.label digit_value = 4
.label digit = 3
.label radix = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::radix#4 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta radix
jmp b1
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
// [5] phi (byte) main::radix#4 = (byte) main::radix#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
// main::@1
b1:
// [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
// [6] phi (byte) main::digit#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
lda #0
sta digit
jmp b2
// [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
b2_from_b2:
// [6] phi (byte) main::digit#2 = (byte) main::digit#1 [phi:main::@2->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [7] (word) main::digit_value#0 ← *((const word[]) RADIX_DECIMAL_VALUES#0 + (byte) main::digit#2) -- vwuz1=pwuc1_derefidx_vbuz2
ldy digit
lda RADIX_DECIMAL_VALUES,y
sta digit_value
lda RADIX_DECIMAL_VALUES+1,y
sta digit_value+1
// [8] (byte~) main::$2 ← (byte) main::digit#2 << (byte) 1 -- vbuz1=vbuz2_rol_1
lda digit
asl
sta _2
// [9] *((const word*) main::SCREEN#0 + (byte~) main::$2) ← (word) main::digit_value#0 -- pwuc1_derefidx_vbuz1=vwuz2
ldy _2
lda digit_value
sta SCREEN,y
lda digit_value+1
sta SCREEN+1,y
// [10] (byte) main::digit#1 ← ++ (byte) main::digit#2 -- vbuz1=_inc_vbuz1
inc digit
// [11] if((byte) main::digit#1!=(byte) 5) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda #5
cmp digit
bne b2_from_b2
jmp b3
// main::@3
b3:
// [12] (byte) main::radix#1 ← ++ (byte) main::radix#4 -- vbuz1=_inc_vbuz1
inc radix
// [13] if((byte) main::radix#1!=(byte) 2) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #2
cmp radix
bne b1_from_b3
jmp breturn
// main::@return
breturn:
// [14] return
rts
}
// File Data
RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [7] (word) main::digit_value#0 ← *((const word[]) RADIX_DECIMAL_VALUES#0 + (byte) main::digit#2) [ main::radix#4 main::digit#2 main::digit_value#0 ] ( main:2 [ main::radix#4 main::digit#2 main::digit_value#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::radix#4 main::radix#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::digit#2 main::digit#1 ]
Statement [8] (byte~) main::$2 ← (byte) main::digit#2 << (byte) 1 [ main::radix#4 main::digit#2 main::digit_value#0 main::$2 ] ( main:2 [ main::radix#4 main::digit#2 main::digit_value#0 main::$2 ] ) always clobbers reg byte a
Statement [9] *((const word*) main::SCREEN#0 + (byte~) main::$2) ← (word) main::digit_value#0 [ main::radix#4 main::digit#2 ] ( main:2 [ main::radix#4 main::digit#2 ] ) always clobbers reg byte a
Statement [7] (word) main::digit_value#0 ← *((const word[]) RADIX_DECIMAL_VALUES#0 + (byte) main::digit#2) [ main::radix#4 main::digit#2 main::digit_value#0 ] ( main:2 [ main::radix#4 main::digit#2 main::digit_value#0 ] ) always clobbers reg byte a
Statement [8] (byte~) main::$2 ← (byte) main::digit#2 << (byte) 1 [ main::radix#4 main::digit#2 main::digit_value#0 main::$2 ] ( main:2 [ main::radix#4 main::digit#2 main::digit_value#0 main::$2 ] ) always clobbers reg byte a
Statement [9] *((const word*) main::SCREEN#0 + (byte~) main::$2) ← (word) main::digit_value#0 [ main::radix#4 main::digit#2 ] ( main:2 [ main::radix#4 main::digit#2 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::radix#4 main::radix#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::digit#2 main::digit#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Potential registers zp ZP_WORD:4 [ main::digit_value#0 ] : zp ZP_WORD:4 ,
Potential registers zp ZP_BYTE:6 [ main::$2 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 252.5: zp ZP_BYTE:3 [ main::digit#2 main::digit#1 ] 202: zp ZP_BYTE:6 [ main::$2 ] 101: zp ZP_WORD:4 [ main::digit_value#0 ] 19.64: zp ZP_BYTE:2 [ main::radix#4 main::radix#1 ]
Uplift Scope [RadixInfo]
Uplift Scope []
Uplifting [main] best 5733 combination reg byte x [ main::digit#2 main::digit#1 ] reg byte a [ main::$2 ] zp ZP_WORD:4 [ main::digit_value#0 ] zp ZP_BYTE:2 [ main::radix#4 main::radix#1 ]
Uplifting [RadixInfo] best 5733 combination
Uplifting [] best 5733 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::radix#4 main::radix#1 ]
Uplifting [main] best 5733 combination zp ZP_BYTE:2 [ main::radix#4 main::radix#1 ]
Allocated (was zp ZP_WORD:4) zp ZP_WORD:3 [ main::digit_value#0 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Illustrates a problem with pointer sizeof()-rewriting for pointers inside structs
// Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
// Global Constants & labels
// @begin
bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
// @1
b1:
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
// @end
bend:
// main
main: {
.label SCREEN = $400
.label digit_value = 3
.label radix = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::radix#4 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta radix
jmp b1
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
// [5] phi (byte) main::radix#4 = (byte) main::radix#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
// main::@1
b1:
// [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
// [6] phi (byte) main::digit#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1
ldx #0
jmp b2
// [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
b2_from_b2:
// [6] phi (byte) main::digit#2 = (byte) main::digit#1 [phi:main::@2->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [7] (word) main::digit_value#0 ← *((const word[]) RADIX_DECIMAL_VALUES#0 + (byte) main::digit#2) -- vwuz1=pwuc1_derefidx_vbuxx
lda RADIX_DECIMAL_VALUES,x
sta digit_value
lda RADIX_DECIMAL_VALUES+1,x
sta digit_value+1
// [8] (byte~) main::$2 ← (byte) main::digit#2 << (byte) 1 -- vbuaa=vbuxx_rol_1
txa
asl
// [9] *((const word*) main::SCREEN#0 + (byte~) main::$2) ← (word) main::digit_value#0 -- pwuc1_derefidx_vbuaa=vwuz1
tay
lda digit_value
sta SCREEN,y
lda digit_value+1
sta SCREEN+1,y
// [10] (byte) main::digit#1 ← ++ (byte) main::digit#2 -- vbuxx=_inc_vbuxx
inx
// [11] if((byte) main::digit#1!=(byte) 5) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #5
bne b2_from_b2
jmp b3
// main::@3
b3:
// [12] (byte) main::radix#1 ← ++ (byte) main::radix#4 -- vbuz1=_inc_vbuz1
inc radix
// [13] if((byte) main::radix#1!=(byte) 2) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #2
cmp radix
bne b1_from_b3
jmp breturn
// main::@return
breturn:
// [14] return
rts
}
// File Data
RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b2_from_b2 with b2
Replacing label b1_from_b3 with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b3:
Removing instruction b2_from_b1:
Removing instruction b2_from_b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b3:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b1
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(word[]) RADIX_DECIMAL_VALUES
(const word[]) RADIX_DECIMAL_VALUES#0 RADIX_DECIMAL_VALUES = { (word) $2710, (word) $3e8, (word) $64, (word) $a }
(word*) RadixInfo::values
(void()) main()
(byte~) main::$2 reg byte a 202.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(word*) main::SCREEN
(const word*) main::SCREEN#0 SCREEN = (word*) 1024
(byte) main::digit
(byte) main::digit#1 reg byte x 151.5
(byte) main::digit#2 reg byte x 101.0
(word) main::digit_value
(word) main::digit_value#0 digit_value zp ZP_WORD:3 101.0
(word*) main::info_values
(byte) main::radix
(byte) main::radix#1 radix zp ZP_BYTE:2 16.5
(byte) main::radix#4 radix zp ZP_BYTE:2 3.142857142857143
zp ZP_BYTE:2 [ main::radix#4 main::radix#1 ]
reg byte x [ main::digit#2 main::digit#1 ]
zp ZP_WORD:3 [ main::digit_value#0 ]
reg byte a [ main::$2 ]
FINAL ASSEMBLER
Score: 4731
// File Comments
// Illustrates a problem with pointer sizeof()-rewriting for pointers inside structs
// Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// @begin
// [1] phi from @begin to @1 [phi:@begin->@1]
// @1
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
// [3] phi from @1 to @end [phi:@1->@end]
// @end
// main
main: {
.label SCREEN = $400
.label digit_value = 3
.label radix = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::radix#4 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta radix
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
// [5] phi (byte) main::radix#4 = (byte) main::radix#1 [phi:main::@3->main::@1#0] -- register_copy
// main::@1
b1:
// [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// [6] phi (byte) main::digit#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1
ldx #0
// [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
// [6] phi (byte) main::digit#2 = (byte) main::digit#1 [phi:main::@2->main::@2#0] -- register_copy
// main::@2
b2:
// digit_value = info.values[digit]
// [7] (word) main::digit_value#0 ← *((const word[]) RADIX_DECIMAL_VALUES#0 + (byte) main::digit#2) -- vwuz1=pwuc1_derefidx_vbuxx
lda RADIX_DECIMAL_VALUES,x
sta digit_value
lda RADIX_DECIMAL_VALUES+1,x
sta digit_value+1
// SCREEN[digit] = digit_value
// [8] (byte~) main::$2 ← (byte) main::digit#2 << (byte) 1 -- vbuaa=vbuxx_rol_1
txa
asl
// [9] *((const word*) main::SCREEN#0 + (byte~) main::$2) ← (word) main::digit_value#0 -- pwuc1_derefidx_vbuaa=vwuz1
tay
lda digit_value
sta SCREEN,y
lda digit_value+1
sta SCREEN+1,y
// for( char digit: 0..4 )
// [10] (byte) main::digit#1 ← ++ (byte) main::digit#2 -- vbuxx=_inc_vbuxx
inx
// [11] if((byte) main::digit#1!=(byte) 5) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #5
bne b2
// main::@3
// for( byte radix: 0..1)
// [12] (byte) main::radix#1 ← ++ (byte) main::radix#4 -- vbuz1=_inc_vbuz1
inc radix
// [13] if((byte) main::radix#1!=(byte) 2) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #2
cmp radix
bne b1
// main::@return
// }
// [14] return
rts
}
// File Data
RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a

View File

@ -0,0 +1,28 @@
(label) @1
(label) @begin
(label) @end
(word[]) RADIX_DECIMAL_VALUES
(const word[]) RADIX_DECIMAL_VALUES#0 RADIX_DECIMAL_VALUES = { (word) $2710, (word) $3e8, (word) $64, (word) $a }
(word*) RadixInfo::values
(void()) main()
(byte~) main::$2 reg byte a 202.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(word*) main::SCREEN
(const word*) main::SCREEN#0 SCREEN = (word*) 1024
(byte) main::digit
(byte) main::digit#1 reg byte x 151.5
(byte) main::digit#2 reg byte x 101.0
(word) main::digit_value
(word) main::digit_value#0 digit_value zp ZP_WORD:3 101.0
(word*) main::info_values
(byte) main::radix
(byte) main::radix#1 radix zp ZP_BYTE:2 16.5
(byte) main::radix#4 radix zp ZP_BYTE:2 3.142857142857143
zp ZP_BYTE:2 [ main::radix#4 main::radix#1 ]
reg byte x [ main::digit#2 main::digit#1 ]
zp ZP_WORD:3 [ main::digit_value#0 ]
reg byte a [ main::$2 ]

View File

@ -3,6 +3,7 @@ Resolved forward reference FONT_HEX_PROTO to (byte[]) FONT_HEX_PROTO
Fixing pointer addition (word*~) bsearch16u::$7 ← (word*) bsearch16u::items + (byte~) bsearch16u::$6
Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot + (number) 1
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i)
Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i)
Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
@ -20,10 +21,12 @@ Culled Empty Block (label) @4
Culled Empty Block (label) @5
Culled Empty Block (label) @6
Culled Empty Block (label) @7
Culled Empty Block (label) @8
Culled Empty Block (label) @9
Culled Empty Block (label) @10
Culled Empty Block (label) @11
Culled Empty Block (label) @12
Culled Empty Block (label) @13
Culled Empty Block (label) @14
Culled Empty Block (label) init_font_hex::@6
Culled Empty Block (label) atan2_16::@9
Culled Empty Block (label) atan2_16::@10
@ -37,10 +40,8 @@ Culled Empty Block (label) atan2_16::@23
Culled Empty Block (label) atan2_16::@31
Culled Empty Block (label) atan2_16::@32
Culled Empty Block (label) atan2_16::@14
Culled Empty Block (label) @14
Culled Empty Block (label) clock::@1
Culled Empty Block (label) @16
Culled Empty Block (label) @17
Culled Empty Block (label) clock::@1
Culled Empty Block (label) @18
Culled Empty Block (label) @19
Culled Empty Block (label) @20
@ -54,21 +55,23 @@ Culled Empty Block (label) @27
Culled Empty Block (label) @28
Culled Empty Block (label) @29
Culled Empty Block (label) @30
Culled Empty Block (label) @31
Culled Empty Block (label) @32
Culled Empty Block (label) @33
Culled Empty Block (label) @34
Culled Empty Block (label) @35
Culled Empty Block (label) @36
Culled Empty Block (label) @37
Culled Empty Block (label) @38
Culled Empty Block (label) @39
Culled Empty Block (label) main::toD0181_@1
Culled Empty Block (label) main::toD0182_@1
Culled Empty Block (label) @39
Culled Empty Block (label) @41
Culled Empty Block (label) init_angle_screen::@4
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@8
@8: scope:[] from @begin
to:@10
@10: scope:[] from @begin
(byte*) D018#0 ← ((byte*)) (number) $d018
(dword*) CIA2_TIMER_AB#0 ← ((dword*)) (number) $dd04
(byte*) CIA2_TIMER_A_CONTROL#0 ← ((byte*)) (number) $dd0e
@ -78,7 +81,7 @@ CONTROL FLOW GRAPH SSA
(byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (number) 0
(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (number) 0
(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (number) $40
to:@13
to:@15
init_font_hex: scope:[init_font_hex] from main
(byte*) init_font_hex::charset#6 ← phi( main/(byte*) init_font_hex::charset#1 )
(byte*) init_font_hex::proto_hi#0 ← (byte[]) FONT_HEX_PROTO#0
@ -148,13 +151,13 @@ init_font_hex::@5: scope:[init_font_hex] from init_font_hex::@4
init_font_hex::@return: scope:[init_font_hex] from init_font_hex::@5
return
to:@return
@13: scope:[] from @8
@15: scope:[] from @10
(byte[]) FONT_HEX_PROTO#0 ← { (number) 2, (number) 5, (number) 5, (number) 5, (number) 2, (number) 6, (number) 2, (number) 2, (number) 2, (number) 7, (number) 6, (number) 1, (number) 2, (number) 4, (number) 7, (number) 6, (number) 1, (number) 2, (number) 1, (number) 6, (number) 5, (number) 5, (number) 7, (number) 1, (number) 1, (number) 7, (number) 4, (number) 6, (number) 1, (number) 6, (number) 3, (number) 4, (number) 6, (number) 5, (number) 2, (number) 7, (number) 1, (number) 1, (number) 1, (number) 1, (number) 2, (number) 5, (number) 2, (number) 5, (number) 2, (number) 2, (number) 5, (number) 3, (number) 1, (number) 1, (number) 2, (number) 5, (number) 7, (number) 5, (number) 5, (number) 6, (number) 5, (number) 6, (number) 5, (number) 6, (number) 2, (number) 5, (number) 4, (number) 5, (number) 2, (number) 6, (number) 5, (number) 5, (number) 5, (number) 6, (number) 7, (number) 4, (number) 6, (number) 4, (number) 7, (number) 7, (number) 4, (number) 6, (number) 4, (number) 4 }
(byte) CORDIC_ITERATIONS_16#0 ← (number) $f
(word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 ← kickasm {{ .for (var i=0; i<CORDIC_ITERATIONS_16; i++)
.word 256*2*256*atan(1/pow(2,i))/PI/2
}}
to:@15
to:@17
atan2_16: scope:[atan2_16] from init_angle_screen::@2
(signed word) atan2_16::x#9 ← phi( init_angle_screen::@2/(signed word) atan2_16::x#0 )
(signed word) atan2_16::y#1 ← phi( init_angle_screen::@2/(signed word) atan2_16::y#0 )
@ -365,9 +368,9 @@ atan2_16::@return: scope:[atan2_16] from atan2_16::@8
(word) atan2_16::return#1 ← (word) atan2_16::return#3
return
to:@return
@15: scope:[] from @13
@17: scope:[] from @15
(dword) CLOCKS_PER_INIT#0 ← (number) $12
to:@31
to:@33
clock: scope:[clock] from main::@5
(number~) clock::$0 ← (number) $ffffffff - *((dword*) CIA2_TIMER_AB#0)
(dword) clock::return#0 ← (number~) clock::$0
@ -439,9 +442,9 @@ print_dword_at::@2: scope:[print_dword_at] from print_dword_at::@1
print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@2
return
to:@return
@31: scope:[] from @15
@33: scope:[] from @17
(byte[]) print_hextab#0 ← (const string) $0
to:@38
to:@40
print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1
(byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 )
(byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 )
@ -472,11 +475,11 @@ print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1
print_char_at::@return: scope:[print_char_at] from print_char_at
return
to:@return
@38: scope:[] from @31
@40: scope:[] from @33
(byte*) CHARSET#0 ← ((byte*)) (number) $2000
(byte*) SCREEN#0 ← ((byte*)) (number) $2800
to:@40
main: scope:[main] from @40
to:@42
main: scope:[main] from @42
(byte*) init_font_hex::charset#1 ← (byte*) CHARSET#0
call init_font_hex
to:main::@3
@ -629,22 +632,22 @@ init_angle_screen::@3: scope:[init_angle_screen] from init_angle_screen::@5
init_angle_screen::@return: scope:[init_angle_screen] from init_angle_screen::@3
return
to:@return
@40: scope:[] from @38
@42: scope:[] from @40
call main
to:@41
@41: scope:[] from @40
to:@43
@43: scope:[] from @42
to:@end
@end: scope:[] from @41
@end: scope:[] from @43
SYMBOL TABLE SSA
(const string) $0 = (string) "0123456789abcdef"
(label) @13
(label) @10
(label) @15
(label) @31
(label) @38
(label) @17
(label) @33
(label) @40
(label) @41
(label) @8
(label) @42
(label) @43
(label) @begin
(label) @end
(byte*) CHARSET
@ -675,6 +678,10 @@ SYMBOL TABLE SSA
(byte*) D018#0
(byte[]) FONT_HEX_PROTO
(byte[]) FONT_HEX_PROTO#0
(const byte) RADIX::BINARY = (byte) 0
(const byte) RADIX::DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL = (byte) 1
(byte*) SCREEN
(byte*) SCREEN#0
(const byte) SIZEOF_WORD = (byte) 2
@ -1923,13 +1930,13 @@ Added new block during phi lifting atan2_16::@39(between atan2_16::@7 and atan2_
Added new block during phi lifting init_angle_screen::@6(between init_angle_screen::@3 and init_angle_screen::@1)
Added new block during phi lifting init_angle_screen::@7(between init_angle_screen::@5 and init_angle_screen::@2)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @8
Adding NOP phi() at start of @13
Adding NOP phi() at start of @10
Adding NOP phi() at start of @15
Adding NOP phi() at start of @31
Adding NOP phi() at start of @38
Adding NOP phi() at start of @17
Adding NOP phi() at start of @33
Adding NOP phi() at start of @40
Adding NOP phi() at start of @41
Adding NOP phi() at start of @42
Adding NOP phi() at start of @43
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@3
@ -2011,12 +2018,12 @@ Coalesced [212] init_font_hex::c1#5 ← init_font_hex::c1#1
Coalesced [213] init_font_hex::i#3 ← init_font_hex::i#1
Coalesced [214] init_font_hex::idx#7 ← init_font_hex::idx#2
Coalesced down to 28 phi equivalence classes
Culled Empty Block (label) @8
Culled Empty Block (label) @13
Culled Empty Block (label) @10
Culled Empty Block (label) @15
Culled Empty Block (label) @31
Culled Empty Block (label) @38
Culled Empty Block (label) @41
Culled Empty Block (label) @17
Culled Empty Block (label) @33
Culled Empty Block (label) @40
Culled Empty Block (label) @43
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::toD0181_@return
Culled Empty Block (label) main::@7
@ -2035,7 +2042,7 @@ Culled Empty Block (label) atan2_16::@37
Culled Empty Block (label) init_font_hex::@7
Culled Empty Block (label) init_font_hex::@8
Culled Empty Block (label) init_font_hex::@9
Renumbering block @40 to @1
Renumbering block @42 to @1
Renumbering block atan2_16::@13 to atan2_16::@9
Renumbering block atan2_16::@15 to atan2_16::@10
Renumbering block atan2_16::@16 to atan2_16::@11
@ -4040,6 +4047,7 @@ Uplift Scope [print_word_at] 10: zp ZP_WORD:2 [ print_word_at::w#2 print_word_at
Uplift Scope [main] 4: zp ZP_DWORD:47 [ main::$4 ] 4: zp ZP_DWORD:51 [ main::cyclecount#0 ]
Uplift Scope [clock] 4: zp ZP_DWORD:43 [ clock::return#2 ] 1.33: zp ZP_DWORD:61 [ clock::return#0 ]
Uplift Scope [print_dword_at] 2: zp ZP_DWORD:55 [ print_dword_at::dw#0 ]
Uplift Scope [RADIX]
Uplift Scope [clock_start]
Uplift Scope []
@ -4055,6 +4063,7 @@ Uplifting [print_word_at] best 1138556 combination zp ZP_WORD:2 [ print_word_at:
Uplifting [main] best 1138556 combination zp ZP_DWORD:47 [ main::$4 ] zp ZP_DWORD:51 [ main::cyclecount#0 ]
Uplifting [clock] best 1138556 combination zp ZP_DWORD:43 [ clock::return#2 ] zp ZP_DWORD:61 [ clock::return#0 ]
Uplifting [print_dword_at] best 1138556 combination zp ZP_DWORD:55 [ print_dword_at::dw#0 ]
Uplifting [RADIX] best 1138556 combination
Uplifting [clock_start] best 1138556 combination
Uplifting [] best 1138556 combination
Attempting to uplift remaining variables inzp ZP_BYTE:42 [ init_font_hex::idx#5 init_font_hex::idx#2 ]
@ -5291,6 +5300,10 @@ FINAL SYMBOL TABLE
(const byte*) D018#0 D018 = (byte*) 53272
(byte[]) FONT_HEX_PROTO
(const byte[]) FONT_HEX_PROTO#0 FONT_HEX_PROTO = { (byte) 2, (byte) 5, (byte) 5, (byte) 5, (byte) 2, (byte) 6, (byte) 2, (byte) 2, (byte) 2, (byte) 7, (byte) 6, (byte) 1, (byte) 2, (byte) 4, (byte) 7, (byte) 6, (byte) 1, (byte) 2, (byte) 1, (byte) 6, (byte) 5, (byte) 5, (byte) 7, (byte) 1, (byte) 1, (byte) 7, (byte) 4, (byte) 6, (byte) 1, (byte) 6, (byte) 3, (byte) 4, (byte) 6, (byte) 5, (byte) 2, (byte) 7, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 2, (byte) 5, (byte) 2, (byte) 5, (byte) 2, (byte) 2, (byte) 5, (byte) 3, (byte) 1, (byte) 1, (byte) 2, (byte) 5, (byte) 7, (byte) 5, (byte) 5, (byte) 6, (byte) 5, (byte) 6, (byte) 5, (byte) 6, (byte) 2, (byte) 5, (byte) 4, (byte) 5, (byte) 2, (byte) 6, (byte) 5, (byte) 5, (byte) 5, (byte) 6, (byte) 7, (byte) 4, (byte) 6, (byte) 4, (byte) 7, (byte) 7, (byte) 4, (byte) 6, (byte) 4, (byte) 4 }
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = (byte*) 10240
(word()) atan2_16((signed word) atan2_16::x , (signed word) atan2_16::y)

View File

@ -29,6 +29,10 @@
(const byte*) D018#0 D018 = (byte*) 53272
(byte[]) FONT_HEX_PROTO
(const byte[]) FONT_HEX_PROTO#0 FONT_HEX_PROTO = { (byte) 2, (byte) 5, (byte) 5, (byte) 5, (byte) 2, (byte) 6, (byte) 2, (byte) 2, (byte) 2, (byte) 7, (byte) 6, (byte) 1, (byte) 2, (byte) 4, (byte) 7, (byte) 6, (byte) 1, (byte) 2, (byte) 1, (byte) 6, (byte) 5, (byte) 5, (byte) 7, (byte) 1, (byte) 1, (byte) 7, (byte) 4, (byte) 6, (byte) 1, (byte) 6, (byte) 3, (byte) 4, (byte) 6, (byte) 5, (byte) 2, (byte) 7, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 2, (byte) 5, (byte) 2, (byte) 5, (byte) 2, (byte) 2, (byte) 5, (byte) 3, (byte) 1, (byte) 1, (byte) 2, (byte) 5, (byte) 7, (byte) 5, (byte) 5, (byte) 6, (byte) 5, (byte) 6, (byte) 5, (byte) 6, (byte) 2, (byte) 5, (byte) 4, (byte) 5, (byte) 2, (byte) 6, (byte) 5, (byte) 5, (byte) 5, (byte) 6, (byte) 7, (byte) 4, (byte) 6, (byte) 4, (byte) 7, (byte) 7, (byte) 4, (byte) 6, (byte) 4, (byte) 4 }
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = (byte*) 10240
(word()) atan2_16((signed word) atan2_16::x , (signed word) atan2_16::y)

View File

@ -5,6 +5,7 @@ Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot +
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
Fixing pointer increment (word*) init_squares::squares ← ++ (word*) init_squares::squares
Fixing pointer addition (word~) sqrt::$1 ← (word*) sqrt::found - (word*) SQUARES
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Fixing pointer array-indexing *((word*) SQUARES + (byte) sqr::val)
Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
Identified constant variable (byte*) HEAP_TOP
@ -27,19 +28,19 @@ Culled Empty Block (label) bsearch16u::@16
Culled Empty Block (label) bsearch16u::@17
Culled Empty Block (label) bsearch16u::@4
Culled Empty Block (label) bsearch16u::@5
Culled Empty Block (label) init_squares::@2
Culled Empty Block (label) @8
Culled Empty Block (label) @9
Culled Empty Block (label) init_squares::@2
Culled Empty Block (label) @11
Culled Empty Block (label) sqr::@1
Culled Empty Block (label) @10
Culled Empty Block (label) sqrt::@1
Culled Empty Block (label) @12
Culled Empty Block (label) @13
Culled Empty Block (label) sqrt::@1
Culled Empty Block (label) @14
Culled Empty Block (label) @15
Culled Empty Block (label) @16
Culled Empty Block (label) @17
Culled Empty Block (label) init_font_hex::@6
Culled Empty Block (label) clock::@1
Culled Empty Block (label) @17
Culled Empty Block (label) @18
Culled Empty Block (label) @19
Culled Empty Block (label) @20
Culled Empty Block (label) @21
@ -53,15 +54,17 @@ Culled Empty Block (label) @28
Culled Empty Block (label) @29
Culled Empty Block (label) @30
Culled Empty Block (label) @31
Culled Empty Block (label) @32
Culled Empty Block (label) @33
Culled Empty Block (label) @34
Culled Empty Block (label) @35
Culled Empty Block (label) @36
Culled Empty Block (label) @37
Culled Empty Block (label) @38
Culled Empty Block (label) @39
Culled Empty Block (label) @40
Culled Empty Block (label) main::toD0181_@1
Culled Empty Block (label) main::toD0182_@1
Culled Empty Block (label) @40
Culled Empty Block (label) @42
Culled Empty Block (label) init_dist_screen::@13
Culled Empty Block (label) init_dist_screen::@14
Culled Empty Block (label) init_dist_screen::@9
@ -74,7 +77,7 @@ CONTROL FLOW GRAPH SSA
@4: scope:[] from @begin
(byte*) HEAP_TOP#0 ← ((byte*)) (number) $a000
(byte*) heap_head#0 ← (byte*) HEAP_TOP#0
to:@8
to:@10
malloc: scope:[malloc] from init_squares
(word) malloc::size#1 ← phi( init_squares/(word) malloc::size#0 )
(byte*) heap_head#10 ← phi( init_squares/(byte*) heap_head#19 )
@ -172,11 +175,11 @@ bsearch16u::@3: scope:[bsearch16u] from bsearch16u::@1 bsearch16u::@2
(word*~) bsearch16u::$4 ← phi( bsearch16u::@1/(word*~) bsearch16u::$3 bsearch16u::@2/(word*~) bsearch16u::$2 )
(word*) bsearch16u::return#2 ← (word*~) bsearch16u::$4
to:bsearch16u::@return
@8: scope:[] from @4
@10: scope:[] from @4
(byte*) heap_head#43 ← phi( @4/(byte*) heap_head#0 )
(byte) NUM_SQUARES#0 ← (number) $ff
(word*) SQUARES#0 ← (word*) 0
to:@11
to:@13
init_squares: scope:[init_squares] from init_dist_screen
(byte*) heap_head#19 ← phi( init_dist_screen/(byte*) heap_head#23 )
(byte) NUM_SQUARES#6 ← phi( init_dist_screen/(byte) NUM_SQUARES#3 )
@ -256,10 +259,10 @@ sqrt::@return: scope:[sqrt] from sqrt::@2
(byte) sqrt::return#1 ← (byte) sqrt::return#3
return
to:@return
@11: scope:[] from @8
(word*) SQUARES#43 ← phi( @8/(word*) SQUARES#0 )
(byte*) heap_head#38 ← phi( @8/(byte*) heap_head#43 )
(byte) NUM_SQUARES#32 ← phi( @8/(byte) NUM_SQUARES#0 )
@13: scope:[] from @10
(word*) SQUARES#43 ← phi( @10/(word*) SQUARES#0 )
(byte*) heap_head#38 ← phi( @10/(byte*) heap_head#43 )
(byte) NUM_SQUARES#32 ← phi( @10/(byte) NUM_SQUARES#0 )
(byte*) D018#0 ← ((byte*)) (number) $d018
(dword*) CIA2_TIMER_AB#0 ← ((dword*)) (number) $dd04
(byte*) CIA2_TIMER_A_CONTROL#0 ← ((byte*)) (number) $dd0e
@ -269,7 +272,7 @@ sqrt::@return: scope:[sqrt] from sqrt::@2
(byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (number) 0
(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (number) 0
(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (number) $40
to:@16
to:@18
init_font_hex: scope:[init_font_hex] from main
(byte*) init_font_hex::charset#6 ← phi( main/(byte*) init_font_hex::charset#1 )
(byte*) init_font_hex::proto_hi#0 ← (byte[]) FONT_HEX_PROTO#0
@ -339,13 +342,13 @@ init_font_hex::@5: scope:[init_font_hex] from init_font_hex::@4
init_font_hex::@return: scope:[init_font_hex] from init_font_hex::@5
return
to:@return
@16: scope:[] from @11
(word*) SQUARES#39 ← phi( @11/(word*) SQUARES#43 )
(byte*) heap_head#34 ← phi( @11/(byte*) heap_head#38 )
(byte) NUM_SQUARES#28 ← phi( @11/(byte) NUM_SQUARES#32 )
@18: scope:[] from @13
(word*) SQUARES#39 ← phi( @13/(word*) SQUARES#43 )
(byte*) heap_head#34 ← phi( @13/(byte*) heap_head#38 )
(byte) NUM_SQUARES#28 ← phi( @13/(byte) NUM_SQUARES#32 )
(byte[]) FONT_HEX_PROTO#0 ← { (number) 2, (number) 5, (number) 5, (number) 5, (number) 2, (number) 6, (number) 2, (number) 2, (number) 2, (number) 7, (number) 6, (number) 1, (number) 2, (number) 4, (number) 7, (number) 6, (number) 1, (number) 2, (number) 1, (number) 6, (number) 5, (number) 5, (number) 7, (number) 1, (number) 1, (number) 7, (number) 4, (number) 6, (number) 1, (number) 6, (number) 3, (number) 4, (number) 6, (number) 5, (number) 2, (number) 7, (number) 1, (number) 1, (number) 1, (number) 1, (number) 2, (number) 5, (number) 2, (number) 5, (number) 2, (number) 2, (number) 5, (number) 3, (number) 1, (number) 1, (number) 2, (number) 5, (number) 7, (number) 5, (number) 5, (number) 6, (number) 5, (number) 6, (number) 5, (number) 6, (number) 2, (number) 5, (number) 4, (number) 5, (number) 2, (number) 6, (number) 5, (number) 5, (number) 5, (number) 6, (number) 7, (number) 4, (number) 6, (number) 4, (number) 7, (number) 7, (number) 4, (number) 6, (number) 4, (number) 4 }
(dword) CLOCKS_PER_INIT#0 ← (number) $12
to:@32
to:@34
clock: scope:[clock] from main::@5
(number~) clock::$0 ← (number) $ffffffff - *((dword*) CIA2_TIMER_AB#0)
(dword) clock::return#0 ← (number~) clock::$0
@ -417,12 +420,12 @@ print_dword_at::@2: scope:[print_dword_at] from print_dword_at::@1
print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@2
return
to:@return
@32: scope:[] from @16
(word*) SQUARES#34 ← phi( @16/(word*) SQUARES#39 )
(byte*) heap_head#30 ← phi( @16/(byte*) heap_head#34 )
(byte) NUM_SQUARES#23 ← phi( @16/(byte) NUM_SQUARES#28 )
@34: scope:[] from @18
(word*) SQUARES#34 ← phi( @18/(word*) SQUARES#39 )
(byte*) heap_head#30 ← phi( @18/(byte*) heap_head#34 )
(byte) NUM_SQUARES#23 ← phi( @18/(byte) NUM_SQUARES#28 )
(byte[]) print_hextab#0 ← (const string) $0
to:@39
to:@41
print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1
(byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 )
(byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 )
@ -453,17 +456,17 @@ print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1
print_char_at::@return: scope:[print_char_at] from print_char_at
return
to:@return
@39: scope:[] from @32
(word*) SQUARES#33 ← phi( @32/(word*) SQUARES#34 )
(byte*) heap_head#29 ← phi( @32/(byte*) heap_head#30 )
(byte) NUM_SQUARES#22 ← phi( @32/(byte) NUM_SQUARES#23 )
@41: scope:[] from @34
(word*) SQUARES#33 ← phi( @34/(word*) SQUARES#34 )
(byte*) heap_head#29 ← phi( @34/(byte*) heap_head#30 )
(byte) NUM_SQUARES#22 ← phi( @34/(byte) NUM_SQUARES#23 )
(byte*) CHARSET#0 ← ((byte*)) (number) $2000
(byte*) SCREEN#0 ← ((byte*)) (number) $2800
to:@41
main: scope:[main] from @41
(word*) SQUARES#46 ← phi( @41/(word*) SQUARES#25 )
(byte*) heap_head#44 ← phi( @41/(byte*) heap_head#25 )
(byte) NUM_SQUARES#36 ← phi( @41/(byte) NUM_SQUARES#17 )
to:@43
main: scope:[main] from @43
(word*) SQUARES#46 ← phi( @43/(word*) SQUARES#25 )
(byte*) heap_head#44 ← phi( @43/(byte*) heap_head#25 )
(byte) NUM_SQUARES#36 ← phi( @43/(byte) NUM_SQUARES#17 )
(byte*) init_font_hex::charset#1 ← (byte*) CHARSET#0
call init_font_hex
to:main::@3
@ -787,32 +790,32 @@ init_dist_screen::@return: scope:[init_dist_screen] from init_dist_screen::@11
(word*) SQUARES#6 ← (word*) SQUARES#15
return
to:@return
@41: scope:[] from @39
(word*) SQUARES#25 ← phi( @39/(word*) SQUARES#33 )
(byte*) heap_head#25 ← phi( @39/(byte*) heap_head#29 )
(byte) NUM_SQUARES#17 ← phi( @39/(byte) NUM_SQUARES#22 )
@43: scope:[] from @41
(word*) SQUARES#25 ← phi( @41/(word*) SQUARES#33 )
(byte*) heap_head#25 ← phi( @41/(byte*) heap_head#29 )
(byte) NUM_SQUARES#17 ← phi( @41/(byte) NUM_SQUARES#22 )
call main
to:@42
@42: scope:[] from @41
(word*) SQUARES#16 ← phi( @41/(word*) SQUARES#4 )
(byte*) heap_head#18 ← phi( @41/(byte*) heap_head#6 )
(byte) NUM_SQUARES#12 ← phi( @41/(byte) NUM_SQUARES#2 )
to:@44
@44: scope:[] from @43
(word*) SQUARES#16 ← phi( @43/(word*) SQUARES#4 )
(byte*) heap_head#18 ← phi( @43/(byte*) heap_head#6 )
(byte) NUM_SQUARES#12 ← phi( @43/(byte) NUM_SQUARES#2 )
(byte) NUM_SQUARES#5 ← (byte) NUM_SQUARES#12
(byte*) heap_head#9 ← (byte*) heap_head#18
(word*) SQUARES#7 ← (word*) SQUARES#16
to:@end
@end: scope:[] from @42
@end: scope:[] from @44
SYMBOL TABLE SSA
(const string) $0 = (string) "0123456789abcdef"
(label) @11
(label) @16
(label) @32
(label) @39
(label) @10
(label) @13
(label) @18
(label) @34
(label) @4
(label) @41
(label) @42
(label) @8
(label) @43
(label) @44
(label) @begin
(label) @end
(byte*) CHARSET
@ -884,6 +887,10 @@ SYMBOL TABLE SSA
(byte) NUM_SQUARES#7
(byte) NUM_SQUARES#8
(byte) NUM_SQUARES#9
(const byte) RADIX::BINARY = (byte) 0
(const byte) RADIX::DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL = (byte) 1
(byte*) SCREEN
(byte*) SCREEN#0
(const byte) SIZEOF_WORD = (byte) 2
@ -2359,13 +2366,13 @@ Added new block during phi lifting init_dist_screen::@19(between init_dist_scree
Added new block during phi lifting init_dist_screen::@20(between init_dist_screen::@18 and init_dist_screen::@5)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @4
Adding NOP phi() at start of @8
Adding NOP phi() at start of @11
Adding NOP phi() at start of @16
Adding NOP phi() at start of @32
Adding NOP phi() at start of @39
Adding NOP phi() at start of @10
Adding NOP phi() at start of @13
Adding NOP phi() at start of @18
Adding NOP phi() at start of @34
Adding NOP phi() at start of @41
Adding NOP phi() at start of @42
Adding NOP phi() at start of @43
Adding NOP phi() at start of @44
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@3
@ -2442,12 +2449,12 @@ Coalesced [217] init_font_hex::i#3 ← init_font_hex::i#1
Coalesced [218] init_font_hex::idx#7 ← init_font_hex::idx#2
Coalesced down to 27 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) @8
Culled Empty Block (label) @11
Culled Empty Block (label) @16
Culled Empty Block (label) @32
Culled Empty Block (label) @39
Culled Empty Block (label) @42
Culled Empty Block (label) @10
Culled Empty Block (label) @13
Culled Empty Block (label) @18
Culled Empty Block (label) @34
Culled Empty Block (label) @41
Culled Empty Block (label) @44
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::toD0181_@return
Culled Empty Block (label) main::@7
@ -2465,7 +2472,7 @@ Culled Empty Block (label) init_squares::@4
Culled Empty Block (label) init_font_hex::@7
Culled Empty Block (label) init_font_hex::@8
Culled Empty Block (label) init_font_hex::@9
Renumbering block @41 to @1
Renumbering block @43 to @1
Renumbering block bsearch16u::@2 to bsearch16u::@1
Renumbering block bsearch16u::@3 to bsearch16u::@2
Renumbering block bsearch16u::@6 to bsearch16u::@3
@ -4639,6 +4646,7 @@ Uplift Scope [main] 4: zp ZP_DWORD:46 [ main::$4 ] 4: zp ZP_DWORD:50 [ main::cyc
Uplift Scope [clock] 4: zp ZP_DWORD:42 [ clock::return#2 ] 1.33: zp ZP_DWORD:60 [ clock::return#0 ]
Uplift Scope [print_dword_at] 2: zp ZP_DWORD:54 [ print_dword_at::dw#0 ]
Uplift Scope [malloc]
Uplift Scope [RADIX]
Uplift Scope [clock_start]
Uplift Scope []
@ -4657,6 +4665,7 @@ Uplifting [main] best 239596 combination zp ZP_DWORD:46 [ main::$4 ] zp ZP_DWORD
Uplifting [clock] best 239596 combination zp ZP_DWORD:42 [ clock::return#2 ] zp ZP_DWORD:60 [ clock::return#0 ]
Uplifting [print_dword_at] best 239596 combination zp ZP_DWORD:54 [ print_dword_at::dw#0 ]
Uplifting [malloc] best 239596 combination
Uplifting [RADIX] best 239596 combination
Uplifting [clock_start] best 239596 combination
Uplifting [] best 239596 combination
Attempting to uplift remaining variables inzp ZP_BYTE:41 [ init_font_hex::idx#5 init_font_hex::idx#2 ]
@ -5919,6 +5928,10 @@ FINAL SYMBOL TABLE
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(byte) NUM_SQUARES
(const byte) NUM_SQUARES#3 NUM_SQUARES = (byte) $30
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = (byte*) 10240
(const byte) SIZEOF_WORD SIZEOF_WORD = (byte) 2
@ -6816,7 +6829,7 @@ bsearch16u: {
lda #0
adc items+1
sta pivot+1
// result = (signed word)key-(signed word)*pivot
// result = (signed int)key-(signed int)*pivot
// [107] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0) -- vwsz1=vwsz2_minus__deref_pwsz3
sec
lda key

View File

@ -27,6 +27,10 @@
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(byte) NUM_SQUARES
(const byte) NUM_SQUARES#3 NUM_SQUARES = (byte) $30
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = (byte*) 10240
(const byte) SIZEOF_WORD SIZEOF_WORD = (byte) 2

View File

@ -6,6 +6,7 @@ Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot +
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
Fixing pointer increment (word*) init_squares::squares ← ++ (word*) init_squares::squares
Fixing pointer addition (word~) sqrt::$1 ← (word*) sqrt::found - (word*) SQUARES
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Fixing pointer array-indexing *((word*) SQUARES + (byte) sqr::val)
Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i)
Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i)
@ -36,10 +37,12 @@ Culled Empty Block (label) bsearch16u::@16
Culled Empty Block (label) bsearch16u::@17
Culled Empty Block (label) bsearch16u::@4
Culled Empty Block (label) bsearch16u::@5
Culled Empty Block (label) init_squares::@2
Culled Empty Block (label) @12
Culled Empty Block (label) @13
Culled Empty Block (label) init_squares::@2
Culled Empty Block (label) @15
Culled Empty Block (label) sqr::@1
Culled Empty Block (label) @14
Culled Empty Block (label) @16
Culled Empty Block (label) sqrt::@1
Culled Empty Block (label) atan2_16::@9
Culled Empty Block (label) atan2_16::@10
@ -53,7 +56,7 @@ Culled Empty Block (label) atan2_16::@23
Culled Empty Block (label) atan2_16::@31
Culled Empty Block (label) atan2_16::@32
Culled Empty Block (label) atan2_16::@14
Culled Empty Block (label) @16
Culled Empty Block (label) @18
Culled Empty Block (label) main::@2
Culled Empty Block (label) main::@19
Culled Empty Block (label) main::@3
@ -69,9 +72,9 @@ Culled Empty Block (label) main::@26
Culled Empty Block (label) main::@28
Culled Empty Block (label) main::@29
Culled Empty Block (label) init_buckets::@10
Culled Empty Block (label) @19
Culled Empty Block (label) @21
Culled Empty Block (label) init_angle_screen::@4
Culled Empty Block (label) @20
Culled Empty Block (label) @22
Culled Empty Block (label) init_dist_screen::@13
Culled Empty Block (label) init_dist_screen::@14
Culled Empty Block (label) init_dist_screen::@9
@ -87,10 +90,10 @@ CONTROL FLOW GRAPH SSA
@8: scope:[] from @begin
(byte*) HEAP_TOP#0 ← ((byte*)) (number) $a000
(byte*) heap_head#0 ← (byte*) HEAP_TOP#0
to:@12
malloc: scope:[malloc] from @17 @18 @22 @24 @25 init_buckets::@5 init_squares
(word) malloc::size#7 ← phi( @17/(word) malloc::size#1 @18/(word) malloc::size#3 @22/(word) malloc::size#2 @24/(word) malloc::size#4 @25/(word) malloc::size#5 init_buckets::@5/(word) malloc::size#6 init_squares/(word) malloc::size#0 )
(byte*) heap_head#18 ← phi( @17/(byte*) heap_head#35 @18/(byte*) heap_head#36 @22/(byte*) heap_head#5 @24/(byte*) heap_head#10 @25/(byte*) heap_head#11 init_buckets::@5/(byte*) heap_head#37 init_squares/(byte*) heap_head#38 )
to:@14
malloc: scope:[malloc] from @19 @20 @24 @26 @27 init_buckets::@5 init_squares
(word) malloc::size#7 ← phi( @19/(word) malloc::size#1 @20/(word) malloc::size#3 @24/(word) malloc::size#2 @26/(word) malloc::size#4 @27/(word) malloc::size#5 init_buckets::@5/(word) malloc::size#6 init_squares/(word) malloc::size#0 )
(byte*) heap_head#18 ← phi( @19/(byte*) heap_head#35 @20/(byte*) heap_head#36 @24/(byte*) heap_head#5 @26/(byte*) heap_head#10 @27/(byte*) heap_head#11 init_buckets::@5/(byte*) heap_head#37 init_squares/(byte*) heap_head#38 )
(byte*~) malloc::$0 ← (byte*) heap_head#18 - (word) malloc::size#7
(byte*) malloc::mem#0 ← (byte*~) malloc::$0
(byte*) heap_head#1 ← (byte*) malloc::mem#0
@ -185,11 +188,11 @@ bsearch16u::@3: scope:[bsearch16u] from bsearch16u::@1 bsearch16u::@2
(word*~) bsearch16u::$4 ← phi( bsearch16u::@1/(word*~) bsearch16u::$3 bsearch16u::@2/(word*~) bsearch16u::$2 )
(word*) bsearch16u::return#2 ← (word*~) bsearch16u::$4
to:bsearch16u::@return
@12: scope:[] from @8
@14: scope:[] from @8
(byte*) heap_head#54 ← phi( @8/(byte*) heap_head#0 )
(byte) NUM_SQUARES#0 ← (number) $ff
(word*) SQUARES#0 ← (word*) 0
to:@15
to:@17
init_squares: scope:[init_squares] from init_dist_screen
(byte*) heap_head#38 ← phi( init_dist_screen/(byte*) heap_head#44 )
(byte) NUM_SQUARES#6 ← phi( init_dist_screen/(byte) NUM_SQUARES#3 )
@ -269,15 +272,15 @@ sqrt::@return: scope:[sqrt] from sqrt::@2
(byte) sqrt::return#1 ← (byte) sqrt::return#3
return
to:@return
@15: scope:[] from @12
(word*) SQUARES#57 ← phi( @12/(word*) SQUARES#0 )
(byte) NUM_SQUARES#51 ← phi( @12/(byte) NUM_SQUARES#0 )
(byte*) heap_head#47 ← phi( @12/(byte*) heap_head#54 )
@17: scope:[] from @14
(word*) SQUARES#57 ← phi( @14/(word*) SQUARES#0 )
(byte) NUM_SQUARES#51 ← phi( @14/(byte) NUM_SQUARES#0 )
(byte*) heap_head#47 ← phi( @14/(byte*) heap_head#54 )
(byte) CORDIC_ITERATIONS_16#0 ← (number) $f
(word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 ← kickasm {{ .for (var i=0; i<CORDIC_ITERATIONS_16; i++)
.word 256*2*256*atan(1/pow(2,i))/PI/2
}}
to:@17
to:@19
atan2_16: scope:[atan2_16] from init_angle_screen::@2
(signed word) atan2_16::x#9 ← phi( init_angle_screen::@2/(signed word) atan2_16::x#0 )
(signed word) atan2_16::y#1 ← phi( init_angle_screen::@2/(signed word) atan2_16::y#0 )
@ -488,41 +491,41 @@ atan2_16::@return: scope:[atan2_16] from atan2_16::@8
(word) atan2_16::return#1 ← (word) atan2_16::return#3
return
to:@return
@17: scope:[] from @15
(word*) SQUARES#56 ← phi( @15/(word*) SQUARES#57 )
(byte) NUM_SQUARES#49 ← phi( @15/(byte) NUM_SQUARES#51 )
(byte*) heap_head#35 ← phi( @15/(byte*) heap_head#47 )
@19: scope:[] from @17
(word*) SQUARES#56 ← phi( @17/(word*) SQUARES#57 )
(byte) NUM_SQUARES#49 ← phi( @17/(byte) NUM_SQUARES#51 )
(byte*) heap_head#35 ← phi( @17/(byte*) heap_head#47 )
(word) malloc::size#1 ← (number) $3e8
call malloc
(void*) malloc::return#3 ← (void*) malloc::return#1
to:@22
@22: scope:[] from @17
(word*) SQUARES#54 ← phi( @17/(word*) SQUARES#56 )
(byte) NUM_SQUARES#45 ← phi( @17/(byte) NUM_SQUARES#49 )
(byte*) heap_head#22 ← phi( @17/(byte*) heap_head#2 )
(void*) malloc::return#11 ← phi( @17/(void*) malloc::return#3 )
to:@24
@24: scope:[] from @19
(word*) SQUARES#54 ← phi( @19/(word*) SQUARES#56 )
(byte) NUM_SQUARES#45 ← phi( @19/(byte) NUM_SQUARES#49 )
(byte*) heap_head#22 ← phi( @19/(byte*) heap_head#2 )
(void*) malloc::return#11 ← phi( @19/(void*) malloc::return#3 )
(void*~) $0 ← (void*) malloc::return#11
(byte*) heap_head#5 ← (byte*) heap_head#22
(byte[]) SCREEN_DIST#0 ← ((byte*)) (void*~) $0
(word) malloc::size#2 ← (number) $3e8
call malloc
(void*) malloc::return#4 ← (void*) malloc::return#1
to:@23
@23: scope:[] from @22
(word*) SQUARES#53 ← phi( @22/(word*) SQUARES#54 )
(byte) NUM_SQUARES#43 ← phi( @22/(byte) NUM_SQUARES#45 )
(byte*) heap_head#23 ← phi( @22/(byte*) heap_head#2 )
(void*) malloc::return#12 ← phi( @22/(void*) malloc::return#4 )
to:@25
@25: scope:[] from @24
(word*) SQUARES#53 ← phi( @24/(word*) SQUARES#54 )
(byte) NUM_SQUARES#43 ← phi( @24/(byte) NUM_SQUARES#45 )
(byte*) heap_head#23 ← phi( @24/(byte*) heap_head#2 )
(void*) malloc::return#12 ← phi( @24/(void*) malloc::return#4 )
(void*~) $1 ← (void*) malloc::return#12
(byte*) heap_head#6 ← (byte*) heap_head#23
(byte[]) SCREEN_ANGLE#0 ← ((byte*)) (void*~) $1
(byte*) SCREEN_FILL#0 ← ((byte*)) (number) $400
(byte) FILL_CHAR#0 ← (byte) '*'
to:@18
main: scope:[main] from @21
(word*) SQUARES#21 ← phi( @21/(word*) SQUARES#25 )
(byte*) heap_head#40 ← phi( @21/(byte*) heap_head#46 )
(byte) NUM_SQUARES#14 ← phi( @21/(byte) NUM_SQUARES#17 )
to:@20
main: scope:[main] from @23
(word*) SQUARES#21 ← phi( @23/(word*) SQUARES#25 )
(byte*) heap_head#40 ← phi( @23/(byte*) heap_head#46 )
(byte) NUM_SQUARES#14 ← phi( @23/(byte) NUM_SQUARES#17 )
asm { sei }
(byte*) init_dist_screen::screen#0 ← (byte[]) SCREEN_DIST#0
call init_dist_screen
@ -713,21 +716,21 @@ main::@return: scope:[main] from main::@24
(word*) SQUARES#4 ← (word*) SQUARES#13
return
to:@return
@18: scope:[] from @23
(word*) SQUARES#49 ← phi( @23/(word*) SQUARES#53 )
(byte) NUM_SQUARES#38 ← phi( @23/(byte) NUM_SQUARES#43 )
(byte*) heap_head#36 ← phi( @23/(byte*) heap_head#6 )
@20: scope:[] from @25
(word*) SQUARES#49 ← phi( @25/(word*) SQUARES#53 )
(byte) NUM_SQUARES#38 ← phi( @25/(byte) NUM_SQUARES#43 )
(byte*) heap_head#36 ← phi( @25/(byte*) heap_head#6 )
(byte) NUM_BUCKETS#0 ← (number) $30
(byte~) $2 ← (byte) NUM_BUCKETS#0 * (const byte) SIZEOF_BYTE
(word) malloc::size#3 ← (byte~) $2
call malloc
(void*) malloc::return#5 ← (void*) malloc::return#1
to:@24
@24: scope:[] from @18
(word*) SQUARES#45 ← phi( @18/(word*) SQUARES#49 )
(byte) NUM_SQUARES#34 ← phi( @18/(byte) NUM_SQUARES#38 )
(byte*) heap_head#27 ← phi( @18/(byte*) heap_head#2 )
(void*) malloc::return#13 ← phi( @18/(void*) malloc::return#5 )
to:@26
@26: scope:[] from @20
(word*) SQUARES#45 ← phi( @20/(word*) SQUARES#49 )
(byte) NUM_SQUARES#34 ← phi( @20/(byte) NUM_SQUARES#38 )
(byte*) heap_head#27 ← phi( @20/(byte*) heap_head#2 )
(void*) malloc::return#13 ← phi( @20/(void*) malloc::return#5 )
(void*~) $3 ← (void*) malloc::return#13
(byte*) heap_head#10 ← (byte*) heap_head#27
(byte[]) BUCKET_SIZES#0 ← ((byte*)) (void*~) $3
@ -735,12 +738,12 @@ main::@return: scope:[main] from main::@24
(word) malloc::size#4 ← (byte~) $4
call malloc
(void*) malloc::return#6 ← (void*) malloc::return#1
to:@25
@25: scope:[] from @24
(word*) SQUARES#39 ← phi( @24/(word*) SQUARES#45 )
(byte) NUM_SQUARES#28 ← phi( @24/(byte) NUM_SQUARES#34 )
(byte*) heap_head#28 ← phi( @24/(byte*) heap_head#2 )
(void*) malloc::return#14 ← phi( @24/(void*) malloc::return#6 )
to:@27
@27: scope:[] from @26
(word*) SQUARES#39 ← phi( @26/(word*) SQUARES#45 )
(byte) NUM_SQUARES#28 ← phi( @26/(byte) NUM_SQUARES#34 )
(byte*) heap_head#28 ← phi( @26/(byte*) heap_head#2 )
(void*) malloc::return#14 ← phi( @26/(void*) malloc::return#6 )
(void*~) $5 ← (void*) malloc::return#14
(byte*) heap_head#11 ← (byte*) heap_head#28
(word*[]) BUCKETS#0 ← ((word**)) (void*~) $5
@ -748,16 +751,16 @@ main::@return: scope:[main] from main::@24
(word) malloc::size#5 ← (byte~) $6
call malloc
(void*) malloc::return#7 ← (void*) malloc::return#1
to:@26
@26: scope:[] from @25
(word*) SQUARES#34 ← phi( @25/(word*) SQUARES#39 )
(byte) NUM_SQUARES#23 ← phi( @25/(byte) NUM_SQUARES#28 )
(byte*) heap_head#29 ← phi( @25/(byte*) heap_head#2 )
(void*) malloc::return#15 ← phi( @25/(void*) malloc::return#7 )
to:@28
@28: scope:[] from @27
(word*) SQUARES#34 ← phi( @27/(word*) SQUARES#39 )
(byte) NUM_SQUARES#23 ← phi( @27/(byte) NUM_SQUARES#28 )
(byte*) heap_head#29 ← phi( @27/(byte*) heap_head#2 )
(void*) malloc::return#15 ← phi( @27/(void*) malloc::return#7 )
(void*~) $7 ← (void*) malloc::return#15
(byte*) heap_head#12 ← (byte*) heap_head#29
(byte[]) BUCKET_IDX#0 ← ((byte*)) (void*~) $7
to:@21
to:@23
init_buckets: scope:[init_buckets] from main::@31
(byte*) heap_head#74 ← phi( main::@31/(byte*) heap_head#41 )
(byte*) init_buckets::screen#6 ← phi( main::@31/(byte*) init_buckets::screen#0 )
@ -1135,21 +1138,21 @@ init_dist_screen::@return: scope:[init_dist_screen] from init_dist_screen::@11
(word*) SQUARES#6 ← (word*) SQUARES#15
return
to:@return
@21: scope:[] from @26
(word*) SQUARES#25 ← phi( @26/(word*) SQUARES#34 )
(byte*) heap_head#46 ← phi( @26/(byte*) heap_head#12 )
(byte) NUM_SQUARES#17 ← phi( @26/(byte) NUM_SQUARES#23 )
@23: scope:[] from @28
(word*) SQUARES#25 ← phi( @28/(word*) SQUARES#34 )
(byte*) heap_head#46 ← phi( @28/(byte*) heap_head#12 )
(byte) NUM_SQUARES#17 ← phi( @28/(byte) NUM_SQUARES#23 )
call main
to:@27
@27: scope:[] from @21
(word*) SQUARES#16 ← phi( @21/(word*) SQUARES#4 )
(byte*) heap_head#34 ← phi( @21/(byte*) heap_head#9 )
(byte) NUM_SQUARES#12 ← phi( @21/(byte) NUM_SQUARES#2 )
to:@29
@29: scope:[] from @23
(word*) SQUARES#16 ← phi( @23/(word*) SQUARES#4 )
(byte*) heap_head#34 ← phi( @23/(byte*) heap_head#9 )
(byte) NUM_SQUARES#12 ← phi( @23/(byte) NUM_SQUARES#2 )
(byte) NUM_SQUARES#5 ← (byte) NUM_SQUARES#12
(byte*) heap_head#17 ← (byte*) heap_head#34
(word*) SQUARES#7 ← (word*) SQUARES#16
to:@end
@end: scope:[] from @27
@end: scope:[] from @29
SYMBOL TABLE SSA
(void*~) $0
@ -1160,17 +1163,17 @@ SYMBOL TABLE SSA
(void*~) $5
(byte~) $6
(void*~) $7
(label) @12
(label) @15
(label) @14
(label) @17
(label) @18
(label) @21
(label) @22
(label) @19
(label) @20
(label) @23
(label) @24
(label) @25
(label) @26
(label) @27
(label) @28
(label) @29
(label) @8
(label) @begin
(label) @end
@ -1248,6 +1251,10 @@ SYMBOL TABLE SSA
(byte) NUM_SQUARES#7
(byte) NUM_SQUARES#8
(byte) NUM_SQUARES#9
(const byte) RADIX::BINARY = (byte) 0
(const byte) RADIX::DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL = (byte) 1
(byte*) RASTER
(byte*) RASTER#0
(byte[]) SCREEN_ANGLE
@ -3144,11 +3151,11 @@ Added new block during phi lifting init_dist_screen::@19(between init_dist_scree
Added new block during phi lifting init_dist_screen::@20(between init_dist_screen::@18 and init_dist_screen::@5)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @8
Adding NOP phi() at start of @12
Adding NOP phi() at start of @15
Adding NOP phi() at start of @14
Adding NOP phi() at start of @17
Adding NOP phi() at start of @21
Adding NOP phi() at start of @27
Adding NOP phi() at start of @19
Adding NOP phi() at start of @23
Adding NOP phi() at start of @29
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@32
Adding NOP phi() at start of main::@6
@ -3263,9 +3270,9 @@ Coalesced [342] init_squares::squares#3 ← init_squares::squares#1
Coalesced [343] init_squares::i#3 ← init_squares::i#1
Coalesced down to 45 phi equivalence classes
Culled Empty Block (label) @8
Culled Empty Block (label) @12
Culled Empty Block (label) @15
Culled Empty Block (label) @27
Culled Empty Block (label) @14
Culled Empty Block (label) @17
Culled Empty Block (label) @29
Culled Empty Block (label) main::@32
Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@24
@ -3289,14 +3296,14 @@ Culled Empty Block (label) init_dist_screen::@20
Culled Empty Block (label) bsearch16u::@1
Culled Empty Block (label) bsearch16u::@18
Culled Empty Block (label) init_squares::@4
Renumbering block @17 to @1
Renumbering block @18 to @2
Renumbering block @21 to @3
Renumbering block @22 to @4
Renumbering block @23 to @5
Renumbering block @24 to @6
Renumbering block @25 to @7
Renumbering block @26 to @8
Renumbering block @19 to @1
Renumbering block @20 to @2
Renumbering block @23 to @3
Renumbering block @24 to @4
Renumbering block @25 to @5
Renumbering block @26 to @6
Renumbering block @27 to @7
Renumbering block @28 to @8
Renumbering block bsearch16u::@2 to bsearch16u::@1
Renumbering block bsearch16u::@3 to bsearch16u::@2
Renumbering block bsearch16u::@6 to bsearch16u::@3
@ -6913,6 +6920,7 @@ Uplift Scope [sqrt] 202: zp ZP_BYTE:148 [ sqrt::return#2 ] 103: zp ZP_WORD:146 [
Uplift Scope [init_squares] 25.17: zp ZP_WORD:61 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ] 22: zp ZP_BYTE:63 [ init_squares::i#2 init_squares::i#1 ] 22: zp ZP_BYTE:172 [ init_squares::$3 ] 22: zp ZP_BYTE:173 [ init_squares::$4 ] 13.93: zp ZP_WORD:59 [ init_squares::sqr#2 init_squares::sqr#1 ]
Uplift Scope [malloc] 35: zp ZP_WORD:23 [ malloc::size#7 malloc::size#6 ] 0.4: zp ZP_WORD:109 [ malloc::mem#0 ]
Uplift Scope [] 23.24: zp ZP_WORD:21 [ heap_head#18 heap_head#1 ] 0.12: zp ZP_WORD:64 [ SCREEN_DIST#0 ] 0.05: zp ZP_WORD:66 [ SCREEN_ANGLE#0 ] 0.04: zp ZP_WORD:72 [ BUCKET_IDX#0 ] 0.03: zp ZP_WORD:170 [ SQUARES#1 ] 0.03: zp ZP_WORD:70 [ BUCKETS#0 ] 0.02: zp ZP_WORD:68 [ BUCKET_SIZES#0 ]
Uplift Scope [RADIX]
Uplifting [atan2_16] best 1253979 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp ZP_WORD:42 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp ZP_WORD:44 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp ZP_WORD:37 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp ZP_WORD:32 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp ZP_WORD:34 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$24 ] reg byte a [ atan2_16::$23 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp ZP_WORD:122 [ atan2_16::return#2 ] zp ZP_WORD:39 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] zp ZP_WORD:118 [ atan2_16::x#0 ] zp ZP_WORD:120 [ atan2_16::y#0 ]
Limited combination testing to 100 combinations of 144 possible.
@ -6929,6 +6937,7 @@ Uplifting [sqrt] best 1226619 combination reg byte a [ sqrt::return#2 ] zp ZP_WO
Uplifting [init_squares] best 1226419 combination zp ZP_WORD:61 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ] reg byte x [ init_squares::i#2 init_squares::i#1 ] reg byte a [ init_squares::$3 ] reg byte a [ init_squares::$4 ] zp ZP_WORD:59 [ init_squares::sqr#2 init_squares::sqr#1 ]
Uplifting [malloc] best 1226419 combination zp ZP_WORD:23 [ malloc::size#7 malloc::size#6 ] zp ZP_WORD:109 [ malloc::mem#0 ]
Uplifting [] best 1226419 combination zp ZP_WORD:21 [ heap_head#18 heap_head#1 ] zp ZP_WORD:64 [ SCREEN_DIST#0 ] zp ZP_WORD:66 [ SCREEN_ANGLE#0 ] zp ZP_WORD:72 [ BUCKET_IDX#0 ] zp ZP_WORD:170 [ SQUARES#1 ] zp ZP_WORD:70 [ BUCKETS#0 ] zp ZP_WORD:68 [ BUCKET_SIZES#0 ]
Uplifting [RADIX] best 1226419 combination
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::min_angle#2 main::min_angle#4 main::min_angle#1 ]
Uplifting [main] best 1226419 combination zp ZP_BYTE:4 [ main::min_angle#2 main::min_angle#4 main::min_angle#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:130 [ init_angle_screen::$13 ]
@ -9061,6 +9070,10 @@ FINAL SYMBOL TABLE
(const byte) NUM_BUCKETS#0 NUM_BUCKETS = (byte) $30
(byte) NUM_SQUARES
(const byte) NUM_SQUARES#3 NUM_SQUARES = (byte) $30
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) RASTER
(const byte*) RASTER#0 RASTER = (byte*) 53266
(byte[]) SCREEN_ANGLE
@ -10976,7 +10989,7 @@ bsearch16u: {
lda #0
adc items+1
sta pivot+1
// result = (signed word)key-(signed word)*pivot
// result = (signed int)key-(signed int)*pivot
// [231] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0) -- vwsz1=vwsz2_minus__deref_pwsz3
sec
lda key

View File

@ -32,6 +32,10 @@
(const byte) NUM_BUCKETS#0 NUM_BUCKETS = (byte) $30
(byte) NUM_SQUARES
(const byte) NUM_SQUARES#3 NUM_SQUARES = (byte) $30
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) RASTER
(const byte*) RASTER#0 RASTER = (byte*) 53266
(byte[]) SCREEN_ANGLE

View File

@ -3,6 +3,7 @@ Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot +
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
Fixing pointer increment (word*) init_squares::squares ← ++ (word*) init_squares::squares
Fixing pointer addition (word~) sqrt::$1 ← (word*) sqrt::found - (word*) SQUARES
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Fixing pointer array-indexing *((word*) SQUARES + (byte) sqr::val)
Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i)
Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i)
@ -23,10 +24,12 @@ Culled Empty Block (label) bsearch16u::@16
Culled Empty Block (label) bsearch16u::@17
Culled Empty Block (label) bsearch16u::@4
Culled Empty Block (label) bsearch16u::@5
Culled Empty Block (label) init_squares::@2
Culled Empty Block (label) @8
Culled Empty Block (label) @9
Culled Empty Block (label) init_squares::@2
Culled Empty Block (label) @11
Culled Empty Block (label) sqr::@1
Culled Empty Block (label) @10
Culled Empty Block (label) @12
Culled Empty Block (label) sqrt::@1
Culled Empty Block (label) atan2_16::@9
Culled Empty Block (label) atan2_16::@10
@ -40,7 +43,7 @@ Culled Empty Block (label) atan2_16::@23
Culled Empty Block (label) atan2_16::@31
Culled Empty Block (label) atan2_16::@32
Culled Empty Block (label) atan2_16::@14
Culled Empty Block (label) @12
Culled Empty Block (label) @14
Culled Empty Block (label) main::@14
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@15
@ -49,9 +52,9 @@ Culled Empty Block (label) main::@10
Culled Empty Block (label) main::@13
Culled Empty Block (label) main::@11
Culled Empty Block (label) main::@16
Culled Empty Block (label) @14
Culled Empty Block (label) @16
Culled Empty Block (label) init_angle_screen::@4
Culled Empty Block (label) @15
Culled Empty Block (label) @17
Culled Empty Block (label) init_dist_screen::@13
Culled Empty Block (label) init_dist_screen::@14
Culled Empty Block (label) init_dist_screen::@9
@ -64,10 +67,10 @@ CONTROL FLOW GRAPH SSA
@4: scope:[] from @begin
(byte*) HEAP_TOP#0 ← ((byte*)) (number) $a000
(byte*) heap_head#0 ← (byte*) HEAP_TOP#0
to:@8
malloc: scope:[malloc] from @13 @17 init_squares
(word) malloc::size#3 ← phi( @13/(word) malloc::size#1 @17/(word) malloc::size#2 init_squares/(word) malloc::size#0 )
(byte*) heap_head#12 ← phi( @13/(byte*) heap_head#23 @17/(byte*) heap_head#5 init_squares/(byte*) heap_head#24 )
to:@10
malloc: scope:[malloc] from @15 @19 init_squares
(word) malloc::size#3 ← phi( @15/(word) malloc::size#1 @19/(word) malloc::size#2 init_squares/(word) malloc::size#0 )
(byte*) heap_head#12 ← phi( @15/(byte*) heap_head#23 @19/(byte*) heap_head#5 init_squares/(byte*) heap_head#24 )
(byte*~) malloc::$0 ← (byte*) heap_head#12 - (word) malloc::size#3
(byte*) malloc::mem#0 ← (byte*~) malloc::$0
(byte*) heap_head#1 ← (byte*) malloc::mem#0
@ -162,11 +165,11 @@ bsearch16u::@3: scope:[bsearch16u] from bsearch16u::@1 bsearch16u::@2
(word*~) bsearch16u::$4 ← phi( bsearch16u::@1/(word*~) bsearch16u::$3 bsearch16u::@2/(word*~) bsearch16u::$2 )
(word*) bsearch16u::return#2 ← (word*~) bsearch16u::$4
to:bsearch16u::@return
@8: scope:[] from @4
@10: scope:[] from @4
(byte*) heap_head#37 ← phi( @4/(byte*) heap_head#0 )
(byte) NUM_SQUARES#0 ← (number) $ff
(word*) SQUARES#0 ← (word*) 0
to:@11
to:@13
init_squares: scope:[init_squares] from init_dist_screen
(byte*) heap_head#24 ← phi( init_dist_screen/(byte*) heap_head#29 )
(byte) NUM_SQUARES#6 ← phi( init_dist_screen/(byte) NUM_SQUARES#3 )
@ -246,15 +249,15 @@ sqrt::@return: scope:[sqrt] from sqrt::@2
(byte) sqrt::return#1 ← (byte) sqrt::return#3
return
to:@return
@11: scope:[] from @8
(word*) SQUARES#45 ← phi( @8/(word*) SQUARES#0 )
(byte) NUM_SQUARES#34 ← phi( @8/(byte) NUM_SQUARES#0 )
(byte*) heap_head#32 ← phi( @8/(byte*) heap_head#37 )
@13: scope:[] from @10
(word*) SQUARES#45 ← phi( @10/(word*) SQUARES#0 )
(byte) NUM_SQUARES#34 ← phi( @10/(byte) NUM_SQUARES#0 )
(byte*) heap_head#32 ← phi( @10/(byte*) heap_head#37 )
(byte) CORDIC_ITERATIONS_16#0 ← (number) $f
(word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 ← kickasm {{ .for (var i=0; i<CORDIC_ITERATIONS_16; i++)
.word 256*2*256*atan(1/pow(2,i))/PI/2
}}
to:@13
to:@15
atan2_16: scope:[atan2_16] from init_angle_screen::@2
(signed word) atan2_16::x#9 ← phi( init_angle_screen::@2/(signed word) atan2_16::x#0 )
(signed word) atan2_16::y#1 ← phi( init_angle_screen::@2/(signed word) atan2_16::y#0 )
@ -465,41 +468,41 @@ atan2_16::@return: scope:[atan2_16] from atan2_16::@8
(word) atan2_16::return#1 ← (word) atan2_16::return#3
return
to:@return
@13: scope:[] from @11
(word*) SQUARES#42 ← phi( @11/(word*) SQUARES#45 )
(byte) NUM_SQUARES#31 ← phi( @11/(byte) NUM_SQUARES#34 )
(byte*) heap_head#23 ← phi( @11/(byte*) heap_head#32 )
@15: scope:[] from @13
(word*) SQUARES#42 ← phi( @13/(word*) SQUARES#45 )
(byte) NUM_SQUARES#31 ← phi( @13/(byte) NUM_SQUARES#34 )
(byte*) heap_head#23 ← phi( @13/(byte*) heap_head#32 )
(word) malloc::size#1 ← (number) $3e8
call malloc
(void*) malloc::return#3 ← (void*) malloc::return#1
to:@17
@17: scope:[] from @13
(word*) SQUARES#36 ← phi( @13/(word*) SQUARES#42 )
(byte) NUM_SQUARES#25 ← phi( @13/(byte) NUM_SQUARES#31 )
(byte*) heap_head#16 ← phi( @13/(byte*) heap_head#2 )
(void*) malloc::return#7 ← phi( @13/(void*) malloc::return#3 )
to:@19
@19: scope:[] from @15
(word*) SQUARES#36 ← phi( @15/(word*) SQUARES#42 )
(byte) NUM_SQUARES#25 ← phi( @15/(byte) NUM_SQUARES#31 )
(byte*) heap_head#16 ← phi( @15/(byte*) heap_head#2 )
(void*) malloc::return#7 ← phi( @15/(void*) malloc::return#3 )
(void*~) $0 ← (void*) malloc::return#7
(byte*) heap_head#5 ← (byte*) heap_head#16
(byte*) SCREEN_DIST#0 ← ((byte*)) (void*~) $0
(word) malloc::size#2 ← (number) $3e8
call malloc
(void*) malloc::return#4 ← (void*) malloc::return#1
to:@18
@18: scope:[] from @17
(word*) SQUARES#35 ← phi( @17/(word*) SQUARES#36 )
(byte) NUM_SQUARES#24 ← phi( @17/(byte) NUM_SQUARES#25 )
(byte*) heap_head#17 ← phi( @17/(byte*) heap_head#2 )
(void*) malloc::return#8 ← phi( @17/(void*) malloc::return#4 )
to:@20
@20: scope:[] from @19
(word*) SQUARES#35 ← phi( @19/(word*) SQUARES#36 )
(byte) NUM_SQUARES#24 ← phi( @19/(byte) NUM_SQUARES#25 )
(byte*) heap_head#17 ← phi( @19/(byte*) heap_head#2 )
(void*) malloc::return#8 ← phi( @19/(void*) malloc::return#4 )
(void*~) $1 ← (void*) malloc::return#8
(byte*) heap_head#6 ← (byte*) heap_head#17
(byte*) SCREEN_ANGLE#0 ← ((byte*)) (void*~) $1
(byte*) SCREEN_FILL#0 ← ((byte*)) (number) $400
(byte) FILL_CHAR#0 ← (byte) '@'
to:@16
main: scope:[main] from @16
(word*) SQUARES#21 ← phi( @16/(word*) SQUARES#26 )
(byte*) heap_head#26 ← phi( @16/(byte*) heap_head#31 )
(byte) NUM_SQUARES#14 ← phi( @16/(byte) NUM_SQUARES#18 )
to:@18
main: scope:[main] from @18
(word*) SQUARES#21 ← phi( @18/(word*) SQUARES#26 )
(byte*) heap_head#26 ← phi( @18/(byte*) heap_head#31 )
(byte) NUM_SQUARES#14 ← phi( @18/(byte) NUM_SQUARES#18 )
(byte*) init_dist_screen::screen#0 ← (byte*) SCREEN_DIST#0
call init_dist_screen
to:main::@17
@ -887,33 +890,33 @@ init_dist_screen::@return: scope:[init_dist_screen] from init_dist_screen::@11
(word*) SQUARES#6 ← (word*) SQUARES#15
return
to:@return
@16: scope:[] from @18
(word*) SQUARES#26 ← phi( @18/(word*) SQUARES#35 )
(byte*) heap_head#31 ← phi( @18/(byte*) heap_head#6 )
(byte) NUM_SQUARES#18 ← phi( @18/(byte) NUM_SQUARES#24 )
@18: scope:[] from @20
(word*) SQUARES#26 ← phi( @20/(word*) SQUARES#35 )
(byte*) heap_head#31 ← phi( @20/(byte*) heap_head#6 )
(byte) NUM_SQUARES#18 ← phi( @20/(byte) NUM_SQUARES#24 )
call main
to:@19
@19: scope:[] from @16
(word*) SQUARES#16 ← phi( @16/(word*) SQUARES#4 )
(byte*) heap_head#22 ← phi( @16/(byte*) heap_head#8 )
(byte) NUM_SQUARES#12 ← phi( @16/(byte) NUM_SQUARES#2 )
to:@21
@21: scope:[] from @18
(word*) SQUARES#16 ← phi( @18/(word*) SQUARES#4 )
(byte*) heap_head#22 ← phi( @18/(byte*) heap_head#8 )
(byte) NUM_SQUARES#12 ← phi( @18/(byte) NUM_SQUARES#2 )
(byte) NUM_SQUARES#5 ← (byte) NUM_SQUARES#12
(byte*) heap_head#11 ← (byte*) heap_head#22
(word*) SQUARES#7 ← (word*) SQUARES#16
to:@end
@end: scope:[] from @19
@end: scope:[] from @21
SYMBOL TABLE SSA
(void*~) $0
(void*~) $1
(label) @11
(label) @10
(label) @13
(label) @16
(label) @17
(label) @15
(label) @18
(label) @19
(label) @20
(label) @21
(label) @4
(label) @8
(label) @begin
(label) @end
(word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16
@ -966,6 +969,10 @@ SYMBOL TABLE SSA
(byte) NUM_SQUARES#7
(byte) NUM_SQUARES#8
(byte) NUM_SQUARES#9
(const byte) RADIX::BINARY = (byte) 0
(const byte) RADIX::DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL = (byte) 1
(byte*) SCREEN_ANGLE
(byte*) SCREEN_ANGLE#0
(byte*) SCREEN_DIST
@ -2461,11 +2468,11 @@ Added new block during phi lifting init_dist_screen::@19(between init_dist_scree
Added new block during phi lifting init_dist_screen::@20(between init_dist_screen::@18 and init_dist_screen::@5)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @4
Adding NOP phi() at start of @8
Adding NOP phi() at start of @11
Adding NOP phi() at start of @10
Adding NOP phi() at start of @13
Adding NOP phi() at start of @16
Adding NOP phi() at start of @19
Adding NOP phi() at start of @15
Adding NOP phi() at start of @18
Adding NOP phi() at start of @21
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@18
Adding NOP phi() at start of main::@1
@ -2564,9 +2571,9 @@ Coalesced [265] init_squares::i#3 ← init_squares::i#1
Not coalescing [268] heap_head#1 ← malloc::mem#0
Coalesced down to 38 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) @8
Culled Empty Block (label) @11
Culled Empty Block (label) @19
Culled Empty Block (label) @10
Culled Empty Block (label) @13
Culled Empty Block (label) @21
Culled Empty Block (label) main::@18
Culled Empty Block (label) main::@1
Culled Empty Block (label) init_angle_screen::@6
@ -2582,10 +2589,10 @@ Culled Empty Block (label) init_dist_screen::@20
Culled Empty Block (label) bsearch16u::@1
Culled Empty Block (label) bsearch16u::@18
Culled Empty Block (label) init_squares::@4
Renumbering block @13 to @1
Renumbering block @16 to @2
Renumbering block @17 to @3
Renumbering block @18 to @4
Renumbering block @15 to @1
Renumbering block @18 to @2
Renumbering block @19 to @3
Renumbering block @20 to @4
Renumbering block bsearch16u::@2 to bsearch16u::@1
Renumbering block bsearch16u::@3 to bsearch16u::@2
Renumbering block bsearch16u::@6 to bsearch16u::@3
@ -5358,6 +5365,7 @@ Uplift Scope [sqrt] 202: zp ZP_BYTE:100 [ sqrt::return#2 ] 103: zp ZP_WORD:98 [
Uplift Scope [init_squares] 25.17: zp ZP_WORD:50 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ] 22: zp ZP_BYTE:52 [ init_squares::i#2 init_squares::i#1 ] 22: zp ZP_BYTE:124 [ init_squares::$3 ] 22: zp ZP_BYTE:125 [ init_squares::$4 ] 13.93: zp ZP_WORD:48 [ init_squares::sqr#2 init_squares::sqr#1 ]
Uplift Scope [] 6.6: zp ZP_WORD:53 [ heap_head#12 heap_head#1 ] 0.09: zp ZP_WORD:59 [ SCREEN_ANGLE#0 ] 0.08: zp ZP_WORD:57 [ SCREEN_DIST#0 ] 0.03: zp ZP_WORD:122 [ SQUARES#1 ]
Uplift Scope [malloc] 2: zp ZP_WORD:55 [ malloc::size#3 ] 0.67: zp ZP_WORD:126 [ malloc::mem#0 ]
Uplift Scope [RADIX]
Uplifting [atan2_16] best 1247286 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp ZP_WORD:31 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp ZP_WORD:33 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp ZP_WORD:26 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp ZP_WORD:21 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp ZP_WORD:23 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$24 ] reg byte a [ atan2_16::$23 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp ZP_WORD:74 [ atan2_16::return#2 ] zp ZP_WORD:28 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] zp ZP_WORD:70 [ atan2_16::x#0 ] zp ZP_WORD:72 [ atan2_16::y#0 ]
Limited combination testing to 100 combinations of 144 possible.
@ -5372,6 +5380,7 @@ Uplifting [sqrt] best 1221646 combination reg byte a [ sqrt::return#2 ] zp ZP_WO
Uplifting [init_squares] best 1221446 combination zp ZP_WORD:50 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ] reg byte x [ init_squares::i#2 init_squares::i#1 ] reg byte a [ init_squares::$3 ] reg byte a [ init_squares::$4 ] zp ZP_WORD:48 [ init_squares::sqr#2 init_squares::sqr#1 ]
Uplifting [] best 1221446 combination zp ZP_WORD:53 [ heap_head#12 heap_head#1 ] zp ZP_WORD:59 [ SCREEN_ANGLE#0 ] zp ZP_WORD:57 [ SCREEN_DIST#0 ] zp ZP_WORD:122 [ SQUARES#1 ]
Uplifting [malloc] best 1221446 combination zp ZP_WORD:55 [ malloc::size#3 ] zp ZP_WORD:126 [ malloc::mem#0 ]
Uplifting [RADIX] best 1221446 combination
Attempting to uplift remaining variables inzp ZP_BYTE:82 [ init_angle_screen::$13 ]
Uplifting [init_angle_screen] best 1221046 combination reg byte a [ init_angle_screen::$13 ]
Attempting to uplift remaining variables inzp ZP_BYTE:83 [ init_angle_screen::$14 ]
@ -6950,6 +6959,10 @@ FINAL SYMBOL TABLE
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(byte) NUM_SQUARES
(const byte) NUM_SQUARES#3 NUM_SQUARES = (byte) $30
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) SCREEN_ANGLE
(void*) SCREEN_ANGLE#0 SCREEN_ANGLE zp ZP_WORD:50 0.08695652173913043
(byte*) SCREEN_DIST
@ -8352,7 +8365,7 @@ bsearch16u: {
lda #0
adc items+1
sta pivot+1
// result = (signed word)key-(signed word)*pivot
// result = (signed int)key-(signed int)*pivot
// [165] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0) -- vwsz1=vwsz2_minus__deref_pwsz3
sec
lda key

View File

@ -16,6 +16,10 @@
(const byte*) HEAP_TOP#0 HEAP_TOP = (byte*) 40960
(byte) NUM_SQUARES
(const byte) NUM_SQUARES#3 NUM_SQUARES = (byte) $30
(const byte) RADIX::BINARY BINARY = (byte) 0
(const byte) RADIX::DECIMAL DECIMAL = (byte) 2
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (byte) 3
(const byte) RADIX::OCTAL OCTAL = (byte) 1
(byte*) SCREEN_ANGLE
(void*) SCREEN_ANGLE#0 SCREEN_ANGLE zp ZP_WORD:50 0.08695652173913043
(byte*) SCREEN_DIST

View File

@ -7,11 +7,10 @@
.const OFFSET_STRUCT_POINT_Y = 1
main: {
.label SCREEN = $400
.label _16 = 3
.label ptr = 3
.label _14 = 6
.label x = 5
.label y = 6
.label idx = 2
.label ptr = 2
.label i = 4
lda #2
sta circles+OFFSET_STRUCT_CIRCLE_CENTER
lda #3
@ -25,43 +24,42 @@ main: {
lda #$f
sta circles+1*SIZEOF_STRUCT_CIRCLE
lda #0
sta idx
sta i
tax
b1:
txa
asl
stx $ff
clc
adc $ff
clc
adc #<circles
lda #<circles
sta ptr
lda #>circles
adc #0
sta ptr+1
b1:
ldy #OFFSET_STRUCT_CIRCLE_CENTER
lda (ptr),y
sta x
tya
clc
adc _16
sta _16
bcc !+
inc _16+1
!:
adc ptr
sta _14
lda #0
adc ptr+1
sta _14+1
ldy #OFFSET_STRUCT_POINT_Y
lda (_16),y
sta y
lda (_14),y
tay
lda x
ldy idx
sta SCREEN,y
iny
lda y
sta SCREEN,y
iny
sty idx
sta SCREEN,x
inx
cpx #2
tya
sta SCREEN,x
inx
lda #SIZEOF_STRUCT_CIRCLE
clc
adc ptr
sta ptr
bcc !+
inc ptr+1
!:
inc i
lda #2
cmp i
bne b1
rts
}

View File

@ -16,21 +16,20 @@ main: scope:[main] from @1
[9] *((byte*)(const struct Circle[2]) circles#0+(byte) 1*(const byte) SIZEOF_STRUCT_CIRCLE) ← (byte) $f
to:main::@1
main::@1: scope:[main] from main main::@1
[10] (byte) main::idx#3 ← phi( main/(byte) 0 main::@1/(byte) main::idx#2 )
[10] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
[11] (byte) main::$23 ← (byte) main::i#2 << (byte) 1
[12] (byte~) main::$2 ← (byte) main::$23 + (byte) main::i#2
[13] (struct Circle*) main::ptr#0 ← (const struct Circle[2]) circles#0 + (byte~) main::$2
[14] (byte) main::x#0 ← *((byte*)(struct Point*)(struct Circle*) main::ptr#0 + (const byte) OFFSET_STRUCT_CIRCLE_CENTER)
[15] (struct Point*) main::$16 ← (struct Point*)(struct Circle*) main::ptr#0 + (const byte) OFFSET_STRUCT_CIRCLE_CENTER
[16] (byte) main::y#0 ← *((byte*)(struct Point*) main::$16 + (const byte) OFFSET_STRUCT_POINT_Y)
[17] *((const byte*) main::SCREEN#0 + (byte) main::idx#3) ← (byte) main::x#0
[18] (byte) main::idx#1 ← ++ (byte) main::idx#3
[19] *((const byte*) main::SCREEN#0 + (byte) main::idx#1) ← (byte) main::y#0
[20] (byte) main::idx#2 ← ++ (byte) main::idx#1
[21] (byte) main::i#1 ← ++ (byte) main::i#2
[22] if((byte) main::i#1!=(byte) 2) goto main::@1
[10] (byte) main::idx#3 ← phi( main/(byte) 0 main::@1/(byte) main::idx#2 )
[10] (struct Circle*) main::ptr#2 ← phi( main/(const struct Circle[2]) circles#0 main::@1/(struct Circle*) main::ptr#1 )
[11] (byte) main::x#0 ← *((byte*)(struct Point*)(struct Circle*) main::ptr#2 + (const byte) OFFSET_STRUCT_CIRCLE_CENTER)
[12] (struct Point*) main::$14 ← (struct Point*)(struct Circle*) main::ptr#2 + (const byte) OFFSET_STRUCT_CIRCLE_CENTER
[13] (byte) main::y#0 ← *((byte*)(struct Point*) main::$14 + (const byte) OFFSET_STRUCT_POINT_Y)
[14] *((const byte*) main::SCREEN#0 + (byte) main::idx#3) ← (byte) main::x#0
[15] (byte) main::idx#1 ← ++ (byte) main::idx#3
[16] *((const byte*) main::SCREEN#0 + (byte) main::idx#1) ← (byte) main::y#0
[17] (byte) main::idx#2 ← ++ (byte) main::idx#1
[18] (struct Circle*) main::ptr#1 ← (struct Circle*) main::ptr#2 + (const byte) SIZEOF_STRUCT_CIRCLE
[19] (byte) main::i#1 ← ++ (byte) main::i#2
[20] if((byte) main::i#1!=(byte) 2) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
[23] return
[21] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -11,32 +11,30 @@
(struct Circle[2]) circles
(const struct Circle[2]) circles#0 circles = { fill( 2, 0) }
(void()) main()
(struct Point*) main::$16 $16 zp ZP_WORD:3 11.0
(byte~) main::$2 reg byte a 22.0
(byte) main::$23 reg byte a 22.0
(struct Point*) main::$14 $14 zp ZP_WORD:6 11.0
(label) main::@1
(label) main::@return
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 4.0
(byte) main::i#1 i zp ZP_BYTE:4 16.5
(byte) main::i#2 i zp ZP_BYTE:4 2.4444444444444446
(byte) main::idx
(byte) main::idx#1 reg byte y 16.5
(byte) main::idx#2 idx zp ZP_BYTE:2 7.333333333333333
(byte) main::idx#3 idx zp ZP_BYTE:2 4.125
(byte) main::idx#1 reg byte x 16.5
(byte) main::idx#2 reg byte x 5.5
(byte) main::idx#3 reg byte x 6.6000000000000005
(struct Circle*) main::ptr
(struct Circle*) main::ptr#0 ptr zp ZP_WORD:3 5.5
(struct Circle*) main::ptr#1 ptr zp ZP_WORD:2 7.333333333333333
(struct Circle*) main::ptr#2 ptr zp ZP_WORD:2 2.75
(byte) main::x
(byte) main::x#0 x zp ZP_BYTE:5 7.333333333333333
(byte) main::y
(byte) main::y#0 y zp ZP_BYTE:6 7.333333333333333
(byte) main::y#0 reg byte y 7.333333333333333
reg byte x [ main::i#2 main::i#1 ]
zp ZP_BYTE:2 [ main::idx#3 main::idx#2 ]
reg byte a [ main::$23 ]
reg byte a [ main::$2 ]
zp ZP_WORD:3 [ main::ptr#0 main::$16 ]
zp ZP_WORD:2 [ main::ptr#2 main::ptr#1 ]
reg byte x [ main::idx#3 main::idx#2 ]
zp ZP_BYTE:4 [ main::i#2 main::i#1 ]
zp ZP_BYTE:5 [ main::x#0 ]
zp ZP_BYTE:6 [ main::y#0 ]
reg byte y [ main::idx#1 ]
zp ZP_WORD:6 [ main::$14 ]
reg byte y [ main::y#0 ]
reg byte x [ main::idx#1 ]