Now optimizing *(ptr+n) into ptr[n] when possible.

This commit is contained in:
jespergravgaard 2019-04-20 22:12:56 +02:00
parent d6427d58df
commit fc75878f9d
141 changed files with 13687 additions and 12272 deletions

View File

@ -0,0 +1,6 @@
ldy #0
lda {z2}
sta ({z1}),y
iny
lda {z2}+1
sta ({z1}),y

View File

@ -0,0 +1,5 @@
ldy #{c1}
sta ({z1}),y
lda #0
iny
sta ({z1}),y

View File

@ -0,0 +1,6 @@
ldy #{c1}
lda {z2}
sta ({z1}),y
iny
lda {z2}+1
sta ({z1}),y

View File

@ -0,0 +1,6 @@
ldy #0
lda ({z1}),y
sta {c1},x
iny
lda ({z1}),y
sta {c1}+1,x

View File

@ -0,0 +1,5 @@
lda ({z1}),y
sta {c1},y
iny
lda ({z1}),y
sta {c1}+1,y

View File

@ -0,0 +1,5 @@
ldy #{c1}
sta ({z1}),y
lda #0
iny
sta ({z1}),y

View File

@ -0,0 +1,5 @@
ldy #{c1}
sta ({z1}),y
lda #0
iny
sta ({z1}),y

View File

@ -0,0 +1,6 @@
ldy #{c1}
lda {z2}
sta ({z1}),y
iny
lda {z2}+1
sta ({z1}),y

View File

@ -0,0 +1,6 @@
ldy #0
lda ({z2}),y
sta {z1}
iny
lda ({z2}),y
sta {z1}+1

View File

@ -0,0 +1,5 @@
lda ({z2}),y
sta {z1}
iny
lda ({z2}),y
sta {z1}+1

View File

@ -0,0 +1,5 @@
lda ({z2}),y
sta {z1}
iny
lda ({z2}),y
sta {z1}+1

View File

@ -179,7 +179,7 @@ public class Compiler {
new Pass1AssertUsedVars(program).execute();
new Pass1ProcedureInline(program).execute();
new Pass1EliminateUncalledProcedures(program).execute();
new PassNEliminateUnusedVars(program).execute();
new PassNEliminateUnusedVars(program, false).execute();
new Pass1ExtractInlineStrings(program).execute();
new Pass1EliminateEmptyBlocks(program).execute();
@ -246,7 +246,7 @@ public class Compiler {
optimizations.add(new Pass2ConstantStringConsolidation(program));
optimizations.add(new Pass2FixInlineConstructors(program));
optimizations.add(new Pass2TypeInference(program));
optimizations.add(new PassNEliminateUnusedVars(program));
optimizations.add(new PassNEliminateUnusedVars(program, true));
optimizations.add(new Pass2EliminateRedundantCasts(program));
optimizations.add(new Pass2NopCastElimination(program));
optimizations.add(new Pass2EliminateUnusedBlocks(program));
@ -255,6 +255,7 @@ public class Compiler {
optimizations.add(new Pass2ConstantCallPointerIdentification(program));
optimizations.add(new Pass2MultiplyToShiftRewriting(program));
optimizations.add(new Pass2SizeOfSimplification(program));
optimizations.add(new Pass2InlineDerefIdx(program));
pass2Execute(optimizations);
}

View File

@ -0,0 +1,93 @@
package dk.camelot64.kickc.passes;
import dk.camelot64.kickc.model.CompileError;
import dk.camelot64.kickc.model.Program;
import dk.camelot64.kickc.model.iterator.ProgramValueIterator;
import dk.camelot64.kickc.model.operators.OperatorCastPtr;
import dk.camelot64.kickc.model.operators.Operators;
import dk.camelot64.kickc.model.statements.StatementAssignment;
import dk.camelot64.kickc.model.statements.StatementLValue;
import dk.camelot64.kickc.model.types.SymbolType;
import dk.camelot64.kickc.model.types.SymbolTypeInference;
import dk.camelot64.kickc.model.types.SymbolTypePointer;
import dk.camelot64.kickc.model.values.*;
import java.util.concurrent.atomic.AtomicBoolean;
/** Identify derefs of pointers that are defined as pointer + value - and inline them as derefidx instead */
public class Pass2InlineDerefIdx extends Pass2SsaOptimization {
public Pass2InlineDerefIdx(Program program) {
super(program);
}
@Override
public boolean step() {
AtomicBoolean optimized = new AtomicBoolean(false);
ProgramValueIterator.execute(getGraph(), (programValue, currentStmt, stmtIt, currentBlock) -> {
if(programValue.get() instanceof PointerDereferenceSimple) {
PointerDereferenceSimple pointerDereferenceSimple = (PointerDereferenceSimple) programValue.get();
RValue inlined = attemptInlineDeref(pointerDereferenceSimple.getPointer());
if(inlined!=null) {
getLog().append("Converting *(pointer+n) to pointer[n] "+currentStmt.toString(getProgram(), false) + " -- " + inlined);
programValue.set(inlined);
optimized.set(true);
}
}
});
return optimized.get();
}
/**
* Attempt to inline a pointer reference to an indexed pointer reference
* by examining the definition of the pointer to see if it is ptr+value
* @param pointer the pointer
* @return The indexed pointer dereference if the inlining is possible
*/
public RValue attemptInlineDeref(RValue pointer) {
if(pointer instanceof VariableRef) {
VariableRef derefVar = (VariableRef) pointer;
StatementLValue derefVarDefined = getGraph().getAssignment(derefVar);
if(derefVarDefined instanceof StatementAssignment) {
StatementAssignment derefAssignment = (StatementAssignment) derefVarDefined;
return attemptInlineDeref(derefAssignment);
}
} else if(pointer instanceof CastValue) {
CastValue castValue = (CastValue) pointer;
RValue inlined = attemptInlineDeref(castValue.getValue());
if(inlined!=null) {
if(inlined instanceof PointerDereferenceIndexed) {
return new
PointerDereferenceIndexed(
new CastValue(castValue.getToType(), ((PointerDereferenceIndexed) inlined).getPointer()),
((PointerDereferenceIndexed) inlined).getIndex());
} else {
throw new CompileError("Not implemented!");
}
}
}
return null;
}
public RValue attemptInlineDeref(StatementAssignment derefAssignment) {
if(Operators.PLUS.equals(derefAssignment.getOperator())) {
SymbolType derefLeftType = SymbolTypeInference.inferType(getScope(), derefAssignment.getrValue1());
if(derefLeftType instanceof SymbolTypePointer) {
SymbolType derefIndexType = SymbolTypeInference.inferType(getScope(), derefAssignment.getrValue2());
if(derefIndexType.getSizeBytes()==1) {
// Only inline byte-based indices
return new PointerDereferenceIndexed(derefAssignment.getrValue1(), derefAssignment.getrValue2());
}
}
} else if(derefAssignment.getOperator()==null) {
return attemptInlineDeref(derefAssignment.getrValue2());
} else if(derefAssignment.getOperator() instanceof OperatorCastPtr) {
throw new CompileError("Not implemented!");
//return attemptInlineDeref(derefAssignment.getrValue2());
}
return null;
}
}

View File

@ -59,6 +59,9 @@ public class Pass2NopCastElimination extends Pass2SsaOptimization {
} else if(rValType instanceof SymbolTypePointer && Operators.CAST_WORD.equals(assignment.getOperator())) {
isNopCast = true;
toType = SymbolType.WORD;
} else if(rValType instanceof SymbolTypePointer && assignment.getOperator() instanceof OperatorCastPtr) {
isNopCast = true;
toType = new SymbolTypePointer(((OperatorCastPtr) assignment.getOperator()).getElementType());
}
if(isNopCast) {
getLog().append("Eliminating Noop Cast "+assignment.toString(getProgram(), false));

View File

@ -17,8 +17,11 @@ import java.util.ListIterator;
*/
public class PassNEliminateUnusedVars extends Pass2SsaOptimization {
public PassNEliminateUnusedVars(Program program) {
private boolean pass2;
public PassNEliminateUnusedVars(Program program, boolean pass2) {
super(program);
this.pass2 = pass2;
}
@Override
@ -37,7 +40,7 @@ public class PassNEliminateUnusedVars extends Pass2SsaOptimization {
if(lValue instanceof VariableRef && referenceInfos.isUnused((VariableRef) lValue) && !Pass2ConstantIdentification.isAddressOfUsed((VariableRef) lValue, getProgram())) {
Variable variable = getScope().getVariable((VariableRef) lValue);
if(variable==null || !variable.isDeclaredVolatile()) {
if(getLog().isVerbosePass1CreateSsa() || getLog().isVerboseSSAOptimize()) {
if(pass2 || getLog().isVerbosePass1CreateSsa()) {
getLog().append("Eliminating unused variable " + lValue.toString(getProgram()) + " and assignment " + assignment.toString(getProgram(), false));
}
stmtIt.remove();
@ -51,7 +54,7 @@ public class PassNEliminateUnusedVars extends Pass2SsaOptimization {
StatementCall call = (StatementCall) statement;
LValue lValue = call.getlValue();
if(lValue instanceof VariableRef && referenceInfos.isUnused((VariableRef) lValue) && !Pass2ConstantIdentification.isAddressOfUsed((VariableRef) lValue, getProgram())) {
if(getLog().isVerbosePass1CreateSsa() || getLog().isVerboseSSAOptimize()) {
if(pass2 || getLog().isVerbosePass1CreateSsa()) {
getLog().append("Eliminating unused variable - keeping the call " + lValue.toString(getProgram()));
}
Variable variable = getScope().getVariable((VariableRef) lValue);
@ -65,7 +68,7 @@ public class PassNEliminateUnusedVars extends Pass2SsaOptimization {
StatementCallPointer call = (StatementCallPointer) statement;
LValue lValue = call.getlValue();
if(lValue instanceof VariableRef && referenceInfos.isUnused((VariableRef) lValue) && !Pass2ConstantIdentification.isAddressOfUsed((VariableRef) lValue, getProgram())) {
if(getLog().isVerbosePass1CreateSsa() || getLog().isVerboseSSAOptimize()) {
if(pass2 || getLog().isVerbosePass1CreateSsa()) {
getLog().append("Eliminating unused variable - keeping the call " + lValue.toString(getProgram()));
}
Variable variable = getScope().getVariable((VariableRef) lValue);
@ -82,7 +85,7 @@ public class PassNEliminateUnusedVars extends Pass2SsaOptimization {
StatementPhiBlock.PhiVariable phiVariable = phiVarIt.next();
VariableRef variableRef = phiVariable.getVariable();
if(referenceInfos.isUnused(variableRef) && !Pass2ConstantIdentification.isAddressOfUsed(variableRef, getProgram())) {
if(getLog().isVerbosePass1CreateSsa() || getLog().isVerboseSSAOptimize()) {
if(pass2 || getLog().isVerbosePass1CreateSsa()) {
getLog().append("Eliminating unused variable - keeping the phi block " + variableRef.toString(getProgram()));
}
Variable variable = getScope().getVariable(variableRef);
@ -100,7 +103,7 @@ public class PassNEliminateUnusedVars extends Pass2SsaOptimization {
Collection<ConstantVar> allConstants = getScope().getAllConstants(true);
for(ConstantVar constant : allConstants) {
if(referenceInfos.isUnused(constant.getRef())) {
if(getLog().isVerbosePass1CreateSsa() || getLog().isVerboseSSAOptimize()) {
if(pass2 || getLog().isVerbosePass1CreateSsa()) {
getLog().append("Eliminating unused constant " + constant.toString(getProgram()));
}
constant.getScope().remove(constant);

View File

@ -37,6 +37,16 @@ public class TestPrograms {
// compileAndCompare("pointer-cast-3");
//}
@Test
public void testDerefToDerefIdx2() throws IOException, URISyntaxException {
compileAndCompare("deref-to-derefidx-2");
}
@Test
public void testDerefToDerefIdx() throws IOException, URISyntaxException {
compileAndCompare("deref-to-derefidx");
}
@Test
public void testSemiStruct2() throws IOException, URISyntaxException {
compileAndCompare("semi-struct-2");
@ -47,6 +57,11 @@ public class TestPrograms {
compileAndCompare("semi-struct-1");
}
@Test
public void testStrip() throws IOException, URISyntaxException {
compileAndCompare("strip");
}
@Test
public void testReserveZpGlobal() throws IOException, URISyntaxException {
compileAndCompare("reserve-zp-global");

View File

@ -0,0 +1,16 @@
// Tests optimizing derefs of *(ptr+b) to ptr[b - even when a noop-cast is needed
byte[] msg1 = { 'a', 'b', 'c', 'd' };
byte[] msg2 = { '1', '2', '3', '4' };
void main() {
print(msg1);
print(msg2);
}
const word* SCREEN = $0400;
byte screen_idx=0;
void print(byte* m) {
SCREEN[screen_idx++] = *(word*)(m+2);
}

View File

@ -0,0 +1,16 @@
// Tests optimizing derefs of *(ptr+b) to ptr[b]
byte[] msg1 = { 'a', 'b', 'c', 'd' };
byte[] msg2 = { '1', '2', '3', '4' };
void main() {
print(msg1);
print(msg2);
}
const byte* SCREEN = $0400;
byte idx=0;
void print(byte* m) {
SCREEN[idx++] = *(m+2);
}

View File

@ -102,7 +102,7 @@ void main() {
byte* entry1 = fileEntry(1);
byte* entry2 = fileEntry(2);
initEntry(entry1,$00);
initEntry(entry2,$80);
initEntry(entry2,$11);
print_cls();
print_str("** entry 1 **");
print_ln();
@ -125,19 +125,19 @@ void main() {
// Set all values in the passed struct
// Sets the values to n, n+1, n... to help test that everything works as intended
void initEntry(byte* entry, byte n) {
*entryBufDisk(entry) = n+1;
*entryBufEdit(entry) = n+2;
*entryTsLen(entry) = n+3;
*entryTsOrder(entry) = n+4;
*entryTLastLink(entry) = n+5;
*entrySLastLink(entry) = n+6;
*entryBFlag(entry) = n+7;
*entryBError(entry) = n+8;
*entryUCross(entry) = n+9;
*entryBAddrLo(entry) = n+10;
*entryBAddrHi(entry) = n+11;
*entryTHi(entry) = n+12;
*entryTLo(entry) = n+13;
*entryBufDisk(entry) = $1111+n;
*entryBufEdit(entry) = $2222+n;
*entryTsLen(entry) = $3333+n;
*entryTsOrder(entry) = $4444+n;
*entryTLastLink(entry) = $55+n;
*entrySLastLink(entry) = $66+n;
*entryBFlag(entry) = $77+n;
*entryBError(entry) = $88+n;
*entryUCross(entry) = $9999+n;
*entryBAddrLo(entry) = $aa+n;
*entryBAddrHi(entry) = $bb+n;
*entryTHi(entry) = $cc+n;
*entryTLo(entry) = $dd+n;
}
// Print the contents of a file entry

26
src/test/kc/strip.kc Normal file
View File

@ -0,0 +1,26 @@
// Tests of strip() function from https://news.ycombinator.com/item?id=12080871
unsigned char[] msg1 = "hello world!";
unsigned char[] msg2 = "goodbye blue sky!";
void main() {
strip(msg1, ' ');
print(msg1);
strip(msg2, 'y');
print(msg2);
}
void strip(unsigned char *p, unsigned char c) {
unsigned char *dest=p;
do {
if(*p!=c) *dest++=*p;
} while(*p++!=0);
}
unsigned char* screen = $400;
void print(unsigned char* msg) {
do {
*screen++ = *msg++;
} while(*msg!=0);
}

View File

@ -60,6 +60,7 @@ Consolidated array index constant in *(main::screen#0+$29)
Consolidated array index constant in *(main::screen#0+2)
Consolidated array index constant in *(main::screen#0+$2a)
Successful SSA optimization Pass2ConstantAdditionElimination
Eliminating unused constant (const byte) main::a#0
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) main::a#1
Inlining constant with var siblings (const byte) main::a#3

View File

@ -375,6 +375,7 @@ Constant (const byte) test::i#10 = main::i#10
Constant (const byte) test::a#10 = main::a#10
Constant (const byte) main::i#11 = ++main::i#10
Successful SSA optimization Pass2ConstantIdentification
Eliminating unused constant (const byte) main::i#11
Successful SSA optimization PassNEliminateUnusedVars
Culled Empty Block (label) main::@11
Successful SSA optimization Pass2CullEmptyBlocks

View File

@ -206,7 +206,20 @@ if() condition always true - replacing block destination [21] if((const bool) bo
if() condition always true - replacing block destination [22] if((const bool) bool_const_vars::$6) goto bool_const_vars::@5
if() condition always false - eliminating [23] if((const bool) bool_const_inline::$3) goto bool_const_inline::@1
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const bool) bool_const_if::b#0
Eliminating unused constant (const bool) bool_const_vars::$0
Eliminating unused constant (const bool) bool_const_vars::$2
Eliminating unused constant (const bool) bool_const_vars::$4
Eliminating unused constant (const bool) bool_const_vars::$6
Eliminating unused constant (const bool) bool_const_inline::$0
Eliminating unused constant (const bool) bool_const_inline::$2
Eliminating unused constant (const bool) bool_const_inline::$3
Eliminating unused constant (const bool) bool_const_inline::$7
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const byte) bool_const_vars::a#0
Eliminating unused constant (const signed byte/signed word/signed dword) bool_const_vars::$5
Eliminating unused constant (const byte) bool_const_inline::a#0
Eliminating unused constant (const signed byte/signed word/signed dword) bool_const_inline::$1
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block bool_const_if::@3
Removing unused block bool_const_vars::@1

View File

@ -748,6 +748,7 @@ Constant (const byte/word/dword) main::$24 = main::$19|main::$23
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [31] if(true) goto main::@4
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) gfx_init_plane_charset8::gfxbCpuBank#1
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -1162,42 +1162,32 @@ print_str_at: {
}
// Render all form values from the form_fields_val array
form_render_values: {
.label field = 3
.label idx = 2
lda #0
sta idx
ldx #0
b1:
ldy idx
jsr form_field_ptr
ldx idx
ldy form_fields_val,x
lda print_hextab,y
ldy #0
sta (field),y
inc idx
lda idx
cmp #form_fields_cnt
ldy form_field_ptr.x
sta (form_field_ptr._2),y
inx
cpx #form_fields_cnt
bcc b1
rts
}
// Get the screen address of a form field
// field_idx is the index of the field to get the screen address for
// form_field_ptr(byte register(Y) field_idx)
// form_field_ptr(byte register(X) field_idx)
form_field_ptr: {
.label return = 3
.label x = $13
.label _2 = 3
ldx form_fields_y,y
lda form_line_hi,x
lda form_fields_y,x
tay
lda form_line_hi,y
sta _2+1
lda form_line_lo,x
lda form_line_lo,y
sta _2
lda form_fields_x,y
clc
adc return
sta return
bcc !+
inc return+1
!:
lda form_fields_x,x
sta x
rts
}
// Apply a form value preset to the form values
@ -1306,8 +1296,7 @@ apply_preset: {
// Reads keyboard and allows the user to navigate and change the fields of the form
// Returns 0 if space is not pressed, non-0 if space is pressed
form_control: {
.label field = 3
ldy form_field_idx
ldx form_field_idx
jsr form_field_ptr
dec form_cursor_count
lda form_cursor_count
@ -1326,19 +1315,19 @@ form_control: {
jmp b2
!b2:
lda #$7f
ldy #0
and (field),y
sta (field),y
ldy form_field_ptr.x
and (form_field_ptr._2),y
sta (form_field_ptr._2),y
b3:
jsr keyboard_event_scan
jsr keyboard_event_get
cmp #KEY_CRSR_DOWN
bne b4
lda #$7f
ldy #0
and (field),y
ldy form_field_ptr.x
and (form_field_ptr._2),y
// Unblink the cursor
sta (field),y
sta (form_field_ptr._2),y
txa
and #KEY_MODIFIER_SHIFT
cmp #0
@ -1382,8 +1371,8 @@ form_control: {
ldx form_field_idx
ldy form_fields_val,x
lda print_hextab,y
ldy #0
sta (field),y
ldy form_field_ptr.x
sta (form_field_ptr._2),y
b6:
ldx #0
rts
@ -1405,9 +1394,9 @@ form_control: {
rts
b2:
lda #$80
ldy #0
ora (field),y
sta (field),y
ldy form_field_ptr.x
ora (form_field_ptr._2),y
sta (form_field_ptr._2),y
jmp b3
}
// Set the screen to use for the form.
@ -1570,7 +1559,7 @@ gfx_init_plane_full: {
// Initialize 320*200 1bpp pixel ($2000) plane with identical bytes
// gfx_init_plane_fill(dword zeropage(9) plane_addr, byte zeropage(2) fill)
gfx_init_plane_fill: {
.label _0 = $13
.label _0 = $14
.label _1 = 3
.label _4 = 3
.label _5 = 3

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -527,7 +527,6 @@
(label) form_control::@9
(label) form_control::@return
(byte*) form_control::field
(byte*) form_control::field#0 field zp ZP_WORD:3 0.5925925925925926
(byte) form_control::key_event
(byte) form_control::key_event#0 reg byte a 2.6666666666666665
(byte) form_control::return
@ -555,34 +554,31 @@
(signed byte) form_cursor_count#1 form_cursor_count zp ZP_BYTE:13 0.3333333333333333
(signed byte) form_cursor_count#15 form_cursor_count zp ZP_BYTE:13 0.4
(signed byte) form_cursor_count#16 form_cursor_count zp ZP_BYTE:13 65.82352941176472
(signed byte) form_cursor_count#21 form_cursor_count zp ZP_BYTE:13 157.99999999999997
(signed byte) form_cursor_count#21 form_cursor_count zp ZP_BYTE:13 221.2
(signed byte) form_cursor_count#5 form_cursor_count zp ZP_BYTE:13 2.0
(byte*) form_dtv_palet
(const byte*) form_dtv_palet#0 form_dtv_palet = (const byte[]) form_fields_val#0+(byte/signed byte/word/signed word/dword/signed dword) $1b
(byte) form_field_idx
(byte) form_field_idx#1 form_field_idx zp ZP_BYTE:14 0.3333333333333333
(byte) form_field_idx#18 form_field_idx zp ZP_BYTE:14 65.94117647058826
(byte) form_field_idx#28 form_field_idx zp ZP_BYTE:14 29.17948717948718
(byte) form_field_idx#28 form_field_idx zp ZP_BYTE:14 30.75675675675673
(byte) form_field_idx#31 form_field_idx zp ZP_BYTE:14 6.0
(byte) form_field_idx#44 form_field_idx zp ZP_BYTE:14 2.0
(byte) form_field_idx#45 form_field_idx zp ZP_BYTE:14 2.0
(byte*()) form_field_ptr((byte) form_field_ptr::field_idx)
(word~) form_field_ptr::$2 $2 zp ZP_WORD:3 1.0
(word~) form_field_ptr::$2 $2 zp ZP_WORD:3 0.06451612903225806
(label) form_field_ptr::@return
(byte*) form_field_ptr::field
(byte) form_field_ptr::field_idx
(byte) form_field_ptr::field_idx#0 reg byte y 2002.0
(byte) form_field_ptr::field_idx#1 reg byte y 4.0
(byte) form_field_ptr::field_idx#2 reg byte y 335.66666666666674
(byte) form_field_ptr::field_idx#0 reg byte x 2002.0
(byte) form_field_ptr::field_idx#1 reg byte x 4.0
(byte) form_field_ptr::field_idx#2 reg byte x 335.66666666666674
(byte*) form_field_ptr::line
(byte*) form_field_ptr::return
(byte*) form_field_ptr::return#0 return zp ZP_WORD:3 251.25
(byte*) form_field_ptr::return#2 return zp ZP_WORD:3 2002.0
(byte*) form_field_ptr::return#3 return zp ZP_WORD:3 4.0
(byte) form_field_ptr::x
(byte) form_field_ptr::x#0 reg byte a 4.0
(byte) form_field_ptr::x#0 x zp ZP_BYTE:19 33.90000000000003
(byte) form_field_ptr::y
(byte) form_field_ptr::y#0 reg byte x 6.0
(byte) form_field_ptr::y#0 reg byte a 6.0
(byte) form_fields_cnt
(const byte) form_fields_cnt#0 form_fields_cnt = (byte/signed byte/word/signed word/dword/signed dword) $24
(byte[]) form_fields_max
@ -632,10 +628,9 @@
(label) form_render_values::@2
(label) form_render_values::@return
(byte*) form_render_values::field
(byte*) form_render_values::field#0 field zp ZP_WORD:3 2002.0
(byte) form_render_values::idx
(byte) form_render_values::idx#1 idx zp ZP_BYTE:2 1501.5
(byte) form_render_values::idx#2 idx zp ZP_BYTE:2 667.3333333333334
(byte) form_render_values::idx#1 reg byte x 1501.5
(byte) form_render_values::idx#2 reg byte x 1001.0
(void()) form_set_screen((byte*) form_set_screen::screen)
(byte~) form_set_screen::$0 reg byte a 202.0
(byte~) form_set_screen::$1 reg byte a 202.0
@ -829,7 +824,7 @@
(byte) gfx_init_plane_charset8::gfxbCpuBank
(const byte) gfx_init_plane_charset8::gfxbCpuBank#0 gfxbCpuBank = ((byte))(const dword) PLANE_CHARSET8#0/(word/signed word/dword/signed dword) $4000
(void()) gfx_init_plane_fill((dword) gfx_init_plane_fill::plane_addr , (byte) gfx_init_plane_fill::fill)
(dword~) gfx_init_plane_fill::$0 $0 zp ZP_DWORD:19 4.0
(dword~) gfx_init_plane_fill::$0 $0 zp ZP_DWORD:20 4.0
(word~) gfx_init_plane_fill::$1 $1 zp ZP_WORD:3 4.0
(word~) gfx_init_plane_fill::$4 $4 zp ZP_WORD:3 4.0
(word~) gfx_init_plane_fill::$5 $5 zp ZP_WORD:3 4.0
@ -1240,7 +1235,7 @@
(byte) keyboard_events_size#24 keyboard_events_size zp ZP_BYTE:8 6.6923076923076925
(byte) keyboard_events_size#27 keyboard_events_size zp ZP_BYTE:8 0.3333333333333333
(byte) keyboard_events_size#4 keyboard_events_size zp ZP_BYTE:8 3.0
(byte) keyboard_events_size#47 keyboard_events_size zp ZP_BYTE:8 65.05882352941177
(byte) keyboard_events_size#47 keyboard_events_size zp ZP_BYTE:8 73.73333333333335
(void()) keyboard_init()
(label) keyboard_init::@return
(byte[8]) keyboard_matrix_col_bitmask
@ -1381,8 +1376,8 @@
reg byte x [ gfx_mode::dtv_control#12 gfx_mode::dtv_control#6 gfx_mode::dtv_control#13 gfx_mode::dtv_control#5 gfx_mode::dtv_control#11 gfx_mode::dtv_control#4 gfx_mode::dtv_control#10 gfx_mode::dtv_control#3 gfx_mode::dtv_control#15 gfx_mode::dtv_control#14 gfx_mode::dtv_control#2 ]
reg byte x [ gfx_mode::vic_control#4 gfx_mode::vic_control#2 gfx_mode::vic_control#5 ]
reg byte a [ gfx_mode::vic_control2#2 ]
zp ZP_BYTE:2 [ gfx_mode::cy#4 gfx_mode::cy#1 keyboard_event_scan::row#2 keyboard_event_scan::row#1 keyboard_event_pressed::keycode#4 form_render_values::idx#2 form_render_values::idx#1 gfx_init_plane_fill::fill#6 gfx_init_plane_horisontal2::ay#4 gfx_init_plane_horisontal2::ay#1 gfx_init_plane_vertical::by#4 gfx_init_plane_vertical::by#1 gfx_init_plane_horisontal::ay#4 gfx_init_plane_horisontal::ay#1 gfx_init_plane_charset8::ch#8 gfx_init_plane_charset8::ch#1 gfx_init_plane_8bppchunky::y#6 gfx_init_plane_8bppchunky::y#1 gfx_init_vic_bitmap::l#2 gfx_init_vic_bitmap::l#1 bitmap_clear::y#4 bitmap_clear::y#1 gfx_init_charset::c#4 gfx_init_charset::c#1 gfx_init_screen4::cy#4 gfx_init_screen4::cy#1 gfx_init_screen3::cy#4 gfx_init_screen3::cy#1 gfx_init_screen2::cy#4 gfx_init_screen2::cy#1 gfx_init_screen1::cy#4 gfx_init_screen1::cy#1 gfx_init_screen0::cy#4 gfx_init_screen0::cy#1 gfx_mode::$56 bitmap_init::$6 ]
zp ZP_WORD:3 [ gfx_mode::vic_colors#2 gfx_mode::vic_colors#3 gfx_mode::vic_colors#1 gfx_mode::vic_colors#0 get_vic_screen::return#11 get_vic_screen::return#5 get_vic_screen::return#10 gfx_mode::$52 gfx_mode::$54 gfx_mode::$55 get_vic_charset::return#2 get_vic_charset::return#4 gfx_mode::$57 gfx_mode::$59 render_preset_name::name#13 print_str_at::str#2 print_str_at::str#1 print_str_at::str#0 apply_preset::preset#14 form_set_screen::line#2 form_set_screen::line#1 print_str_lines::str#4 print_str_lines::str#3 print_str_lines::str#5 print_str_lines::str#0 print_cls::sc#2 print_cls::sc#0 print_cls::sc#1 gfx_init_plane_fill::gfxb#2 gfx_init_plane_fill::gfxb#3 gfx_init_plane_fill::gfxb#1 gfx_init_plane_fill::gfxb#6 gfx_init_plane_fill::$6 gfx_init_plane_fill::$4 gfx_init_plane_fill::$5 gfx_init_plane_horisontal2::gfxa#2 gfx_init_plane_horisontal2::gfxa#3 gfx_init_plane_horisontal2::gfxa#1 gfx_init_plane_vertical::gfxb#2 gfx_init_plane_vertical::gfxb#3 gfx_init_plane_vertical::gfxb#1 gfx_init_plane_horisontal::gfxa#3 gfx_init_plane_horisontal::gfxa#6 gfx_init_plane_horisontal::gfxa#7 gfx_init_plane_horisontal::gfxa#1 gfx_init_plane_horisontal::gfxa#2 gfx_init_plane_charset8::chargen#2 gfx_init_plane_charset8::chargen#3 gfx_init_plane_charset8::chargen#1 gfx_init_plane_8bppchunky::x#2 gfx_init_plane_8bppchunky::x#1 bitmap_clear::bitmap#2 bitmap_clear::bitmap#3 bitmap_clear::bitmap#5 bitmap_clear::bitmap#1 bitmap_clear::$3 bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 gfx_init_charset::chargen#2 gfx_init_charset::chargen#3 gfx_init_charset::chargen#1 gfx_init_screen4::ch#2 gfx_init_screen4::ch#3 gfx_init_screen4::ch#1 gfx_init_screen3::ch#2 gfx_init_screen3::ch#3 gfx_init_screen3::ch#1 gfx_init_screen2::ch#2 gfx_init_screen2::ch#3 gfx_init_screen2::ch#1 gfx_init_screen1::ch#2 gfx_init_screen1::ch#3 gfx_init_screen1::ch#1 gfx_init_screen0::ch#2 gfx_init_screen0::ch#3 gfx_init_screen0::ch#1 gfx_mode::$24 gfx_mode::$26 gfx_mode::$28 gfx_mode::$38 gfx_mode::$40 gfx_mode::$42 form_field_ptr::return#2 form_render_values::field#0 form_field_ptr::return#0 form_field_ptr::$2 form_field_ptr::return#3 form_control::field#0 gfx_init_plane_fill::$1 bitmap_plot::plotter_x#0 bitmap_plot::$0 ]
zp ZP_BYTE:2 [ gfx_mode::cy#4 gfx_mode::cy#1 keyboard_event_scan::row#2 keyboard_event_scan::row#1 keyboard_event_pressed::keycode#4 gfx_init_plane_fill::fill#6 gfx_init_plane_horisontal2::ay#4 gfx_init_plane_horisontal2::ay#1 gfx_init_plane_vertical::by#4 gfx_init_plane_vertical::by#1 gfx_init_plane_horisontal::ay#4 gfx_init_plane_horisontal::ay#1 gfx_init_plane_charset8::ch#8 gfx_init_plane_charset8::ch#1 gfx_init_plane_8bppchunky::y#6 gfx_init_plane_8bppchunky::y#1 gfx_init_vic_bitmap::l#2 gfx_init_vic_bitmap::l#1 bitmap_clear::y#4 bitmap_clear::y#1 gfx_init_charset::c#4 gfx_init_charset::c#1 gfx_init_screen4::cy#4 gfx_init_screen4::cy#1 gfx_init_screen3::cy#4 gfx_init_screen3::cy#1 gfx_init_screen2::cy#4 gfx_init_screen2::cy#1 gfx_init_screen1::cy#4 gfx_init_screen1::cy#1 gfx_init_screen0::cy#4 gfx_init_screen0::cy#1 gfx_mode::$56 bitmap_init::$6 ]
zp ZP_WORD:3 [ gfx_mode::vic_colors#2 gfx_mode::vic_colors#3 gfx_mode::vic_colors#1 gfx_mode::vic_colors#0 get_vic_screen::return#11 get_vic_screen::return#5 get_vic_screen::return#10 gfx_mode::$52 gfx_mode::$54 gfx_mode::$55 get_vic_charset::return#2 get_vic_charset::return#4 gfx_mode::$57 gfx_mode::$59 render_preset_name::name#13 print_str_at::str#2 print_str_at::str#1 print_str_at::str#0 apply_preset::preset#14 form_set_screen::line#2 form_set_screen::line#1 print_str_lines::str#4 print_str_lines::str#3 print_str_lines::str#5 print_str_lines::str#0 print_cls::sc#2 print_cls::sc#0 print_cls::sc#1 gfx_init_plane_fill::gfxb#2 gfx_init_plane_fill::gfxb#3 gfx_init_plane_fill::gfxb#1 gfx_init_plane_fill::gfxb#6 gfx_init_plane_fill::$6 gfx_init_plane_fill::$4 gfx_init_plane_fill::$5 gfx_init_plane_horisontal2::gfxa#2 gfx_init_plane_horisontal2::gfxa#3 gfx_init_plane_horisontal2::gfxa#1 gfx_init_plane_vertical::gfxb#2 gfx_init_plane_vertical::gfxb#3 gfx_init_plane_vertical::gfxb#1 gfx_init_plane_horisontal::gfxa#3 gfx_init_plane_horisontal::gfxa#6 gfx_init_plane_horisontal::gfxa#7 gfx_init_plane_horisontal::gfxa#1 gfx_init_plane_horisontal::gfxa#2 gfx_init_plane_charset8::chargen#2 gfx_init_plane_charset8::chargen#3 gfx_init_plane_charset8::chargen#1 gfx_init_plane_8bppchunky::x#2 gfx_init_plane_8bppchunky::x#1 bitmap_clear::bitmap#2 bitmap_clear::bitmap#3 bitmap_clear::bitmap#5 bitmap_clear::bitmap#1 bitmap_clear::$3 bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 gfx_init_charset::chargen#2 gfx_init_charset::chargen#3 gfx_init_charset::chargen#1 gfx_init_screen4::ch#2 gfx_init_screen4::ch#3 gfx_init_screen4::ch#1 gfx_init_screen3::ch#2 gfx_init_screen3::ch#3 gfx_init_screen3::ch#1 gfx_init_screen2::ch#2 gfx_init_screen2::ch#3 gfx_init_screen2::ch#1 gfx_init_screen1::ch#2 gfx_init_screen1::ch#3 gfx_init_screen1::ch#1 gfx_init_screen0::ch#2 gfx_init_screen0::ch#3 gfx_init_screen0::ch#1 gfx_mode::$24 gfx_mode::$26 gfx_mode::$28 gfx_mode::$38 gfx_mode::$40 gfx_mode::$42 form_field_ptr::$2 gfx_init_plane_fill::$1 bitmap_plot::plotter_x#0 bitmap_plot::$0 ]
zp ZP_WORD:5 [ gfx_mode::col#2 gfx_mode::col#3 gfx_mode::col#1 print_str_at::at#2 print_str_at::at#0 print_char_cursor#20 print_char_cursor#22 print_char_cursor#77 print_char_cursor#78 print_char_cursor#38 print_char_cursor#1 gfx_init_plane_charset8::gfxa#2 gfx_init_plane_charset8::gfxa#5 gfx_init_plane_charset8::gfxa#6 gfx_init_plane_charset8::gfxa#1 gfx_init_plane_8bppchunky::gfxb#4 gfx_init_plane_8bppchunky::gfxb#3 gfx_init_plane_8bppchunky::gfxb#5 gfx_init_plane_8bppchunky::gfxb#1 gfx_init_charset::charset#2 gfx_init_charset::charset#3 gfx_init_charset::charset#1 print_cls::$0 bitmap_plot::plotter_y#0 ]
reg byte x [ gfx_mode::cx#2 gfx_mode::cx#1 ]
reg byte x [ gfx_mode::j#2 gfx_mode::j#1 ]
@ -1400,7 +1395,8 @@ zp ZP_BYTE:13 [ form_cursor_count#21 form_cursor_count#1 form_cursor_count#16 fo
zp ZP_BYTE:14 [ form_field_idx#28 form_field_idx#1 form_field_idx#18 form_field_idx#31 form_field_idx#44 form_field_idx#45 bitmap_line_xdyi::x#3 bitmap_line_xdyi::x#6 bitmap_line_xdyi::x#0 bitmap_line_xdyi::x#1 bitmap_line_xdyi::x#2 bitmap_line_ydxi::y#3 bitmap_line_ydxi::y#6 bitmap_line_ydxi::y#1 bitmap_line_ydxi::y#0 bitmap_line_ydxi::y#2 bitmap_line_xdyd::x#3 bitmap_line_xdyd::x#6 bitmap_line_xdyd::x#0 bitmap_line_xdyd::x#1 bitmap_line_xdyd::x#2 bitmap_line_ydxd::y#2 bitmap_line_ydxd::y#7 bitmap_line_ydxd::y#0 bitmap_line_ydxd::y#1 bitmap_line_ydxd::y#3 ]
zp ZP_BYTE:15 [ form_mode::preset_current#6 form_mode::preset_current#0 form_mode::preset_current#1 bitmap_line_xdyi::y#3 bitmap_line_xdyi::y#5 bitmap_line_xdyi::y#0 bitmap_line_xdyi::y#1 bitmap_line_xdyi::y#6 bitmap_line_xdyi::y#2 bitmap_line::y0#0 bitmap_line_xdyd::y#3 bitmap_line_xdyd::y#5 bitmap_line_xdyd::y#0 bitmap_line_xdyd::y#1 bitmap_line_xdyd::y#6 bitmap_line_xdyd::y#2 bitmap_line_ydxd::y1#6 bitmap_line_ydxd::y1#0 bitmap_line_ydxd::y1#1 ]
reg byte a [ render_preset_name::idx#10 render_preset_name::idx#0 render_preset_name::idx#1 ]
reg byte y [ form_field_ptr::field_idx#2 form_field_ptr::field_idx#1 form_field_ptr::field_idx#0 ]
reg byte x [ form_render_values::idx#2 form_render_values::idx#1 ]
reg byte x [ form_field_ptr::field_idx#2 form_field_ptr::field_idx#1 form_field_ptr::field_idx#0 ]
reg byte y [ apply_preset::i#2 apply_preset::i#1 ]
reg byte x [ form_control::return#2 ]
reg byte x [ form_set_screen::y#2 form_set_screen::y#1 ]
@ -1481,8 +1477,8 @@ reg byte a [ keyboard_matrix_read::return#0 ]
reg byte a [ form_control::return#0 ]
reg byte a [ form_mode::$36 ]
reg byte a [ apply_preset::idx#0 ]
reg byte x [ form_field_ptr::y#0 ]
reg byte a [ form_field_ptr::x#0 ]
reg byte a [ form_field_ptr::y#0 ]
zp ZP_BYTE:19 [ form_field_ptr::x#0 ]
reg byte a [ form_control::$13 ]
reg byte a [ keyboard_event_get::return#4 ]
reg byte a [ form_control::key_event#0 ]
@ -1493,7 +1489,7 @@ reg byte a [ form_control::$14 ]
reg byte a [ form_set_screen::$0 ]
reg byte a [ form_set_screen::$1 ]
reg byte a [ print_str_lines::ch#0 ]
zp ZP_DWORD:19 [ gfx_init_plane_fill::$0 ]
zp ZP_DWORD:20 [ gfx_init_plane_fill::$0 ]
reg byte a [ gfx_init_plane_fill::gfxbCpuBank#0 ]
reg byte a [ gfx_init_plane_horisontal2::$8 ]
reg byte a [ gfx_init_plane_horisontal2::row#0 ]

View File

@ -7249,7 +7249,56 @@ Fixing inline constructor with bitmap_plot::$3 ← *(bitmap_plot_yhi#0 + bitmap_
Successful SSA optimization Pass2FixInlineConstructors
Inferred type updated to byte in [483] (byte/signed word/word/dword/signed dword~) mode_stdbitmap::$29 ← (byte) mode_stdbitmap::l#2
Inferred type updated to byte in [484] (byte/signed word/word/dword/signed dword~) mode_stdbitmap::$30 ← (byte) mode_stdbitmap::l#2
Eliminating unused variable - keeping the phi block (byte*) print_screen#13
Eliminating unused variable - keeping the phi block (byte*) print_line_cursor#10
Eliminating unused variable - keeping the phi block (byte*) print_char_cursor#11
Eliminating unused variable - keeping the phi block (byte) dtv_control#1
Eliminating unused constant (const byte) bitmap_line::xd#0
Eliminating unused constant (const byte) bitmap_line::yd#0
Eliminating unused constant (const string) $21
Eliminating unused constant (const string) $22
Eliminating unused constant (const string) $23
Eliminating unused constant (const string) $25
Eliminating unused constant (const string) $26
Eliminating unused constant (const string) $27
Eliminating unused constant (const string) $28
Eliminating unused constant (const string) $29
Eliminating unused constant (const string) $30
Eliminating unused constant (const string) $31
Eliminating unused constant (const string) $32
Eliminating unused constant (const string) $33
Eliminating unused constant (const string) $34
Eliminating unused constant (const string) $35
Eliminating unused constant (const string) $36
Eliminating unused constant (const string) $37
Eliminating unused constant (const string) $38
Eliminating unused constant (const string) $39
Eliminating unused constant (const string) $40
Eliminating unused constant (const string) $41
Eliminating unused constant (const string) $1
Eliminating unused constant (const string) $2
Eliminating unused constant (const string) $3
Eliminating unused constant (const string) $4
Eliminating unused constant (const string) $5
Eliminating unused constant (const string) $6
Eliminating unused constant (const string) $7
Eliminating unused constant (const string) $8
Eliminating unused constant (const string) $9
Eliminating unused constant (const string) $10
Eliminating unused constant (const string) $11
Eliminating unused constant (const string) $12
Eliminating unused constant (const string) $13
Eliminating unused constant (const string) $14
Eliminating unused constant (const string) $15
Eliminating unused constant (const string) $16
Eliminating unused constant (const string) $17
Eliminating unused constant (const string) $18
Eliminating unused constant (const string) $19
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused variable - keeping the phi block (byte) dtv_control#3
Eliminating unused constant (const string) $24
Eliminating unused constant (const byte*) print_screen#0
Eliminating unused constant (const byte) dtv_control#129
Successful SSA optimization PassNEliminateUnusedVars
Eliminating Noop Cast (byte*) bitmap_clear::bitmap#0 ← ((byte*)) (word~) bitmap_clear::$3
Eliminating Noop Cast (byte*) bitmap_plot::plotter#0 ← ((byte*)) (word~) bitmap_plot::$0

View File

@ -114,6 +114,7 @@ Constant (const byte) main::getScreen1_$0#0 = main::getScreen1_id#0*SIZEOF_POINT
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(screens#0+main::getScreen1_$0#0)
Successful SSA optimization Pass2ConstantAdditionElimination
Eliminating unused constant (const byte*) main::screen#0
Successful SSA optimization PassNEliminateUnusedVars
Removing redundant cast (byte*) main::spritePtr1_return#0 ← ((byte*)) (byte*) main::spritePtr1_$0#0
Successful SSA optimization Pass2EliminateRedundantCasts

View File

@ -43,6 +43,7 @@ Constant (const byte) main::c#1 = 1+3
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+0)
Successful SSA optimization Pass2ConstantAdditionElimination
Eliminating unused constant (const byte) main::c#0
Successful SSA optimization PassNEliminateUnusedVars
Simplifying constant plus zero main::SCREEN#0+0
Adding NOP phi() at start of @begin

View File

@ -1153,6 +1153,9 @@ Consolidated array index constant in *(PLAYFIELD_SPRITE_PTRS_2#0+3)
Successful SSA optimization Pass2ConstantAdditionElimination
if() condition always true - replacing block destination [92] if(true) goto loop::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused variable - keeping the phi block (byte) irq_cnt#3
Eliminating unused variable - keeping the phi block (byte) irq_sprite_ypos#11
Eliminating unused variable - keeping the phi block (byte) irq_sprite_ptr#11
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block loop::@return
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -8745,15 +8745,50 @@ Removing PHI-reference to removed block (main::@12) in block main::@19
Removing PHI-reference to removed block (main::@12) in block main::@19
if() condition always true - replacing block destination [529] if(true) goto main::@13
Successful SSA optimization Pass2ConstantIfs
Eliminating unused variable (byte*) render_bcd::screen_pos#1 and assignment [131] (byte*) render_bcd::screen_pos#1 ← ++ (byte*) render_bcd::screen_pos#3
Eliminating unused variable - keeping the phi block (byte) irq_cnt#3
Eliminating unused variable - keeping the phi block (byte) irq_sprite_ypos#11
Eliminating unused variable - keeping the phi block (byte) irq_sprite_ptr#11
Eliminating unused variable - keeping the phi block (byte) render_screen_showing#13
Eliminating unused variable - keeping the phi block (byte) keyboard_modifiers#16
Eliminating unused constant (const byte) render_show::d018val#0
Eliminating unused constant (const byte*) render_score::screen#0
Eliminating unused constant (const byte*) render_next::screen_next_area#0
Eliminating unused constant (const byte) play_movement::render#0
Eliminating unused constant (const byte) play_move_rotate::orientation#0
Eliminating unused constant (const byte) main::render#0
Eliminating unused constant (const byte*) current_piece_gfx#0
Eliminating unused constant (const byte) current_piece_char#0
Eliminating unused constant (const byte) current_xpos#0
Eliminating unused constant (const byte) current_ypos#0
Eliminating unused constant (const byte) render_screen_render#0
Eliminating unused constant (const byte) render_screen_show#0
Eliminating unused constant (const byte*) current_piece#0
Eliminating unused constant (const byte) current_orientation#0
Eliminating unused constant (const byte) current_movedown_slow#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused variable - keeping the phi block (byte) keyboard_modifiers#14
Eliminating unused constant (const byte) keyboard_modifiers#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused variable (byte) keyboard_modifiers#5 and assignment [51] (byte) keyboard_modifiers#5 ← (byte) keyboard_modifiers#13 | (const byte) KEY_MODIFIER_COMMODORE#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused variable - keeping the phi block (byte) keyboard_modifiers#13
Eliminating unused constant (const byte) KEY_MODIFIER_COMMODORE#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused variable (byte) keyboard_modifiers#4 and assignment [50] (byte) keyboard_modifiers#4 ← (byte) keyboard_modifiers#12 | (const byte) KEY_MODIFIER_CTRL#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused variable - keeping the phi block (byte) keyboard_modifiers#12
Eliminating unused constant (const byte) KEY_MODIFIER_CTRL#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused variable (byte) keyboard_modifiers#3 and assignment [44] (byte) keyboard_modifiers#3 ← (byte) keyboard_modifiers#11 | (const byte) KEY_MODIFIER_RSHIFT#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused variable - keeping the phi block (byte) keyboard_modifiers#11
Eliminating unused constant (const byte) KEY_MODIFIER_RSHIFT#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const byte) keyboard_modifiers#2
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const byte) KEY_MODIFIER_LSHIFT#0
Eliminating unused constant (const byte) keyboard_modifiers#1
Successful SSA optimization PassNEliminateUnusedVars
Eliminating Noop Cast (byte*) render_next::next_piece_gfx#0 ← ((byte*)) *((const word[]) PIECES#0 + (byte) render_next::$9)
Eliminating Noop Cast (byte*) current_piece#5 ← ((byte*)) *((const word[]) PIECES#0 + (byte) play_spawn_current::$7)
@ -8915,6 +8950,9 @@ Redundant Phi (dword) score_bcd#42 (dword) score_bcd#14
Redundant Phi (byte) level#102 (byte) level#17
Redundant Phi (byte) level_bcd#100 (byte) level_bcd#17
Successful SSA optimization Pass2RedundantPhiElimination
Eliminating unused constant (const byte) SIZEOF_POINTER
Eliminating unused constant (const byte) SIZEOF_WORD
Eliminating unused constant (const byte) SIZEOF_DWORD
Successful SSA optimization PassNEliminateUnusedVars
Alias candidate removed (volatile)(byte) sprites_irq::raster_sprite_gfx_modify#0 = (byte/signed word/word/dword/signed dword~) sprites_irq::$0
Inlining constant with var siblings (const byte) keyboard_event_scan::keycode#0

View File

@ -62,6 +62,8 @@ Constant (const byte) main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte[]) main::msg#0 = "cm"+'l'
Successful SSA optimization Pass2ConstantIdentification
Eliminating unused constant (const string) main::$2
Eliminating unused constant (const byte) main::l#0
Successful SSA optimization PassNEliminateUnusedVars
Resolved ranged next value main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,2)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 3

View File

@ -95,6 +95,7 @@ Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_1) in block main::@1_2
if() condition always false - eliminating [5] if((const byte) main::j#4!=(byte/signed byte/word/signed word/dword/signed dword) 2) goto main::@1_2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) main::j#4
Successful SSA optimization PassNEliminateUnusedVars
Eliminating variable (byte) main::j#5 from unused block main::@1_2
Eliminating variable (byte/signed word/word/dword/signed dword~) main::$9 from unused block main::@1_2

View File

@ -171,6 +171,7 @@ Culled Empty Block (label) line::@1
Successful SSA optimization Pass2CullEmptyBlocks
Redundant Phi (byte) plot::x#2 (byte) plot::x#1
Successful SSA optimization Pass2RedundantPhiElimination
Eliminating unused constant (const byte) plot::x#0
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0

View File

@ -92,6 +92,7 @@ Removing unused procedure block doit2::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Culled Empty Block (label) @1
Successful SSA optimization Pass2CullEmptyBlocks
Eliminating unused constant (const byte) cc#0
Successful SSA optimization PassNEliminateUnusedVars
Simplifying constant plus zero SCREEN#0+0
Adding NOP phi() at start of @begin

View File

@ -58,6 +58,8 @@ Consolidated array index constant in *(main::screen#0+0)
Successful SSA optimization Pass2ConstantAdditionElimination
if() condition always true - replacing block destination [0] if((const byte*) main::rem#0!=(const byte*) main::NULL#0) goto main::@1
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte*) main::NULL#0
Eliminating unused constant (const byte*) main::rem#0
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@3
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -98,6 +98,13 @@ Constant (const byte[]) main::s3#0 = "cam"+main::s#0+'o'
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte[]) main::s5#0 = main::s3#0+main::s4#0
Successful SSA optimization Pass2ConstantIdentification
Eliminating unused constant (const string) main::$7
Eliminating unused constant (const string) main::$8
Eliminating unused constant (const string) main::$9
Eliminating unused constant (const string) main::$10
Eliminating unused constant (const byte) main::e#0
Eliminating unused constant (const string) main::$3
Eliminating unused constant (const byte[]) main::s2#0
Successful SSA optimization PassNEliminateUnusedVars
Resolved ranged next value main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,7)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 8

View File

@ -0,0 +1,38 @@
// Tests optimizing derefs of *(ptr+b) to ptr[b - even when a noop-cast is needed
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
.label screen_idx = 4
main: {
lda #0
sta screen_idx
lda #<msg1
sta print.m
lda #>msg1
sta print.m+1
jsr print
lda #<msg2
sta print.m
lda #>msg2
sta print.m+1
jsr print
rts
}
// print(byte* zeropage(2) m)
print: {
.label m = 2
lda screen_idx
asl
ldy #2
tax
lda (m),y
sta SCREEN,y
iny
lda (m),y
sta SCREEN+1,y
inc screen_idx
rts
}
msg1: .byte 'a', 'b', 'c', 'd'
msg2: .byte '1', '2', '3', '4'

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()
[5] call print
to:main::@1
main::@1: scope:[main] from main
[6] phi()
[7] call print
to:main::@return
main::@return: scope:[main] from main::@1
[8] return
to:@return
print: scope:[print] from main main::@1
[9] (byte) screen_idx#10 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) screen_idx#11 )
[9] (byte*) print::m#2 ← phi( main/(const byte[]) msg1#0 main::@1/(const byte[]) msg2#0 )
[10] (byte) print::$2 ← (byte) screen_idx#10 << (byte/signed byte/word/signed word/dword/signed dword) 1
[11] *((const word*) SCREEN#0 + (byte) print::$2) ← *((word*)(byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2)
[12] (byte) screen_idx#11 ← ++ (byte) screen_idx#10
to:print::@return
print::@return: scope:[print] from print
[13] return
to:@return

View File

@ -0,0 +1,535 @@
Fixing pointer array-indexing *((word*) SCREEN + (byte) screen_idx)
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte[]) msg1#0 ← { (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd' }
(byte[]) msg2#0 ← { (byte) '1', (byte) '2', (byte) '3', (byte) '4' }
to:@1
main: scope:[main] from @2
(byte) screen_idx#13 ← phi( @2/(byte) screen_idx#14 )
(byte*) print::m#0 ← (byte[]) msg1#0
call print
to:main::@1
main::@1: scope:[main] from main
(byte) screen_idx#7 ← phi( main/(byte) screen_idx#5 )
(byte) screen_idx#0 ← (byte) screen_idx#7
(byte*) print::m#1 ← (byte[]) msg2#0
call print
to:main::@2
main::@2: scope:[main] from main::@1
(byte) screen_idx#8 ← phi( main::@1/(byte) screen_idx#5 )
(byte) screen_idx#1 ← (byte) screen_idx#8
to:main::@return
main::@return: scope:[main] from main::@2
(byte) screen_idx#9 ← phi( main::@2/(byte) screen_idx#1 )
(byte) screen_idx#2 ← (byte) screen_idx#9
return
to:@return
@1: scope:[] from @begin
(word*) SCREEN#0 ← ((word*)) (word/signed word/dword/signed dword) $400
(byte) screen_idx#3 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:@2
print: scope:[print] from main main::@1
(byte) screen_idx#10 ← phi( main/(byte) screen_idx#13 main::@1/(byte) screen_idx#0 )
(byte*) print::m#2 ← phi( main/(byte*) print::m#0 main::@1/(byte*) print::m#1 )
(byte*~) print::$0 ← (byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2
(word*~) print::$1 ← ((word*)) (byte*~) print::$0
(byte) print::$2 ← (byte) screen_idx#10 * (const byte) SIZEOF_WORD
*((word*) SCREEN#0 + (byte) print::$2) ← *((word*~) print::$1)
(byte) screen_idx#4 ← ++ (byte) screen_idx#10
to:print::@return
print::@return: scope:[print] from print
(byte) screen_idx#11 ← phi( print/(byte) screen_idx#4 )
(byte) screen_idx#5 ← (byte) screen_idx#11
return
to:@return
@2: scope:[] from @1
(byte) screen_idx#14 ← phi( @1/(byte) screen_idx#3 )
call main
to:@3
@3: scope:[] from @2
(byte) screen_idx#12 ← phi( @2/(byte) screen_idx#2 )
(byte) screen_idx#6 ← (byte) screen_idx#12
to:@end
@end: scope:[] from @3
SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @3
(label) @begin
(label) @end
(word*) SCREEN
(word*) SCREEN#0
(const byte) SIZEOF_WORD = (byte/signed byte/word/signed word/dword/signed dword) 2
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@return
(byte[]) msg1
(byte[]) msg1#0
(byte[]) msg2
(byte[]) msg2#0
(void()) print((byte*) print::m)
(byte*~) print::$0
(word*~) print::$1
(byte) print::$2
(label) print::@return
(byte*) print::m
(byte*) print::m#0
(byte*) print::m#1
(byte*) print::m#2
(byte) screen_idx
(byte) screen_idx#0
(byte) screen_idx#1
(byte) screen_idx#10
(byte) screen_idx#11
(byte) screen_idx#12
(byte) screen_idx#13
(byte) screen_idx#14
(byte) screen_idx#2
(byte) screen_idx#3
(byte) screen_idx#4
(byte) screen_idx#5
(byte) screen_idx#6
(byte) screen_idx#7
(byte) screen_idx#8
(byte) screen_idx#9
Alias (byte) screen_idx#0 = (byte) screen_idx#7
Alias (byte) screen_idx#1 = (byte) screen_idx#8 (byte) screen_idx#9 (byte) screen_idx#2
Alias (byte) screen_idx#11 = (byte) screen_idx#4 (byte) screen_idx#5
Alias (byte) screen_idx#14 = (byte) screen_idx#3
Alias (byte) screen_idx#12 = (byte) screen_idx#6
Successful SSA optimization Pass2AliasElimination
Redundant Phi (byte) screen_idx#13 (byte) screen_idx#14
Redundant Phi (byte) screen_idx#0 (byte) screen_idx#11
Redundant Phi (byte) screen_idx#1 (byte) screen_idx#11
Redundant Phi (byte) screen_idx#12 (byte) screen_idx#1
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte[]) msg1#0 = { 'a', 'b', 'c', 'd' }
Constant (const byte[]) msg2#0 = { '1', '2', '3', '4' }
Constant (const word*) SCREEN#0 = ((word*))$400
Constant (const byte) screen_idx#14 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) print::m#0 = msg1#0
Constant (const byte*) print::m#1 = msg2#0
Successful SSA optimization Pass2ConstantIdentification
Eliminating Noop Cast (word*~) print::$1 ← ((word*)) (byte*~) print::$0
Successful SSA optimization Pass2NopCastElimination
Rewriting multiplication to use shift (byte) print::$2 ← (byte) screen_idx#10 * (const byte) SIZEOF_WORD
Successful SSA optimization Pass2MultiplyToShiftRewriting
Converting *(pointer+n) to pointer[n] *((const word*) SCREEN#0 + (byte) print::$2) ← *((word*)(byte*~) print::$0) -- *((word*)print::m#2 + 2)
Successful SSA optimization Pass2InlineDerefIdx
Culled Empty Block (label) main::@2
Culled Empty Block (label) @1
Culled Empty Block (label) @3
Successful SSA optimization Pass2CullEmptyBlocks
Eliminating unused variable (byte*~) print::$0 and assignment [4] (byte*~) print::$0 ← (byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2
Eliminating unused constant (const byte) SIZEOF_WORD
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte*) print::m#0
Inlining constant with var siblings (const byte*) print::m#1
Inlining constant with var siblings (const byte) screen_idx#14
Constant inlined print::m#1 = (const byte[]) msg2#0
Constant inlined print::m#0 = (const byte[]) msg1#0
Constant inlined screen_idx#14 = (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
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
Calls in [main] to print:5 print:7
Created 2 initial phi equivalence classes
Coalesced [6] screen_idx#15 ← screen_idx#11
Coalesced down to 2 phi equivalence classes
Renumbering block @2 to @1
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
Adding NOP phi() at start of main::@1
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()
[5] call print
to:main::@1
main::@1: scope:[main] from main
[6] phi()
[7] call print
to:main::@return
main::@return: scope:[main] from main::@1
[8] return
to:@return
print: scope:[print] from main main::@1
[9] (byte) screen_idx#10 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) screen_idx#11 )
[9] (byte*) print::m#2 ← phi( main/(const byte[]) msg1#0 main::@1/(const byte[]) msg2#0 )
[10] (byte) print::$2 ← (byte) screen_idx#10 << (byte/signed byte/word/signed word/dword/signed dword) 1
[11] *((const word*) SCREEN#0 + (byte) print::$2) ← *((word*)(byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2)
[12] (byte) screen_idx#11 ← ++ (byte) screen_idx#10
to:print::@return
print::@return: scope:[print] from print
[13] return
to:@return
VARIABLE REGISTER WEIGHTS
(word*) SCREEN
(void()) main()
(byte[]) msg1
(byte[]) msg2
(void()) print((byte*) print::m)
(byte) print::$2 4.0
(byte*) print::m
(byte*) print::m#2
(byte) screen_idx
(byte) screen_idx#10 2.0
(byte) screen_idx#11 1.0
Initial phi equivalence classes
[ print::m#2 ]
[ screen_idx#10 screen_idx#11 ]
Added variable print::$2 to zero page equivalence class [ print::$2 ]
Complete equivalence classes
[ print::m#2 ]
[ screen_idx#10 screen_idx#11 ]
[ print::$2 ]
Allocated zp ZP_WORD:2 [ print::m#2 ]
Allocated zp ZP_BYTE:4 [ screen_idx#10 screen_idx#11 ]
Allocated zp ZP_BYTE:5 [ print::$2 ]
INITIAL ASM
//SEG0 File Comments
// Tests optimizing derefs of *(ptr+b) to ptr[b - even when a noop-cast is needed
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label screen_idx = 4
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG5 @1
b1:
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
//SEG11 [5] call print
//SEG12 [9] phi from main to print [phi:main->print]
print_from_main:
//SEG13 [9] phi (byte) screen_idx#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->print#0] -- vbuz1=vbuc1
lda #0
sta screen_idx
//SEG14 [9] phi (byte*) print::m#2 = (const byte[]) msg1#0 [phi:main->print#1] -- pbuz1=pbuc1
lda #<msg1
sta print.m
lda #>msg1
sta print.m+1
jsr print
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG16 main::@1
b1:
//SEG17 [7] call print
//SEG18 [9] phi from main::@1 to print [phi:main::@1->print]
print_from_b1:
//SEG19 [9] phi (byte) screen_idx#10 = (byte) screen_idx#11 [phi:main::@1->print#0] -- register_copy
//SEG20 [9] phi (byte*) print::m#2 = (const byte[]) msg2#0 [phi:main::@1->print#1] -- pbuz1=pbuc1
lda #<msg2
sta print.m
lda #>msg2
sta print.m+1
jsr print
jmp breturn
//SEG21 main::@return
breturn:
//SEG22 [8] return
rts
}
//SEG23 print
// print(byte* zeropage(2) m)
print: {
.label _2 = 5
.label m = 2
//SEG24 [10] (byte) print::$2 ← (byte) screen_idx#10 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1
lda screen_idx
asl
sta _2
//SEG25 [11] *((const word*) SCREEN#0 + (byte) print::$2) ← *((word*)(byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) -- pwuc1_derefidx_vbuz1=pwuz2_derefidx_vbuc2
ldx _2
ldy #2
lda (m),y
sta SCREEN,y
iny
lda (m),y
sta SCREEN+1,y
//SEG26 [12] (byte) screen_idx#11 ← ++ (byte) screen_idx#10 -- vbuz1=_inc_vbuz1
inc screen_idx
jmp breturn
//SEG27 print::@return
breturn:
//SEG28 [13] return
rts
}
msg1: .byte 'a', 'b', 'c', 'd'
msg2: .byte '1', '2', '3', '4'
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [10] (byte) print::$2 ← (byte) screen_idx#10 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ print::m#2 screen_idx#10 print::$2 ] ( main:2::print:5 [ print::m#2 screen_idx#10 print::$2 ] main:2::print:7 [ print::m#2 screen_idx#10 print::$2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ screen_idx#10 screen_idx#11 ]
Statement [11] *((const word*) SCREEN#0 + (byte) print::$2) ← *((word*)(byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) [ screen_idx#10 ] ( main:2::print:5 [ screen_idx#10 ] main:2::print:7 [ screen_idx#10 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:4 [ screen_idx#10 screen_idx#11 ]
Statement [10] (byte) print::$2 ← (byte) screen_idx#10 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ print::m#2 screen_idx#10 print::$2 ] ( main:2::print:5 [ print::m#2 screen_idx#10 print::$2 ] main:2::print:7 [ print::m#2 screen_idx#10 print::$2 ] ) always clobbers reg byte a
Statement [11] *((const word*) SCREEN#0 + (byte) print::$2) ← *((word*)(byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) [ screen_idx#10 ] ( main:2::print:5 [ screen_idx#10 ] main:2::print:7 [ screen_idx#10 ] ) always clobbers reg byte a reg byte y
Potential registers zp ZP_WORD:2 [ print::m#2 ] : zp ZP_WORD:2 ,
Potential registers zp ZP_BYTE:4 [ screen_idx#10 screen_idx#11 ] : zp ZP_BYTE:4 , reg byte x ,
Potential registers zp ZP_BYTE:5 [ print::$2 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [print] 4: zp ZP_BYTE:5 [ print::$2 ] 0: zp ZP_WORD:2 [ print::m#2 ]
Uplift Scope [] 3: zp ZP_BYTE:4 [ screen_idx#10 screen_idx#11 ]
Uplift Scope [main]
Uplifting [print] best 107 combination reg byte a [ print::$2 ] zp ZP_WORD:2 [ print::m#2 ]
Uplifting [] best 107 combination zp ZP_BYTE:4 [ screen_idx#10 screen_idx#11 ]
Uplifting [main] best 107 combination
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ screen_idx#10 screen_idx#11 ]
Uplifting [] best 107 combination zp ZP_BYTE:4 [ screen_idx#10 screen_idx#11 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// Tests optimizing derefs of *(ptr+b) to ptr[b - even when a noop-cast is needed
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label screen_idx = 4
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG5 @1
b1:
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
//SEG11 [5] call print
//SEG12 [9] phi from main to print [phi:main->print]
print_from_main:
//SEG13 [9] phi (byte) screen_idx#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->print#0] -- vbuz1=vbuc1
lda #0
sta screen_idx
//SEG14 [9] phi (byte*) print::m#2 = (const byte[]) msg1#0 [phi:main->print#1] -- pbuz1=pbuc1
lda #<msg1
sta print.m
lda #>msg1
sta print.m+1
jsr print
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG16 main::@1
b1:
//SEG17 [7] call print
//SEG18 [9] phi from main::@1 to print [phi:main::@1->print]
print_from_b1:
//SEG19 [9] phi (byte) screen_idx#10 = (byte) screen_idx#11 [phi:main::@1->print#0] -- register_copy
//SEG20 [9] phi (byte*) print::m#2 = (const byte[]) msg2#0 [phi:main::@1->print#1] -- pbuz1=pbuc1
lda #<msg2
sta print.m
lda #>msg2
sta print.m+1
jsr print
jmp breturn
//SEG21 main::@return
breturn:
//SEG22 [8] return
rts
}
//SEG23 print
// print(byte* zeropage(2) m)
print: {
.label m = 2
//SEG24 [10] (byte) print::$2 ← (byte) screen_idx#10 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuz1_rol_1
lda screen_idx
asl
//SEG25 [11] *((const word*) SCREEN#0 + (byte) print::$2) ← *((word*)(byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) -- pwuc1_derefidx_vbuaa=pwuz1_derefidx_vbuc2
ldy #2
tax
lda (m),y
sta SCREEN,y
iny
lda (m),y
sta SCREEN+1,y
//SEG26 [12] (byte) screen_idx#11 ← ++ (byte) screen_idx#10 -- vbuz1=_inc_vbuz1
inc screen_idx
jmp breturn
//SEG27 print::@return
breturn:
//SEG28 [13] return
rts
}
msg1: .byte 'a', 'b', 'c', 'd'
msg2: .byte '1', '2', '3', '4'
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_main:
Removing instruction print_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction print_from_main:
Removing instruction b1:
Removing instruction breturn:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(word*) SCREEN
(const word*) SCREEN#0 SCREEN = ((word*))(word/signed word/dword/signed dword) $400
(void()) main()
(label) main::@1
(label) main::@return
(byte[]) msg1
(const byte[]) msg1#0 msg1 = { (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd' }
(byte[]) msg2
(const byte[]) msg2#0 msg2 = { (byte) '1', (byte) '2', (byte) '3', (byte) '4' }
(void()) print((byte*) print::m)
(byte) print::$2 reg byte a 4.0
(label) print::@return
(byte*) print::m
(byte*) print::m#2 m zp ZP_WORD:2
(byte) screen_idx
(byte) screen_idx#10 screen_idx zp ZP_BYTE:4 2.0
(byte) screen_idx#11 screen_idx zp ZP_BYTE:4 1.0
zp ZP_WORD:2 [ print::m#2 ]
zp ZP_BYTE:4 [ screen_idx#10 screen_idx#11 ]
reg byte a [ print::$2 ]
FINAL ASSEMBLER
Score: 86
//SEG0 File Comments
// Tests optimizing derefs of *(ptr+b) to ptr[b - even when a noop-cast is needed
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label screen_idx = 4
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
//SEG11 [5] call print
//SEG12 [9] phi from main to print [phi:main->print]
//SEG13 [9] phi (byte) screen_idx#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->print#0] -- vbuz1=vbuc1
lda #0
sta screen_idx
//SEG14 [9] phi (byte*) print::m#2 = (const byte[]) msg1#0 [phi:main->print#1] -- pbuz1=pbuc1
lda #<msg1
sta print.m
lda #>msg1
sta print.m+1
jsr print
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG16 main::@1
//SEG17 [7] call print
//SEG18 [9] phi from main::@1 to print [phi:main::@1->print]
//SEG19 [9] phi (byte) screen_idx#10 = (byte) screen_idx#11 [phi:main::@1->print#0] -- register_copy
//SEG20 [9] phi (byte*) print::m#2 = (const byte[]) msg2#0 [phi:main::@1->print#1] -- pbuz1=pbuc1
lda #<msg2
sta print.m
lda #>msg2
sta print.m+1
jsr print
//SEG21 main::@return
//SEG22 [8] return
rts
}
//SEG23 print
// print(byte* zeropage(2) m)
print: {
.label m = 2
//SEG24 [10] (byte) print::$2 ← (byte) screen_idx#10 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuz1_rol_1
lda screen_idx
asl
//SEG25 [11] *((const word*) SCREEN#0 + (byte) print::$2) ← *((word*)(byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) -- pwuc1_derefidx_vbuaa=pwuz1_derefidx_vbuc2
ldy #2
tax
lda (m),y
sta SCREEN,y
iny
lda (m),y
sta SCREEN+1,y
//SEG26 [12] (byte) screen_idx#11 ← ++ (byte) screen_idx#10 -- vbuz1=_inc_vbuz1
inc screen_idx
//SEG27 print::@return
//SEG28 [13] return
rts
}
msg1: .byte 'a', 'b', 'c', 'd'
msg2: .byte '1', '2', '3', '4'

View File

@ -0,0 +1,24 @@
(label) @1
(label) @begin
(label) @end
(word*) SCREEN
(const word*) SCREEN#0 SCREEN = ((word*))(word/signed word/dword/signed dword) $400
(void()) main()
(label) main::@1
(label) main::@return
(byte[]) msg1
(const byte[]) msg1#0 msg1 = { (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd' }
(byte[]) msg2
(const byte[]) msg2#0 msg2 = { (byte) '1', (byte) '2', (byte) '3', (byte) '4' }
(void()) print((byte*) print::m)
(byte) print::$2 reg byte a 4.0
(label) print::@return
(byte*) print::m
(byte*) print::m#2 m zp ZP_WORD:2
(byte) screen_idx
(byte) screen_idx#10 screen_idx zp ZP_BYTE:4 2.0
(byte) screen_idx#11 screen_idx zp ZP_BYTE:4 1.0
zp ZP_WORD:2 [ print::m#2 ]
zp ZP_BYTE:4 [ screen_idx#10 screen_idx#11 ]
reg byte a [ print::$2 ]

View File

@ -0,0 +1,30 @@
// Tests optimizing derefs of *(ptr+b) to ptr[b]
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
main: {
ldx #0
lda #<msg1
sta print.m
lda #>msg1
sta print.m+1
jsr print
lda #<msg2
sta print.m
lda #>msg2
sta print.m+1
jsr print
rts
}
// print(byte* zeropage(2) m)
print: {
.label m = 2
ldy #2
lda (m),y
sta SCREEN,x
inx
rts
}
msg1: .byte 'a', 'b', 'c', 'd'
msg2: .byte '1', '2', '3', '4'

View File

@ -0,0 +1,29 @@
@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()
[5] call print
to:main::@1
main::@1: scope:[main] from main
[6] phi()
[7] call print
to:main::@return
main::@return: scope:[main] from main::@1
[8] return
to:@return
print: scope:[print] from main main::@1
[9] (byte) idx#10 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) idx#11 )
[9] (byte*) print::m#2 ← phi( main/(const byte[]) msg1#0 main::@1/(const byte[]) msg2#0 )
[10] *((const byte*) SCREEN#0 + (byte) idx#10) ← *((byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2)
[11] (byte) idx#11 ← ++ (byte) idx#10
to:print::@return
print::@return: scope:[print] from print
[12] return
to:@return

View File

@ -0,0 +1,486 @@
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte[]) msg1#0 ← { (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd' }
(byte[]) msg2#0 ← { (byte) '1', (byte) '2', (byte) '3', (byte) '4' }
to:@1
main: scope:[main] from @2
(byte) idx#13 ← phi( @2/(byte) idx#14 )
(byte*) print::m#0 ← (byte[]) msg1#0
call print
to:main::@1
main::@1: scope:[main] from main
(byte) idx#7 ← phi( main/(byte) idx#5 )
(byte) idx#0 ← (byte) idx#7
(byte*) print::m#1 ← (byte[]) msg2#0
call print
to:main::@2
main::@2: scope:[main] from main::@1
(byte) idx#8 ← phi( main::@1/(byte) idx#5 )
(byte) idx#1 ← (byte) idx#8
to:main::@return
main::@return: scope:[main] from main::@2
(byte) idx#9 ← phi( main::@2/(byte) idx#1 )
(byte) idx#2 ← (byte) idx#9
return
to:@return
@1: scope:[] from @begin
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) $400
(byte) idx#3 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:@2
print: scope:[print] from main main::@1
(byte) idx#10 ← phi( main/(byte) idx#13 main::@1/(byte) idx#0 )
(byte*) print::m#2 ← phi( main/(byte*) print::m#0 main::@1/(byte*) print::m#1 )
(byte*~) print::$0 ← (byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2
*((byte*) SCREEN#0 + (byte) idx#10) ← *((byte*~) print::$0)
(byte) idx#4 ← ++ (byte) idx#10
to:print::@return
print::@return: scope:[print] from print
(byte) idx#11 ← phi( print/(byte) idx#4 )
(byte) idx#5 ← (byte) idx#11
return
to:@return
@2: scope:[] from @1
(byte) idx#14 ← phi( @1/(byte) idx#3 )
call main
to:@3
@3: scope:[] from @2
(byte) idx#12 ← phi( @2/(byte) idx#2 )
(byte) idx#6 ← (byte) idx#12
to:@end
@end: scope:[] from @3
SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @3
(label) @begin
(label) @end
(byte*) SCREEN
(byte*) SCREEN#0
(byte) idx
(byte) idx#0
(byte) idx#1
(byte) idx#10
(byte) idx#11
(byte) idx#12
(byte) idx#13
(byte) idx#14
(byte) idx#2
(byte) idx#3
(byte) idx#4
(byte) idx#5
(byte) idx#6
(byte) idx#7
(byte) idx#8
(byte) idx#9
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@return
(byte[]) msg1
(byte[]) msg1#0
(byte[]) msg2
(byte[]) msg2#0
(void()) print((byte*) print::m)
(byte*~) print::$0
(label) print::@return
(byte*) print::m
(byte*) print::m#0
(byte*) print::m#1
(byte*) print::m#2
Alias (byte) idx#0 = (byte) idx#7
Alias (byte) idx#1 = (byte) idx#8 (byte) idx#9 (byte) idx#2
Alias (byte) idx#11 = (byte) idx#4 (byte) idx#5
Alias (byte) idx#14 = (byte) idx#3
Alias (byte) idx#12 = (byte) idx#6
Successful SSA optimization Pass2AliasElimination
Redundant Phi (byte) idx#13 (byte) idx#14
Redundant Phi (byte) idx#0 (byte) idx#11
Redundant Phi (byte) idx#1 (byte) idx#11
Redundant Phi (byte) idx#12 (byte) idx#1
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte[]) msg1#0 = { 'a', 'b', 'c', 'd' }
Constant (const byte[]) msg2#0 = { '1', '2', '3', '4' }
Constant (const byte*) SCREEN#0 = ((byte*))$400
Constant (const byte) idx#14 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) print::m#0 = msg1#0
Constant (const byte*) print::m#1 = msg2#0
Successful SSA optimization Pass2ConstantIdentification
Converting *(pointer+n) to pointer[n] *((const byte*) SCREEN#0 + (byte) idx#10) ← *((byte*~) print::$0) -- *(print::m#2 + 2)
Successful SSA optimization Pass2InlineDerefIdx
Culled Empty Block (label) main::@2
Culled Empty Block (label) @1
Culled Empty Block (label) @3
Successful SSA optimization Pass2CullEmptyBlocks
Eliminating unused variable (byte*~) print::$0 and assignment [4] (byte*~) print::$0 ← (byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte*) print::m#0
Inlining constant with var siblings (const byte*) print::m#1
Inlining constant with var siblings (const byte) idx#14
Constant inlined idx#14 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined print::m#1 = (const byte[]) msg2#0
Constant inlined print::m#0 = (const byte[]) msg1#0
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
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
Calls in [main] to print:5 print:7
Created 2 initial phi equivalence classes
Coalesced [6] idx#15 ← idx#11
Coalesced down to 2 phi equivalence classes
Renumbering block @2 to @1
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
Adding NOP phi() at start of main::@1
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()
[5] call print
to:main::@1
main::@1: scope:[main] from main
[6] phi()
[7] call print
to:main::@return
main::@return: scope:[main] from main::@1
[8] return
to:@return
print: scope:[print] from main main::@1
[9] (byte) idx#10 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) idx#11 )
[9] (byte*) print::m#2 ← phi( main/(const byte[]) msg1#0 main::@1/(const byte[]) msg2#0 )
[10] *((const byte*) SCREEN#0 + (byte) idx#10) ← *((byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2)
[11] (byte) idx#11 ← ++ (byte) idx#10
to:print::@return
print::@return: scope:[print] from print
[12] return
to:@return
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(byte) idx
(byte) idx#10 3.0
(byte) idx#11 1.0
(void()) main()
(byte[]) msg1
(byte[]) msg2
(void()) print((byte*) print::m)
(byte*) print::m
(byte*) print::m#2 2.0
Initial phi equivalence classes
[ print::m#2 ]
[ idx#10 idx#11 ]
Complete equivalence classes
[ print::m#2 ]
[ idx#10 idx#11 ]
Allocated zp ZP_WORD:2 [ print::m#2 ]
Allocated zp ZP_BYTE:4 [ idx#10 idx#11 ]
INITIAL ASM
//SEG0 File Comments
// Tests optimizing derefs of *(ptr+b) to ptr[b]
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label idx = 4
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG5 @1
b1:
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
//SEG11 [5] call print
//SEG12 [9] phi from main to print [phi:main->print]
print_from_main:
//SEG13 [9] phi (byte) idx#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->print#0] -- vbuz1=vbuc1
lda #0
sta idx
//SEG14 [9] phi (byte*) print::m#2 = (const byte[]) msg1#0 [phi:main->print#1] -- pbuz1=pbuc1
lda #<msg1
sta print.m
lda #>msg1
sta print.m+1
jsr print
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG16 main::@1
b1:
//SEG17 [7] call print
//SEG18 [9] phi from main::@1 to print [phi:main::@1->print]
print_from_b1:
//SEG19 [9] phi (byte) idx#10 = (byte) idx#11 [phi:main::@1->print#0] -- register_copy
//SEG20 [9] phi (byte*) print::m#2 = (const byte[]) msg2#0 [phi:main::@1->print#1] -- pbuz1=pbuc1
lda #<msg2
sta print.m
lda #>msg2
sta print.m+1
jsr print
jmp breturn
//SEG21 main::@return
breturn:
//SEG22 [8] return
rts
}
//SEG23 print
// print(byte* zeropage(2) m)
print: {
.label m = 2
//SEG24 [10] *((const byte*) SCREEN#0 + (byte) idx#10) ← *((byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuc2
ldx idx
ldy #2
lda (m),y
sta SCREEN,x
//SEG25 [11] (byte) idx#11 ← ++ (byte) idx#10 -- vbuz1=_inc_vbuz1
inc idx
jmp breturn
//SEG26 print::@return
breturn:
//SEG27 [12] return
rts
}
msg1: .byte 'a', 'b', 'c', 'd'
msg2: .byte '1', '2', '3', '4'
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [10] *((const byte*) SCREEN#0 + (byte) idx#10) ← *((byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) [ idx#10 ] ( main:2::print:5 [ idx#10 ] main:2::print:7 [ idx#10 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ idx#10 idx#11 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:4 [ idx#10 idx#11 ]
Statement [10] *((const byte*) SCREEN#0 + (byte) idx#10) ← *((byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) [ idx#10 ] ( main:2::print:5 [ idx#10 ] main:2::print:7 [ idx#10 ] ) always clobbers reg byte a reg byte y
Potential registers zp ZP_WORD:2 [ print::m#2 ] : zp ZP_WORD:2 ,
Potential registers zp ZP_BYTE:4 [ idx#10 idx#11 ] : zp ZP_BYTE:4 , reg byte x ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 4: zp ZP_BYTE:4 [ idx#10 idx#11 ]
Uplift Scope [print] 2: zp ZP_WORD:2 [ print::m#2 ]
Uplift Scope [main]
Uplifting [] best 81 combination reg byte x [ idx#10 idx#11 ]
Uplifting [print] best 81 combination zp ZP_WORD:2 [ print::m#2 ]
Uplifting [main] best 81 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// Tests optimizing derefs of *(ptr+b) to ptr[b]
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG5 @1
b1:
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
//SEG11 [5] call print
//SEG12 [9] phi from main to print [phi:main->print]
print_from_main:
//SEG13 [9] phi (byte) idx#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->print#0] -- vbuxx=vbuc1
ldx #0
//SEG14 [9] phi (byte*) print::m#2 = (const byte[]) msg1#0 [phi:main->print#1] -- pbuz1=pbuc1
lda #<msg1
sta print.m
lda #>msg1
sta print.m+1
jsr print
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG16 main::@1
b1:
//SEG17 [7] call print
//SEG18 [9] phi from main::@1 to print [phi:main::@1->print]
print_from_b1:
//SEG19 [9] phi (byte) idx#10 = (byte) idx#11 [phi:main::@1->print#0] -- register_copy
//SEG20 [9] phi (byte*) print::m#2 = (const byte[]) msg2#0 [phi:main::@1->print#1] -- pbuz1=pbuc1
lda #<msg2
sta print.m
lda #>msg2
sta print.m+1
jsr print
jmp breturn
//SEG21 main::@return
breturn:
//SEG22 [8] return
rts
}
//SEG23 print
// print(byte* zeropage(2) m)
print: {
.label m = 2
//SEG24 [10] *((const byte*) SCREEN#0 + (byte) idx#10) ← *((byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
ldy #2
lda (m),y
sta SCREEN,x
//SEG25 [11] (byte) idx#11 ← ++ (byte) idx#10 -- vbuxx=_inc_vbuxx
inx
jmp breturn
//SEG26 print::@return
breturn:
//SEG27 [12] return
rts
}
msg1: .byte 'a', 'b', 'c', 'd'
msg2: .byte '1', '2', '3', '4'
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_main:
Removing instruction print_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction print_from_main:
Removing instruction b1:
Removing instruction breturn:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) $400
(byte) idx
(byte) idx#10 reg byte x 3.0
(byte) idx#11 reg byte x 1.0
(void()) main()
(label) main::@1
(label) main::@return
(byte[]) msg1
(const byte[]) msg1#0 msg1 = { (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd' }
(byte[]) msg2
(const byte[]) msg2#0 msg2 = { (byte) '1', (byte) '2', (byte) '3', (byte) '4' }
(void()) print((byte*) print::m)
(label) print::@return
(byte*) print::m
(byte*) print::m#2 m zp ZP_WORD:2 2.0
zp ZP_WORD:2 [ print::m#2 ]
reg byte x [ idx#10 idx#11 ]
FINAL ASSEMBLER
Score: 60
//SEG0 File Comments
// Tests optimizing derefs of *(ptr+b) to ptr[b]
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
//SEG11 [5] call print
//SEG12 [9] phi from main to print [phi:main->print]
//SEG13 [9] phi (byte) idx#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->print#0] -- vbuxx=vbuc1
ldx #0
//SEG14 [9] phi (byte*) print::m#2 = (const byte[]) msg1#0 [phi:main->print#1] -- pbuz1=pbuc1
lda #<msg1
sta print.m
lda #>msg1
sta print.m+1
jsr print
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG16 main::@1
//SEG17 [7] call print
//SEG18 [9] phi from main::@1 to print [phi:main::@1->print]
//SEG19 [9] phi (byte) idx#10 = (byte) idx#11 [phi:main::@1->print#0] -- register_copy
//SEG20 [9] phi (byte*) print::m#2 = (const byte[]) msg2#0 [phi:main::@1->print#1] -- pbuz1=pbuc1
lda #<msg2
sta print.m
lda #>msg2
sta print.m+1
jsr print
//SEG21 main::@return
//SEG22 [8] return
rts
}
//SEG23 print
// print(byte* zeropage(2) m)
print: {
.label m = 2
//SEG24 [10] *((const byte*) SCREEN#0 + (byte) idx#10) ← *((byte*) print::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
ldy #2
lda (m),y
sta SCREEN,x
//SEG25 [11] (byte) idx#11 ← ++ (byte) idx#10 -- vbuxx=_inc_vbuxx
inx
//SEG26 print::@return
//SEG27 [12] return
rts
}
msg1: .byte 'a', 'b', 'c', 'd'
msg2: .byte '1', '2', '3', '4'

View File

@ -0,0 +1,22 @@
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) $400
(byte) idx
(byte) idx#10 reg byte x 3.0
(byte) idx#11 reg byte x 1.0
(void()) main()
(label) main::@1
(label) main::@return
(byte[]) msg1
(const byte[]) msg1#0 msg1 = { (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd' }
(byte[]) msg2
(const byte[]) msg2#0 msg2 = { (byte) '1', (byte) '2', (byte) '3', (byte) '4' }
(void()) print((byte*) print::m)
(label) print::@return
(byte*) print::m
(byte*) print::m#2 m zp ZP_WORD:2 2.0
zp ZP_WORD:2 [ print::m#2 ]
reg byte x [ idx#10 idx#11 ]

View File

@ -50,6 +50,8 @@ Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::screen#0+0)
Consolidated array index constant in *(main::screen#0+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Eliminating unused constant (const byte) main::a#0
Eliminating unused constant (const byte) main::b#0
Successful SSA optimization PassNEliminateUnusedVars
Simplifying constant plus zero main::screen#0+0
Adding NOP phi() at start of @begin

View File

@ -76,6 +76,7 @@ Constant (const byte) key#0 = 0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [5] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) key#0
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -691,24 +691,14 @@ debug_print_init: {
.label at_line = SCREEN+$10*$28
.label at_cols = COLS+$10*$28
.label _59 = 6
.label _60 = 6
.label _63 = 6
.label _64 = 6
.label _67 = 6
.label _68 = 6
.label _71 = 6
.label _72 = 6
.label _75 = 6
.label _76 = 6
.label _79 = 6
.label _80 = 6
.label _83 = 6
.label _84 = 6
.label _87 = 6
.label _88 = 6
.label _91 = 6
.label _92 = 6
.label j = 4
.label c = 2
.label i = 3
jsr print_cls
@ -855,8 +845,7 @@ debug_print_init: {
ldy i
ldx zs,y
jsr print_sbyte_at
lda #0
sta j
ldy #0
b2:
lax i
axs #-[8]
@ -867,16 +856,8 @@ debug_print_init: {
lda #>at_cols
adc #0
sta _59+1
lda j
clc
adc _60
sta _60
bcc !+
inc _60+1
!:
txa
ldy #0
sta (_60),y
sta (_59),y
lda c
clc
adc #<at_cols+$28*1
@ -884,16 +865,8 @@ debug_print_init: {
lda #>at_cols+$28*1
adc #0
sta _63+1
lda j
clc
adc _64
sta _64
bcc !+
inc _64+1
!:
txa
ldy #0
sta (_64),y
sta (_63),y
lda c
clc
adc #<at_cols+$28*2
@ -901,16 +874,8 @@ debug_print_init: {
lda #>at_cols+$28*2
adc #0
sta _67+1
lda j
clc
adc _68
sta _68
bcc !+
inc _68+1
!:
txa
ldy #0
sta (_68),y
sta (_67),y
lda c
clc
adc #<at_cols+$28*3
@ -918,16 +883,8 @@ debug_print_init: {
lda #>at_cols+$28*3
adc #0
sta _71+1
lda j
clc
adc _72
sta _72
bcc !+
inc _72+1
!:
txa
ldy #0
sta (_72),y
sta (_71),y
lda c
clc
adc #<at_cols+$28*4
@ -935,16 +892,8 @@ debug_print_init: {
lda #>at_cols+$28*4
adc #0
sta _75+1
lda j
clc
adc _76
sta _76
bcc !+
inc _76+1
!:
txa
ldy #0
sta (_76),y
sta (_75),y
lda c
clc
adc #<at_cols+$28*5
@ -952,16 +901,8 @@ debug_print_init: {
lda #>at_cols+$28*5
adc #0
sta _79+1
lda j
clc
adc _80
sta _80
bcc !+
inc _80+1
!:
txa
ldy #0
sta (_80),y
sta (_79),y
lda c
clc
adc #<at_cols+$28*6
@ -969,16 +910,8 @@ debug_print_init: {
lda #>at_cols+$28*6
adc #0
sta _83+1
lda j
clc
adc _84
sta _84
bcc !+
inc _84+1
!:
txa
ldy #0
sta (_84),y
sta (_83),y
lda c
clc
adc #<at_cols+$28*7
@ -986,16 +919,8 @@ debug_print_init: {
lda #>at_cols+$28*7
adc #0
sta _87+1
lda j
clc
adc _88
sta _88
bcc !+
inc _88+1
!:
txa
ldy #0
sta (_88),y
sta (_87),y
lda c
clc
adc #<at_cols+$28*8
@ -1003,19 +928,10 @@ debug_print_init: {
lda #>at_cols+$28*8
adc #0
sta _91+1
lda j
clc
adc _92
sta _92
bcc !+
inc _92+1
!:
txa
ldy #0
sta (_92),y
inc j
lda #4
cmp j
sta (_91),y
iny
cpy #4
beq !b2+
jmp b2
!b2:

View File

@ -475,82 +475,73 @@ debug_print_init::@2: scope:[debug_print_init] from debug_print_init::@17 debug
[225] (byte) debug_print_init::j#2 ← phi( debug_print_init::@2/(byte) debug_print_init::j#1 debug_print_init::@17/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[226] (byte) debug_print_init::col#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte) debug_print_init::i#2
[227] (byte*~) debug_print_init::$59 ← (const byte*) debug_print_init::at_cols#0 + (byte) debug_print_init::c#2
[228] (byte*~) debug_print_init::$60 ← (byte*~) debug_print_init::$59 + (byte) debug_print_init::j#2
[229] *((byte*~) debug_print_init::$60) ← (byte) debug_print_init::col#0
[230] (byte*~) debug_print_init::$63 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) debug_print_init::c#2
[231] (byte*~) debug_print_init::$64 ← (byte*~) debug_print_init::$63 + (byte) debug_print_init::j#2
[232] *((byte*~) debug_print_init::$64) ← (byte) debug_print_init::col#0
[233] (byte*~) debug_print_init::$67 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) debug_print_init::c#2
[234] (byte*~) debug_print_init::$68 ← (byte*~) debug_print_init::$67 + (byte) debug_print_init::j#2
[235] *((byte*~) debug_print_init::$68) ← (byte) debug_print_init::col#0
[236] (byte*~) debug_print_init::$71 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 3 + (byte) debug_print_init::c#2
[237] (byte*~) debug_print_init::$72 ← (byte*~) debug_print_init::$71 + (byte) debug_print_init::j#2
[238] *((byte*~) debug_print_init::$72) ← (byte) debug_print_init::col#0
[239] (byte*~) debug_print_init::$75 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) debug_print_init::c#2
[240] (byte*~) debug_print_init::$76 ← (byte*~) debug_print_init::$75 + (byte) debug_print_init::j#2
[241] *((byte*~) debug_print_init::$76) ← (byte) debug_print_init::col#0
[242] (byte*~) debug_print_init::$79 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 5 + (byte) debug_print_init::c#2
[243] (byte*~) debug_print_init::$80 ← (byte*~) debug_print_init::$79 + (byte) debug_print_init::j#2
[244] *((byte*~) debug_print_init::$80) ← (byte) debug_print_init::col#0
[245] (byte*~) debug_print_init::$83 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 6 + (byte) debug_print_init::c#2
[246] (byte*~) debug_print_init::$84 ← (byte*~) debug_print_init::$83 + (byte) debug_print_init::j#2
[247] *((byte*~) debug_print_init::$84) ← (byte) debug_print_init::col#0
[248] (byte*~) debug_print_init::$87 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 7 + (byte) debug_print_init::c#2
[249] (byte*~) debug_print_init::$88 ← (byte*~) debug_print_init::$87 + (byte) debug_print_init::j#2
[250] *((byte*~) debug_print_init::$88) ← (byte) debug_print_init::col#0
[251] (byte*~) debug_print_init::$91 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 8 + (byte) debug_print_init::c#2
[252] (byte*~) debug_print_init::$92 ← (byte*~) debug_print_init::$91 + (byte) debug_print_init::j#2
[253] *((byte*~) debug_print_init::$92) ← (byte) debug_print_init::col#0
[254] (byte) debug_print_init::j#1 ← ++ (byte) debug_print_init::j#2
[255] if((byte) debug_print_init::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto debug_print_init::@2
[228] *((byte*~) debug_print_init::$59 + (byte) debug_print_init::j#2) ← (byte) debug_print_init::col#0
[229] (byte*~) debug_print_init::$63 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) debug_print_init::c#2
[230] *((byte*~) debug_print_init::$63 + (byte) debug_print_init::j#2) ← (byte) debug_print_init::col#0
[231] (byte*~) debug_print_init::$67 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) debug_print_init::c#2
[232] *((byte*~) debug_print_init::$67 + (byte) debug_print_init::j#2) ← (byte) debug_print_init::col#0
[233] (byte*~) debug_print_init::$71 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 3 + (byte) debug_print_init::c#2
[234] *((byte*~) debug_print_init::$71 + (byte) debug_print_init::j#2) ← (byte) debug_print_init::col#0
[235] (byte*~) debug_print_init::$75 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) debug_print_init::c#2
[236] *((byte*~) debug_print_init::$75 + (byte) debug_print_init::j#2) ← (byte) debug_print_init::col#0
[237] (byte*~) debug_print_init::$79 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 5 + (byte) debug_print_init::c#2
[238] *((byte*~) debug_print_init::$79 + (byte) debug_print_init::j#2) ← (byte) debug_print_init::col#0
[239] (byte*~) debug_print_init::$83 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 6 + (byte) debug_print_init::c#2
[240] *((byte*~) debug_print_init::$83 + (byte) debug_print_init::j#2) ← (byte) debug_print_init::col#0
[241] (byte*~) debug_print_init::$87 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 7 + (byte) debug_print_init::c#2
[242] *((byte*~) debug_print_init::$87 + (byte) debug_print_init::j#2) ← (byte) debug_print_init::col#0
[243] (byte*~) debug_print_init::$91 ← (const byte*) debug_print_init::at_cols#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 8 + (byte) debug_print_init::c#2
[244] *((byte*~) debug_print_init::$91 + (byte) debug_print_init::j#2) ← (byte) debug_print_init::col#0
[245] (byte) debug_print_init::j#1 ← ++ (byte) debug_print_init::j#2
[246] if((byte) debug_print_init::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto debug_print_init::@2
to:debug_print_init::@3
debug_print_init::@3: scope:[debug_print_init] from debug_print_init::@2
[256] (byte) debug_print_init::c#1 ← (byte) debug_print_init::c#2 + (byte/signed byte/word/signed word/dword/signed dword) 4
[257] (byte) debug_print_init::i#1 ← ++ (byte) debug_print_init::i#2
[258] if((byte) debug_print_init::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto debug_print_init::@1
[247] (byte) debug_print_init::c#1 ← (byte) debug_print_init::c#2 + (byte/signed byte/word/signed word/dword/signed dword) 4
[248] (byte) debug_print_init::i#1 ← ++ (byte) debug_print_init::i#2
[249] if((byte) debug_print_init::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto debug_print_init::@1
to:debug_print_init::@return
debug_print_init::@return: scope:[debug_print_init] from debug_print_init::@3
[259] return
[250] return
to:@return
print_str_at: scope:[print_str_at] from debug_print_init::@10 debug_print_init::@11 debug_print_init::@12 debug_print_init::@13 debug_print_init::@14 debug_print_init::@15 debug_print_init::@4 debug_print_init::@5 debug_print_init::@6 debug_print_init::@7 debug_print_init::@8 debug_print_init::@9
[260] (byte*) print_str_at::at#15 ← phi( debug_print_init::@9/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $12 debug_print_init::@10/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $13 debug_print_init::@11/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $14 debug_print_init::@12/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $15 debug_print_init::@13/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $16 debug_print_init::@14/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $17 debug_print_init::@15/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18 debug_print_init::@4/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $22 debug_print_init::@5/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) $22 debug_print_init::@6/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 2+(byte/signed byte/word/signed word/dword/signed dword) $22 debug_print_init::@7/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $10 debug_print_init::@8/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $11 )
[260] (byte*) print_str_at::str#15 ← phi( debug_print_init::@9/(const string) debug_print_init::str5 debug_print_init::@10/(const string) debug_print_init::str6 debug_print_init::@11/(const string) debug_print_init::str7 debug_print_init::@12/(const string) debug_print_init::str8 debug_print_init::@13/(const string) debug_print_init::str9 debug_print_init::@14/(const string) debug_print_init::str10 debug_print_init::@15/(const string) debug_print_init::str11 debug_print_init::@4/(const string) debug_print_init::str debug_print_init::@5/(const string) debug_print_init::str1 debug_print_init::@6/(const string) debug_print_init::str2 debug_print_init::@7/(const string) debug_print_init::str3 debug_print_init::@8/(const string) debug_print_init::str4 )
[251] (byte*) print_str_at::at#15 ← phi( debug_print_init::@9/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $12 debug_print_init::@10/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $13 debug_print_init::@11/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $14 debug_print_init::@12/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $15 debug_print_init::@13/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $16 debug_print_init::@14/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $17 debug_print_init::@15/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18 debug_print_init::@4/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $22 debug_print_init::@5/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) $22 debug_print_init::@6/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) 2+(byte/signed byte/word/signed word/dword/signed dword) $22 debug_print_init::@7/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $10 debug_print_init::@8/(const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $11 )
[251] (byte*) print_str_at::str#15 ← phi( debug_print_init::@9/(const string) debug_print_init::str5 debug_print_init::@10/(const string) debug_print_init::str6 debug_print_init::@11/(const string) debug_print_init::str7 debug_print_init::@12/(const string) debug_print_init::str8 debug_print_init::@13/(const string) debug_print_init::str9 debug_print_init::@14/(const string) debug_print_init::str10 debug_print_init::@15/(const string) debug_print_init::str11 debug_print_init::@4/(const string) debug_print_init::str debug_print_init::@5/(const string) debug_print_init::str1 debug_print_init::@6/(const string) debug_print_init::str2 debug_print_init::@7/(const string) debug_print_init::str3 debug_print_init::@8/(const string) debug_print_init::str4 )
to:print_str_at::@1
print_str_at::@1: scope:[print_str_at] from print_str_at print_str_at::@2
[261] (byte*) print_str_at::at#13 ← phi( print_str_at/(byte*) print_str_at::at#15 print_str_at::@2/(byte*) print_str_at::at#0 )
[261] (byte*) print_str_at::str#13 ← phi( print_str_at/(byte*) print_str_at::str#15 print_str_at::@2/(byte*) print_str_at::str#0 )
[262] if(*((byte*) print_str_at::str#13)!=(byte) '@') goto print_str_at::@2
[252] (byte*) print_str_at::at#13 ← phi( print_str_at/(byte*) print_str_at::at#15 print_str_at::@2/(byte*) print_str_at::at#0 )
[252] (byte*) print_str_at::str#13 ← phi( print_str_at/(byte*) print_str_at::str#15 print_str_at::@2/(byte*) print_str_at::str#0 )
[253] if(*((byte*) print_str_at::str#13)!=(byte) '@') goto print_str_at::@2
to:print_str_at::@return
print_str_at::@return: scope:[print_str_at] from print_str_at::@1
[263] return
[254] return
to:@return
print_str_at::@2: scope:[print_str_at] from print_str_at::@1
[264] *((byte*) print_str_at::at#13) ← *((byte*) print_str_at::str#13)
[265] (byte*) print_str_at::at#0 ← ++ (byte*) print_str_at::at#13
[266] (byte*) print_str_at::str#0 ← ++ (byte*) print_str_at::str#13
[255] *((byte*) print_str_at::at#13) ← *((byte*) print_str_at::str#13)
[256] (byte*) print_str_at::at#0 ← ++ (byte*) print_str_at::at#13
[257] (byte*) print_str_at::str#0 ← ++ (byte*) print_str_at::str#13
to:print_str_at::@1
print_cls: scope:[print_cls] from debug_print_init
[267] phi()
[258] phi()
to:print_cls::@1
print_cls::@1: scope:[print_cls] from print_cls print_cls::@1
[268] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_screen#0 print_cls::@1/(byte*) print_cls::sc#1 )
[269] *((byte*) print_cls::sc#2) ← (byte) ' '
[270] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2
[271] if((byte*) print_cls::sc#1!=(const byte*) print_screen#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1
[259] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_screen#0 print_cls::@1/(byte*) print_cls::sc#1 )
[260] *((byte*) print_cls::sc#2) ← (byte) ' '
[261] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2
[262] if((byte*) print_cls::sc#1!=(const byte*) print_screen#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1
to:print_cls::@return
print_cls::@return: scope:[print_cls] from print_cls::@1
[272] return
[263] return
to:@return
sprites_init: scope:[sprites_init] from main
[273] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) $ff
[264] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) $ff
to:sprites_init::@1
sprites_init::@1: scope:[sprites_init] from sprites_init sprites_init::@1
[274] (byte) sprites_init::i#2 ← phi( sprites_init/(byte/signed byte/word/signed word/dword/signed dword) 0 sprites_init::@1/(byte) sprites_init::i#1 )
[275] *((const byte*) sprites_init::sprites_ptr#0 + (byte) sprites_init::i#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40
[276] *((const byte*) SPRITES_COLS#0 + (byte) sprites_init::i#2) ← (const byte) GREEN#0
[277] (byte) sprites_init::i#1 ← ++ (byte) sprites_init::i#2
[278] if((byte) sprites_init::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto sprites_init::@1
[265] (byte) sprites_init::i#2 ← phi( sprites_init/(byte/signed byte/word/signed word/dword/signed dword) 0 sprites_init::@1/(byte) sprites_init::i#1 )
[266] *((const byte*) sprites_init::sprites_ptr#0 + (byte) sprites_init::i#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40
[267] *((const byte*) SPRITES_COLS#0 + (byte) sprites_init::i#2) ← (const byte) GREEN#0
[268] (byte) sprites_init::i#1 ← ++ (byte) sprites_init::i#2
[269] if((byte) sprites_init::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto sprites_init::@1
to:sprites_init::@return
sprites_init::@return: scope:[sprites_init] from sprites_init::@1
[279] return
[270] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -258,23 +258,14 @@
(signed byte) debug_print::print_sbyte_pos9_sb#0 reg byte x 4.0
(void()) debug_print_init()
(byte*~) debug_print_init::$59 $59 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$60 $60 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$63 $63 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$64 $64 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$67 $67 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$68 $68 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$71 $71 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$72 $72 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$75 $75 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$76 $76 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$79 $79 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$80 $80 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$83 $83 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$84 $84 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$87 $87 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$88 $88 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$91 $91 zp ZP_WORD:6 202.0
(byte*~) debug_print_init::$92 $92 zp ZP_WORD:6 202.0
(label) debug_print_init::@1
(label) debug_print_init::@10
(label) debug_print_init::@11
@ -301,15 +292,15 @@
(const byte*) debug_print_init::at_line#0 at_line = (const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $10*(byte/signed byte/word/signed word/dword/signed dword) $28
(byte) debug_print_init::c
(byte) debug_print_init::c#1 c zp ZP_BYTE:2 7.333333333333333
(byte) debug_print_init::c#2 c zp ZP_BYTE:2 23.512195121951223
(byte) debug_print_init::c#2 c zp ZP_BYTE:2 30.125
(byte) debug_print_init::col
(byte) debug_print_init::col#0 reg byte x 37.40740740740741
(byte) debug_print_init::col#0 reg byte x 56.111111111111114
(byte) debug_print_init::i
(byte) debug_print_init::i#1 i zp ZP_BYTE:3 16.5
(byte) debug_print_init::i#2 i zp ZP_BYTE:3 3.7142857142857144
(byte) debug_print_init::i#2 i zp ZP_BYTE:3 4.727272727272727
(byte) debug_print_init::j
(byte) debug_print_init::j#1 j zp ZP_BYTE:4 151.5
(byte) debug_print_init::j#2 j zp ZP_BYTE:4 38.31034482758621
(byte) debug_print_init::j#1 reg byte y 151.5
(byte) debug_print_init::j#2 reg byte y 55.54999999999999
(const string) debug_print_init::str str = (string) "sx@"
(const string) debug_print_init::str1 str1 = (string) "sy@"
(const string) debug_print_init::str10 str10 = (string) "xp@"
@ -480,11 +471,12 @@
zp ZP_BYTE:2 [ sx#10 sx#3 debug_print_init::c#2 debug_print_init::c#1 ]
zp ZP_BYTE:3 [ sy#10 sy#3 calculate_matrix::sy#0 debug_print_init::i#2 debug_print_init::i#1 ]
zp ZP_BYTE:4 [ anim::i#2 anim::i#1 debug_print::c#2 debug_print::c#1 debug_print_init::j#2 debug_print_init::j#1 calculate_matrix::t1#0 ]
zp ZP_BYTE:4 [ anim::i#2 anim::i#1 debug_print::c#2 debug_print::c#1 calculate_matrix::t1#0 ]
zp ZP_BYTE:5 [ debug_print::i#2 debug_print::i#1 rotate_matrix::y#0 calculate_matrix::t3#0 ]
zp ZP_WORD:6 [ print_sbyte_at::at#21 print_sbyte_at::at#15 print_sbyte_at::at#16 print_sbyte_at::at#17 print_sbyte_at::at#18 print_sbyte_at::at#19 print_sbyte_at::at#20 print_sbyte_at::at#0 print_sbyte_at::at#1 print_sbyte_at::at#2 print_char_at::at#4 print_char_at::at#2 print_char_at::at#3 print_char_at::at#0 print_char_at::at#1 print_byte_at::at#0 print_str_at::str#13 print_str_at::str#15 print_str_at::str#0 print_cls::sc#2 print_cls::sc#1 debug_print_init::$59 debug_print_init::$60 debug_print_init::$63 debug_print_init::$64 debug_print_init::$67 debug_print_init::$68 debug_print_init::$71 debug_print_init::$72 debug_print_init::$75 debug_print_init::$76 debug_print_init::$79 debug_print_init::$80 debug_print_init::$83 debug_print_init::$84 debug_print_init::$87 debug_print_init::$88 debug_print_init::$91 debug_print_init::$92 ]
zp ZP_WORD:6 [ print_sbyte_at::at#21 print_sbyte_at::at#15 print_sbyte_at::at#16 print_sbyte_at::at#17 print_sbyte_at::at#18 print_sbyte_at::at#19 print_sbyte_at::at#20 print_sbyte_at::at#0 print_sbyte_at::at#1 print_sbyte_at::at#2 print_char_at::at#4 print_char_at::at#2 print_char_at::at#3 print_char_at::at#0 print_char_at::at#1 print_byte_at::at#0 print_str_at::str#13 print_str_at::str#15 print_str_at::str#0 print_cls::sc#2 print_cls::sc#1 debug_print_init::$59 debug_print_init::$63 debug_print_init::$67 debug_print_init::$71 debug_print_init::$75 debug_print_init::$79 debug_print_init::$83 debug_print_init::$87 debug_print_init::$91 ]
reg byte x [ print_sbyte_at::b#24 print_sbyte_at::b#0 print_sbyte_at::b#22 print_sbyte_at::b#16 print_sbyte_at::b#17 print_sbyte_at::b#18 print_sbyte_at::b#19 print_sbyte_at::b#20 print_sbyte_at::b#21 print_sbyte_at::b#4 print_sbyte_at::b#13 print_sbyte_at::b#14 print_sbyte_at::b#15 print_sbyte_at::b#5 print_sbyte_at::b#7 print_sbyte_at::b#8 print_sbyte_at::b#9 print_sbyte_at::b#10 print_sbyte_at::b#11 print_sbyte_at::b#12 print_sbyte_at::b#1 print_sbyte_at::b#2 print_sbyte_at::b#3 ]
zp ZP_BYTE:8 [ print_char_at::ch#4 print_char_at::ch#2 print_char_at::ch#3 rotate_matrix::z#0 calculate_matrix::t4#0 ]
reg byte y [ debug_print_init::j#2 debug_print_init::j#1 ]
zp ZP_WORD:9 [ print_str_at::at#13 print_str_at::at#15 print_str_at::at#0 ]
reg byte x [ sprites_init::i#2 sprites_init::i#1 ]
reg byte y [ calculate_matrix::sx#0 ]

View File

@ -1431,6 +1431,8 @@ Fixing inline constructor with bitmap_plot::$3 ← *(bitmap_plot_yhi#0 + bitmap_
Successful SSA optimization Pass2FixInlineConstructors
Inferred type updated to byte in [175] (byte/signed word/word/dword/signed dword~) lines::$0 ← (byte) lines::l#2
Inferred type updated to byte in [176] (byte/signed word/word/dword/signed dword~) lines::$1 ← (byte) lines::l#2
Eliminating unused constant (const byte) bitmap_line::xd#0
Eliminating unused constant (const byte) bitmap_line::yd#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating Noop Cast (byte*) bitmap_clear::bitmap#0 ← ((byte*)) (word~) bitmap_clear::$3
Eliminating Noop Cast (byte*) bitmap_plot::plotter#0 ← ((byte*)) (word~) bitmap_plot::$0

View File

@ -1227,6 +1227,7 @@ Constant (const byte*) plot_chargen::$6 = plot_chargen::$5+1
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [80] if(true) goto main::@5
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) main::shift#0
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -1459,7 +1459,17 @@ if() condition always true - replacing block destination [73] if(true) goto loop
Successful SSA optimization Pass2ConstantIfs
Inferred type updated to byte in [6] (byte/signed word/word/dword/signed dword~) plexSort::$2 ← (byte) plexSort::m#2
Inferred type updated to byte in [13] (byte/signed word/word/dword/signed dword~) plexSort::$5 ← (byte) plexSort::s#3
Eliminating unused variable - keeping the phi block (byte) plex_show_idx#20
Eliminating unused variable - keeping the phi block (byte) plex_sprite_idx#20
Eliminating unused variable - keeping the phi block (byte) plex_sprite_msb#10
Eliminating unused variable - keeping the phi block (byte) plex_free_next#19
Eliminating unused constant (const byte*) PLEX_SCREEN_PTR#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const word/signed word/dword/signed dword) $0
Eliminating unused constant (const byte) plex_show_idx#0
Eliminating unused constant (const byte) plex_sprite_idx#0
Eliminating unused constant (const byte) plex_sprite_msb#0
Eliminating unused constant (const byte) plex_free_next#29
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block loop::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
@ -1511,6 +1521,7 @@ Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) plexSort::$6 [18] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) $ff) goto plexSort::@8
Simple Condition (bool~) plexSort::$7 [96] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Eliminating unused constant (const byte) SIZEOF_WORD
Successful SSA optimization PassNEliminateUnusedVars
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#44
Successful SSA optimization Pass2SelfPhiElimination

View File

@ -1324,6 +1324,7 @@ Redundant Phi (byte*) print_char_cursor#43 (byte*) print_char_cursor#44
Successful SSA optimization Pass2RedundantPhiElimination
Inferred type updated to word in [76] (word/signed dword/dword~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3
Inferred type updated to word in [77] (word/signed dword/dword~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7
Eliminating unused variable - keeping the phi block (byte*) print_line_cursor#39
Successful SSA optimization PassNEliminateUnusedVars
Self Phi Eliminated (byte*) makecharset::charset#7
Successful SSA optimization Pass2SelfPhiElimination
@ -1706,6 +1707,7 @@ Removing PHI-reference to removed block (doplasma::@6_24) in block doplasma::@6_
Removing PHI-reference to removed block (doplasma::@6_24) in block doplasma::@6_25
if() condition always false - eliminating [88] if((const byte) doplasma::ii#50<(byte/signed byte/word/signed word/dword/signed dword) $19) goto doplasma::@6_25
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) doplasma::ii#50
Successful SSA optimization PassNEliminateUnusedVars
Eliminating variable (byte) doplasma::val#51 from unused block doplasma::@6_25
Eliminating variable (byte) doplasma::ii#51 from unused block doplasma::@6_25

View File

@ -1446,6 +1446,7 @@ Redundant Phi (byte*) print_char_cursor#44 (byte*) print_char_cursor#46
Successful SSA optimization Pass2RedundantPhiElimination
Inferred type updated to word in [76] (word/signed dword/dword~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3
Inferred type updated to word in [77] (word/signed dword/dword~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7
Eliminating unused variable - keeping the phi block (byte*) print_line_cursor#41
Successful SSA optimization PassNEliminateUnusedVars
Self Phi Eliminated (byte*) makecharset::charset#7
Successful SSA optimization Pass2SelfPhiElimination

View File

@ -1881,7 +1881,13 @@ if() condition always true - replacing block destination [150] if(true) goto loo
Successful SSA optimization Pass2ConstantIfs
Fixing inline constructor with div32u16u::$4 ← div32u16u::quotient_hi#0 dw= div32u16u::quotient_lo#0
Successful SSA optimization Pass2FixInlineConstructors
Eliminating unused constant (const signed word) sin16s_gen2::offs#0
Eliminating unused constant (const byte) render_logo::logo_idx#0
Eliminating unused constant (const byte) render_logo::screen_idx#0
Eliminating unused constant (const byte) render_logo::line#0
Eliminating unused constant (const word) rem16u#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const signed word) sin16s_gen2::$1
Successful SSA optimization PassNEliminateUnusedVars
Eliminating Noop Cast (word) mul16u::a#1 ← ((word)) (signed word) mul16s::a#0
Eliminating Noop Cast (word~) mul16s::$14 ← ((word)) (signed word) mul16s::a#0
@ -1963,6 +1969,7 @@ Removed zero-constant in assignment render_logo::$15
if() condition always true - replacing block destination [44] if((const byte) render_logo::line#4!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto render_logo::@15_1
Successful SSA optimization Pass2ConstantIfs
Inferred type updated to byte in [42] (byte/signed word/word/dword/signed dword~) render_logo::$15 ← (byte) render_logo::logo_idx#10
Eliminating unused constant (const byte/signed word/word/dword/signed dword) render_logo::$14
Successful SSA optimization PassNEliminateUnusedVars
Alias (byte) render_logo::logo_idx#10 = (byte~) render_logo::$15
Successful SSA optimization Pass2AliasElimination
@ -2027,6 +2034,7 @@ Successful SSA optimization Pass2ConstantIdentification
Removing PHI-reference to removed block (render_logo::@15_5) in block render_logo::@15_6
if() condition always false - eliminating [53] if((const byte) render_logo::line#24!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto render_logo::@15_6
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) render_logo::line#24
Successful SSA optimization PassNEliminateUnusedVars
Eliminating variable (byte) render_logo::line#25 from unused block render_logo::@15_6
Eliminating variable (byte/signed word/word/dword/signed dword~) render_logo::$51 from unused block render_logo::@15_6
@ -2092,6 +2100,7 @@ Successful SSA optimization Pass2ConstantIdentification
Removing PHI-reference to removed block (render_logo::@7_5) in block render_logo::@7_6
if() condition always false - eliminating [61] if((const byte) render_logo::line#34!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto render_logo::@7_6
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) render_logo::line#34
Successful SSA optimization PassNEliminateUnusedVars
Eliminating variable (byte) render_logo::line#35 from unused block render_logo::@7_6
Eliminating variable (byte/signed word/word/dword/signed dword~) render_logo::$63 from unused block render_logo::@7_6
@ -2166,6 +2175,7 @@ Successful SSA optimization Pass2ConstantIdentification
Removing PHI-reference to removed block (render_logo::@32_5) in block render_logo::@32_6
if() condition always false - eliminating [73] if((const byte) render_logo::line#46!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto render_logo::@32_6
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) render_logo::line#46
Successful SSA optimization PassNEliminateUnusedVars
Eliminating variable (byte) render_logo::line#47 from unused block render_logo::@32_6
Eliminating variable (byte/signed word/word/dword/signed dword~) render_logo::$75 from unused block render_logo::@32_6
@ -2187,6 +2197,7 @@ Removed zero-constant in assignment render_logo::$23
if() condition always true - replacing block destination [76] if((const byte) render_logo::line#6!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto render_logo::@24_1
Successful SSA optimization Pass2ConstantIfs
Inferred type updated to byte in [74] (byte/signed word/word/dword/signed dword~) render_logo::$23 ← (byte) render_logo::logo_idx#11
Eliminating unused constant (const byte/signed word/word/dword/signed dword) render_logo::$22
Successful SSA optimization PassNEliminateUnusedVars
Alias (byte) render_logo::logo_idx#11 = (byte~) render_logo::$23
Successful SSA optimization Pass2AliasElimination
@ -2251,6 +2262,7 @@ Successful SSA optimization Pass2ConstantIdentification
Removing PHI-reference to removed block (render_logo::@24_5) in block render_logo::@24_6
if() condition always false - eliminating [85] if((const byte) render_logo::line#58!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto render_logo::@24_6
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) render_logo::line#58
Successful SSA optimization PassNEliminateUnusedVars
Eliminating variable (byte) render_logo::line#59 from unused block render_logo::@24_6
Eliminating variable (byte/signed word/word/dword/signed dword~) render_logo::$97 from unused block render_logo::@24_6

View File

@ -1958,7 +1958,10 @@ Fixing inline constructor with bitmap_clear::$3 ← *(bitmap_plot_yhi#0+0) w= *(
Fixing inline constructor with bitmap_plot::$3 ← *(bitmap_plot_yhi#0 + bitmap_plot::y#2) w= *(bitmap_plot_ylo#0 + bitmap_plot::y#2)
Fixing inline constructor with div32u16u::$4 ← div32u16u::quotient_hi#0 dw= div32u16u::quotient_lo#0
Successful SSA optimization Pass2FixInlineConstructors
Eliminating unused constant (const signed word) sin16s_gen2::offs#0
Eliminating unused constant (const word) rem16u#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const signed word) sin16s_gen2::$1
Successful SSA optimization PassNEliminateUnusedVars
Eliminating Noop Cast (word) mul16u::a#1 ← ((word)) (signed word) mul16s::a#0
Eliminating Noop Cast (word~) mul16s::$14 ← ((word)) (signed word) mul16s::a#0

View File

@ -1927,6 +1927,7 @@ Successful SSA optimization Pass2ConstantIfs
Fixing inline constructor with getFAC::$0 ← *(memHi#0) w= *(memLo#0)
Successful SSA optimization Pass2FixInlineConstructors
Inferred type updated to byte in [49] (byte/signed word/word/dword/signed dword~) init::$9 ← (byte) init::i#2
Eliminating unused constant (const byte) progress_idx#35
Successful SSA optimization PassNEliminateUnusedVars
Eliminating Noop Cast (byte*) prepareMEM::mem#0 ← ((byte*)) (word) setFAC::w#5
Successful SSA optimization Pass2NopCastElimination

View File

@ -74,6 +74,7 @@ Constant (const byte) main::i#0 = 0
Constant (const byte) main::j#0 = 0
Constant (const byte) main::j#1 = $64
Successful SSA optimization Pass2ConstantIdentification
Eliminating unused constant (const byte) main::j#0
Successful SSA optimization PassNEliminateUnusedVars
Resolved ranged next value main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,$ff)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 0

View File

@ -123,6 +123,7 @@ Constant (const byte*) fn2::BGCOL#0 = ((byte*))$d021
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [1] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const void()*) main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -116,6 +116,7 @@ Constant (const byte*) fn2::BGCOL#0 = ((byte*))$d021
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [1] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const void()*) main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -99,13 +99,17 @@ Constant (const void()*) main::$1 = getfn::return#0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [1] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused variable (byte) getfn::b#0 and assignment [2] (byte) getfn::b#0 ← (byte) main::i#1
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Replacing constant pointer function call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
Eliminating unused constant (const void()*) main::$1
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const void()*) getfn::return#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const void()*) getfn::return#1
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0

View File

@ -97,6 +97,7 @@ Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Rewriting multiplication to use shift (byte) main::$2 ← (byte~) main::$0 * (const byte) SIZEOF_POINTER
Successful SSA optimization Pass2MultiplyToShiftRewriting
Eliminating unused constant (const byte) SIZEOF_POINTER
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) main::i#0
Constant inlined $0 = &(void()) fn1()

View File

@ -89,6 +89,7 @@ Constant (const word/signed word/dword/signed dword) fn1::$0 = $400+$3e8
Successful SSA optimization Pass2ConstantIdentification
Replacing constant pointer function call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
Eliminating unused constant (const void()*) main::cls#0
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte*) main::cols#0
Inlining constant with var siblings (const byte*) fn1::screen#0

View File

@ -134,7 +134,9 @@ Resolved ranged next value do10::i#1 ← ++ do10::i#2 to ++
Resolved ranged comparison value if(do10::i#1!=rangelast(0,9)) goto do10::@1 to (byte/signed byte/word/signed word/dword/signed dword) $a
Replacing constant pointer function call hello
Successful SSA optimization Pass2ConstantCallPointerIdentification
Eliminating unused constant (const void()*) do10::fn#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const void()*) main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) do10::i#0
Inlining constant with var siblings (const byte) hello::i#0

View File

@ -72,6 +72,7 @@ Successful SSA optimization Pass2ConstantIdentification
Replacing constant pointer function call fn1
Replacing constant pointer function call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
Eliminating unused constant (const void()*) main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end

View File

@ -49,6 +49,7 @@ Constant (const byte*) fn1::BORDERCOL#0 = ((byte*))$d020
Successful SSA optimization Pass2ConstantIdentification
Replacing constant pointer function call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
Eliminating unused constant (const void()*) main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2

View File

@ -107,6 +107,7 @@ Consolidated array index constant in *(main::SCREEN#0+1)
Consolidated array index constant in *(main::SCREEN#0+2)
Consolidated array index constant in *(main::SCREEN#0+3)
Successful SSA optimization Pass2ConstantAdditionElimination
Eliminating unused constant (const void()*) main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with different constant siblings (const void()*) main::f#1
Inlining constant with different constant siblings (const void()*) main::f#2

View File

@ -140,6 +140,9 @@ Consolidated array index constant in *(main::SCREEN#0+0)
Successful SSA optimization Pass2ConstantAdditionElimination
if() condition always true - replacing block destination [1] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused variable (byte) fn1::return#0 and assignment [9] (byte) fn1::return#0 ← *((const byte*) fn1::BORDERCOL#0)
Eliminating unused variable (byte) fn2::return#0 and assignment [12] (byte) fn2::return#0 ← *((const byte*) fn2::BGCOL#0)
Eliminating unused constant (const byte()*) main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -7,11 +7,10 @@
.label D018 = $d018
.label CHARSET4 = $2800
main: {
.label _1 = 8
.label _11 = 8
.label _21 = 8
.label _30 = 8
.label chargen1 = 6
.label _1 = 6
.label _11 = 6
.label _21 = 6
.label _30 = 6
.label charset4 = 4
.label chargen = 2
sei
@ -26,19 +25,13 @@ main: {
lda #>CHARGEN
sta chargen+1
b1:
lda chargen
clc
adc #1
sta chargen1
lda chargen+1
adc #0
sta chargen1+1
lda #$60
ldy #0
and (chargen),y
sta _1
lda #$60
and (chargen1),y
ldy #1
and (chargen),y
lsr
lsr
ora _1
@ -61,7 +54,8 @@ main: {
and (chargen),y
sta _11
lda #$18
and (chargen1),y
ldy #1
and (chargen),y
lsr
lsr
ora _11
@ -81,7 +75,8 @@ main: {
asl
sta _21
lda #6
and (chargen1),y
ldy #1
and (chargen),y
lsr
ora _21
tay
@ -100,7 +95,8 @@ main: {
asl
sta _30
lda #1
and (chargen1),y
tay
and (chargen),y
ora _30
tay
lda bits_count,y

View File

@ -14,81 +14,80 @@ main: scope:[main] from @1
main::@1: scope:[main] from main main::@5
[6] (byte*) main::charset4#10 ← phi( main/(const byte*) CHARSET4#0 main::@5/(byte*) main::charset4#1 )
[6] (byte*) main::chargen#10 ← phi( main/(const byte*) CHARGEN#0 main::@5/(byte*) main::chargen#1 )
[7] (byte*) main::chargen1#0 ← (byte*) main::chargen#10 + (byte/signed byte/word/signed word/dword/signed dword) 1
[8] (byte~) main::$1 ← *((byte*) main::chargen#10) & (byte/signed byte/word/signed word/dword/signed dword) $60
[9] (byte~) main::$2 ← *((byte*) main::chargen1#0) & (byte/signed byte/word/signed word/dword/signed dword) $60
[10] (byte~) main::$3 ← (byte~) main::$2 >> (byte/signed byte/word/signed word/dword/signed dword) 2
[11] (byte~) main::$4 ← (byte~) main::$1 | (byte~) main::$3
[12] (byte~) main::$5 ← (byte~) main::$4 >> (byte/signed byte/word/signed word/dword/signed dword) 1
[13] (byte~) main::$6 ← (byte~) main::$5 >> (byte/signed byte/word/signed word/dword/signed dword) 2
[14] (byte) main::bits#0 ← *((const byte[]) bits_count#0 + (byte~) main::$6)
[15] if((byte) main::bits#0<(byte/signed byte/word/signed word/dword/signed dword) 2) goto main::@2
[7] (byte~) main::$1 ← *((byte*) main::chargen#10) & (byte/signed byte/word/signed word/dword/signed dword) $60
[8] (byte~) main::$2 ← *((byte*) main::chargen#10 + (byte/signed byte/word/signed word/dword/signed dword) 1) & (byte/signed byte/word/signed word/dword/signed dword) $60
[9] (byte~) main::$3 ← (byte~) main::$2 >> (byte/signed byte/word/signed word/dword/signed dword) 2
[10] (byte~) main::$4 ← (byte~) main::$1 | (byte~) main::$3
[11] (byte~) main::$5 ← (byte~) main::$4 >> (byte/signed byte/word/signed word/dword/signed dword) 1
[12] (byte~) main::$6 ← (byte~) main::$5 >> (byte/signed byte/word/signed word/dword/signed dword) 2
[13] (byte) main::bits#0 ← *((const byte[]) bits_count#0 + (byte~) main::$6)
[14] if((byte) main::bits#0<(byte/signed byte/word/signed word/dword/signed dword) 2) goto main::@2
to:main::@6
main::@6: scope:[main] from main::@1
[16] phi()
[15] phi()
to:main::@2
main::@2: scope:[main] from main::@1 main::@6
[17] (byte) main::bits_gen#9 ← phi( main::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@6/(byte/signed byte/word/signed word/dword/signed dword) 1 )
[18] (byte) main::bits_gen#1 ← (byte) main::bits_gen#9 << (byte/signed byte/word/signed word/dword/signed dword) 1
[19] (byte~) main::$11 ← *((byte*) main::chargen#10) & (byte/signed byte/word/signed word/dword/signed dword) $18
[20] (byte~) main::$12 ← *((byte*) main::chargen1#0) & (byte/signed byte/word/signed word/dword/signed dword) $18
[21] (byte~) main::$13 ← (byte~) main::$12 >> (byte/signed byte/word/signed word/dword/signed dword) 2
[22] (byte~) main::$14 ← (byte~) main::$11 | (byte~) main::$13
[23] (byte~) main::$15 ← (byte~) main::$14 >> (byte/signed byte/word/signed word/dword/signed dword) 1
[24] (byte) main::bits#1 ← *((const byte[]) bits_count#0 + (byte~) main::$15)
[25] if((byte) main::bits#1<(byte/signed byte/word/signed word/dword/signed dword) 2) goto main::@3
[16] (byte) main::bits_gen#9 ← phi( main::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@6/(byte/signed byte/word/signed word/dword/signed dword) 1 )
[17] (byte) main::bits_gen#1 ← (byte) main::bits_gen#9 << (byte/signed byte/word/signed word/dword/signed dword) 1
[18] (byte~) main::$11 ← *((byte*) main::chargen#10) & (byte/signed byte/word/signed word/dword/signed dword) $18
[19] (byte~) main::$12 ← *((byte*) main::chargen#10 + (byte/signed byte/word/signed word/dword/signed dword) 1) & (byte/signed byte/word/signed word/dword/signed dword) $18
[20] (byte~) main::$13 ← (byte~) main::$12 >> (byte/signed byte/word/signed word/dword/signed dword) 2
[21] (byte~) main::$14 ← (byte~) main::$11 | (byte~) main::$13
[22] (byte~) main::$15 ← (byte~) main::$14 >> (byte/signed byte/word/signed word/dword/signed dword) 1
[23] (byte) main::bits#1 ← *((const byte[]) bits_count#0 + (byte~) main::$15)
[24] if((byte) main::bits#1<(byte/signed byte/word/signed word/dword/signed dword) 2) goto main::@3
to:main::@7
main::@7: scope:[main] from main::@2
[26] (byte) main::bits_gen#4 ← (byte) main::bits_gen#1 + (byte/signed byte/word/signed word/dword/signed dword) 1
[25] (byte) main::bits_gen#4 ← (byte) main::bits_gen#1 + (byte/signed byte/word/signed word/dword/signed dword) 1
to:main::@3
main::@3: scope:[main] from main::@2 main::@7
[27] (byte) main::bits_gen#11 ← phi( main::@2/(byte) main::bits_gen#1 main::@7/(byte) main::bits_gen#4 )
[28] (byte) main::bits_gen#14 ← (byte) main::bits_gen#11 << (byte/signed byte/word/signed word/dword/signed dword) 1
[29] (byte~) main::$20 ← *((byte*) main::chargen#10) & (byte/signed byte/word/signed word/dword/signed dword) 6
[30] (byte~) main::$21 ← (byte~) main::$20 << (byte/signed byte/word/signed word/dword/signed dword) 1
[31] (byte~) main::$22 ← *((byte*) main::chargen1#0) & (byte/signed byte/word/signed word/dword/signed dword) 6
[32] (byte~) main::$23 ← (byte~) main::$22 >> (byte/signed byte/word/signed word/dword/signed dword) 1
[33] (byte~) main::$24 ← (byte~) main::$21 | (byte~) main::$23
[34] (byte) main::bits#2 ← *((const byte[]) bits_count#0 + (byte~) main::$24)
[35] if((byte) main::bits#2<(byte/signed byte/word/signed word/dword/signed dword) 2) goto main::@4
[26] (byte) main::bits_gen#11 ← phi( main::@2/(byte) main::bits_gen#1 main::@7/(byte) main::bits_gen#4 )
[27] (byte) main::bits_gen#14 ← (byte) main::bits_gen#11 << (byte/signed byte/word/signed word/dword/signed dword) 1
[28] (byte~) main::$20 ← *((byte*) main::chargen#10) & (byte/signed byte/word/signed word/dword/signed dword) 6
[29] (byte~) main::$21 ← (byte~) main::$20 << (byte/signed byte/word/signed word/dword/signed dword) 1
[30] (byte~) main::$22 ← *((byte*) main::chargen#10 + (byte/signed byte/word/signed word/dword/signed dword) 1) & (byte/signed byte/word/signed word/dword/signed dword) 6
[31] (byte~) main::$23 ← (byte~) main::$22 >> (byte/signed byte/word/signed word/dword/signed dword) 1
[32] (byte~) main::$24 ← (byte~) main::$21 | (byte~) main::$23
[33] (byte) main::bits#2 ← *((const byte[]) bits_count#0 + (byte~) main::$24)
[34] if((byte) main::bits#2<(byte/signed byte/word/signed word/dword/signed dword) 2) goto main::@4
to:main::@8
main::@8: scope:[main] from main::@3
[36] (byte) main::bits_gen#6 ← (byte) main::bits_gen#14 + (byte/signed byte/word/signed word/dword/signed dword) 1
[35] (byte) main::bits_gen#6 ← (byte) main::bits_gen#14 + (byte/signed byte/word/signed word/dword/signed dword) 1
to:main::@4
main::@4: scope:[main] from main::@3 main::@8
[37] (byte) main::bits_gen#13 ← phi( main::@3/(byte) main::bits_gen#14 main::@8/(byte) main::bits_gen#6 )
[38] (byte) main::bits_gen#16 ← (byte) main::bits_gen#13 << (byte/signed byte/word/signed word/dword/signed dword) 1
[39] (byte~) main::$29 ← *((byte*) main::chargen#10) & (byte/signed byte/word/signed word/dword/signed dword) 1
[40] (byte~) main::$30 ← (byte~) main::$29 << (byte/signed byte/word/signed word/dword/signed dword) 2
[41] (byte~) main::$31 ← *((byte*) main::chargen1#0) & (byte/signed byte/word/signed word/dword/signed dword) 1
[42] (byte~) main::$32 ← (byte~) main::$30 | (byte~) main::$31
[43] (byte) main::bits#3 ← *((const byte[]) bits_count#0 + (byte~) main::$32)
[44] if((byte) main::bits#3<(byte/signed byte/word/signed word/dword/signed dword) 2) goto main::@5
[36] (byte) main::bits_gen#13 ← phi( main::@3/(byte) main::bits_gen#14 main::@8/(byte) main::bits_gen#6 )
[37] (byte) main::bits_gen#16 ← (byte) main::bits_gen#13 << (byte/signed byte/word/signed word/dword/signed dword) 1
[38] (byte~) main::$29 ← *((byte*) main::chargen#10) & (byte/signed byte/word/signed word/dword/signed dword) 1
[39] (byte~) main::$30 ← (byte~) main::$29 << (byte/signed byte/word/signed word/dword/signed dword) 2
[40] (byte~) main::$31 ← *((byte*) main::chargen#10 + (byte/signed byte/word/signed word/dword/signed dword) 1) & (byte/signed byte/word/signed word/dword/signed dword) 1
[41] (byte~) main::$32 ← (byte~) main::$30 | (byte~) main::$31
[42] (byte) main::bits#3 ← *((const byte[]) bits_count#0 + (byte~) main::$32)
[43] if((byte) main::bits#3<(byte/signed byte/word/signed word/dword/signed dword) 2) goto main::@5
to:main::@9
main::@9: scope:[main] from main::@4
[45] (byte) main::bits_gen#8 ← (byte) main::bits_gen#16 + (byte/signed byte/word/signed word/dword/signed dword) 1
[44] (byte) main::bits_gen#8 ← (byte) main::bits_gen#16 + (byte/signed byte/word/signed word/dword/signed dword) 1
to:main::@5
main::@5: scope:[main] from main::@4 main::@9
[46] (byte) main::bits_gen#15 ← phi( main::@4/(byte) main::bits_gen#16 main::@9/(byte) main::bits_gen#8 )
[47] (byte) main::bits_gen#7 ← (byte) main::bits_gen#15 << (byte/signed byte/word/signed word/dword/signed dword) 1
[48] *((byte*) main::charset4#10) ← (byte) main::bits_gen#7
[49] (byte*) main::charset4#1 ← ++ (byte*) main::charset4#10
[50] (byte*) main::chargen#1 ← (byte*) main::chargen#10 + (byte/signed byte/word/signed word/dword/signed dword) 2
[51] if((byte*) main::chargen#1<(const byte*) CHARGEN#0+(word/signed word/dword/signed dword) $800) goto main::@1
[45] (byte) main::bits_gen#15 ← phi( main::@4/(byte) main::bits_gen#16 main::@9/(byte) main::bits_gen#8 )
[46] (byte) main::bits_gen#7 ← (byte) main::bits_gen#15 << (byte/signed byte/word/signed word/dword/signed dword) 1
[47] *((byte*) main::charset4#10) ← (byte) main::bits_gen#7
[48] (byte*) main::charset4#1 ← ++ (byte*) main::charset4#10
[49] (byte*) main::chargen#1 ← (byte*) main::chargen#10 + (byte/signed byte/word/signed word/dword/signed dword) 2
[50] if((byte*) main::chargen#1<(const byte*) CHARGEN#0+(word/signed word/dword/signed dword) $800) goto main::@1
to:main::@10
main::@10: scope:[main] from main::@5
[52] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) $37
[51] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) $37
asm { cli }
to:main::@11
main::@11: scope:[main] from main::@10 main::@11
[54] (byte) main::i#2 ← phi( main::@10/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@11/(byte) main::i#1 )
[55] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) main::i#2
[56] (byte) main::i#1 ← ++ (byte) main::i#2
[57] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11
[53] (byte) main::i#2 ← phi( main::@10/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@11/(byte) main::i#1 )
[54] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) main::i#2
[55] (byte) main::i#1 ← ++ (byte) main::i#2
[56] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@11
to:main::@12
main::@12: scope:[main] from main::@11
[58] *((const byte*) D018#0) ← (byte/signed byte/word/signed word/dword/signed dword) $19
[57] *((const byte*) D018#0) ← (byte/signed byte/word/signed word/dword/signed dword) $19
to:main::@return
main::@return: scope:[main] from main::@12
[59] return
[58] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -14,21 +14,21 @@
(byte[]) bits_count
(const byte[]) bits_count#0 bits_count = { (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 4 }
(void()) main()
(byte~) main::$1 $1 zp ZP_BYTE:8 7.333333333333333
(byte~) main::$11 $11 zp ZP_BYTE:8 7.333333333333333
(byte~) main::$1 $1 zp ZP_BYTE:6 7.333333333333333
(byte~) main::$11 $11 zp ZP_BYTE:6 7.333333333333333
(byte~) main::$12 reg byte a 22.0
(byte~) main::$13 reg byte a 22.0
(byte~) main::$14 reg byte a 22.0
(byte~) main::$15 reg byte a 22.0
(byte~) main::$2 reg byte a 22.0
(byte~) main::$20 reg byte a 22.0
(byte~) main::$21 $21 zp ZP_BYTE:8 7.333333333333333
(byte~) main::$21 $21 zp ZP_BYTE:6 7.333333333333333
(byte~) main::$22 reg byte a 22.0
(byte~) main::$23 reg byte a 22.0
(byte~) main::$24 reg byte a 22.0
(byte~) main::$29 reg byte a 22.0
(byte~) main::$3 reg byte a 22.0
(byte~) main::$30 $30 zp ZP_BYTE:8 11.0
(byte~) main::$30 $30 zp ZP_BYTE:6 11.0
(byte~) main::$31 reg byte a 22.0
(byte~) main::$32 reg byte a 22.0
(byte~) main::$4 reg byte a 22.0
@ -66,12 +66,11 @@
(byte) main::bits_gen#9 reg byte a 11.0
(byte*) main::chargen
(byte*) main::chargen#1 chargen zp ZP_WORD:2 16.5
(byte*) main::chargen#10 chargen zp ZP_WORD:2 1.75
(byte*) main::chargen#10 chargen zp ZP_WORD:2 2.558139534883721
(byte*) main::chargen1
(byte*) main::chargen1#0 chargen1 zp ZP_WORD:6 1.6176470588235294
(byte*) main::charset4
(byte*) main::charset4#1 charset4 zp ZP_WORD:4 7.333333333333333
(byte*) main::charset4#10 charset4 zp ZP_WORD:4 0.7674418604651163
(byte*) main::charset4#10 charset4 zp ZP_WORD:4 0.7857142857142858
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 22.0
@ -83,8 +82,7 @@ reg byte x [ main::bits_gen#11 main::bits_gen#1 main::bits_gen#4 ]
reg byte x [ main::bits_gen#13 main::bits_gen#14 main::bits_gen#6 ]
reg byte x [ main::bits_gen#15 main::bits_gen#16 main::bits_gen#8 ]
reg byte x [ main::i#2 main::i#1 ]
zp ZP_WORD:6 [ main::chargen1#0 ]
zp ZP_BYTE:8 [ main::$1 main::$11 main::$21 main::$30 ]
zp ZP_BYTE:6 [ main::$1 main::$11 main::$21 main::$30 ]
reg byte a [ main::$2 ]
reg byte a [ main::$3 ]
reg byte a [ main::$4 ]

View File

@ -59,6 +59,7 @@ Constant (const byte) main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) main::$0 = SCREEN#0+$50
Successful SSA optimization Pass2ConstantIdentification
Eliminating unused constant (const byte) main::a#0
Successful SSA optimization PassNEliminateUnusedVars
Resolved ranged next value main::i#1 ← ++ main::a#1 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,$27)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) $28

View File

@ -157,6 +157,8 @@ Removing PHI-reference to removed block (main::toUpper1) in block main::toUpper1
if() condition always true - replacing block destination [0] if((const bool) main::toUpper1_bo#0) goto main::toUpper1_@2
if() condition always false - eliminating [3] if((const bool) main::toUpper2_bo#0) goto main::toUpper2_@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const bool) main::toUpper1_bo#0
Eliminating unused constant (const bool) main::toUpper2_bo#0
Successful SSA optimization PassNEliminateUnusedVars
Removing PHI-reference to removed block (main::toUpper2_@2) in block main::toUpper2_@1
Removing unused block main::toUpper2_@2
@ -168,6 +170,7 @@ Successful SSA optimization Pass2CullEmptyBlocks
Redundant Phi (byte) main::toUpper1_return#0 (const byte) main::toUpper1_res#1
Redundant Phi (byte) main::toUpper2_return#0 (const byte) main::toUpper2_ch#0
Successful SSA optimization Pass2RedundantPhiElimination
Eliminating unused constant (const byte) main::toUpper2_res#1
Successful SSA optimization PassNEliminateUnusedVars
Culled Empty Block (label) main::toUpper1_@1
Culled Empty Block (label) main::toUpper2_@1

View File

@ -13,9 +13,7 @@ main: {
.const line2_ysize = $f
.const line2_ch = '.'
.label sc = 2
.label plot1__0 = 6
.label line1_pos = 2
.label plot2__0 = 6
.label line2_pos = 2
lda #<$400
sta sc
@ -48,15 +46,9 @@ main: {
sta line1_pos+1
line1_b1:
lda line1_pos+1
clc
adc cur_line
sta plot1__0
lda #0
adc cur_line+1
sta plot1__0+1
tay
lda #line1_ch
ldy #0
sta (plot1__0),y
sta (cur_line),y
lda #line1_xadd
clc
adc line1_pos
@ -85,15 +77,9 @@ main: {
sta line2_pos+1
line2_b1:
lda line2_pos+1
clc
adc cur_line
sta plot2__0
lda #0
adc cur_line+1
sta plot2__0+1
tay
lda #line2_ch
ldy #0
sta (plot2__0),y
sta (cur_line),y
lda #line2_xadd
clc
adc line2_pos

View File

@ -26,34 +26,32 @@ main::line1_@1: scope:[main] from main::@2 main::line1
[11] (byte) main::plot1_xpos#0 ← > (word) main::line1_pos#2
to:main::plot1
main::plot1: scope:[main] from main::line1_@1
[12] (byte*) main::plot1_$0#0 ← (byte*) cur_line#13 + (byte) main::plot1_xpos#0
[13] *((byte*) main::plot1_$0#0) ← (const byte) main::line1_ch#0
[12] *((byte*) cur_line#13 + (byte) main::plot1_xpos#0) ← (const byte) main::line1_ch#0
to:main::@2
main::@2: scope:[main] from main::plot1
[14] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0
[15] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28
[16] (byte) main::line1_i#1 ← ++ (byte) main::line1_i#2
[17] if((byte) main::line1_i#1<(const byte) main::line1_ysize#0) goto main::line1_@1
[13] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0
[14] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28
[15] (byte) main::line1_i#1 ← ++ (byte) main::line1_i#2
[16] if((byte) main::line1_i#1<(const byte) main::line1_ysize#0) goto main::line1_@1
to:main::line2
main::line2: scope:[main] from main::@2
[18] phi()
[17] phi()
to:main::line2_@1
main::line2_@1: scope:[main] from main::@3 main::line2
[19] (byte) main::line2_i#2 ← phi( main::@3/(byte) main::line2_i#1 main::line2/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[19] (byte*) cur_line#10 ← phi( main::@3/(byte*) cur_line#11 main::line2/((byte*))(word/signed word/dword/signed dword) $400 )
[19] (word) main::line2_pos#2 ← phi( main::@3/(word) main::line2_pos#1 main::line2/(const byte) main::line2_xpos#0*(word/signed word/dword/signed dword) $100 )
[20] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2
[18] (byte) main::line2_i#2 ← phi( main::@3/(byte) main::line2_i#1 main::line2/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[18] (byte*) cur_line#10 ← phi( main::@3/(byte*) cur_line#11 main::line2/((byte*))(word/signed word/dword/signed dword) $400 )
[18] (word) main::line2_pos#2 ← phi( main::@3/(word) main::line2_pos#1 main::line2/(const byte) main::line2_xpos#0*(word/signed word/dword/signed dword) $100 )
[19] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2
to:main::plot2
main::plot2: scope:[main] from main::line2_@1
[21] (byte*) main::plot2_$0#0 ← (byte*) cur_line#10 + (byte) main::plot2_xpos#0
[22] *((byte*) main::plot2_$0#0) ← (const byte) main::line2_ch#0
[20] *((byte*) cur_line#10 + (byte) main::plot2_xpos#0) ← (const byte) main::line2_ch#0
to:main::@3
main::@3: scope:[main] from main::plot2
[23] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0
[24] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28
[25] (byte) main::line2_i#1 ← ++ (byte) main::line2_i#2
[26] if((byte) main::line2_i#1<(const byte) main::line2_ysize#0) goto main::line2_@1
[21] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0
[22] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28
[23] (byte) main::line2_i#1 ← ++ (byte) main::line2_i#2
[24] if((byte) main::line2_i#1<(const byte) main::line2_ysize#0) goto main::line2_@1
to:main::@return
main::@return: scope:[main] from main::@3
[27] return
[25] return
to:@return

View File

@ -337,7 +337,11 @@ Fixing inline constructor with main::$5 ← main::line2_xpos#0 w= 0
Successful SSA optimization Pass2FixInlineConstructors
Inferred type updated to word/signed word/dword/signed dword in (word~) main::$4 ← (const byte) main::line1_xpos#0 w= (byte/signed byte/word/signed word/dword/signed dword) 0
Inferred type updated to word/signed word/dword/signed dword in (word~) main::$5 ← (const byte) main::line2_xpos#0 w= (byte/signed byte/word/signed word/dword/signed dword) 0
Eliminating unused constant (const byte*) cur_line#15
Successful SSA optimization PassNEliminateUnusedVars
Converting *(pointer+n) to pointer[n] *((byte*) main::plot1_$0#0) ← (const byte) main::line1_ch#0 -- *(cur_line#13 + main::plot1_xpos#0)
Converting *(pointer+n) to pointer[n] *((byte*) main::plot2_$0#0) ← (const byte) main::line2_ch#0 -- *(cur_line#10 + main::plot2_xpos#0)
Successful SSA optimization Pass2InlineDerefIdx
Culled Empty Block (label) main::@2
Culled Empty Block (label) main::@3
Culled Empty Block (label) @1
@ -349,6 +353,9 @@ Successful SSA optimization Pass2AliasElimination
Constant (const word) main::line1_pos#0 = main::line1_xpos#0*$100+0
Constant (const word) main::line2_pos#0 = main::line2_xpos#0*$100+0
Successful SSA optimization Pass2ConstantIdentification
Eliminating unused variable (byte*) main::plot1_$0#0 and assignment [6] (byte*) main::plot1_$0#0 ← (byte*) cur_line#13 + (byte) main::plot1_xpos#0
Eliminating unused variable (byte*) main::plot2_$0#0 and assignment [14] (byte*) main::plot2_$0#0 ← (byte*) cur_line#10 + (byte) main::plot2_xpos#0
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte*) main::sc#0
Inlining constant with var siblings (const byte) main::line1_i#0
Inlining constant with var siblings (const byte) main::line2_i#0
@ -380,13 +387,13 @@ CALL GRAPH
Calls in [] to main:2
Created 7 initial phi equivalence classes
Coalesced [28] main::line2_pos#5 ← main::line2_pos#1
Coalesced [29] cur_line#17 ← cur_line#11
Coalesced [30] main::line2_i#5 ← main::line2_i#1
Coalesced [31] main::line1_pos#5 ← main::line1_pos#1
Coalesced [32] cur_line#16 ← cur_line#1
Coalesced [33] main::line1_i#5 ← main::line1_i#1
Coalesced [34] main::sc#3 ← main::sc#1
Coalesced [26] main::line2_pos#5 ← main::line2_pos#1
Coalesced [27] cur_line#17 ← cur_line#11
Coalesced [28] main::line2_i#5 ← main::line2_i#1
Coalesced [29] main::line1_pos#5 ← main::line1_pos#1
Coalesced [30] cur_line#16 ← cur_line#1
Coalesced [31] main::line1_i#5 ← main::line1_i#1
Coalesced [32] main::sc#3 ← main::sc#1
Coalesced down to 7 phi equivalence classes
Culled Empty Block (label) main::@9
Culled Empty Block (label) main::@8
@ -430,55 +437,53 @@ main::line1_@1: scope:[main] from main::@2 main::line1
[11] (byte) main::plot1_xpos#0 ← > (word) main::line1_pos#2
to:main::plot1
main::plot1: scope:[main] from main::line1_@1
[12] (byte*) main::plot1_$0#0 ← (byte*) cur_line#13 + (byte) main::plot1_xpos#0
[13] *((byte*) main::plot1_$0#0) ← (const byte) main::line1_ch#0
[12] *((byte*) cur_line#13 + (byte) main::plot1_xpos#0) ← (const byte) main::line1_ch#0
to:main::@2
main::@2: scope:[main] from main::plot1
[14] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0
[15] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28
[16] (byte) main::line1_i#1 ← ++ (byte) main::line1_i#2
[17] if((byte) main::line1_i#1<(const byte) main::line1_ysize#0) goto main::line1_@1
[13] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0
[14] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28
[15] (byte) main::line1_i#1 ← ++ (byte) main::line1_i#2
[16] if((byte) main::line1_i#1<(const byte) main::line1_ysize#0) goto main::line1_@1
to:main::line2
main::line2: scope:[main] from main::@2
[18] phi()
[17] phi()
to:main::line2_@1
main::line2_@1: scope:[main] from main::@3 main::line2
[19] (byte) main::line2_i#2 ← phi( main::@3/(byte) main::line2_i#1 main::line2/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[19] (byte*) cur_line#10 ← phi( main::@3/(byte*) cur_line#11 main::line2/((byte*))(word/signed word/dword/signed dword) $400 )
[19] (word) main::line2_pos#2 ← phi( main::@3/(word) main::line2_pos#1 main::line2/(const byte) main::line2_xpos#0*(word/signed word/dword/signed dword) $100 )
[20] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2
[18] (byte) main::line2_i#2 ← phi( main::@3/(byte) main::line2_i#1 main::line2/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[18] (byte*) cur_line#10 ← phi( main::@3/(byte*) cur_line#11 main::line2/((byte*))(word/signed word/dword/signed dword) $400 )
[18] (word) main::line2_pos#2 ← phi( main::@3/(word) main::line2_pos#1 main::line2/(const byte) main::line2_xpos#0*(word/signed word/dword/signed dword) $100 )
[19] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2
to:main::plot2
main::plot2: scope:[main] from main::line2_@1
[21] (byte*) main::plot2_$0#0 ← (byte*) cur_line#10 + (byte) main::plot2_xpos#0
[22] *((byte*) main::plot2_$0#0) ← (const byte) main::line2_ch#0
[20] *((byte*) cur_line#10 + (byte) main::plot2_xpos#0) ← (const byte) main::line2_ch#0
to:main::@3
main::@3: scope:[main] from main::plot2
[23] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0
[24] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28
[25] (byte) main::line2_i#1 ← ++ (byte) main::line2_i#2
[26] if((byte) main::line2_i#1<(const byte) main::line2_ysize#0) goto main::line2_@1
[21] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0
[22] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28
[23] (byte) main::line2_i#1 ← ++ (byte) main::line2_i#2
[24] if((byte) main::line2_i#1<(const byte) main::line2_ysize#0) goto main::line2_@1
to:main::@return
main::@return: scope:[main] from main::@3
[27] return
[25] return
to:@return
VARIABLE REGISTER WEIGHTS
(byte*) cur_line
(byte*) cur_line#1 7.333333333333333
(byte*) cur_line#10 6.6000000000000005
(byte*) cur_line#10 8.25
(byte*) cur_line#11 7.333333333333333
(byte*) cur_line#13 6.6000000000000005
(byte*) cur_line#13 8.25
(void()) main()
(byte~) main::line1_$0
(bool~) main::line1_$2
(byte) main::line1_ch
(byte) main::line1_i
(byte) main::line1_i#1 16.5
(byte) main::line1_i#2 3.6666666666666665
(byte) main::line1_i#2 4.4
(word) main::line1_pos
(word) main::line1_pos#1 5.5
(word) main::line1_pos#2 8.25
(word) main::line1_pos#2 11.0
(byte) main::line1_xadd
(byte) main::line1_xpos
(byte) main::line1_ysize
@ -487,20 +492,18 @@ VARIABLE REGISTER WEIGHTS
(byte) main::line2_ch
(byte) main::line2_i
(byte) main::line2_i#1 16.5
(byte) main::line2_i#2 3.6666666666666665
(byte) main::line2_i#2 4.4
(word) main::line2_pos
(word) main::line2_pos#1 5.5
(word) main::line2_pos#2 8.25
(word) main::line2_pos#2 11.0
(byte) main::line2_xadd
(byte) main::line2_xpos
(byte) main::line2_ysize
(byte*~) main::plot1_$0
(byte*) main::plot1_$0#0 22.0
(byte) main::plot1_ch
(byte) main::plot1_xpos
(byte) main::plot1_xpos#0 22.0
(byte*~) main::plot2_$0
(byte*) main::plot2_$0#0 22.0
(byte) main::plot2_ch
(byte) main::plot2_xpos
(byte) main::plot2_xpos#0 22.0
@ -517,9 +520,7 @@ Initial phi equivalence classes
[ cur_line#10 cur_line#11 ]
[ main::line2_i#2 main::line2_i#1 ]
Added variable main::plot1_xpos#0 to zero page equivalence class [ main::plot1_xpos#0 ]
Added variable main::plot1_$0#0 to zero page equivalence class [ main::plot1_$0#0 ]
Added variable main::plot2_xpos#0 to zero page equivalence class [ main::plot2_xpos#0 ]
Added variable main::plot2_$0#0 to zero page equivalence class [ main::plot2_$0#0 ]
Complete equivalence classes
[ main::sc#2 main::sc#1 ]
[ main::line1_pos#2 main::line1_pos#1 ]
@ -529,9 +530,7 @@ Complete equivalence classes
[ cur_line#10 cur_line#11 ]
[ main::line2_i#2 main::line2_i#1 ]
[ main::plot1_xpos#0 ]
[ main::plot1_$0#0 ]
[ main::plot2_xpos#0 ]
[ main::plot2_$0#0 ]
Allocated zp ZP_WORD:2 [ main::sc#2 main::sc#1 ]
Allocated zp ZP_WORD:4 [ main::line1_pos#2 main::line1_pos#1 ]
Allocated zp ZP_WORD:6 [ cur_line#13 cur_line#1 ]
@ -540,9 +539,7 @@ Allocated zp ZP_WORD:9 [ main::line2_pos#2 main::line2_pos#1 ]
Allocated zp ZP_WORD:11 [ cur_line#10 cur_line#11 ]
Allocated zp ZP_BYTE:13 [ main::line2_i#2 main::line2_i#1 ]
Allocated zp ZP_BYTE:14 [ main::plot1_xpos#0 ]
Allocated zp ZP_WORD:15 [ main::plot1_$0#0 ]
Allocated zp ZP_BYTE:17 [ main::plot2_xpos#0 ]
Allocated zp ZP_WORD:18 [ main::plot2_$0#0 ]
Allocated zp ZP_BYTE:15 [ main::plot2_xpos#0 ]
INITIAL ASM
//SEG0 File Comments
@ -583,11 +580,9 @@ main: {
.const line2_ch = '.'
.label sc = 2
.label plot1_xpos = $e
.label plot1__0 = $f
.label line1_pos = 4
.label line1_i = 8
.label plot2_xpos = $11
.label plot2__0 = $12
.label plot2_xpos = $f
.label line2_pos = 9
.label line2_i = $d
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
@ -657,22 +652,14 @@ main: {
jmp plot1
//SEG31 main::plot1
plot1:
//SEG32 [12] (byte*) main::plot1_$0#0 ← (byte*) cur_line#13 + (byte) main::plot1_xpos#0 -- pbuz1=pbuz2_plus_vbuz3
lda plot1_xpos
clc
adc cur_line
sta plot1__0
lda #0
adc cur_line+1
sta plot1__0+1
//SEG33 [13] *((byte*) main::plot1_$0#0) ← (const byte) main::line1_ch#0 -- _deref_pbuz1=vbuc1
//SEG32 [12] *((byte*) cur_line#13 + (byte) main::plot1_xpos#0) ← (const byte) main::line1_ch#0 -- pbuz1_derefidx_vbuz2=vbuc1
lda #line1_ch
ldy #0
sta (plot1__0),y
ldy plot1_xpos
sta (cur_line),y
jmp b2
//SEG34 main::@2
//SEG33 main::@2
b2:
//SEG35 [14] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
//SEG34 [13] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
lda #line1_xadd
clc
adc line1_pos
@ -680,7 +667,7 @@ main: {
bcc !+
inc line1_pos+1
!:
//SEG36 [15] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
//SEG35 [14] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
lda #$28
clc
adc cur_line
@ -688,63 +675,55 @@ main: {
bcc !+
inc cur_line+1
!:
//SEG37 [16] (byte) main::line1_i#1 ← ++ (byte) main::line1_i#2 -- vbuz1=_inc_vbuz1
//SEG36 [15] (byte) main::line1_i#1 ← ++ (byte) main::line1_i#2 -- vbuz1=_inc_vbuz1
inc line1_i
//SEG38 [17] if((byte) main::line1_i#1<(const byte) main::line1_ysize#0) goto main::line1_@1 -- vbuz1_lt_vbuc1_then_la1
//SEG37 [16] if((byte) main::line1_i#1<(const byte) main::line1_ysize#0) goto main::line1_@1 -- vbuz1_lt_vbuc1_then_la1
lda line1_i
cmp #line1_ysize
bcc line1_b1_from_b2
//SEG39 [18] phi from main::@2 to main::line2 [phi:main::@2->main::line2]
//SEG38 [17] phi from main::@2 to main::line2 [phi:main::@2->main::line2]
line2_from_b2:
jmp line2
//SEG40 main::line2
//SEG39 main::line2
line2:
//SEG41 [19] phi from main::line2 to main::line2_@1 [phi:main::line2->main::line2_@1]
//SEG40 [18] phi from main::line2 to main::line2_@1 [phi:main::line2->main::line2_@1]
line2_b1_from_line2:
//SEG42 [19] phi (byte) main::line2_i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::line2->main::line2_@1#0] -- vbuz1=vbuc1
//SEG41 [18] phi (byte) main::line2_i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::line2->main::line2_@1#0] -- vbuz1=vbuc1
lda #0
sta line2_i
//SEG43 [19] phi (byte*) cur_line#10 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:main::line2->main::line2_@1#1] -- pbuz1=pbuc1
//SEG42 [18] phi (byte*) cur_line#10 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:main::line2->main::line2_@1#1] -- pbuz1=pbuc1
lda #<$400
sta cur_line_10
lda #>$400
sta cur_line_10+1
//SEG44 [19] phi (word) main::line2_pos#2 = (const byte) main::line2_xpos#0*(word/signed word/dword/signed dword) $100 [phi:main::line2->main::line2_@1#2] -- vwuz1=vwuc1
//SEG43 [18] phi (word) main::line2_pos#2 = (const byte) main::line2_xpos#0*(word/signed word/dword/signed dword) $100 [phi:main::line2->main::line2_@1#2] -- vwuz1=vwuc1
lda #<line2_xpos*$100
sta line2_pos
lda #>line2_xpos*$100
sta line2_pos+1
jmp line2_b1
//SEG45 [19] phi from main::@3 to main::line2_@1 [phi:main::@3->main::line2_@1]
//SEG44 [18] phi from main::@3 to main::line2_@1 [phi:main::@3->main::line2_@1]
line2_b1_from_b3:
//SEG46 [19] phi (byte) main::line2_i#2 = (byte) main::line2_i#1 [phi:main::@3->main::line2_@1#0] -- register_copy
//SEG47 [19] phi (byte*) cur_line#10 = (byte*) cur_line#11 [phi:main::@3->main::line2_@1#1] -- register_copy
//SEG48 [19] phi (word) main::line2_pos#2 = (word) main::line2_pos#1 [phi:main::@3->main::line2_@1#2] -- register_copy
//SEG45 [18] phi (byte) main::line2_i#2 = (byte) main::line2_i#1 [phi:main::@3->main::line2_@1#0] -- register_copy
//SEG46 [18] phi (byte*) cur_line#10 = (byte*) cur_line#11 [phi:main::@3->main::line2_@1#1] -- register_copy
//SEG47 [18] phi (word) main::line2_pos#2 = (word) main::line2_pos#1 [phi:main::@3->main::line2_@1#2] -- register_copy
jmp line2_b1
//SEG49 main::line2_@1
//SEG48 main::line2_@1
line2_b1:
//SEG50 [20] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2 -- vbuz1=_hi_vwuz2
//SEG49 [19] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2 -- vbuz1=_hi_vwuz2
lda line2_pos+1
sta plot2_xpos
jmp plot2
//SEG51 main::plot2
//SEG50 main::plot2
plot2:
//SEG52 [21] (byte*) main::plot2_$0#0 ← (byte*) cur_line#10 + (byte) main::plot2_xpos#0 -- pbuz1=pbuz2_plus_vbuz3
lda plot2_xpos
clc
adc cur_line_10
sta plot2__0
lda #0
adc cur_line_10+1
sta plot2__0+1
//SEG53 [22] *((byte*) main::plot2_$0#0) ← (const byte) main::line2_ch#0 -- _deref_pbuz1=vbuc1
//SEG51 [20] *((byte*) cur_line#10 + (byte) main::plot2_xpos#0) ← (const byte) main::line2_ch#0 -- pbuz1_derefidx_vbuz2=vbuc1
lda #line2_ch
ldy #0
sta (plot2__0),y
ldy plot2_xpos
sta (cur_line_10),y
jmp b3
//SEG54 main::@3
//SEG52 main::@3
b3:
//SEG55 [23] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
//SEG53 [21] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
lda #line2_xadd
clc
adc line2_pos
@ -752,7 +731,7 @@ main: {
bcc !+
inc line2_pos+1
!:
//SEG56 [24] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
//SEG54 [22] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
lda #$28
clc
adc cur_line_11
@ -760,16 +739,16 @@ main: {
bcc !+
inc cur_line_11+1
!:
//SEG57 [25] (byte) main::line2_i#1 ← ++ (byte) main::line2_i#2 -- vbuz1=_inc_vbuz1
//SEG55 [23] (byte) main::line2_i#1 ← ++ (byte) main::line2_i#2 -- vbuz1=_inc_vbuz1
inc line2_i
//SEG58 [26] if((byte) main::line2_i#1<(const byte) main::line2_ysize#0) goto main::line2_@1 -- vbuz1_lt_vbuc1_then_la1
//SEG56 [24] if((byte) main::line2_i#1<(const byte) main::line2_ysize#0) goto main::line2_@1 -- vbuz1_lt_vbuc1_then_la1
lda line2_i
cmp #line2_ysize
bcc line2_b1_from_b3
jmp breturn
//SEG59 main::@return
//SEG57 main::@return
breturn:
//SEG60 [27] return
//SEG58 [25] return
rts
}
@ -778,54 +757,45 @@ Statement [6] *((byte*) main::sc#2) ← (byte) ' ' [ main::sc#2 ] ( main:2 [ mai
Statement [8] if((byte*) main::sc#1<(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto main::@1 [ main::sc#1 ] ( main:2 [ main::sc#1 ] ) always clobbers reg byte a
Statement [11] (byte) main::plot1_xpos#0 ← > (word) main::line1_pos#2 [ main::line1_pos#2 cur_line#13 main::line1_i#2 main::plot1_xpos#0 ] ( main:2 [ main::line1_pos#2 cur_line#13 main::line1_i#2 main::plot1_xpos#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ main::line1_i#2 main::line1_i#1 ]
Statement [12] (byte*) main::plot1_$0#0 ← (byte*) cur_line#13 + (byte) main::plot1_xpos#0 [ main::line1_pos#2 cur_line#13 main::line1_i#2 main::plot1_$0#0 ] ( main:2 [ main::line1_pos#2 cur_line#13 main::line1_i#2 main::plot1_$0#0 ] ) always clobbers reg byte a
Statement [13] *((byte*) main::plot1_$0#0) ← (const byte) main::line1_ch#0 [ main::line1_pos#2 cur_line#13 main::line1_i#2 ] ( main:2 [ main::line1_pos#2 cur_line#13 main::line1_i#2 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:8 [ main::line1_i#2 main::line1_i#1 ]
Statement [14] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0 [ cur_line#13 main::line1_i#2 main::line1_pos#1 ] ( main:2 [ cur_line#13 main::line1_i#2 main::line1_pos#1 ] ) always clobbers reg byte a
Statement [15] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line1_i#2 main::line1_pos#1 cur_line#1 ] ( main:2 [ main::line1_i#2 main::line1_pos#1 cur_line#1 ] ) always clobbers reg byte a
Statement [20] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_xpos#0 ] ( main:2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_xpos#0 ] ) always clobbers reg byte a
Statement [12] *((byte*) cur_line#13 + (byte) main::plot1_xpos#0) ← (const byte) main::line1_ch#0 [ main::line1_pos#2 cur_line#13 main::line1_i#2 ] ( main:2 [ main::line1_pos#2 cur_line#13 main::line1_i#2 ] ) always clobbers reg byte a
Statement [13] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0 [ cur_line#13 main::line1_i#2 main::line1_pos#1 ] ( main:2 [ cur_line#13 main::line1_i#2 main::line1_pos#1 ] ) always clobbers reg byte a
Statement [14] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line1_i#2 main::line1_pos#1 cur_line#1 ] ( main:2 [ main::line1_i#2 main::line1_pos#1 cur_line#1 ] ) always clobbers reg byte a
Statement [19] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_xpos#0 ] ( main:2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_xpos#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:13 [ main::line2_i#2 main::line2_i#1 ]
Statement [21] (byte*) main::plot2_$0#0 ← (byte*) cur_line#10 + (byte) main::plot2_xpos#0 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_$0#0 ] ( main:2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_$0#0 ] ) always clobbers reg byte a
Statement [22] *((byte*) main::plot2_$0#0) ← (const byte) main::line2_ch#0 [ main::line2_pos#2 cur_line#10 main::line2_i#2 ] ( main:2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:13 [ main::line2_i#2 main::line2_i#1 ]
Statement [23] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0 [ cur_line#10 main::line2_i#2 main::line2_pos#1 ] ( main:2 [ cur_line#10 main::line2_i#2 main::line2_pos#1 ] ) always clobbers reg byte a
Statement [24] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line2_i#2 main::line2_pos#1 cur_line#11 ] ( main:2 [ main::line2_i#2 main::line2_pos#1 cur_line#11 ] ) always clobbers reg byte a
Statement [20] *((byte*) cur_line#10 + (byte) main::plot2_xpos#0) ← (const byte) main::line2_ch#0 [ main::line2_pos#2 cur_line#10 main::line2_i#2 ] ( main:2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 ] ) always clobbers reg byte a
Statement [21] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0 [ cur_line#10 main::line2_i#2 main::line2_pos#1 ] ( main:2 [ cur_line#10 main::line2_i#2 main::line2_pos#1 ] ) always clobbers reg byte a
Statement [22] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line2_i#2 main::line2_pos#1 cur_line#11 ] ( main:2 [ main::line2_i#2 main::line2_pos#1 cur_line#11 ] ) always clobbers reg byte a
Statement [6] *((byte*) main::sc#2) ← (byte) ' ' [ main::sc#2 ] ( main:2 [ main::sc#2 ] ) always clobbers reg byte a reg byte y
Statement [8] if((byte*) main::sc#1<(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto main::@1 [ main::sc#1 ] ( main:2 [ main::sc#1 ] ) always clobbers reg byte a
Statement [11] (byte) main::plot1_xpos#0 ← > (word) main::line1_pos#2 [ main::line1_pos#2 cur_line#13 main::line1_i#2 main::plot1_xpos#0 ] ( main:2 [ main::line1_pos#2 cur_line#13 main::line1_i#2 main::plot1_xpos#0 ] ) always clobbers reg byte a
Statement [12] (byte*) main::plot1_$0#0 ← (byte*) cur_line#13 + (byte) main::plot1_xpos#0 [ main::line1_pos#2 cur_line#13 main::line1_i#2 main::plot1_$0#0 ] ( main:2 [ main::line1_pos#2 cur_line#13 main::line1_i#2 main::plot1_$0#0 ] ) always clobbers reg byte a
Statement [13] *((byte*) main::plot1_$0#0) ← (const byte) main::line1_ch#0 [ main::line1_pos#2 cur_line#13 main::line1_i#2 ] ( main:2 [ main::line1_pos#2 cur_line#13 main::line1_i#2 ] ) always clobbers reg byte a reg byte y
Statement [14] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0 [ cur_line#13 main::line1_i#2 main::line1_pos#1 ] ( main:2 [ cur_line#13 main::line1_i#2 main::line1_pos#1 ] ) always clobbers reg byte a
Statement [15] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line1_i#2 main::line1_pos#1 cur_line#1 ] ( main:2 [ main::line1_i#2 main::line1_pos#1 cur_line#1 ] ) always clobbers reg byte a
Statement [20] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_xpos#0 ] ( main:2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_xpos#0 ] ) always clobbers reg byte a
Statement [21] (byte*) main::plot2_$0#0 ← (byte*) cur_line#10 + (byte) main::plot2_xpos#0 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_$0#0 ] ( main:2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_$0#0 ] ) always clobbers reg byte a
Statement [22] *((byte*) main::plot2_$0#0) ← (const byte) main::line2_ch#0 [ main::line2_pos#2 cur_line#10 main::line2_i#2 ] ( main:2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 ] ) always clobbers reg byte a reg byte y
Statement [23] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0 [ cur_line#10 main::line2_i#2 main::line2_pos#1 ] ( main:2 [ cur_line#10 main::line2_i#2 main::line2_pos#1 ] ) always clobbers reg byte a
Statement [24] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line2_i#2 main::line2_pos#1 cur_line#11 ] ( main:2 [ main::line2_i#2 main::line2_pos#1 cur_line#11 ] ) always clobbers reg byte a
Statement [12] *((byte*) cur_line#13 + (byte) main::plot1_xpos#0) ← (const byte) main::line1_ch#0 [ main::line1_pos#2 cur_line#13 main::line1_i#2 ] ( main:2 [ main::line1_pos#2 cur_line#13 main::line1_i#2 ] ) always clobbers reg byte a
Statement [13] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0 [ cur_line#13 main::line1_i#2 main::line1_pos#1 ] ( main:2 [ cur_line#13 main::line1_i#2 main::line1_pos#1 ] ) always clobbers reg byte a
Statement [14] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line1_i#2 main::line1_pos#1 cur_line#1 ] ( main:2 [ main::line1_i#2 main::line1_pos#1 cur_line#1 ] ) always clobbers reg byte a
Statement [19] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_xpos#0 ] ( main:2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 main::plot2_xpos#0 ] ) always clobbers reg byte a
Statement [20] *((byte*) cur_line#10 + (byte) main::plot2_xpos#0) ← (const byte) main::line2_ch#0 [ main::line2_pos#2 cur_line#10 main::line2_i#2 ] ( main:2 [ main::line2_pos#2 cur_line#10 main::line2_i#2 ] ) always clobbers reg byte a
Statement [21] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0 [ cur_line#10 main::line2_i#2 main::line2_pos#1 ] ( main:2 [ cur_line#10 main::line2_i#2 main::line2_pos#1 ] ) always clobbers reg byte a
Statement [22] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line2_i#2 main::line2_pos#1 cur_line#11 ] ( main:2 [ main::line2_i#2 main::line2_pos#1 cur_line#11 ] ) always clobbers reg byte a
Potential registers zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] : zp ZP_WORD:2 ,
Potential registers zp ZP_WORD:4 [ main::line1_pos#2 main::line1_pos#1 ] : zp ZP_WORD:4 ,
Potential registers zp ZP_WORD:6 [ cur_line#13 cur_line#1 ] : zp ZP_WORD:6 ,
Potential registers zp ZP_BYTE:8 [ main::line1_i#2 main::line1_i#1 ] : zp ZP_BYTE:8 , reg byte x ,
Potential registers zp ZP_BYTE:8 [ main::line1_i#2 main::line1_i#1 ] : zp ZP_BYTE:8 , reg byte x , reg byte y ,
Potential registers zp ZP_WORD:9 [ main::line2_pos#2 main::line2_pos#1 ] : zp ZP_WORD:9 ,
Potential registers zp ZP_WORD:11 [ cur_line#10 cur_line#11 ] : zp ZP_WORD:11 ,
Potential registers zp ZP_BYTE:13 [ main::line2_i#2 main::line2_i#1 ] : zp ZP_BYTE:13 , reg byte x ,
Potential registers zp ZP_BYTE:13 [ main::line2_i#2 main::line2_i#1 ] : zp ZP_BYTE:13 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:14 [ main::plot1_xpos#0 ] : zp ZP_BYTE:14 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_WORD:15 [ main::plot1_$0#0 ] : zp ZP_WORD:15 ,
Potential registers zp ZP_BYTE:17 [ main::plot2_xpos#0 ] : zp ZP_BYTE:17 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_WORD:18 [ main::plot2_$0#0 ] : zp ZP_WORD:18 ,
Potential registers zp ZP_BYTE:15 [ main::plot2_xpos#0 ] : zp ZP_BYTE:15 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 33: zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] 22: zp ZP_BYTE:14 [ main::plot1_xpos#0 ] 22: zp ZP_WORD:15 [ main::plot1_$0#0 ] 22: zp ZP_BYTE:17 [ main::plot2_xpos#0 ] 22: zp ZP_WORD:18 [ main::plot2_$0#0 ] 20.17: zp ZP_BYTE:8 [ main::line1_i#2 main::line1_i#1 ] 20.17: zp ZP_BYTE:13 [ main::line2_i#2 main::line2_i#1 ] 13.75: zp ZP_WORD:4 [ main::line1_pos#2 main::line1_pos#1 ] 13.75: zp ZP_WORD:9 [ main::line2_pos#2 main::line2_pos#1 ]
Uplift Scope [] 13.93: zp ZP_WORD:6 [ cur_line#13 cur_line#1 ] 13.93: zp ZP_WORD:11 [ cur_line#10 cur_line#11 ]
Uplift Scope [main] 33: zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] 22: zp ZP_BYTE:14 [ main::plot1_xpos#0 ] 22: zp ZP_BYTE:15 [ main::plot2_xpos#0 ] 20.9: zp ZP_BYTE:8 [ main::line1_i#2 main::line1_i#1 ] 20.9: zp ZP_BYTE:13 [ main::line2_i#2 main::line2_i#1 ] 16.5: zp ZP_WORD:4 [ main::line1_pos#2 main::line1_pos#1 ] 16.5: zp ZP_WORD:9 [ main::line2_pos#2 main::line2_pos#1 ]
Uplift Scope [] 15.58: zp ZP_WORD:6 [ cur_line#13 cur_line#1 ] 15.58: zp ZP_WORD:11 [ cur_line#10 cur_line#11 ]
Uplifting [main] best 2704 combination zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] reg byte a [ main::plot1_xpos#0 ] zp ZP_WORD:15 [ main::plot1_$0#0 ] reg byte a [ main::plot2_xpos#0 ] zp ZP_WORD:18 [ main::plot2_$0#0 ] reg byte x [ main::line1_i#2 main::line1_i#1 ] reg byte x [ main::line2_i#2 main::line2_i#1 ] zp ZP_WORD:4 [ main::line1_pos#2 main::line1_pos#1 ] zp ZP_WORD:9 [ main::line2_pos#2 main::line2_pos#1 ]
Uplifting [] best 2704 combination zp ZP_WORD:6 [ cur_line#13 cur_line#1 ] zp ZP_WORD:11 [ cur_line#10 cur_line#11 ]
Uplifting [main] best 2384 combination zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] reg byte a [ main::plot1_xpos#0 ] reg byte a [ main::plot2_xpos#0 ] reg byte x [ main::line1_i#2 main::line1_i#1 ] reg byte x [ main::line2_i#2 main::line2_i#1 ] zp ZP_WORD:4 [ main::line1_pos#2 main::line1_pos#1 ] zp ZP_WORD:9 [ main::line2_pos#2 main::line2_pos#1 ]
Limited combination testing to 100 combinations of 144 possible.
Uplifting [] best 2384 combination zp ZP_WORD:6 [ cur_line#13 cur_line#1 ] zp ZP_WORD:11 [ cur_line#10 cur_line#11 ]
Coalescing zero page register [ zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] ] with [ zp ZP_WORD:4 [ main::line1_pos#2 main::line1_pos#1 ] ]
Coalescing zero page register [ zp ZP_WORD:2 [ main::sc#2 main::sc#1 main::line1_pos#2 main::line1_pos#1 ] ] with [ zp ZP_WORD:9 [ main::line2_pos#2 main::line2_pos#1 ] ]
Coalescing zero page register [ zp ZP_WORD:6 [ cur_line#13 cur_line#1 ] ] with [ zp ZP_WORD:11 [ cur_line#10 cur_line#11 ] ]
Coalescing zero page register [ zp ZP_WORD:15 [ main::plot1_$0#0 ] ] with [ zp ZP_WORD:18 [ main::plot2_$0#0 ] ]
Allocated (was zp ZP_WORD:6) zp ZP_WORD:4 [ cur_line#13 cur_line#1 cur_line#10 cur_line#11 ]
Allocated (was zp ZP_WORD:15) zp ZP_WORD:6 [ main::plot1_$0#0 main::plot2_$0#0 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
@ -863,9 +833,7 @@ main: {
.const line2_ysize = $f
.const line2_ch = '.'
.label sc = 2
.label plot1__0 = 6
.label line1_pos = 2
.label plot2__0 = 6
.label line2_pos = 2
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
@ -932,21 +900,14 @@ main: {
jmp plot1
//SEG31 main::plot1
plot1:
//SEG32 [12] (byte*) main::plot1_$0#0 ← (byte*) cur_line#13 + (byte) main::plot1_xpos#0 -- pbuz1=pbuz2_plus_vbuaa
clc
adc cur_line
sta plot1__0
lda #0
adc cur_line+1
sta plot1__0+1
//SEG33 [13] *((byte*) main::plot1_$0#0) ← (const byte) main::line1_ch#0 -- _deref_pbuz1=vbuc1
//SEG32 [12] *((byte*) cur_line#13 + (byte) main::plot1_xpos#0) ← (const byte) main::line1_ch#0 -- pbuz1_derefidx_vbuaa=vbuc1
tay
lda #line1_ch
ldy #0
sta (plot1__0),y
sta (cur_line),y
jmp b2
//SEG34 main::@2
//SEG33 main::@2
b2:
//SEG35 [14] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
//SEG34 [13] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
lda #line1_xadd
clc
adc line1_pos
@ -954,7 +915,7 @@ main: {
bcc !+
inc line1_pos+1
!:
//SEG36 [15] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
//SEG35 [14] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
lda #$28
clc
adc cur_line
@ -962,59 +923,52 @@ main: {
bcc !+
inc cur_line+1
!:
//SEG37 [16] (byte) main::line1_i#1 ← ++ (byte) main::line1_i#2 -- vbuxx=_inc_vbuxx
//SEG36 [15] (byte) main::line1_i#1 ← ++ (byte) main::line1_i#2 -- vbuxx=_inc_vbuxx
inx
//SEG38 [17] if((byte) main::line1_i#1<(const byte) main::line1_ysize#0) goto main::line1_@1 -- vbuxx_lt_vbuc1_then_la1
//SEG37 [16] if((byte) main::line1_i#1<(const byte) main::line1_ysize#0) goto main::line1_@1 -- vbuxx_lt_vbuc1_then_la1
cpx #line1_ysize
bcc line1_b1_from_b2
//SEG39 [18] phi from main::@2 to main::line2 [phi:main::@2->main::line2]
//SEG38 [17] phi from main::@2 to main::line2 [phi:main::@2->main::line2]
line2_from_b2:
jmp line2
//SEG40 main::line2
//SEG39 main::line2
line2:
//SEG41 [19] phi from main::line2 to main::line2_@1 [phi:main::line2->main::line2_@1]
//SEG40 [18] phi from main::line2 to main::line2_@1 [phi:main::line2->main::line2_@1]
line2_b1_from_line2:
//SEG42 [19] phi (byte) main::line2_i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::line2->main::line2_@1#0] -- vbuxx=vbuc1
//SEG41 [18] phi (byte) main::line2_i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::line2->main::line2_@1#0] -- vbuxx=vbuc1
ldx #0
//SEG43 [19] phi (byte*) cur_line#10 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:main::line2->main::line2_@1#1] -- pbuz1=pbuc1
//SEG42 [18] phi (byte*) cur_line#10 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:main::line2->main::line2_@1#1] -- pbuz1=pbuc1
lda #<$400
sta cur_line
lda #>$400
sta cur_line+1
//SEG44 [19] phi (word) main::line2_pos#2 = (const byte) main::line2_xpos#0*(word/signed word/dword/signed dword) $100 [phi:main::line2->main::line2_@1#2] -- vwuz1=vwuc1
//SEG43 [18] phi (word) main::line2_pos#2 = (const byte) main::line2_xpos#0*(word/signed word/dword/signed dword) $100 [phi:main::line2->main::line2_@1#2] -- vwuz1=vwuc1
lda #<line2_xpos*$100
sta line2_pos
lda #>line2_xpos*$100
sta line2_pos+1
jmp line2_b1
//SEG45 [19] phi from main::@3 to main::line2_@1 [phi:main::@3->main::line2_@1]
//SEG44 [18] phi from main::@3 to main::line2_@1 [phi:main::@3->main::line2_@1]
line2_b1_from_b3:
//SEG46 [19] phi (byte) main::line2_i#2 = (byte) main::line2_i#1 [phi:main::@3->main::line2_@1#0] -- register_copy
//SEG47 [19] phi (byte*) cur_line#10 = (byte*) cur_line#11 [phi:main::@3->main::line2_@1#1] -- register_copy
//SEG48 [19] phi (word) main::line2_pos#2 = (word) main::line2_pos#1 [phi:main::@3->main::line2_@1#2] -- register_copy
//SEG45 [18] phi (byte) main::line2_i#2 = (byte) main::line2_i#1 [phi:main::@3->main::line2_@1#0] -- register_copy
//SEG46 [18] phi (byte*) cur_line#10 = (byte*) cur_line#11 [phi:main::@3->main::line2_@1#1] -- register_copy
//SEG47 [18] phi (word) main::line2_pos#2 = (word) main::line2_pos#1 [phi:main::@3->main::line2_@1#2] -- register_copy
jmp line2_b1
//SEG49 main::line2_@1
//SEG48 main::line2_@1
line2_b1:
//SEG50 [20] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2 -- vbuaa=_hi_vwuz1
//SEG49 [19] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2 -- vbuaa=_hi_vwuz1
lda line2_pos+1
jmp plot2
//SEG51 main::plot2
//SEG50 main::plot2
plot2:
//SEG52 [21] (byte*) main::plot2_$0#0 ← (byte*) cur_line#10 + (byte) main::plot2_xpos#0 -- pbuz1=pbuz2_plus_vbuaa
clc
adc cur_line
sta plot2__0
lda #0
adc cur_line+1
sta plot2__0+1
//SEG53 [22] *((byte*) main::plot2_$0#0) ← (const byte) main::line2_ch#0 -- _deref_pbuz1=vbuc1
//SEG51 [20] *((byte*) cur_line#10 + (byte) main::plot2_xpos#0) ← (const byte) main::line2_ch#0 -- pbuz1_derefidx_vbuaa=vbuc1
tay
lda #line2_ch
ldy #0
sta (plot2__0),y
sta (cur_line),y
jmp b3
//SEG54 main::@3
//SEG52 main::@3
b3:
//SEG55 [23] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
//SEG53 [21] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
lda #line2_xadd
clc
adc line2_pos
@ -1022,7 +976,7 @@ main: {
bcc !+
inc line2_pos+1
!:
//SEG56 [24] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
//SEG54 [22] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
lda #$28
clc
adc cur_line
@ -1030,15 +984,15 @@ main: {
bcc !+
inc cur_line+1
!:
//SEG57 [25] (byte) main::line2_i#1 ← ++ (byte) main::line2_i#2 -- vbuxx=_inc_vbuxx
//SEG55 [23] (byte) main::line2_i#1 ← ++ (byte) main::line2_i#2 -- vbuxx=_inc_vbuxx
inx
//SEG58 [26] if((byte) main::line2_i#1<(const byte) main::line2_ysize#0) goto main::line2_@1 -- vbuxx_lt_vbuc1_then_la1
//SEG56 [24] if((byte) main::line2_i#1<(const byte) main::line2_ysize#0) goto main::line2_@1 -- vbuxx_lt_vbuc1_then_la1
cpx #line2_ysize
bcc line2_b1_from_b3
jmp breturn
//SEG59 main::@return
//SEG57 main::@return
breturn:
//SEG60 [27] return
//SEG58 [25] return
rts
}
@ -1098,9 +1052,9 @@ FINAL SYMBOL TABLE
(label) @end
(byte*) cur_line
(byte*) cur_line#1 cur_line zp ZP_WORD:4 7.333333333333333
(byte*) cur_line#10 cur_line zp ZP_WORD:4 6.6000000000000005
(byte*) cur_line#10 cur_line zp ZP_WORD:4 8.25
(byte*) cur_line#11 cur_line zp ZP_WORD:4 7.333333333333333
(byte*) cur_line#13 cur_line zp ZP_WORD:4 6.6000000000000005
(byte*) cur_line#13 cur_line zp ZP_WORD:4 8.25
(void()) main()
(label) main::@1
(label) main::@2
@ -1114,10 +1068,10 @@ FINAL SYMBOL TABLE
(const byte) main::line1_ch#0 line1_ch = (byte) '*'
(byte) main::line1_i
(byte) main::line1_i#1 reg byte x 16.5
(byte) main::line1_i#2 reg byte x 3.6666666666666665
(byte) main::line1_i#2 reg byte x 4.4
(word) main::line1_pos
(word) main::line1_pos#1 line1_pos zp ZP_WORD:2 5.5
(word) main::line1_pos#2 line1_pos zp ZP_WORD:2 8.25
(word) main::line1_pos#2 line1_pos zp ZP_WORD:2 11.0
(byte) main::line1_xadd
(const byte) main::line1_xadd#0 line1_xadd = (byte/signed byte/word/signed word/dword/signed dword) $40
(byte) main::line1_xpos
@ -1132,10 +1086,10 @@ FINAL SYMBOL TABLE
(const byte) main::line2_ch#0 line2_ch = (byte) '.'
(byte) main::line2_i
(byte) main::line2_i#1 reg byte x 16.5
(byte) main::line2_i#2 reg byte x 3.6666666666666665
(byte) main::line2_i#2 reg byte x 4.4
(word) main::line2_pos
(word) main::line2_pos#1 line2_pos zp ZP_WORD:2 5.5
(word) main::line2_pos#2 line2_pos zp ZP_WORD:2 8.25
(word) main::line2_pos#2 line2_pos zp ZP_WORD:2 11.0
(byte) main::line2_xadd
(const byte) main::line2_xadd#0 line2_xadd = (byte/word/signed word/dword/signed dword) $80
(byte) main::line2_xpos
@ -1144,13 +1098,11 @@ FINAL SYMBOL TABLE
(const byte) main::line2_ysize#0 line2_ysize = (byte/signed byte/word/signed word/dword/signed dword) $f
(label) main::plot1
(byte*~) main::plot1_$0
(byte*) main::plot1_$0#0 plot1_$0 zp ZP_WORD:6 22.0
(byte) main::plot1_ch
(byte) main::plot1_xpos
(byte) main::plot1_xpos#0 reg byte a 22.0
(label) main::plot2
(byte*~) main::plot2_$0
(byte*) main::plot2_$0#0 plot2_$0 zp ZP_WORD:6 22.0
(byte) main::plot2_ch
(byte) main::plot2_xpos
(byte) main::plot2_xpos#0 reg byte a 22.0
@ -1163,12 +1115,11 @@ zp ZP_WORD:4 [ cur_line#13 cur_line#1 cur_line#10 cur_line#11 ]
reg byte x [ main::line1_i#2 main::line1_i#1 ]
reg byte x [ main::line2_i#2 main::line2_i#1 ]
reg byte a [ main::plot1_xpos#0 ]
zp ZP_WORD:6 [ main::plot1_$0#0 main::plot2_$0#0 ]
reg byte a [ main::plot2_xpos#0 ]
FINAL ASSEMBLER
Score: 2356
Score: 2036
//SEG0 File Comments
// Inline functions in two levels
@ -1196,9 +1147,7 @@ main: {
.const line2_ysize = $f
.const line2_ch = '.'
.label sc = 2
.label plot1__0 = 6
.label line1_pos = 2
.label plot2__0 = 6
.label line2_pos = 2
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte*) main::sc#2 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:main->main::@1#0] -- pbuz1=pbuc1
@ -1252,19 +1201,12 @@ main: {
//SEG30 [11] (byte) main::plot1_xpos#0 ← > (word) main::line1_pos#2 -- vbuaa=_hi_vwuz1
lda line1_pos+1
//SEG31 main::plot1
//SEG32 [12] (byte*) main::plot1_$0#0 ← (byte*) cur_line#13 + (byte) main::plot1_xpos#0 -- pbuz1=pbuz2_plus_vbuaa
clc
adc cur_line
sta plot1__0
lda #0
adc cur_line+1
sta plot1__0+1
//SEG33 [13] *((byte*) main::plot1_$0#0) ← (const byte) main::line1_ch#0 -- _deref_pbuz1=vbuc1
//SEG32 [12] *((byte*) cur_line#13 + (byte) main::plot1_xpos#0) ← (const byte) main::line1_ch#0 -- pbuz1_derefidx_vbuaa=vbuc1
tay
lda #line1_ch
ldy #0
sta (plot1__0),y
//SEG34 main::@2
//SEG35 [14] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
sta (cur_line),y
//SEG33 main::@2
//SEG34 [13] (word) main::line1_pos#1 ← (word) main::line1_pos#2 + (const byte) main::line1_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
lda #line1_xadd
clc
adc line1_pos
@ -1272,7 +1214,7 @@ main: {
bcc !+
inc line1_pos+1
!:
//SEG36 [15] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
//SEG35 [14] (byte*) cur_line#1 ← (byte*) cur_line#13 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
lda #$28
clc
adc cur_line
@ -1280,48 +1222,41 @@ main: {
bcc !+
inc cur_line+1
!:
//SEG37 [16] (byte) main::line1_i#1 ← ++ (byte) main::line1_i#2 -- vbuxx=_inc_vbuxx
//SEG36 [15] (byte) main::line1_i#1 ← ++ (byte) main::line1_i#2 -- vbuxx=_inc_vbuxx
inx
//SEG38 [17] if((byte) main::line1_i#1<(const byte) main::line1_ysize#0) goto main::line1_@1 -- vbuxx_lt_vbuc1_then_la1
//SEG37 [16] if((byte) main::line1_i#1<(const byte) main::line1_ysize#0) goto main::line1_@1 -- vbuxx_lt_vbuc1_then_la1
cpx #line1_ysize
bcc line1_b1
//SEG39 [18] phi from main::@2 to main::line2 [phi:main::@2->main::line2]
//SEG40 main::line2
//SEG41 [19] phi from main::line2 to main::line2_@1 [phi:main::line2->main::line2_@1]
//SEG42 [19] phi (byte) main::line2_i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::line2->main::line2_@1#0] -- vbuxx=vbuc1
//SEG38 [17] phi from main::@2 to main::line2 [phi:main::@2->main::line2]
//SEG39 main::line2
//SEG40 [18] phi from main::line2 to main::line2_@1 [phi:main::line2->main::line2_@1]
//SEG41 [18] phi (byte) main::line2_i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::line2->main::line2_@1#0] -- vbuxx=vbuc1
ldx #0
//SEG43 [19] phi (byte*) cur_line#10 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:main::line2->main::line2_@1#1] -- pbuz1=pbuc1
//SEG42 [18] phi (byte*) cur_line#10 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:main::line2->main::line2_@1#1] -- pbuz1=pbuc1
lda #<$400
sta cur_line
lda #>$400
sta cur_line+1
//SEG44 [19] phi (word) main::line2_pos#2 = (const byte) main::line2_xpos#0*(word/signed word/dword/signed dword) $100 [phi:main::line2->main::line2_@1#2] -- vwuz1=vwuc1
//SEG43 [18] phi (word) main::line2_pos#2 = (const byte) main::line2_xpos#0*(word/signed word/dword/signed dword) $100 [phi:main::line2->main::line2_@1#2] -- vwuz1=vwuc1
lda #<line2_xpos*$100
sta line2_pos
lda #>line2_xpos*$100
sta line2_pos+1
//SEG45 [19] phi from main::@3 to main::line2_@1 [phi:main::@3->main::line2_@1]
//SEG46 [19] phi (byte) main::line2_i#2 = (byte) main::line2_i#1 [phi:main::@3->main::line2_@1#0] -- register_copy
//SEG47 [19] phi (byte*) cur_line#10 = (byte*) cur_line#11 [phi:main::@3->main::line2_@1#1] -- register_copy
//SEG48 [19] phi (word) main::line2_pos#2 = (word) main::line2_pos#1 [phi:main::@3->main::line2_@1#2] -- register_copy
//SEG49 main::line2_@1
//SEG44 [18] phi from main::@3 to main::line2_@1 [phi:main::@3->main::line2_@1]
//SEG45 [18] phi (byte) main::line2_i#2 = (byte) main::line2_i#1 [phi:main::@3->main::line2_@1#0] -- register_copy
//SEG46 [18] phi (byte*) cur_line#10 = (byte*) cur_line#11 [phi:main::@3->main::line2_@1#1] -- register_copy
//SEG47 [18] phi (word) main::line2_pos#2 = (word) main::line2_pos#1 [phi:main::@3->main::line2_@1#2] -- register_copy
//SEG48 main::line2_@1
line2_b1:
//SEG50 [20] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2 -- vbuaa=_hi_vwuz1
//SEG49 [19] (byte) main::plot2_xpos#0 ← > (word) main::line2_pos#2 -- vbuaa=_hi_vwuz1
lda line2_pos+1
//SEG51 main::plot2
//SEG52 [21] (byte*) main::plot2_$0#0 ← (byte*) cur_line#10 + (byte) main::plot2_xpos#0 -- pbuz1=pbuz2_plus_vbuaa
clc
adc cur_line
sta plot2__0
lda #0
adc cur_line+1
sta plot2__0+1
//SEG53 [22] *((byte*) main::plot2_$0#0) ← (const byte) main::line2_ch#0 -- _deref_pbuz1=vbuc1
//SEG50 main::plot2
//SEG51 [20] *((byte*) cur_line#10 + (byte) main::plot2_xpos#0) ← (const byte) main::line2_ch#0 -- pbuz1_derefidx_vbuaa=vbuc1
tay
lda #line2_ch
ldy #0
sta (plot2__0),y
//SEG54 main::@3
//SEG55 [23] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
sta (cur_line),y
//SEG52 main::@3
//SEG53 [21] (word) main::line2_pos#1 ← (word) main::line2_pos#2 + (const byte) main::line2_xadd#0 -- vwuz1=vwuz1_plus_vbuc1
lda #line2_xadd
clc
adc line2_pos
@ -1329,7 +1264,7 @@ main: {
bcc !+
inc line2_pos+1
!:
//SEG56 [24] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
//SEG54 [22] (byte*) cur_line#11 ← (byte*) cur_line#10 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- pbuz1=pbuz1_plus_vbuc1
lda #$28
clc
adc cur_line
@ -1337,13 +1272,13 @@ main: {
bcc !+
inc cur_line+1
!:
//SEG57 [25] (byte) main::line2_i#1 ← ++ (byte) main::line2_i#2 -- vbuxx=_inc_vbuxx
//SEG55 [23] (byte) main::line2_i#1 ← ++ (byte) main::line2_i#2 -- vbuxx=_inc_vbuxx
inx
//SEG58 [26] if((byte) main::line2_i#1<(const byte) main::line2_ysize#0) goto main::line2_@1 -- vbuxx_lt_vbuc1_then_la1
//SEG56 [24] if((byte) main::line2_i#1<(const byte) main::line2_ysize#0) goto main::line2_@1 -- vbuxx_lt_vbuc1_then_la1
cpx #line2_ysize
bcc line2_b1
//SEG59 main::@return
//SEG60 [27] return
//SEG57 main::@return
//SEG58 [25] return
rts
}

View File

@ -3,9 +3,9 @@
(label) @end
(byte*) cur_line
(byte*) cur_line#1 cur_line zp ZP_WORD:4 7.333333333333333
(byte*) cur_line#10 cur_line zp ZP_WORD:4 6.6000000000000005
(byte*) cur_line#10 cur_line zp ZP_WORD:4 8.25
(byte*) cur_line#11 cur_line zp ZP_WORD:4 7.333333333333333
(byte*) cur_line#13 cur_line zp ZP_WORD:4 6.6000000000000005
(byte*) cur_line#13 cur_line zp ZP_WORD:4 8.25
(void()) main()
(label) main::@1
(label) main::@2
@ -19,10 +19,10 @@
(const byte) main::line1_ch#0 line1_ch = (byte) '*'
(byte) main::line1_i
(byte) main::line1_i#1 reg byte x 16.5
(byte) main::line1_i#2 reg byte x 3.6666666666666665
(byte) main::line1_i#2 reg byte x 4.4
(word) main::line1_pos
(word) main::line1_pos#1 line1_pos zp ZP_WORD:2 5.5
(word) main::line1_pos#2 line1_pos zp ZP_WORD:2 8.25
(word) main::line1_pos#2 line1_pos zp ZP_WORD:2 11.0
(byte) main::line1_xadd
(const byte) main::line1_xadd#0 line1_xadd = (byte/signed byte/word/signed word/dword/signed dword) $40
(byte) main::line1_xpos
@ -37,10 +37,10 @@
(const byte) main::line2_ch#0 line2_ch = (byte) '.'
(byte) main::line2_i
(byte) main::line2_i#1 reg byte x 16.5
(byte) main::line2_i#2 reg byte x 3.6666666666666665
(byte) main::line2_i#2 reg byte x 4.4
(word) main::line2_pos
(word) main::line2_pos#1 line2_pos zp ZP_WORD:2 5.5
(word) main::line2_pos#2 line2_pos zp ZP_WORD:2 8.25
(word) main::line2_pos#2 line2_pos zp ZP_WORD:2 11.0
(byte) main::line2_xadd
(const byte) main::line2_xadd#0 line2_xadd = (byte/word/signed word/dword/signed dword) $80
(byte) main::line2_xpos
@ -49,13 +49,11 @@
(const byte) main::line2_ysize#0 line2_ysize = (byte/signed byte/word/signed word/dword/signed dword) $f
(label) main::plot1
(byte*~) main::plot1_$0
(byte*) main::plot1_$0#0 plot1_$0 zp ZP_WORD:6 22.0
(byte) main::plot1_ch
(byte) main::plot1_xpos
(byte) main::plot1_xpos#0 reg byte a 22.0
(label) main::plot2
(byte*~) main::plot2_$0
(byte*) main::plot2_$0#0 plot2_$0 zp ZP_WORD:6 22.0
(byte) main::plot2_ch
(byte) main::plot2_xpos
(byte) main::plot2_xpos#0 reg byte a 22.0
@ -68,5 +66,4 @@ zp ZP_WORD:4 [ cur_line#13 cur_line#1 cur_line#10 cur_line#11 ]
reg byte x [ main::line1_i#2 main::line1_i#1 ]
reg byte x [ main::line2_i#2 main::line2_i#1 ]
reg byte a [ main::plot1_xpos#0 ]
zp ZP_WORD:6 [ main::plot1_$0#0 main::plot2_$0#0 ]
reg byte a [ main::plot2_xpos#0 ]

View File

@ -182,6 +182,7 @@ Constant (const byte*) print_msg::msg#1 = print_msg::$2
Constant (const byte*) print_msg::msg#2 = print_msg::$3
Constant (const byte*) screen#20 = ((byte*))$400
Successful SSA optimization Pass2ConstantIdentification
Eliminating unused constant (const byte*) print_msg::msg#0
Successful SSA optimization PassNEliminateUnusedVars
Culled Empty Block (label) main::@2
Culled Empty Block (label) print_msg::@1

View File

@ -225,6 +225,7 @@ Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (table_driven_irq::@8) in block table_driven_irq::@return
if() condition always true - replacing block destination [26] if(true) goto table_driven_irq::@1
Successful SSA optimization Pass2ConstantIfs
Eliminating unused variable - keeping the phi block (byte) irq_idx#3
Successful SSA optimization PassNEliminateUnusedVars
Culled Empty Block (label) @4
Culled Empty Block (label) table_driven_irq::@4

View File

@ -165,6 +165,8 @@ Constant (const void()*) main::$0 = &irq
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [8] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused variable - keeping the phi block (bool) framedone#1
Eliminating unused variable - keeping the phi block (bool) framedone#10
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -1425,6 +1425,10 @@ Successful SSA optimization Pass2ConstantIfs
Fixing inline constructor with bitmap_clear::$3 ← *(bitmap_plot_yhi#0+0) w= *(bitmap_plot_ylo#0+0)
Fixing inline constructor with bitmap_plot::$3 ← *(bitmap_plot_yhi#0 + bitmap_plot::y#0) w= *(bitmap_plot_ylo#0 + bitmap_plot::y#0)
Successful SSA optimization Pass2FixInlineConstructors
Eliminating unused constant (const word) divr16s::dividendu#0
Eliminating unused constant (const word) divr16s::remu#0
Eliminating unused constant (const word) divr16s::divisoru#0
Eliminating unused constant (const bool) divr16s::$0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating Noop Cast (word) divr16s::remu#1 ← ((word)) (signed word~) divr16s::$10
Eliminating Noop Cast (word) divr16s::remu#2 ← ((word)) (signed word) divr16s::rem#0
@ -1495,6 +1499,7 @@ Successful SSA optimization Pass2ConditionalJumpSimplification
Inferred type updated to word in [68] (word/signed dword/dword~) point_init::$9 ← *((const word[SIZE#0]) x_start#0 + (byte) point_init::$20) << (byte/signed byte/word/signed word/dword/signed dword) 4
Inferred type updated to word in [72] (word/signed dword/dword~) point_init::$11 ← (word~) point_init::$10 << (byte/signed byte/word/signed word/dword/signed dword) 4
Inferred type updated to byte in [84] (byte/signed word/word/dword/signed dword~) point_init::$16 ← (byte~) point_init::$15 >> (byte/signed byte/word/signed word/dword/signed dword) 4
Eliminating unused constant (const byte) SIZEOF_WORD
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const word) divr16u::quotient#0
Inlining constant with var siblings (const byte) divr16u::i#0

View File

@ -1277,7 +1277,9 @@ Successful SSA optimization Pass2ConstantStringConsolidation
Fixing inline constructor with lin16u_gen::$8 ← lin16u_gen::stepi#0 dw= lin16u_gen::stepf#0
Fixing inline constructor with lin16u_gen::$9 ← lin16u_gen::min#3 dw= 0
Successful SSA optimization Pass2FixInlineConstructors
Eliminating unused variable - keeping the phi block (word) rem16u#22
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const word) rem16u#0
Successful SSA optimization PassNEliminateUnusedVars
Resolved ranged next value divr16u::i#1 ← ++ divr16u::i#2 to ++
Resolved ranged comparison value if(divr16u::i#1!=rangelast(0,$f)) goto divr16u::@1 to (byte/signed byte/word/signed word/dword/signed dword) $10

View File

@ -89,6 +89,9 @@ Consolidated array index constant in assignment *(SCREEN#0+9 + main::$1)
Successful SSA optimization Pass2ConstantAdditionElimination
Inferred type updated to byte in [3] (byte/signed word/word/dword/signed dword~) main::$0 ← (byte) main::i#2
Inferred type updated to byte in [5] (byte/signed word/word/dword/signed dword~) main::$1 ← (byte) main::i#2
Eliminating unused constant (const string) $2
Eliminating unused constant (const string) $3
Eliminating unused constant (const string) $0
Successful SSA optimization PassNEliminateUnusedVars
Resolved ranged next value main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,3)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 4

View File

@ -129,6 +129,7 @@ Constant (const void()*) main::$0 = &irq
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [3] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused variable - keeping the phi block (byte) col#10
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -767,6 +767,8 @@ Constant (const byte*) print_screen#1 = print_set_screen::screen#0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [27] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused variable - keeping the phi block (byte*) print_screen#11
Eliminating unused variable - keeping the phi block (byte*) print_line_cursor#11
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks

View File

@ -1480,8 +1480,17 @@ if() condition always true - replacing block destination [106] if(true) goto loo
Successful SSA optimization Pass2ConstantIfs
Inferred type updated to byte in [9] (byte/signed word/word/dword/signed dword~) plexSort::$2 ← (byte) plexSort::m#2
Inferred type updated to byte in [16] (byte/signed word/word/dword/signed dword~) plexSort::$5 ← (byte) plexSort::s#3
Eliminating unused variable - keeping the phi block (bool) framedone#10
Eliminating unused variable - keeping the phi block (byte) plex_show_idx#10
Eliminating unused variable - keeping the phi block (byte) plex_sprite_idx#10
Eliminating unused variable - keeping the phi block (byte) plex_sprite_msb#11
Eliminating unused variable - keeping the phi block (byte) plex_free_next#10
Eliminating unused constant (const byte) plex_irq::rasterY#0
Eliminating unused constant (const byte*) PLEX_SCREEN_PTR#1
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const byte*) plexInit::screen#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const byte*) SCREEN#0
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block loop::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
@ -1525,6 +1534,7 @@ Simple Condition (bool~) plex_irq::$3 [97] if((byte) plex_show_idx#16<(const byt
Simple Condition (bool~) plexSort::$7 [121] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3
Simple Condition (bool~) plex_irq::$5 [122] if((byte) plex_irq::plexFreeNextYpos1_return#0<(byte/signed word/word/dword/signed dword~) plex_irq::$4) goto plex_irq::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Eliminating unused constant (const byte) SIZEOF_WORD
Successful SSA optimization PassNEliminateUnusedVars
Alias candidate removed (volatile)(byte) plex_free_next#2 = (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0
Alias candidate removed (volatile)(byte) plex_sprite_idx#3 = (byte/word/dword~) plexShowSprite::$6

View File

@ -275,6 +275,7 @@ Self Phi Eliminated (byte*) gen_char3::dst#5
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) gen_char3::dst#5 (byte*) gen_char3::dst#0
Successful SSA optimization Pass2RedundantPhiElimination
Eliminating unused constant (const byte) SIZEOF_WORD
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) main::c#0
Inlining constant with var siblings (const byte*) main::charset#0

View File

@ -152,6 +152,7 @@ Successful SSA optimization Pass2ConstantIdentification
Removed zero-constant in assignment fill::$1
if() condition always true - replacing block destination [7] if((const byte) fill::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto fill::@2_1
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte/signed word/word/dword/signed dword) fill::$0
Successful SSA optimization PassNEliminateUnusedVars
Alias (byte*) fill::screen#4 = (byte*~) fill::$1
Successful SSA optimization Pass2AliasElimination
@ -174,6 +175,7 @@ Successful SSA optimization Pass2ConstantIdentification
Removing PHI-reference to removed block (fill::@2_2) in block fill::@2_3
if() condition always false - eliminating [11] if((const byte) fill::j#6!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto fill::@2_3
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) fill::j#6
Successful SSA optimization PassNEliminateUnusedVars
Eliminating variable (byte) fill::j#7 from unused block fill::@2_3
Eliminating variable (byte/signed word/word/dword/signed dword~) fill::$8 from unused block fill::@2_3

View File

@ -150,6 +150,8 @@ Constant (const byte) line#0 = $40
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) main::$3 = SCREEN#0+$28
Successful SSA optimization Pass2ConstantIdentification
Eliminating unused variable (byte) ch#2 and assignment [1] (byte) ch#2 ← ++ (byte) line#13
Eliminating unused variable (byte) ch#4 and assignment [3] (byte) ch#4 ← ++ (byte) line#13
Successful SSA optimization PassNEliminateUnusedVars
Culled Empty Block (label) @3
Successful SSA optimization Pass2CullEmptyBlocks

View File

@ -8,21 +8,10 @@ main: {
// Increment on a const named pointer
.label BGCOL = $d020
.label sc2 = screen+$51
.label _15 = 2
.label _18 = 2
.label _20 = 4
ldx #0
// RValue pointer expression (variable)
b1:
txa
clc
adc #<screen+$28
sta _15
lda #>screen+$28
adc #0
sta _15+1
ldy #0
lda (_15),y
lda screen+$28,x
sta screen,x
inx
cpx #$b
@ -35,23 +24,8 @@ main: {
ldx #0
// LValue pointer expression (variable - directly)
b3:
txa
clc
adc #<screen+$a0
sta _18
lda #>screen+$a0
adc #0
sta _18+1
txa
clc
adc #<screen+$c8
sta _20
lda #>screen+$c8
adc #0
sta _20+1
ldy #0
lda (_20),y
sta (_18),y
lda screen+$c8,x
sta screen+$a0,x
inx
cpx #$b
bne b3

View File

@ -12,28 +12,25 @@ main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
[5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) main::i#1 )
[6] (byte*~) main::$15 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2
[7] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((byte*~) main::$15)
[8] (byte) main::i#1 ← ++ (byte) main::i#2
[9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@1
[6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2)
[7] (byte) main::i#1 ← ++ (byte) main::i#2
[8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[10] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79)
[11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a)
[9] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79)
[10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a)
to:main::@3
main::@3: scope:[main] from main::@2 main::@3
[12] (byte) main::j#2 ← phi( main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@3/(byte) main::j#1 )
[13] (byte*~) main::$18 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2
[14] (byte*~) main::$20 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2
[15] *((byte*~) main::$18) ← *((byte*~) main::$20)
[16] (byte) main::j#1 ← ++ (byte) main::j#2
[17] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@3
[11] (byte) main::j#2 ← phi( main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@3/(byte) main::j#1 )
[12] *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2) ← *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2)
[13] (byte) main::j#1 ← ++ (byte) main::j#2
[14] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@3
to:main::@4
main::@4: scope:[main] from main::@3
[18] *(((byte*))(word/dword/signed dword) $d020) ← ++ *(((byte*))(word/dword/signed dword) $d020)
[19] *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) ← -- *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21)
[20] *((const byte*) main::BGCOL#0) ← ++ *((const byte*) main::BGCOL#0)
[15] *(((byte*))(word/dword/signed dword) $d020) ← ++ *(((byte*))(word/dword/signed dword) $d020)
[16] *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) ← -- *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21)
[17] *((const byte*) main::BGCOL#0) ← ++ *((const byte*) main::BGCOL#0)
to:main::@return
main::@return: scope:[main] from main::@4
[21] return
[18] return
to:@return

View File

@ -125,6 +125,14 @@ Resolved ranged next value main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,$a)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) $b
Resolved ranged next value main::j#1 ← ++ main::j#2 to ++
Resolved ranged comparison value if(main::j#1!=rangelast(0,$a)) goto main::@3 to (byte/signed byte/word/signed word/dword/signed dword) $b
Converting *(pointer+n) to pointer[n] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((byte*~) main::$15) -- *(main::$14 + main::i#2)
Converting *(pointer+n) to pointer[n] *((byte*~) main::$18) ← *((byte*~) main::$20) -- *(main::$19 + main::j#2)
Converting *(pointer+n) to pointer[n] *((byte*~) main::$18) ← *((const byte*) main::$19 + (byte) main::j#2) -- *(main::$17 + main::j#2)
Successful SSA optimization Pass2InlineDerefIdx
Eliminating unused variable (byte*~) main::$15 and assignment [1] (byte*~) main::$15 ← (const byte*) main::$14 + (byte) main::i#2
Eliminating unused variable (byte*~) main::$18 and assignment [8] (byte*~) main::$18 ← (const byte*) main::$17 + (byte) main::j#2
Eliminating unused variable (byte*~) main::$20 and assignment [9] (byte*~) main::$20 ← (const byte*) main::$19 + (byte) main::j#2
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) main::j#0
Constant inlined main::$2 = (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79
@ -149,8 +157,8 @@ CALL GRAPH
Calls in [] to main:2
Created 2 initial phi equivalence classes
Coalesced [22] main::j#3 ← main::j#1
Coalesced [23] main::i#3 ← main::i#1
Coalesced [19] main::j#3 ← main::j#1
Coalesced [20] main::i#3 ← main::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@5
@ -174,65 +182,50 @@ main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
[5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) main::i#1 )
[6] (byte*~) main::$15 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2
[7] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((byte*~) main::$15)
[8] (byte) main::i#1 ← ++ (byte) main::i#2
[9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@1
[6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2)
[7] (byte) main::i#1 ← ++ (byte) main::i#2
[8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[10] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79)
[11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a)
[9] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79)
[10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a)
to:main::@3
main::@3: scope:[main] from main::@2 main::@3
[12] (byte) main::j#2 ← phi( main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@3/(byte) main::j#1 )
[13] (byte*~) main::$18 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2
[14] (byte*~) main::$20 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2
[15] *((byte*~) main::$18) ← *((byte*~) main::$20)
[16] (byte) main::j#1 ← ++ (byte) main::j#2
[17] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@3
[11] (byte) main::j#2 ← phi( main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@3/(byte) main::j#1 )
[12] *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2) ← *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2)
[13] (byte) main::j#1 ← ++ (byte) main::j#2
[14] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@3
to:main::@4
main::@4: scope:[main] from main::@3
[18] *(((byte*))(word/dword/signed dword) $d020) ← ++ *(((byte*))(word/dword/signed dword) $d020)
[19] *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) ← -- *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21)
[20] *((const byte*) main::BGCOL#0) ← ++ *((const byte*) main::BGCOL#0)
[15] *(((byte*))(word/dword/signed dword) $d020) ← ++ *(((byte*))(word/dword/signed dword) $d020)
[16] *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) ← -- *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21)
[17] *((const byte*) main::BGCOL#0) ← ++ *((const byte*) main::BGCOL#0)
to:main::@return
main::@return: scope:[main] from main::@4
[21] return
[18] return
to:@return
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte*~) main::$15 22.0
(byte*~) main::$18 11.0
(byte*~) main::$20 22.0
(byte*) main::BGCOL
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 14.666666666666666
(byte) main::i#2 22.0
(byte) main::j
(byte) main::j#1 16.5
(byte) main::j#2 11.0
(byte) main::j#2 22.0
(byte*) main::sc2
(byte*) main::screen
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#2 main::j#1 ]
Added variable main::$15 to zero page equivalence class [ main::$15 ]
Added variable main::$18 to zero page equivalence class [ main::$18 ]
Added variable main::$20 to zero page equivalence class [ main::$20 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#2 main::j#1 ]
[ main::$15 ]
[ main::$18 ]
[ main::$20 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::j#2 main::j#1 ]
Allocated zp ZP_WORD:4 [ main::$15 ]
Allocated zp ZP_WORD:6 [ main::$18 ]
Allocated zp ZP_WORD:8 [ main::$20 ]
INITIAL ASM
//SEG0 File Comments
@ -265,9 +258,6 @@ main: {
// Increment on a const named pointer
.label BGCOL = $d020
.label sc2 = screen+$51
.label _15 = 4
.label _18 = 6
.label _20 = 8
.label i = 2
.label j = 3
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
@ -283,125 +273,85 @@ main: {
jmp b1
//SEG15 main::@1
b1:
//SEG16 [6] (byte*~) main::$15 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2 -- pbuz1=pbuc1_plus_vbuz2
lda i
clc
adc #<screen+$28
sta _15
lda #>screen+$28
adc #0
sta _15+1
//SEG17 [7] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((byte*~) main::$15) -- pbuc1_derefidx_vbuz1=_deref_pbuz2
ldx i
ldy #0
lda (_15),y
sta screen,x
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
//SEG16 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy i
lda screen+$28,y
sta screen,y
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$b
cmp i
bne b1_from_b1
jmp b2
//SEG20 main::@2
//SEG19 main::@2
b2:
//SEG21 [10] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79) -- _deref_pbuc1=_deref_pbuc2
//SEG20 [9] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79) -- _deref_pbuc1=_deref_pbuc2
lda screen+$79
sta sc2
//SEG22 [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a) -- _deref_pbuc1=_deref_pbuc2
//SEG21 [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a) -- _deref_pbuc1=_deref_pbuc2
// LValue pointer expression (constant - directly)
lda screen+$7a
sta screen+$52
//SEG23 [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG22 [11] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b3_from_b2:
//SEG24 [12] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->main::@3#0] -- vbuz1=vbuc1
//SEG23 [11] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->main::@3#0] -- vbuz1=vbuc1
lda #0
sta j
jmp b3
// LValue pointer expression (variable - directly)
//SEG25 [12] phi from main::@3 to main::@3 [phi:main::@3->main::@3]
//SEG24 [11] phi from main::@3 to main::@3 [phi:main::@3->main::@3]
b3_from_b3:
//SEG26 [12] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@3->main::@3#0] -- register_copy
//SEG25 [11] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@3->main::@3#0] -- register_copy
jmp b3
//SEG27 main::@3
//SEG26 main::@3
b3:
//SEG28 [13] (byte*~) main::$18 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2 -- pbuz1=pbuc1_plus_vbuz2
lda j
clc
adc #<screen+$a0
sta _18
lda #>screen+$a0
adc #0
sta _18+1
//SEG29 [14] (byte*~) main::$20 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2 -- pbuz1=pbuc1_plus_vbuz2
lda j
clc
adc #<screen+$c8
sta _20
lda #>screen+$c8
adc #0
sta _20+1
//SEG30 [15] *((byte*~) main::$18) ← *((byte*~) main::$20) -- _deref_pbuz1=_deref_pbuz2
ldy #0
lda (_20),y
ldy #0
sta (_18),y
//SEG31 [16] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuz1=_inc_vbuz1
//SEG27 [12] *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2) ← *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy j
lda screen+$c8,y
sta screen+$a0,y
//SEG28 [13] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuz1=_inc_vbuz1
inc j
//SEG32 [17] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@3 -- vbuz1_neq_vbuc1_then_la1
//SEG29 [14] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@3 -- vbuz1_neq_vbuc1_then_la1
lda #$b
cmp j
bne b3_from_b3
jmp b4
//SEG33 main::@4
//SEG30 main::@4
b4:
//SEG34 [18] *(((byte*))(word/dword/signed dword) $d020) ← ++ *(((byte*))(word/dword/signed dword) $d020) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG31 [15] *(((byte*))(word/dword/signed dword) $d020) ← ++ *(((byte*))(word/dword/signed dword) $d020) -- _deref_pbuc1=_inc__deref_pbuc1
inc $d020
//SEG35 [19] *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) ← -- *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) -- _deref_pbuc1=_dec__deref_pbuc1
//SEG32 [16] *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) ← -- *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) -- _deref_pbuc1=_dec__deref_pbuc1
dec $d000+$21
//SEG36 [20] *((const byte*) main::BGCOL#0) ← ++ *((const byte*) main::BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG33 [17] *((const byte*) main::BGCOL#0) ← ++ *((const byte*) main::BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
jmp breturn
//SEG37 main::@return
//SEG34 main::@return
breturn:
//SEG38 [21] return
//SEG35 [18] return
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (byte*~) main::$15 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2 [ main::i#2 main::$15 ] ( main:2 [ main::i#2 main::$15 ] ) always clobbers reg byte a
Statement [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2) [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Statement [7] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((byte*~) main::$15) [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Statement [10] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [13] (byte*~) main::$18 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2 [ main::j#2 main::$18 ] ( main:2 [ main::j#2 main::$18 ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [12] *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2) ← *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2) [ main::j#2 ] ( main:2 [ main::j#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::j#2 main::j#1 ]
Statement [14] (byte*~) main::$20 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2 [ main::j#2 main::$18 main::$20 ] ( main:2 [ main::j#2 main::$18 main::$20 ] ) always clobbers reg byte a
Statement [15] *((byte*~) main::$18) ← *((byte*~) main::$20) [ main::j#2 ] ( main:2 [ main::j#2 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:3 [ main::j#2 main::j#1 ]
Statement [6] (byte*~) main::$15 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2 [ main::i#2 main::$15 ] ( main:2 [ main::i#2 main::$15 ] ) always clobbers reg byte a
Statement [7] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((byte*~) main::$15) [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y
Statement [10] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [13] (byte*~) main::$18 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2 [ main::j#2 main::$18 ] ( main:2 [ main::j#2 main::$18 ] ) always clobbers reg byte a
Statement [14] (byte*~) main::$20 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2 [ main::j#2 main::$18 main::$20 ] ( main:2 [ main::j#2 main::$18 main::$20 ] ) always clobbers reg byte a
Statement [15] *((byte*~) main::$18) ← *((byte*~) main::$20) [ main::j#2 ] ( main:2 [ main::j#2 ] ) always clobbers reg byte a reg byte y
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x ,
Potential registers zp ZP_BYTE:3 [ main::j#2 main::j#1 ] : zp ZP_BYTE:3 , reg byte x ,
Potential registers zp ZP_WORD:4 [ main::$15 ] : zp ZP_WORD:4 ,
Potential registers zp ZP_WORD:6 [ main::$18 ] : zp ZP_WORD:6 ,
Potential registers zp ZP_WORD:8 [ main::$20 ] : zp ZP_WORD:8 ,
Statement [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2) [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [12] *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2) ← *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2) [ main::j#2 ] ( main:2 [ main::j#2 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::j#2 main::j#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 31.17: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 27.5: zp ZP_BYTE:3 [ main::j#2 main::j#1 ] 22: zp ZP_WORD:4 [ main::$15 ] 22: zp ZP_WORD:8 [ main::$20 ] 11: zp ZP_WORD:6 [ main::$18 ]
Uplift Scope [main] 38.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 38.5: zp ZP_BYTE:3 [ main::j#2 main::j#1 ]
Uplift Scope []
Uplifting [main] best 1165 combination reg byte x [ main::i#2 main::i#1 ] reg byte x [ main::j#2 main::j#1 ] zp ZP_WORD:4 [ main::$15 ] zp ZP_WORD:8 [ main::$20 ] zp ZP_WORD:6 [ main::$18 ]
Uplifting [] best 1165 combination
Coalescing zero page register [ zp ZP_WORD:4 [ main::$15 ] ] with [ zp ZP_WORD:6 [ main::$18 ] ]
Allocated (was zp ZP_WORD:4) zp ZP_WORD:2 [ main::$15 main::$18 ]
Allocated (was zp ZP_WORD:8) zp ZP_WORD:4 [ main::$20 ]
Uplifting [main] best 595 combination reg byte x [ main::i#2 main::i#1 ] reg byte x [ main::j#2 main::j#1 ]
Uplifting [] best 595 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
@ -434,9 +384,6 @@ main: {
// Increment on a const named pointer
.label BGCOL = $d020
.label sc2 = screen+$51
.label _15 = 2
.label _18 = 2
.label _20 = 4
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
@ -449,84 +396,57 @@ main: {
jmp b1
//SEG15 main::@1
b1:
//SEG16 [6] (byte*~) main::$15 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2 -- pbuz1=pbuc1_plus_vbuxx
txa
clc
adc #<screen+$28
sta _15
lda #>screen+$28
adc #0
sta _15+1
//SEG17 [7] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((byte*~) main::$15) -- pbuc1_derefidx_vbuxx=_deref_pbuz1
ldy #0
lda (_15),y
//SEG16 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda screen+$28,x
sta screen,x
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$b
bne b1_from_b1
jmp b2
//SEG20 main::@2
//SEG19 main::@2
b2:
//SEG21 [10] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79) -- _deref_pbuc1=_deref_pbuc2
//SEG20 [9] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79) -- _deref_pbuc1=_deref_pbuc2
lda screen+$79
sta sc2
//SEG22 [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a) -- _deref_pbuc1=_deref_pbuc2
//SEG21 [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a) -- _deref_pbuc1=_deref_pbuc2
// LValue pointer expression (constant - directly)
lda screen+$7a
sta screen+$52
//SEG23 [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG22 [11] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b3_from_b2:
//SEG24 [12] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->main::@3#0] -- vbuxx=vbuc1
//SEG23 [11] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->main::@3#0] -- vbuxx=vbuc1
ldx #0
jmp b3
// LValue pointer expression (variable - directly)
//SEG25 [12] phi from main::@3 to main::@3 [phi:main::@3->main::@3]
//SEG24 [11] phi from main::@3 to main::@3 [phi:main::@3->main::@3]
b3_from_b3:
//SEG26 [12] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@3->main::@3#0] -- register_copy
//SEG25 [11] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@3->main::@3#0] -- register_copy
jmp b3
//SEG27 main::@3
//SEG26 main::@3
b3:
//SEG28 [13] (byte*~) main::$18 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2 -- pbuz1=pbuc1_plus_vbuxx
txa
clc
adc #<screen+$a0
sta _18
lda #>screen+$a0
adc #0
sta _18+1
//SEG29 [14] (byte*~) main::$20 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2 -- pbuz1=pbuc1_plus_vbuxx
txa
clc
adc #<screen+$c8
sta _20
lda #>screen+$c8
adc #0
sta _20+1
//SEG30 [15] *((byte*~) main::$18) ← *((byte*~) main::$20) -- _deref_pbuz1=_deref_pbuz2
ldy #0
lda (_20),y
ldy #0
sta (_18),y
//SEG31 [16] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuxx=_inc_vbuxx
//SEG27 [12] *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2) ← *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda screen+$c8,x
sta screen+$a0,x
//SEG28 [13] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuxx=_inc_vbuxx
inx
//SEG32 [17] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@3 -- vbuxx_neq_vbuc1_then_la1
//SEG29 [14] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@3 -- vbuxx_neq_vbuc1_then_la1
cpx #$b
bne b3_from_b3
jmp b4
//SEG33 main::@4
//SEG30 main::@4
b4:
//SEG34 [18] *(((byte*))(word/dword/signed dword) $d020) ← ++ *(((byte*))(word/dword/signed dword) $d020) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG31 [15] *(((byte*))(word/dword/signed dword) $d020) ← ++ *(((byte*))(word/dword/signed dword) $d020) -- _deref_pbuc1=_inc__deref_pbuc1
inc $d020
//SEG35 [19] *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) ← -- *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) -- _deref_pbuc1=_dec__deref_pbuc1
//SEG32 [16] *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) ← -- *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) -- _deref_pbuc1=_dec__deref_pbuc1
dec $d000+$21
//SEG36 [20] *((const byte*) main::BGCOL#0) ← ++ *((const byte*) main::BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG33 [17] *((const byte*) main::BGCOL#0) ← ++ *((const byte*) main::BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
jmp breturn
//SEG37 main::@return
//SEG34 main::@return
breturn:
//SEG38 [21] return
//SEG35 [18] return
rts
}
@ -539,8 +459,6 @@ Removing instruction jmp b3
Removing instruction jmp b4
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label b1_from_b1 with b1
Replacing label b3_from_b3 with b3
Removing instruction b1_from_bbegin:
@ -571,9 +489,6 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(void()) main()
(byte*~) main::$15 $15 zp ZP_WORD:2 22.0
(byte*~) main::$18 $18 zp ZP_WORD:2 11.0
(byte*~) main::$20 $20 zp ZP_WORD:4 22.0
(label) main::@1
(label) main::@2
(label) main::@3
@ -583,10 +498,10 @@ FINAL SYMBOL TABLE
(const byte*) main::BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) $d020
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 14.666666666666666
(byte) main::i#2 reg byte x 22.0
(byte) main::j
(byte) main::j#1 reg byte x 16.5
(byte) main::j#2 reg byte x 11.0
(byte) main::j#2 reg byte x 22.0
(byte*) main::sc2
(const byte*) main::sc2#0 sc2 = (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $51
(byte*) main::screen
@ -594,12 +509,10 @@ FINAL SYMBOL TABLE
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::j#2 main::j#1 ]
zp ZP_WORD:2 [ main::$15 main::$18 ]
zp ZP_WORD:4 [ main::$20 ]
FINAL ASSEMBLER
Score: 950
Score: 400
//SEG0 File Comments
// Test some complex pointers
@ -622,9 +535,6 @@ main: {
// Increment on a const named pointer
.label BGCOL = $d020
.label sc2 = screen+$51
.label _15 = 2
.label _18 = 2
.label _20 = 4
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
@ -633,73 +543,47 @@ main: {
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG16 [6] (byte*~) main::$15 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2 -- pbuz1=pbuc1_plus_vbuxx
txa
clc
adc #<screen+$28
sta _15
lda #>screen+$28
adc #0
sta _15+1
//SEG17 [7] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((byte*~) main::$15) -- pbuc1_derefidx_vbuxx=_deref_pbuz1
ldy #0
lda (_15),y
//SEG16 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda screen+$28,x
sta screen,x
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$b
bne b1
//SEG20 main::@2
//SEG21 [10] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79) -- _deref_pbuc1=_deref_pbuc2
//SEG19 main::@2
//SEG20 [9] *((const byte*) main::sc2#0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $79) -- _deref_pbuc1=_deref_pbuc2
lda screen+$79
sta sc2
//SEG22 [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a) -- _deref_pbuc1=_deref_pbuc2
//SEG21 [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $52) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $7a) -- _deref_pbuc1=_deref_pbuc2
// LValue pointer expression (constant - directly)
lda screen+$7a
sta screen+$52
//SEG23 [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG24 [12] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->main::@3#0] -- vbuxx=vbuc1
//SEG22 [11] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG23 [11] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->main::@3#0] -- vbuxx=vbuc1
ldx #0
// LValue pointer expression (variable - directly)
//SEG25 [12] phi from main::@3 to main::@3 [phi:main::@3->main::@3]
//SEG26 [12] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@3->main::@3#0] -- register_copy
//SEG27 main::@3
//SEG24 [11] phi from main::@3 to main::@3 [phi:main::@3->main::@3]
//SEG25 [11] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@3->main::@3#0] -- register_copy
//SEG26 main::@3
b3:
//SEG28 [13] (byte*~) main::$18 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2 -- pbuz1=pbuc1_plus_vbuxx
txa
clc
adc #<screen+$a0
sta _18
lda #>screen+$a0
adc #0
sta _18+1
//SEG29 [14] (byte*~) main::$20 ← (const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2 -- pbuz1=pbuc1_plus_vbuxx
txa
clc
adc #<screen+$c8
sta _20
lda #>screen+$c8
adc #0
sta _20+1
//SEG30 [15] *((byte*~) main::$18) ← *((byte*~) main::$20) -- _deref_pbuz1=_deref_pbuz2
ldy #0
lda (_20),y
sta (_18),y
//SEG31 [16] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuxx=_inc_vbuxx
//SEG27 [12] *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $a0 + (byte) main::j#2) ← *((const byte*) main::screen#0+(byte/word/signed word/dword/signed dword) $c8 + (byte) main::j#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda screen+$c8,x
sta screen+$a0,x
//SEG28 [13] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuxx=_inc_vbuxx
inx
//SEG32 [17] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@3 -- vbuxx_neq_vbuc1_then_la1
//SEG29 [14] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) $b) goto main::@3 -- vbuxx_neq_vbuc1_then_la1
cpx #$b
bne b3
//SEG33 main::@4
//SEG34 [18] *(((byte*))(word/dword/signed dword) $d020) ← ++ *(((byte*))(word/dword/signed dword) $d020) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG30 main::@4
//SEG31 [15] *(((byte*))(word/dword/signed dword) $d020) ← ++ *(((byte*))(word/dword/signed dword) $d020) -- _deref_pbuc1=_inc__deref_pbuc1
inc $d020
//SEG35 [19] *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) ← -- *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) -- _deref_pbuc1=_dec__deref_pbuc1
//SEG32 [16] *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) ← -- *(((byte*))(word/dword/signed dword) $d000+(byte/signed byte/word/signed word/dword/signed dword) $21) -- _deref_pbuc1=_dec__deref_pbuc1
dec $d000+$21
//SEG36 [20] *((const byte*) main::BGCOL#0) ← ++ *((const byte*) main::BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG33 [17] *((const byte*) main::BGCOL#0) ← ++ *((const byte*) main::BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
//SEG37 main::@return
//SEG38 [21] return
//SEG34 main::@return
//SEG35 [18] return
rts
}

View File

@ -2,9 +2,6 @@
(label) @begin
(label) @end
(void()) main()
(byte*~) main::$15 $15 zp ZP_WORD:2 22.0
(byte*~) main::$18 $18 zp ZP_WORD:2 11.0
(byte*~) main::$20 $20 zp ZP_WORD:4 22.0
(label) main::@1
(label) main::@2
(label) main::@3
@ -14,10 +11,10 @@
(const byte*) main::BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) $d020
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 14.666666666666666
(byte) main::i#2 reg byte x 22.0
(byte) main::j
(byte) main::j#1 reg byte x 16.5
(byte) main::j#2 reg byte x 11.0
(byte) main::j#2 reg byte x 22.0
(byte*) main::sc2
(const byte*) main::sc2#0 sc2 = (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $51
(byte*) main::screen
@ -25,5 +22,3 @@
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::j#2 main::j#1 ]
zp ZP_WORD:2 [ main::$15 main::$18 ]
zp ZP_WORD:4 [ main::$20 ]

View File

@ -239,6 +239,7 @@ Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(lvalue::SCREEN#0+1)
Consolidated array index constant in *(rvalue::SCREEN#0+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Eliminating unused variable (byte) rvalue::b#0 and assignment [12] (byte) rvalue::b#0 ← *((const byte[$400]) rvalue::SCREEN#0)
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) lvalue::i#0
Inlining constant with var siblings (const byte) rvalue::i#0

View File

@ -87,6 +87,7 @@ Consolidated array index constant in *(screen#0+2)
Successful SSA optimization Pass2ConstantAdditionElimination
if() condition always true - replacing block destination [1] if((const byte) call#0==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@return
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) call#0
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@2
Removing unused procedure proc

Some files were not shown because too many files have changed in this diff Show More