1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-13 18:30:21 +00:00

Added bulk unwinding for struct pointer derefs.

This commit is contained in:
jespergravgaard 2020-01-19 22:10:02 +01:00
parent 7ea2453733
commit 06a2e00540
43 changed files with 4143 additions and 4034 deletions

View File

@ -0,0 +1,7 @@
ldy #00
!:
lda ({z2}),y
sta ({z1}),y
iny
cpy #{c1}
bne !-

View File

@ -0,0 +1,7 @@
ldy #0
!:
lda ({z2}),y
sta ({z1}),y
iny
dex
bne !-

View File

@ -0,0 +1,8 @@
ldy #0
!:
lda {c2},y
sta {c1},x
inx
iny
cpy #{c3}
bne !-

View File

@ -0,0 +1,6 @@
!:
lda {c2},x
sta {c1},x
inx
dey
bne !-

View File

@ -0,0 +1,8 @@
ldx #0
!:
lda {c2},x
sta {c1},y
iny
inx
cpx #{c3}
bne !-

View File

@ -0,0 +1,6 @@
!:
lda {c2},y
sta {c1},y
iny
dex
bne !-

View File

@ -4,13 +4,15 @@ import dk.camelot64.kickc.model.InternalError;
import dk.camelot64.kickc.model.*;
import dk.camelot64.kickc.model.iterator.ProgramValueIterator;
import dk.camelot64.kickc.model.statements.*;
import dk.camelot64.kickc.model.symbols.*;
import dk.camelot64.kickc.model.symbols.Procedure;
import dk.camelot64.kickc.model.symbols.ProgramScope;
import dk.camelot64.kickc.model.symbols.StructDefinition;
import dk.camelot64.kickc.model.symbols.Variable;
import dk.camelot64.kickc.model.types.SymbolType;
import dk.camelot64.kickc.model.types.SymbolTypeInference;
import dk.camelot64.kickc.model.types.SymbolTypeStruct;
import dk.camelot64.kickc.model.values.*;
import dk.camelot64.kickc.passes.unwinding.*;
import dk.camelot64.kickc.passes.unwinding.StructUnwinding;
import java.util.ArrayList;
import java.util.List;
@ -268,8 +270,8 @@ public class Pass1UnwindStructValues extends Pass1Base {
if(lValueUnwinding.isBulkCopyable() && rValueUnwinding.isBulkCopyable()) {
// Use bulk unwinding for a struct member that is an array
stmtIt.previous();
if(lValueUnwinding.getArraySpec()!=null)
if(rValueUnwinding.getArraySpec()==null || !lValueUnwinding.getArraySpec().equals(rValueUnwinding.getArraySpec()))
if(lValueUnwinding.getArraySpec() != null)
if(rValueUnwinding.getArraySpec() == null || !lValueUnwinding.getArraySpec().equals(rValueUnwinding.getArraySpec()))
throw new RuntimeException("ArraySpec mismatch!");
LValue lValueMemberVarRef = lValueUnwinding.getBulkLValue(getScope());
RValue rValueBulkUnwinding = rValueUnwinding.getBulkRValue(getScope());
@ -312,6 +314,12 @@ public class Pass1UnwindStructValues extends Pass1Base {
if(value instanceof ConstantStructValue)
// A constant struct value
return true;
if(value instanceof PointerDereference) {
final SymbolType symbolType = SymbolTypeInference.inferType(getProgram().getScope(), value);
if(symbolType instanceof SymbolTypeStruct)
// A pointer to a struct
return true;
}
// TODO: Add support for arrays
// Not bulk assignable
return false;
@ -339,6 +347,9 @@ public class Pass1UnwindStructValues extends Pass1Base {
if(value instanceof ConstantStructValue) {
return new RValueUnwindingConstant(valueType, null, (ConstantStructValue) value);
}
if(value instanceof PointerDereference) {
return new RValueUnwindingStructPointerDeref((PointerDereference) value, (SymbolTypeStruct) valueType);
}
}
}
return null;

View File

@ -0,0 +1,57 @@
package dk.camelot64.kickc.passes.unwinding;
import dk.camelot64.kickc.model.operators.OperatorSizeOf;
import dk.camelot64.kickc.model.symbols.ArraySpec;
import dk.camelot64.kickc.model.symbols.ProgramScope;
import dk.camelot64.kickc.model.types.SymbolType;
import dk.camelot64.kickc.model.types.SymbolTypeStruct;
import dk.camelot64.kickc.model.values.*;
/** Value unwinding for a simple pointer to a struct. */
public class RValueUnwindingStructPointerDeref implements RValueUnwinding {
/** Pointer to struct value. */
private final PointerDereference structPointerDereference;
/** Struct type. */
private final SymbolTypeStruct structType;
public RValueUnwindingStructPointerDeref(PointerDereference structPointerDereference, SymbolTypeStruct structType) {
this.structPointerDereference = structPointerDereference;
this.structType = structType;
}
@Override
public SymbolType getSymbolType() {
return structType;
}
@Override
public ArraySpec getArraySpec() {
return null;
}
@Override
public RValue getUnwinding(ProgramScope programScope) {
return structPointerDereference.getPointer();
}
@Override
public boolean isBulkCopyable() {
return true;
}
@Override
public LValue getBulkLValue(ProgramScope scope) {
return structPointerDereference;
}
private ConstantValue getByteSize(ProgramScope scope) {
return OperatorSizeOf.getSizeOfConstantVar(scope, getSymbolType());
}
@Override
public RValue getBulkRValue(ProgramScope scope) {
return new MemcpyValue(structPointerDereference, getByteSize(scope), getSymbolType());
}
}

View File

@ -11,7 +11,7 @@ import dk.camelot64.kickc.model.values.*;
import java.util.ListIterator;
class RValueUnwindingStructPointerDerefSimple implements RValueUnwinding {
public class RValueUnwindingStructPointerDerefSimple implements RValueUnwinding {
private final PointerDereferenceSimple structPointerDeref;
private final ArraySpec memberArraySpec;
private final SymbolType memberType;
@ -47,9 +47,9 @@ class RValueUnwindingStructPointerDerefSimple implements RValueUnwinding {
Variable memberAddress = scope.addVariableIntermediate();
memberAddress.setType(new SymbolTypePointer(memberType));
CastValue structTypedPointer = new CastValue(new SymbolTypePointer(memberType), structPointerDeref.getPointer());
// Add statement $1 = ptr_struct + OFFSET_STRUCT_NAME_MEMBER
// Add statement $1 = (memberType*)ptr_struct + OFFSET_MEMBER
stmtIt.add(new StatementAssignment((LValue) memberAddress.getRef(), structTypedPointer, Operators.PLUS, memberOffsetConstant, true, currentStmt.getSource(), currentStmt.getComments()));
// Unwind to *(ptr_struct+OFFSET_STRUCT_NAME_MEMBER)
// Unwind to *((memberType*)ptr_struct+OFFSET_MEMBER)
return new PointerDereferenceSimple(memberAddress.getRef());
}

View File

@ -46,9 +46,9 @@ class RValueUnwindingStructPointerDereferenceIndexedMember implements RValueUnwi
Variable memberAddress = scope.addVariableIntermediate();
memberAddress.setType(new SymbolTypePointer(memberType));
CastValue structTypedPointer = new CastValue(new SymbolTypePointer(memberType), structPointerDeref.getPointer());
// Add statement $1 = ptr_struct + OFFSET_STRUCT_NAME_MEMBER
// Add statement $1 = ptr_struct + OFFSET_MEMBER
stmtIt.add(new StatementAssignment((LValue) memberAddress.getRef(), structTypedPointer, Operators.PLUS, memberOffsetConstant, true, currentStmt.getSource(), currentStmt.getComments()));
// Unwind to *(ptr_struct+OFFSET_STRUCT_NAME_MEMBER[idx]
// Unwind to ((elmType*)ptr_struct+OFFSET_MEMBER)[idx]
return new PointerDereferenceIndexed(memberAddress.getRef(), structPointerDeref.getIndex());
}

View File

@ -1,19 +1,16 @@
package dk.camelot64.kickc.passes.unwinding;
import dk.camelot64.kickc.model.ControlFlowBlock;
import dk.camelot64.kickc.model.statements.Statement;
import dk.camelot64.kickc.model.symbols.ArraySpec;
import dk.camelot64.kickc.model.symbols.ProgramScope;
import dk.camelot64.kickc.model.symbols.StructDefinition;
import dk.camelot64.kickc.model.symbols.Variable;
import dk.camelot64.kickc.model.types.SymbolType;
import dk.camelot64.kickc.model.values.*;
import dk.camelot64.kickc.model.values.ConstantRef;
import dk.camelot64.kickc.passes.PassNStructPointerRewriting;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
/** Unwinding for a struct value with C-classic memory layout. */
public class StructUnwindingVariable implements StructUnwinding {
@ -37,15 +34,15 @@ public class StructUnwindingVariable implements StructUnwinding {
@Override
public RValueUnwinding getMemberUnwinding(String memberName, ProgramScope programScope) {
final SymbolType symbolType = structDefinition.getMember(memberName).getType();
final ArraySpec arraySpec = structDefinition.getMember(memberName).getArraySpec();
final SymbolType memberType = structDefinition.getMember(memberName).getType();
final ArraySpec memberArraySpec = structDefinition.getMember(memberName).getArraySpec();
ConstantRef memberOffsetConstant = PassNStructPointerRewriting.getMemberOffsetConstant(programScope, structDefinition, memberName);
if(arraySpec==null) {
if(memberArraySpec==null) {
// Simple member value - unwind to value of member *((type*)&struct + OFFSET_MEMBER)
return new RValueUnwindingStructVariableMemberSimple(variable, symbolType, arraySpec, memberOffsetConstant);
return new RValueUnwindingStructVariableMemberSimple(variable, memberType, memberArraySpec, memberOffsetConstant);
} else {
// Array struct member - unwind to pointer to first element (elmtype*)&struct + OFFSET_MEMBER
return new RValueUnwindingStructVariableMemberArray(variable, symbolType, arraySpec, memberOffsetConstant);
return new RValueUnwindingStructVariableMemberArray(variable, memberType, memberArraySpec, memberOffsetConstant);
}
}

View File

@ -1127,6 +1127,11 @@ public class TestPrograms {
assertError("struct-err-0", "Unknown struct type");
}
@Test
public void testStruct35() throws IOException, URISyntaxException {
compileAndCompare("struct-35");
}
@Test
public void testStruct34() throws IOException, URISyntaxException {
compileAndCompare("struct-34");

18
src/test/kc/struct-35.kc Normal file
View File

@ -0,0 +1,18 @@
// Minimal struct with C-Standard behavior - copy assignment through struct pointer
struct Point {
char x;
char y;
};
__mem __ma struct Point point1 = { 2, 3 };
__mem __ma struct Point point2;
const char* SCREEN = 0x0400;
void main() {
struct Point* p2 = &point2;
*p2 = point1;
SCREEN[0] = point2.x;
SCREEN[1] = point2.y;
}

View File

@ -65,6 +65,7 @@
.const YPOS_BOTTOMMOST = BORDER_YPOS_BOTTOM<<4
.const RASTER_IRQ_TOP = $30
.const RASTER_IRQ_MIDDLE = $ff
.const SIZEOF_STRUCT_PROCESSINGSPRITE = $e
.const OFFSET_STRUCT_PROCESSINGSPRITE_Y = 2
.const OFFSET_STRUCT_PROCESSINGSPRITE_VX = 4
.const OFFSET_STRUCT_PROCESSINGSPRITE_VY = 6
@ -95,7 +96,8 @@ __b1:
main: {
.label dst = 3
.label src = $1c
.label center_y = $1e
.label i = 2
.label center_y = $b
lda.z SCREEN_DIST
sta.z init_angle_screen.screen
lda.z SCREEN_DIST+1
@ -117,39 +119,30 @@ main: {
lda.z src
cmp #<SCREEN+$3e8
bne __b2
ldx #0
lda #0
sta.z i
// Init processing array
__b3:
txa
lda.z i
asl
stx.z $ff
clc
adc.z $ff
adc.z i
asl
stx.z $ff
clc
adc.z $ff
adc.z i
asl
tay
lda #<0
sta PROCESSING,y
sta PROCESSING+1,y
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_Y,y
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_Y+1,y
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_VX,y
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_VX+1,y
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_VY,y
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_VY+1,y
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_ID,y
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_PTR,y
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_COL,y
lda #STATUS_FREE
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_STATUS,y
lda #<0
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_SCREENPTR,y
sta PROCESSING+OFFSET_STRUCT_PROCESSINGSPRITE_SCREENPTR+1,y
tax
ldy #0
!:
lda __2,y
sta PROCESSING,x
inx
cpx #NUM_PROCESSING-1+1
iny
cpy #SIZEOF_STRUCT_PROCESSINGSPRITE
bne !-
inc.z i
lda #NUM_PROCESSING-1+1
cmp.z i
bne __b3
jsr initSprites
jsr setupRasterIrq
@ -186,7 +179,7 @@ main: {
jmp __b1
}
// Start processing a char - by inserting it into the PROCESSING array
// startProcessing(byte zp($b) center_x, byte zp($1e) center_y)
// startProcessing(byte zp($1e) center_x, byte zp($b) center_y)
startProcessing: {
.label __0 = $c
.label __1 = $c
@ -201,8 +194,8 @@ startProcessing: {
.label __16 = $15
.label __17 = $15
.label __21 = $18
.label center_x = $b
.label center_y = $1e
.label center_x = $1e
.label center_y = $b
.label i = 2
.label offset = $c
.label colPtr = $10
@ -476,11 +469,11 @@ getCharToProcess: {
.label screen_line = $1c
.label dist_line = 3
.label y = 2
.label return_x = $12
.label return_y = $17
.label closest_dist = $b
.label closest_x = $12
.label closest_y = $17
.label return_x = $17
.label return_y = $b
.label closest_dist = $12
.label closest_x = $17
.label closest_y = $b
.label __12 = $1a
.label __13 = $18
lda.z SCREEN_COPY
@ -669,7 +662,7 @@ init_angle_screen: {
.label ang_w = $1e
.label x = $12
.label xb = $17
.label y = $b
.label y = 2
lda.z screen
clc
adc #<$28*$c
@ -1306,3 +1299,6 @@ VYSIN:
// Sprites currently being processed in the interrupt
PROCESSING: .fill $e*NUM_PROCESSING, 0
__2: .word 0, 0, 0, 0
.byte 0, 0, 0, STATUS_FREE
.word 0

View File

@ -34,539 +34,531 @@ main::@1: scope:[main] from main::@2 main::@9
to:main::@3
main::@3: scope:[main] from main::@1 main::@3
[14] (byte) main::i#2 ← phi( main::@1/(byte) 0 main::@3/(byte) main::i#1 )
[15] (byte~) main::$20 ← (byte) main::i#2 << (byte) 1
[16] (byte~) main::$21 ← (byte~) main::$20 + (byte) main::i#2
[17] (byte~) main::$22 ← (byte~) main::$21 << (byte) 1
[18] (byte~) main::$23 ← (byte~) main::$22 + (byte) main::i#2
[19] (byte~) main::$10 ← (byte~) main::$23 << (byte) 1
[20] *((word*)(const struct ProcessingSprite*) PROCESSING + (byte~) main::$10) ← (word) 0
[21] *((word*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y + (byte~) main::$10) ← (word) 0
[22] *((word*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VX + (byte~) main::$10) ← (word) 0
[23] *((word*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VY + (byte~) main::$10) ← (word) 0
[24] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_ID + (byte~) main::$10) ← (byte) 0
[25] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_PTR + (byte~) main::$10) ← (byte) 0
[26] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_COL + (byte~) main::$10) ← (byte) 0
[27] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS + (byte~) main::$10) ← (const byte) STATUS_FREE
[28] *((byte**)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_SCREENPTR + (byte~) main::$10) ← (byte*) 0
[29] (byte) main::i#1 ← ++ (byte) main::i#2
[30] if((byte) main::i#1!=(const byte) NUM_PROCESSING-(byte) 1+(byte) 1) goto main::@3
[15] (byte~) main::$11 ← (byte) main::i#2 << (byte) 1
[16] (byte~) main::$12 ← (byte~) main::$11 + (byte) main::i#2
[17] (byte~) main::$13 ← (byte~) main::$12 << (byte) 1
[18] (byte~) main::$14 ← (byte~) main::$13 + (byte) main::i#2
[19] (byte~) main::$10 ← (byte~) main::$14 << (byte) 1
[20] *((const struct ProcessingSprite*) PROCESSING + (byte~) main::$10) ← memcpy(*(&(const struct ProcessingSprite) $2), struct ProcessingSprite, (const byte) SIZEOF_STRUCT_PROCESSINGSPRITE)
[21] (byte) main::i#1 ← ++ (byte) main::i#2
[22] if((byte) main::i#1!=(const byte) NUM_PROCESSING-(byte) 1+(byte) 1) goto main::@3
to:main::@4
main::@4: scope:[main] from main::@3
[31] phi()
[32] call initSprites
[23] phi()
[24] call initSprites
to:main::@10
main::@10: scope:[main] from main::@4
[33] phi()
[34] call setupRasterIrq
[25] phi()
[26] call setupRasterIrq
to:main::@5
main::@5: scope:[main] from main::@10 main::@6
[35] phi()
[36] call getCharToProcess
[37] (byte) getCharToProcess::return_x#0 ← (byte) getCharToProcess::return_x#1
[38] (byte) getCharToProcess::return_y#0 ← (byte) getCharToProcess::return_y#1
[39] (byte) getCharToProcess::return_dist#0 ← (byte) getCharToProcess::return_dist#1
[27] phi()
[28] call getCharToProcess
[29] (byte) getCharToProcess::return_x#0 ← (byte) getCharToProcess::return_x#1
[30] (byte) getCharToProcess::return_y#0 ← (byte) getCharToProcess::return_y#1
[31] (byte) getCharToProcess::return_dist#0 ← (byte) getCharToProcess::return_dist#1
to:main::@11
main::@11: scope:[main] from main::@5
[40] (byte) main::center_x#0 ← (byte) getCharToProcess::return_x#0
[41] (byte) main::center_y#0 ← (byte) getCharToProcess::return_y#0
[42] (byte) main::center_dist#0 ← (byte) getCharToProcess::return_dist#0
[43] if((byte) main::center_dist#0!=(const byte) NOT_FOUND) goto main::@6
[32] (byte) main::center_x#0 ← (byte) getCharToProcess::return_x#0
[33] (byte) main::center_y#0 ← (byte) getCharToProcess::return_y#0
[34] (byte) main::center_dist#0 ← (byte) getCharToProcess::return_dist#0
[35] if((byte) main::center_dist#0!=(const byte) NOT_FOUND) goto main::@6
to:main::@7
main::@7: scope:[main] from main::@11
[44] *((const byte*) SCREEN+(word) $3e7) ← (byte) '.'
[36] *((const byte*) SCREEN+(word) $3e7) ← (byte) '.'
to:main::@8
main::@8: scope:[main] from main::@7 main::@8
[45] *((const byte*) COLS+(word) $3e7) ← ++ *((const byte*) COLS+(word) $3e7)
[37] *((const byte*) COLS+(word) $3e7) ← ++ *((const byte*) COLS+(word) $3e7)
to:main::@8
main::@6: scope:[main] from main::@11
[46] (byte) startProcessing::center_x#0 ← (byte) main::center_x#0
[47] (byte) startProcessing::center_y#0 ← (byte) main::center_y#0
[48] call startProcessing
[38] (byte) startProcessing::center_x#0 ← (byte) main::center_x#0
[39] (byte) startProcessing::center_y#0 ← (byte) main::center_y#0
[40] call startProcessing
to:main::@5
main::@2: scope:[main] from main::@1
[49] *((byte*) main::dst#2) ← *((byte*) main::src#2)
[50] (byte*) main::src#1 ← ++ (byte*) main::src#2
[51] (byte*) main::dst#1 ← ++ (byte*) main::dst#2
[41] *((byte*) main::dst#2) ← *((byte*) main::src#2)
[42] (byte*) main::src#1 ← ++ (byte*) main::src#2
[43] (byte*) main::dst#1 ← ++ (byte*) main::dst#2
to:main::@1
(void()) startProcessing((byte) startProcessing::center_x , (byte) startProcessing::center_y , (byte) startProcessing::center_dist)
startProcessing: scope:[startProcessing] from main::@6
[52] phi()
[44] phi()
to:startProcessing::@1
startProcessing::@1: scope:[startProcessing] from startProcessing startProcessing::@8
[53] (byte) startProcessing::freeIdx#6 ← phi( startProcessing/(byte) $ff startProcessing::@8/(byte) startProcessing::freeIdx#7 )
[45] (byte) startProcessing::freeIdx#6 ← phi( startProcessing/(byte) $ff startProcessing::@8/(byte) startProcessing::freeIdx#7 )
to:startProcessing::@2
startProcessing::@2: scope:[startProcessing] from startProcessing::@1 startProcessing::@3
[54] (byte) startProcessing::i#2 ← phi( startProcessing::@1/(byte) 0 startProcessing::@3/(byte) startProcessing::i#1 )
[55] (byte~) startProcessing::$39 ← (byte) startProcessing::i#2 << (byte) 1
[56] (byte~) startProcessing::$40 ← (byte~) startProcessing::$39 + (byte) startProcessing::i#2
[57] (byte~) startProcessing::$41 ← (byte~) startProcessing::$40 << (byte) 1
[58] (byte~) startProcessing::$42 ← (byte~) startProcessing::$41 + (byte) startProcessing::i#2
[59] (byte~) startProcessing::$27 ← (byte~) startProcessing::$42 << (byte) 1
[60] if(*((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS + (byte~) startProcessing::$27)!=(const byte) STATUS_FREE) goto startProcessing::@3
[46] (byte) startProcessing::i#2 ← phi( startProcessing::@1/(byte) 0 startProcessing::@3/(byte) startProcessing::i#1 )
[47] (byte~) startProcessing::$39 ← (byte) startProcessing::i#2 << (byte) 1
[48] (byte~) startProcessing::$40 ← (byte~) startProcessing::$39 + (byte) startProcessing::i#2
[49] (byte~) startProcessing::$41 ← (byte~) startProcessing::$40 << (byte) 1
[50] (byte~) startProcessing::$42 ← (byte~) startProcessing::$41 + (byte) startProcessing::i#2
[51] (byte~) startProcessing::$27 ← (byte~) startProcessing::$42 << (byte) 1
[52] if(*((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS + (byte~) startProcessing::$27)!=(const byte) STATUS_FREE) goto startProcessing::@3
to:startProcessing::@4
startProcessing::@4: scope:[startProcessing] from startProcessing::@2 startProcessing::@9
[61] (byte) startProcessing::freeIdx#2 ← phi( startProcessing::@9/(byte) startProcessing::freeIdx#8 startProcessing::@2/(byte) startProcessing::i#2 )
[62] if((byte) startProcessing::freeIdx#2==(byte) $ff) goto startProcessing::@8
[53] (byte) startProcessing::freeIdx#2 ← phi( startProcessing::@9/(byte) startProcessing::freeIdx#8 startProcessing::@2/(byte) startProcessing::i#2 )
[54] if((byte) startProcessing::freeIdx#2==(byte) $ff) goto startProcessing::@8
to:startProcessing::@5
startProcessing::@5: scope:[startProcessing] from startProcessing::@4
[63] (word~) startProcessing::$0 ← (word)(byte) startProcessing::center_y#0
[64] (word~) startProcessing::$44 ← (word~) startProcessing::$0 << (byte) 2
[65] (word~) startProcessing::$45 ← (word~) startProcessing::$44 + (word~) startProcessing::$0
[66] (word~) startProcessing::$1 ← (word~) startProcessing::$45 << (byte) 3
[67] (word) startProcessing::offset#0 ← (word~) startProcessing::$1 + (byte) startProcessing::center_x#0
[68] (byte*) startProcessing::colPtr#0 ← (const byte*) COLS + (word) startProcessing::offset#0
[69] (byte) startProcessing::spriteCol#0 ← *((byte*) startProcessing::colPtr#0)
[70] (byte*) startProcessing::screenPtr#0 ← (const byte*) SCREEN + (word) startProcessing::offset#0
[71] (word~) startProcessing::$5 ← (word)(byte) startProcessing::freeIdx#2
[72] (word~) startProcessing::$6 ← (word~) startProcessing::$5 << (byte) 6
[73] (byte*) startProcessing::spriteData#0 ← (const byte*) SPRITE_DATA + (word~) startProcessing::$6
[74] (byte) startProcessing::ch#0 ← *((byte*) startProcessing::screenPtr#0)
[75] (word~) startProcessing::$8 ← (word)(byte) startProcessing::ch#0
[76] (word~) startProcessing::$9 ← (word~) startProcessing::$8 << (byte) 3
[77] (byte*) startProcessing::chargenData#0 ← (const byte*) CHARGEN + (word~) startProcessing::$9
[55] (word~) startProcessing::$0 ← (word)(byte) startProcessing::center_y#0
[56] (word~) startProcessing::$44 ← (word~) startProcessing::$0 << (byte) 2
[57] (word~) startProcessing::$45 ← (word~) startProcessing::$44 + (word~) startProcessing::$0
[58] (word~) startProcessing::$1 ← (word~) startProcessing::$45 << (byte) 3
[59] (word) startProcessing::offset#0 ← (word~) startProcessing::$1 + (byte) startProcessing::center_x#0
[60] (byte*) startProcessing::colPtr#0 ← (const byte*) COLS + (word) startProcessing::offset#0
[61] (byte) startProcessing::spriteCol#0 ← *((byte*) startProcessing::colPtr#0)
[62] (byte*) startProcessing::screenPtr#0 ← (const byte*) SCREEN + (word) startProcessing::offset#0
[63] (word~) startProcessing::$5 ← (word)(byte) startProcessing::freeIdx#2
[64] (word~) startProcessing::$6 ← (word~) startProcessing::$5 << (byte) 6
[65] (byte*) startProcessing::spriteData#0 ← (const byte*) SPRITE_DATA + (word~) startProcessing::$6
[66] (byte) startProcessing::ch#0 ← *((byte*) startProcessing::screenPtr#0)
[67] (word~) startProcessing::$8 ← (word)(byte) startProcessing::ch#0
[68] (word~) startProcessing::$9 ← (word~) startProcessing::$8 << (byte) 3
[69] (byte*) startProcessing::chargenData#0 ← (const byte*) CHARGEN + (word~) startProcessing::$9
asm { sei }
[79] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_CHARROM
[71] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_CHARROM
to:startProcessing::@6
startProcessing::@6: scope:[startProcessing] from startProcessing::@5 startProcessing::@6
[80] (byte) startProcessing::i1#2 ← phi( startProcessing::@5/(byte) 0 startProcessing::@6/(byte) startProcessing::i1#1 )
[80] (byte*) startProcessing::spriteData#2 ← phi( startProcessing::@5/(byte*) startProcessing::spriteData#0 startProcessing::@6/(byte*) startProcessing::spriteData#1 )
[80] (byte*) startProcessing::chargenData#2 ← phi( startProcessing::@5/(byte*) startProcessing::chargenData#0 startProcessing::@6/(byte*) startProcessing::chargenData#1 )
[81] *((byte*) startProcessing::spriteData#2) ← *((byte*) startProcessing::chargenData#2)
[82] (byte*) startProcessing::spriteData#1 ← (byte*) startProcessing::spriteData#2 + (byte) 3
[83] (byte*) startProcessing::chargenData#1 ← ++ (byte*) startProcessing::chargenData#2
[84] (byte) startProcessing::i1#1 ← ++ (byte) startProcessing::i1#2
[85] if((byte) startProcessing::i1#1!=(byte) 8) goto startProcessing::@6
[72] (byte) startProcessing::i1#2 ← phi( startProcessing::@5/(byte) 0 startProcessing::@6/(byte) startProcessing::i1#1 )
[72] (byte*) startProcessing::spriteData#2 ← phi( startProcessing::@5/(byte*) startProcessing::spriteData#0 startProcessing::@6/(byte*) startProcessing::spriteData#1 )
[72] (byte*) startProcessing::chargenData#2 ← phi( startProcessing::@5/(byte*) startProcessing::chargenData#0 startProcessing::@6/(byte*) startProcessing::chargenData#1 )
[73] *((byte*) startProcessing::spriteData#2) ← *((byte*) startProcessing::chargenData#2)
[74] (byte*) startProcessing::spriteData#1 ← (byte*) startProcessing::spriteData#2 + (byte) 3
[75] (byte*) startProcessing::chargenData#1 ← ++ (byte*) startProcessing::chargenData#2
[76] (byte) startProcessing::i1#1 ← ++ (byte) startProcessing::i1#2
[77] if((byte) startProcessing::i1#1!=(byte) 8) goto startProcessing::@6
to:startProcessing::@7
startProcessing::@7: scope:[startProcessing] from startProcessing::@6
[86] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_IO
[78] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_IO
asm { cli }
[88] (word~) startProcessing::$11 ← (word)(byte) startProcessing::center_x#0
[89] (word~) startProcessing::$12 ← (word~) startProcessing::$11 << (byte) 3
[90] (word~) startProcessing::$13 ← (const byte) BORDER_XPOS_LEFT + (word~) startProcessing::$12
[91] (word) startProcessing::spriteX#0 ← (word~) startProcessing::$13 << (byte) 4
[92] (word~) startProcessing::$15 ← (word)(byte) startProcessing::center_y#0
[93] (word~) startProcessing::$16 ← (word~) startProcessing::$15 << (byte) 3
[94] (word~) startProcessing::$17 ← (const byte) BORDER_YPOS_TOP + (word~) startProcessing::$16
[95] (word) startProcessing::spriteY#0 ← (word~) startProcessing::$17 << (byte) 4
[96] (byte) startProcessing::spritePtr#0 ← (byte)(const byte*) SPRITE_DATA/(byte) $40 + (byte) startProcessing::freeIdx#2
[97] (byte~) startProcessing::$20 ← (byte) startProcessing::freeIdx#2 << (byte) 3
[98] (word~) startProcessing::$21 ← (word)(byte~) startProcessing::$20
[99] (byte~) startProcessing::$47 ← (byte) startProcessing::freeIdx#2 << (byte) 1
[100] (byte~) startProcessing::$48 ← (byte~) startProcessing::$47 + (byte) startProcessing::freeIdx#2
[101] (byte~) startProcessing::$49 ← (byte~) startProcessing::$48 << (byte) 1
[102] (byte~) startProcessing::$50 ← (byte~) startProcessing::$49 + (byte) startProcessing::freeIdx#2
[103] (byte~) startProcessing::$28 ← (byte~) startProcessing::$50 << (byte) 1
[104] *((word*)(const struct ProcessingSprite*) PROCESSING + (byte~) startProcessing::$28) ← (word) startProcessing::spriteX#0
[105] *((word*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y + (byte~) startProcessing::$28) ← (word) startProcessing::spriteY#0
[106] *((word*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VX + (byte~) startProcessing::$28) ← (word~) startProcessing::$21
[107] *((word*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VY + (byte~) startProcessing::$28) ← (word) $3c
[108] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_ID + (byte~) startProcessing::$28) ← (byte) startProcessing::freeIdx#2
[109] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_PTR + (byte~) startProcessing::$28) ← (byte) startProcessing::spritePtr#0
[110] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_COL + (byte~) startProcessing::$28) ← (byte) startProcessing::spriteCol#0
[111] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS + (byte~) startProcessing::$28) ← (const byte) STATUS_NEW
[112] *((byte**)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_SCREENPTR + (byte~) startProcessing::$28) ← (byte*) startProcessing::screenPtr#0
[80] (word~) startProcessing::$11 ← (word)(byte) startProcessing::center_x#0
[81] (word~) startProcessing::$12 ← (word~) startProcessing::$11 << (byte) 3
[82] (word~) startProcessing::$13 ← (const byte) BORDER_XPOS_LEFT + (word~) startProcessing::$12
[83] (word) startProcessing::spriteX#0 ← (word~) startProcessing::$13 << (byte) 4
[84] (word~) startProcessing::$15 ← (word)(byte) startProcessing::center_y#0
[85] (word~) startProcessing::$16 ← (word~) startProcessing::$15 << (byte) 3
[86] (word~) startProcessing::$17 ← (const byte) BORDER_YPOS_TOP + (word~) startProcessing::$16
[87] (word) startProcessing::spriteY#0 ← (word~) startProcessing::$17 << (byte) 4
[88] (byte) startProcessing::spritePtr#0 ← (byte)(const byte*) SPRITE_DATA/(byte) $40 + (byte) startProcessing::freeIdx#2
[89] (byte~) startProcessing::$20 ← (byte) startProcessing::freeIdx#2 << (byte) 3
[90] (word~) startProcessing::$21 ← (word)(byte~) startProcessing::$20
[91] (byte~) startProcessing::$47 ← (byte) startProcessing::freeIdx#2 << (byte) 1
[92] (byte~) startProcessing::$48 ← (byte~) startProcessing::$47 + (byte) startProcessing::freeIdx#2
[93] (byte~) startProcessing::$49 ← (byte~) startProcessing::$48 << (byte) 1
[94] (byte~) startProcessing::$50 ← (byte~) startProcessing::$49 + (byte) startProcessing::freeIdx#2
[95] (byte~) startProcessing::$28 ← (byte~) startProcessing::$50 << (byte) 1
[96] *((word*)(const struct ProcessingSprite*) PROCESSING + (byte~) startProcessing::$28) ← (word) startProcessing::spriteX#0
[97] *((word*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y + (byte~) startProcessing::$28) ← (word) startProcessing::spriteY#0
[98] *((word*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VX + (byte~) startProcessing::$28) ← (word~) startProcessing::$21
[99] *((word*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VY + (byte~) startProcessing::$28) ← (word) $3c
[100] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_ID + (byte~) startProcessing::$28) ← (byte) startProcessing::freeIdx#2
[101] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_PTR + (byte~) startProcessing::$28) ← (byte) startProcessing::spritePtr#0
[102] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_COL + (byte~) startProcessing::$28) ← (byte) startProcessing::spriteCol#0
[103] *((byte*)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS + (byte~) startProcessing::$28) ← (const byte) STATUS_NEW
[104] *((byte**)(const struct ProcessingSprite*) PROCESSING+(const byte) OFFSET_STRUCT_PROCESSINGSPRITE_SCREENPTR + (byte~) startProcessing::$28) ← (byte*) startProcessing::screenPtr#0
to:startProcessing::@return
startProcessing::@return: scope:[startProcessing] from startProcessing::@7
[113] return
[105] return
to:@return
startProcessing::@8: scope:[startProcessing] from startProcessing::@4
[114] (byte) startProcessing::freeIdx#7 ← (byte) startProcessing::freeIdx#2
[106] (byte) startProcessing::freeIdx#7 ← (byte) startProcessing::freeIdx#2
to:startProcessing::@1
startProcessing::@3: scope:[startProcessing] from startProcessing::@2
[115] (byte) startProcessing::i#1 ← ++ (byte) startProcessing::i#2
[116] if((byte) startProcessing::i#1!=(const byte) NUM_PROCESSING-(byte) 1+(byte) 1) goto startProcessing::@2
[107] (byte) startProcessing::i#1 ← ++ (byte) startProcessing::i#2
[108] if((byte) startProcessing::i#1!=(const byte) NUM_PROCESSING-(byte) 1+(byte) 1) goto startProcessing::@2
to:startProcessing::@9
startProcessing::@9: scope:[startProcessing] from startProcessing::@3
[117] (byte) startProcessing::freeIdx#8 ← (byte) startProcessing::freeIdx#6
[109] (byte) startProcessing::freeIdx#8 ← (byte) startProcessing::freeIdx#6
to:startProcessing::@4
(struct ProcessingChar()) getCharToProcess()
getCharToProcess: scope:[getCharToProcess] from main::@5
[118] (byte*) getCharToProcess::screen_line#0 ← (byte*)(void*) SCREEN_COPY#0
[119] (byte*) getCharToProcess::dist_line#0 ← (byte*)(void*) SCREEN_DIST#0
[110] (byte*) getCharToProcess::screen_line#0 ← (byte*)(void*) SCREEN_COPY#0
[111] (byte*) getCharToProcess::dist_line#0 ← (byte*)(void*) SCREEN_DIST#0
to:getCharToProcess::@1
getCharToProcess::@1: scope:[getCharToProcess] from getCharToProcess getCharToProcess::@9
[120] (byte) getCharToProcess::closest_y#9 ← phi( getCharToProcess/(byte) 0 getCharToProcess::@9/(byte) getCharToProcess::return_y#1 )
[120] (byte) getCharToProcess::closest_x#9 ← phi( getCharToProcess/(byte) 0 getCharToProcess::@9/(byte) getCharToProcess::return_x#1 )
[120] (byte) getCharToProcess::y#7 ← phi( getCharToProcess/(byte) 0 getCharToProcess::@9/(byte) getCharToProcess::y#1 )
[120] (byte) getCharToProcess::closest_dist#8 ← phi( getCharToProcess/(const byte) NOT_FOUND getCharToProcess::@9/(byte) getCharToProcess::closest_dist#10 )
[120] (byte*) getCharToProcess::dist_line#6 ← phi( getCharToProcess/(byte*) getCharToProcess::dist_line#0 getCharToProcess::@9/(byte*) getCharToProcess::dist_line#1 )
[120] (byte*) getCharToProcess::screen_line#4 ← phi( getCharToProcess/(byte*) getCharToProcess::screen_line#0 getCharToProcess::@9/(byte*) getCharToProcess::screen_line#1 )
[112] (byte) getCharToProcess::closest_y#9 ← phi( getCharToProcess/(byte) 0 getCharToProcess::@9/(byte) getCharToProcess::return_y#1 )
[112] (byte) getCharToProcess::closest_x#9 ← phi( getCharToProcess/(byte) 0 getCharToProcess::@9/(byte) getCharToProcess::return_x#1 )
[112] (byte) getCharToProcess::y#7 ← phi( getCharToProcess/(byte) 0 getCharToProcess::@9/(byte) getCharToProcess::y#1 )
[112] (byte) getCharToProcess::closest_dist#8 ← phi( getCharToProcess/(const byte) NOT_FOUND getCharToProcess::@9/(byte) getCharToProcess::closest_dist#10 )
[112] (byte*) getCharToProcess::dist_line#6 ← phi( getCharToProcess/(byte*) getCharToProcess::dist_line#0 getCharToProcess::@9/(byte*) getCharToProcess::dist_line#1 )
[112] (byte*) getCharToProcess::screen_line#4 ← phi( getCharToProcess/(byte*) getCharToProcess::screen_line#0 getCharToProcess::@9/(byte*) getCharToProcess::screen_line#1 )
to:getCharToProcess::@2
getCharToProcess::@2: scope:[getCharToProcess] from getCharToProcess::@1 getCharToProcess::@10
[121] (byte) getCharToProcess::closest_y#7 ← phi( getCharToProcess::@1/(byte) getCharToProcess::closest_y#9 getCharToProcess::@10/(byte) getCharToProcess::return_y#1 )
[121] (byte) getCharToProcess::closest_x#7 ← phi( getCharToProcess::@1/(byte) getCharToProcess::closest_x#9 getCharToProcess::@10/(byte) getCharToProcess::return_x#1 )
[121] (byte) getCharToProcess::closest_dist#2 ← phi( getCharToProcess::@1/(byte) getCharToProcess::closest_dist#8 getCharToProcess::@10/(byte) getCharToProcess::closest_dist#12 )
[121] (byte) getCharToProcess::x#2 ← phi( getCharToProcess::@1/(byte) 0 getCharToProcess::@10/(byte) getCharToProcess::x#1 )
[122] if(*((byte*) getCharToProcess::screen_line#4 + (byte) getCharToProcess::x#2)==(byte) ' ') goto getCharToProcess::@11
[113] (byte) getCharToProcess::closest_y#7 ← phi( getCharToProcess::@1/(byte) getCharToProcess::closest_y#9 getCharToProcess::@10/(byte) getCharToProcess::return_y#1 )
[113] (byte) getCharToProcess::closest_x#7 ← phi( getCharToProcess::@1/(byte) getCharToProcess::closest_x#9 getCharToProcess::@10/(byte) getCharToProcess::return_x#1 )
[113] (byte) getCharToProcess::closest_dist#2 ← phi( getCharToProcess::@1/(byte) getCharToProcess::closest_dist#8 getCharToProcess::@10/(byte) getCharToProcess::closest_dist#12 )
[113] (byte) getCharToProcess::x#2 ← phi( getCharToProcess::@1/(byte) 0 getCharToProcess::@10/(byte) getCharToProcess::x#1 )
[114] if(*((byte*) getCharToProcess::screen_line#4 + (byte) getCharToProcess::x#2)==(byte) ' ') goto getCharToProcess::@11
to:getCharToProcess::@4
getCharToProcess::@4: scope:[getCharToProcess] from getCharToProcess::@2
[123] (byte) getCharToProcess::dist#0 ← *((byte*) getCharToProcess::dist_line#6 + (byte) getCharToProcess::x#2)
[124] if((byte) getCharToProcess::dist#0>=(byte) getCharToProcess::closest_dist#2) goto getCharToProcess::@12
[115] (byte) getCharToProcess::dist#0 ← *((byte*) getCharToProcess::dist_line#6 + (byte) getCharToProcess::x#2)
[116] if((byte) getCharToProcess::dist#0>=(byte) getCharToProcess::closest_dist#2) goto getCharToProcess::@12
to:getCharToProcess::@5
getCharToProcess::@5: scope:[getCharToProcess] from getCharToProcess::@4
[125] (byte) getCharToProcess::return_x#7 ← (byte) getCharToProcess::x#2
[126] (byte) getCharToProcess::return_y#7 ← (byte) getCharToProcess::y#7
[117] (byte) getCharToProcess::return_x#7 ← (byte) getCharToProcess::x#2
[118] (byte) getCharToProcess::return_y#7 ← (byte) getCharToProcess::y#7
to:getCharToProcess::@3
getCharToProcess::@3: scope:[getCharToProcess] from getCharToProcess::@11 getCharToProcess::@12 getCharToProcess::@5
[127] (byte) getCharToProcess::return_y#1 ← phi( getCharToProcess::@11/(byte) getCharToProcess::closest_y#7 getCharToProcess::@12/(byte) getCharToProcess::closest_y#7 getCharToProcess::@5/(byte) getCharToProcess::return_y#7 )
[127] (byte) getCharToProcess::return_x#1 ← phi( getCharToProcess::@11/(byte) getCharToProcess::closest_x#7 getCharToProcess::@12/(byte) getCharToProcess::closest_x#7 getCharToProcess::@5/(byte) getCharToProcess::return_x#7 )
[127] (byte) getCharToProcess::return_dist#1 ← phi( getCharToProcess::@11/(byte) getCharToProcess::return_dist#5 getCharToProcess::@12/(byte) getCharToProcess::return_dist#6 getCharToProcess::@5/(byte) getCharToProcess::dist#0 )
[128] (byte) getCharToProcess::x#1 ← ++ (byte) getCharToProcess::x#2
[129] if((byte) getCharToProcess::x#1!=(byte) $28) goto getCharToProcess::@10
[119] (byte) getCharToProcess::return_y#1 ← phi( getCharToProcess::@11/(byte) getCharToProcess::closest_y#7 getCharToProcess::@12/(byte) getCharToProcess::closest_y#7 getCharToProcess::@5/(byte) getCharToProcess::return_y#7 )
[119] (byte) getCharToProcess::return_x#1 ← phi( getCharToProcess::@11/(byte) getCharToProcess::closest_x#7 getCharToProcess::@12/(byte) getCharToProcess::closest_x#7 getCharToProcess::@5/(byte) getCharToProcess::return_x#7 )
[119] (byte) getCharToProcess::return_dist#1 ← phi( getCharToProcess::@11/(byte) getCharToProcess::return_dist#5 getCharToProcess::@12/(byte) getCharToProcess::return_dist#6 getCharToProcess::@5/(byte) getCharToProcess::dist#0 )
[120] (byte) getCharToProcess::x#1 ← ++ (byte) getCharToProcess::x#2
[121] if((byte) getCharToProcess::x#1!=(byte) $28) goto getCharToProcess::@10
to:getCharToProcess::@6
getCharToProcess::@6: scope:[getCharToProcess] from getCharToProcess::@3
[130] (byte*) getCharToProcess::screen_line#1 ← (byte*) getCharToProcess::screen_line#4 + (byte) $28
[131] (byte*) getCharToProcess::dist_line#1 ← (byte*) getCharToProcess::dist_line#6 + (byte) $28
[132] (byte) getCharToProcess::y#1 ← ++ (byte) getCharToProcess::y#7
[133] if((byte) getCharToProcess::y#1!=(byte) $19) goto getCharToProcess::@9
[122] (byte*) getCharToProcess::screen_line#1 ← (byte*) getCharToProcess::screen_line#4 + (byte) $28
[123] (byte*) getCharToProcess::dist_line#1 ← (byte*) getCharToProcess::dist_line#6 + (byte) $28
[124] (byte) getCharToProcess::y#1 ← ++ (byte) getCharToProcess::y#7
[125] if((byte) getCharToProcess::y#1!=(byte) $19) goto getCharToProcess::@9
to:getCharToProcess::@7
getCharToProcess::@7: scope:[getCharToProcess] from getCharToProcess::@6
[134] if((byte) getCharToProcess::return_dist#1==(const byte) NOT_FOUND) goto getCharToProcess::@return
[126] if((byte) getCharToProcess::return_dist#1==(const byte) NOT_FOUND) goto getCharToProcess::@return
to:getCharToProcess::@8
getCharToProcess::@8: scope:[getCharToProcess] from getCharToProcess::@7
[135] (word~) getCharToProcess::$8 ← (word)(byte) getCharToProcess::return_y#1
[136] (word~) getCharToProcess::$12 ← (word~) getCharToProcess::$8 << (byte) 2
[137] (word~) getCharToProcess::$13 ← (word~) getCharToProcess::$12 + (word~) getCharToProcess::$8
[138] (word~) getCharToProcess::$9 ← (word~) getCharToProcess::$13 << (byte) 3
[139] (byte*~) getCharToProcess::$10 ← (byte*)(void*) SCREEN_COPY#0 + (word~) getCharToProcess::$9
[140] *((byte*~) getCharToProcess::$10 + (byte) getCharToProcess::return_x#1) ← (byte) ' '
[127] (word~) getCharToProcess::$8 ← (word)(byte) getCharToProcess::return_y#1
[128] (word~) getCharToProcess::$12 ← (word~) getCharToProcess::$8 << (byte) 2
[129] (word~) getCharToProcess::$13 ← (word~) getCharToProcess::$12 + (word~) getCharToProcess::$8
[130] (word~) getCharToProcess::$9 ← (word~) getCharToProcess::$13 << (byte) 3
[131] (byte*~) getCharToProcess::$10 ← (byte*)(void*) SCREEN_COPY#0 + (word~) getCharToProcess::$9
[132] *((byte*~) getCharToProcess::$10 + (byte) getCharToProcess::return_x#1) ← (byte) ' '
to:getCharToProcess::@return
getCharToProcess::@return: scope:[getCharToProcess] from getCharToProcess::@7 getCharToProcess::@8
[141] return
[133] return
to:@return
getCharToProcess::@9: scope:[getCharToProcess] from getCharToProcess::@6
[142] (byte) getCharToProcess::closest_dist#10 ← (byte) getCharToProcess::return_dist#1
[134] (byte) getCharToProcess::closest_dist#10 ← (byte) getCharToProcess::return_dist#1
to:getCharToProcess::@1
getCharToProcess::@10: scope:[getCharToProcess] from getCharToProcess::@3
[143] (byte) getCharToProcess::closest_dist#12 ← (byte) getCharToProcess::return_dist#1
[135] (byte) getCharToProcess::closest_dist#12 ← (byte) getCharToProcess::return_dist#1
to:getCharToProcess::@2
getCharToProcess::@12: scope:[getCharToProcess] from getCharToProcess::@4
[144] (byte) getCharToProcess::return_dist#6 ← (byte) getCharToProcess::closest_dist#2
[136] (byte) getCharToProcess::return_dist#6 ← (byte) getCharToProcess::closest_dist#2
to:getCharToProcess::@3
getCharToProcess::@11: scope:[getCharToProcess] from getCharToProcess::@2
[145] (byte) getCharToProcess::return_dist#5 ← (byte) getCharToProcess::closest_dist#2
[137] (byte) getCharToProcess::return_dist#5 ← (byte) getCharToProcess::closest_dist#2
to:getCharToProcess::@3
(void()) setupRasterIrq((word) setupRasterIrq::raster , (void()*) setupRasterIrq::irqRoutine)
setupRasterIrq: scope:[setupRasterIrq] from main::@10
asm { sei }
[147] *((const byte*) PROCPORT_DDR) ← (const byte) PROCPORT_DDR_MEMORY_MASK
[148] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_IO
[149] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR
[139] *((const byte*) PROCPORT_DDR) ← (const byte) PROCPORT_DDR_MEMORY_MASK
[140] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_IO
[141] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR
to:setupRasterIrq::@1
setupRasterIrq::@1: scope:[setupRasterIrq] from setupRasterIrq
[150] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f
[142] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f
to:setupRasterIrq::@2
setupRasterIrq::@2: scope:[setupRasterIrq] from setupRasterIrq::@1
[151] *((const byte*) RASTER) ← <(const byte) RASTER_IRQ_TOP
[152] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER
[153] *((const void()**) HARDWARE_IRQ) ← (const void()*) setupRasterIrq::irqRoutine#0
[143] *((const byte*) RASTER) ← <(const byte) RASTER_IRQ_TOP
[144] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER
[145] *((const void()**) HARDWARE_IRQ) ← (const void()*) setupRasterIrq::irqRoutine#0
asm { cli }
to:setupRasterIrq::@return
setupRasterIrq::@return: scope:[setupRasterIrq] from setupRasterIrq::@2
[155] return
[147] return
to:@return
(void()) initSprites()
initSprites: scope:[initSprites] from main::@4
[156] phi()
[148] phi()
to:initSprites::@1
initSprites::@1: scope:[initSprites] from initSprites initSprites::@2
[157] (byte*) initSprites::sp#2 ← phi( initSprites/(const byte*) SPRITE_DATA initSprites::@2/(byte*) initSprites::sp#1 )
[158] if((byte*) initSprites::sp#2<(const byte*) SPRITE_DATA+(const byte) NUM_PROCESSING*(byte) $40) goto initSprites::@2
[149] (byte*) initSprites::sp#2 ← phi( initSprites/(const byte*) SPRITE_DATA initSprites::@2/(byte*) initSprites::sp#1 )
[150] if((byte*) initSprites::sp#2<(const byte*) SPRITE_DATA+(const byte) NUM_PROCESSING*(byte) $40) goto initSprites::@2
to:initSprites::@3
initSprites::@3: scope:[initSprites] from initSprites::@1 initSprites::@3
[159] (byte) initSprites::i#2 ← phi( initSprites::@1/(byte) 0 initSprites::@3/(byte) initSprites::i#1 )
[160] *((const byte*) SPRITES_COLS + (byte) initSprites::i#2) ← (const byte) LIGHT_BLUE
[161] (byte) initSprites::i#1 ← ++ (byte) initSprites::i#2
[162] if((byte) initSprites::i#1!=(byte) 8) goto initSprites::@3
[151] (byte) initSprites::i#2 ← phi( initSprites::@1/(byte) 0 initSprites::@3/(byte) initSprites::i#1 )
[152] *((const byte*) SPRITES_COLS + (byte) initSprites::i#2) ← (const byte) LIGHT_BLUE
[153] (byte) initSprites::i#1 ← ++ (byte) initSprites::i#2
[154] if((byte) initSprites::i#1!=(byte) 8) goto initSprites::@3
to:initSprites::@4
initSprites::@4: scope:[initSprites] from initSprites::@3
[163] *((const byte*) SPRITES_MC) ← (byte) 0
[164] *((const byte*) SPRITES_EXPAND_X) ← (byte) 0
[165] *((const byte*) SPRITES_EXPAND_Y) ← (byte) 0
[155] *((const byte*) SPRITES_MC) ← (byte) 0
[156] *((const byte*) SPRITES_EXPAND_X) ← (byte) 0
[157] *((const byte*) SPRITES_EXPAND_Y) ← (byte) 0
to:initSprites::@return
initSprites::@return: scope:[initSprites] from initSprites::@4
[166] return
[158] return
to:@return
initSprites::@2: scope:[initSprites] from initSprites::@1
[167] *((byte*) initSprites::sp#2) ← (byte) 0
[168] (byte*) initSprites::sp#1 ← ++ (byte*) initSprites::sp#2
[159] *((byte*) initSprites::sp#2) ← (byte) 0
[160] (byte*) initSprites::sp#1 ← ++ (byte*) initSprites::sp#2
to:initSprites::@1
(void()) init_angle_screen((byte*) init_angle_screen::screen)
init_angle_screen: scope:[init_angle_screen] from main
[169] (byte*) init_angle_screen::screen_topline#0 ← (byte*) init_angle_screen::screen#0 + (word)(number) $28*(number) $c
[170] (byte*) init_angle_screen::screen_bottomline#0 ← (byte*) init_angle_screen::screen#0 + (word)(number) $28*(number) $c
[161] (byte*) init_angle_screen::screen_topline#0 ← (byte*) init_angle_screen::screen#0 + (word)(number) $28*(number) $c
[162] (byte*) init_angle_screen::screen_bottomline#0 ← (byte*) init_angle_screen::screen#0 + (word)(number) $28*(number) $c
to:init_angle_screen::@1
init_angle_screen::@1: scope:[init_angle_screen] from init_angle_screen init_angle_screen::@4
[171] (byte*) init_angle_screen::screen_bottomline#6 ← phi( init_angle_screen/(byte*) init_angle_screen::screen_bottomline#0 init_angle_screen::@4/(byte*) init_angle_screen::screen_bottomline#1 )
[171] (byte*) init_angle_screen::screen_topline#6 ← phi( init_angle_screen/(byte*) init_angle_screen::screen_topline#0 init_angle_screen::@4/(byte*) init_angle_screen::screen_topline#1 )
[171] (byte) init_angle_screen::y#5 ← phi( init_angle_screen/(byte) 0 init_angle_screen::@4/(byte) init_angle_screen::y#1 )
[163] (byte*) init_angle_screen::screen_bottomline#6 ← phi( init_angle_screen/(byte*) init_angle_screen::screen_bottomline#0 init_angle_screen::@4/(byte*) init_angle_screen::screen_bottomline#1 )
[163] (byte*) init_angle_screen::screen_topline#6 ← phi( init_angle_screen/(byte*) init_angle_screen::screen_topline#0 init_angle_screen::@4/(byte*) init_angle_screen::screen_topline#1 )
[163] (byte) init_angle_screen::y#5 ← phi( init_angle_screen/(byte) 0 init_angle_screen::@4/(byte) init_angle_screen::y#1 )
to:init_angle_screen::@2
init_angle_screen::@2: scope:[init_angle_screen] from init_angle_screen::@1 init_angle_screen::@5
[172] (byte) init_angle_screen::xb#2 ← phi( init_angle_screen::@1/(byte) $27 init_angle_screen::@5/(byte) init_angle_screen::xb#1 )
[172] (byte) init_angle_screen::x#2 ← phi( init_angle_screen::@1/(byte) 0 init_angle_screen::@5/(byte) init_angle_screen::x#1 )
[173] if((byte) init_angle_screen::x#2<(byte) $13+(byte) 1) goto init_angle_screen::@3
[164] (byte) init_angle_screen::xb#2 ← phi( init_angle_screen::@1/(byte) $27 init_angle_screen::@5/(byte) init_angle_screen::xb#1 )
[164] (byte) init_angle_screen::x#2 ← phi( init_angle_screen::@1/(byte) 0 init_angle_screen::@5/(byte) init_angle_screen::x#1 )
[165] if((byte) init_angle_screen::x#2<(byte) $13+(byte) 1) goto init_angle_screen::@3
to:init_angle_screen::@4
init_angle_screen::@4: scope:[init_angle_screen] from init_angle_screen::@2
[174] (byte*) init_angle_screen::screen_topline#1 ← (byte*) init_angle_screen::screen_topline#6 - (byte) $28
[175] (byte*) init_angle_screen::screen_bottomline#1 ← (byte*) init_angle_screen::screen_bottomline#6 + (byte) $28
[176] (byte) init_angle_screen::y#1 ← ++ (byte) init_angle_screen::y#5
[177] if((byte) init_angle_screen::y#1!=(byte) $d) goto init_angle_screen::@1
[166] (byte*) init_angle_screen::screen_topline#1 ← (byte*) init_angle_screen::screen_topline#6 - (byte) $28
[167] (byte*) init_angle_screen::screen_bottomline#1 ← (byte*) init_angle_screen::screen_bottomline#6 + (byte) $28
[168] (byte) init_angle_screen::y#1 ← ++ (byte) init_angle_screen::y#5
[169] if((byte) init_angle_screen::y#1!=(byte) $d) goto init_angle_screen::@1
to:init_angle_screen::@return
init_angle_screen::@return: scope:[init_angle_screen] from init_angle_screen::@4
[178] return
[170] return
to:@return
init_angle_screen::@3: scope:[init_angle_screen] from init_angle_screen::@2
[179] (byte~) init_angle_screen::$3 ← (byte) init_angle_screen::x#2 << (byte) 1
[180] (byte~) init_angle_screen::$4 ← (byte) $27 - (byte~) init_angle_screen::$3
[181] (word) init_angle_screen::xw#0 ← (byte~) init_angle_screen::$4 w= (byte) 0
[182] (byte~) init_angle_screen::$7 ← (byte) init_angle_screen::y#5 << (byte) 1
[183] (word) init_angle_screen::yw#0 ← (byte~) init_angle_screen::$7 w= (byte) 0
[184] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0
[185] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0
[186] call atan2_16
[187] (word) atan2_16::return#2 ← (word) atan2_16::return#0
[171] (byte~) init_angle_screen::$3 ← (byte) init_angle_screen::x#2 << (byte) 1
[172] (byte~) init_angle_screen::$4 ← (byte) $27 - (byte~) init_angle_screen::$3
[173] (word) init_angle_screen::xw#0 ← (byte~) init_angle_screen::$4 w= (byte) 0
[174] (byte~) init_angle_screen::$7 ← (byte) init_angle_screen::y#5 << (byte) 1
[175] (word) init_angle_screen::yw#0 ← (byte~) init_angle_screen::$7 w= (byte) 0
[176] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0
[177] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0
[178] call atan2_16
[179] (word) atan2_16::return#2 ← (word) atan2_16::return#0
to:init_angle_screen::@5
init_angle_screen::@5: scope:[init_angle_screen] from init_angle_screen::@3
[188] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2
[189] (word~) init_angle_screen::$11 ← (word) init_angle_screen::angle_w#0 + (byte) $80
[190] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$11
[191] *((byte*) init_angle_screen::screen_bottomline#6 + (byte) init_angle_screen::xb#2) ← (byte) init_angle_screen::ang_w#0
[192] (byte~) init_angle_screen::$13 ← - (byte) init_angle_screen::ang_w#0
[193] *((byte*) init_angle_screen::screen_topline#6 + (byte) init_angle_screen::xb#2) ← (byte~) init_angle_screen::$13
[194] (byte~) init_angle_screen::$14 ← (byte) $80 + (byte) init_angle_screen::ang_w#0
[195] *((byte*) init_angle_screen::screen_topline#6 + (byte) init_angle_screen::x#2) ← (byte~) init_angle_screen::$14
[196] (byte~) init_angle_screen::$15 ← (byte) $80 - (byte) init_angle_screen::ang_w#0
[197] *((byte*) init_angle_screen::screen_bottomline#6 + (byte) init_angle_screen::x#2) ← (byte~) init_angle_screen::$15
[198] (byte) init_angle_screen::x#1 ← ++ (byte) init_angle_screen::x#2
[199] (byte) init_angle_screen::xb#1 ← -- (byte) init_angle_screen::xb#2
[180] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2
[181] (word~) init_angle_screen::$11 ← (word) init_angle_screen::angle_w#0 + (byte) $80
[182] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$11
[183] *((byte*) init_angle_screen::screen_bottomline#6 + (byte) init_angle_screen::xb#2) ← (byte) init_angle_screen::ang_w#0
[184] (byte~) init_angle_screen::$13 ← - (byte) init_angle_screen::ang_w#0
[185] *((byte*) init_angle_screen::screen_topline#6 + (byte) init_angle_screen::xb#2) ← (byte~) init_angle_screen::$13
[186] (byte~) init_angle_screen::$14 ← (byte) $80 + (byte) init_angle_screen::ang_w#0
[187] *((byte*) init_angle_screen::screen_topline#6 + (byte) init_angle_screen::x#2) ← (byte~) init_angle_screen::$14
[188] (byte~) init_angle_screen::$15 ← (byte) $80 - (byte) init_angle_screen::ang_w#0
[189] *((byte*) init_angle_screen::screen_bottomline#6 + (byte) init_angle_screen::x#2) ← (byte~) init_angle_screen::$15
[190] (byte) init_angle_screen::x#1 ← ++ (byte) init_angle_screen::x#2
[191] (byte) init_angle_screen::xb#1 ← -- (byte) init_angle_screen::xb#2
to:init_angle_screen::@2
(word()) atan2_16((signed word) atan2_16::x , (signed word) atan2_16::y)
atan2_16: scope:[atan2_16] from init_angle_screen::@3
[200] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1
[192] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1
to:atan2_16::@2
atan2_16::@2: scope:[atan2_16] from atan2_16
[201] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0
[193] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0
to:atan2_16::@3
atan2_16::@3: scope:[atan2_16] from atan2_16::@1 atan2_16::@2
[202] (signed word) atan2_16::yi#0 ← phi( atan2_16::@1/(signed word) atan2_16::yi#16 atan2_16::@2/(signed word~) atan2_16::$2 )
[203] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4
[194] (signed word) atan2_16::yi#0 ← phi( atan2_16::@1/(signed word) atan2_16::yi#16 atan2_16::@2/(signed word~) atan2_16::$2 )
[195] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4
to:atan2_16::@5
atan2_16::@5: scope:[atan2_16] from atan2_16::@3
[204] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0
[196] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0
to:atan2_16::@6
atan2_16::@6: scope:[atan2_16] from atan2_16::@4 atan2_16::@5
[205] (signed word) atan2_16::xi#0 ← phi( atan2_16::@4/(signed word) atan2_16::xi#13 atan2_16::@5/(signed word~) atan2_16::$7 )
[197] (signed word) atan2_16::xi#0 ← phi( atan2_16::@4/(signed word) atan2_16::xi#13 atan2_16::@5/(signed word~) atan2_16::$7 )
to:atan2_16::@10
atan2_16::@10: scope:[atan2_16] from atan2_16::@19 atan2_16::@6
[206] (word) atan2_16::angle#12 ← phi( atan2_16::@19/(word) atan2_16::angle#13 atan2_16::@6/(word) 0 )
[206] (byte) atan2_16::i#2 ← phi( atan2_16::@19/(byte) atan2_16::i#1 atan2_16::@6/(byte) 0 )
[206] (signed word) atan2_16::xi#3 ← phi( atan2_16::@19/(signed word) atan2_16::xi#8 atan2_16::@6/(signed word) atan2_16::xi#0 )
[206] (signed word) atan2_16::yi#3 ← phi( atan2_16::@19/(signed word) atan2_16::yi#8 atan2_16::@6/(signed word) atan2_16::yi#0 )
[207] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11
[198] (word) atan2_16::angle#12 ← phi( atan2_16::@19/(word) atan2_16::angle#13 atan2_16::@6/(word) 0 )
[198] (byte) atan2_16::i#2 ← phi( atan2_16::@19/(byte) atan2_16::i#1 atan2_16::@6/(byte) 0 )
[198] (signed word) atan2_16::xi#3 ← phi( atan2_16::@19/(signed word) atan2_16::xi#8 atan2_16::@6/(signed word) atan2_16::xi#0 )
[198] (signed word) atan2_16::yi#3 ← phi( atan2_16::@19/(signed word) atan2_16::yi#8 atan2_16::@6/(signed word) atan2_16::yi#0 )
[199] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11
to:atan2_16::@12
atan2_16::@12: scope:[atan2_16] from atan2_16::@10 atan2_16::@19
[208] (word) atan2_16::angle#6 ← phi( atan2_16::@10/(word) atan2_16::angle#12 atan2_16::@19/(word) atan2_16::angle#13 )
[209] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1
[210] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7
[200] (word) atan2_16::angle#6 ← phi( atan2_16::@10/(word) atan2_16::angle#12 atan2_16::@19/(word) atan2_16::angle#13 )
[201] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1
[202] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7
to:atan2_16::@21
atan2_16::@21: scope:[atan2_16] from atan2_16::@12
[211] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1
[203] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1
to:atan2_16::@7
atan2_16::@7: scope:[atan2_16] from atan2_16::@12 atan2_16::@21
[212] (word) atan2_16::angle#11 ← phi( atan2_16::@12/(word) atan2_16::angle#1 atan2_16::@21/(word) atan2_16::angle#4 )
[213] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8
[204] (word) atan2_16::angle#11 ← phi( atan2_16::@12/(word) atan2_16::angle#1 atan2_16::@21/(word) atan2_16::angle#4 )
[205] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8
to:atan2_16::@9
atan2_16::@9: scope:[atan2_16] from atan2_16::@7
[214] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11
[206] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11
to:atan2_16::@8
atan2_16::@8: scope:[atan2_16] from atan2_16::@7 atan2_16::@9
[215] (word) atan2_16::return#0 ← phi( atan2_16::@9/(word) atan2_16::angle#5 atan2_16::@7/(word) atan2_16::angle#11 )
[207] (word) atan2_16::return#0 ← phi( atan2_16::@9/(word) atan2_16::angle#5 atan2_16::@7/(word) atan2_16::angle#11 )
to:atan2_16::@return
atan2_16::@return: scope:[atan2_16] from atan2_16::@8
[216] return
[208] return
to:@return
atan2_16::@11: scope:[atan2_16] from atan2_16::@10
[217] (byte) atan2_16::shift#5 ← (byte) atan2_16::i#2
[218] (signed word) atan2_16::xd#10 ← (signed word) atan2_16::xi#3
[219] (signed word) atan2_16::yd#10 ← (signed word) atan2_16::yi#3
[209] (byte) atan2_16::shift#5 ← (byte) atan2_16::i#2
[210] (signed word) atan2_16::xd#10 ← (signed word) atan2_16::xi#3
[211] (signed word) atan2_16::yd#10 ← (signed word) atan2_16::yi#3
to:atan2_16::@13
atan2_16::@13: scope:[atan2_16] from atan2_16::@11 atan2_16::@14
[220] (signed word) atan2_16::yd#3 ← phi( atan2_16::@11/(signed word) atan2_16::yd#10 atan2_16::@14/(signed word) atan2_16::yd#1 )
[220] (signed word) atan2_16::xd#3 ← phi( atan2_16::@11/(signed word) atan2_16::xd#10 atan2_16::@14/(signed word) atan2_16::xd#1 )
[220] (byte) atan2_16::shift#2 ← phi( atan2_16::@11/(byte) atan2_16::shift#5 atan2_16::@14/(byte) atan2_16::shift#1 )
[221] if((byte) atan2_16::shift#2>=(byte) 2) goto atan2_16::@14
[212] (signed word) atan2_16::yd#3 ← phi( atan2_16::@11/(signed word) atan2_16::yd#10 atan2_16::@14/(signed word) atan2_16::yd#1 )
[212] (signed word) atan2_16::xd#3 ← phi( atan2_16::@11/(signed word) atan2_16::xd#10 atan2_16::@14/(signed word) atan2_16::xd#1 )
[212] (byte) atan2_16::shift#2 ← phi( atan2_16::@11/(byte) atan2_16::shift#5 atan2_16::@14/(byte) atan2_16::shift#1 )
[213] if((byte) atan2_16::shift#2>=(byte) 2) goto atan2_16::@14
to:atan2_16::@15
atan2_16::@15: scope:[atan2_16] from atan2_16::@13
[222] if((byte) 0==(byte) atan2_16::shift#2) goto atan2_16::@17
[214] if((byte) 0==(byte) atan2_16::shift#2) goto atan2_16::@17
to:atan2_16::@16
atan2_16::@16: scope:[atan2_16] from atan2_16::@15
[223] (signed word) atan2_16::xd#2 ← (signed word) atan2_16::xd#3 >> (signed byte) 1
[224] (signed word) atan2_16::yd#2 ← (signed word) atan2_16::yd#3 >> (signed byte) 1
[215] (signed word) atan2_16::xd#2 ← (signed word) atan2_16::xd#3 >> (signed byte) 1
[216] (signed word) atan2_16::yd#2 ← (signed word) atan2_16::yd#3 >> (signed byte) 1
to:atan2_16::@17
atan2_16::@17: scope:[atan2_16] from atan2_16::@15 atan2_16::@16
[225] (signed word) atan2_16::xd#5 ← phi( atan2_16::@15/(signed word) atan2_16::xd#3 atan2_16::@16/(signed word) atan2_16::xd#2 )
[225] (signed word) atan2_16::yd#5 ← phi( atan2_16::@15/(signed word) atan2_16::yd#3 atan2_16::@16/(signed word) atan2_16::yd#2 )
[226] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@18
[217] (signed word) atan2_16::xd#5 ← phi( atan2_16::@15/(signed word) atan2_16::xd#3 atan2_16::@16/(signed word) atan2_16::xd#2 )
[217] (signed word) atan2_16::yd#5 ← phi( atan2_16::@15/(signed word) atan2_16::yd#3 atan2_16::@16/(signed word) atan2_16::yd#2 )
[218] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@18
to:atan2_16::@20
atan2_16::@20: scope:[atan2_16] from atan2_16::@17
[227] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#5
[228] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#5
[229] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1
[230] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word*) CORDIC_ATAN2_ANGLES_16 + (byte~) atan2_16::$23)
[219] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#5
[220] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#5
[221] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1
[222] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word*) CORDIC_ATAN2_ANGLES_16 + (byte~) atan2_16::$23)
to:atan2_16::@19
atan2_16::@19: scope:[atan2_16] from atan2_16::@18 atan2_16::@20
[231] (signed word) atan2_16::xi#8 ← phi( atan2_16::@18/(signed word) atan2_16::xi#1 atan2_16::@20/(signed word) atan2_16::xi#2 )
[231] (word) atan2_16::angle#13 ← phi( atan2_16::@18/(word) atan2_16::angle#2 atan2_16::@20/(word) atan2_16::angle#3 )
[231] (signed word) atan2_16::yi#8 ← phi( atan2_16::@18/(signed word) atan2_16::yi#1 atan2_16::@20/(signed word) atan2_16::yi#2 )
[232] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2
[233] if((byte) atan2_16::i#1==(const byte) CORDIC_ITERATIONS_16-(byte) 1+(byte) 1) goto atan2_16::@12
[223] (signed word) atan2_16::xi#8 ← phi( atan2_16::@18/(signed word) atan2_16::xi#1 atan2_16::@20/(signed word) atan2_16::xi#2 )
[223] (word) atan2_16::angle#13 ← phi( atan2_16::@18/(word) atan2_16::angle#2 atan2_16::@20/(word) atan2_16::angle#3 )
[223] (signed word) atan2_16::yi#8 ← phi( atan2_16::@18/(signed word) atan2_16::yi#1 atan2_16::@20/(signed word) atan2_16::yi#2 )
[224] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2
[225] if((byte) atan2_16::i#1==(const byte) CORDIC_ITERATIONS_16-(byte) 1+(byte) 1) goto atan2_16::@12
to:atan2_16::@10
atan2_16::@18: scope:[atan2_16] from atan2_16::@17
[234] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#5
[235] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#5
[236] (byte~) atan2_16::$22 ← (byte) atan2_16::i#2 << (byte) 1
[237] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word*) CORDIC_ATAN2_ANGLES_16 + (byte~) atan2_16::$22)
[226] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#5
[227] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#5
[228] (byte~) atan2_16::$22 ← (byte) atan2_16::i#2 << (byte) 1
[229] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word*) CORDIC_ATAN2_ANGLES_16 + (byte~) atan2_16::$22)
to:atan2_16::@19
atan2_16::@14: scope:[atan2_16] from atan2_16::@13
[238] (signed word) atan2_16::xd#1 ← (signed word) atan2_16::xd#3 >> (signed byte) 2
[239] (signed word) atan2_16::yd#1 ← (signed word) atan2_16::yd#3 >> (signed byte) 2
[240] (byte) atan2_16::shift#1 ← (byte) atan2_16::shift#2 - (byte) 2
[230] (signed word) atan2_16::xd#1 ← (signed word) atan2_16::xd#3 >> (signed byte) 2
[231] (signed word) atan2_16::yd#1 ← (signed word) atan2_16::yd#3 >> (signed byte) 2
[232] (byte) atan2_16::shift#1 ← (byte) atan2_16::shift#2 - (byte) 2
to:atan2_16::@13
atan2_16::@4: scope:[atan2_16] from atan2_16::@3
[241] (signed word) atan2_16::xi#13 ← (signed word) atan2_16::x#0
[233] (signed word) atan2_16::xi#13 ← (signed word) atan2_16::x#0
to:atan2_16::@6
atan2_16::@1: scope:[atan2_16] from atan2_16
[242] (signed word) atan2_16::yi#16 ← (signed word) atan2_16::y#0
[234] (signed word) atan2_16::yi#16 ← (signed word) atan2_16::y#0
to:atan2_16::@3
(void*()) malloc((word) malloc::size)
malloc: scope:[malloc] from @1 @3
[243] (byte*) heap_head#5 ← phi( @1/(const byte*) HEAP_TOP @3/(byte*) heap_head#1 )
[244] (byte*) malloc::mem#0 ← (byte*) heap_head#5 - (word) $3e8
[245] (byte*) heap_head#1 ← (byte*) malloc::mem#0
[235] (byte*) heap_head#5 ← phi( @1/(const byte*) HEAP_TOP @3/(byte*) heap_head#1 )
[236] (byte*) malloc::mem#0 ← (byte*) heap_head#5 - (word) $3e8
[237] (byte*) heap_head#1 ← (byte*) malloc::mem#0
to:malloc::@return
malloc::@return: scope:[malloc] from malloc
[246] return
[238] return
to:@return
interrupt(HARDWARE_ALL)(void()) irqBottom()
irqBottom: scope:[irqBottom] from
[247] phi()
[239] phi()
to:irqBottom::@1
irqBottom::@1: scope:[irqBottom] from irqBottom
[248] phi()
[249] call processChars
[240] phi()
[241] call processChars
to:irqBottom::@2
irqBottom::@2: scope:[irqBottom] from irqBottom::@1
[250] *((const byte*) RASTER) ← (const byte) RASTER_IRQ_TOP
[251] *((const void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_ALL)(void()) irqTop()
[252] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[242] *((const byte*) RASTER) ← (const byte) RASTER_IRQ_TOP
[243] *((const void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_ALL)(void()) irqTop()
[244] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
to:irqBottom::@return
irqBottom::@return: scope:[irqBottom] from irqBottom::@2
[253] return
[245] return
to:@return
(void()) processChars()
processChars: scope:[processChars] from irqBottom::@1
[254] phi()
[246] phi()
to:processChars::@1
processChars::@1: scope:[processChars] from processChars processChars::@2
[255] (byte) processChars::numActive#10 ← phi( processChars/(byte) 0 processChars::@2/(byte) processChars::numActive#3 )
[255] (byte) processChars::i#10 ← phi( processChars/(byte) 0 processChars::@2/(byte) processChars::i#1 )
[256] (byte~) processChars::$62 ← (byte) processChars::i#10 << (byte) 1
[257] (byte~) processChars::$63 ← (byte~) processChars::$62 + (byte) processChars::i#10
[258] (byte~) processChars::$64 ← (byte~) processChars::$63 << (byte) 1
[259] (byte~) processChars::$65 ← (byte~) processChars::$64 + (byte) processChars::i#10
[260] (byte~) processChars::$32 ← (byte~) processChars::$65 << (byte) 1
[261] (struct ProcessingSprite*) processChars::processing#0 ← (const struct ProcessingSprite*) PROCESSING + (byte~) processChars::$32
[262] (byte) processChars::bitmask#0 ← (byte) 1 << *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_ID)
[263] if(*((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS)==(const byte) STATUS_FREE) goto processChars::@2
[247] (byte) processChars::numActive#10 ← phi( processChars/(byte) 0 processChars::@2/(byte) processChars::numActive#3 )
[247] (byte) processChars::i#10 ← phi( processChars/(byte) 0 processChars::@2/(byte) processChars::i#1 )
[248] (byte~) processChars::$62 ← (byte) processChars::i#10 << (byte) 1
[249] (byte~) processChars::$63 ← (byte~) processChars::$62 + (byte) processChars::i#10
[250] (byte~) processChars::$64 ← (byte~) processChars::$63 << (byte) 1
[251] (byte~) processChars::$65 ← (byte~) processChars::$64 + (byte) processChars::i#10
[252] (byte~) processChars::$32 ← (byte~) processChars::$65 << (byte) 1
[253] (struct ProcessingSprite*) processChars::processing#0 ← (const struct ProcessingSprite*) PROCESSING + (byte~) processChars::$32
[254] (byte) processChars::bitmask#0 ← (byte) 1 << *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_ID)
[255] if(*((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS)==(const byte) STATUS_FREE) goto processChars::@2
to:processChars::@10
processChars::@10: scope:[processChars] from processChars::@1
[264] if(*((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS)!=(const byte) STATUS_NEW) goto processChars::@3
[256] if(*((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS)!=(const byte) STATUS_NEW) goto processChars::@3
to:processChars::@11
processChars::@11: scope:[processChars] from processChars::@10
[265] *(*((byte**)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_SCREENPTR)) ← (byte) ' '
[266] *((const byte*) SPRITES_ENABLE) ← *((const byte*) SPRITES_ENABLE) | (byte) processChars::bitmask#0
[267] *((const byte*) SPRITES_COLS + *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_ID)) ← *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_COL)
[268] *((const byte*) SCREEN+(const word) SPRITE_PTRS + *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_ID)) ← *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_PTR)
[269] *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS) ← (const byte) STATUS_PROCESSING
[257] *(*((byte**)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_SCREENPTR)) ← (byte) ' '
[258] *((const byte*) SPRITES_ENABLE) ← *((const byte*) SPRITES_ENABLE) | (byte) processChars::bitmask#0
[259] *((const byte*) SPRITES_COLS + *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_ID)) ← *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_COL)
[260] *((const byte*) SCREEN+(const word) SPRITE_PTRS + *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_ID)) ← *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_PTR)
[261] *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS) ← (const byte) STATUS_PROCESSING
to:processChars::@3
processChars::@3: scope:[processChars] from processChars::@10 processChars::@11
[270] (word) processChars::xpos#0 ← *((word*)(struct ProcessingSprite*) processChars::processing#0) >> (byte) 4
[271] (byte~) processChars::$9 ← > (word) processChars::xpos#0
[272] if((byte) 0!=(byte~) processChars::$9) goto processChars::@4
[262] (word) processChars::xpos#0 ← *((word*)(struct ProcessingSprite*) processChars::processing#0) >> (byte) 4
[263] (byte~) processChars::$9 ← > (word) processChars::xpos#0
[264] if((byte) 0!=(byte~) processChars::$9) goto processChars::@4
to:processChars::@8
processChars::@8: scope:[processChars] from processChars::@3
[273] (byte~) processChars::$10 ← (byte) $ff ^ (byte) processChars::bitmask#0
[274] *((const byte*) SPRITES_XMSB) ← *((const byte*) SPRITES_XMSB) & (byte~) processChars::$10
[265] (byte~) processChars::$10 ← (byte) $ff ^ (byte) processChars::bitmask#0
[266] *((const byte*) SPRITES_XMSB) ← *((const byte*) SPRITES_XMSB) & (byte~) processChars::$10
to:processChars::@5
processChars::@5: scope:[processChars] from processChars::@4 processChars::@8
[275] (byte~) processChars::$15 ← (byte) processChars::i#10 << (byte) 1
[276] (byte~) processChars::$12 ← (byte)(word) processChars::xpos#0
[277] *((const byte*) SPRITES_XPOS + (byte~) processChars::$15) ← (byte~) processChars::$12
[278] (word~) processChars::$13 ← *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y) >> (byte) 4
[279] (byte) processChars::ypos#0 ← (byte)(word~) processChars::$13
[280] *((const byte*) SPRITES_YPOS + (byte~) processChars::$15) ← (byte) processChars::ypos#0
[281] if(*((word*)(struct ProcessingSprite*) processChars::processing#0)<(const word) XPOS_LEFTMOST) goto processChars::@6
[267] (byte~) processChars::$15 ← (byte) processChars::i#10 << (byte) 1
[268] (byte~) processChars::$12 ← (byte)(word) processChars::xpos#0
[269] *((const byte*) SPRITES_XPOS + (byte~) processChars::$15) ← (byte~) processChars::$12
[270] (word~) processChars::$13 ← *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y) >> (byte) 4
[271] (byte) processChars::ypos#0 ← (byte)(word~) processChars::$13
[272] *((const byte*) SPRITES_YPOS + (byte~) processChars::$15) ← (byte) processChars::ypos#0
[273] if(*((word*)(struct ProcessingSprite*) processChars::processing#0)<(const word) XPOS_LEFTMOST) goto processChars::@6
to:processChars::@14
processChars::@14: scope:[processChars] from processChars::@5
[282] if(*((word*)(struct ProcessingSprite*) processChars::processing#0)>(const word) XPOS_RIGHTMOST) goto processChars::@6
[274] if(*((word*)(struct ProcessingSprite*) processChars::processing#0)>(const word) XPOS_RIGHTMOST) goto processChars::@6
to:processChars::@13
processChars::@13: scope:[processChars] from processChars::@14
[283] if(*((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y)<(const word) YPOS_TOPMOST) goto processChars::@6
[275] if(*((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y)<(const word) YPOS_TOPMOST) goto processChars::@6
to:processChars::@12
processChars::@12: scope:[processChars] from processChars::@13
[284] if(*((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y)>(const word) YPOS_BOTTOMMOST) goto processChars::@6
[276] if(*((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y)>(const word) YPOS_BOTTOMMOST) goto processChars::@6
to:processChars::@9
processChars::@9: scope:[processChars] from processChars::@12
[285] (word~) processChars::$23 ← (word) processChars::xpos#0 >> (byte) 3
[286] (byte~) processChars::$24 ← (byte)(word~) processChars::$23
[287] (byte) processChars::xchar#0 ← (byte~) processChars::$24 - (const byte) BORDER_XPOS_LEFT/(byte) 8
[288] (byte~) processChars::$33 ← (byte) processChars::xchar#0 << (byte) 1
[289] *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VX) ← *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VX) + *((const word*) VXSIN + (byte~) processChars::$33)
[290] *((word*)(struct ProcessingSprite*) processChars::processing#0) ← *((word*)(struct ProcessingSprite*) processChars::processing#0) + *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VX)
[291] (byte~) processChars::$27 ← (byte) processChars::ypos#0 >> (byte) 3
[292] (byte) processChars::ychar#0 ← (byte~) processChars::$27 - (const byte) BORDER_YPOS_TOP/(byte) 8
[293] (byte~) processChars::$34 ← (byte) processChars::ychar#0 << (byte) 1
[294] *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VY) ← *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VY) + *((const word*) VYSIN + (byte~) processChars::$34)
[295] *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y) ← *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y) + *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VY)
[277] (word~) processChars::$23 ← (word) processChars::xpos#0 >> (byte) 3
[278] (byte~) processChars::$24 ← (byte)(word~) processChars::$23
[279] (byte) processChars::xchar#0 ← (byte~) processChars::$24 - (const byte) BORDER_XPOS_LEFT/(byte) 8
[280] (byte~) processChars::$33 ← (byte) processChars::xchar#0 << (byte) 1
[281] *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VX) ← *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VX) + *((const word*) VXSIN + (byte~) processChars::$33)
[282] *((word*)(struct ProcessingSprite*) processChars::processing#0) ← *((word*)(struct ProcessingSprite*) processChars::processing#0) + *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VX)
[283] (byte~) processChars::$27 ← (byte) processChars::ypos#0 >> (byte) 3
[284] (byte) processChars::ychar#0 ← (byte~) processChars::$27 - (const byte) BORDER_YPOS_TOP/(byte) 8
[285] (byte~) processChars::$34 ← (byte) processChars::ychar#0 << (byte) 1
[286] *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VY) ← *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VY) + *((const word*) VYSIN + (byte~) processChars::$34)
[287] *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y) ← *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_Y) + *((word*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_VY)
to:processChars::@7
processChars::@7: scope:[processChars] from processChars::@6 processChars::@9
[296] (byte) processChars::numActive#1 ← ++ (byte) processChars::numActive#10
[288] (byte) processChars::numActive#1 ← ++ (byte) processChars::numActive#10
to:processChars::@2
processChars::@2: scope:[processChars] from processChars::@1 processChars::@7
[297] (byte) processChars::numActive#3 ← phi( processChars::@1/(byte) processChars::numActive#10 processChars::@7/(byte) processChars::numActive#1 )
[298] (byte) processChars::i#1 ← ++ (byte) processChars::i#10
[299] if((byte) processChars::i#1!=(const byte) NUM_PROCESSING-(byte) 1+(byte) 1) goto processChars::@1
[289] (byte) processChars::numActive#3 ← phi( processChars::@1/(byte) processChars::numActive#10 processChars::@7/(byte) processChars::numActive#1 )
[290] (byte) processChars::i#1 ← ++ (byte) processChars::i#10
[291] if((byte) processChars::i#1!=(const byte) NUM_PROCESSING-(byte) 1+(byte) 1) goto processChars::@1
to:processChars::@return
processChars::@return: scope:[processChars] from processChars::@2
[300] return
[292] return
to:@return
processChars::@6: scope:[processChars] from processChars::@12 processChars::@13 processChars::@14 processChars::@5
[301] *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS) ← (const byte) STATUS_FREE
[302] (byte~) processChars::$29 ← (byte) $ff ^ (byte) processChars::bitmask#0
[303] *((const byte*) SPRITES_ENABLE) ← *((const byte*) SPRITES_ENABLE) & (byte~) processChars::$29
[293] *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS) ← (const byte) STATUS_FREE
[294] (byte~) processChars::$29 ← (byte) $ff ^ (byte) processChars::bitmask#0
[295] *((const byte*) SPRITES_ENABLE) ← *((const byte*) SPRITES_ENABLE) & (byte~) processChars::$29
to:processChars::@7
processChars::@4: scope:[processChars] from processChars::@3
[304] *((const byte*) SPRITES_XMSB) ← *((const byte*) SPRITES_XMSB) | (byte) processChars::bitmask#0
[296] *((const byte*) SPRITES_XMSB) ← *((const byte*) SPRITES_XMSB) | (byte) processChars::bitmask#0
to:processChars::@5
interrupt(HARDWARE_ALL)(void()) irqTop()
irqTop: scope:[irqTop] from
[305] phi()
[297] phi()
to:irqTop::@1
irqTop::@1: scope:[irqTop] from irqTop
[306] *((const byte*) RASTER) ← (const byte) RASTER_IRQ_MIDDLE
[307] *((const void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_ALL)(void()) irqBottom()
[308] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[298] *((const byte*) RASTER) ← (const byte) RASTER_IRQ_MIDDLE
[299] *((const void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_ALL)(void()) irqBottom()
[300] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
to:irqTop::@return
irqTop::@return: scope:[irqTop] from irqTop::@1
[309] return
[301] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
(const struct ProcessingSprite) $2 = { x: (word) 0, y: (word) 0, vx: (word) 0, vy: (word) 0, id: (byte) 0, ptr: (byte) 0, col: (byte) 0, status: (const byte) STATUS_FREE, screenPtr: (byte*) 0 }
(label) @1
(label) @2
(label) @3
@ -59,9 +60,10 @@
(const byte) RASTER_IRQ_TOP = (byte) $30
(const byte*) SCREEN = (byte*) 1024
(byte*) SCREEN_COPY
(void*) SCREEN_COPY#0 SCREEN_COPY zp[2]:7 0.0273972602739726
(void*) SCREEN_COPY#0 SCREEN_COPY zp[2]:7 0.03076923076923077
(byte*) SCREEN_DIST
(void*) SCREEN_DIST#0 SCREEN_DIST zp[2]:9 0.028169014084507043
(void*) SCREEN_DIST#0 SCREEN_DIST zp[2]:9 0.031746031746031744
(const byte) SIZEOF_STRUCT_PROCESSINGSPRITE = (byte) $e
(const byte*) SPRITES_COLS = (byte*) 53287
(const byte*) SPRITES_ENABLE = (byte*) 53269
(const byte*) SPRITES_EXPAND_X = (byte*) 53277
@ -185,16 +187,16 @@
(label) getCharToProcess::@9
(label) getCharToProcess::@return
(byte) getCharToProcess::closest_dist
(byte) getCharToProcess::closest_dist#10 closest_dist zp[1]:11 202.0
(byte) getCharToProcess::closest_dist#12 closest_dist zp[1]:11 2002.0
(byte) getCharToProcess::closest_dist#2 closest_dist zp[1]:11 1026.25
(byte) getCharToProcess::closest_dist#8 closest_dist zp[1]:11 202.0
(byte) getCharToProcess::closest_dist#10 closest_dist zp[1]:18 202.0
(byte) getCharToProcess::closest_dist#12 closest_dist zp[1]:18 2002.0
(byte) getCharToProcess::closest_dist#2 closest_dist zp[1]:18 1026.25
(byte) getCharToProcess::closest_dist#8 closest_dist zp[1]:18 202.0
(byte) getCharToProcess::closest_x
(byte) getCharToProcess::closest_x#7 closest_x zp[1]:18 517.3333333333334
(byte) getCharToProcess::closest_x#9 closest_x zp[1]:18 202.0
(byte) getCharToProcess::closest_x#7 closest_x zp[1]:23 517.3333333333334
(byte) getCharToProcess::closest_x#9 closest_x zp[1]:23 202.0
(byte) getCharToProcess::closest_y
(byte) getCharToProcess::closest_y#7 closest_y zp[1]:23 517.3333333333334
(byte) getCharToProcess::closest_y#9 closest_y zp[1]:23 202.0
(byte) getCharToProcess::closest_y#7 closest_y zp[1]:11 517.3333333333334
(byte) getCharToProcess::closest_y#9 closest_y zp[1]:11 202.0
(byte) getCharToProcess::dist
(byte) getCharToProcess::dist#0 reg byte x 750.75
(byte*) getCharToProcess::dist_line
@ -209,12 +211,12 @@
(byte) getCharToProcess::return_dist#6 reg byte x 2002.0
(byte) getCharToProcess::return_x
(byte) getCharToProcess::return_x#0 reg byte y 7.333333333333333
(byte) getCharToProcess::return_x#1 return_x zp[1]:18 228.7777777777778
(byte) getCharToProcess::return_x#7 return_x zp[1]:18 1001.0
(byte) getCharToProcess::return_x#1 return_x zp[1]:23 228.7777777777778
(byte) getCharToProcess::return_x#7 return_x zp[1]:23 1001.0
(byte) getCharToProcess::return_y
(byte) getCharToProcess::return_y#0 reg byte a 7.333333333333333
(byte) getCharToProcess::return_y#1 return_y zp[1]:23 216.6315789473684
(byte) getCharToProcess::return_y#7 return_y zp[1]:23 2002.0
(byte) getCharToProcess::return_y#1 return_y zp[1]:11 216.6315789473684
(byte) getCharToProcess::return_y#7 return_y zp[1]:11 2002.0
(byte*) getCharToProcess::screen_line
(byte*) getCharToProcess::screen_line#0 screen_line zp[2]:28 2.0
(byte*) getCharToProcess::screen_line#1 screen_line zp[2]:28 40.4
@ -277,8 +279,8 @@
(signed word) init_angle_screen::xw
(word) init_angle_screen::xw#0 xw zp[2]:26 33.666666666666664
(byte) init_angle_screen::y
(byte) init_angle_screen::y#1 y zp[1]:11 16.5
(byte) init_angle_screen::y#5 y zp[1]:11 4.730769230769231
(byte) init_angle_screen::y#1 y zp[1]:2 16.5
(byte) init_angle_screen::y#5 y zp[1]:2 4.730769230769231
(signed word) init_angle_screen::yw
(word) init_angle_screen::yw#0 yw zp[2]:28 50.5
interrupt(HARDWARE_ALL)(void()) irqBottom()
@ -292,11 +294,11 @@ interrupt(HARDWARE_ALL)(void()) irqTop()
(byte) irqTop::i
(byte) irqTop::i1
(void()) main()
(byte~) main::$10 reg byte y 12.222222222222221
(byte~) main::$20 reg byte a 22.0
(byte~) main::$21 reg byte a 22.0
(byte~) main::$22 reg byte a 22.0
(byte~) main::$23 reg byte a 22.0
(byte~) main::$10 reg byte a 22.0
(byte~) main::$11 reg byte a 22.0
(byte~) main::$12 reg byte a 22.0
(byte~) main::$13 reg byte a 22.0
(byte~) main::$14 reg byte a 22.0
(struct ProcessingChar~) main::$5
(label) main::@1
(label) main::@10
@ -314,14 +316,14 @@ interrupt(HARDWARE_ALL)(void()) irqTop()
(byte) main::center_x
(byte) main::center_x#0 reg byte y 5.5
(byte) main::center_y
(byte) main::center_y#0 center_y zp[1]:30 5.5
(byte) main::center_y#0 center_y zp[1]:11 5.5
(byte*) main::dst
(byte*) main::dst#0 dst zp[2]:3 4.0
(byte*) main::dst#1 dst zp[2]:3 22.0
(byte*) main::dst#2 dst zp[2]:3 8.75
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 3.6666666666666665
(byte) main::i#1 i zp[1]:2 16.5
(byte) main::i#2 i zp[1]:2 7.857142857142857
(byte*) main::src
(byte*) main::src#1 src zp[2]:28 11.0
(byte*) main::src#2 src zp[2]:28 14.666666666666666
@ -429,9 +431,9 @@ interrupt(HARDWARE_ALL)(void()) irqTop()
(struct ProcessingChar) startProcessing::center
(byte) startProcessing::center_dist
(byte) startProcessing::center_x
(byte) startProcessing::center_x#0 center_x zp[1]:11 0.30952380952380953
(byte) startProcessing::center_x#0 center_x zp[1]:30 0.30952380952380953
(byte) startProcessing::center_y
(byte) startProcessing::center_y#0 center_y zp[1]:30 0.24444444444444444
(byte) startProcessing::center_y#0 center_y zp[1]:11 0.24444444444444444
(byte) startProcessing::ch
(byte) startProcessing::ch#0 reg byte a 2.0
(byte*) startProcessing::chargenData
@ -469,13 +471,12 @@ interrupt(HARDWARE_ALL)(void()) irqTop()
(word) startProcessing::spriteY
(word) startProcessing::spriteY#0 spriteY zp[2]:21 0.4
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ startProcessing::freeIdx#6 startProcessing::freeIdx#7 ]
reg byte x [ startProcessing::i1#2 startProcessing::i1#1 ]
zp[1]:2 [ getCharToProcess::y#7 getCharToProcess::y#1 startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 ]
reg byte y [ getCharToProcess::x#2 getCharToProcess::x#1 ]
reg byte x [ getCharToProcess::return_dist#1 getCharToProcess::return_dist#5 getCharToProcess::return_dist#6 getCharToProcess::dist#0 ]
reg byte x [ initSprites::i#2 initSprites::i#1 ]
zp[1]:2 [ init_angle_screen::y#5 init_angle_screen::y#1 getCharToProcess::y#7 getCharToProcess::y#1 startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 main::i#2 main::i#1 ]
zp[2]:3 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#0 init_angle_screen::screen_topline#1 getCharToProcess::dist_line#6 getCharToProcess::dist_line#0 getCharToProcess::dist_line#1 startProcessing::spriteData#2 startProcessing::spriteData#0 startProcessing::spriteData#1 startProcessing::$6 startProcessing::$5 main::dst#2 main::dst#0 main::dst#1 ]
reg byte x [ atan2_16::i#2 atan2_16::i#1 ]
reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ]
@ -483,17 +484,17 @@ zp[1]:5 [ processChars::i#10 processChars::i#1 ]
zp[1]:6 [ processChars::numActive#10 processChars::numActive#3 processChars::numActive#1 ]
zp[2]:7 [ SCREEN_COPY#0 ]
zp[2]:9 [ SCREEN_DIST#0 malloc::mem#0 ]
reg byte a [ main::$20 ]
reg byte a [ main::$21 ]
reg byte a [ main::$22 ]
reg byte a [ main::$23 ]
reg byte y [ main::$10 ]
reg byte a [ main::$11 ]
reg byte a [ main::$12 ]
reg byte a [ main::$13 ]
reg byte a [ main::$14 ]
reg byte a [ main::$10 ]
reg byte y [ getCharToProcess::return_x#0 ]
reg byte a [ getCharToProcess::return_y#0 ]
reg byte x [ getCharToProcess::return_dist#0 ]
reg byte y [ main::center_x#0 ]
zp[1]:11 [ main::center_y#0 startProcessing::center_y#0 getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ]
reg byte a [ main::center_dist#0 ]
zp[1]:11 [ startProcessing::center_x#0 init_angle_screen::y#5 init_angle_screen::y#1 getCharToProcess::closest_dist#2 getCharToProcess::closest_dist#8 getCharToProcess::closest_dist#10 getCharToProcess::closest_dist#12 ]
reg byte a [ startProcessing::$39 ]
reg byte a [ startProcessing::$40 ]
reg byte a [ startProcessing::$41 ]
@ -502,11 +503,11 @@ reg byte a [ startProcessing::$27 ]
zp[2]:12 [ startProcessing::$0 startProcessing::$45 startProcessing::$1 startProcessing::offset#0 startProcessing::screenPtr#0 atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ]
zp[2]:14 [ startProcessing::$44 atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ]
zp[2]:16 [ startProcessing::colPtr#0 atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_angle_screen::angle_w#0 init_angle_screen::$11 ]
zp[1]:18 [ startProcessing::spriteCol#0 init_angle_screen::x#2 init_angle_screen::x#1 getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ]
zp[1]:18 [ startProcessing::spriteCol#0 init_angle_screen::x#2 init_angle_screen::x#1 getCharToProcess::closest_dist#2 getCharToProcess::closest_dist#8 getCharToProcess::closest_dist#10 getCharToProcess::closest_dist#12 ]
reg byte a [ startProcessing::ch#0 ]
zp[2]:19 [ startProcessing::$11 startProcessing::$12 startProcessing::$13 startProcessing::spriteX#0 atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ]
zp[2]:21 [ startProcessing::$15 startProcessing::$16 startProcessing::$17 startProcessing::spriteY#0 atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ]
zp[1]:23 [ startProcessing::spritePtr#0 init_angle_screen::xb#2 init_angle_screen::xb#1 getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ]
zp[1]:23 [ startProcessing::spritePtr#0 init_angle_screen::xb#2 init_angle_screen::xb#1 getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ]
reg byte a [ startProcessing::$20 ]
reg byte a [ startProcessing::$47 ]
reg byte a [ startProcessing::$48 ]
@ -519,7 +520,7 @@ reg byte a [ init_angle_screen::$4 ]
zp[2]:26 [ init_angle_screen::xw#0 atan2_16::x#0 getCharToProcess::$12 ]
reg byte a [ init_angle_screen::$7 ]
zp[2]:28 [ init_angle_screen::yw#0 atan2_16::y#0 initSprites::sp#2 initSprites::sp#1 getCharToProcess::screen_line#4 getCharToProcess::screen_line#0 getCharToProcess::screen_line#1 startProcessing::chargenData#2 startProcessing::chargenData#0 startProcessing::chargenData#1 startProcessing::$9 startProcessing::$8 main::src#2 main::src#1 ]
zp[1]:30 [ init_angle_screen::ang_w#0 main::center_y#0 startProcessing::center_y#0 ]
zp[1]:30 [ init_angle_screen::ang_w#0 startProcessing::center_x#0 ]
reg byte a [ init_angle_screen::$13 ]
reg byte a [ init_angle_screen::$14 ]
reg byte a [ init_angle_screen::$15 ]

View File

@ -29,14 +29,18 @@ main: {
sta p2-1,y
dey
bne !-
lda.z p1
sta.z v
lda p1+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_POINT_Y
lda.z p2
sta v+OFFSET_STRUCT_VECTOR_Q
lda p2+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
ldy #SIZEOF_STRUCT_POINT
!:
lda p1-1,y
sta v-1,y
dey
bne !-
ldy #SIZEOF_STRUCT_POINT
!:
lda p2-1,y
sta v+OFFSET_STRUCT_VECTOR_Q-1,y
dey
bne !-
lda.z v
sta SCREEN
lda v+OFFSET_STRUCT_POINT_Y

View File

@ -13,15 +13,13 @@ main: scope:[main] from @1
[4] *(&(struct Vector) main::v) ← memset(struct Vector, (const byte) SIZEOF_STRUCT_VECTOR)
[5] *(&(struct Point) main::p1) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[6] *(&(struct Point) main::p2) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[7] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1)
[8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y)
[9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2)
[10] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y)
[11] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v)
[12] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y)
[13] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
[14] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
[7] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[8] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[9] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v)
[10] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y)
[11] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
[12] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
to:main::@return
main::@return: scope:[main] from main
[15] return
[13] return
to:@return

View File

@ -7,10 +7,8 @@ Replacing struct member reference (struct Vector) main::v.p with member unwindin
Replacing struct member reference (struct Vector) main::v.p with member unwinding reference *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P)
Replacing struct member reference (struct Vector) main::v.q with member unwinding reference *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
Replacing struct member reference (struct Vector) main::v.q with member unwinding reference *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
Adding struct value member variable copy *((byte*~) main::$0) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_X)
Adding struct value member variable copy *((byte*~) main::$1) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y)
Adding struct value member variable copy *((byte*~) main::$2) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_X)
Adding struct value member variable copy *((byte*~) main::$3) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y)
Adding struct value member variable copy *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Adding struct value member variable copy *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Rewriting struct pointer member access *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P).x
Rewriting struct pointer member access *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P).y
Rewriting struct pointer member access *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q).x
@ -25,22 +23,16 @@ main: scope:[main] from @1
*(&(struct Vector) main::v) ← memset(struct Vector, (const byte) SIZEOF_STRUCT_VECTOR)
*(&(struct Point) main::p1) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
*(&(struct Point) main::p2) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
*((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
*((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT)
(byte*~) main::$0 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
*((byte*~) main::$0) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_X)
*((const byte*) SCREEN + (number) 0) ← *((byte*~) main::$0)
(byte*~) main::$1 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
*((byte*~) main::$1) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y)
*((const byte*) SCREEN + (number) 1) ← *((byte*~) main::$1)
(byte*~) main::$2 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
*((byte*~) main::$2) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_X)
*((const byte*) SCREEN + (number) 2) ← *((byte*~) main::$2)
(byte*~) main::$3 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
*((byte*~) main::$3) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y)
(byte*~) main::$4 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
*((const byte*) SCREEN + (number) 0) ← *((byte*~) main::$4)
(byte*~) main::$5 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
*((const byte*) SCREEN + (number) 1) ← *((byte*~) main::$5)
(byte*~) main::$6 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
*((const byte*) SCREEN + (number) 2) ← *((byte*~) main::$6)
(byte*~) main::$7 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
*((const byte*) SCREEN + (number) 3) ← *((byte*~) main::$7)
*((const byte*) SCREEN + (number) 3) ← *((byte*~) main::$3)
to:main::@return
main::@return: scope:[main] from main
return
@ -75,19 +67,15 @@ SYMBOL TABLE SSA
(byte*~) main::$1
(byte*~) main::$2
(byte*~) main::$3
(byte*~) main::$4
(byte*~) main::$5
(byte*~) main::$6
(byte*~) main::$7
(label) main::@return
(struct Point) main::p1 loadstore
(struct Point) main::p2 loadstore
(struct Vector) main::v loadstore
Adding number conversion cast (unumber) 0 in *((const byte*) SCREEN + (number) 0) ← *((byte*~) main::$4)
Adding number conversion cast (unumber) 1 in *((const byte*) SCREEN + (number) 1) ← *((byte*~) main::$5)
Adding number conversion cast (unumber) 2 in *((const byte*) SCREEN + (number) 2) ← *((byte*~) main::$6)
Adding number conversion cast (unumber) 3 in *((const byte*) SCREEN + (number) 3) ← *((byte*~) main::$7)
Adding number conversion cast (unumber) 0 in *((const byte*) SCREEN + (number) 0) ← *((byte*~) main::$0)
Adding number conversion cast (unumber) 1 in *((const byte*) SCREEN + (number) 1) ← *((byte*~) main::$1)
Adding number conversion cast (unumber) 2 in *((const byte*) SCREEN + (number) 2) ← *((byte*~) main::$2)
Adding number conversion cast (unumber) 3 in *((const byte*) SCREEN + (number) 3) ← *((byte*~) main::$3)
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
@ -100,47 +88,30 @@ Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant right-side identified [3] (byte*~) main::$0 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [5] (byte*~) main::$1 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [7] (byte*~) main::$2 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [9] (byte*~) main::$3 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [11] (byte*~) main::$4 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [13] (byte*~) main::$5 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [15] (byte*~) main::$6 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [17] (byte*~) main::$7 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [5] (byte*~) main::$0 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [7] (byte*~) main::$1 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [9] (byte*~) main::$2 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [11] (byte*~) main::$3 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) main::$0 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$1 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P+OFFSET_STRUCT_POINT_Y
Constant (const byte*) main::$2 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$3 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
Constant (const byte*) main::$4 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$5 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P+OFFSET_STRUCT_POINT_Y
Constant (const byte*) main::$6 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$7 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P in
Simplifying expression containing zero (struct Point*)&main::v in
Simplifying expression containing zero (struct Point*)&main::v in
Simplifying expression containing zero (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q in
Simplifying expression containing zero (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P in
Simplifying expression containing zero (struct Point*)&main::v in
Simplifying expression containing zero (struct Point*)&main::v in
Simplifying expression containing zero (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q in
Simplifying expression containing zero (byte*)&main::p1 in [4] *((const byte*) main::$0) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_X)
Simplifying expression containing zero (byte*)&main::p2 in [8] *((const byte*) main::$2) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_X)
Simplifying expression containing zero SCREEN in [12] *((const byte*) SCREEN + (byte) 0) ← *((const byte*) main::$4)
Simplifying expression containing zero (struct Point*)&main::v in [3] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Simplifying expression containing zero SCREEN in [6] *((const byte*) SCREEN + (byte) 0) ← *((const byte*) main::$0)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_VECTOR_P
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
Constant inlined main::$3 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$1 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$2 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q
Constant inlined main::$0 = (byte*)(struct Point*)&(struct Vector) main::v
Constant inlined main::$5 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$6 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q
Constant inlined main::$3 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$4 = (byte*)(struct Point*)&(struct Vector) main::v
Constant inlined main::$7 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(SCREEN+1)
Consolidated array index constant in *(SCREEN+2)
@ -176,17 +147,15 @@ main: scope:[main] from @1
[4] *(&(struct Vector) main::v) ← memset(struct Vector, (const byte) SIZEOF_STRUCT_VECTOR)
[5] *(&(struct Point) main::p1) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[6] *(&(struct Point) main::p2) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[7] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1)
[8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y)
[9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2)
[10] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y)
[11] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v)
[12] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y)
[13] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
[14] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
[7] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[8] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[9] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v)
[10] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y)
[11] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
[12] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
to:main::@return
main::@return: scope:[main] from main
[15] return
[13] return
to:@return
@ -266,34 +235,36 @@ main: {
sta p2-1,y
dey
bne !-
// [7] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1) -- _deref_pbuc1=_deref_pbuc2
lda.z p1
sta.z v
// [8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p1+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_POINT_Y
// [9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2) -- _deref_pbuc1=_deref_pbuc2
lda.z p2
sta v+OFFSET_STRUCT_VECTOR_Q
// [10] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p2+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
// [11] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
// [7] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p1-1,y
sta v-1,y
dey
bne !-
// [8] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p2-1,y
sta v+OFFSET_STRUCT_VECTOR_Q-1,y
dey
bne !-
// [9] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
lda.z v
sta SCREEN
// [12] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [10] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
// [13] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
// [11] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q
sta SCREEN+2
// [14] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [12] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
sta SCREEN+3
jmp __breturn
// main::@return
__breturn:
// [15] return
// [13] return
rts
}
// File Data
@ -304,14 +275,12 @@ REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *(&(struct Vector) main::v) ← memset(struct Vector, (const byte) SIZEOF_STRUCT_VECTOR) [ main::v main::p1 main::p2 ] ( main:2 [ main::v main::p1 main::p2 ] ) always clobbers reg byte a reg byte y
Statement [5] *(&(struct Point) main::p1) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::v main::p1 main::p2 ] ( main:2 [ main::v main::p1 main::p2 ] ) always clobbers reg byte a reg byte y
Statement [6] *(&(struct Point) main::p2) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::v main::p1 main::p2 ] ( main:2 [ main::v main::p1 main::p2 ] ) always clobbers reg byte a reg byte y
Statement [7] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1) [ main::v main::p1 main::p2 ] ( main:2 [ main::v main::p1 main::p2 ] ) always clobbers reg byte a
Statement [8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y) [ main::v main::p2 ] ( main:2 [ main::v main::p2 ] ) always clobbers reg byte a
Statement [9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2) [ main::v main::p2 ] ( main:2 [ main::v main::p2 ] ) always clobbers reg byte a
Statement [10] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [11] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [12] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [13] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [14] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [7] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::v main::p2 ] ( main:2 [ main::v main::p2 ] ) always clobbers reg byte a reg byte y
Statement [8] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a reg byte y
Statement [9] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [10] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [11] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [12] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) [ ] ( main:2 [ ] ) always clobbers reg byte a
Potential registers zp[4]:2 [ main::v ] : zp[4]:2 ,
Potential registers zp[2]:6 [ main::p1 ] : zp[2]:6 ,
Potential registers zp[2]:8 [ main::p2 ] : zp[2]:8 ,
@ -322,10 +291,10 @@ Uplift Scope [Vector]
Uplift Scope [main] 0: zp[4]:2 [ main::v ] 0: zp[2]:6 [ main::p1 ] 0: zp[2]:8 [ main::p2 ]
Uplift Scope []
Uplifting [Point] best 126 combination
Uplifting [Vector] best 126 combination
Uplifting [main] best 126 combination zp[4]:2 [ main::v ] zp[2]:6 [ main::p1 ] zp[2]:8 [ main::p2 ]
Uplifting [] best 126 combination
Uplifting [Point] best 129 combination
Uplifting [Vector] best 129 combination
Uplifting [main] best 129 combination zp[4]:2 [ main::v ] zp[2]:6 [ main::p1 ] zp[2]:8 [ main::p2 ]
Uplifting [] best 129 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -380,34 +349,36 @@ main: {
sta p2-1,y
dey
bne !-
// [7] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1) -- _deref_pbuc1=_deref_pbuc2
lda.z p1
sta.z v
// [8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p1+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_POINT_Y
// [9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2) -- _deref_pbuc1=_deref_pbuc2
lda.z p2
sta v+OFFSET_STRUCT_VECTOR_Q
// [10] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p2+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
// [11] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
// [7] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p1-1,y
sta v-1,y
dey
bne !-
// [8] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p2-1,y
sta v+OFFSET_STRUCT_VECTOR_Q-1,y
dey
bne !-
// [9] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
lda.z v
sta SCREEN
// [12] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [10] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
// [13] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
// [11] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q
sta SCREEN+2
// [14] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [12] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
sta SCREEN+3
jmp __breturn
// main::@return
__breturn:
// [15] return
// [13] return
rts
}
// File Data
@ -460,7 +431,7 @@ zp[2]:8 [ main::p2 ]
FINAL ASSEMBLER
Score: 111
Score: 114
// File Comments
// Minimal struct with C-Standard behavior - struct containing struct with assignment of sub-struct
@ -510,38 +481,40 @@ main: {
dey
bne !-
// v.p = p1
// [7] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1) -- _deref_pbuc1=_deref_pbuc2
lda.z p1
sta.z v
// [8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p1+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_POINT_Y
// [7] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p1-1,y
sta v-1,y
dey
bne !-
// v.q = p2
// [9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2) -- _deref_pbuc1=_deref_pbuc2
lda.z p2
sta v+OFFSET_STRUCT_VECTOR_Q
// [10] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p2+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
// [8] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p2-1,y
sta v+OFFSET_STRUCT_VECTOR_Q-1,y
dey
bne !-
// SCREEN[0] = v.p.x
// [11] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
// [9] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
lda.z v
sta SCREEN
// SCREEN[1] = v.p.y
// [12] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [10] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
// SCREEN[2] = v.q.x
// [13] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
// [11] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q
sta SCREEN+2
// SCREEN[3] = v.q.y
// [14] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [12] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
sta SCREEN+3
// main::@return
// }
// [15] return
// [13] return
rts
}
// File Data

View File

@ -22,14 +22,18 @@ main: {
sta p2-1,y
dey
bne !-
lda.z p1
sta.z v
lda p1+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_POINT_Y
lda.z p2
sta v+OFFSET_STRUCT_VECTOR_Q
lda p2+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
ldy #SIZEOF_STRUCT_POINT
!:
lda p1-1,y
sta v-1,y
dey
bne !-
ldy #SIZEOF_STRUCT_POINT
!:
lda p2-1,y
sta v+OFFSET_STRUCT_VECTOR_Q-1,y
dey
bne !-
lda.z v
sta SCREEN
lda v+OFFSET_STRUCT_POINT_Y

View File

@ -12,15 +12,13 @@
main: scope:[main] from @1
[4] *(&(struct Point) main::p1) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[5] *(&(struct Point) main::p2) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[6] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1)
[7] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y)
[8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2)
[9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y)
[10] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v)
[11] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y)
[12] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
[13] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
[6] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[7] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[8] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v)
[9] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y)
[10] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
[11] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
to:main::@return
main::@return: scope:[main] from main
[14] return
[12] return
to:@return

View File

@ -6,10 +6,8 @@ Replacing struct member reference (struct Vector) main::v.p with member unwindin
Replacing struct member reference (struct Vector) main::v.p with member unwinding reference *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P)
Replacing struct member reference (struct Vector) main::v.q with member unwinding reference *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
Replacing struct member reference (struct Vector) main::v.q with member unwinding reference *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
Adding struct value member variable copy *((byte*~) main::$0) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_X)
Adding struct value member variable copy *((byte*~) main::$1) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y)
Adding struct value member variable copy *((byte*~) main::$2) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_X)
Adding struct value member variable copy *((byte*~) main::$3) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y)
Adding struct value member variable copy *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Adding struct value member variable copy *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Rewriting struct pointer member access *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P).x
Rewriting struct pointer member access *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P).y
Rewriting struct pointer member access *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q).x
@ -23,23 +21,17 @@ CONTROL FLOW GRAPH SSA
main: scope:[main] from @1
*(&(struct Point) main::p1) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
*(&(struct Point) main::p2) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
(byte*~) main::$0 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
*((byte*~) main::$0) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_X)
(byte*~) main::$1 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
*((byte*~) main::$1) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y)
(byte*~) main::$2 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
*((byte*~) main::$2) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_X)
(byte*~) main::$3 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
*((byte*~) main::$3) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y)
*((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
*((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT)
(struct Vector) main::v ← struct-unwound {*((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P), *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)}
(byte*~) main::$4 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
*((const byte*) SCREEN + (number) 0) ← *((byte*~) main::$4)
(byte*~) main::$5 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
*((const byte*) SCREEN + (number) 1) ← *((byte*~) main::$5)
(byte*~) main::$6 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
*((const byte*) SCREEN + (number) 2) ← *((byte*~) main::$6)
(byte*~) main::$7 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
*((const byte*) SCREEN + (number) 3) ← *((byte*~) main::$7)
(byte*~) main::$0 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
*((const byte*) SCREEN + (number) 0) ← *((byte*~) main::$0)
(byte*~) main::$1 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
*((const byte*) SCREEN + (number) 1) ← *((byte*~) main::$1)
(byte*~) main::$2 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
*((const byte*) SCREEN + (number) 2) ← *((byte*~) main::$2)
(byte*~) main::$3 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
*((const byte*) SCREEN + (number) 3) ← *((byte*~) main::$3)
to:main::@return
main::@return: scope:[main] from main
return
@ -73,19 +65,15 @@ SYMBOL TABLE SSA
(byte*~) main::$1
(byte*~) main::$2
(byte*~) main::$3
(byte*~) main::$4
(byte*~) main::$5
(byte*~) main::$6
(byte*~) main::$7
(label) main::@return
(struct Point) main::p1 loadstore
(struct Point) main::p2 loadstore
(struct Vector) main::v loadstore
Adding number conversion cast (unumber) 0 in *((const byte*) SCREEN + (number) 0) ← *((byte*~) main::$4)
Adding number conversion cast (unumber) 1 in *((const byte*) SCREEN + (number) 1) ← *((byte*~) main::$5)
Adding number conversion cast (unumber) 2 in *((const byte*) SCREEN + (number) 2) ← *((byte*~) main::$6)
Adding number conversion cast (unumber) 3 in *((const byte*) SCREEN + (number) 3) ← *((byte*~) main::$7)
Adding number conversion cast (unumber) 0 in *((const byte*) SCREEN + (number) 0) ← *((byte*~) main::$0)
Adding number conversion cast (unumber) 1 in *((const byte*) SCREEN + (number) 1) ← *((byte*~) main::$1)
Adding number conversion cast (unumber) 2 in *((const byte*) SCREEN + (number) 2) ← *((byte*~) main::$2)
Adding number conversion cast (unumber) 3 in *((const byte*) SCREEN + (number) 3) ← *((byte*~) main::$3)
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
@ -98,48 +86,31 @@ Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Removing C-classic struct-unwound assignment [10] (struct Vector) main::v ← struct-unwound {*((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P), *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)}
Constant right-side identified [2] (byte*~) main::$0 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [4] (byte*~) main::$1 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [6] (byte*~) main::$2 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [8] (byte*~) main::$3 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [11] (byte*~) main::$4 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [13] (byte*~) main::$5 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [15] (byte*~) main::$6 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [17] (byte*~) main::$7 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
Removing C-classic struct-unwound assignment [4] (struct Vector) main::v ← struct-unwound {*((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P), *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)}
Constant right-side identified [5] (byte*~) main::$0 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [7] (byte*~) main::$1 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [9] (byte*~) main::$2 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [11] (byte*~) main::$3 ← (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q + (const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) main::$0 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$1 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P+OFFSET_STRUCT_POINT_Y
Constant (const byte*) main::$2 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$3 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
Constant (const byte*) main::$4 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$5 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P+OFFSET_STRUCT_POINT_Y
Constant (const byte*) main::$6 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$7 = (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P in
Simplifying expression containing zero (struct Point*)&main::v in
Simplifying expression containing zero (struct Point*)&main::v in
Simplifying expression containing zero (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q in
Simplifying expression containing zero (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P in
Simplifying expression containing zero (struct Point*)&main::v in
Simplifying expression containing zero (struct Point*)&main::v in
Simplifying expression containing zero (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q in
Simplifying expression containing zero (byte*)&main::p1 in [3] *((const byte*) main::$0) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_X)
Simplifying expression containing zero (byte*)&main::p2 in [7] *((const byte*) main::$2) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_X)
Simplifying expression containing zero SCREEN in [12] *((const byte*) SCREEN + (byte) 0) ← *((const byte*) main::$4)
Simplifying expression containing zero (struct Point*)&main::v in [2] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Simplifying expression containing zero SCREEN in [6] *((const byte*) SCREEN + (byte) 0) ← *((const byte*) main::$0)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_VECTOR_P
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
Constant inlined main::$3 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$1 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$2 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q
Constant inlined main::$0 = (byte*)(struct Point*)&(struct Vector) main::v
Constant inlined main::$5 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$6 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q
Constant inlined main::$3 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$4 = (byte*)(struct Point*)&(struct Vector) main::v
Constant inlined main::$7 = (byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(SCREEN+1)
Consolidated array index constant in *(SCREEN+2)
@ -174,17 +145,15 @@ FINAL CONTROL FLOW GRAPH
main: scope:[main] from @1
[4] *(&(struct Point) main::p1) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[5] *(&(struct Point) main::p2) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[6] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1)
[7] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y)
[8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2)
[9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y)
[10] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v)
[11] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y)
[12] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
[13] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
[6] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[7] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[8] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v)
[9] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y)
[10] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
[11] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
to:main::@return
main::@return: scope:[main] from main
[14] return
[12] return
to:@return
@ -256,34 +225,36 @@ main: {
sta p2-1,y
dey
bne !-
// [6] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1) -- _deref_pbuc1=_deref_pbuc2
lda.z p1
sta.z v
// [7] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p1+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_POINT_Y
// [8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2) -- _deref_pbuc1=_deref_pbuc2
lda.z p2
sta v+OFFSET_STRUCT_VECTOR_Q
// [9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p2+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
// [10] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
// [6] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p1-1,y
sta v-1,y
dey
bne !-
// [7] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p2-1,y
sta v+OFFSET_STRUCT_VECTOR_Q-1,y
dey
bne !-
// [8] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
lda.z v
sta SCREEN
// [11] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [9] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
// [12] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
// [10] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q
sta SCREEN+2
// [13] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [11] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
sta SCREEN+3
jmp __breturn
// main::@return
__breturn:
// [14] return
// [12] return
rts
}
// File Data
@ -293,14 +264,12 @@ main: {
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *(&(struct Point) main::p1) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::p1 main::p2 main::v ] ( main:2 [ main::p1 main::p2 main::v ] ) always clobbers reg byte a reg byte y
Statement [5] *(&(struct Point) main::p2) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::p1 main::p2 main::v ] ( main:2 [ main::p1 main::p2 main::v ] ) always clobbers reg byte a reg byte y
Statement [6] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1) [ main::p1 main::p2 main::v ] ( main:2 [ main::p1 main::p2 main::v ] ) always clobbers reg byte a
Statement [7] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y) [ main::p2 main::v ] ( main:2 [ main::p2 main::v ] ) always clobbers reg byte a
Statement [8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2) [ main::p2 main::v ] ( main:2 [ main::p2 main::v ] ) always clobbers reg byte a
Statement [9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [10] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [11] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [12] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [13] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [6] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::p2 main::v ] ( main:2 [ main::p2 main::v ] ) always clobbers reg byte a reg byte y
Statement [7] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a reg byte y
Statement [8] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [9] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [10] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a
Statement [11] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) [ ] ( main:2 [ ] ) always clobbers reg byte a
Potential registers zp[2]:2 [ main::p1 ] : zp[2]:2 ,
Potential registers zp[2]:4 [ main::p2 ] : zp[2]:4 ,
Potential registers zp[4]:6 [ main::v ] : zp[4]:6 ,
@ -311,10 +280,10 @@ Uplift Scope [Vector]
Uplift Scope [main] 0: zp[2]:2 [ main::p1 ] 0: zp[2]:4 [ main::p2 ] 0: zp[4]:6 [ main::v ]
Uplift Scope []
Uplifting [Point] best 113 combination
Uplifting [Vector] best 113 combination
Uplifting [main] best 113 combination zp[2]:2 [ main::p1 ] zp[2]:4 [ main::p2 ] zp[4]:6 [ main::v ]
Uplifting [] best 113 combination
Uplifting [Point] best 116 combination
Uplifting [Vector] best 116 combination
Uplifting [main] best 116 combination zp[2]:2 [ main::p1 ] zp[2]:4 [ main::p2 ] zp[4]:6 [ main::v ]
Uplifting [] best 116 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -361,34 +330,36 @@ main: {
sta p2-1,y
dey
bne !-
// [6] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1) -- _deref_pbuc1=_deref_pbuc2
lda.z p1
sta.z v
// [7] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p1+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_POINT_Y
// [8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2) -- _deref_pbuc1=_deref_pbuc2
lda.z p2
sta v+OFFSET_STRUCT_VECTOR_Q
// [9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p2+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
// [10] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
// [6] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p1-1,y
sta v-1,y
dey
bne !-
// [7] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p2-1,y
sta v+OFFSET_STRUCT_VECTOR_Q-1,y
dey
bne !-
// [8] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
lda.z v
sta SCREEN
// [11] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [9] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
// [12] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
// [10] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q
sta SCREEN+2
// [13] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [11] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
sta SCREEN+3
jmp __breturn
// main::@return
__breturn:
// [14] return
// [12] return
rts
}
// File Data
@ -440,7 +411,7 @@ zp[4]:6 [ main::v ]
FINAL ASSEMBLER
Score: 98
Score: 101
// File Comments
// Minimal struct with C-Standard behavior - struct containing struct with initializer using sub-struct value
@ -481,37 +452,39 @@ main: {
dey
bne !-
// v = { p1, p2 }
// [6] *((byte*)(struct Point*)&(struct Vector) main::v) ← *((byte*)&(struct Point) main::p1) -- _deref_pbuc1=_deref_pbuc2
lda.z p1
sta.z v
// [7] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p1+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p1+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_POINT_Y
// [8] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← *((byte*)&(struct Point) main::p2) -- _deref_pbuc1=_deref_pbuc2
lda.z p2
sta v+OFFSET_STRUCT_VECTOR_Q
// [9] *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) ← *((byte*)&(struct Point) main::p2+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda p2+OFFSET_STRUCT_POINT_Y
sta v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
// [6] *((struct Point*)&(struct Vector) main::v) ← memcpy(*(&(struct Point) main::p1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p1-1,y
sta v-1,y
dey
bne !-
// [7] *((struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) ← memcpy(*(&(struct Point) main::p2), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda p2-1,y
sta v+OFFSET_STRUCT_VECTOR_Q-1,y
dey
bne !-
// SCREEN[0] = v.p.x
// [10] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
// [8] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2
lda.z v
sta SCREEN
// SCREEN[1] = v.p.y
// [11] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [9] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
// SCREEN[2] = v.q.x
// [12] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
// [10] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q
sta SCREEN+2
// SCREEN[3] = v.q.y
// [13] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
// [11] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
sta SCREEN+3
// main::@return
// }
// [14] return
// [12] return
rts
}
// File Data

View File

@ -0,0 +1,23 @@
// Minimal struct with C-Standard behavior - copy assignment through struct pointer
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
main: {
.label p2 = point2
ldy #SIZEOF_STRUCT_POINT
!:
lda point1-1,y
sta p2-1,y
dey
bne !-
lda point2
sta SCREEN
lda point2+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
rts
}
point1: .byte 2, 3
point2: .fill SIZEOF_STRUCT_POINT, 0

View File

@ -0,0 +1,19 @@
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
(void()) main()
main: scope:[main] from @1
[4] *((const struct Point*) main::p2) ← memcpy(*(&(struct Point) point1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[5] *((const byte*) SCREEN) ← *((byte*)&(struct Point) point2)
[6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_Y)
to:main::@return
main::@return: scope:[main] from main
[7] return
to:@return

316
src/test/ref/struct-35.log Normal file
View File

@ -0,0 +1,316 @@
Setting inferred volatile on symbol affected by address-of (struct Point*) main::p2 ← &(struct Point) point2
Adding struct value member variable copy *((struct Point*) main::p2) ← memcpy(*(&(struct Point) point1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Replacing struct member reference (struct Point) point2.x with member unwinding reference *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_X)
Replacing struct member reference (struct Point) point2.y with member unwinding reference *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_Y)
Identified constant variable (struct Point*) main::p2
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@1
(void()) main()
main: scope:[main] from @1
*((const struct Point*) main::p2) ← memcpy(*(&(struct Point) point1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
*((const byte*) SCREEN + (number) 0) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_X)
*((const byte*) SCREEN + (number) 1) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_Y)
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_POINT_X = (byte) 0
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte*) SCREEN = (byte*)(number) $400
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(label) main::@return
(const struct Point*) main::p2 = &(struct Point) point2
(struct Point) point1 loadstore = { x: (byte) 2, y: (byte) 3 }
(struct Point) point2 loadstore = {}
Adding number conversion cast (unumber) 0 in *((const byte*) SCREEN + (number) 0) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_X)
Adding number conversion cast (unumber) 1 in *((const byte*) SCREEN + (number) 1) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_Y)
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simplifying expression containing zero (byte*)&point2 in [1] *((const byte*) SCREEN + (byte) 0) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_X)
Simplifying expression containing zero SCREEN in [1] *((const byte*) SCREEN + (byte) 0) ← *((byte*)&(struct Point) point2)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
Consolidated array index constant in *(SCREEN+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @2
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
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()
(void()) main()
main: scope:[main] from @1
[4] *((const struct Point*) main::p2) ← memcpy(*(&(struct Point) point1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[5] *((const byte*) SCREEN) ← *((byte*)&(struct Point) point2)
[6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_Y)
to:main::@return
main::@return: scope:[main] from main
[7] return
to:@return
VARIABLE REGISTER WEIGHTS
(byte) Point::x
(byte) Point::y
(void()) main()
(struct Point) point1 loadstore = { x: (byte) 2, y: (byte) 3 }
(struct Point) point2 loadstore = {}
Initial phi equivalence classes
Added variable point1 to live range equivalence class [ point1 ]
Added variable point2 to live range equivalence class [ point2 ]
Complete equivalence classes
[ point1 ]
[ point2 ]
Allocated mem[2] [ point1 ]
Allocated mem[2] [ point2 ]
INITIAL ASM
Target platform is c64basic / MOS6502X
// File Comments
// Minimal struct with C-Standard behavior - copy assignment through struct pointer
// Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
// main
main: {
.label p2 = point2
// [4] *((const struct Point*) main::p2) ← memcpy(*(&(struct Point) point1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda point1-1,y
sta p2-1,y
dey
bne !-
// [5] *((const byte*) SCREEN) ← *((byte*)&(struct Point) point2) -- _deref_pbuc1=_deref_pbuc2
lda point2
sta SCREEN
// [6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda point2+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
jmp __breturn
// main::@return
__breturn:
// [7] return
rts
}
// File Data
point1: .byte 2, 3
point2: .fill SIZEOF_STRUCT_POINT, 0
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((const struct Point*) main::p2) ← memcpy(*(&(struct Point) point1), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ point2 ] ( main:2 [ point2 ] ) always clobbers reg byte a reg byte y
Statement [5] *((const byte*) SCREEN) ← *((byte*)&(struct Point) point2) [ point2 ] ( main:2 [ point2 ] ) always clobbers reg byte a
Statement [6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_Y) [ ] ( main:2 [ ] ) always clobbers reg byte a
Potential registers mem[2] [ point1 ] : mem[2] ,
Potential registers mem[2] [ point2 ] : mem[2] ,
REGISTER UPLIFT SCOPES
Uplift Scope [Point]
Uplift Scope [main]
Uplift Scope [] 0: mem[2] [ point1 ] 0: mem[2] [ point2 ]
Uplifting [Point] best 53 combination
Uplifting [main] best 53 combination
Uplifting [] best 53 combination mem[2] [ point1 ] mem[2] [ point2 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Minimal struct with C-Standard behavior - copy assignment through struct pointer
// Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
// main
main: {
.label p2 = point2
// [4] *((const struct Point*) main::p2) ← memcpy(*(&(struct Point) point1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda point1-1,y
sta p2-1,y
dey
bne !-
// [5] *((const byte*) SCREEN) ← *((byte*)&(struct Point) point2) -- _deref_pbuc1=_deref_pbuc2
lda point2
sta SCREEN
// [6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda point2+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
jmp __breturn
// main::@return
__breturn:
// [7] return
rts
}
// File Data
point1: .byte 2, 3
point2: .fill SIZEOF_STRUCT_POINT, 0
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte*) SCREEN = (byte*) 1024
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(label) main::@return
(const struct Point*) main::p2 = &(struct Point) point2
(struct Point) point1 loadstore mem[2] = { x: (byte) 2, y: (byte) 3 }
(struct Point) point2 loadstore mem[2] = {}
mem[2] [ point1 ]
mem[2] [ point2 ]
FINAL ASSEMBLER
Score: 38
// File Comments
// Minimal struct with C-Standard behavior - copy assignment through struct pointer
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
// [1] phi from @begin to @1 [phi:@begin->@1]
// @1
// [2] call main
// [3] phi from @1 to @end [phi:@1->@end]
// @end
// main
main: {
.label p2 = point2
// *p2 = point1
// [4] *((const struct Point*) main::p2) ← memcpy(*(&(struct Point) point1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda point1-1,y
sta p2-1,y
dey
bne !-
// SCREEN[0] = point2.x
// [5] *((const byte*) SCREEN) ← *((byte*)&(struct Point) point2) -- _deref_pbuc1=_deref_pbuc2
lda point2
sta SCREEN
// SCREEN[1] = point2.y
// [6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)&(struct Point) point2+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda point2+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
// main::@return
// }
// [7] return
rts
}
// File Data
point1: .byte 2, 3
point2: .fill SIZEOF_STRUCT_POINT, 0

View File

@ -0,0 +1,16 @@
(label) @1
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte*) SCREEN = (byte*) 1024
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(label) main::@return
(const struct Point*) main::p2 = &(struct Point) point2
(struct Point) point1 loadstore mem[2] = { x: (byte) 2, y: (byte) 3 }
(struct Point) point2 loadstore mem[2] = {}
mem[2] [ point1 ]
mem[2] [ point2 ]

View File

@ -2,6 +2,7 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
main: {
.label SCREEN = $400
@ -9,12 +10,10 @@ main: {
.label __4 = $a
.label i = 2
.label i1 = 4
.label __11 = 8
.label __12 = 6
.label __13 = $c
.label __14 = $e
.label __15 = $10
.label __16 = $a
.label __7 = 8
.label __8 = 6
.label __9 = $c
.label __10 = $a
lda #<0
sta.z i
sta.z i+1
@ -29,22 +28,22 @@ main: {
lda.z __3
clc
adc #<points
sta.z __11
sta.z __7
lda.z __3+1
adc #>points
sta.z __11+1
sta.z __7+1
lda #2
ldy #0
sta (__11),y
sta (__7),y
clc
lda.z __12
lda.z __8
adc #<points+OFFSET_STRUCT_POINT_Y
sta.z __12
lda.z __12+1
sta.z __8
lda.z __8+1
adc #>points+OFFSET_STRUCT_POINT_Y
sta.z __12+1
sta.z __8+1
txa
sta (__12),y
sta (__8),y
inc.z i
bne !+
inc.z i+1
@ -68,36 +67,24 @@ main: {
lda.z __4
clc
adc #<points
sta.z __13
sta.z __9
lda.z __4+1
adc #>points
sta.z __13+1
lda.z __4
sta.z __9+1
clc
lda.z __10
adc #<SCREEN
sta.z __14
lda.z __4+1
sta.z __10
lda.z __10+1
adc #>SCREEN
sta.z __14+1
sta.z __10+1
ldy #0
lda (__13),y
sta (__14),y
lda.z __4
clc
adc #<points+OFFSET_STRUCT_POINT_Y
sta.z __15
lda.z __4+1
adc #>points+OFFSET_STRUCT_POINT_Y
sta.z __15+1
clc
lda.z __16
adc #<SCREEN+OFFSET_STRUCT_POINT_Y
sta.z __16
lda.z __16+1
adc #>SCREEN+OFFSET_STRUCT_POINT_Y
sta.z __16+1
lda (__15),y
sta (__16),y
!:
lda (__9),y
sta (__10),y
iny
cpy #SIZEOF_STRUCT_POINT
bne !-
inc.z i1
bne !+
inc.z i1+1

View File

@ -16,25 +16,22 @@ main::@1: scope:[main] from main main::@1
[5] (word) main::i#2 ← phi( main/(word) 0 main::@1/(word) main::i#1 )
[6] (byte~) main::$0 ← (byte)(word) main::i#2
[7] (word~) main::$3 ← (word) main::i#2 << (byte) 1
[8] (byte*~) main::$11 ← (byte*)(const struct Point*) points + (word~) main::$3
[9] *((byte*~) main::$11) ← (byte) 2
[10] (byte*~) main::$12 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3
[11] *((byte*~) main::$12) ← (byte~) main::$0
[8] (byte*~) main::$7 ← (byte*)(const struct Point*) points + (word~) main::$3
[9] *((byte*~) main::$7) ← (byte) 2
[10] (byte*~) main::$8 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3
[11] *((byte*~) main::$8) ← (byte~) main::$0
[12] (word) main::i#1 ← ++ (word) main::i#2
[13] if((word) main::i#1!=(word) $1f4) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
[14] (word) main::i1#2 ← phi( main::@1/(word) 0 main::@2/(word) main::i1#1 )
[15] (word~) main::$4 ← (word) main::i1#2 << (byte) 1
[16] (byte*~) main::$13 ← (byte*)(const struct Point*) points + (word~) main::$4
[17] (byte*~) main::$14 ← (byte*)(const struct Point*) main::SCREEN + (word~) main::$4
[18] *((byte*~) main::$14) ← *((byte*~) main::$13)
[19] (byte*~) main::$15 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4
[20] (byte*~) main::$16 ← (byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4
[21] *((byte*~) main::$16) ← *((byte*~) main::$15)
[22] (word) main::i1#1 ← ++ (word) main::i1#2
[23] if((word) main::i1#1!=(word) $1f4) goto main::@2
[16] (struct Point*~) main::$9 ← (const struct Point*) points + (word~) main::$4
[17] (struct Point*~) main::$10 ← (const struct Point*) main::SCREEN + (word~) main::$4
[18] *((struct Point*~) main::$10) ← memcpy(*((struct Point*~) main::$9), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[19] (word) main::i1#1 ← ++ (word) main::i1#2
[20] if((word) main::i1#1!=(word) $1f4) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@2
[24] return
[21] return
to:@return

View File

@ -4,8 +4,7 @@ Fixing pointer array-indexing *((const struct Point*) main::SCREEN + (word) main
Constantified RValue *((const struct Point*) points + (word~) main::$3) ← (struct Point){ (byte) 2, (byte~) main::$0 }
Adding struct value member variable copy *((byte*~) main::$5 + (word~) main::$3) ← (byte) 2
Adding struct value member variable copy *((byte*~) main::$6 + (word~) main::$3) ← (byte~) main::$0
Adding struct value member variable copy *((byte*~) main::$7 + (word~) main::$4) ← *((byte*~) main::$8 + (word~) main::$4)
Adding struct value member variable copy *((byte*~) main::$9 + (word~) main::$4) ← *((byte*~) main::$10 + (word~) main::$4)
Adding struct value member variable copy *((const struct Point*) main::SCREEN + (word~) main::$4) ← memcpy(*((const struct Point*) points + (word~) main::$4), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Culled Empty Block (label) main::@4
CONTROL FLOW GRAPH SSA
@ -34,12 +33,7 @@ main::@2: scope:[main] from main::@1
main::@3: scope:[main] from main::@2 main::@3
(word) main::i1#2 ← phi( main::@2/(word) main::i1#0 main::@3/(word) main::i1#1 )
(word~) main::$4 ← (word) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
(byte*~) main::$7 ← (byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_X
(byte*~) main::$8 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
*((byte*~) main::$7 + (word~) main::$4) ← *((byte*~) main::$8 + (word~) main::$4)
(byte*~) main::$9 ← (byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_Y
(byte*~) main::$10 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
*((byte*~) main::$9 + (word~) main::$4) ← *((byte*~) main::$10 + (word~) main::$4)
*((const struct Point*) main::SCREEN + (word~) main::$4) ← memcpy(*((const struct Point*) points + (word~) main::$4), struct Point, (const byte) SIZEOF_STRUCT_POINT)
(word) main::i1#1 ← (word) main::i1#2 + rangenext(0,$1f3)
(bool~) main::$2 ← (word) main::i1#1 != rangelast(0,$1f3)
if((bool~) main::$2) goto main::@3
@ -67,15 +61,11 @@ SYMBOL TABLE SSA
(void()) main()
(byte~) main::$0
(bool~) main::$1
(byte*~) main::$10
(bool~) main::$2
(word~) main::$3
(word~) main::$4
(byte*~) main::$5
(byte*~) main::$6
(byte*~) main::$7
(byte*~) main::$8
(byte*~) main::$9
(label) main::@1
(label) main::@2
(label) main::@3
@ -96,38 +86,26 @@ Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (struct Point*) 1024
Successful SSA optimization PassNCastSimplification
Simple Condition (bool~) main::$1 [10] if((word) main::i#1!=rangelast(0,$1f3)) goto main::@1
Simple Condition (bool~) main::$2 [22] if((word) main::i1#1!=rangelast(0,$1f3)) goto main::@3
Simple Condition (bool~) main::$2 [17] if((word) main::i1#1!=rangelast(0,$1f3)) goto main::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [4] (byte*~) main::$5 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [6] (byte*~) main::$6 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [14] (byte*~) main::$7 ← (byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [15] (byte*~) main::$8 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [17] (byte*~) main::$9 ← (byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [18] (byte*~) main::$10 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const word) main::i#0 = 0
Constant (const byte*) main::$5 = (byte*)points+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$6 = (byte*)points+OFFSET_STRUCT_POINT_Y
Constant (const word) main::i1#0 = 0
Constant (const byte*) main::$7 = (byte*)main::SCREEN+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$8 = (byte*)points+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$9 = (byte*)main::SCREEN+OFFSET_STRUCT_POINT_Y
Constant (const byte*) main::$10 = (byte*)points+OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [8] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [10] if(main::i#1!=rangelast(0,$1f3)) goto main::@1 to (number) $1f4
Resolved ranged next value [20] main::i1#1 ← ++ main::i1#2 to ++
Resolved ranged comparison value [22] if(main::i1#1!=rangelast(0,$1f3)) goto main::@3 to (number) $1f4
Resolved ranged next value [15] main::i1#1 ← ++ main::i1#2 to ++
Resolved ranged comparison value [17] if(main::i1#1!=rangelast(0,$1f3)) goto main::@3 to (number) $1f4
De-inlining pointer[w] to *(pointer+w) [5] *((const byte*) main::$5 + (word~) main::$3) ← (byte) 2
De-inlining pointer[w] to *(pointer+w) [7] *((const byte*) main::$6 + (word~) main::$3) ← (byte~) main::$0
De-inlining pointer[w] to *(pointer+w) [16] *((const byte*) main::$7 + (word~) main::$4) ← *((const byte*) main::$8 + (word~) main::$4)
De-inlining pointer[w] to *(pointer+w) [16] *((const byte*) main::$7 + (word~) main::$4) ← *((byte*~) main::$13)
De-inlining pointer[w] to *(pointer+w) [19] *((const byte*) main::$9 + (word~) main::$4) ← *((const byte*) main::$10 + (word~) main::$4)
De-inlining pointer[w] to *(pointer+w) [19] *((const byte*) main::$9 + (word~) main::$4) ← *((byte*~) main::$15)
De-inlining pointer[w] to *(pointer+w) [14] *((const struct Point*) main::SCREEN + (word~) main::$4) ← memcpy(*((const struct Point*) points + (word~) main::$4), struct Point, (const byte) SIZEOF_STRUCT_POINT)
De-inlining pointer[w] to *(pointer+w) [14] *((const struct Point*) main::SCREEN + (word~) main::$4) ← memcpy(*((struct Point*~) main::$9), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Successful SSA optimization Pass2DeInlineWordDerefIdx
Simplifying expression containing zero (byte*)points in
Simplifying expression containing zero (byte*)main::SCREEN in
Simplifying expression containing zero (byte*)points in
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
@ -149,13 +127,7 @@ Constant inlined main::$5 = (byte*)(const struct Point*) points
Constant inlined main::i#0 = (word) 0
Constant inlined main::i1#0 = (word) 0
Constant inlined main::$6 = (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$9 = (byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$7 = (byte*)(const struct Point*) main::SCREEN
Constant inlined main::$10 = (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$8 = (byte*)(const struct Point*) points
Successful SSA optimization Pass2ConstantInlining
Eliminating unused constant (const byte) SIZEOF_STRUCT_POINT
Successful SSA optimization PassNEliminateUnusedVars
Added new block during phi lifting main::@5(between main::@1 and main::@1)
Added new block during phi lifting main::@6(between main::@3 and main::@3)
Adding NOP phi() at start of @begin
@ -168,8 +140,8 @@ CALL GRAPH
Calls in [] to main:2
Created 2 initial phi equivalence classes
Coalesced [27] main::i1#3 ← main::i1#1
Coalesced [28] main::i#3 ← main::i#1
Coalesced [24] main::i1#3 ← main::i1#1
Coalesced [25] main::i#3 ← main::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@2
@ -200,27 +172,24 @@ main::@1: scope:[main] from main main::@1
[5] (word) main::i#2 ← phi( main/(word) 0 main::@1/(word) main::i#1 )
[6] (byte~) main::$0 ← (byte)(word) main::i#2
[7] (word~) main::$3 ← (word) main::i#2 << (byte) 1
[8] (byte*~) main::$11 ← (byte*)(const struct Point*) points + (word~) main::$3
[9] *((byte*~) main::$11) ← (byte) 2
[10] (byte*~) main::$12 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3
[11] *((byte*~) main::$12) ← (byte~) main::$0
[8] (byte*~) main::$7 ← (byte*)(const struct Point*) points + (word~) main::$3
[9] *((byte*~) main::$7) ← (byte) 2
[10] (byte*~) main::$8 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3
[11] *((byte*~) main::$8) ← (byte~) main::$0
[12] (word) main::i#1 ← ++ (word) main::i#2
[13] if((word) main::i#1!=(word) $1f4) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
[14] (word) main::i1#2 ← phi( main::@1/(word) 0 main::@2/(word) main::i1#1 )
[15] (word~) main::$4 ← (word) main::i1#2 << (byte) 1
[16] (byte*~) main::$13 ← (byte*)(const struct Point*) points + (word~) main::$4
[17] (byte*~) main::$14 ← (byte*)(const struct Point*) main::SCREEN + (word~) main::$4
[18] *((byte*~) main::$14) ← *((byte*~) main::$13)
[19] (byte*~) main::$15 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4
[20] (byte*~) main::$16 ← (byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4
[21] *((byte*~) main::$16) ← *((byte*~) main::$15)
[22] (word) main::i1#1 ← ++ (word) main::i1#2
[23] if((word) main::i1#1!=(word) $1f4) goto main::@2
[16] (struct Point*~) main::$9 ← (const struct Point*) points + (word~) main::$4
[17] (struct Point*~) main::$10 ← (const struct Point*) main::SCREEN + (word~) main::$4
[18] *((struct Point*~) main::$10) ← memcpy(*((struct Point*~) main::$9), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[19] (word) main::i1#1 ← ++ (word) main::i1#2
[20] if((word) main::i1#1!=(word) $1f4) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@2
[24] return
[21] return
to:@return
@ -229,56 +198,48 @@ VARIABLE REGISTER WEIGHTS
(byte) Point::y
(void()) main()
(byte~) main::$0 4.4
(byte*~) main::$11 22.0
(byte*~) main::$12 22.0
(byte*~) main::$13 11.0
(byte*~) main::$14 22.0
(byte*~) main::$15 11.0
(byte*~) main::$16 22.0
(struct Point*~) main::$10 22.0
(word~) main::$3 11.0
(word~) main::$4 11.0
(word~) main::$4 16.5
(byte*~) main::$7 22.0
(byte*~) main::$8 22.0
(struct Point*~) main::$9 5.5
(word) main::i
(word) main::i#1 16.5
(word) main::i#2 4.714285714285714
(word) main::i1
(word) main::i1#1 16.5
(word) main::i1#2 4.125
(word) main::i1#2 6.6000000000000005
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::i1#2 main::i1#1 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Added variable main::$3 to live range equivalence class [ main::$3 ]
Added variable main::$11 to live range equivalence class [ main::$11 ]
Added variable main::$12 to live range equivalence class [ main::$12 ]
Added variable main::$7 to live range equivalence class [ main::$7 ]
Added variable main::$8 to live range equivalence class [ main::$8 ]
Added variable main::$4 to live range equivalence class [ main::$4 ]
Added variable main::$13 to live range equivalence class [ main::$13 ]
Added variable main::$14 to live range equivalence class [ main::$14 ]
Added variable main::$15 to live range equivalence class [ main::$15 ]
Added variable main::$16 to live range equivalence class [ main::$16 ]
Added variable main::$9 to live range equivalence class [ main::$9 ]
Added variable main::$10 to live range equivalence class [ main::$10 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::i1#2 main::i1#1 ]
[ main::$0 ]
[ main::$3 ]
[ main::$11 ]
[ main::$12 ]
[ main::$7 ]
[ main::$8 ]
[ main::$4 ]
[ main::$13 ]
[ main::$14 ]
[ main::$15 ]
[ main::$16 ]
[ main::$9 ]
[ main::$10 ]
Allocated zp[2]:2 [ main::i#2 main::i#1 ]
Allocated zp[2]:4 [ main::i1#2 main::i1#1 ]
Allocated zp[1]:6 [ main::$0 ]
Allocated zp[2]:7 [ main::$3 ]
Allocated zp[2]:9 [ main::$11 ]
Allocated zp[2]:11 [ main::$12 ]
Allocated zp[2]:9 [ main::$7 ]
Allocated zp[2]:11 [ main::$8 ]
Allocated zp[2]:13 [ main::$4 ]
Allocated zp[2]:15 [ main::$13 ]
Allocated zp[2]:17 [ main::$14 ]
Allocated zp[2]:19 [ main::$15 ]
Allocated zp[2]:21 [ main::$16 ]
Allocated zp[2]:15 [ main::$9 ]
Allocated zp[2]:17 [ main::$10 ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@ -289,6 +250,7 @@ Target platform is c64basic / MOS6502X
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
__bbegin:
@ -314,12 +276,10 @@ main: {
.label __4 = $d
.label i = 2
.label i1 = 4
.label __11 = 9
.label __12 = $b
.label __13 = $f
.label __14 = $11
.label __15 = $13
.label __16 = $15
.label __7 = 9
.label __8 = $b
.label __9 = $f
.label __10 = $11
// [5] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [5] phi (word) main::i#2 = (word) 0 [phi:main->main::@1#0] -- vwuz1=vwuc1
@ -344,30 +304,30 @@ main: {
lda.z i+1
rol
sta.z __3+1
// [8] (byte*~) main::$11 ← (byte*)(const struct Point*) points + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2
// [8] (byte*~) main::$7 ← (byte*)(const struct Point*) points + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2
lda.z __3
clc
adc #<points
sta.z __11
sta.z __7
lda.z __3+1
adc #>points
sta.z __11+1
// [9] *((byte*~) main::$11) ← (byte) 2 -- _deref_pbuz1=vbuc1
sta.z __7+1
// [9] *((byte*~) main::$7) ← (byte) 2 -- _deref_pbuz1=vbuc1
lda #2
ldy #0
sta (__11),y
// [10] (byte*~) main::$12 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2
sta (__7),y
// [10] (byte*~) main::$8 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2
lda.z __3
clc
adc #<points+OFFSET_STRUCT_POINT_Y
sta.z __12
sta.z __8
lda.z __3+1
adc #>points+OFFSET_STRUCT_POINT_Y
sta.z __12+1
// [11] *((byte*~) main::$12) ← (byte~) main::$0 -- _deref_pbuz1=vbuz2
sta.z __8+1
// [11] *((byte*~) main::$8) ← (byte~) main::$0 -- _deref_pbuz1=vbuz2
lda.z __0
ldy #0
sta (__12),y
sta (__8),y
// [12] (word) main::i#1 ← ++ (word) main::i#2 -- vwuz1=_inc_vwuz1
inc.z i
bne !+
@ -401,54 +361,36 @@ main: {
lda.z i1+1
rol
sta.z __4+1
// [16] (byte*~) main::$13 ← (byte*)(const struct Point*) points + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2
// [16] (struct Point*~) main::$9 ← (const struct Point*) points + (word~) main::$4 -- pssz1=pssc1_plus_vwuz2
lda.z __4
clc
adc #<points
sta.z __13
sta.z __9
lda.z __4+1
adc #>points
sta.z __13+1
// [17] (byte*~) main::$14 ← (byte*)(const struct Point*) main::SCREEN + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2
sta.z __9+1
// [17] (struct Point*~) main::$10 ← (const struct Point*) main::SCREEN + (word~) main::$4 -- pssz1=pssc1_plus_vwuz2
lda.z __4
clc
adc #<SCREEN
sta.z __14
sta.z __10
lda.z __4+1
adc #>SCREEN
sta.z __14+1
// [18] *((byte*~) main::$14) ← *((byte*~) main::$13) -- _deref_pbuz1=_deref_pbuz2
sta.z __10+1
// [18] *((struct Point*~) main::$10) ← memcpy(*((struct Point*~) main::$9), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssz1=_deref_pssz2_memcpy_vbuc1
ldy #0
lda (__13),y
ldy #0
sta (__14),y
// [19] (byte*~) main::$15 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2
lda.z __4
clc
adc #<points+OFFSET_STRUCT_POINT_Y
sta.z __15
lda.z __4+1
adc #>points+OFFSET_STRUCT_POINT_Y
sta.z __15+1
// [20] (byte*~) main::$16 ← (byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2
lda.z __4
clc
adc #<SCREEN+OFFSET_STRUCT_POINT_Y
sta.z __16
lda.z __4+1
adc #>SCREEN+OFFSET_STRUCT_POINT_Y
sta.z __16+1
// [21] *((byte*~) main::$16) ← *((byte*~) main::$15) -- _deref_pbuz1=_deref_pbuz2
ldy #0
lda (__15),y
ldy #0
sta (__16),y
// [22] (word) main::i1#1 ← ++ (word) main::i1#2 -- vwuz1=_inc_vwuz1
!:
lda (__9),y
sta (__10),y
iny
cpy #SIZEOF_STRUCT_POINT
bne !-
// [19] (word) main::i1#1 ← ++ (word) main::i1#2 -- vwuz1=_inc_vwuz1
inc.z i1
bne !+
inc.z i1+1
!:
// [23] if((word) main::i1#1!=(word) $1f4) goto main::@2 -- vwuz1_neq_vwuc1_then_la1
// [20] if((word) main::i1#1!=(word) $1f4) goto main::@2 -- vwuz1_neq_vwuc1_then_la1
lda.z i1+1
cmp #>$1f4
bne __b2_from___b2
@ -458,7 +400,7 @@ main: {
jmp __breturn
// main::@return
__breturn:
// [24] return
// [21] return
rts
}
// File Data
@ -468,63 +410,53 @@ REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (byte~) main::$0 ← (byte)(word) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) always clobbers reg byte a
Statement [7] (word~) main::$3 ← (word) main::i#2 << (byte) 1 [ main::i#2 main::$0 main::$3 ] ( main:2 [ main::i#2 main::$0 main::$3 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:6 [ main::$0 ]
Statement [8] (byte*~) main::$11 ← (byte*)(const struct Point*) points + (word~) main::$3 [ main::i#2 main::$0 main::$3 main::$11 ] ( main:2 [ main::i#2 main::$0 main::$3 main::$11 ] ) always clobbers reg byte a
Statement [9] *((byte*~) main::$11) ← (byte) 2 [ main::i#2 main::$0 main::$3 ] ( main:2 [ main::i#2 main::$0 main::$3 ] ) always clobbers reg byte a reg byte y
Statement [8] (byte*~) main::$7 ← (byte*)(const struct Point*) points + (word~) main::$3 [ main::i#2 main::$0 main::$3 main::$7 ] ( main:2 [ main::i#2 main::$0 main::$3 main::$7 ] ) always clobbers reg byte a
Statement [9] *((byte*~) main::$7) ← (byte) 2 [ main::i#2 main::$0 main::$3 ] ( main:2 [ main::i#2 main::$0 main::$3 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte y as potential for zp[1]:6 [ main::$0 ]
Statement [10] (byte*~) main::$12 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 [ main::i#2 main::$0 main::$12 ] ( main:2 [ main::i#2 main::$0 main::$12 ] ) always clobbers reg byte a
Statement [11] *((byte*~) main::$12) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y
Statement [10] (byte*~) main::$8 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 [ main::i#2 main::$0 main::$8 ] ( main:2 [ main::i#2 main::$0 main::$8 ] ) always clobbers reg byte a
Statement [11] *((byte*~) main::$8) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y
Statement [13] if((word) main::i#1!=(word) $1f4) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a
Statement [15] (word~) main::$4 ← (word) main::i1#2 << (byte) 1 [ main::i1#2 main::$4 ] ( main:2 [ main::i1#2 main::$4 ] ) always clobbers reg byte a
Statement [16] (byte*~) main::$13 ← (byte*)(const struct Point*) points + (word~) main::$4 [ main::i1#2 main::$4 main::$13 ] ( main:2 [ main::i1#2 main::$4 main::$13 ] ) always clobbers reg byte a
Statement [17] (byte*~) main::$14 ← (byte*)(const struct Point*) main::SCREEN + (word~) main::$4 [ main::i1#2 main::$4 main::$13 main::$14 ] ( main:2 [ main::i1#2 main::$4 main::$13 main::$14 ] ) always clobbers reg byte a
Statement [18] *((byte*~) main::$14) ← *((byte*~) main::$13) [ main::i1#2 main::$4 ] ( main:2 [ main::i1#2 main::$4 ] ) always clobbers reg byte a reg byte y
Statement [19] (byte*~) main::$15 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4 [ main::i1#2 main::$4 main::$15 ] ( main:2 [ main::i1#2 main::$4 main::$15 ] ) always clobbers reg byte a
Statement [20] (byte*~) main::$16 ← (byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4 [ main::i1#2 main::$15 main::$16 ] ( main:2 [ main::i1#2 main::$15 main::$16 ] ) always clobbers reg byte a
Statement [21] *((byte*~) main::$16) ← *((byte*~) main::$15) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte y
Statement [23] if((word) main::i1#1!=(word) $1f4) goto main::@2 [ main::i1#1 ] ( main:2 [ main::i1#1 ] ) always clobbers reg byte a
Statement [16] (struct Point*~) main::$9 ← (const struct Point*) points + (word~) main::$4 [ main::i1#2 main::$4 main::$9 ] ( main:2 [ main::i1#2 main::$4 main::$9 ] ) always clobbers reg byte a
Statement [17] (struct Point*~) main::$10 ← (const struct Point*) main::SCREEN + (word~) main::$4 [ main::i1#2 main::$9 main::$10 ] ( main:2 [ main::i1#2 main::$9 main::$10 ] ) always clobbers reg byte a
Statement [18] *((struct Point*~) main::$10) ← memcpy(*((struct Point*~) main::$9), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte y
Statement [20] if((word) main::i1#1!=(word) $1f4) goto main::@2 [ main::i1#1 ] ( main:2 [ main::i1#1 ] ) always clobbers reg byte a
Statement [6] (byte~) main::$0 ← (byte)(word) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) always clobbers reg byte a
Statement [7] (word~) main::$3 ← (word) main::i#2 << (byte) 1 [ main::i#2 main::$0 main::$3 ] ( main:2 [ main::i#2 main::$0 main::$3 ] ) always clobbers reg byte a
Statement [8] (byte*~) main::$11 ← (byte*)(const struct Point*) points + (word~) main::$3 [ main::i#2 main::$0 main::$3 main::$11 ] ( main:2 [ main::i#2 main::$0 main::$3 main::$11 ] ) always clobbers reg byte a
Statement [9] *((byte*~) main::$11) ← (byte) 2 [ main::i#2 main::$0 main::$3 ] ( main:2 [ main::i#2 main::$0 main::$3 ] ) always clobbers reg byte a reg byte y
Statement [10] (byte*~) main::$12 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 [ main::i#2 main::$0 main::$12 ] ( main:2 [ main::i#2 main::$0 main::$12 ] ) always clobbers reg byte a
Statement [11] *((byte*~) main::$12) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y
Statement [8] (byte*~) main::$7 ← (byte*)(const struct Point*) points + (word~) main::$3 [ main::i#2 main::$0 main::$3 main::$7 ] ( main:2 [ main::i#2 main::$0 main::$3 main::$7 ] ) always clobbers reg byte a
Statement [9] *((byte*~) main::$7) ← (byte) 2 [ main::i#2 main::$0 main::$3 ] ( main:2 [ main::i#2 main::$0 main::$3 ] ) always clobbers reg byte a reg byte y
Statement [10] (byte*~) main::$8 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 [ main::i#2 main::$0 main::$8 ] ( main:2 [ main::i#2 main::$0 main::$8 ] ) always clobbers reg byte a
Statement [11] *((byte*~) main::$8) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y
Statement [13] if((word) main::i#1!=(word) $1f4) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a
Statement [15] (word~) main::$4 ← (word) main::i1#2 << (byte) 1 [ main::i1#2 main::$4 ] ( main:2 [ main::i1#2 main::$4 ] ) always clobbers reg byte a
Statement [16] (byte*~) main::$13 ← (byte*)(const struct Point*) points + (word~) main::$4 [ main::i1#2 main::$4 main::$13 ] ( main:2 [ main::i1#2 main::$4 main::$13 ] ) always clobbers reg byte a
Statement [17] (byte*~) main::$14 ← (byte*)(const struct Point*) main::SCREEN + (word~) main::$4 [ main::i1#2 main::$4 main::$13 main::$14 ] ( main:2 [ main::i1#2 main::$4 main::$13 main::$14 ] ) always clobbers reg byte a
Statement [18] *((byte*~) main::$14) ← *((byte*~) main::$13) [ main::i1#2 main::$4 ] ( main:2 [ main::i1#2 main::$4 ] ) always clobbers reg byte a reg byte y
Statement [19] (byte*~) main::$15 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4 [ main::i1#2 main::$4 main::$15 ] ( main:2 [ main::i1#2 main::$4 main::$15 ] ) always clobbers reg byte a
Statement [20] (byte*~) main::$16 ← (byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4 [ main::i1#2 main::$15 main::$16 ] ( main:2 [ main::i1#2 main::$15 main::$16 ] ) always clobbers reg byte a
Statement [21] *((byte*~) main::$16) ← *((byte*~) main::$15) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte y
Statement [23] if((word) main::i1#1!=(word) $1f4) goto main::@2 [ main::i1#1 ] ( main:2 [ main::i1#1 ] ) always clobbers reg byte a
Statement [16] (struct Point*~) main::$9 ← (const struct Point*) points + (word~) main::$4 [ main::i1#2 main::$4 main::$9 ] ( main:2 [ main::i1#2 main::$4 main::$9 ] ) always clobbers reg byte a
Statement [17] (struct Point*~) main::$10 ← (const struct Point*) main::SCREEN + (word~) main::$4 [ main::i1#2 main::$9 main::$10 ] ( main:2 [ main::i1#2 main::$9 main::$10 ] ) always clobbers reg byte a
Statement [18] *((struct Point*~) main::$10) ← memcpy(*((struct Point*~) main::$9), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte y
Statement [20] if((word) main::i1#1!=(word) $1f4) goto main::@2 [ main::i1#1 ] ( main:2 [ main::i1#1 ] ) always clobbers reg byte a
Potential registers zp[2]:2 [ main::i#2 main::i#1 ] : zp[2]:2 ,
Potential registers zp[2]:4 [ main::i1#2 main::i1#1 ] : zp[2]:4 ,
Potential registers zp[1]:6 [ main::$0 ] : zp[1]:6 , reg byte x ,
Potential registers zp[2]:7 [ main::$3 ] : zp[2]:7 ,
Potential registers zp[2]:9 [ main::$11 ] : zp[2]:9 ,
Potential registers zp[2]:11 [ main::$12 ] : zp[2]:11 ,
Potential registers zp[2]:9 [ main::$7 ] : zp[2]:9 ,
Potential registers zp[2]:11 [ main::$8 ] : zp[2]:11 ,
Potential registers zp[2]:13 [ main::$4 ] : zp[2]:13 ,
Potential registers zp[2]:15 [ main::$13 ] : zp[2]:15 ,
Potential registers zp[2]:17 [ main::$14 ] : zp[2]:17 ,
Potential registers zp[2]:19 [ main::$15 ] : zp[2]:19 ,
Potential registers zp[2]:21 [ main::$16 ] : zp[2]:21 ,
Potential registers zp[2]:15 [ main::$9 ] : zp[2]:15 ,
Potential registers zp[2]:17 [ main::$10 ] : zp[2]:17 ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 22: zp[2]:9 [ main::$11 ] 22: zp[2]:11 [ main::$12 ] 22: zp[2]:17 [ main::$14 ] 22: zp[2]:21 [ main::$16 ] 21.21: zp[2]:2 [ main::i#2 main::i#1 ] 20.62: zp[2]:4 [ main::i1#2 main::i1#1 ] 11: zp[2]:7 [ main::$3 ] 11: zp[2]:13 [ main::$4 ] 11: zp[2]:15 [ main::$13 ] 11: zp[2]:19 [ main::$15 ] 4.4: zp[1]:6 [ main::$0 ]
Uplift Scope [main] 23.1: zp[2]:4 [ main::i1#2 main::i1#1 ] 22: zp[2]:9 [ main::$7 ] 22: zp[2]:11 [ main::$8 ] 22: zp[2]:17 [ main::$10 ] 21.21: zp[2]:2 [ main::i#2 main::i#1 ] 16.5: zp[2]:13 [ main::$4 ] 11: zp[2]:7 [ main::$3 ] 5.5: zp[2]:15 [ main::$9 ] 4.4: zp[1]:6 [ main::$0 ]
Uplift Scope [Point]
Uplift Scope []
Uplifting [main] best 2878 combination zp[2]:9 [ main::$11 ] zp[2]:11 [ main::$12 ] zp[2]:17 [ main::$14 ] zp[2]:21 [ main::$16 ] zp[2]:2 [ main::i#2 main::i#1 ] zp[2]:4 [ main::i1#2 main::i1#1 ] zp[2]:7 [ main::$3 ] zp[2]:13 [ main::$4 ] zp[2]:15 [ main::$13 ] zp[2]:19 [ main::$15 ] reg byte x [ main::$0 ]
Uplifting [Point] best 2878 combination
Uplifting [] best 2878 combination
Coalescing zero page register [ zp[2]:7 [ main::$3 ] ] with [ zp[2]:11 [ main::$12 ] ] - score: 1
Coalescing zero page register [ zp[2]:13 [ main::$4 ] ] with [ zp[2]:21 [ main::$16 ] ] - score: 1
Allocated (was zp[2]:7) zp[2]:6 [ main::$3 main::$12 ]
Allocated (was zp[2]:9) zp[2]:8 [ main::$11 ]
Allocated (was zp[2]:13) zp[2]:10 [ main::$4 main::$16 ]
Allocated (was zp[2]:15) zp[2]:12 [ main::$13 ]
Allocated (was zp[2]:17) zp[2]:14 [ main::$14 ]
Allocated (was zp[2]:19) zp[2]:16 [ main::$15 ]
Uplifting [main] best 2408 combination zp[2]:4 [ main::i1#2 main::i1#1 ] zp[2]:9 [ main::$7 ] zp[2]:11 [ main::$8 ] zp[2]:17 [ main::$10 ] zp[2]:2 [ main::i#2 main::i#1 ] zp[2]:13 [ main::$4 ] zp[2]:7 [ main::$3 ] zp[2]:15 [ main::$9 ] reg byte x [ main::$0 ]
Uplifting [Point] best 2408 combination
Uplifting [] best 2408 combination
Coalescing zero page register [ zp[2]:7 [ main::$3 ] ] with [ zp[2]:11 [ main::$8 ] ] - score: 1
Coalescing zero page register [ zp[2]:13 [ main::$4 ] ] with [ zp[2]:17 [ main::$10 ] ] - score: 1
Allocated (was zp[2]:7) zp[2]:6 [ main::$3 main::$8 ]
Allocated (was zp[2]:9) zp[2]:8 [ main::$7 ]
Allocated (was zp[2]:13) zp[2]:10 [ main::$4 main::$10 ]
Allocated (was zp[2]:15) zp[2]:12 [ main::$9 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -534,6 +466,7 @@ ASSEMBLER BEFORE OPTIMIZATION
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
__bbegin:
@ -558,12 +491,10 @@ main: {
.label __4 = $a
.label i = 2
.label i1 = 4
.label __11 = 8
.label __12 = 6
.label __13 = $c
.label __14 = $e
.label __15 = $10
.label __16 = $a
.label __7 = 8
.label __8 = 6
.label __9 = $c
.label __10 = $a
// [5] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [5] phi (word) main::i#2 = (word) 0 [phi:main->main::@1#0] -- vwuz1=vwuc1
@ -588,30 +519,30 @@ main: {
lda.z i+1
rol
sta.z __3+1
// [8] (byte*~) main::$11 ← (byte*)(const struct Point*) points + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2
// [8] (byte*~) main::$7 ← (byte*)(const struct Point*) points + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2
lda.z __3
clc
adc #<points
sta.z __11
sta.z __7
lda.z __3+1
adc #>points
sta.z __11+1
// [9] *((byte*~) main::$11) ← (byte) 2 -- _deref_pbuz1=vbuc1
sta.z __7+1
// [9] *((byte*~) main::$7) ← (byte) 2 -- _deref_pbuz1=vbuc1
lda #2
ldy #0
sta (__11),y
// [10] (byte*~) main::$12 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz1
sta (__7),y
// [10] (byte*~) main::$8 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz1
clc
lda.z __12
lda.z __8
adc #<points+OFFSET_STRUCT_POINT_Y
sta.z __12
lda.z __12+1
sta.z __8
lda.z __8+1
adc #>points+OFFSET_STRUCT_POINT_Y
sta.z __12+1
// [11] *((byte*~) main::$12) ← (byte~) main::$0 -- _deref_pbuz1=vbuxx
sta.z __8+1
// [11] *((byte*~) main::$8) ← (byte~) main::$0 -- _deref_pbuz1=vbuxx
txa
ldy #0
sta (__12),y
sta (__8),y
// [12] (word) main::i#1 ← ++ (word) main::i#2 -- vwuz1=_inc_vwuz1
inc.z i
bne !+
@ -645,54 +576,36 @@ main: {
lda.z i1+1
rol
sta.z __4+1
// [16] (byte*~) main::$13 ← (byte*)(const struct Point*) points + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2
// [16] (struct Point*~) main::$9 ← (const struct Point*) points + (word~) main::$4 -- pssz1=pssc1_plus_vwuz2
lda.z __4
clc
adc #<points
sta.z __13
sta.z __9
lda.z __4+1
adc #>points
sta.z __13+1
// [17] (byte*~) main::$14 ← (byte*)(const struct Point*) main::SCREEN + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2
lda.z __4
sta.z __9+1
// [17] (struct Point*~) main::$10 ← (const struct Point*) main::SCREEN + (word~) main::$4 -- pssz1=pssc1_plus_vwuz1
clc
lda.z __10
adc #<SCREEN
sta.z __14
lda.z __4+1
sta.z __10
lda.z __10+1
adc #>SCREEN
sta.z __14+1
// [18] *((byte*~) main::$14) ← *((byte*~) main::$13) -- _deref_pbuz1=_deref_pbuz2
sta.z __10+1
// [18] *((struct Point*~) main::$10) ← memcpy(*((struct Point*~) main::$9), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssz1=_deref_pssz2_memcpy_vbuc1
ldy #0
lda (__13),y
ldy #0
sta (__14),y
// [19] (byte*~) main::$15 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2
lda.z __4
clc
adc #<points+OFFSET_STRUCT_POINT_Y
sta.z __15
lda.z __4+1
adc #>points+OFFSET_STRUCT_POINT_Y
sta.z __15+1
// [20] (byte*~) main::$16 ← (byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz1
clc
lda.z __16
adc #<SCREEN+OFFSET_STRUCT_POINT_Y
sta.z __16
lda.z __16+1
adc #>SCREEN+OFFSET_STRUCT_POINT_Y
sta.z __16+1
// [21] *((byte*~) main::$16) ← *((byte*~) main::$15) -- _deref_pbuz1=_deref_pbuz2
ldy #0
lda (__15),y
ldy #0
sta (__16),y
// [22] (word) main::i1#1 ← ++ (word) main::i1#2 -- vwuz1=_inc_vwuz1
!:
lda (__9),y
sta (__10),y
iny
cpy #SIZEOF_STRUCT_POINT
bne !-
// [19] (word) main::i1#1 ← ++ (word) main::i1#2 -- vwuz1=_inc_vwuz1
inc.z i1
bne !+
inc.z i1+1
!:
// [23] if((word) main::i1#1!=(word) $1f4) goto main::@2 -- vwuz1_neq_vwuc1_then_la1
// [20] if((word) main::i1#1!=(word) $1f4) goto main::@2 -- vwuz1_neq_vwuc1_then_la1
lda.z i1+1
cmp #>$1f4
bne __b2_from___b2
@ -702,7 +615,7 @@ main: {
jmp __breturn
// main::@return
__breturn:
// [24] return
// [21] return
rts
}
// File Data
@ -719,9 +632,6 @@ Removing instruction lda #>0
Removing instruction lda.z i
Removing instruction ldy #0
Removing instruction lda #>0
Removing instruction ldy #0
Removing instruction ldy #0
Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b1 with __b1
@ -756,16 +666,15 @@ FINAL SYMBOL TABLE
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(byte~) main::$0 reg byte x 4.4
(byte*~) main::$11 zp[2]:8 22.0
(byte*~) main::$12 zp[2]:6 22.0
(byte*~) main::$13 zp[2]:12 11.0
(byte*~) main::$14 zp[2]:14 22.0
(byte*~) main::$15 zp[2]:16 11.0
(byte*~) main::$16 zp[2]:10 22.0
(struct Point*~) main::$10 zp[2]:10 22.0
(word~) main::$3 zp[2]:6 11.0
(word~) main::$4 zp[2]:10 11.0
(word~) main::$4 zp[2]:10 16.5
(byte*~) main::$7 zp[2]:8 22.0
(byte*~) main::$8 zp[2]:6 22.0
(struct Point*~) main::$9 zp[2]:12 5.5
(label) main::@1
(label) main::@2
(label) main::@return
@ -775,22 +684,20 @@ FINAL SYMBOL TABLE
(word) main::i#2 i zp[2]:2 4.714285714285714
(word) main::i1
(word) main::i1#1 i1 zp[2]:4 16.5
(word) main::i1#2 i1 zp[2]:4 4.125
(word) main::i1#2 i1 zp[2]:4 6.6000000000000005
(const struct Point*) points[(number) $1f4] = { fill( $1f4, 0) }
zp[2]:2 [ main::i#2 main::i#1 ]
zp[2]:4 [ main::i1#2 main::i1#1 ]
reg byte x [ main::$0 ]
zp[2]:6 [ main::$3 main::$12 ]
zp[2]:8 [ main::$11 ]
zp[2]:10 [ main::$4 main::$16 ]
zp[2]:12 [ main::$13 ]
zp[2]:14 [ main::$14 ]
zp[2]:16 [ main::$15 ]
zp[2]:6 [ main::$3 main::$8 ]
zp[2]:8 [ main::$7 ]
zp[2]:10 [ main::$4 main::$10 ]
zp[2]:12 [ main::$9 ]
FINAL ASSEMBLER
Score: 2566
Score: 2156
// File Comments
// Minimal struct - array with 256+ structs
@ -799,6 +706,7 @@ Score: 2566
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
// [1] phi from @begin to @1 [phi:@begin->@1]
@ -814,12 +722,10 @@ main: {
.label __4 = $a
.label i = 2
.label i1 = 4
.label __11 = 8
.label __12 = 6
.label __13 = $c
.label __14 = $e
.label __15 = $10
.label __16 = $a
.label __7 = 8
.label __8 = 6
.label __9 = $c
.label __10 = $a
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (word) main::i#2 = (word) 0 [phi:main->main::@1#0] -- vwuz1=vwuc1
lda #<0
@ -840,29 +746,29 @@ main: {
lda.z i+1
rol
sta.z __3+1
// [8] (byte*~) main::$11 ← (byte*)(const struct Point*) points + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2
// [8] (byte*~) main::$7 ← (byte*)(const struct Point*) points + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2
lda.z __3
clc
adc #<points
sta.z __11
sta.z __7
lda.z __3+1
adc #>points
sta.z __11+1
// [9] *((byte*~) main::$11) ← (byte) 2 -- _deref_pbuz1=vbuc1
sta.z __7+1
// [9] *((byte*~) main::$7) ← (byte) 2 -- _deref_pbuz1=vbuc1
lda #2
ldy #0
sta (__11),y
// [10] (byte*~) main::$12 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz1
sta (__7),y
// [10] (byte*~) main::$8 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz1
clc
lda.z __12
lda.z __8
adc #<points+OFFSET_STRUCT_POINT_Y
sta.z __12
lda.z __12+1
sta.z __8
lda.z __8+1
adc #>points+OFFSET_STRUCT_POINT_Y
sta.z __12+1
// [11] *((byte*~) main::$12) ← (byte~) main::$0 -- _deref_pbuz1=vbuxx
sta.z __8+1
// [11] *((byte*~) main::$8) ← (byte~) main::$0 -- _deref_pbuz1=vbuxx
txa
sta (__12),y
sta (__8),y
// for( word i: 0..499)
// [12] (word) main::i#1 ← ++ (word) main::i#2 -- vwuz1=_inc_vwuz1
inc.z i
@ -893,52 +799,37 @@ main: {
lda.z i1+1
rol
sta.z __4+1
// [16] (byte*~) main::$13 ← (byte*)(const struct Point*) points + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2
// [16] (struct Point*~) main::$9 ← (const struct Point*) points + (word~) main::$4 -- pssz1=pssc1_plus_vwuz2
lda.z __4
clc
adc #<points
sta.z __13
sta.z __9
lda.z __4+1
adc #>points
sta.z __13+1
// [17] (byte*~) main::$14 ← (byte*)(const struct Point*) main::SCREEN + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2
lda.z __4
sta.z __9+1
// [17] (struct Point*~) main::$10 ← (const struct Point*) main::SCREEN + (word~) main::$4 -- pssz1=pssc1_plus_vwuz1
clc
lda.z __10
adc #<SCREEN
sta.z __14
lda.z __4+1
sta.z __10
lda.z __10+1
adc #>SCREEN
sta.z __14+1
// [18] *((byte*~) main::$14) ← *((byte*~) main::$13) -- _deref_pbuz1=_deref_pbuz2
sta.z __10+1
// [18] *((struct Point*~) main::$10) ← memcpy(*((struct Point*~) main::$9), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssz1=_deref_pssz2_memcpy_vbuc1
ldy #0
lda (__13),y
sta (__14),y
// [19] (byte*~) main::$15 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2
lda.z __4
clc
adc #<points+OFFSET_STRUCT_POINT_Y
sta.z __15
lda.z __4+1
adc #>points+OFFSET_STRUCT_POINT_Y
sta.z __15+1
// [20] (byte*~) main::$16 ← (byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz1
clc
lda.z __16
adc #<SCREEN+OFFSET_STRUCT_POINT_Y
sta.z __16
lda.z __16+1
adc #>SCREEN+OFFSET_STRUCT_POINT_Y
sta.z __16+1
// [21] *((byte*~) main::$16) ← *((byte*~) main::$15) -- _deref_pbuz1=_deref_pbuz2
lda (__15),y
sta (__16),y
!:
lda (__9),y
sta (__10),y
iny
cpy #SIZEOF_STRUCT_POINT
bne !-
// for( word i: 0..499)
// [22] (word) main::i1#1 ← ++ (word) main::i1#2 -- vwuz1=_inc_vwuz1
// [19] (word) main::i1#1 ← ++ (word) main::i1#2 -- vwuz1=_inc_vwuz1
inc.z i1
bne !+
inc.z i1+1
!:
// [23] if((word) main::i1#1!=(word) $1f4) goto main::@2 -- vwuz1_neq_vwuc1_then_la1
// [20] if((word) main::i1#1!=(word) $1f4) goto main::@2 -- vwuz1_neq_vwuc1_then_la1
lda.z i1+1
cmp #>$1f4
bne __b2
@ -947,7 +838,7 @@ main: {
bne __b2
// main::@return
// }
// [24] return
// [21] return
rts
}
// File Data

View File

@ -4,16 +4,15 @@
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(byte~) main::$0 reg byte x 4.4
(byte*~) main::$11 zp[2]:8 22.0
(byte*~) main::$12 zp[2]:6 22.0
(byte*~) main::$13 zp[2]:12 11.0
(byte*~) main::$14 zp[2]:14 22.0
(byte*~) main::$15 zp[2]:16 11.0
(byte*~) main::$16 zp[2]:10 22.0
(struct Point*~) main::$10 zp[2]:10 22.0
(word~) main::$3 zp[2]:6 11.0
(word~) main::$4 zp[2]:10 11.0
(word~) main::$4 zp[2]:10 16.5
(byte*~) main::$7 zp[2]:8 22.0
(byte*~) main::$8 zp[2]:6 22.0
(struct Point*~) main::$9 zp[2]:12 5.5
(label) main::@1
(label) main::@2
(label) main::@return
@ -23,15 +22,13 @@
(word) main::i#2 i zp[2]:2 4.714285714285714
(word) main::i1
(word) main::i1#1 i1 zp[2]:4 16.5
(word) main::i1#2 i1 zp[2]:4 4.125
(word) main::i1#2 i1 zp[2]:4 6.6000000000000005
(const struct Point*) points[(number) $1f4] = { fill( $1f4, 0) }
zp[2]:2 [ main::i#2 main::i#1 ]
zp[2]:4 [ main::i1#2 main::i1#1 ]
reg byte x [ main::$0 ]
zp[2]:6 [ main::$3 main::$12 ]
zp[2]:8 [ main::$11 ]
zp[2]:10 [ main::$4 main::$16 ]
zp[2]:12 [ main::$13 ]
zp[2]:14 [ main::$14 ]
zp[2]:16 [ main::$15 ]
zp[2]:6 [ main::$3 main::$8 ]
zp[2]:8 [ main::$7 ]
zp[2]:10 [ main::$4 main::$10 ]
zp[2]:12 [ main::$9 ]

View File

@ -2,11 +2,13 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.const SIZEOF_STRUCT_POINT = 3
.const OFFSET_STRUCT_POINT_Y = 1
.const OFFSET_STRUCT_POINT_Z = 2
main: {
.label SCREEN = $400
.label __2 = 2
.label __2 = 3
.label i1 = 2
ldx #0
__b1:
txa
@ -29,22 +31,24 @@ main: {
inx
cpx #4
bne __b1
ldx #0
lda #0
sta.z i1
__b2:
txa
lda.z i1
asl
stx.z $ff
clc
adc.z $ff
adc.z i1
ldx #SIZEOF_STRUCT_POINT
tay
!:
lda points,y
sta SCREEN,y
lda points+OFFSET_STRUCT_POINT_Y,y
sta SCREEN+OFFSET_STRUCT_POINT_Y,y
lda points+OFFSET_STRUCT_POINT_Z,y
sta SCREEN+OFFSET_STRUCT_POINT_Z,y
inx
cpx #4
iny
dex
bne !-
inc.z i1
lda #4
cmp.z i1
bne __b2
rts
}

View File

@ -15,8 +15,8 @@ main: scope:[main] from @1
main::@1: scope:[main] from main main::@1
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
[6] (signed byte~) main::$2 ← - (signed byte)(byte) main::i#2
[7] (byte~) main::$17 ← (byte) main::i#2 << (byte) 1
[8] (byte~) main::$6 ← (byte~) main::$17 + (byte) main::i#2
[7] (byte~) main::$11 ← (byte) main::i#2 << (byte) 1
[8] (byte~) main::$6 ← (byte~) main::$11 + (byte) main::i#2
[9] *((signed byte*)(const struct Point*) points + (byte~) main::$6) ← (signed byte)(byte) main::i#2
[10] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) ← (signed byte~) main::$2
[11] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$6) ← (signed byte)(byte) main::i#2
@ -25,14 +25,12 @@ main::@1: scope:[main] from main main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
[14] (byte) main::i1#2 ← phi( main::@1/(byte) 0 main::@2/(byte) main::i1#1 )
[15] (byte~) main::$19 ← (byte) main::i1#2 << (byte) 1
[16] (byte~) main::$7 ← (byte~) main::$19 + (byte) main::i1#2
[17] *((signed byte*)(const struct Point*) main::SCREEN + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points + (byte~) main::$7)
[18] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7)
[19] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7)
[20] (byte) main::i1#1 ← ++ (byte) main::i1#2
[21] if((byte) main::i1#1!=(byte) 4) goto main::@2
[15] (byte~) main::$13 ← (byte) main::i1#2 << (byte) 1
[16] (byte~) main::$7 ← (byte~) main::$13 + (byte) main::i1#2
[17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[18] (byte) main::i1#1 ← ++ (byte) main::i1#2
[19] if((byte) main::i1#1!=(byte) 4) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@2
[22] return
[20] return
to:@return

View File

@ -5,9 +5,7 @@ Constantified RValue *((const struct Point*) points + (byte~) main::$6) ← (str
Adding struct value member variable copy *((signed byte*~) main::$8 + (byte~) main::$6) ← (signed byte~) main::$0
Adding struct value member variable copy *((signed byte*~) main::$9 + (byte~) main::$6) ← (signed byte~) main::$2
Adding struct value member variable copy *((signed byte*~) main::$10 + (byte~) main::$6) ← (signed byte~) main::$3
Adding struct value member variable copy *((signed byte*~) main::$11 + (byte~) main::$7) ← *((signed byte*~) main::$12 + (byte~) main::$7)
Adding struct value member variable copy *((signed byte*~) main::$13 + (byte~) main::$7) ← *((signed byte*~) main::$14 + (byte~) main::$7)
Adding struct value member variable copy *((signed byte*~) main::$15 + (byte~) main::$7) ← *((signed byte*~) main::$16 + (byte~) main::$7)
Adding struct value member variable copy *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Culled Empty Block (label) main::@4
CONTROL FLOW GRAPH SSA
@ -41,15 +39,7 @@ main::@2: scope:[main] from main::@1
main::@3: scope:[main] from main::@2 main::@3
(byte) main::i1#2 ← phi( main::@2/(byte) main::i1#0 main::@3/(byte) main::i1#1 )
(byte~) main::$7 ← (byte) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
(signed byte*~) main::$11 ← (signed byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_X
(signed byte*~) main::$12 ← (signed byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
*((signed byte*~) main::$11 + (byte~) main::$7) ← *((signed byte*~) main::$12 + (byte~) main::$7)
(signed byte*~) main::$13 ← (signed byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_Y
(signed byte*~) main::$14 ← (signed byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
*((signed byte*~) main::$13 + (byte~) main::$7) ← *((signed byte*~) main::$14 + (byte~) main::$7)
(signed byte*~) main::$15 ← (signed byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_Z
(signed byte*~) main::$16 ← (signed byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Z
*((signed byte*~) main::$15 + (byte~) main::$7) ← *((signed byte*~) main::$16 + (byte~) main::$7)
*((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT)
(byte) main::i1#1 ← (byte) main::i1#2 + rangenext(0,3)
(bool~) main::$5 ← (byte) main::i1#1 != rangelast(0,3)
if((bool~) main::$5) goto main::@3
@ -80,12 +70,6 @@ SYMBOL TABLE SSA
(signed byte~) main::$0
(signed byte~) main::$1
(signed byte*~) main::$10
(signed byte*~) main::$11
(signed byte*~) main::$12
(signed byte*~) main::$13
(signed byte*~) main::$14
(signed byte*~) main::$15
(signed byte*~) main::$16
(signed byte~) main::$2
(signed byte~) main::$3
(bool~) main::$4
@ -116,36 +100,22 @@ Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (struct Point*) 1024
Successful SSA optimization PassNCastSimplification
Simple Condition (bool~) main::$4 [15] if((byte) main::i#1!=rangelast(0,3)) goto main::@1
Simple Condition (bool~) main::$5 [30] if((byte) main::i1#1!=rangelast(0,3)) goto main::@3
Simple Condition (bool~) main::$5 [22] if((byte) main::i1#1!=rangelast(0,3)) goto main::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [7] (signed byte*~) main::$8 ← (signed byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [9] (signed byte*~) main::$9 ← (signed byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [11] (signed byte*~) main::$10 ← (signed byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Z
Constant right-side identified [19] (signed byte*~) main::$11 ← (signed byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [20] (signed byte*~) main::$12 ← (signed byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [22] (signed byte*~) main::$13 ← (signed byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [23] (signed byte*~) main::$14 ← (signed byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [25] (signed byte*~) main::$15 ← (signed byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_Z
Constant right-side identified [26] (signed byte*~) main::$16 ← (signed byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Z
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::i#0 = 0
Constant (const signed byte*) main::$8 = (signed byte*)points+OFFSET_STRUCT_POINT_X
Constant (const signed byte*) main::$9 = (signed byte*)points+OFFSET_STRUCT_POINT_Y
Constant (const signed byte*) main::$10 = (signed byte*)points+OFFSET_STRUCT_POINT_Z
Constant (const byte) main::i1#0 = 0
Constant (const signed byte*) main::$11 = (signed byte*)main::SCREEN+OFFSET_STRUCT_POINT_X
Constant (const signed byte*) main::$12 = (signed byte*)points+OFFSET_STRUCT_POINT_X
Constant (const signed byte*) main::$13 = (signed byte*)main::SCREEN+OFFSET_STRUCT_POINT_Y
Constant (const signed byte*) main::$14 = (signed byte*)points+OFFSET_STRUCT_POINT_Y
Constant (const signed byte*) main::$15 = (signed byte*)main::SCREEN+OFFSET_STRUCT_POINT_Z
Constant (const signed byte*) main::$16 = (signed byte*)points+OFFSET_STRUCT_POINT_Z
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [13] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [15] if(main::i#1!=rangelast(0,3)) goto main::@1 to (number) 4
Resolved ranged next value [28] main::i1#1 ← ++ main::i1#2 to ++
Resolved ranged comparison value [30] if(main::i1#1!=rangelast(0,3)) goto main::@3 to (number) 4
Simplifying expression containing zero (signed byte*)points in
Simplifying expression containing zero (signed byte*)main::SCREEN in
Resolved ranged next value [20] main::i1#1 ← ++ main::i1#2 to ++
Resolved ranged comparison value [22] if(main::i1#1!=rangelast(0,3)) goto main::@3 to (number) 4
Simplifying expression containing zero (signed byte*)points in
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
@ -167,23 +137,15 @@ Rewriting multiplication to use shift and addition[5] (byte~) main::$6 ← (byte
Rewriting multiplication to use shift and addition[12] (byte~) main::$7 ← (byte) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) main::i1#0
Constant inlined main::$16 = (signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z
Constant inlined main::$12 = (signed byte*)(const struct Point*) points
Constant inlined main::i#0 = (byte) 0
Constant inlined main::i1#0 = (byte) 0
Constant inlined main::$13 = (signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$14 = (signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$15 = (signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Z
Constant inlined main::$9 = (signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$10 = (signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z
Constant inlined main::$8 = (signed byte*)(const struct Point*) points
Constant inlined main::$11 = (signed byte*)(const struct Point*) main::SCREEN
Successful SSA optimization Pass2ConstantInlining
Alias (byte~) main::$6 = (byte~) main::$18
Alias (byte~) main::$7 = (byte~) main::$20
Alias (byte~) main::$6 = (byte~) main::$12
Alias (byte~) main::$7 = (byte~) main::$14
Successful SSA optimization Pass2AliasElimination
Eliminating unused constant (const byte) SIZEOF_STRUCT_POINT
Successful SSA optimization PassNEliminateUnusedVars
Added new block during phi lifting main::@5(between main::@1 and main::@1)
Added new block during phi lifting main::@6(between main::@3 and main::@3)
Adding NOP phi() at start of @begin
@ -196,8 +158,8 @@ CALL GRAPH
Calls in [] to main:2
Created 2 initial phi equivalence classes
Coalesced [25] main::i1#3 ← main::i1#1
Coalesced [26] main::i#3 ← main::i#1
Coalesced [23] main::i1#3 ← main::i1#1
Coalesced [24] main::i#3 ← main::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@2
@ -227,8 +189,8 @@ main: scope:[main] from @1
main::@1: scope:[main] from main main::@1
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
[6] (signed byte~) main::$2 ← - (signed byte)(byte) main::i#2
[7] (byte~) main::$17 ← (byte) main::i#2 << (byte) 1
[8] (byte~) main::$6 ← (byte~) main::$17 + (byte) main::i#2
[7] (byte~) main::$11 ← (byte) main::i#2 << (byte) 1
[8] (byte~) main::$6 ← (byte~) main::$11 + (byte) main::i#2
[9] *((signed byte*)(const struct Point*) points + (byte~) main::$6) ← (signed byte)(byte) main::i#2
[10] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) ← (signed byte~) main::$2
[11] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$6) ← (signed byte)(byte) main::i#2
@ -237,16 +199,14 @@ main::@1: scope:[main] from main main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
[14] (byte) main::i1#2 ← phi( main::@1/(byte) 0 main::@2/(byte) main::i1#1 )
[15] (byte~) main::$19 ← (byte) main::i1#2 << (byte) 1
[16] (byte~) main::$7 ← (byte~) main::$19 + (byte) main::i1#2
[17] *((signed byte*)(const struct Point*) main::SCREEN + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points + (byte~) main::$7)
[18] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7)
[19] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7)
[20] (byte) main::i1#1 ← ++ (byte) main::i1#2
[21] if((byte) main::i1#1!=(byte) 4) goto main::@2
[15] (byte~) main::$13 ← (byte) main::i1#2 << (byte) 1
[16] (byte~) main::$7 ← (byte~) main::$13 + (byte) main::i1#2
[17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[18] (byte) main::i1#1 ← ++ (byte) main::i1#2
[19] if((byte) main::i1#1!=(byte) 4) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@2
[22] return
[20] return
to:@return
@ -255,40 +215,40 @@ VARIABLE REGISTER WEIGHTS
(signed byte) Point::y
(signed byte) Point::z
(void()) main()
(byte~) main::$17 22.0
(byte~) main::$19 22.0
(byte~) main::$11 22.0
(byte~) main::$13 22.0
(signed byte~) main::$2 5.5
(byte~) main::$6 14.666666666666666
(byte~) main::$7 25.666666666666668
(byte~) main::$7 22.0
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 6.285714285714286
(byte) main::i1
(byte) main::i1#1 16.5
(byte) main::i1#2 7.333333333333333
(byte) main::i1#2 11.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::i1#2 main::i1#1 ]
Added variable main::$2 to live range equivalence class [ main::$2 ]
Added variable main::$17 to live range equivalence class [ main::$17 ]
Added variable main::$11 to live range equivalence class [ main::$11 ]
Added variable main::$6 to live range equivalence class [ main::$6 ]
Added variable main::$19 to live range equivalence class [ main::$19 ]
Added variable main::$13 to live range equivalence class [ main::$13 ]
Added variable main::$7 to live range equivalence class [ main::$7 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::i1#2 main::i1#1 ]
[ main::$2 ]
[ main::$17 ]
[ main::$11 ]
[ main::$6 ]
[ main::$19 ]
[ main::$13 ]
[ main::$7 ]
Allocated zp[1]:2 [ main::i#2 main::i#1 ]
Allocated zp[1]:3 [ main::i1#2 main::i1#1 ]
Allocated zp[1]:4 [ main::$2 ]
Allocated zp[1]:5 [ main::$17 ]
Allocated zp[1]:5 [ main::$11 ]
Allocated zp[1]:6 [ main::$6 ]
Allocated zp[1]:7 [ main::$19 ]
Allocated zp[1]:7 [ main::$13 ]
Allocated zp[1]:8 [ main::$7 ]
INITIAL ASM
@ -300,6 +260,7 @@ Target platform is c64basic / MOS6502X
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 3
.const OFFSET_STRUCT_POINT_Y = 1
.const OFFSET_STRUCT_POINT_Z = 2
// @begin
@ -326,8 +287,8 @@ main: {
.label __7 = 8
.label i = 2
.label i1 = 3
.label __17 = 5
.label __19 = 7
.label __11 = 5
.label __13 = 7
// [5] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
@ -346,12 +307,12 @@ main: {
clc
adc #1
sta.z __2
// [7] (byte~) main::$17 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1
// [7] (byte~) main::$11 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1
lda.z i
asl
sta.z __17
// [8] (byte~) main::$6 ← (byte~) main::$17 + (byte) main::i#2 -- vbuz1=vbuz2_plus_vbuz3
lda.z __17
sta.z __11
// [8] (byte~) main::$6 ← (byte~) main::$11 + (byte) main::i#2 -- vbuz1=vbuz2_plus_vbuz3
lda.z __11
clc
adc.z i
sta.z __6
@ -385,37 +346,34 @@ main: {
jmp __b2
// main::@2
__b2:
// [15] (byte~) main::$19 ← (byte) main::i1#2 << (byte) 1 -- vbuz1=vbuz2_rol_1
// [15] (byte~) main::$13 ← (byte) main::i1#2 << (byte) 1 -- vbuz1=vbuz2_rol_1
lda.z i1
asl
sta.z __19
// [16] (byte~) main::$7 ← (byte~) main::$19 + (byte) main::i1#2 -- vbuz1=vbuz2_plus_vbuz3
lda.z __19
sta.z __13
// [16] (byte~) main::$7 ← (byte~) main::$13 + (byte) main::i1#2 -- vbuz1=vbuz2_plus_vbuz3
lda.z __13
clc
adc.z i1
sta.z __7
// [17] *((signed byte*)(const struct Point*) main::SCREEN + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points + (byte~) main::$7) -- pbsc1_derefidx_vbuz1=pbsc2_derefidx_vbuz1
// [17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- pssc1_derefidx_vbuz1=pssc2_derefidx_vbuz1_memcpy_vbuc3
ldx #SIZEOF_STRUCT_POINT
ldy.z __7
!:
lda points,y
sta SCREEN,y
// [18] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) -- pbsc1_derefidx_vbuz1=pbsc2_derefidx_vbuz1
ldy.z __7
lda points+OFFSET_STRUCT_POINT_Y,y
sta SCREEN+OFFSET_STRUCT_POINT_Y,y
// [19] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) -- pbsc1_derefidx_vbuz1=pbsc2_derefidx_vbuz1
ldy.z __7
lda points+OFFSET_STRUCT_POINT_Z,y
sta SCREEN+OFFSET_STRUCT_POINT_Z,y
// [20] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1
iny
dex
bne !-
// [18] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1
inc.z i1
// [21] if((byte) main::i1#1!=(byte) 4) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
// [19] if((byte) main::i1#1!=(byte) 4) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda #4
cmp.z i1
bne __b2_from___b2
jmp __breturn
// main::@return
__breturn:
// [22] return
// [20] return
rts
}
// File Data
@ -424,55 +382,55 @@ main: {
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (signed byte~) main::$2 ← - (signed byte)(byte) main::i#2 [ main::i#2 main::$2 ] ( main:2 [ main::i#2 main::$2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Statement [7] (byte~) main::$17 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$2 main::$17 ] ( main:2 [ main::i#2 main::$2 main::$17 ] ) always clobbers reg byte a
Statement [7] (byte~) main::$11 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$2 main::$11 ] ( main:2 [ main::i#2 main::$2 main::$11 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::$2 ]
Statement [8] (byte~) main::$6 ← (byte~) main::$17 + (byte) main::i#2 [ main::i#2 main::$2 main::$6 ] ( main:2 [ main::i#2 main::$2 main::$6 ] ) always clobbers reg byte a
Statement [8] (byte~) main::$6 ← (byte~) main::$11 + (byte) main::i#2 [ main::i#2 main::$2 main::$6 ] ( main:2 [ main::i#2 main::$2 main::$6 ] ) always clobbers reg byte a
Statement [9] *((signed byte*)(const struct Point*) points + (byte~) main::$6) ← (signed byte)(byte) main::i#2 [ main::i#2 main::$2 main::$6 ] ( main:2 [ main::i#2 main::$2 main::$6 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:6 [ main::$6 ]
Statement [10] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) ← (signed byte~) main::$2 [ main::i#2 main::$6 ] ( main:2 [ main::i#2 main::$6 ] ) always clobbers reg byte a
Statement [11] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$6) ← (signed byte)(byte) main::i#2 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Statement [15] (byte~) main::$19 ← (byte) main::i1#2 << (byte) 1 [ main::i1#2 main::$19 ] ( main:2 [ main::i1#2 main::$19 ] ) always clobbers reg byte a
Statement [15] (byte~) main::$13 ← (byte) main::i1#2 << (byte) 1 [ main::i1#2 main::$13 ] ( main:2 [ main::i1#2 main::$13 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::i1#2 main::i1#1 ]
Statement [16] (byte~) main::$7 ← (byte~) main::$19 + (byte) main::i1#2 [ main::i1#2 main::$7 ] ( main:2 [ main::i1#2 main::$7 ] ) always clobbers reg byte a
Statement [17] *((signed byte*)(const struct Point*) main::SCREEN + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points + (byte~) main::$7) [ main::i1#2 main::$7 ] ( main:2 [ main::i1#2 main::$7 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:8 [ main::$7 ]
Statement [18] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) [ main::i1#2 main::$7 ] ( main:2 [ main::i1#2 main::$7 ] ) always clobbers reg byte a
Statement [19] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a
Statement [16] (byte~) main::$7 ← (byte~) main::$13 + (byte) main::i1#2 [ main::i1#2 main::$7 ] ( main:2 [ main::i1#2 main::$7 ] ) always clobbers reg byte a
Statement [17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte x reg byte y
Removing always clobbered register reg byte x as potential for zp[1]:3 [ main::i1#2 main::i1#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:3 [ main::i1#2 main::i1#1 ]
Statement [19] if((byte) main::i1#1!=(byte) 4) goto main::@2 [ main::i1#1 ] ( main:2 [ main::i1#1 ] ) always clobbers reg byte a
Statement [6] (signed byte~) main::$2 ← - (signed byte)(byte) main::i#2 [ main::i#2 main::$2 ] ( main:2 [ main::i#2 main::$2 ] ) always clobbers reg byte a
Statement [7] (byte~) main::$17 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$2 main::$17 ] ( main:2 [ main::i#2 main::$2 main::$17 ] ) always clobbers reg byte a
Statement [8] (byte~) main::$6 ← (byte~) main::$17 + (byte) main::i#2 [ main::i#2 main::$2 main::$6 ] ( main:2 [ main::i#2 main::$2 main::$6 ] ) always clobbers reg byte a
Statement [7] (byte~) main::$11 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$2 main::$11 ] ( main:2 [ main::i#2 main::$2 main::$11 ] ) always clobbers reg byte a
Statement [8] (byte~) main::$6 ← (byte~) main::$11 + (byte) main::i#2 [ main::i#2 main::$2 main::$6 ] ( main:2 [ main::i#2 main::$2 main::$6 ] ) always clobbers reg byte a
Statement [9] *((signed byte*)(const struct Point*) points + (byte~) main::$6) ← (signed byte)(byte) main::i#2 [ main::i#2 main::$2 main::$6 ] ( main:2 [ main::i#2 main::$2 main::$6 ] ) always clobbers reg byte a
Statement [10] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) ← (signed byte~) main::$2 [ main::i#2 main::$6 ] ( main:2 [ main::i#2 main::$6 ] ) always clobbers reg byte a
Statement [11] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$6) ← (signed byte)(byte) main::i#2 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Statement [15] (byte~) main::$19 ← (byte) main::i1#2 << (byte) 1 [ main::i1#2 main::$19 ] ( main:2 [ main::i1#2 main::$19 ] ) always clobbers reg byte a
Statement [16] (byte~) main::$7 ← (byte~) main::$19 + (byte) main::i1#2 [ main::i1#2 main::$7 ] ( main:2 [ main::i1#2 main::$7 ] ) always clobbers reg byte a
Statement [17] *((signed byte*)(const struct Point*) main::SCREEN + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points + (byte~) main::$7) [ main::i1#2 main::$7 ] ( main:2 [ main::i1#2 main::$7 ] ) always clobbers reg byte a
Statement [18] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) [ main::i1#2 main::$7 ] ( main:2 [ main::i1#2 main::$7 ] ) always clobbers reg byte a
Statement [19] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a
Statement [15] (byte~) main::$13 ← (byte) main::i1#2 << (byte) 1 [ main::i1#2 main::$13 ] ( main:2 [ main::i1#2 main::$13 ] ) always clobbers reg byte a
Statement [16] (byte~) main::$7 ← (byte~) main::$13 + (byte) main::i1#2 [ main::i1#2 main::$7 ] ( main:2 [ main::i1#2 main::$7 ] ) always clobbers reg byte a
Statement [17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte x reg byte y
Statement [19] if((byte) main::i1#1!=(byte) 4) goto main::@2 [ main::i1#1 ] ( main:2 [ main::i1#1 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y ,
Potential registers zp[1]:3 [ main::i1#2 main::i1#1 ] : zp[1]:3 , reg byte x , reg byte y ,
Potential registers zp[1]:3 [ main::i1#2 main::i1#1 ] : zp[1]:3 ,
Potential registers zp[1]:4 [ main::$2 ] : zp[1]:4 , reg byte x , reg byte y ,
Potential registers zp[1]:5 [ main::$17 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:5 [ main::$11 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:6 [ main::$6 ] : zp[1]:6 , reg byte x , reg byte y ,
Potential registers zp[1]:7 [ main::$19 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:8 [ main::$7 ] : zp[1]:8 , reg byte x , reg byte y ,
Potential registers zp[1]:7 [ main::$13 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:8 [ main::$7 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 25.67: zp[1]:8 [ main::$7 ] 23.83: zp[1]:3 [ main::i1#2 main::i1#1 ] 22.79: zp[1]:2 [ main::i#2 main::i#1 ] 22: zp[1]:5 [ main::$17 ] 22: zp[1]:7 [ main::$19 ] 14.67: zp[1]:6 [ main::$6 ] 5.5: zp[1]:4 [ main::$2 ]
Uplift Scope [main] 27.5: zp[1]:3 [ main::i1#2 main::i1#1 ] 22.79: zp[1]:2 [ main::i#2 main::i#1 ] 22: zp[1]:5 [ main::$11 ] 22: zp[1]:7 [ main::$13 ] 22: zp[1]:8 [ main::$7 ] 14.67: zp[1]:6 [ main::$6 ] 5.5: zp[1]:4 [ main::$2 ]
Uplift Scope [Point]
Uplift Scope []
Uplifting [main] best 1353 combination reg byte y [ main::$7 ] reg byte x [ main::i1#2 main::i1#1 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$17 ] zp[1]:7 [ main::$19 ] zp[1]:6 [ main::$6 ] zp[1]:4 [ main::$2 ]
Limited combination testing to 100 combinations of 3888 possible.
Uplifting [Point] best 1353 combination
Uplifting [] best 1353 combination
Attempting to uplift remaining variables inzp[1]:7 [ main::$19 ]
Uplifting [main] best 1333 combination reg byte a [ main::$19 ]
Uplifting [main] best 1298 combination zp[1]:3 [ main::i1#2 main::i1#1 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$11 ] reg byte a [ main::$13 ] reg byte a [ main::$7 ] zp[1]:6 [ main::$6 ] zp[1]:4 [ main::$2 ]
Limited combination testing to 100 combinations of 1728 possible.
Uplifting [Point] best 1298 combination
Uplifting [] best 1298 combination
Attempting to uplift remaining variables inzp[1]:3 [ main::i1#2 main::i1#1 ]
Uplifting [main] best 1298 combination zp[1]:3 [ main::i1#2 main::i1#1 ]
Attempting to uplift remaining variables inzp[1]:6 [ main::$6 ]
Uplifting [main] best 1233 combination reg byte y [ main::$6 ]
Uplifting [main] best 1198 combination reg byte y [ main::$6 ]
Attempting to uplift remaining variables inzp[1]:4 [ main::$2 ]
Uplifting [main] best 1233 combination zp[1]:4 [ main::$2 ]
Allocated (was zp[1]:4) zp[1]:2 [ main::$2 ]
Uplifting [main] best 1198 combination zp[1]:4 [ main::$2 ]
Allocated (was zp[1]:3) zp[1]:2 [ main::i1#2 main::i1#1 ]
Allocated (was zp[1]:4) zp[1]:3 [ main::$2 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -482,6 +440,7 @@ ASSEMBLER BEFORE OPTIMIZATION
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 3
.const OFFSET_STRUCT_POINT_Y = 1
.const OFFSET_STRUCT_POINT_Z = 2
// @begin
@ -503,7 +462,8 @@ __bend:
// main
main: {
.label SCREEN = $400
.label __2 = 2
.label __2 = 3
.label i1 = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
@ -521,10 +481,10 @@ main: {
clc
adc #1
sta.z __2
// [7] (byte~) main::$17 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1
// [7] (byte~) main::$11 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1
txa
asl
// [8] (byte~) main::$6 ← (byte~) main::$17 + (byte) main::i#2 -- vbuyy=vbuaa_plus_vbuxx
// [8] (byte~) main::$6 ← (byte~) main::$11 + (byte) main::i#2 -- vbuyy=vbuaa_plus_vbuxx
stx.z $ff
clc
adc.z $ff
@ -545,8 +505,9 @@ main: {
bne __b1_from___b1
// [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
__b2_from___b1:
// [14] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1
ldx #0
// [14] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
lda #0
sta.z i1
jmp __b2
// [14] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
__b2_from___b2:
@ -554,32 +515,31 @@ main: {
jmp __b2
// main::@2
__b2:
// [15] (byte~) main::$19 ← (byte) main::i1#2 << (byte) 1 -- vbuaa=vbuxx_rol_1
txa
// [15] (byte~) main::$13 ← (byte) main::i1#2 << (byte) 1 -- vbuaa=vbuz1_rol_1
lda.z i1
asl
// [16] (byte~) main::$7 ← (byte~) main::$19 + (byte) main::i1#2 -- vbuyy=vbuaa_plus_vbuxx
stx.z $ff
// [16] (byte~) main::$7 ← (byte~) main::$13 + (byte) main::i1#2 -- vbuaa=vbuaa_plus_vbuz1
clc
adc.z $ff
adc.z i1
// [17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- pssc1_derefidx_vbuaa=pssc2_derefidx_vbuaa_memcpy_vbuc3
ldx #SIZEOF_STRUCT_POINT
tay
// [17] *((signed byte*)(const struct Point*) main::SCREEN + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points + (byte~) main::$7) -- pbsc1_derefidx_vbuyy=pbsc2_derefidx_vbuyy
!:
lda points,y
sta SCREEN,y
// [18] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) -- pbsc1_derefidx_vbuyy=pbsc2_derefidx_vbuyy
lda points+OFFSET_STRUCT_POINT_Y,y
sta SCREEN+OFFSET_STRUCT_POINT_Y,y
// [19] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) -- pbsc1_derefidx_vbuyy=pbsc2_derefidx_vbuyy
lda points+OFFSET_STRUCT_POINT_Z,y
sta SCREEN+OFFSET_STRUCT_POINT_Z,y
// [20] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuxx=_inc_vbuxx
inx
// [21] if((byte) main::i1#1!=(byte) 4) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #4
iny
dex
bne !-
// [18] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1
inc.z i1
// [19] if((byte) main::i1#1!=(byte) 4) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda #4
cmp.z i1
bne __b2_from___b2
jmp __breturn
// main::@return
__breturn:
// [22] return
// [20] return
rts
}
// File Data
@ -625,12 +585,13 @@ FINAL SYMBOL TABLE
(signed byte) Point::x
(signed byte) Point::y
(signed byte) Point::z
(const byte) SIZEOF_STRUCT_POINT = (byte) 3
(void()) main()
(byte~) main::$17 reg byte a 22.0
(byte~) main::$19 reg byte a 22.0
(signed byte~) main::$2 zp[1]:2 5.5
(byte~) main::$11 reg byte a 22.0
(byte~) main::$13 reg byte a 22.0
(signed byte~) main::$2 zp[1]:3 5.5
(byte~) main::$6 reg byte y 14.666666666666666
(byte~) main::$7 reg byte y 25.666666666666668
(byte~) main::$7 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@return
@ -639,21 +600,21 @@ FINAL SYMBOL TABLE
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 6.285714285714286
(byte) main::i1
(byte) main::i1#1 reg byte x 16.5
(byte) main::i1#2 reg byte x 7.333333333333333
(byte) main::i1#1 i1 zp[1]:2 16.5
(byte) main::i1#2 i1 zp[1]:2 11.0
(const struct Point*) points[(number) 4] = { fill( 4, 0) }
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::i1#2 main::i1#1 ]
zp[1]:2 [ main::$2 ]
reg byte a [ main::$17 ]
zp[1]:2 [ main::i1#2 main::i1#1 ]
zp[1]:3 [ main::$2 ]
reg byte a [ main::$11 ]
reg byte y [ main::$6 ]
reg byte a [ main::$19 ]
reg byte y [ main::$7 ]
reg byte a [ main::$13 ]
reg byte a [ main::$7 ]
FINAL ASSEMBLER
Score: 1071
Score: 1036
// File Comments
// Minimal struct - array of 3-byte structs (required *3)
@ -662,6 +623,7 @@ Score: 1071
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 3
.const OFFSET_STRUCT_POINT_Y = 1
.const OFFSET_STRUCT_POINT_Z = 2
// @begin
@ -674,7 +636,8 @@ Score: 1071
// main
main: {
.label SCREEN = $400
.label __2 = 2
.label __2 = 3
.label i1 = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
@ -690,10 +653,10 @@ main: {
adc #1
sta.z __2
// points[i] = { (signed byte)i, -(signed byte)i, (signed byte)i }
// [7] (byte~) main::$17 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1
// [7] (byte~) main::$11 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1
txa
asl
// [8] (byte~) main::$6 ← (byte~) main::$17 + (byte) main::i#2 -- vbuyy=vbuaa_plus_vbuxx
// [8] (byte~) main::$6 ← (byte~) main::$11 + (byte) main::i#2 -- vbuyy=vbuaa_plus_vbuxx
stx.z $ff
clc
adc.z $ff
@ -714,39 +677,39 @@ main: {
cpx #4
bne __b1
// [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// [14] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1
ldx #0
// [14] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
lda #0
sta.z i1
// [14] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
// [14] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy
// main::@2
__b2:
// SCREEN[i] = points[i]
// [15] (byte~) main::$19 ← (byte) main::i1#2 << (byte) 1 -- vbuaa=vbuxx_rol_1
txa
// [15] (byte~) main::$13 ← (byte) main::i1#2 << (byte) 1 -- vbuaa=vbuz1_rol_1
lda.z i1
asl
// [16] (byte~) main::$7 ← (byte~) main::$19 + (byte) main::i1#2 -- vbuyy=vbuaa_plus_vbuxx
stx.z $ff
// [16] (byte~) main::$7 ← (byte~) main::$13 + (byte) main::i1#2 -- vbuaa=vbuaa_plus_vbuz1
clc
adc.z $ff
adc.z i1
// [17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- pssc1_derefidx_vbuaa=pssc2_derefidx_vbuaa_memcpy_vbuc3
ldx #SIZEOF_STRUCT_POINT
tay
// [17] *((signed byte*)(const struct Point*) main::SCREEN + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points + (byte~) main::$7) -- pbsc1_derefidx_vbuyy=pbsc2_derefidx_vbuyy
!:
lda points,y
sta SCREEN,y
// [18] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$7) -- pbsc1_derefidx_vbuyy=pbsc2_derefidx_vbuyy
lda points+OFFSET_STRUCT_POINT_Y,y
sta SCREEN+OFFSET_STRUCT_POINT_Y,y
// [19] *((signed byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) ← *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$7) -- pbsc1_derefidx_vbuyy=pbsc2_derefidx_vbuyy
lda points+OFFSET_STRUCT_POINT_Z,y
sta SCREEN+OFFSET_STRUCT_POINT_Z,y
iny
dex
bne !-
// for( byte i: 0..3)
// [20] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuxx=_inc_vbuxx
inx
// [21] if((byte) main::i1#1!=(byte) 4) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #4
// [18] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1
inc.z i1
// [19] if((byte) main::i1#1!=(byte) 4) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda #4
cmp.z i1
bne __b2
// main::@return
// }
// [22] return
// [20] return
rts
}
// File Data

View File

@ -6,12 +6,13 @@
(signed byte) Point::x
(signed byte) Point::y
(signed byte) Point::z
(const byte) SIZEOF_STRUCT_POINT = (byte) 3
(void()) main()
(byte~) main::$17 reg byte a 22.0
(byte~) main::$19 reg byte a 22.0
(signed byte~) main::$2 zp[1]:2 5.5
(byte~) main::$11 reg byte a 22.0
(byte~) main::$13 reg byte a 22.0
(signed byte~) main::$2 zp[1]:3 5.5
(byte~) main::$6 reg byte y 14.666666666666666
(byte~) main::$7 reg byte y 25.666666666666668
(byte~) main::$7 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@return
@ -20,14 +21,14 @@
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 6.285714285714286
(byte) main::i1
(byte) main::i1#1 reg byte x 16.5
(byte) main::i1#2 reg byte x 7.333333333333333
(byte) main::i1#1 i1 zp[1]:2 16.5
(byte) main::i1#2 i1 zp[1]:2 11.0
(const struct Point*) points[(number) 4] = { fill( 4, 0) }
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::i1#2 main::i1#1 ]
zp[1]:2 [ main::$2 ]
reg byte a [ main::$17 ]
zp[1]:2 [ main::i1#2 main::i1#1 ]
zp[1]:3 [ main::$2 ]
reg byte a [ main::$11 ]
reg byte y [ main::$6 ]
reg byte a [ main::$19 ]
reg byte y [ main::$7 ]
reg byte a [ main::$13 ]
reg byte a [ main::$7 ]

View File

@ -7,14 +7,18 @@
.const OFFSET_STRUCT_POINT_Y = 1
.label idx = 2
main: {
lda #1
sta points
lda #2
sta points+OFFSET_STRUCT_POINT_Y
lda #3
sta points+1*SIZEOF_STRUCT_POINT
lda #4
sta points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT
ldy #SIZEOF_STRUCT_POINT
!:
lda __0-1,y
sta points-1,y
dey
bne !-
ldy #SIZEOF_STRUCT_POINT
!:
lda __1-1,y
sta points+1*SIZEOF_STRUCT_POINT-1,y
dey
bne !-
lda #0
sta.z idx
tax
@ -47,3 +51,5 @@ print: {
rts
}
points: .fill 2*2, 0
__0: .byte 1, 2
__1: .byte 3, 4

View File

@ -10,34 +10,32 @@
(void()) main()
main: scope:[main] from @1
[4] *((byte*)(const struct Point*) points) ← (byte) 1
[5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 2
[6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 3
[7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 4
[4] *((const struct Point*) points) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[5] *((const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
to:main::@1
main::@1: scope:[main] from main main::@2
[8] (byte) idx#12 ← phi( main/(byte) 0 main::@2/(byte) idx#10 )
[8] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 )
[9] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1
[10] (byte) print::p_x#0 ← *((byte*)(const struct Point*) points + (byte~) main::$4)
[11] (byte) print::p_y#0 ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4)
[12] call print
[6] (byte) idx#12 ← phi( main/(byte) 0 main::@2/(byte) idx#10 )
[6] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 )
[7] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1
[8] (byte) print::p_x#0 ← *((byte*)(const struct Point*) points + (byte~) main::$4)
[9] (byte) print::p_y#0 ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4)
[10] call print
to:main::@2
main::@2: scope:[main] from main::@1
[13] (byte) main::i#1 ← ++ (byte) main::i#2
[14] if((byte) main::i#1!=(byte) 2) goto main::@1
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if((byte) main::i#1!=(byte) 2) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[15] return
[13] return
to:@return
(void()) print((byte) print::p_x , (byte) print::p_y)
print: scope:[print] from main::@1
[16] *((const byte*) SCREEN + (byte) idx#12) ← (byte) print::p_x#0
[17] (byte) idx#3 ← ++ (byte) idx#12
[18] *((const byte*) SCREEN + (byte) idx#3) ← (byte) print::p_y#0
[19] (byte) idx#10 ← ++ (byte) idx#3
[14] *((const byte*) SCREEN + (byte) idx#12) ← (byte) print::p_x#0
[15] (byte) idx#3 ← ++ (byte) idx#12
[16] *((const byte*) SCREEN + (byte) idx#3) ← (byte) print::p_y#0
[17] (byte) idx#10 ← ++ (byte) idx#3
to:print::@return
print::@return: scope:[print] from print
[20] return
[18] return
to:@return

View File

@ -7,11 +7,9 @@ Created struct value member variable (byte) print::p_x
Created struct value member variable (byte) print::p_y
Converted struct value to member variables (struct Point) print::p
Converted procedure struct value parameter to member unwinding (void()) print((byte) print::p_x , (byte) print::p_y)
Adding struct value member variable copy *((byte*~) main::$5 + (number~) main::$2) ← (byte) 1
Adding struct value member variable copy *((byte*~) main::$6 + (number~) main::$2) ← (byte) 2
Adding struct value member variable copy *((byte*~) main::$7 + (number~) main::$3) ← (byte) 3
Adding struct value member variable copy *((byte*~) main::$8 + (number~) main::$3) ← (byte) 4
Converted procedure struct value parameter to member unwinding in call (void~) main::$0 ← call print *((byte*~) main::$9 + (byte~) main::$4) *((byte*~) main::$10 + (byte~) main::$4)
Adding struct value member variable copy *((const struct Point*) points + (number~) main::$2) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Adding struct value member variable copy *((const struct Point*) points + (number~) main::$3) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Converted procedure struct value parameter to member unwinding in call (void~) main::$0 ← call print *((byte*~) main::$5 + (byte~) main::$4) *((byte*~) main::$6 + (byte~) main::$4)
Replacing struct member reference (struct Point) print::p.x with member unwinding reference (byte) print::p_x
Replacing struct member reference (struct Point) print::p.y with member unwinding reference (byte) print::p_y
Culled Empty Block (label) main::@2
@ -26,31 +24,25 @@ CONTROL FLOW GRAPH SSA
main: scope:[main] from @2
(byte) idx#14 ← phi( @2/(byte) idx#13 )
(number~) main::$2 ← (number) 0 * (const byte) SIZEOF_STRUCT_POINT
(byte*~) main::$5 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
*((byte*~) main::$5 + (number~) main::$2) ← (byte) 1
(byte*~) main::$6 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
*((byte*~) main::$6 + (number~) main::$2) ← (byte) 2
*((const struct Point*) points + (number~) main::$2) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
(number~) main::$3 ← (number) 1 * (const byte) SIZEOF_STRUCT_POINT
(byte*~) main::$7 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
*((byte*~) main::$7 + (number~) main::$3) ← (byte) 3
(byte*~) main::$8 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
*((byte*~) main::$8 + (number~) main::$3) ← (byte) 4
*((const struct Point*) points + (number~) main::$3) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
(byte) main::i#0 ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@3
(byte) idx#12 ← phi( main/(byte) idx#14 main::@3/(byte) idx#1 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@3/(byte) main::i#1 )
(byte~) main::$4 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
(byte) print::p_x#0 ← *((byte*~) main::$9 + (byte~) main::$4)
(byte) print::p_y#0 ← *((byte*~) main::$10 + (byte~) main::$4)
(byte) print::p_x#0 ← *((byte*~) main::$5 + (byte~) main::$4)
(byte) print::p_y#0 ← *((byte*~) main::$6 + (byte~) main::$4)
call print
to:main::@3
main::@3: scope:[main] from main::@1
(byte) main::i#3 ← phi( main::@1/(byte) main::i#2 )
(byte) idx#7 ← phi( main::@1/(byte) idx#5 )
(byte) idx#1 ← (byte) idx#7
(byte*~) main::$9 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
(byte*~) main::$10 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
(byte*~) main::$5 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
(byte*~) main::$6 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
(byte) main::i#1 ← (byte) main::i#3 + rangenext(0,1)
(bool~) main::$1 ← (byte) main::i#1 != rangelast(0,1)
if((bool~) main::$1) goto main::@1
@ -87,6 +79,8 @@ print::@return: scope:[print] from print
@end: scope:[] from @3
SYMBOL TABLE SSA
(const struct Point) $0 = { x: (byte) 1, y: (byte) 2 }
(const struct Point) $1 = { x: (byte) 3, y: (byte) 4 }
(label) @2
(label) @3
(label) @begin
@ -115,15 +109,11 @@ SYMBOL TABLE SSA
(byte) idx#9
(void()) main()
(bool~) main::$1
(byte*~) main::$10
(number~) main::$2
(number~) main::$3
(byte~) main::$4
(byte*~) main::$5
(byte*~) main::$6
(byte*~) main::$7
(byte*~) main::$8
(byte*~) main::$9
(label) main::@1
(label) main::@3
(label) main::@return
@ -170,37 +160,26 @@ Identical Phi Values (byte) idx#9 (byte) idx#12
Identical Phi Values (byte) print::p_y#1 (byte) print::p_y#0
Identical Phi Values (byte) idx#11 (byte) idx#1
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$1 [24] if((byte) main::i#1!=rangelast(0,1)) goto main::@1
Simple Condition (bool~) main::$1 [18] if((byte) main::i#1!=rangelast(0,1)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [2] (byte~) main::$2 ← (byte) 0 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [3] (byte*~) main::$5 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [5] (byte*~) main::$6 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [7] (byte~) main::$3 ← (byte) 1 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [8] (byte*~) main::$7 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [10] (byte*~) main::$8 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [20] (byte*~) main::$9 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [21] (byte*~) main::$10 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [4] (byte~) main::$3 ← (byte) 1 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [14] (byte*~) main::$5 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [15] (byte*~) main::$6 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) idx#0 = 0
Constant (const byte) main::$2 = 0*SIZEOF_STRUCT_POINT
Constant (const byte) main::$3 = 1*SIZEOF_STRUCT_POINT
Constant (const byte) main::i#0 = 0
Constant (const byte*) main::$5 = (byte*)points+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$6 = (byte*)points+OFFSET_STRUCT_POINT_Y
Constant (const byte) main::$3 = 1*SIZEOF_STRUCT_POINT
Constant (const byte*) main::$7 = (byte*)points+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$8 = (byte*)points+OFFSET_STRUCT_POINT_Y
Constant (const byte) main::i#0 = 0
Constant (const byte*) main::$9 = (byte*)points+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$10 = (byte*)points+OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [22] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [24] if(main::i#1!=rangelast(0,1)) goto main::@1 to (number) 2
Resolved ranged next value [16] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [18] if(main::i#1!=rangelast(0,1)) goto main::@1 to (number) 2
Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_POINT in
Successful SSA optimization PassNSimplifyConstantZero
Simplifying expression containing zero (byte*)points in
Simplifying expression containing zero (byte*)points in
Simplifying expression containing zero (byte*)points in
Simplifying expression containing zero main::$5 in [4] *((const byte*) main::$5 + (const byte) main::$2) ← (byte) 1
Simplifying expression containing zero main::$6 in [6] *((const byte*) main::$6 + (const byte) main::$2) ← (byte) 2
Simplifying expression containing zero points in [3] *((const struct Point*) points + (const byte) main::$2) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) main::$2
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
@ -211,7 +190,7 @@ Simplifying constant integer cast 2
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Rewriting multiplication to use shift [5] (byte~) main::$4 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
Rewriting multiplication to use shift [3] (byte~) main::$4 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) idx#0
@ -219,14 +198,9 @@ Constant inlined main::$5 = (byte*)(const struct Point*) points
Constant inlined main::i#0 = (byte) 0
Constant inlined main::$6 = (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$3 = (byte) 1*(const byte) SIZEOF_STRUCT_POINT
Constant inlined main::$9 = (byte*)(const struct Point*) points
Constant inlined idx#0 = (byte) 0
Constant inlined main::$7 = (byte*)(const struct Point*) points
Constant inlined main::$10 = (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$8 = (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *((byte*)points+1*SIZEOF_STRUCT_POINT)
Consolidated array index constant in *((byte*)points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT)
Consolidated array index constant in *(points+1*SIZEOF_STRUCT_POINT)
Successful SSA optimization Pass2ConstantAdditionElimination
Added new block during phi lifting main::@4(between main::@3 and main::@1)
Adding NOP phi() at start of @begin
@ -235,11 +209,11 @@ Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2
Calls in [main] to print:13
Calls in [main] to print:11
Created 2 initial phi equivalence classes
Coalesced [17] main::i#4 ← main::i#1
Coalesced [18] idx#15 ← idx#10
Coalesced [15] main::i#4 ← main::i#1
Coalesced [16] idx#15 ← idx#10
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@4
@ -262,36 +236,34 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] *((byte*)(const struct Point*) points) ← (byte) 1
[5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 2
[6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 3
[7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 4
[4] *((const struct Point*) points) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[5] *((const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT)
to:main::@1
main::@1: scope:[main] from main main::@2
[8] (byte) idx#12 ← phi( main/(byte) 0 main::@2/(byte) idx#10 )
[8] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 )
[9] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1
[10] (byte) print::p_x#0 ← *((byte*)(const struct Point*) points + (byte~) main::$4)
[11] (byte) print::p_y#0 ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4)
[12] call print
[6] (byte) idx#12 ← phi( main/(byte) 0 main::@2/(byte) idx#10 )
[6] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 )
[7] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1
[8] (byte) print::p_x#0 ← *((byte*)(const struct Point*) points + (byte~) main::$4)
[9] (byte) print::p_y#0 ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4)
[10] call print
to:main::@2
main::@2: scope:[main] from main::@1
[13] (byte) main::i#1 ← ++ (byte) main::i#2
[14] if((byte) main::i#1!=(byte) 2) goto main::@1
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if((byte) main::i#1!=(byte) 2) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[15] return
[13] return
to:@return
(void()) print((byte) print::p_x , (byte) print::p_y)
print: scope:[print] from main::@1
[16] *((const byte*) SCREEN + (byte) idx#12) ← (byte) print::p_x#0
[17] (byte) idx#3 ← ++ (byte) idx#12
[18] *((const byte*) SCREEN + (byte) idx#3) ← (byte) print::p_y#0
[19] (byte) idx#10 ← ++ (byte) idx#3
[14] *((const byte*) SCREEN + (byte) idx#12) ← (byte) print::p_x#0
[15] (byte) idx#3 ← ++ (byte) idx#12
[16] *((const byte*) SCREEN + (byte) idx#3) ← (byte) print::p_y#0
[17] (byte) idx#10 ← ++ (byte) idx#3
to:print::@return
print::@return: scope:[print] from print
[20] return
[18] return
to:@return
@ -367,61 +339,63 @@ __bend:
main: {
.label __4 = 4
.label i = 2
// [4] *((byte*)(const struct Point*) points) ← (byte) 1 -- _deref_pbuc1=vbuc2
lda #1
sta points
// [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 2 -- _deref_pbuc1=vbuc2
lda #2
sta points+OFFSET_STRUCT_POINT_Y
// [6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 3 -- _deref_pbuc1=vbuc2
lda #3
sta points+1*SIZEOF_STRUCT_POINT
// [7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 4 -- _deref_pbuc1=vbuc2
lda #4
sta points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT
// [8] phi from main to main::@1 [phi:main->main::@1]
// [4] *((const struct Point*) points) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda __0-1,y
sta points-1,y
dey
bne !-
// [5] *((const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda __1-1,y
sta points+1*SIZEOF_STRUCT_POINT-1,y
dey
bne !-
// [6] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [8] phi (byte) idx#12 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
// [6] phi (byte) idx#12 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta.z idx_1
// [8] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
// [6] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
lda #0
sta.z i
jmp __b1
// [8] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
// [6] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
__b1_from___b2:
// [8] phi (byte) idx#12 = (byte) idx#10 [phi:main::@2->main::@1#0] -- register_copy
// [8] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
// [6] phi (byte) idx#12 = (byte) idx#10 [phi:main::@2->main::@1#0] -- register_copy
// [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
jmp __b1
// main::@1
__b1:
// [9] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1
// [7] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1
lda.z i
asl
sta.z __4
// [10] (byte) print::p_x#0 ← *((byte*)(const struct Point*) points + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuz2
// [8] (byte) print::p_x#0 ← *((byte*)(const struct Point*) points + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuz2
ldy.z __4
lda points,y
sta.z print.p_x
// [11] (byte) print::p_y#0 ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuz2
// [9] (byte) print::p_y#0 ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuz2
ldy.z __4
lda points+OFFSET_STRUCT_POINT_Y,y
sta.z print.p_y
// [12] call print
// [10] call print
jsr print
jmp __b2
// main::@2
__b2:
// [13] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc.z i
// [14] if((byte) main::i#1!=(byte) 2) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [12] if((byte) main::i#1!=(byte) 2) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #2
cmp.z i
bne __b1_from___b2
jmp __breturn
// main::@return
__breturn:
// [15] return
// [13] return
rts
}
// print
@ -429,44 +403,42 @@ main: {
print: {
.label p_x = 5
.label p_y = 6
// [16] *((const byte*) SCREEN + (byte) idx#12) ← (byte) print::p_x#0 -- pbuc1_derefidx_vbuz1=vbuz2
// [14] *((const byte*) SCREEN + (byte) idx#12) ← (byte) print::p_x#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z p_x
ldy.z idx_1
sta SCREEN,y
// [17] (byte) idx#3 ← ++ (byte) idx#12 -- vbuz1=_inc_vbuz2
// [15] (byte) idx#3 ← ++ (byte) idx#12 -- vbuz1=_inc_vbuz2
ldy.z idx_1
iny
sty.z idx
// [18] *((const byte*) SCREEN + (byte) idx#3) ← (byte) print::p_y#0 -- pbuc1_derefidx_vbuz1=vbuz2
// [16] *((const byte*) SCREEN + (byte) idx#3) ← (byte) print::p_y#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z p_y
ldy.z idx
sta SCREEN,y
// [19] (byte) idx#10 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz2
// [17] (byte) idx#10 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz2
ldy.z idx
iny
sty.z idx_1
jmp __breturn
// print::@return
__breturn:
// [20] return
// [18] return
rts
}
// File Data
points: .fill 2*2, 0
__0: .byte 1, 2
__1: .byte 3, 4
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((byte*)(const struct Point*) points) ← (byte) 1 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 2 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 3 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 4 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [9] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 [ main::i#2 idx#12 main::$4 ] ( main:2 [ main::i#2 idx#12 main::$4 ] ) always clobbers reg byte a
Statement [4] *((const struct Point*) points) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y
Statement [5] *((const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y
Statement [7] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 [ main::i#2 idx#12 main::$4 ] ( main:2 [ main::i#2 idx#12 main::$4 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:3 [ idx#12 idx#10 ]
Statement [4] *((byte*)(const struct Point*) points) ← (byte) 1 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 2 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 3 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 4 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [9] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 [ main::i#2 idx#12 main::$4 ] ( main:2 [ main::i#2 idx#12 main::$4 ] ) always clobbers reg byte a
Statement [4] *((const struct Point*) points) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y
Statement [5] *((const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y
Statement [7] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 [ main::i#2 idx#12 main::$4 ] ( main:2 [ main::i#2 idx#12 main::$4 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y ,
Potential registers zp[1]:3 [ idx#12 idx#10 ] : zp[1]:3 , reg byte x , reg byte y ,
Potential registers zp[1]:4 [ main::$4 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y ,
@ -480,16 +452,16 @@ Uplift Scope [print] 6.5: zp[1]:5 [ print::p_x#0 ] 4.33: zp[1]:6 [ print::p_y#0
Uplift Scope [] 5.6: zp[1]:3 [ idx#12 idx#10 ] 3: zp[1]:7 [ idx#3 ]
Uplift Scope [Point]
Uplifting [main] best 614 combination reg byte x [ main::i#2 main::i#1 ] reg byte y [ main::$4 ]
Uplifting [print] best 614 combination zp[1]:5 [ print::p_x#0 ] zp[1]:6 [ print::p_y#0 ]
Uplifting [] best 605 combination zp[1]:3 [ idx#12 idx#10 ] reg byte y [ idx#3 ]
Uplifting [Point] best 605 combination
Uplifting [main] best 622 combination reg byte x [ main::i#2 main::i#1 ] reg byte y [ main::$4 ]
Uplifting [print] best 622 combination zp[1]:5 [ print::p_x#0 ] zp[1]:6 [ print::p_y#0 ]
Uplifting [] best 613 combination zp[1]:3 [ idx#12 idx#10 ] reg byte y [ idx#3 ]
Uplifting [Point] best 613 combination
Attempting to uplift remaining variables inzp[1]:5 [ print::p_x#0 ]
Uplifting [print] best 605 combination zp[1]:5 [ print::p_x#0 ]
Uplifting [print] best 613 combination zp[1]:5 [ print::p_x#0 ]
Attempting to uplift remaining variables inzp[1]:3 [ idx#12 idx#10 ]
Uplifting [] best 605 combination zp[1]:3 [ idx#12 idx#10 ]
Uplifting [] best 613 combination zp[1]:3 [ idx#12 idx#10 ]
Attempting to uplift remaining variables inzp[1]:6 [ print::p_y#0 ]
Uplifting [print] best 605 combination zp[1]:6 [ print::p_y#0 ]
Uplifting [print] best 613 combination zp[1]:6 [ print::p_y#0 ]
Allocated (was zp[1]:3) zp[1]:2 [ idx#12 idx#10 ]
Allocated (was zp[1]:5) zp[1]:3 [ print::p_x#0 ]
Allocated (was zp[1]:6) zp[1]:4 [ print::p_y#0 ]
@ -522,57 +494,59 @@ __bend_from___b1:
__bend:
// main
main: {
// [4] *((byte*)(const struct Point*) points) ← (byte) 1 -- _deref_pbuc1=vbuc2
lda #1
sta points
// [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 2 -- _deref_pbuc1=vbuc2
lda #2
sta points+OFFSET_STRUCT_POINT_Y
// [6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 3 -- _deref_pbuc1=vbuc2
lda #3
sta points+1*SIZEOF_STRUCT_POINT
// [7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 4 -- _deref_pbuc1=vbuc2
lda #4
sta points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT
// [8] phi from main to main::@1 [phi:main->main::@1]
// [4] *((const struct Point*) points) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda __0-1,y
sta points-1,y
dey
bne !-
// [5] *((const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda __1-1,y
sta points+1*SIZEOF_STRUCT_POINT-1,y
dey
bne !-
// [6] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [8] phi (byte) idx#12 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
// [6] phi (byte) idx#12 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta.z idx
// [8] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
// [6] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
ldx #0
jmp __b1
// [8] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
// [6] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
__b1_from___b2:
// [8] phi (byte) idx#12 = (byte) idx#10 [phi:main::@2->main::@1#0] -- register_copy
// [8] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
// [6] phi (byte) idx#12 = (byte) idx#10 [phi:main::@2->main::@1#0] -- register_copy
// [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
jmp __b1
// main::@1
__b1:
// [9] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 -- vbuyy=vbuxx_rol_1
// [7] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 -- vbuyy=vbuxx_rol_1
txa
asl
tay
// [10] (byte) print::p_x#0 ← *((byte*)(const struct Point*) points + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuyy
// [8] (byte) print::p_x#0 ← *((byte*)(const struct Point*) points + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuyy
lda points,y
sta.z print.p_x
// [11] (byte) print::p_y#0 ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuyy
// [9] (byte) print::p_y#0 ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuyy
lda points+OFFSET_STRUCT_POINT_Y,y
sta.z print.p_y
// [12] call print
// [10] call print
jsr print
jmp __b2
// main::@2
__b2:
// [13] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [14] if((byte) main::i#1!=(byte) 2) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
// [12] if((byte) main::i#1!=(byte) 2) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #2
bne __b1_from___b2
jmp __breturn
// main::@return
__breturn:
// [15] return
// [13] return
rts
}
// print
@ -580,27 +554,29 @@ main: {
print: {
.label p_x = 3
.label p_y = 4
// [16] *((const byte*) SCREEN + (byte) idx#12) ← (byte) print::p_x#0 -- pbuc1_derefidx_vbuz1=vbuz2
// [14] *((const byte*) SCREEN + (byte) idx#12) ← (byte) print::p_x#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z p_x
ldy.z idx
sta SCREEN,y
// [17] (byte) idx#3 ← ++ (byte) idx#12 -- vbuyy=_inc_vbuz1
// [15] (byte) idx#3 ← ++ (byte) idx#12 -- vbuyy=_inc_vbuz1
ldy.z idx
iny
// [18] *((const byte*) SCREEN + (byte) idx#3) ← (byte) print::p_y#0 -- pbuc1_derefidx_vbuyy=vbuz1
// [16] *((const byte*) SCREEN + (byte) idx#3) ← (byte) print::p_y#0 -- pbuc1_derefidx_vbuyy=vbuz1
lda.z p_y
sta SCREEN,y
// [19] (byte) idx#10 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuyy
// [17] (byte) idx#10 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuyy
iny
sty.z idx
jmp __breturn
// print::@return
__breturn:
// [20] return
// [18] return
rts
}
// File Data
points: .fill 2*2, 0
__0: .byte 1, 2
__1: .byte 3, 4
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
@ -635,6 +611,8 @@ Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
(const struct Point) $0 = { x: (byte) 1, y: (byte) 2 }
(const struct Point) $1 = { x: (byte) 3, y: (byte) 4 }
(label) @1
(label) @begin
(label) @end
@ -673,7 +651,7 @@ reg byte y [ idx#3 ]
FINAL ASSEMBLER
Score: 467
Score: 475
// File Comments
// Demonstrates problem with passing struct array element as parameter to call
@ -695,53 +673,55 @@ Score: 467
// main
main: {
// points[0] = { 1, 2 }
// [4] *((byte*)(const struct Point*) points) ← (byte) 1 -- _deref_pbuc1=vbuc2
lda #1
sta points
// [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 2 -- _deref_pbuc1=vbuc2
lda #2
sta points+OFFSET_STRUCT_POINT_Y
// [4] *((const struct Point*) points) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda __0-1,y
sta points-1,y
dey
bne !-
// points[1] = { 3, 4 }
// [6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 3 -- _deref_pbuc1=vbuc2
lda #3
sta points+1*SIZEOF_STRUCT_POINT
// [7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 4 -- _deref_pbuc1=vbuc2
lda #4
sta points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT
// [8] phi from main to main::@1 [phi:main->main::@1]
// [8] phi (byte) idx#12 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
// [5] *((const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← memcpy(*(&(const struct Point) $1), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3
ldy #SIZEOF_STRUCT_POINT
!:
lda __1-1,y
sta points+1*SIZEOF_STRUCT_POINT-1,y
dey
bne !-
// [6] phi from main to main::@1 [phi:main->main::@1]
// [6] phi (byte) idx#12 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta.z idx
// [8] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
// [6] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
tax
// [8] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
// [8] phi (byte) idx#12 = (byte) idx#10 [phi:main::@2->main::@1#0] -- register_copy
// [8] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
// [6] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
// [6] phi (byte) idx#12 = (byte) idx#10 [phi:main::@2->main::@1#0] -- register_copy
// [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
// main::@1
__b1:
// print(points[i])
// [9] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 -- vbuyy=vbuxx_rol_1
// [7] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 -- vbuyy=vbuxx_rol_1
txa
asl
tay
// [10] (byte) print::p_x#0 ← *((byte*)(const struct Point*) points + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuyy
// [8] (byte) print::p_x#0 ← *((byte*)(const struct Point*) points + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuyy
lda points,y
sta.z print.p_x
// [11] (byte) print::p_y#0 ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuyy
// [9] (byte) print::p_y#0 ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) -- vbuz1=pbuc1_derefidx_vbuyy
lda points+OFFSET_STRUCT_POINT_Y,y
sta.z print.p_y
// [12] call print
// [10] call print
jsr print
// main::@2
// for ( char i: 0..1)
// [13] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [14] if((byte) main::i#1!=(byte) 2) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
// [12] if((byte) main::i#1!=(byte) 2) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #2
bne __b1
// main::@return
// }
// [15] return
// [13] return
rts
}
// print
@ -750,26 +730,28 @@ print: {
.label p_x = 3
.label p_y = 4
// SCREEN[idx++] = p.x
// [16] *((const byte*) SCREEN + (byte) idx#12) ← (byte) print::p_x#0 -- pbuc1_derefidx_vbuz1=vbuz2
// [14] *((const byte*) SCREEN + (byte) idx#12) ← (byte) print::p_x#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z p_x
ldy.z idx
sta SCREEN,y
// SCREEN[idx++] = p.x;
// [17] (byte) idx#3 ← ++ (byte) idx#12 -- vbuyy=_inc_vbuz1
// [15] (byte) idx#3 ← ++ (byte) idx#12 -- vbuyy=_inc_vbuz1
iny
// SCREEN[idx++] = p.y
// [18] *((const byte*) SCREEN + (byte) idx#3) ← (byte) print::p_y#0 -- pbuc1_derefidx_vbuyy=vbuz1
// [16] *((const byte*) SCREEN + (byte) idx#3) ← (byte) print::p_y#0 -- pbuc1_derefidx_vbuyy=vbuz1
lda.z p_y
sta SCREEN,y
// SCREEN[idx++] = p.y;
// [19] (byte) idx#10 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuyy
// [17] (byte) idx#10 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuyy
iny
sty.z idx
// print::@return
// }
// [20] return
// [18] return
rts
}
// File Data
points: .fill 2*2, 0
__0: .byte 1, 2
__1: .byte 3, 4

View File

@ -1,3 +1,5 @@
(const struct Point) $0 = { x: (byte) 1, y: (byte) 2 }
(const struct Point) $1 = { x: (byte) 3, y: (byte) 4 }
(label) @1
(label) @begin
(label) @end

View File

@ -2,9 +2,11 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
main: {
.label SCREEN = $400
.label i1 = 2
ldy #0
__b1:
tya
@ -17,17 +19,22 @@ main: {
iny
cpy #2
bne __b1
ldx #0
lda #0
sta.z i1
__b2:
txa
lda.z i1
asl
ldx #SIZEOF_STRUCT_POINT
tay
!:
lda points,y
sta SCREEN,y
lda points+OFFSET_STRUCT_POINT_Y,y
sta SCREEN+OFFSET_STRUCT_POINT_Y,y
inx
cpx #2
iny
dex
bne !-
inc.z i1
lda #2
cmp.z i1
bne __b2
rts
}

View File

@ -23,11 +23,10 @@ main::@1: scope:[main] from main main::@1
main::@2: scope:[main] from main::@1 main::@2
[11] (byte) main::i1#2 ← phi( main::@1/(byte) 0 main::@2/(byte) main::i1#1 )
[12] (byte~) main::$3 ← (byte) main::i1#2 << (byte) 1
[13] *((byte*)(const struct Point*) main::SCREEN + (byte~) main::$3) ← *((byte*)(const struct Point*) points + (byte~) main::$3)
[14] *((byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3)
[15] (byte) main::i1#1 ← ++ (byte) main::i1#2
[16] if((byte) main::i1#1!=(byte) 2) goto main::@2
[13] *((const struct Point*) main::SCREEN + (byte~) main::$3) ← memcpy(*((const struct Point*) points + (byte~) main::$3), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[14] (byte) main::i1#1 ← ++ (byte) main::i1#2
[15] if((byte) main::i1#1!=(byte) 2) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@2
[17] return
[16] return
to:@return

View File

@ -4,8 +4,7 @@ Fixing pointer array-indexing *((const struct Point*) main::SCREEN + (byte) main
Constantified RValue *((const struct Point*) points + (byte~) main::$2) ← (struct Point){ (byte) 2, (byte) main::i }
Adding struct value member variable copy *((byte*~) main::$4 + (byte~) main::$2) ← (byte) 2
Adding struct value member variable copy *((byte*~) main::$5 + (byte~) main::$2) ← (byte) main::i
Adding struct value member variable copy *((byte*~) main::$6 + (byte~) main::$3) ← *((byte*~) main::$7 + (byte~) main::$3)
Adding struct value member variable copy *((byte*~) main::$8 + (byte~) main::$3) ← *((byte*~) main::$9 + (byte~) main::$3)
Adding struct value member variable copy *((const struct Point*) main::SCREEN + (byte~) main::$3) ← memcpy(*((const struct Point*) points + (byte~) main::$3), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Culled Empty Block (label) main::@4
CONTROL FLOW GRAPH SSA
@ -33,12 +32,7 @@ main::@2: scope:[main] from main::@1
main::@3: scope:[main] from main::@2 main::@3
(byte) main::i1#2 ← phi( main::@2/(byte) main::i1#0 main::@3/(byte) main::i1#1 )
(byte~) main::$3 ← (byte) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
(byte*~) main::$6 ← (byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_X
(byte*~) main::$7 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
*((byte*~) main::$6 + (byte~) main::$3) ← *((byte*~) main::$7 + (byte~) main::$3)
(byte*~) main::$8 ← (byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_Y
(byte*~) main::$9 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
*((byte*~) main::$8 + (byte~) main::$3) ← *((byte*~) main::$9 + (byte~) main::$3)
*((const struct Point*) main::SCREEN + (byte~) main::$3) ← memcpy(*((const struct Point*) points + (byte~) main::$3), struct Point, (const byte) SIZEOF_STRUCT_POINT)
(byte) main::i1#1 ← (byte) main::i1#2 + rangenext(0,1)
(bool~) main::$1 ← (byte) main::i1#1 != rangelast(0,1)
if((bool~) main::$1) goto main::@3
@ -70,10 +64,6 @@ SYMBOL TABLE SSA
(byte~) main::$3
(byte*~) main::$4
(byte*~) main::$5
(byte*~) main::$6
(byte*~) main::$7
(byte*~) main::$8
(byte*~) main::$9
(label) main::@1
(label) main::@2
(label) main::@3
@ -92,30 +82,20 @@ SYMBOL TABLE SSA
Simplifying constant pointer cast (struct Point*) 1024
Successful SSA optimization PassNCastSimplification
Simple Condition (bool~) main::$0 [9] if((byte) main::i#1!=rangelast(0,1)) goto main::@1
Simple Condition (bool~) main::$1 [21] if((byte) main::i1#1!=rangelast(0,1)) goto main::@3
Simple Condition (bool~) main::$1 [16] if((byte) main::i1#1!=rangelast(0,1)) goto main::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [3] (byte*~) main::$4 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [5] (byte*~) main::$5 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [13] (byte*~) main::$6 ← (byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [14] (byte*~) main::$7 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [16] (byte*~) main::$8 ← (byte*)(const struct Point*) main::SCREEN + (const byte) OFFSET_STRUCT_POINT_Y
Constant right-side identified [17] (byte*~) main::$9 ← (byte*)(const struct Point*) points + (const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::i#0 = 0
Constant (const byte*) main::$4 = (byte*)points+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$5 = (byte*)points+OFFSET_STRUCT_POINT_Y
Constant (const byte) main::i1#0 = 0
Constant (const byte*) main::$6 = (byte*)main::SCREEN+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$7 = (byte*)points+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$8 = (byte*)main::SCREEN+OFFSET_STRUCT_POINT_Y
Constant (const byte*) main::$9 = (byte*)points+OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [7] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [9] if(main::i#1!=rangelast(0,1)) goto main::@1 to (number) 2
Resolved ranged next value [19] main::i1#1 ← ++ main::i1#2 to ++
Resolved ranged comparison value [21] if(main::i1#1!=rangelast(0,1)) goto main::@3 to (number) 2
Simplifying expression containing zero (byte*)points in
Simplifying expression containing zero (byte*)main::SCREEN in
Resolved ranged next value [14] main::i1#1 ← ++ main::i1#2 to ++
Resolved ranged comparison value [16] if(main::i1#1!=rangelast(0,1)) goto main::@3 to (number) 2
Simplifying expression containing zero (byte*)points in
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
@ -137,14 +117,8 @@ Inlining constant with var siblings (const byte) main::i1#0
Constant inlined main::$5 = (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::i#0 = (byte) 0
Constant inlined main::i1#0 = (byte) 0
Constant inlined main::$6 = (byte*)(const struct Point*) main::SCREEN
Constant inlined main::$4 = (byte*)(const struct Point*) points
Constant inlined main::$9 = (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y
Constant inlined main::$7 = (byte*)(const struct Point*) points
Constant inlined main::$8 = (byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantInlining
Eliminating unused constant (const byte) SIZEOF_STRUCT_POINT
Successful SSA optimization PassNEliminateUnusedVars
Added new block during phi lifting main::@5(between main::@1 and main::@1)
Added new block during phi lifting main::@6(between main::@3 and main::@3)
Adding NOP phi() at start of @begin
@ -157,8 +131,8 @@ CALL GRAPH
Calls in [] to main:2
Created 2 initial phi equivalence classes
Coalesced [20] main::i1#3 ← main::i1#1
Coalesced [21] main::i#3 ← main::i#1
Coalesced [19] main::i1#3 ← main::i1#1
Coalesced [20] main::i#3 ← main::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@2
@ -196,13 +170,12 @@ main::@1: scope:[main] from main main::@1
main::@2: scope:[main] from main::@1 main::@2
[11] (byte) main::i1#2 ← phi( main::@1/(byte) 0 main::@2/(byte) main::i1#1 )
[12] (byte~) main::$3 ← (byte) main::i1#2 << (byte) 1
[13] *((byte*)(const struct Point*) main::SCREEN + (byte~) main::$3) ← *((byte*)(const struct Point*) points + (byte~) main::$3)
[14] *((byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3)
[15] (byte) main::i1#1 ← ++ (byte) main::i1#2
[16] if((byte) main::i1#1!=(byte) 2) goto main::@2
[13] *((const struct Point*) main::SCREEN + (byte~) main::$3) ← memcpy(*((const struct Point*) points + (byte~) main::$3), struct Point, (const byte) SIZEOF_STRUCT_POINT)
[14] (byte) main::i1#1 ← ++ (byte) main::i1#2
[15] if((byte) main::i1#1!=(byte) 2) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@2
[17] return
[16] return
to:@return
@ -211,13 +184,13 @@ VARIABLE REGISTER WEIGHTS
(byte) Point::y
(void()) main()
(byte~) main::$2 16.5
(byte~) main::$3 27.5
(byte~) main::$3 22.0
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 11.0
(byte) main::i1
(byte) main::i1#1 16.5
(byte) main::i1#2 8.25
(byte) main::i1#2 11.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
@ -243,6 +216,7 @@ Target platform is c64basic / MOS6502X
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
__bbegin:
@ -313,24 +287,25 @@ main: {
lda.z i1
asl
sta.z __3
// [13] *((byte*)(const struct Point*) main::SCREEN + (byte~) main::$3) ← *((byte*)(const struct Point*) points + (byte~) main::$3) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
// [13] *((const struct Point*) main::SCREEN + (byte~) main::$3) ← memcpy(*((const struct Point*) points + (byte~) main::$3), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- pssc1_derefidx_vbuz1=pssc2_derefidx_vbuz1_memcpy_vbuc3
ldx #SIZEOF_STRUCT_POINT
ldy.z __3
!:
lda points,y
sta SCREEN,y
// [14] *((byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy.z __3
lda points+OFFSET_STRUCT_POINT_Y,y
sta SCREEN+OFFSET_STRUCT_POINT_Y,y
// [15] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1
iny
dex
bne !-
// [14] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1
inc.z i1
// [16] if((byte) main::i1#1!=(byte) 2) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
// [15] if((byte) main::i1#1!=(byte) 2) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda #2
cmp.z i1
bne __b2_from___b2
jmp __breturn
// main::@return
__breturn:
// [17] return
// [16] return
rts
}
// File Data
@ -344,28 +319,32 @@ Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::$
Statement [8] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$2) ← (byte) main::i#2 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Statement [12] (byte~) main::$3 ← (byte) main::i1#2 << (byte) 1 [ main::i1#2 main::$3 ] ( main:2 [ main::i1#2 main::$3 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::i1#2 main::i1#1 ]
Statement [13] *((byte*)(const struct Point*) main::SCREEN + (byte~) main::$3) ← *((byte*)(const struct Point*) points + (byte~) main::$3) [ main::i1#2 main::$3 ] ( main:2 [ main::i1#2 main::$3 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:5 [ main::$3 ]
Statement [14] *((byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a
Statement [13] *((const struct Point*) main::SCREEN + (byte~) main::$3) ← memcpy(*((const struct Point*) points + (byte~) main::$3), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte x reg byte y
Removing always clobbered register reg byte x as potential for zp[1]:3 [ main::i1#2 main::i1#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:3 [ main::i1#2 main::i1#1 ]
Statement [15] if((byte) main::i1#1!=(byte) 2) goto main::@2 [ main::i1#1 ] ( main:2 [ main::i1#1 ] ) always clobbers reg byte a
Statement [6] (byte~) main::$2 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$2 ] ( main:2 [ main::i#2 main::$2 ] ) always clobbers reg byte a
Statement [7] *((byte*)(const struct Point*) points + (byte~) main::$2) ← (byte) 2 [ main::i#2 main::$2 ] ( main:2 [ main::i#2 main::$2 ] ) always clobbers reg byte a
Statement [8] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$2) ← (byte) main::i#2 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Statement [12] (byte~) main::$3 ← (byte) main::i1#2 << (byte) 1 [ main::i1#2 main::$3 ] ( main:2 [ main::i1#2 main::$3 ] ) always clobbers reg byte a
Statement [13] *((byte*)(const struct Point*) main::SCREEN + (byte~) main::$3) ← *((byte*)(const struct Point*) points + (byte~) main::$3) [ main::i1#2 main::$3 ] ( main:2 [ main::i1#2 main::$3 ] ) always clobbers reg byte a
Statement [14] *((byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a
Statement [13] *((const struct Point*) main::SCREEN + (byte~) main::$3) ← memcpy(*((const struct Point*) points + (byte~) main::$3), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte x reg byte y
Statement [15] if((byte) main::i1#1!=(byte) 2) goto main::@2 [ main::i1#1 ] ( main:2 [ main::i1#1 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y ,
Potential registers zp[1]:3 [ main::i1#2 main::i1#1 ] : zp[1]:3 , reg byte x , reg byte y ,
Potential registers zp[1]:3 [ main::i1#2 main::i1#1 ] : zp[1]:3 ,
Potential registers zp[1]:4 [ main::$2 ] : zp[1]:4 , reg byte x , reg byte y ,
Potential registers zp[1]:5 [ main::$3 ] : zp[1]:5 , reg byte x , reg byte y ,
Potential registers zp[1]:5 [ main::$3 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 27.5: zp[1]:2 [ main::i#2 main::i#1 ] 27.5: zp[1]:5 [ main::$3 ] 24.75: zp[1]:3 [ main::i1#2 main::i1#1 ] 16.5: zp[1]:4 [ main::$2 ]
Uplift Scope [main] 27.5: zp[1]:2 [ main::i#2 main::i#1 ] 27.5: zp[1]:3 [ main::i1#2 main::i1#1 ] 22: zp[1]:5 [ main::$3 ] 16.5: zp[1]:4 [ main::$2 ]
Uplift Scope [Point]
Uplift Scope []
Uplifting [main] best 788 combination reg byte y [ main::i#2 main::i#1 ] reg byte y [ main::$3 ] reg byte x [ main::i1#2 main::i1#1 ] reg byte x [ main::$2 ]
Uplifting [Point] best 788 combination
Uplifting [] best 788 combination
Uplifting [main] best 878 combination reg byte y [ main::i#2 main::i#1 ] zp[1]:3 [ main::i1#2 main::i1#1 ] reg byte a [ main::$3 ] reg byte x [ main::$2 ]
Uplifting [Point] best 878 combination
Uplifting [] best 878 combination
Attempting to uplift remaining variables inzp[1]:3 [ main::i1#2 main::i1#1 ]
Uplifting [main] best 878 combination zp[1]:3 [ main::i1#2 main::i1#1 ]
Allocated (was zp[1]:3) zp[1]:2 [ main::i1#2 main::i1#1 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -375,6 +354,7 @@ ASSEMBLER BEFORE OPTIMIZATION
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
__bbegin:
@ -395,6 +375,7 @@ __bend:
// main
main: {
.label SCREEN = $400
.label i1 = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
@ -423,8 +404,9 @@ main: {
bne __b1_from___b1
// [11] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
__b2_from___b1:
// [11] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1
ldx #0
// [11] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
lda #0
sta.z i1
jmp __b2
// [11] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
__b2_from___b2:
@ -432,25 +414,28 @@ main: {
jmp __b2
// main::@2
__b2:
// [12] (byte~) main::$3 ← (byte) main::i1#2 << (byte) 1 -- vbuyy=vbuxx_rol_1
txa
// [12] (byte~) main::$3 ← (byte) main::i1#2 << (byte) 1 -- vbuaa=vbuz1_rol_1
lda.z i1
asl
// [13] *((const struct Point*) main::SCREEN + (byte~) main::$3) ← memcpy(*((const struct Point*) points + (byte~) main::$3), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- pssc1_derefidx_vbuaa=pssc2_derefidx_vbuaa_memcpy_vbuc3
ldx #SIZEOF_STRUCT_POINT
tay
// [13] *((byte*)(const struct Point*) main::SCREEN + (byte~) main::$3) ← *((byte*)(const struct Point*) points + (byte~) main::$3) -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuyy
!:
lda points,y
sta SCREEN,y
// [14] *((byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuyy
lda points+OFFSET_STRUCT_POINT_Y,y
sta SCREEN+OFFSET_STRUCT_POINT_Y,y
// [15] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuxx=_inc_vbuxx
inx
// [16] if((byte) main::i1#1!=(byte) 2) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #2
iny
dex
bne !-
// [14] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1
inc.z i1
// [15] if((byte) main::i1#1!=(byte) 2) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda #2
cmp.z i1
bne __b2_from___b2
jmp __breturn
// main::@return
__breturn:
// [17] return
// [16] return
rts
}
// File Data
@ -494,9 +479,10 @@ FINAL SYMBOL TABLE
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(byte~) main::$2 reg byte x 16.5
(byte~) main::$3 reg byte y 27.5
(byte~) main::$3 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@return
@ -505,18 +491,18 @@ FINAL SYMBOL TABLE
(byte) main::i#1 reg byte y 16.5
(byte) main::i#2 reg byte y 11.0
(byte) main::i1
(byte) main::i1#1 reg byte x 16.5
(byte) main::i1#2 reg byte x 8.25
(byte) main::i1#1 i1 zp[1]:2 16.5
(byte) main::i1#2 i1 zp[1]:2 11.0
(const struct Point*) points[(number) 2] = { fill( 2, 0) }
reg byte y [ main::i#2 main::i#1 ]
reg byte x [ main::i1#2 main::i1#1 ]
zp[1]:2 [ main::i1#2 main::i1#1 ]
reg byte x [ main::$2 ]
reg byte y [ main::$3 ]
reg byte a [ main::$3 ]
FINAL ASSEMBLER
Score: 626
Score: 716
// File Comments
// Minimal struct - array access with struct value copying (and initializing)
@ -525,6 +511,7 @@ Score: 626
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
// [1] phi from @begin to @1 [phi:@begin->@1]
@ -536,6 +523,7 @@ Score: 626
// main
main: {
.label SCREEN = $400
.label i1 = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
ldy #0
@ -561,32 +549,36 @@ main: {
cpy #2
bne __b1
// [11] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// [11] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1
ldx #0
// [11] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
lda #0
sta.z i1
// [11] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
// [11] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy
// main::@2
__b2:
// SCREEN[i] = points[i]
// [12] (byte~) main::$3 ← (byte) main::i1#2 << (byte) 1 -- vbuyy=vbuxx_rol_1
txa
// [12] (byte~) main::$3 ← (byte) main::i1#2 << (byte) 1 -- vbuaa=vbuz1_rol_1
lda.z i1
asl
// [13] *((const struct Point*) main::SCREEN + (byte~) main::$3) ← memcpy(*((const struct Point*) points + (byte~) main::$3), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- pssc1_derefidx_vbuaa=pssc2_derefidx_vbuaa_memcpy_vbuc3
ldx #SIZEOF_STRUCT_POINT
tay
// [13] *((byte*)(const struct Point*) main::SCREEN + (byte~) main::$3) ← *((byte*)(const struct Point*) points + (byte~) main::$3) -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuyy
!:
lda points,y
sta SCREEN,y
// [14] *((byte*)(const struct Point*) main::SCREEN+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$3) -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuyy
lda points+OFFSET_STRUCT_POINT_Y,y
sta SCREEN+OFFSET_STRUCT_POINT_Y,y
iny
dex
bne !-
// for( byte i: 0..1)
// [15] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuxx=_inc_vbuxx
inx
// [16] if((byte) main::i1#1!=(byte) 2) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #2
// [14] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1
inc.z i1
// [15] if((byte) main::i1#1!=(byte) 2) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda #2
cmp.z i1
bne __b2
// main::@return
// }
// [17] return
// [16] return
rts
}
// File Data

View File

@ -4,9 +4,10 @@
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(byte~) main::$2 reg byte x 16.5
(byte~) main::$3 reg byte y 27.5
(byte~) main::$3 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@return
@ -15,11 +16,11 @@
(byte) main::i#1 reg byte y 16.5
(byte) main::i#2 reg byte y 11.0
(byte) main::i1
(byte) main::i1#1 reg byte x 16.5
(byte) main::i1#2 reg byte x 8.25
(byte) main::i1#1 i1 zp[1]:2 16.5
(byte) main::i1#2 i1 zp[1]:2 11.0
(const struct Point*) points[(number) 2] = { fill( 2, 0) }
reg byte y [ main::i#2 main::i#1 ]
reg byte x [ main::i1#2 main::i1#1 ]
zp[1]:2 [ main::i1#2 main::i1#1 ]
reg byte x [ main::$2 ]
reg byte y [ main::$3 ]
reg byte a [ main::$3 ]