diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index 3d3059145..0e55000cb 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -166,7 +166,6 @@ public class Compiler { new PassNTypeInference(program).execute(); new PassNTypeIdSimplification(program).execute(); new Pass1StructTypeSizeFix(program).execute(); - new Pass1AssertProcedureCallParameters(program).execute(); new Pass1AssertReturn(program).execute(); new Pass1AssertUsedVars(program).execute(); @@ -176,21 +175,19 @@ public class Compiler { } new Pass1AddressOfVolatile(program).execute(); - new Pass1FixLValuesLoHi(program).execute(); new Pass1AssertNoLValueIntermediate(program).execute(); + new PassNAddTypeConversionAssignment(program).execute(); + new Pass1AssertProcedureCallParameters(program).execute(); + new Pass1PointerSizeofFix(program).execute(); // After this point in the code all pointer math is byte-based new PassNSizeOfSimplification(program).execute(); // Needed to eliminate sizeof() referencing pointer value variables - //new PassNAddTypeConversionAssignment(program).execute(); - //new Pass1AssertProcedureCallParameters(program).execute(); - new Pass1UnwindStructValues(program).execute(); new PassNStructPointerRewriting(program).execute(); new PassNAddBooleanCasts(program).execute(); new PassNAddTypeConversionAssignment(program).execute(); - //new Pass1AssertProcedureCallParameters(program).execute(); new Pass1EarlyConstantIdentification(program).execute(); new Pass1ProcedureInline(program).execute(); diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionBinary.java b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionBinary.java index f21ea8348..74209c39e 100644 --- a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionBinary.java +++ b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionBinary.java @@ -123,6 +123,53 @@ public interface ProgramExpressionBinary extends ProgramExpression { } } + /** Binary expression - call parameter . */ + class ProgramExpressionBinaryCallParameter implements ProgramExpressionBinary { + private final VariableRef parameterDef; + private final ProgramValue parameterValue; + + public ProgramExpressionBinaryCallParameter(VariableRef parameterDef, ProgramValue parameterValue) { + this.parameterDef = parameterDef; + this.parameterValue = parameterValue; + } + + @Override + public RValue getLeft() { + return parameterDef; + } + + @Override + public OperatorBinary getOperator() { + return Operators.ASSIGNMENT; + } + + @Override + public RValue getRight() { + return (RValue) parameterValue.get(); + } + + @Override + public void set(Value value) { + throw new InternalError("Updating an entire call parameter is not allowed!"); + } + + @Override + public void addLeftCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols) { + throw new InternalError("Casting parameter variable not allowed. " + parameterDef.toString()); + } + + @Override + public void addRightCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols) { + Value value = parameterValue.get(); + if(value instanceof ConstantValue) { + parameterValue.set(new ConstantCastValue(toType, (ConstantValue) value)); + } else { + parameterValue.set(new CastValue(toType, (RValue) value)); + } + } + + } + /** Binary expression - assignment lvalue and the "total" rvalue. */ class ProgramExpressionBinaryAssignmentLValue implements ProgramExpressionBinary { private final StatementAssignment assignment; diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionIterator.java b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionIterator.java index 799ee7a0a..23f915a5d 100644 --- a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionIterator.java +++ b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionIterator.java @@ -2,12 +2,15 @@ package dk.camelot64.kickc.model.iterator; import dk.camelot64.kickc.model.ControlFlowBlock; import dk.camelot64.kickc.model.Program; -import dk.camelot64.kickc.model.statements.Statement; -import dk.camelot64.kickc.model.statements.StatementAssignment; -import dk.camelot64.kickc.model.statements.StatementConditionalJump; -import dk.camelot64.kickc.model.statements.StatementPhiBlock; +import dk.camelot64.kickc.model.operators.OperatorBinary; +import dk.camelot64.kickc.model.statements.*; +import dk.camelot64.kickc.model.symbols.Procedure; +import dk.camelot64.kickc.model.symbols.ProgramScope; +import dk.camelot64.kickc.model.symbols.Variable; +import dk.camelot64.kickc.model.types.SymbolType; import dk.camelot64.kickc.model.values.*; +import java.util.List; import java.util.ListIterator; /** @@ -64,6 +67,16 @@ public class ProgramExpressionIterator { handler.execute(new ProgramExpressionBinary.ProgramExpressionBinaryPhiValueAssignemnt(phiVariable, value), stmt, stmtIt, block); } } + } else if(stmt instanceof StatementCall) { + StatementCall call = (StatementCall) stmt; + List paramValues = call.getParameters(); + Procedure procedure = program.getScope().getProcedure(call.getProcedure()); + List paramDefs = procedure.getParameters(); + if(paramValues!=null && paramDefs.size()==paramValues.size()) { + for(int i=0;i$12345678 + sta d+1 + lda #<$12345678>>$10 + sta d+2 + lda #>$12345678>>$10 + sta d+3 + lda #<$1234 + sta w + lda #>$1234 + sta w+1 + lda #$12 + sta b + ldx #0 + lda #b + sta print.ptr+1 + jsr print + lda #w + sta print.ptr+1 + jsr print + lda #d + sta print.ptr+1 + jsr print + rts +} +// print(void* zeropage(2) ptr) +print: { + .label ptr = 2 + ldy #0 + lda (ptr),y + sta SCREEN,x + inx + rts +} diff --git a/src/test/ref/pointer-void-2.cfg b/src/test/ref/pointer-void-2.cfg new file mode 100644 index 000000000..b524705aa --- /dev/null +++ b/src/test/ref/pointer-void-2.cfg @@ -0,0 +1,35 @@ +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] (dword) main::d#0 ← (dword) $12345678 + [5] (word) main::w#0 ← (word) $1234 + [6] (byte) main::b#0 ← (byte) $12 + [7] call print + to:main::@1 +main::@1: scope:[main] from main + [8] phi() + [9] call print + to:main::@2 +main::@2: scope:[main] from main::@1 + [10] phi() + [11] call print + to:main::@return +main::@return: scope:[main] from main::@2 + [12] return + to:@return +print: scope:[print] from main main::@1 main::@2 + [13] (byte) idx#12 ← phi( main/(byte) 0 main::@1/(byte) idx#13 main::@2/(byte) idx#13 ) + [13] (void*) print::ptr#3 ← phi( main/(void*)&(byte) main::b#0 main::@1/(void*)&(word) main::w#0 main::@2/(void*)&(dword) main::d#0 ) + [14] *((const byte*) SCREEN#0 + (byte) idx#12) ← *((byte*)(void*) print::ptr#3) + [15] (byte) idx#13 ← ++ (byte) idx#12 + to:print::@return +print::@return: scope:[print] from print + [16] return + to:@return diff --git a/src/test/ref/pointer-void-2.log b/src/test/ref/pointer-void-2.log new file mode 100644 index 000000000..4ae5d6a7d --- /dev/null +++ b/src/test/ref/pointer-void-2.log @@ -0,0 +1,689 @@ +Setting inferred volatile on symbol affected by address-of (byte*~) main::$0 ← & (byte) main::b +Setting inferred volatile on symbol affected by address-of (word*~) main::$2 ← & (word) main::w +Setting inferred volatile on symbol affected by address-of (dword*~) main::$4 ← & (dword) main::d +Adding void pointer type conversion cast (void*) main::$0 in (void~) main::$1 ← call print (byte*~) main::$0 +Adding void pointer type conversion cast (void*) main::$2 in (void~) main::$3 ← call print (word*~) main::$2 +Adding void pointer type conversion cast (void*) main::$4 in (void~) main::$5 ← call print (dword*~) main::$4 +Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (number) $400 + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + to:@1 +main: scope:[main] from @2 + (byte) idx#15 ← phi( @2/(byte) idx#16 ) + (dword) main::d#0 ← (number) $12345678 + (word) main::w#0 ← (number) $1234 + (byte) main::b#0 ← (number) $12 + (byte*~) main::$0 ← & (byte) main::b#0 + (void*) print::ptr#0 ← (void*)(byte*~) main::$0 + call print + to:main::@1 +main::@1: scope:[main] from main + (dword) main::d#2 ← phi( main/(dword) main::d#0 ) + (word) main::w#1 ← phi( main/(word) main::w#0 ) + (byte) idx#8 ← phi( main/(byte) idx#6 ) + (byte) idx#0 ← (byte) idx#8 + (word*~) main::$2 ← & (word) main::w#1 + (void*) print::ptr#1 ← (void*)(word*~) main::$2 + call print + to:main::@2 +main::@2: scope:[main] from main::@1 + (dword) main::d#1 ← phi( main::@1/(dword) main::d#2 ) + (byte) idx#9 ← phi( main::@1/(byte) idx#6 ) + (byte) idx#1 ← (byte) idx#9 + (dword*~) main::$4 ← & (dword) main::d#1 + (void*) print::ptr#2 ← (void*)(dword*~) main::$4 + call print + to:main::@3 +main::@3: scope:[main] from main::@2 + (byte) idx#10 ← phi( main::@2/(byte) idx#6 ) + (byte) idx#2 ← (byte) idx#10 + to:main::@return +main::@return: scope:[main] from main::@3 + (byte) idx#11 ← phi( main::@3/(byte) idx#2 ) + (byte) idx#3 ← (byte) idx#11 + return + to:@return +@1: scope:[] from @begin + (byte*) SCREEN#0 ← ((byte*)) (number) $400 + (byte) idx#4 ← (number) 0 + to:@2 +print: scope:[print] from main main::@1 main::@2 + (byte) idx#12 ← phi( main/(byte) idx#15 main::@1/(byte) idx#0 main::@2/(byte) idx#1 ) + (void*) print::ptr#3 ← phi( main/(void*) print::ptr#0 main::@1/(void*) print::ptr#1 main::@2/(void*) print::ptr#2 ) + (byte*~) print::$0 ← ((byte*)) (void*) print::ptr#3 + *((byte*) SCREEN#0 + (byte) idx#12) ← *((byte*~) print::$0) + (byte) idx#5 ← ++ (byte) idx#12 + to:print::@return +print::@return: scope:[print] from print + (byte) idx#13 ← phi( print/(byte) idx#5 ) + (byte) idx#6 ← (byte) idx#13 + return + to:@return +@2: scope:[] from @1 + (byte) idx#16 ← phi( @1/(byte) idx#4 ) + call main + to:@3 +@3: scope:[] from @2 + (byte) idx#14 ← phi( @2/(byte) idx#3 ) + (byte) idx#7 ← (byte) idx#14 + to:@end +@end: scope:[] from @3 + +SYMBOL TABLE SSA +(label) @1 +(label) @2 +(label) @3 +(label) @begin +(label) @end +(byte*) SCREEN +(byte*) SCREEN#0 +(byte) idx +(byte) idx#0 +(byte) idx#1 +(byte) idx#10 +(byte) idx#11 +(byte) idx#12 +(byte) idx#13 +(byte) idx#14 +(byte) idx#15 +(byte) idx#16 +(byte) idx#2 +(byte) idx#3 +(byte) idx#4 +(byte) idx#5 +(byte) idx#6 +(byte) idx#7 +(byte) idx#8 +(byte) idx#9 +(void()) main() +(byte*~) main::$0 +(word*~) main::$2 +(dword*~) main::$4 +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@return +(byte) main::b +(byte) main::b#0 +(dword) main::d +(dword) main::d#0 +(dword) main::d#1 +(dword) main::d#2 +(word) main::w +(word) main::w#0 +(word) main::w#1 +(void()) print((void*) print::ptr) +(byte*~) print::$0 +(label) print::@return +(void*) print::ptr +(void*) print::ptr#0 +(void*) print::ptr#1 +(void*) print::ptr#2 +(void*) print::ptr#3 + +Adding number conversion cast (unumber) $12345678 in (dword) main::d#0 ← (number) $12345678 +Adding number conversion cast (unumber) $1234 in (word) main::w#0 ← (number) $1234 +Adding number conversion cast (unumber) $12 in (byte) main::b#0 ← (number) $12 +Adding number conversion cast (unumber) 0 in (byte) idx#4 ← (number) 0 +Successful SSA optimization PassNAddNumberTypeConversions +Inlining cast (dword) main::d#0 ← (unumber)(number) $12345678 +Inlining cast (word) main::w#0 ← (unumber)(number) $1234 +Inlining cast (byte) main::b#0 ← (unumber)(number) $12 +Inlining cast (byte*) SCREEN#0 ← (byte*)(number) $400 +Inlining cast (byte) idx#4 ← (unumber)(number) 0 +Inlining cast (byte*~) print::$0 ← (byte*)(void*) print::ptr#3 +Successful SSA optimization Pass2InlineCast +Simplifying constant integer cast $12345678 +Simplifying constant integer cast $1234 +Simplifying constant integer cast $12 +Simplifying constant pointer cast (byte*) 1024 +Simplifying constant integer cast 0 +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type (dword) $12345678 +Finalized unsigned number type (word) $1234 +Finalized unsigned number type (byte) $12 +Finalized unsigned number type (byte) 0 +Successful SSA optimization PassNFinalizeNumberTypeConversions +Alias (word) main::w#0 = (word) main::w#1 +Alias (dword) main::d#0 = (dword) main::d#2 (dword) main::d#1 +Alias (byte) idx#0 = (byte) idx#8 +Alias (byte) idx#1 = (byte) idx#9 +Alias (byte) idx#10 = (byte) idx#2 (byte) idx#11 (byte) idx#3 +Alias (byte) idx#13 = (byte) idx#5 (byte) idx#6 +Alias (byte) idx#16 = (byte) idx#4 +Alias (byte) idx#14 = (byte) idx#7 +Successful SSA optimization Pass2AliasElimination +Identical Phi Values (byte) idx#15 (byte) idx#16 +Identical Phi Values (byte) idx#0 (byte) idx#13 +Identical Phi Values (byte) idx#1 (byte) idx#13 +Identical Phi Values (byte) idx#10 (byte) idx#13 +Identical Phi Values (byte) idx#14 (byte) idx#10 +Successful SSA optimization Pass2IdenticalPhiElimination +Constant right-side identified [4] (byte*~) main::$0 ← & (byte) main::b#0 +Constant right-side identified [9] (word*~) main::$2 ← & (word) main::w#0 +Constant right-side identified [14] (dword*~) main::$4 ← & (dword) main::d#0 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte*) main::$0 = &main::b#0 +Constant (const word*) main::$2 = &main::w#0 +Constant (const dword*) main::$4 = &main::d#0 +Constant (const byte*) SCREEN#0 = (byte*) 1024 +Constant (const byte) idx#16 = 0 +Successful SSA optimization Pass2ConstantIdentification +Constant value identified (void*)main::$0 in [5] (void*) print::ptr#0 ← (void*)(const byte*) main::$0 +Constant value identified (void*)main::$2 in [10] (void*) print::ptr#1 ← (void*)(const word*) main::$2 +Constant value identified (void*)main::$4 in [15] (void*) print::ptr#2 ← (void*)(const dword*) main::$4 +Successful SSA optimization Pass2ConstantValues +Constant (const void*) print::ptr#0 = (void*)main::$0 +Constant (const void*) print::ptr#1 = (void*)main::$2 +Constant (const void*) print::ptr#2 = (void*)main::$4 +Successful SSA optimization Pass2ConstantIdentification +Inlining Noop Cast [8] (byte*~) print::$0 ← (byte*)(void*) print::ptr#3 keeping print::ptr#3 +Successful SSA optimization Pass2NopCastInlining +Inlining constant with var siblings (const void*) print::ptr#0 +Inlining constant with var siblings (const void*) print::ptr#1 +Inlining constant with var siblings (const void*) print::ptr#2 +Inlining constant with var siblings (const byte) idx#16 +Constant inlined print::ptr#2 = (void*)&(dword) main::d#0 +Constant inlined main::$2 = &(word) main::w#0 +Constant inlined main::$0 = &(byte) main::b#0 +Constant inlined main::$4 = &(dword) main::d#0 +Constant inlined print::ptr#0 = (void*)&(byte) main::b#0 +Constant inlined print::ptr#1 = (void*)&(word) main::w#0 +Constant inlined idx#16 = (byte) 0 +Successful SSA optimization Pass2ConstantInlining +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 @3 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main::@3 +CALL GRAPH +Calls in [] to main:3 +Calls in [main] to print:9 print:11 print:13 + +Created 2 initial phi equivalence classes +Coalesced [10] idx#17 ← idx#13 +Coalesced (already) [12] idx#18 ← idx#13 +Coalesced down to 2 phi equivalence classes +Culled Empty Block (label) @1 +Culled Empty Block (label) @3 +Culled Empty Block (label) main::@3 +Renumbering block @2 to @1 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main::@2 + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] (dword) main::d#0 ← (dword) $12345678 + [5] (word) main::w#0 ← (word) $1234 + [6] (byte) main::b#0 ← (byte) $12 + [7] call print + to:main::@1 +main::@1: scope:[main] from main + [8] phi() + [9] call print + to:main::@2 +main::@2: scope:[main] from main::@1 + [10] phi() + [11] call print + to:main::@return +main::@return: scope:[main] from main::@2 + [12] return + to:@return +print: scope:[print] from main main::@1 main::@2 + [13] (byte) idx#12 ← phi( main/(byte) 0 main::@1/(byte) idx#13 main::@2/(byte) idx#13 ) + [13] (void*) print::ptr#3 ← phi( main/(void*)&(byte) main::b#0 main::@1/(void*)&(word) main::w#0 main::@2/(void*)&(dword) main::d#0 ) + [14] *((const byte*) SCREEN#0 + (byte) idx#12) ← *((byte*)(void*) print::ptr#3) + [15] (byte) idx#13 ← ++ (byte) idx#12 + to:print::@return +print::@return: scope:[print] from print + [16] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(byte*) SCREEN +(byte) idx +(byte) idx#12 4.0 +(byte) idx#13 1.0 +(void()) main() +(byte) main::b +(byte) main::b#0 20.0 +(dword) main::d +(dword) main::d#0 20.0 +(word) main::w +(word) main::w#0 20.0 +(void()) print((void*) print::ptr) +(void*) print::ptr +(void*) print::ptr#3 + +Initial phi equivalence classes +[ print::ptr#3 ] +[ idx#12 idx#13 ] +Complete equivalence classes +[ print::ptr#3 ] +[ idx#12 idx#13 ] +[ main::d#0 ] +[ main::w#0 ] +[ main::b#0 ] +Allocated zp ZP_WORD:2 [ print::ptr#3 ] +Allocated zp ZP_BYTE:4 [ idx#12 idx#13 ] +Allocated zp ZP_DWORD:5 [ main::d#0 ] +Allocated zp ZP_WORD:9 [ main::w#0 ] +Allocated zp ZP_BYTE:11 [ main::b#0 ] + +INITIAL ASM +//SEG0 File Comments +// Test simple void pointer - void pointer function +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .label SCREEN = $400 + .label idx = 4 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main + jsr main +//SEG7 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG8 @end +bend: +//SEG9 main +main: { + .label d = 5 + .label w = 9 + .label b = $b + //SEG10 [4] (dword) main::d#0 ← (dword) $12345678 -- vduz1=vduc1 + lda #<$12345678 + sta d + lda #>$12345678 + sta d+1 + lda #<$12345678>>$10 + sta d+2 + lda #>$12345678>>$10 + sta d+3 + //SEG11 [5] (word) main::w#0 ← (word) $1234 -- vwuz1=vwuc1 + lda #<$1234 + sta w + lda #>$1234 + sta w+1 + //SEG12 [6] (byte) main::b#0 ← (byte) $12 -- vbuz1=vbuc1 + lda #$12 + sta b + //SEG13 [7] call print + //SEG14 [13] phi from main to print [phi:main->print] + print_from_main: + //SEG15 [13] phi (byte) idx#12 = (byte) 0 [phi:main->print#0] -- vbuz1=vbuc1 + lda #0 + sta idx + //SEG16 [13] phi (void*) print::ptr#3 = (void*)&(byte) main::b#0 [phi:main->print#1] -- pvoz1=pvoc1 + lda #b + sta print.ptr+1 + jsr print + //SEG17 [8] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + jmp b1 + //SEG18 main::@1 + b1: + //SEG19 [9] call print + //SEG20 [13] phi from main::@1 to print [phi:main::@1->print] + print_from_b1: + //SEG21 [13] phi (byte) idx#12 = (byte) idx#13 [phi:main::@1->print#0] -- register_copy + //SEG22 [13] phi (void*) print::ptr#3 = (void*)&(word) main::w#0 [phi:main::@1->print#1] -- pvoz1=pvoc1 + lda #w + sta print.ptr+1 + jsr print + //SEG23 [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + b2_from_b1: + jmp b2 + //SEG24 main::@2 + b2: + //SEG25 [11] call print + //SEG26 [13] phi from main::@2 to print [phi:main::@2->print] + print_from_b2: + //SEG27 [13] phi (byte) idx#12 = (byte) idx#13 [phi:main::@2->print#0] -- register_copy + //SEG28 [13] phi (void*) print::ptr#3 = (void*)&(dword) main::d#0 [phi:main::@2->print#1] -- pvoz1=pvoc1 + lda #d + sta print.ptr+1 + jsr print + jmp breturn + //SEG29 main::@return + breturn: + //SEG30 [12] return + rts +} +//SEG31 print +// print(void* zeropage(2) ptr) +print: { + .label ptr = 2 + //SEG32 [14] *((const byte*) SCREEN#0 + (byte) idx#12) ← *((byte*)(void*) print::ptr#3) -- pbuc1_derefidx_vbuz1=_deref_pbuz2 + ldx idx + ldy #0 + lda (ptr),y + sta SCREEN,x + //SEG33 [15] (byte) idx#13 ← ++ (byte) idx#12 -- vbuz1=_inc_vbuz1 + inc idx + jmp breturn + //SEG34 print::@return + breturn: + //SEG35 [16] return + rts +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [4] (dword) main::d#0 ← (dword) $12345678 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [5] (word) main::w#0 ← (word) $1234 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [6] (byte) main::b#0 ← (byte) $12 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [14] *((const byte*) SCREEN#0 + (byte) idx#12) ← *((byte*)(void*) print::ptr#3) [ idx#12 ] ( main:2::print:7 [ idx#12 ] main:2::print:9 [ idx#12 ] main:2::print:11 [ idx#12 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ idx#12 idx#13 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:4 [ idx#12 idx#13 ] +Statement [4] (dword) main::d#0 ← (dword) $12345678 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [5] (word) main::w#0 ← (word) $1234 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [6] (byte) main::b#0 ← (byte) $12 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [14] *((const byte*) SCREEN#0 + (byte) idx#12) ← *((byte*)(void*) print::ptr#3) [ idx#12 ] ( main:2::print:7 [ idx#12 ] main:2::print:9 [ idx#12 ] main:2::print:11 [ idx#12 ] ) always clobbers reg byte a reg byte y +Potential registers zp ZP_WORD:2 [ print::ptr#3 ] : zp ZP_WORD:2 , +Potential registers zp ZP_BYTE:4 [ idx#12 idx#13 ] : zp ZP_BYTE:4 , reg byte x , +Potential registers zp ZP_DWORD:5 [ main::d#0 ] : zp ZP_DWORD:5 , +Potential registers zp ZP_WORD:9 [ main::w#0 ] : zp ZP_WORD:9 , +Potential registers zp ZP_BYTE:11 [ main::b#0 ] : zp ZP_BYTE:11 , + +REGISTER UPLIFT SCOPES +Uplift Scope [main] 20: zp ZP_DWORD:5 [ main::d#0 ] 20: zp ZP_WORD:9 [ main::w#0 ] 20: zp ZP_BYTE:11 [ main::b#0 ] +Uplift Scope [] 5: zp ZP_BYTE:4 [ idx#12 idx#13 ] +Uplift Scope [print] 0: zp ZP_WORD:2 [ print::ptr#3 ] + +Uplifting [main] best 144 combination zp ZP_DWORD:5 [ main::d#0 ] zp ZP_WORD:9 [ main::w#0 ] zp ZP_BYTE:11 [ main::b#0 ] +Uplifting [] best 135 combination reg byte x [ idx#12 idx#13 ] +Uplifting [print] best 135 combination zp ZP_WORD:2 [ print::ptr#3 ] +Attempting to uplift remaining variables inzp ZP_BYTE:11 [ main::b#0 ] +Uplifting [main] best 135 combination zp ZP_BYTE:11 [ main::b#0 ] +Allocated (was zp ZP_DWORD:5) zp ZP_DWORD:4 [ main::d#0 ] +Allocated (was zp ZP_WORD:9) zp ZP_WORD:8 [ main::w#0 ] +Allocated (was zp ZP_BYTE:11) zp ZP_BYTE:10 [ main::b#0 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 File Comments +// Test simple void pointer - void pointer function +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .label SCREEN = $400 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main + jsr main +//SEG7 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG8 @end +bend: +//SEG9 main +main: { + .label d = 4 + .label w = 8 + .label b = $a + //SEG10 [4] (dword) main::d#0 ← (dword) $12345678 -- vduz1=vduc1 + lda #<$12345678 + sta d + lda #>$12345678 + sta d+1 + lda #<$12345678>>$10 + sta d+2 + lda #>$12345678>>$10 + sta d+3 + //SEG11 [5] (word) main::w#0 ← (word) $1234 -- vwuz1=vwuc1 + lda #<$1234 + sta w + lda #>$1234 + sta w+1 + //SEG12 [6] (byte) main::b#0 ← (byte) $12 -- vbuz1=vbuc1 + lda #$12 + sta b + //SEG13 [7] call print + //SEG14 [13] phi from main to print [phi:main->print] + print_from_main: + //SEG15 [13] phi (byte) idx#12 = (byte) 0 [phi:main->print#0] -- vbuxx=vbuc1 + ldx #0 + //SEG16 [13] phi (void*) print::ptr#3 = (void*)&(byte) main::b#0 [phi:main->print#1] -- pvoz1=pvoc1 + lda #b + sta print.ptr+1 + jsr print + //SEG17 [8] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + jmp b1 + //SEG18 main::@1 + b1: + //SEG19 [9] call print + //SEG20 [13] phi from main::@1 to print [phi:main::@1->print] + print_from_b1: + //SEG21 [13] phi (byte) idx#12 = (byte) idx#13 [phi:main::@1->print#0] -- register_copy + //SEG22 [13] phi (void*) print::ptr#3 = (void*)&(word) main::w#0 [phi:main::@1->print#1] -- pvoz1=pvoc1 + lda #w + sta print.ptr+1 + jsr print + //SEG23 [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + b2_from_b1: + jmp b2 + //SEG24 main::@2 + b2: + //SEG25 [11] call print + //SEG26 [13] phi from main::@2 to print [phi:main::@2->print] + print_from_b2: + //SEG27 [13] phi (byte) idx#12 = (byte) idx#13 [phi:main::@2->print#0] -- register_copy + //SEG28 [13] phi (void*) print::ptr#3 = (void*)&(dword) main::d#0 [phi:main::@2->print#1] -- pvoz1=pvoc1 + lda #d + sta print.ptr+1 + jsr print + jmp breturn + //SEG29 main::@return + breturn: + //SEG30 [12] return + rts +} +//SEG31 print +// print(void* zeropage(2) ptr) +print: { + .label ptr = 2 + //SEG32 [14] *((const byte*) SCREEN#0 + (byte) idx#12) ← *((byte*)(void*) print::ptr#3) -- pbuc1_derefidx_vbuxx=_deref_pbuz1 + ldy #0 + lda (ptr),y + sta SCREEN,x + //SEG33 [15] (byte) idx#13 ← ++ (byte) idx#12 -- vbuxx=_inc_vbuxx + inx + jmp breturn + //SEG34 print::@return + breturn: + //SEG35 [16] return + rts +} + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b1 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp breturn +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction b1_from_bbegin: +Removing instruction b1: +Removing instruction bend_from_b1: +Removing instruction b1_from_main: +Removing instruction print_from_b1: +Removing instruction b2_from_b1: +Removing instruction print_from_b2: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bend: +Removing instruction print_from_main: +Removing instruction b1: +Removing instruction b2: +Removing instruction breturn: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @begin +(label) @end +(byte*) SCREEN +(const byte*) SCREEN#0 SCREEN = (byte*) 1024 +(byte) idx +(byte) idx#12 reg byte x 4.0 +(byte) idx#13 reg byte x 1.0 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte) main::b +(byte) main::b#0 b zp ZP_BYTE:10 20.0 +(dword) main::d +(dword) main::d#0 d zp ZP_DWORD:4 20.0 +(word) main::w +(word) main::w#0 w zp ZP_WORD:8 20.0 +(void()) print((void*) print::ptr) +(label) print::@return +(void*) print::ptr +(void*) print::ptr#3 ptr zp ZP_WORD:2 + +zp ZP_WORD:2 [ print::ptr#3 ] +reg byte x [ idx#12 idx#13 ] +zp ZP_DWORD:4 [ main::d#0 ] +zp ZP_WORD:8 [ main::w#0 ] +zp ZP_BYTE:10 [ main::b#0 ] + + +FINAL ASSEMBLER +Score: 111 + +//SEG0 File Comments +// Test simple void pointer - void pointer function +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .label SCREEN = $400 +//SEG3 @begin +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +//SEG5 @1 +//SEG6 [2] call main +//SEG7 [3] phi from @1 to @end [phi:@1->@end] +//SEG8 @end +//SEG9 main +main: { + .label d = 4 + .label w = 8 + .label b = $a + //SEG10 [4] (dword) main::d#0 ← (dword) $12345678 -- vduz1=vduc1 + lda #<$12345678 + sta d + lda #>$12345678 + sta d+1 + lda #<$12345678>>$10 + sta d+2 + lda #>$12345678>>$10 + sta d+3 + //SEG11 [5] (word) main::w#0 ← (word) $1234 -- vwuz1=vwuc1 + lda #<$1234 + sta w + lda #>$1234 + sta w+1 + //SEG12 [6] (byte) main::b#0 ← (byte) $12 -- vbuz1=vbuc1 + lda #$12 + sta b + //SEG13 [7] call print + //SEG14 [13] phi from main to print [phi:main->print] + //SEG15 [13] phi (byte) idx#12 = (byte) 0 [phi:main->print#0] -- vbuxx=vbuc1 + ldx #0 + //SEG16 [13] phi (void*) print::ptr#3 = (void*)&(byte) main::b#0 [phi:main->print#1] -- pvoz1=pvoc1 + lda #b + sta print.ptr+1 + jsr print + //SEG17 [8] phi from main to main::@1 [phi:main->main::@1] + //SEG18 main::@1 + //SEG19 [9] call print + //SEG20 [13] phi from main::@1 to print [phi:main::@1->print] + //SEG21 [13] phi (byte) idx#12 = (byte) idx#13 [phi:main::@1->print#0] -- register_copy + //SEG22 [13] phi (void*) print::ptr#3 = (void*)&(word) main::w#0 [phi:main::@1->print#1] -- pvoz1=pvoc1 + lda #w + sta print.ptr+1 + jsr print + //SEG23 [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + //SEG24 main::@2 + //SEG25 [11] call print + //SEG26 [13] phi from main::@2 to print [phi:main::@2->print] + //SEG27 [13] phi (byte) idx#12 = (byte) idx#13 [phi:main::@2->print#0] -- register_copy + //SEG28 [13] phi (void*) print::ptr#3 = (void*)&(dword) main::d#0 [phi:main::@2->print#1] -- pvoz1=pvoc1 + lda #d + sta print.ptr+1 + jsr print + //SEG29 main::@return + //SEG30 [12] return + rts +} +//SEG31 print +// print(void* zeropage(2) ptr) +print: { + .label ptr = 2 + //SEG32 [14] *((const byte*) SCREEN#0 + (byte) idx#12) ← *((byte*)(void*) print::ptr#3) -- pbuc1_derefidx_vbuxx=_deref_pbuz1 + ldy #0 + lda (ptr),y + sta SCREEN,x + //SEG33 [15] (byte) idx#13 ← ++ (byte) idx#12 -- vbuxx=_inc_vbuxx + inx + //SEG34 print::@return + //SEG35 [16] return + rts +} + diff --git a/src/test/ref/pointer-void-2.sym b/src/test/ref/pointer-void-2.sym new file mode 100644 index 000000000..62d06dfb2 --- /dev/null +++ b/src/test/ref/pointer-void-2.sym @@ -0,0 +1,28 @@ +(label) @1 +(label) @begin +(label) @end +(byte*) SCREEN +(const byte*) SCREEN#0 SCREEN = (byte*) 1024 +(byte) idx +(byte) idx#12 reg byte x 4.0 +(byte) idx#13 reg byte x 1.0 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte) main::b +(byte) main::b#0 b zp ZP_BYTE:10 20.0 +(dword) main::d +(dword) main::d#0 d zp ZP_DWORD:4 20.0 +(word) main::w +(word) main::w#0 w zp ZP_WORD:8 20.0 +(void()) print((void*) print::ptr) +(label) print::@return +(void*) print::ptr +(void*) print::ptr#3 ptr zp ZP_WORD:2 + +zp ZP_WORD:2 [ print::ptr#3 ] +reg byte x [ idx#12 idx#13 ] +zp ZP_DWORD:4 [ main::d#0 ] +zp ZP_WORD:8 [ main::w#0 ] +zp ZP_BYTE:10 [ main::b#0 ] diff --git a/src/test/ref/robozzle64-label-problem.log b/src/test/ref/robozzle64-label-problem.log index 633624c97..8ba9ec7cc 100644 --- a/src/test/ref/robozzle64-label-problem.log +++ b/src/test/ref/robozzle64-label-problem.log @@ -1,6 +1,6 @@ -Fixing pointer increment (word*) main::screen ← ++ (word*) main::screen -Fixing pointer increment (word*) main::screen ← ++ (word*) main::screen Adding pointer type conversion cast (word*) main::screen in (word*) main::screen ← (number) $400 +Fixing pointer increment (word*) main::screen ← ++ (word*) main::screen +Fixing pointer increment (word*) main::screen ← ++ (word*) main::screen Culled Empty Block (label) mul8u::@5 Culled Empty Block (label) mul8u::@6 Culled Empty Block (label) mul8u::@8 diff --git a/src/test/ref/signed-indexed-subtract.log b/src/test/ref/signed-indexed-subtract.log index 09183e795..f74570e8f 100644 --- a/src/test/ref/signed-indexed-subtract.log +++ b/src/test/ref/signed-indexed-subtract.log @@ -1,7 +1,7 @@ +Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 Fixing pointer array-indexing *((signed word[]) words + (byte) main::j) Fixing pointer array-indexing *((signed word[]) words + (byte) sub::idx) Fixing pointer array-indexing *((signed word[]) words + (byte) sub::idx) -Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 Culled Empty Block (label) @1 Culled Empty Block (label) @2 Culled Empty Block (label) @3 diff --git a/src/test/ref/signed-word-minus-byte-2.log b/src/test/ref/signed-word-minus-byte-2.log index a85358f76..f82f3771a 100644 --- a/src/test/ref/signed-word-minus-byte-2.log +++ b/src/test/ref/signed-word-minus-byte-2.log @@ -1,5 +1,5 @@ -Fixing pointer array-indexing *((signed word*) main::screen + (byte) main::i) Adding pointer type conversion cast (signed word*) main::screen in (signed word*) main::screen ← (number) $400 +Fixing pointer array-indexing *((signed word*) main::screen + (byte) main::i) Identified constant variable (signed word*) main::screen Culled Empty Block (label) main::@2 diff --git a/src/test/ref/sinusgen16.log b/src/test/ref/sinusgen16.log index cb3c4a5eb..922be596e 100644 --- a/src/test/ref/sinusgen16.log +++ b/src/test/ref/sinusgen16.log @@ -1,9 +1,9 @@ +Identified literal word (dword) { div32u16u::quotient_hi, div32u16u::quotient_lo } in (dword) div32u16u::quotient ← { (word) div32u16u::quotient_hi, (word) div32u16u::quotient_lo } +Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 Fixing pointer increment (signed word*) sin16s_gen::sintab ← ++ (signed word*) sin16s_gen::sintab Fixing pointer increment (signed word*) sin16s_gen2::sintab ← ++ (signed word*) sin16s_gen2::sintab Fixing pointer increment (signed word*) main::st1 ← ++ (signed word*) main::st1 Fixing pointer addition (signed word*~) main::$7 ← (signed word[$78]) main::sintab1 + (word) main::wavelength -Identified literal word (dword) { div32u16u::quotient_hi, div32u16u::quotient_lo } in (dword) div32u16u::quotient ← { (word) div32u16u::quotient_hi, (word) div32u16u::quotient_lo } -Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 Identified constant variable (word) main::wavelength Culled Empty Block (label) @1 Culled Empty Block (label) divr16u::@7 diff --git a/src/test/ref/sinusgen16b.log b/src/test/ref/sinusgen16b.log index e705f26a3..237596f58 100644 --- a/src/test/ref/sinusgen16b.log +++ b/src/test/ref/sinusgen16b.log @@ -1,10 +1,10 @@ +Identified literal word (dword) { div32u16u::quotient_hi, div32u16u::quotient_lo } in (dword) div32u16u::quotient ← { (word) div32u16u::quotient_hi, (word) div32u16u::quotient_lo } +Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 Fixing pointer increment (signed word*) sin16s_gen::sintab ← ++ (signed word*) sin16s_gen::sintab Fixing pointer increment (signed word*) sin16s_gen2::sintab ← ++ (signed word*) sin16s_gen2::sintab Fixing pointer increment (signed word*) sin16s_genb::sintab ← ++ (signed word*) sin16s_genb::sintab Fixing pointer increment (signed word*) main::st1 ← ++ (signed word*) main::st1 Fixing pointer increment (signed word*) main::st2 ← ++ (signed word*) main::st2 -Identified literal word (dword) { div32u16u::quotient_hi, div32u16u::quotient_lo } in (dword) div32u16u::quotient ← { (word) div32u16u::quotient_hi, (word) div32u16u::quotient_lo } -Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 Identified constant variable (word) main::wavelength Culled Empty Block (label) @1 Culled Empty Block (label) divr16u::@7 diff --git a/src/test/ref/sinusgen8.log b/src/test/ref/sinusgen8.log index 319ed6517..31f277ae5 100644 --- a/src/test/ref/sinusgen8.log +++ b/src/test/ref/sinusgen8.log @@ -1,7 +1,7 @@ -Fixing pointer increment (signed word*) sin16s_gen::sintab ← ++ (signed word*) sin16s_gen::sintab -Fixing pointer increment (signed word*) sin16s_gen2::sintab ← ++ (signed word*) sin16s_gen2::sintab Identified literal word (dword) { div32u16u::quotient_hi, div32u16u::quotient_lo } in (dword) div32u16u::quotient ← { (word) div32u16u::quotient_hi, (word) div32u16u::quotient_lo } Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 +Fixing pointer increment (signed word*) sin16s_gen::sintab ← ++ (signed word*) sin16s_gen::sintab +Fixing pointer increment (signed word*) sin16s_gen2::sintab ← ++ (signed word*) sin16s_gen2::sintab Identified constant variable (word) main::wavelength Culled Empty Block (label) @1 Culled Empty Block (label) @2 diff --git a/src/test/ref/sinusgen8b.log b/src/test/ref/sinusgen8b.log index ae7d226a2..51423a6da 100644 --- a/src/test/ref/sinusgen8b.log +++ b/src/test/ref/sinusgen8b.log @@ -1,8 +1,8 @@ +Identified literal word (dword) { div32u16u::quotient_hi, div32u16u::quotient_lo } in (dword) div32u16u::quotient ← { (word) div32u16u::quotient_hi, (word) div32u16u::quotient_lo } +Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 Fixing pointer increment (signed word*) sin16s_gen::sintab ← ++ (signed word*) sin16s_gen::sintab Fixing pointer increment (signed word*) sin16s_gen2::sintab ← ++ (signed word*) sin16s_gen2::sintab Fixing pointer addition (signed word*~) main::$4 ← (signed word[$c0]) main::sintabw + (word~) main::$3 -Identified literal word (dword) { div32u16u::quotient_hi, div32u16u::quotient_lo } in (dword) div32u16u::quotient ← { (word) div32u16u::quotient_hi, (word) div32u16u::quotient_lo } -Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 Identified constant variable (word) main::wavelength Culled Empty Block (label) @1 Culled Empty Block (label) divr16u::@7 diff --git a/src/test/ref/sinusgenscale8.log b/src/test/ref/sinusgenscale8.log index d6be1743a..8d4bba333 100644 --- a/src/test/ref/sinusgenscale8.log +++ b/src/test/ref/sinusgenscale8.log @@ -1,7 +1,7 @@ -Fixing pointer increment (signed word*) sin16s_gen::sintab ← ++ (signed word*) sin16s_gen::sintab -Fixing pointer increment (signed word*) sin16s_gen2::sintab ← ++ (signed word*) sin16s_gen2::sintab Identified literal word (dword) { div32u16u::quotient_hi, div32u16u::quotient_lo } in (dword) div32u16u::quotient ← { (word) div32u16u::quotient_hi, (word) div32u16u::quotient_lo } Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 +Fixing pointer increment (signed word*) sin16s_gen::sintab ← ++ (signed word*) sin16s_gen::sintab +Fixing pointer increment (signed word*) sin16s_gen2::sintab ← ++ (signed word*) sin16s_gen2::sintab Identified constant variable (word) main::tabsize Culled Empty Block (label) @1 Culled Empty Block (label) @2 diff --git a/src/test/ref/sizeof-expr.log b/src/test/ref/sizeof-expr.log index 3d09655a8..4c1c28f53 100644 --- a/src/test/ref/sizeof-expr.log +++ b/src/test/ref/sizeof-expr.log @@ -1,12 +1,12 @@ Setting inferred volatile on symbol affected by address-of (word*~) main::$0 ← & (word) main::w +Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (number) $400 +Adding pointer type conversion cast (byte*) main::bp in (byte*) main::bp ← (number) $1000 Resolving sizeof() (byte~) main::$3 ← sizeof (byte) main::idx Resolving sizeof() (byte~) main::$5 ← sizeof (byte) main::b Resolving sizeof() (byte~) main::$8 ← sizeof (number~) main::$7 Resolving sizeof() (byte~) main::$12 ← sizeof (word) main::w Resolving sizeof() (byte~) main::$14 ← sizeof (byte*) main::bp Resolving sizeof() (byte~) main::$16 ← sizeof (word*) main::wp -Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (number) $400 -Adding pointer type conversion cast (byte*) main::bp in (byte*) main::bp ← (number) $1000 Identified constant variable (byte*) main::bp CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/sizeof-struct.log b/src/test/ref/sizeof-struct.log index 69a58a5bb..fb884deea 100644 --- a/src/test/ref/sizeof-struct.log +++ b/src/test/ref/sizeof-struct.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (number) $400 Resolving sizeof() (byte~) main::$0 ← sizeof (struct Point) main::p Resolving sizeof() (byte~) main::$2 ← sizeof (struct Circle) main::c Created struct value member variable (byte) main::p_x @@ -15,7 +16,6 @@ Created struct value member variable (byte) main::c_center_y Converted struct value to member variables (struct Point) main::c_center Adding struct value member variable default initializer (byte) main::c_center_x ← (byte) 0 Adding struct value member variable default initializer (byte) main::c_center_y ← (byte) 0 -Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (number) $400 Identified constant variable (byte) main::p_x Identified constant variable (byte) main::p_y Identified constant variable (byte) main::c_radius diff --git a/src/test/ref/struct-0.log b/src/test/ref/struct-0.log index 3e2aac03c..8c0c39948 100644 --- a/src/test/ref/struct-0.log +++ b/src/test/ref/struct-0.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Created struct value member variable (byte) point_x Created struct value member variable (byte) point_y Converted struct value to member variables (struct Point) point @@ -7,7 +8,6 @@ Replacing struct member reference (struct Point) point.x with member variable re Replacing struct member reference (struct Point) point.y with member variable reference (byte) point_y Replacing struct member reference (struct Point) point.x with member variable reference (byte) point_x Replacing struct member reference (struct Point) point.y with member variable reference (byte) point_y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/struct-1.log b/src/test/ref/struct-1.log index 26114fb82..c2a1c4050 100644 --- a/src/test/ref/struct-1.log +++ b/src/test/ref/struct-1.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Created struct value member variable (byte) point1_x Created struct value member variable (byte) point1_y Converted struct value to member variables (struct Point) point1 @@ -16,7 +17,6 @@ Replacing struct member reference (struct Point) point1.x with member variable r Replacing struct member reference (struct Point) point2.y with member variable reference (byte) point2_y Replacing struct member reference (struct Point) point2.x with member variable reference (byte) point2_x Replacing struct member reference (struct Point) point2.y with member variable reference (byte) point2_y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/struct-2.log b/src/test/ref/struct-2.log index a82f7aa0d..6f4b5e481 100644 --- a/src/test/ref/struct-2.log +++ b/src/test/ref/struct-2.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Created struct value member variable (byte) point1_x Created struct value member variable (byte) point1_y Converted struct value to member variables (struct Point) point1 @@ -17,7 +18,6 @@ Replacing struct member reference (struct Point) point1.x with member variable r Replacing struct member reference (struct Point) point1.y with member variable reference (byte) point1_y Replacing struct member reference (struct Point) point2.x with member variable reference (byte) point2_x Replacing struct member reference (struct Point) point2.y with member variable reference (byte) point2_y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/struct-3.log b/src/test/ref/struct-3.log index 385bc90e9..f016a0619 100644 --- a/src/test/ref/struct-3.log +++ b/src/test/ref/struct-3.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (number) $400 Created struct value member variable (byte) main::p1_x Created struct value member variable (byte) main::p1_y Converted struct value to member variables (struct Point) main::p1 @@ -14,7 +15,6 @@ Replacing struct member reference (struct Point) main::p1.y with member variable Replacing struct member reference (struct Point) main::p1.x with member variable reference (byte) main::p1_x Replacing struct member reference (struct Point) print::p.x with member variable reference (byte) print::p_x Replacing struct member reference (struct Point) print::p.y with member variable reference (byte) print::p_y -Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (number) $400 CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/struct-4.log b/src/test/ref/struct-4.log index 2d2ce742c..77e8494a1 100644 --- a/src/test/ref/struct-4.log +++ b/src/test/ref/struct-4.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Created struct value member variable (byte) main::p_x Created struct value member variable (byte) main::p_y Converted struct value to member variables (struct Point) main::p @@ -5,7 +6,6 @@ Adding struct value list initializer (byte) main::p_x ← (byte) main::x Adding struct value list initializer (byte) main::p_y ← (number~) main::$0 Replacing struct member reference (struct Point) main::p.x with member variable reference (byte) main::p_x Replacing struct member reference (struct Point) main::p.y with member variable reference (byte) main::p_y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Identified constant variable (byte) main::x Identified constant variable (byte) main::y diff --git a/src/test/ref/struct-5.log b/src/test/ref/struct-5.log index f4a855835..e87da2f86 100644 --- a/src/test/ref/struct-5.log +++ b/src/test/ref/struct-5.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Created struct value member variable (byte) main::q_x Created struct value member variable (byte) main::q_y Converted struct value to member variables (struct Point) main::q @@ -24,7 +25,6 @@ Adding struct value member variable copy (byte) point::return_y ← (byte) point Converted procedure struct return value to member variables return { (byte) point::return_x, (byte) point::return_y } Replacing struct member reference (struct Point) main::q.x with member variable reference (byte) main::q_x Replacing struct member reference (struct Point) main::q.y with member variable reference (byte) main::q_y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Identified constant variable (byte) point::p_x Identified constant variable (byte) point::p_y Culled Empty Block (label) @1 diff --git a/src/test/ref/struct-6.log b/src/test/ref/struct-6.log index 76eb85157..6cd87876b 100644 --- a/src/test/ref/struct-6.log +++ b/src/test/ref/struct-6.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Created struct value member variable (byte) main::p_x Created struct value member variable (byte) main::p_y Converted struct value to member variables (struct Point) main::p @@ -18,7 +19,6 @@ Adding struct value member variable copy (byte) main::c_center_x ← (byte) main Adding struct value member variable copy (byte) main::c_center_y ← (byte) main::p_y Replacing struct member reference (struct Point) main::c_center.x with member variable reference (byte) main::c_center_x Replacing struct member reference (struct Point) main::c_center.y with member variable reference (byte) main::c_center_y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Identified constant variable (byte) main::p_x Identified constant variable (byte) main::p_y Identified constant variable (byte) main::c_radius diff --git a/src/test/ref/struct-7.log b/src/test/ref/struct-7.log index e899719ff..0719b47ff 100644 --- a/src/test/ref/struct-7.log +++ b/src/test/ref/struct-7.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Created struct value member variable (struct Circle) main::t_c1 Created struct value member variable (struct Circle) main::t_c2 Converted struct value to member variables (struct TwoCircles) main::t @@ -39,7 +40,6 @@ Replacing struct member reference (struct Point) main::t_c1_center.x with member Replacing struct member reference (struct Point) main::t_c1_center.y with member variable reference (byte) main::t_c1_center_y Replacing struct member reference (struct Point) main::t_c2_center.x with member variable reference (byte) main::t_c2_center_x Replacing struct member reference (struct Point) main::t_c2_center.y with member variable reference (byte) main::t_c2_center_y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Identified constant variable (byte) main::t_c1_radius Identified constant variable (byte) main::t_c2_radius Identified constant variable (byte) main::t_c1_center_x diff --git a/src/test/ref/struct-ptr-0.log b/src/test/ref/struct-ptr-0.log index df09fa81e..b1eabe49c 100644 --- a/src/test/ref/struct-ptr-0.log +++ b/src/test/ref/struct-ptr-0.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Fixing pointer array-indexing *((struct Point[4]) points + (byte) main::i) Fixing pointer array-indexing *((struct Point[4]) points + (byte) main::i) Fixing pointer array-indexing *((struct Point[4]) points + (byte) main::i1) @@ -6,7 +7,6 @@ Rewriting struct pointer member access *((struct Point[4]) points + (byte~) main Rewriting struct pointer member access *((struct Point[4]) points + (byte~) main::$5).y Rewriting struct pointer member access *((struct Point[4]) points + (byte~) main::$6).x Rewriting struct pointer member access *((struct Point[4]) points + (byte~) main::$7).y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Culled Empty Block (label) main::@4 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/struct-ptr-10.log b/src/test/ref/struct-ptr-10.log index 76017ba09..e3881d6b7 100644 --- a/src/test/ref/struct-ptr-10.log +++ b/src/test/ref/struct-ptr-10.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (struct Point*) main::SCREEN in (struct Point*) main::SCREEN ← (number) $400 Fixing pointer array-indexing *((struct Point[$1f4]) points + (word) main::i) Fixing pointer array-indexing *((struct Point[$1f4]) points + (word) main::i1) Fixing pointer array-indexing *((struct Point*) main::SCREEN + (word) main::i1) @@ -5,7 +6,6 @@ Adding struct value list initializer *((byte*) main::$5 + (word~) main::$3) ← Adding struct value list initializer *((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 pointer type conversion cast (struct Point*) main::SCREEN in (struct Point*) main::SCREEN ← (number) $400 Culled Empty Block (label) main::@4 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/struct-ptr-11.log b/src/test/ref/struct-ptr-11.log index 3f5eb76d2..1fccaf45a 100644 --- a/src/test/ref/struct-ptr-11.log +++ b/src/test/ref/struct-ptr-11.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (struct Point*) main::SCREEN in (struct Point*) main::SCREEN ← (number) $400 Fixing pointer array-indexing *((struct Point[4]) points + (byte) main::i) Fixing pointer array-indexing *((struct Point[4]) points + (byte) main::i1) Fixing pointer array-indexing *((struct Point*) main::SCREEN + (byte) main::i1) @@ -7,7 +8,6 @@ Adding struct value list initializer *((signed byte*) main::$10 + (byte~) main:: 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 pointer type conversion cast (struct Point*) main::SCREEN in (struct Point*) main::SCREEN ← (number) $400 Culled Empty Block (label) main::@4 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/struct-ptr-12.log b/src/test/ref/struct-ptr-12.log index e6756bb40..7fc9c15f8 100644 --- a/src/test/ref/struct-ptr-12.log +++ b/src/test/ref/struct-ptr-12.log @@ -1,4 +1,5 @@ Setting inferred volatile on symbol affected by address-of (struct Point*~) main::$0 ← & (struct Point) main::p +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Created struct value member variable (byte) main::p_x Created struct value member variable (byte) main::p_y Converted struct value to member variables (struct Point) main::p @@ -6,7 +7,6 @@ Adding struct value list initializer (byte) main::p_x ← (number) 2 Adding struct value list initializer (byte) main::p_y ← (number) 3 Rewriting struct pointer member access *((struct Point*) main::q).x Rewriting struct pointer member access *((struct Point*) main::q).y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Adding versioned struct unwinding for (struct Point) main::p#0 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/struct-ptr-13.log b/src/test/ref/struct-ptr-13.log index 340f3789b..1c04327d9 100644 --- a/src/test/ref/struct-ptr-13.log +++ b/src/test/ref/struct-ptr-13.log @@ -1,11 +1,11 @@ -Rewriting struct pointer member access *((struct Point*) points).x -Rewriting struct pointer member access *((struct Point*) points).x -Rewriting struct pointer member access *((struct Point*) points).y -Rewriting struct pointer member access *((struct Point*) points).y -Rewriting struct pointer member access *((struct Point*) points).x -Rewriting struct pointer member access *((struct Point*) points).y Adding pointer type conversion cast (struct Point*) points in (struct Point*) points ← (number) $1000 Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 +Rewriting struct pointer member access *((struct Point*) points).x +Rewriting struct pointer member access *((struct Point*) points).x +Rewriting struct pointer member access *((struct Point*) points).y +Rewriting struct pointer member access *((struct Point*) points).y +Rewriting struct pointer member access *((struct Point*) points).x +Rewriting struct pointer member access *((struct Point*) points).y Identified constant variable (struct Point*) points CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/struct-ptr-14.log b/src/test/ref/struct-ptr-14.log index 54c503c28..458ae0156 100644 --- a/src/test/ref/struct-ptr-14.log +++ b/src/test/ref/struct-ptr-14.log @@ -1,4 +1,5 @@ Setting inferred volatile on symbol affected by address-of (struct Point*~) main::$0 ← & (struct Point) main::p +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Created struct value member variable (byte) main::p_x Created struct value member variable (byte) main::p_y Converted struct value to member variables (struct Point) main::p @@ -8,7 +9,6 @@ Rewriting struct pointer member access *((struct Point*) main::q).x Rewriting struct pointer member access *((struct Point*) main::q).y Rewriting struct pointer member access *((struct Point*) set::ptr).x Rewriting struct pointer member access *((struct Point*) set::ptr).y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Culled Empty Block (label) @1 Adding versioned struct unwinding for (struct Point) main::p#0 diff --git a/src/test/ref/struct-ptr-2.log b/src/test/ref/struct-ptr-2.log index 39fb49656..d0d2e6dbb 100644 --- a/src/test/ref/struct-ptr-2.log +++ b/src/test/ref/struct-ptr-2.log @@ -1,6 +1,6 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Fixing pointer addition (struct Point*~) main::$0 ← (struct Point[4]) points + (byte) main::i Fixing pointer addition (struct Point*~) main::$7 ← (struct Point[4]) points + (byte) main::i1 -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Culled Empty Block (label) main::@4 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/struct-ptr-3.log b/src/test/ref/struct-ptr-3.log index 697022a2d..2e715c0c9 100644 --- a/src/test/ref/struct-ptr-3.log +++ b/src/test/ref/struct-ptr-3.log @@ -1,10 +1,10 @@ +Adding pointer type conversion cast (struct Point*) points in (struct Point*) points ← (number) $1000 +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Fixing pointer increment (struct Point*) points ← ++ (struct Point*) points Rewriting struct pointer member access *((struct Point*) points).x Rewriting struct pointer member access *((struct Point*) points).y Rewriting struct pointer member access *((struct Point*) points).x Rewriting struct pointer member access *((struct Point*) points).y -Adding pointer type conversion cast (struct Point*) points in (struct Point*) points ← (number) $1000 -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/struct-ptr-4.log b/src/test/ref/struct-ptr-4.log index 94fad62e3..e395babee 100644 --- a/src/test/ref/struct-ptr-4.log +++ b/src/test/ref/struct-ptr-4.log @@ -1,11 +1,11 @@ -Fixing pointer increment (struct Point*) main::points ← ++ (struct Point*) main::points -Fixing pointer increment (struct Point*) main::points ← ++ (struct Point*) main::points -Rewriting struct pointer member access *((struct Point*) main::points).x -Rewriting struct pointer member access *((struct Point*) main::points).y -Rewriting struct pointer member access *((struct Point*) main::points).x -Rewriting struct pointer member access *((struct Point*) main::points).y Adding pointer type conversion cast (struct Point*) POINTS in (struct Point*) POINTS ← (number) $1000 Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 +Fixing pointer increment (struct Point*) main::points ← ++ (struct Point*) main::points +Fixing pointer increment (struct Point*) main::points ← ++ (struct Point*) main::points +Rewriting struct pointer member access *((struct Point*) main::points).x +Rewriting struct pointer member access *((struct Point*) main::points).y +Rewriting struct pointer member access *((struct Point*) main::points).x +Rewriting struct pointer member access *((struct Point*) main::points).y Identified constant variable (struct Point*) POINTS Culled Empty Block (label) main::@4 diff --git a/src/test/ref/struct-ptr-5.log b/src/test/ref/struct-ptr-5.log index 9b3c175b6..eeb1f158b 100644 --- a/src/test/ref/struct-ptr-5.log +++ b/src/test/ref/struct-ptr-5.log @@ -1,4 +1,7 @@ Fixing struct type size struct Entry to 3 +Adding pointer type conversion cast (struct Entry*) ENTRIES in (struct Entry*) ENTRIES ← (number) $1000 +Adding pointer type conversion cast (struct Entry*) *(main::entry1).next in *((struct Entry*) main::entry1).next ← (number) 0 +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Fixing pointer addition (struct Entry*~) main::$0 ← (struct Entry*) ENTRIES + (number) 1 Fixing pointer addition (struct Entry*~) main::$1 ← (struct Entry*) ENTRIES + (number) 2 Rewriting struct pointer member access *((struct Entry*) main::entry0).next @@ -12,9 +15,6 @@ Rewriting struct pointer member access *((struct Entry*) main::entry).next Rewriting struct pointer member access *((struct Entry*) main::entry).next Rewriting struct pointer member access *((struct Entry*) main::entry).next Warning! Adding boolean cast to non-boolean condition (struct Entry*) main::entry -Adding pointer type conversion cast (struct Entry*) ENTRIES in (struct Entry*) ENTRIES ← (number) $1000 -Adding pointer type conversion cast (struct Entry*) *(main::$11) in *((struct Entry**) main::$11) ← (number) 0 -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Identified constant variable (struct Entry*) ENTRIES Culled Empty Block (label) main::@4 Culled Empty Block (label) main::@3 diff --git a/src/test/ref/struct-ptr-6.log b/src/test/ref/struct-ptr-6.log index 6d6fc9ad2..55b9e01da 100644 --- a/src/test/ref/struct-ptr-6.log +++ b/src/test/ref/struct-ptr-6.log @@ -1,10 +1,10 @@ +Adding pointer type conversion cast (struct Point*) points in (struct Point*) points ← (number) $1000 +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Fixing pointer increment (struct Point*) points ← ++ (struct Point*) points Rewriting struct pointer member access *((struct Point*) points).x Rewriting struct pointer member access *((struct Point*) points).y Rewriting struct pointer member access *((struct Point*) points).x Rewriting struct pointer member access *((struct Point*) points).y -Adding pointer type conversion cast (struct Point*) points in (struct Point*) points ← (number) $1000 -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/struct-ptr-7.log b/src/test/ref/struct-ptr-7.log index 9db434d51..090b2b7cb 100644 --- a/src/test/ref/struct-ptr-7.log +++ b/src/test/ref/struct-ptr-7.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Fixing pointer array-indexing *((struct Point[2]) points + (number) 0) Fixing pointer array-indexing *((struct Point[2]) points + (number) 0) Fixing pointer array-indexing *((struct Point[2]) points + (number) 1) @@ -14,7 +15,6 @@ Rewriting struct pointer member access *((struct Point[2]) points + (number~) ma Rewriting struct pointer member access *((struct Point[2]) points + (number~) main::$5).y Rewriting struct pointer member access *((struct Point[2]) points + (number~) main::$6).x Rewriting struct pointer member access *((struct Point[2]) points + (number~) main::$7).y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/struct-ptr-8.log b/src/test/ref/struct-ptr-8.log index 876ebfdfc..11b5149fe 100644 --- a/src/test/ref/struct-ptr-8.log +++ b/src/test/ref/struct-ptr-8.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Fixing pointer array-indexing *((struct Point[2]) points + (byte) main::i) Fixing pointer array-indexing *((struct Point[2]) points + (byte) main::i) Fixing pointer array-indexing *((struct Point[2]) points + (byte) main::i1) @@ -6,7 +7,6 @@ Rewriting struct pointer member access *((struct Point[2]) points + (byte~) main Rewriting struct pointer member access *((struct Point[2]) points + (byte~) main::$5).y Rewriting struct pointer member access *((struct Point[2]) points + (byte~) main::$6).x Rewriting struct pointer member access *((struct Point[2]) points + (byte~) main::$7).y -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 Culled Empty Block (label) main::@4 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/struct-ptr-9.log b/src/test/ref/struct-ptr-9.log index 7cc335334..da81db370 100644 --- a/src/test/ref/struct-ptr-9.log +++ b/src/test/ref/struct-ptr-9.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (struct Point*) main::SCREEN in (struct Point*) main::SCREEN ← (number) $400 Fixing pointer array-indexing *((struct Point[2]) points + (byte) main::i) Fixing pointer array-indexing *((struct Point[2]) points + (byte) main::i1) Fixing pointer array-indexing *((struct Point*) main::SCREEN + (byte) main::i1) @@ -5,7 +6,6 @@ Adding struct value list initializer *((byte*) main::$4 + (byte~) main::$2) ← Adding struct value list initializer *((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 pointer type conversion cast (struct Point*) main::SCREEN in (struct Point*) main::SCREEN ← (number) $400 Culled Empty Block (label) main::@4 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/subexpr-optimize-4.log b/src/test/ref/subexpr-optimize-4.log index e566f82e9..f9954eccd 100644 --- a/src/test/ref/subexpr-optimize-4.log +++ b/src/test/ref/subexpr-optimize-4.log @@ -1,6 +1,6 @@ +Adding pointer type conversion cast (byte*) main::screen in (byte*) main::screen ← (number) $400 Warning! Adding boolean cast to non-boolean condition (number~) main::$0 Warning! Adding boolean cast to non-boolean condition (number~) main::$6 -Adding pointer type conversion cast (byte*) main::screen in (byte*) main::screen ← (number) $400 Culled Empty Block (label) main::@8 Culled Empty Block (label) main::@9 Culled Empty Block (label) main::@10 diff --git a/src/test/ref/test-comparisons-sword.log b/src/test/ref/test-comparisons-sword.log index f00ee17bc..2ba1e16ab 100644 --- a/src/test/ref/test-comparisons-sword.log +++ b/src/test/ref/test-comparisons-sword.log @@ -1,5 +1,3 @@ -Fixing pointer array-indexing *((signed word[]) swords + (byte) main::i) -Fixing pointer array-indexing *((signed word[]) swords + (byte) main::j) Adding pointer type conversion cast (byte*) PROCPORT_DDR in (byte*) PROCPORT_DDR ← (number) 0 Adding pointer type conversion cast (byte*) PROCPORT in (byte*) PROCPORT ← (number) 1 Adding pointer type conversion cast (byte*) CHARGEN in (byte*) CHARGEN ← (number) $d000 @@ -45,6 +43,8 @@ Adding pointer type conversion cast (byte*) CIA2_INTERRUPT in (byte*) CIA2_INTER Adding pointer type conversion cast (void()**) KERNEL_IRQ in (void()**) KERNEL_IRQ ← (number) $314 Adding pointer type conversion cast (void()**) HARDWARE_IRQ in (void()**) HARDWARE_IRQ ← (number) $fffe Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 +Fixing pointer array-indexing *((signed word[]) swords + (byte) main::i) +Fixing pointer array-indexing *((signed word[]) swords + (byte) main::j) Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx Culled Empty Block (label) @1 Culled Empty Block (label) @2 diff --git a/src/test/ref/test-comparisons-word.log b/src/test/ref/test-comparisons-word.log index a3bc2398d..aff2f8019 100644 --- a/src/test/ref/test-comparisons-word.log +++ b/src/test/ref/test-comparisons-word.log @@ -1,5 +1,3 @@ -Fixing pointer array-indexing *((word[]) words + (byte) main::i) -Fixing pointer array-indexing *((word[]) words + (byte) main::j) Adding pointer type conversion cast (byte*) PROCPORT_DDR in (byte*) PROCPORT_DDR ← (number) 0 Adding pointer type conversion cast (byte*) PROCPORT in (byte*) PROCPORT ← (number) 1 Adding pointer type conversion cast (byte*) CHARGEN in (byte*) CHARGEN ← (number) $d000 @@ -45,6 +43,8 @@ Adding pointer type conversion cast (byte*) CIA2_INTERRUPT in (byte*) CIA2_INTER Adding pointer type conversion cast (void()**) KERNEL_IRQ in (void()**) KERNEL_IRQ ← (number) $314 Adding pointer type conversion cast (void()**) HARDWARE_IRQ in (void()**) HARDWARE_IRQ ← (number) $fffe Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 +Fixing pointer array-indexing *((word[]) words + (byte) main::i) +Fixing pointer array-indexing *((word[]) words + (byte) main::j) Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx Culled Empty Block (label) @1 Culled Empty Block (label) @2 diff --git a/src/test/ref/test-division.log b/src/test/ref/test-division.log index aa324b14f..b40968828 100644 --- a/src/test/ref/test-division.log +++ b/src/test/ref/test-division.log @@ -1,9 +1,9 @@ +Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 +Identified literal word (dword) { div32u16u::quotient_hi, div32u16u::quotient_lo } in (dword) div32u16u::quotient ← { (word) div32u16u::quotient_hi, (word) div32u16u::quotient_lo } Fixing pointer array-indexing *((word[]) test_16u::dividends + (byte) test_16u::i) Fixing pointer array-indexing *((word[]) test_16u::divisors + (byte) test_16u::i) Fixing pointer array-indexing *((signed word[]) test_16s::dividends + (byte) test_16s::i) Fixing pointer array-indexing *((signed word[]) test_16s::divisors + (byte) test_16s::i) -Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 -Identified literal word (dword) { div32u16u::quotient_hi, div32u16u::quotient_lo } in (dword) div32u16u::quotient ← { (word) div32u16u::quotient_hi, (word) div32u16u::quotient_lo } Identified constant variable (byte) test_8u::rem Culled Empty Block (label) @1 Culled Empty Block (label) @2 diff --git a/src/test/ref/type-inference.log b/src/test/ref/type-inference.log index 2ca7f1659..25e06e97f 100644 --- a/src/test/ref/type-inference.log +++ b/src/test/ref/type-inference.log @@ -1,5 +1,5 @@ -Fixing pointer array-indexing *((word*) main::screen + (byte) main::b) Adding pointer type conversion cast (word*) main::screen in (word*) main::screen ← (number) $400 +Fixing pointer array-indexing *((word*) main::screen + (byte) main::b) Culled Empty Block (label) main::@2 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/typedef-1.log b/src/test/ref/typedef-1.log index 222f7a27c..ab651cd2d 100644 --- a/src/test/ref/typedef-1.log +++ b/src/test/ref/typedef-1.log @@ -1,3 +1,4 @@ +Adding pointer type conversion cast (struct PointDef*) main::SCREEN in (struct PointDef*) main::SCREEN ← (number) $400 Created struct value member variable (byte) main::p_x Created struct value member variable (byte) main::p_y Converted struct value to member variables (struct PointDef) main::p @@ -5,7 +6,6 @@ Adding struct value list initializer (byte) main::p_x ← (number) 4 Adding struct value list initializer (byte) main::p_y ← (number) 7 Adding struct value member variable copy *((byte*) main::$0) ← (byte) main::p_x Adding struct value member variable copy *((byte*) main::$1) ← (byte) main::p_y -Adding pointer type conversion cast (struct PointDef*) main::SCREEN in (struct PointDef*) main::SCREEN ← (number) $400 Identified constant variable (struct PointDef*) main::SCREEN Identified constant variable (byte) main::p_x Identified constant variable (byte) main::p_y diff --git a/src/test/ref/wfragment1.log b/src/test/ref/wfragment1.log index 6e9d1eda5..0fd2ff916 100644 --- a/src/test/ref/wfragment1.log +++ b/src/test/ref/wfragment1.log @@ -1,6 +1,6 @@ -Fixing pointer array-indexing *((word[MAX_OBJECTS]) OBJ_WORLD_X + (byte) move_enemy::obj_slot) -Fixing pointer array-indexing *((word[MAX_OBJECTS]) OBJ_WORLD_X + (byte) move_enemy::obj_slot) Adding pointer type conversion cast (byte*) print_screen in (byte*) print_screen ← (number) $400 +Fixing pointer array-indexing *((word[MAX_OBJECTS]) OBJ_WORLD_X + (byte) move_enemy::obj_slot) +Fixing pointer array-indexing *((word[MAX_OBJECTS]) OBJ_WORLD_X + (byte) move_enemy::obj_slot) Culled Empty Block (label) @1 Culled Empty Block (label) @2 Culled Empty Block (label) @3 diff --git a/src/test/ref/word-array-0.log b/src/test/ref/word-array-0.log index 6e6f26706..e9efb5252 100644 --- a/src/test/ref/word-array-0.log +++ b/src/test/ref/word-array-0.log @@ -1,7 +1,7 @@ -Fixing pointer array-indexing *((word[3]) main::words + (number) 1) -Fixing pointer array-indexing *((word[3]) main::words + (number) 2) Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400+(number) 6*(number) $28 Adding pointer type conversion cast (word[3]) main::words in (word[3]) main::words ← (number) $400 +Fixing pointer array-indexing *((word[3]) main::words + (number) 1) +Fixing pointer array-indexing *((word[3]) main::words + (number) 2) CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/word-array-1.log b/src/test/ref/word-array-1.log index d2e57964a..49711d336 100644 --- a/src/test/ref/word-array-1.log +++ b/src/test/ref/word-array-1.log @@ -1,5 +1,5 @@ -Fixing pointer array-indexing *((word[]) main::words + (byte) main::i) Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 +Fixing pointer array-indexing *((word[]) main::words + (byte) main::i) Culled Empty Block (label) main::@2 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/word-array-2.log b/src/test/ref/word-array-2.log index 5374042a2..ebd9ddafe 100644 --- a/src/test/ref/word-array-2.log +++ b/src/test/ref/word-array-2.log @@ -1,7 +1,7 @@ +Adding pointer type conversion cast (word*) main::SCREEN in (word*) main::SCREEN ← (number) $400 Fixing pointer array-indexing *((word[$100]) words + (word~) main::$1) Fixing pointer array-indexing *((word[$100]) words + (word~) main::$0) Fixing pointer array-indexing *((word*) main::SCREEN + (number) 0) -Adding pointer type conversion cast (word*) main::SCREEN in (word*) main::SCREEN ← (number) $400 CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/word-pointer-compound.log b/src/test/ref/word-pointer-compound.log index 15489d149..fbbae4dd3 100644 --- a/src/test/ref/word-pointer-compound.log +++ b/src/test/ref/word-pointer-compound.log @@ -1,12 +1,12 @@ -Fixing pointer array-indexing *((word[]) main::words + (byte) main::i) -Fixing pointer array-indexing *((word[]) main::words + (byte) main::i) -Fixing pointer array-indexing *((word[]) main::words + (number) 0) -Fixing pointer array-indexing *((word[]) main::words + (number) 0) -Fixing pointer array-indexing *((word[]) main::words + (number) 1) -Fixing pointer array-indexing *((word[]) main::words + (number) 1) -Fixing pointer array-indexing *((word[]) main::words + (number) 2) -Fixing pointer array-indexing *((word[]) main::words + (number) 2) Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 +Fixing pointer array-indexing *((word[]) main::words + (byte) main::i) +Fixing pointer array-indexing *((word[]) main::words + (byte) main::i) +Fixing pointer array-indexing *((word[]) main::words + (number) 0) +Fixing pointer array-indexing *((word[]) main::words + (number) 0) +Fixing pointer array-indexing *((word[]) main::words + (number) 1) +Fixing pointer array-indexing *((word[]) main::words + (number) 1) +Fixing pointer array-indexing *((word[]) main::words + (number) 2) +Fixing pointer array-indexing *((word[]) main::words + (number) 2) CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/word-pointer-iteration-0.log b/src/test/ref/word-pointer-iteration-0.log index 1edfbbbce..f8181a526 100644 --- a/src/test/ref/word-pointer-iteration-0.log +++ b/src/test/ref/word-pointer-iteration-0.log @@ -1,8 +1,8 @@ +Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400+(number) $28*(number) 6 +Adding pointer type conversion cast (word*) main::wp in (word*) main::wp ← (number) $400 Fixing pointer increment (word*) main::wp ← ++ (word*) main::wp Fixing pointer increment (word*) main::wp ← ++ (word*) main::wp Fixing pointer decrement (word*) main::wp ← -- (word*) main::wp -Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400+(number) $28*(number) 6 -Adding pointer type conversion cast (word*) main::wp in (word*) main::wp ← (number) $400 CONTROL FLOW GRAPH SSA @begin: scope:[] from diff --git a/src/test/ref/word-pointer-iteration.log b/src/test/ref/word-pointer-iteration.log index f98ff815f..51a733b1d 100644 --- a/src/test/ref/word-pointer-iteration.log +++ b/src/test/ref/word-pointer-iteration.log @@ -1,5 +1,5 @@ -Fixing pointer increment (word*) main::wp ← ++ (word*) main::wp Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 +Fixing pointer increment (word*) main::wp ← ++ (word*) main::wp Culled Empty Block (label) main::@2 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/word-pointer-math-0.log b/src/test/ref/word-pointer-math-0.log index ec7e8aa5d..0d4ec68d2 100644 --- a/src/test/ref/word-pointer-math-0.log +++ b/src/test/ref/word-pointer-math-0.log @@ -1,7 +1,7 @@ -Fixing pointer addition (word*~) main::$0 ← (word*) main::words + (number) 1 -Fixing pointer addition (word*~) main::$3 ← (word*) main::words + (number) 2 Adding pointer type conversion cast (word*) main::words in (word*) main::words ← (number) $400 Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400+(number) 6*(number) $28 +Fixing pointer addition (word*~) main::$0 ← (word*) main::words + (number) 1 +Fixing pointer addition (word*~) main::$3 ← (word*) main::words + (number) 2 Identified constant variable (word*) main::words CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/word-pointer-math.log b/src/test/ref/word-pointer-math.log index 99f3cbce8..563952424 100644 --- a/src/test/ref/word-pointer-math.log +++ b/src/test/ref/word-pointer-math.log @@ -1,5 +1,5 @@ -Fixing pointer addition (word*~) main::$0 ← (word[]) main::words + (byte) main::i Adding pointer type conversion cast (byte*) main::SCREEN in (byte*) main::SCREEN ← (number) $400 +Fixing pointer addition (word*~) main::$0 ← (word[]) main::words + (byte) main::i Culled Empty Block (label) main::@2 CONTROL FLOW GRAPH SSA