diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index bf72c2051..74445a9ff 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -155,7 +155,7 @@ public class Compiler { new Pass1UnwindBlockScopes(program).execute(); new Pass1Procedures(program).execute(); new PassNTypeInference(program).execute(); - new Pass1TypeIdSimplification(program).execute(); + new PassNTypeIdSimplification(program).execute(); if(getLog().isVerbosePass1CreateSsa()) { getLog().append("SYMBOLS"); @@ -165,7 +165,7 @@ public class Compiler { new Pass1FixLValuesLoHi(program).execute(); new Pass1AssertNoLValueIntermediate(program).execute(); new Pass1PointerSizeofFix(program).execute(); - new PassNAddTypeConversions(program).execute(); + new PassNAddTypeConversionsNew(program).execute(); new Pass1EarlyConstantIdentification(program).execute(); new PassNStatementIndices(program).step(); new PassNCallGraphAnalysis(program).step(); @@ -231,9 +231,10 @@ public class Compiler { private void pass2Optimize() { List optimizations = new ArrayList<>(); - optimizations.add(new PassNTypeInference(program)); - optimizations.add(new PassNAddTypeConversions(program)); + optimizations.add(new PassNAddTypeConversionsNew(program)); optimizations.add(new PassNAddNumberTypeConversions(program)); + optimizations.add(new PassNTypeInference(program)); + optimizations.add(new PassNTypeIdSimplification(program)); optimizations.add(new Pass2CullEmptyBlocks(program)); optimizations.add(new PassNStatementIndices(program)); optimizations.add(new PassNVariableReferenceInfos(program)); @@ -264,6 +265,7 @@ public class Compiler { optimizations.add(new Pass2SizeOfSimplification(program)); optimizations.add(new Pass2InlineDerefIdx(program)); optimizations.add(new Pass2DeInlineWordDerefIdx(program)); + optimizations.add(new Pass2ConstantCastSimplification(program)); pass2Execute(optimizations); } @@ -303,6 +305,7 @@ public class Compiler { constantOptimizations.add(new Pass2ConstantIdentification(program)); constantOptimizations.add(new Pass2ConstantAdditionElimination(program)); constantOptimizations.add(new Pass2ConstantSimplification(program)); + constantOptimizations.add(new Pass2ConstantCastSimplification(program)); constantOptimizations.add(new Pass2ConstantIfs(program)); pass2Execute(constantOptimizations); diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/BinaryExpression.java b/src/main/java/dk/camelot64/kickc/model/iterator/BinaryExpression.java deleted file mode 100644 index d0993af17..000000000 --- a/src/main/java/dk/camelot64/kickc/model/iterator/BinaryExpression.java +++ /dev/null @@ -1,166 +0,0 @@ -package dk.camelot64.kickc.model.iterator; - -import dk.camelot64.kickc.model.operators.OperatorBinary; -import dk.camelot64.kickc.model.operators.Operators; -import dk.camelot64.kickc.model.statements.StatementAssignment; -import dk.camelot64.kickc.model.statements.StatementConditionalJump; -import dk.camelot64.kickc.model.types.SymbolType; -import dk.camelot64.kickc.model.values.*; - -/** - * A binary expression in the program being iterated by {@link BinaryExpressionIterator} - */ -public interface BinaryExpression { - - /** - * Get the left operand - * - * @return The left operand - */ - RValue getLeft(); - - /** - * Get the binary operator - * - * @return the operator - */ - OperatorBinary getOperator(); - - /** - * Get the right operand - * - * @return The right operand - */ - RValue getRight(); - - /** - * Adds a cast to the right operand - * @param toType The toType to cast to - */ - void addRightCast(SymbolType toType); - - /** Binary expression assignment rvalue. */ - class BinaryExpressionAssignmentRValue implements BinaryExpression { - private final StatementAssignment assignment; - - BinaryExpressionAssignmentRValue(StatementAssignment assignment) { - this.assignment = assignment; - } - - @Override - public RValue getLeft() { - return assignment.getrValue1(); - } - - @Override - public OperatorBinary getOperator() { - return (OperatorBinary) assignment.getOperator(); - } - - @Override - public RValue getRight() { - return assignment.getrValue2(); - } - - @Override - public void addRightCast(SymbolType toType) { - if(assignment.getrValue2() instanceof ConstantValue) { - assignment.setrValue2(new ConstantCastValue(toType, (ConstantValue) assignment.getrValue2())); - } else { - throw new InternalError("Not implemented!"); - } - } - } - - /** Binary expression - assignment lvalue and the "total" rvalue. */ - class BinaryExpressionAssignmentLValue implements BinaryExpression { - private final StatementAssignment assignment; - - BinaryExpressionAssignmentLValue(StatementAssignment assignment) { - this.assignment = assignment; - } - - @Override - public RValue getLeft() { - return assignment.getlValue(); - } - - @Override - public OperatorBinary getOperator() { - return Operators.ASSIGNMENT; - } - - @Override - public RValue getRight() { - return new AssignmentRValue(assignment); - } - - @Override - public void addRightCast(SymbolType toType) { - throw new InternalError("Not implemented!"); - } - - - } - - - /** Binary expression conditional jump. */ - class BinaryExpressionConditionalJump implements BinaryExpression { - private final StatementConditionalJump conditionalJump; - - BinaryExpressionConditionalJump(StatementConditionalJump assignment) { - this.conditionalJump = assignment; - } - - @Override - public RValue getLeft() { - return conditionalJump.getrValue1(); - } - - @Override - public OperatorBinary getOperator() { - return (OperatorBinary) conditionalJump.getOperator(); - } - - @Override - public RValue getRight() { - return conditionalJump.getrValue2(); - } - - @Override - public void addRightCast(SymbolType toType) { - throw new InternalError("Not implemented!"); - } - - - } - - /** Binary expression as part of a constant expression. */ - class BinaryExpressionConstant implements BinaryExpression { - private ConstantBinary constantBinary; - - BinaryExpressionConstant(ConstantBinary constantBinary) { - this.constantBinary = constantBinary; - } - - @Override - public RValue getLeft() { - return constantBinary.getLeft(); - } - - @Override - public OperatorBinary getOperator() { - return constantBinary.getOperator(); - } - - @Override - public RValue getRight() { - return constantBinary.getRight(); - } - - @Override - public void addRightCast(SymbolType toType) { - constantBinary.setRight(new ConstantCastValue(toType, constantBinary.getRight())); - } - } -} diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpression.java b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpression.java new file mode 100644 index 000000000..68658fc11 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpression.java @@ -0,0 +1,28 @@ +package dk.camelot64.kickc.model.iterator; + +import dk.camelot64.kickc.model.operators.Operator; +import dk.camelot64.kickc.model.values.ConstantRef; +import dk.camelot64.kickc.model.values.RValue; +import dk.camelot64.kickc.model.values.Value; + +/** A unary or binary operator expression. + * Iterable using {@link ProgramExpressionIterator}. + * */ +public interface ProgramExpression { + + /** + * Get the operator + * + * @return the operator + */ + Operator getOperator(); + + /** + * Replace the unary/binary expression with a new value. + * + * Throws an exception if replacement is not possible + * + * @param value The new value. + */ + void set(Value value); +} diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionBinary.java b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionBinary.java new file mode 100644 index 000000000..655ca17e4 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionBinary.java @@ -0,0 +1,262 @@ +package dk.camelot64.kickc.model.iterator; + +import dk.camelot64.kickc.model.Comment; +import dk.camelot64.kickc.model.InternalError; +import dk.camelot64.kickc.model.operators.OperatorBinary; +import dk.camelot64.kickc.model.operators.Operators; +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.symbols.ProgramScope; +import dk.camelot64.kickc.model.symbols.Scope; +import dk.camelot64.kickc.model.symbols.VariableIntermediate; +import dk.camelot64.kickc.model.types.SymbolType; +import dk.camelot64.kickc.model.types.SymbolTypeInference; +import dk.camelot64.kickc.model.values.*; + +import java.util.ListIterator; + +/** + * A binary expression in the program being iterated by {@link ProgramExpressionIterator} + */ +public interface ProgramExpressionBinary extends ProgramExpression { + + /** + * Get the left operand + * + * @return The left operand + */ + RValue getLeft(); + + /** + * Get the binary operator + * + * @return the operator + */ + OperatorBinary getOperator(); + + /** + * Get the right operand + * + * @return The right operand + */ + RValue getRight(); + + /** + * Adds a cast to the left operand + * @param toType The toType to cast to + */ + void addLeftCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols); + + /** + * Adds a cast to the right operand + * @param toType The toType to cast to + */ + void addRightCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols); + + + /** Binary expression assignment rvalue. */ + class ProgramExpressionBinaryAssignmentRValue implements ProgramExpressionBinary { + + private final StatementAssignment assignment; + + ProgramExpressionBinaryAssignmentRValue(StatementAssignment assignment) { + this.assignment = assignment; + } + + @Override + public RValue getLeft() { + return assignment.getrValue1(); + } + + @Override + public OperatorBinary getOperator() { + return (OperatorBinary) assignment.getOperator(); + } + + @Override + public RValue getRight() { + return assignment.getrValue2(); + } + + @Override + public void set(Value value) { + assignment.setrValue2((RValue) value); + assignment.setOperator(null); + assignment.setrValue1(null); + } + + @Override + public void addLeftCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols) { + if(assignment.getrValue1() instanceof ConstantValue) { + assignment.setrValue1(new ConstantCastValue(toType, (ConstantValue) assignment.getrValue1())); + } else { + Scope blockScope = symbols.getScope(currentScope); + VariableIntermediate tmpVar = blockScope.addVariableIntermediate(); + tmpVar.setType(toType); + StatementAssignment newAssignment = new StatementAssignment(tmpVar.getRef(), Operators.getCastUnary(toType), assignment.getrValue1(), assignment.getSource(), Comment.NO_COMMENTS); + assignment.setrValue1(tmpVar.getRef()); + stmtIt.add(newAssignment); + } + } + + @Override + public void addRightCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols) { + if(assignment.getrValue2() instanceof ConstantValue) { + assignment.setrValue2(new ConstantCastValue(toType, (ConstantValue) assignment.getrValue2())); + } else { + Scope blockScope = symbols.getScope(currentScope); + VariableIntermediate tmpVar = blockScope.addVariableIntermediate(); + tmpVar.setType(toType); + StatementAssignment newAssignment = new StatementAssignment(tmpVar.getRef(), Operators.getCastUnary(toType), assignment.getrValue2(), assignment.getSource(), Comment.NO_COMMENTS); + assignment.setrValue2(tmpVar.getRef()); + stmtIt.add(newAssignment); + } + } + } + + /** Binary expression - assignment lvalue and the "total" rvalue. */ + class ProgramExpressionBinaryAssignmentLValue implements ProgramExpressionBinary { + private final StatementAssignment assignment; + + ProgramExpressionBinaryAssignmentLValue(StatementAssignment assignment) { + this.assignment = assignment; + } + + @Override + public RValue getLeft() { + return assignment.getlValue(); + } + + @Override + public OperatorBinary getOperator() { + return Operators.ASSIGNMENT; + } + + @Override + public RValue getRight() { + if(assignment.getrValue1()==null && assignment.getOperator()==null) { + return assignment.getrValue2(); + } else { + return new AssignmentRValue(assignment); + } + } + + @Override + public void set(Value value) { + throw new InternalError("Updating an entire assignment is not allowed!"); + } + + @Override + public void addLeftCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols) { + Scope blockScope = symbols.getScope(currentScope); + VariableIntermediate tmpVar = blockScope.addVariableIntermediate(); + SymbolType rightType = SymbolTypeInference.inferType(symbols, getRight()); + tmpVar.setType(rightType); + StatementAssignment newAssignment = new StatementAssignment(assignment.getlValue(), Operators.getCastUnary(toType), tmpVar.getRef(), assignment.getSource(), Comment.NO_COMMENTS); + assignment.setlValue(tmpVar.getRef()); + stmtIt.add(newAssignment); + } + + @Override + public void addRightCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols) { + if(assignment.getrValue1()==null && assignment.getOperator()==null) { + //if(assignment.getrValue2() instanceof ConstantInteger) { + // ((ConstantInteger) assignment.getrValue2()).setType(toType); + //} else { + assignment.setOperator(Operators.getCastUnary(toType)); + //} + } else { + throw new InternalError("Not implemented!"); + } + } + + } + + /** Binary expression conditional jump. */ + class ProgramExpressionBinaryConditionalJump implements ProgramExpressionBinary { + private final StatementConditionalJump conditionalJump; + + ProgramExpressionBinaryConditionalJump(StatementConditionalJump assignment) { + this.conditionalJump = assignment; + } + + @Override + public RValue getLeft() { + return conditionalJump.getrValue1(); + } + + @Override + public OperatorBinary getOperator() { + return (OperatorBinary) conditionalJump.getOperator(); + } + + @Override + public RValue getRight() { + return conditionalJump.getrValue2(); + } + + @Override + public void set(Value value) { + conditionalJump.setrValue2((RValue) value); + conditionalJump.setOperator(null); + conditionalJump.setrValue1(null); + } + + @Override + public void addLeftCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols) { + throw new InternalError("Not implemented!"); + } + + @Override + public void addRightCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols) { + throw new InternalError("Not implemented!"); + } + + + } + + /** Binary expression as part of a constant expression. */ + class ProgramExpressionBinaryConstant implements ProgramExpressionBinary { + /** A program value containing a {@link ConstantBinary}. */ + private ProgramValue programValue; + + public ProgramExpressionBinaryConstant(ProgramValue programValue) { + this.programValue = programValue; + } + + public ConstantBinary getConstantBinary() { + return (ConstantBinary)programValue.get(); + } + + @Override + public RValue getLeft() { + return getConstantBinary().getLeft(); + } + + @Override + public OperatorBinary getOperator() { + return getConstantBinary().getOperator(); + } + + @Override + public RValue getRight() { + return getConstantBinary().getRight(); + } + + @Override + public void set(Value value) { + programValue.set(value); + } + + @Override + public void addLeftCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols) { + getConstantBinary().setLeft(new ConstantCastValue(toType, getConstantBinary().getLeft())); + } + + @Override + public void addRightCast(SymbolType toType, ListIterator stmtIt, ScopeRef currentScope, ProgramScope symbols) { + getConstantBinary().setRight(new ConstantCastValue(toType, getConstantBinary().getRight())); + } + } +} diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/BinaryExpressionHandler.java b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionHandler.java similarity index 51% rename from src/main/java/dk/camelot64/kickc/model/iterator/BinaryExpressionHandler.java rename to src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionHandler.java index f5b10f5e0..077eb7cdd 100644 --- a/src/main/java/dk/camelot64/kickc/model/iterator/BinaryExpressionHandler.java +++ b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionHandler.java @@ -5,21 +5,22 @@ import dk.camelot64.kickc.model.statements.Statement; import java.util.ListIterator; -/** A handler that performs some action for binary expressions in the program. - * A {@link BinaryExpressionIterator} can be used to iterate all binary expressions in a part of the program. - * The Handler then receives all binary expressions one at a time. The Handler has the option of modifying the binary expression. After the handler is executed all sub-values are recursed. +/** A handler that performs some action for unary/binary expressions in the program. + * A {@link ProgramExpressionIterator} can be used to iterate all unary/binary expressions in a part of the program. + * The Handler then receives all unary/binary expressions one at a time. + * The Handler has the option of modifying the expression. After the handler is executed all sub-values are recursed. * The execute() method furthermore receives some extra parameters with information about the context of the passed value. */ -public interface BinaryExpressionHandler { +public interface ProgramExpressionHandler { /** - * Handle a single binary expression + * Handle a single expression * - * @param binaryExpression The binary expression + * @param programExpression The expression * @param currentStmt The statement iterator - just past the current statement that the value is a part of. Current statment can be retrieved by calling * @param stmtIt The statement iterator - just past the current statement. Can be used for modifying the control flow block. * @param currentBlock The current block that the value is a part of */ - void execute(BinaryExpression binaryExpression, Statement currentStmt, ListIterator stmtIt, ControlFlowBlock currentBlock); + void execute(ProgramExpression programExpression, Statement currentStmt, ListIterator stmtIt, ControlFlowBlock currentBlock); } diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/BinaryExpressionIterator.java b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionIterator.java similarity index 56% rename from src/main/java/dk/camelot64/kickc/model/iterator/BinaryExpressionIterator.java rename to src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionIterator.java index 05c761267..a8ae53aca 100644 --- a/src/main/java/dk/camelot64/kickc/model/iterator/BinaryExpressionIterator.java +++ b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionIterator.java @@ -6,15 +6,16 @@ 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.values.ConstantBinary; +import dk.camelot64.kickc.model.values.ConstantUnary; import java.util.ListIterator; /** * Capable of iterating the different structures of a Program (graph, block, statement, symboltable, symbol). - * Creates appropriate BinaryExpressions and passes them to a BinaryExpressionHandler. + * Creates appropriate BinaryExpressions and passes them to a ProgramExpressionHandler. * Iteration might be guided (eg. filtering some types of the structure to iterate at call-time) */ -public class BinaryExpressionIterator { +public class ProgramExpressionIterator { /** * Execute a handler on all values in the entire program (both in the control flow graph and the symbol table.) @@ -22,12 +23,11 @@ public class BinaryExpressionIterator { * @param program The program * @param handler The handler to execute */ - public static void execute(Program program, BinaryExpressionHandler handler) { + public static void execute(Program program, ProgramExpressionHandler handler) { // Iterate all symbols ProgramValueIterator.execute(program.getScope(), (programValue, currentStmt, stmtIt, currentBlock) -> { if(programValue.get() instanceof ConstantBinary) { - ConstantBinary constantBinary = (ConstantBinary) programValue.get(); - handler.execute( new BinaryExpression.BinaryExpressionConstant(constantBinary), null, null, null); + handler.execute(new ProgramExpressionBinary.ProgramExpressionBinaryConstant(programValue), null, null, null); } }); @@ -38,22 +38,26 @@ public class BinaryExpressionIterator { Statement stmt = stmtIt.next(); if(stmt instanceof StatementAssignment) { StatementAssignment assignment = (StatementAssignment) stmt; - if(assignment.getrValue1() != null && assignment.getOperator()!=null &&assignment.getrValue2() != null) { - handler.execute( new BinaryExpression.BinaryExpressionAssignmentRValue(assignment), stmt, stmtIt, block); + if(assignment.getrValue1() != null && assignment.getOperator() != null && assignment.getrValue2() != null) { + handler.execute(new ProgramExpressionBinary.ProgramExpressionBinaryAssignmentRValue(assignment), stmt, stmtIt, block); + } else if(assignment.getrValue1() == null && assignment.getOperator() != null && assignment.getrValue2() != null) { + handler.execute(new ProgramExpressionUnary.ProgramExpressionUnaryAssignmentRValue(assignment), stmt, stmtIt, block); } - handler.execute( new BinaryExpression.BinaryExpressionAssignmentLValue(assignment), stmt, stmtIt, block); + handler.execute(new ProgramExpressionBinary.ProgramExpressionBinaryAssignmentLValue(assignment), stmt, stmtIt, block); } else if(stmt instanceof StatementConditionalJump) { StatementConditionalJump condJump = (StatementConditionalJump) stmt; - if(condJump.getrValue1()!=null && condJump.getOperator()!=null && condJump.getrValue2()!=null) { - handler.execute( new BinaryExpression.BinaryExpressionConditionalJump(condJump), stmt, stmtIt, block); + if(condJump.getrValue1() != null && condJump.getOperator() != null && condJump.getrValue2() != null) { + handler.execute(new ProgramExpressionBinary.ProgramExpressionBinaryConditionalJump(condJump), stmt, stmtIt, block); } } // Iterate all statement values ProgramValueIterator.execute(stmt, (programValue, currentStmt, stmtIt1, currentBlock) -> { if(programValue.get() instanceof ConstantBinary) { - ConstantBinary constantBinary = (ConstantBinary) programValue.get(); - handler.execute( new BinaryExpression.BinaryExpressionConstant(constantBinary), stmt, stmtIt, block); + handler.execute(new ProgramExpressionBinary.ProgramExpressionBinaryConstant(programValue), stmt, stmtIt, block); + } else if(programValue.get() instanceof ConstantUnary) { + handler.execute(new ProgramExpressionUnary.ProgramExpressionUnaryConstant(programValue), stmt, stmtIt, block); } + }, stmtIt, block); } } diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionUnary.java b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionUnary.java new file mode 100644 index 000000000..a2795032d --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramExpressionUnary.java @@ -0,0 +1,84 @@ +package dk.camelot64.kickc.model.iterator; + +import dk.camelot64.kickc.model.operators.OperatorUnary; +import dk.camelot64.kickc.model.statements.StatementAssignment; +import dk.camelot64.kickc.model.values.ConstantUnary; +import dk.camelot64.kickc.model.values.RValue; +import dk.camelot64.kickc.model.values.Value; + +/** + * A binary expression in the program being iterated by {@link ProgramExpressionIterator} + */ +public interface ProgramExpressionUnary extends ProgramExpression { + + /** + * Get the unary operator + * + * @return the operator + */ + OperatorUnary getOperator(); + + /** + * Get the right operand + * + * @return The right operand + */ + RValue getOperand(); + + /** Unary expression assignment rvalue. */ + class ProgramExpressionUnaryAssignmentRValue implements ProgramExpressionUnary { + private final StatementAssignment assignment; + + ProgramExpressionUnaryAssignmentRValue(StatementAssignment assignment) { + this.assignment = assignment; + } + + @Override + public OperatorUnary getOperator() { + return (OperatorUnary) assignment.getOperator(); + } + + @Override + public RValue getOperand() { + return assignment.getrValue2(); + } + + @Override + public void set(Value value) { + assignment.setrValue2((RValue) value); + assignment.setOperator(null); + } + } + + /** Unary expression as part of a constant expression. */ + class ProgramExpressionUnaryConstant implements ProgramExpressionUnary { + + /** A ProgramValue containing a {@link ConstantUnary}. */ + private ProgramValue programValue; + + ProgramExpressionUnaryConstant(ProgramValue programValue) { + this.programValue = programValue; + } + + public ConstantUnary getConstantUnary() { + return (ConstantUnary) programValue.get(); + } + + @Override + public OperatorUnary getOperator() { + return (getConstantUnary()).getOperator(); + } + + @Override + public RValue getOperand() { + return getConstantUnary().getOperand(); + } + + @Override + public void set(Value value) { + programValue.set(value); + } + + } + +} diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValue.java b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValue.java index 9f34e3c20..551863bf9 100644 --- a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValue.java +++ b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValue.java @@ -7,489 +7,23 @@ import dk.camelot64.kickc.model.types.SymbolTypeArray; import dk.camelot64.kickc.model.values.*; /** - * An RValue in the program being iterated by {@link ProgramValueIterator}. + * Any Value in the program being iterated by {@link ProgramValueIterator}. * - * The RValue can be inspected using get() and replaced inside the model using set(val). + * The Value can be inspected using get() and replaced inside the model using set(val). * - * The context of the RValue can be determined from the sub-class containing it plus the parameters to the ProgramValueHandler. + * The context of the Value can be determined from the sub-class containing it plus the parameters to the ProgramValueHandler. * */ -public abstract class ProgramValue { +public interface ProgramValue { - public abstract Value get(); + Value get(); - public abstract void set(Value value); + void set(Value value); - public static class ConstantVariableValue extends ProgramValue { - private final ConstantVar constantVar; - - ConstantVariableValue(ConstantVar constantVar) { - this.constantVar = constantVar; - } - - @Override - public Value get() { - return constantVar.getValue(); - } - - @Override - public void set(Value val) { - constantVar.setValue((ConstantValue) val); - } - - } - - /** Size inside a fixed size array. */ - public static class TypeArraySize extends ProgramValue { - private final SymbolTypeArray array; - - TypeArraySize(SymbolTypeArray array) { - this.array = array; - } - - @Override - public Value get() { - return array.getSize(); - } - - @Override - public void set(Value val) { - array.setSize((RValue) val); - } - - } - - /** Value inside a array filled expression. */ - public static class ArrayFilledSize extends ProgramValue { - private final ArrayFilled array; - - ArrayFilledSize(ArrayFilled array) { - this.array = array; - } - - @Override - public Value get() { - return array.getSize(); - } - - @Override - public void set(Value val) { - array.setSize((RValue) val); - } - - } - - /** Value inside an intermediate LValue. */ - public static class LValueIntermediateVariable extends ProgramValue { - private final LvalueIntermediate intermediate; - - LValueIntermediateVariable(LvalueIntermediate intermediate) { - this.intermediate = intermediate; - } - - @Override - public Value get() { - return intermediate.getVariable(); - } - - @Override - public void set(Value val) { - intermediate.setVariable((VariableRef) val); - } - - } - - /** Value inside a constant array filled expression. */ - public static class ConstantArrayFilledSize extends ProgramValue { - private final ConstantArrayFilled array; - - ConstantArrayFilledSize(ConstantArrayFilled array) { - this.array = array; - } - - @Override - public Value get() { - return array.getSize(); - } - - @Override - public void set(Value val) { - array.setSize((ConstantValue) val); - } - - } - - /** Value inside a constant unary expression. */ - public static class ConstantUnaryValue extends ProgramValue { - private final ConstantUnary unary; - - ConstantUnaryValue(ConstantUnary unary) { - this.unary = unary; - } - - @Override - public Value get() { - return unary.getOperand(); - } - - @Override - public void set(Value val) { - unary.setOperand((ConstantValue) val); - } - - } - - /** Left value inside a constant binary expression. */ - public static class ConstantBinaryLeft extends ProgramValue { - private final ConstantBinary binary; - - ConstantBinaryLeft(ConstantBinary binary) { - this.binary = binary; - } - - @Override - public Value get() { - return binary.getLeft(); - } - - @Override - public void set(Value val) { - binary.setLeft((ConstantValue) val); - } - - } - - /** Right value inside a constant binary expression. */ - public static class ConstantBinaryRight extends ProgramValue { - private final ConstantBinary binary; - - ConstantBinaryRight(ConstantBinary range) { - this.binary = range; - } - - @Override - public Value get() { - return binary.getRight(); - } - - @Override - public void set(Value val) { - binary.setRight((ConstantValue) val); - } - - } - - /** - * First value inside a ranged comparison value. - */ - public static class RangeFirst extends ProgramValue { - private final RangeValue range; - - RangeFirst(RangeValue range) { - this.range = range; - } - - @Override - public Value get() { - return range.getRangeFirst(); - } - - @Override - public void set(Value val) { - range.setRangeFirst((RValue) val); - } - - } - - /** - * Last value inside inside a ranged comparison value. - */ - public static class RangeLast extends ProgramValue { - private final RangeValue range; - - RangeLast(RangeValue range) { - this.range = range; - } - - @Override - public Value get() { - return range.getRangeLast(); - } - - @Override - public void set(Value val) { - range.setRangeLast((RValue) val); - } - - } - - /** A variable/constant referenced inside inline ASM. */ - public static class AsmReferenced extends ProgramValue { - private StatementAsm statementAsm; - private String label; - - public AsmReferenced(StatementAsm statementAsm, String label) { - this.statementAsm = statementAsm; - this.label = label; - } - - @Override - public Value get() { - return statementAsm.getReferenced().get(label); - } - - @Override - public void set(Value value) { - statementAsm.getReferenced().put(label, (SymbolVariableRef) value); - } - } - - /** Location inside inline kickasm code. */ - public static class KickAsmLocation extends ProgramValue { - - private StatementKickAsm statementKickAsm; - - KickAsmLocation(StatementKickAsm statementKickAsm) { - super(); - this.statementKickAsm = statementKickAsm; - } - - @Override - public Value get() { - return statementKickAsm.getLocation(); - } - - @Override - public void set(Value value) { - statementKickAsm.setLocation((RValue) value); - } - - } - - /** Bytes inside inline kickasm code. */ - public static class KickAsmBytes extends ProgramValue { - - private StatementKickAsm statementKickAsm; - - KickAsmBytes(StatementKickAsm statementKickAsm) { - super(); - this.statementKickAsm = statementKickAsm; - } - - @Override - public Value get() { - return statementKickAsm.getBytes(); - } - - @Override - public void set(Value value) { - statementKickAsm.setBytes((RValue) value); - } - - } - - /** Cycles inside inline kickasm code. */ - public static class KickAsmCycles extends ProgramValue { - - private StatementKickAsm statementKickAsm; - - KickAsmCycles(StatementKickAsm statementKickAsm) { - super(); - this.statementKickAsm = statementKickAsm; - } - - @Override - public Value get() { - return statementKickAsm.getCycles(); - } - - @Override - public void set(Value value) { - statementKickAsm.setCycles((RValue) value); - } - - } - - /** - * LValue as part of an assignment statement (or a call). - */ - public static class LValue extends ProgramValue { - private final StatementLValue statement; - - public LValue(StatementLValue statement) { - this.statement = statement; - } - - @Override - public Value get() { - return statement.getlValue(); - } - - @Override - public void set(Value value) { - statement.setlValue((dk.camelot64.kickc.model.values.LValue) value); - } - - } - - /** - * Pointer inside a pointer dererence value. - */ - public static class Pointer extends ProgramValue { - private final PointerDereference pointer; - - Pointer(PointerDereference pointer) { - this.pointer = pointer; - } - - @Override - public Value get() { - return pointer.getPointer(); - } - - @Override - public void set(Value val) { - pointer.setPointer((RValue) val); - } - - } - - /** - * Value inside a noop cast. - */ - public static class CastValue extends ProgramValue { - private final dk.camelot64.kickc.model.values.CastValue castValue; - - - public CastValue(dk.camelot64.kickc.model.values.CastValue castValue) { - this.castValue = castValue; - } - - @Override - public Value get() { - return castValue.getValue(); - } - - @Override - public void set(Value val) { - castValue.setValue((RValue) val); - } - - } - - /** - * Value inside a constant noop cast. - */ - public static class ConstantCastValue extends ProgramValue { - private final dk.camelot64.kickc.model.values.ConstantCastValue castValue; - - - ConstantCastValue(dk.camelot64.kickc.model.values.ConstantCastValue castValue) { - this.castValue = castValue; - } - - @Override - public Value get() { - return castValue.getValue(); - } - - @Override - public void set(Value val) { - castValue.setValue((ConstantValue) val); - } - - } - - /** - * Pointer inside a variable pointer. - */ - public static class ConstantSymbolPointerTo extends ProgramValue { - private final ConstantSymbolPointer varPointer; - - - ConstantSymbolPointerTo(ConstantSymbolPointer varPointer) { - this.varPointer = varPointer; - } - - @Override - public Value get() { - return (RValue) varPointer.getToSymbol(); - } - - @Override - public void set(Value val) { - varPointer.setToSymbol((VariableRef) val); - } - - } - - public static class ConstantArrayElement extends ProgramValue { - private final ConstantArrayList arrayList; - private final int idx; - - ConstantArrayElement(ConstantArrayList arrayList, int idx) { - this.arrayList = arrayList; - this.idx = idx; - } - - @Override - public Value get() { - return arrayList.getElements().get(idx); - } - - @Override - public void set(Value value) { - arrayList.getElements().set(idx, (ConstantValue) value); - } - } - - public static class ListElement extends ProgramValue { - private ValueList list; - private int idx; - - ListElement(ValueList list, int idx) { - this.list = list; - this.idx = idx; - } - - @Override - public Value get() { - return list.getList().get(idx); - } - - @Override - public void set(Value value) { - list.getList().set(idx, (RValue) value); - } - - } - - /** - * Pointer index inside a indexed pointer dererence value. - */ - public static class PointerIndex extends ProgramValue { - private final PointerDereferenceIndexed pointer; - - PointerIndex(PointerDereferenceIndexed pointer) { - this.pointer = pointer; - } - - @Override - public Value get() { - return pointer.getIndex(); - } - - @Override - public void set(Value val) { - pointer.setIndex((RValue) val); - } - - } - - public static class RValue1 extends ProgramValue { + class RValue1 implements ProgramValue { private final StatementAssignment statement; - public RValue1(StatementAssignment statement) { + RValue1(StatementAssignment statement) { this.statement = statement; } @@ -504,10 +38,10 @@ public abstract class ProgramValue { } } - public static class RValue2 extends ProgramValue { + class RValue2 implements ProgramValue { private final StatementAssignment statement; - public RValue2(StatementAssignment statement) { + RValue2(StatementAssignment statement) { this.statement = statement; } @@ -522,7 +56,7 @@ public abstract class ProgramValue { } } - public static class CallParameter extends ProgramValue { + class CallParameter implements ProgramValue { private final StatementCall call; private final int i; @@ -542,7 +76,7 @@ public abstract class ProgramValue { } } - public static class CallPointerProcedure extends ProgramValue { + class CallPointerProcedure implements ProgramValue { private final StatementCallPointer call; CallPointerProcedure(StatementCallPointer call) { @@ -560,7 +94,7 @@ public abstract class ProgramValue { } } - public static class CallPointerParameter extends ProgramValue { + class CallPointerParameter implements ProgramValue { private final StatementCallPointer call; private final int i; @@ -580,10 +114,10 @@ public abstract class ProgramValue { } } - public static class CondRValue1 extends ProgramValue { + class CondRValue1 implements ProgramValue { private final StatementConditionalJump statement; - public CondRValue1(StatementConditionalJump statement) { + CondRValue1(StatementConditionalJump statement) { this.statement = statement; } @@ -598,10 +132,10 @@ public abstract class ProgramValue { } } - public static class CondRValue2 extends ProgramValue { + class CondRValue2 implements ProgramValue { private final StatementConditionalJump statement; - public CondRValue2(StatementConditionalJump statement) { + CondRValue2(StatementConditionalJump statement) { this.statement = statement; } @@ -616,10 +150,10 @@ public abstract class ProgramValue { } } - public static class CondLabel extends ProgramValue { + class CondLabel implements ProgramValue { private final StatementConditionalJump statement; - public CondLabel(StatementConditionalJump statement) { + CondLabel(StatementConditionalJump statement) { this.statement = statement; } @@ -634,7 +168,7 @@ public abstract class ProgramValue { } } - public static class Return extends ProgramValue { + class Return implements ProgramValue { private final StatementReturn statement; public Return(StatementReturn statement) { @@ -652,7 +186,7 @@ public abstract class ProgramValue { } } - public static class PhiValue extends ProgramValue { + class PhiValue implements ProgramValue { private final StatementPhiBlock.PhiVariable phiVariable; private final int i; @@ -672,7 +206,7 @@ public abstract class ProgramValue { } } - public static class PhiValuePredecessor extends ProgramValue { + class PhiValuePredecessor implements ProgramValue { private final StatementPhiBlock.PhiVariable phiVariable; private final int i; @@ -695,7 +229,7 @@ public abstract class ProgramValue { /** * LValue as part of an assignment statement (or a call). */ - public static class PhiVariable extends ProgramValue { + class PhiVariable implements ProgramValue { private final StatementPhiBlock.PhiVariable phiVariable; public PhiVariable(StatementPhiBlock.PhiVariable phiVariable) { @@ -715,7 +249,7 @@ public abstract class ProgramValue { } /** A generic Value. */ - public static class GenericValue extends ProgramValue { + class GenericValue implements ProgramValue { private RValue rValue; public GenericValue(RValue rValue) { @@ -734,11 +268,11 @@ public abstract class ProgramValue { } /** A variable used by inline kickasm. */ - public static class KickAsmUses extends ProgramValue { + class KickAsmUses implements ProgramValue { private StatementKickAsm statementKickAsm; private int idx; - public KickAsmUses(StatementKickAsm statementKickAsm, int idx) { + KickAsmUses(StatementKickAsm statementKickAsm, int idx) { this.statementKickAsm = statementKickAsm; this.idx = idx; } @@ -756,7 +290,7 @@ public abstract class ProgramValue { } - public static class BlockLabel extends ProgramValue { + class BlockLabel implements ProgramValue { private final ControlFlowBlock block; @@ -776,7 +310,7 @@ public abstract class ProgramValue { } - public static class BlockDefaultSuccessor extends ProgramValue { + class BlockDefaultSuccessor implements ProgramValue { private final ControlFlowBlock block; @@ -796,7 +330,7 @@ public abstract class ProgramValue { } - public static class BlockConditionalSuccessor extends ProgramValue { + class BlockConditionalSuccessor implements ProgramValue { private final ControlFlowBlock block; @@ -816,7 +350,7 @@ public abstract class ProgramValue { } - public static class BlockCallSuccessor extends ProgramValue { + class BlockCallSuccessor implements ProgramValue { private final ControlFlowBlock block; @@ -836,4 +370,467 @@ public abstract class ProgramValue { } + /** Value inside a array filled expression. */ + class ProgramValueArrayFilledSize implements ProgramValue { + private final ArrayFilled array; + + ProgramValueArrayFilledSize(ArrayFilled array) { + this.array = array; + } + + @Override + public Value get() { + return array.getSize(); + } + + @Override + public void set(Value val) { + array.setSize((RValue) val); + } + + } + + /** A variable/constant referenced inside inline ASM. */ + class ProgramValueAsmReferenced implements ProgramValue { + private StatementAsm statementAsm; + private String label; + + ProgramValueAsmReferenced(StatementAsm statementAsm, String label) { + this.statementAsm = statementAsm; + this.label = label; + } + + @Override + public Value get() { + return statementAsm.getReferenced().get(label); + } + + @Override + public void set(Value value) { + statementAsm.getReferenced().put(label, (SymbolVariableRef) value); + } + } + + /** + * Value inside a noop cast. + */ + class ProgramValueCastValue implements ProgramValue { + private final CastValue castValue; + + + public ProgramValueCastValue(CastValue castValue) { + this.castValue = castValue; + } + + @Override + public Value get() { + return castValue.getValue(); + } + + @Override + public void set(Value val) { + castValue.setValue((RValue) val); + } + + } + + class ProgramValueConstantArrayElement implements ProgramValue { + private final ConstantArrayList arrayList; + private final int idx; + + ProgramValueConstantArrayElement(ConstantArrayList arrayList, int idx) { + this.arrayList = arrayList; + this.idx = idx; + } + + @Override + public Value get() { + return arrayList.getElements().get(idx); + } + + @Override + public void set(Value value) { + arrayList.getElements().set(idx, (ConstantValue) value); + } + } + + /** Value inside a constant array filled expression. */ + class ProgramValueConstantArrayFilledSize implements ProgramValue { + private final ConstantArrayFilled array; + + ProgramValueConstantArrayFilledSize(ConstantArrayFilled array) { + this.array = array; + } + + @Override + public Value get() { + return array.getSize(); + } + + @Override + public void set(Value val) { + array.setSize((ConstantValue) val); + } + + } + + /** Left value inside a constant binary expression. */ + class ProgramValueConstantBinaryLeft implements ProgramValue { + private final ConstantBinary binary; + + ProgramValueConstantBinaryLeft(ConstantBinary binary) { + this.binary = binary; + } + + @Override + public Value get() { + return binary.getLeft(); + } + + @Override + public void set(Value val) { + binary.setLeft((ConstantValue) val); + } + + } + + /** Right value inside a constant binary expression. */ + class ProgramValueConstantBinaryRight implements ProgramValue { + private final ConstantBinary binary; + + ProgramValueConstantBinaryRight(ConstantBinary range) { + this.binary = range; + } + + @Override + public Value get() { + return binary.getRight(); + } + + @Override + public void set(Value val) { + binary.setRight((ConstantValue) val); + } + + } + + /** + * Value inside a constant noop cast. + */ + class ProgramValueConstantCastValue implements ProgramValue { + private final ConstantCastValue castValue; + + + ProgramValueConstantCastValue(ConstantCastValue castValue) { + this.castValue = castValue; + } + + @Override + public Value get() { + return castValue.getValue(); + } + + @Override + public void set(Value val) { + castValue.setValue((ConstantValue) val); + } + + } + + /** + * Pointer inside a variable pointer. + */ + class ProgramValueConstantSymbolPointerTo implements ProgramValue { + private final ConstantSymbolPointer varPointer; + + + ProgramValueConstantSymbolPointerTo(ConstantSymbolPointer varPointer) { + this.varPointer = varPointer; + } + + @Override + public Value get() { + return varPointer.getToSymbol(); + } + + @Override + public void set(Value val) { + varPointer.setToSymbol((VariableRef) val); + } + + } + + /** Value inside a constant unary expression. */ + class ProgramValueConstantUnaryValue implements ProgramValue { + private final ConstantUnary unary; + + ProgramValueConstantUnaryValue(ConstantUnary unary) { + this.unary = unary; + } + + @Override + public Value get() { + return unary.getOperand(); + } + + @Override + public void set(Value val) { + unary.setOperand((ConstantValue) val); + } + + } + + class ProgramValueConstantVar implements ProgramValue { + private final ConstantVar constantVar; + + ProgramValueConstantVar(ConstantVar constantVar) { + this.constantVar = constantVar; + } + + @Override + public Value get() { + return constantVar.getValue(); + } + + @Override + public void set(Value val) { + constantVar.setValue((ConstantValue) val); + } + + } + + /** Bytes inside inline kickasm code. */ + class ProgramValueKickAsmBytes implements ProgramValue { + + private StatementKickAsm statementKickAsm; + + ProgramValueKickAsmBytes(StatementKickAsm statementKickAsm) { + this.statementKickAsm = statementKickAsm; + } + + @Override + public Value get() { + return statementKickAsm.getBytes(); + } + + @Override + public void set(Value value) { + statementKickAsm.setBytes((RValue) value); + } + + } + + /** Cycles inside inline kickasm code. */ + class ProgramValueKickAsmCycles implements ProgramValue { + + private StatementKickAsm statementKickAsm; + + ProgramValueKickAsmCycles(StatementKickAsm statementKickAsm) { + this.statementKickAsm = statementKickAsm; + } + + @Override + public Value get() { + return statementKickAsm.getCycles(); + } + + @Override + public void set(Value value) { + statementKickAsm.setCycles((RValue) value); + } + + } + + /** Location inside inline kickasm code. */ + class ProgramValueKickAsmLocation implements ProgramValue { + + private StatementKickAsm statementKickAsm; + + ProgramValueKickAsmLocation(StatementKickAsm statementKickAsm) { + super(); + this.statementKickAsm = statementKickAsm; + } + + @Override + public Value get() { + return statementKickAsm.getLocation(); + } + + @Override + public void set(Value value) { + statementKickAsm.setLocation((RValue) value); + } + + } + + class ProgramValueListElement implements ProgramValue { + private ValueList list; + private int idx; + + ProgramValueListElement(ValueList list, int idx) { + this.list = list; + this.idx = idx; + } + + @Override + public Value get() { + return list.getList().get(idx); + } + + @Override + public void set(Value value) { + list.getList().set(idx, (RValue) value); + } + + } + + /** + * LValue as part of an assignment statement (or a call). + */ + class ProgramValueLValue implements ProgramValue { + private final StatementLValue statement; + + public ProgramValueLValue(StatementLValue statement) { + this.statement = statement; + } + + @Override + public Value get() { + return statement.getlValue(); + } + + @Override + public void set(Value value) { + statement.setlValue((LValue) value); + } + + } + + /** Value inside an intermediate LValue. */ + class ProgramValueLValueIntermediateVariable implements ProgramValue { + private final LvalueIntermediate intermediate; + + ProgramValueLValueIntermediateVariable(LvalueIntermediate intermediate) { + this.intermediate = intermediate; + } + + @Override + public Value get() { + return intermediate.getVariable(); + } + + @Override + public void set(Value val) { + intermediate.setVariable((VariableRef) val); + } + + } + + /** + * Pointer inside a pointer dererence value. + */ + class ProgramValuePointer implements ProgramValue { + private final PointerDereference pointer; + + ProgramValuePointer(PointerDereference pointer) { + this.pointer = pointer; + } + + @Override + public Value get() { + return pointer.getPointer(); + } + + @Override + public void set(Value val) { + pointer.setPointer((RValue) val); + } + + } + + /** + * Pointer index inside a indexed pointer dererence value. + */ + class ProgramValuePointerIndex implements ProgramValue { + private final PointerDereferenceIndexed pointer; + + ProgramValuePointerIndex(PointerDereferenceIndexed pointer) { + this.pointer = pointer; + } + + @Override + public Value get() { + return pointer.getIndex(); + } + + @Override + public void set(Value val) { + pointer.setIndex((RValue) val); + } + + } + + /** + * First value inside a ranged comparison value. + */ + class ProgramValueRangeFirst implements ProgramValue { + private final RangeValue range; + + ProgramValueRangeFirst(RangeValue range) { + this.range = range; + } + + @Override + public Value get() { + return range.getRangeFirst(); + } + + @Override + public void set(Value val) { + range.setRangeFirst((RValue) val); + } + + } + + /** + * Last value inside inside a ranged comparison value. + */ + class ProgramValueRangeLast implements ProgramValue { + private final RangeValue range; + + ProgramValueRangeLast(RangeValue range) { + this.range = range; + } + + @Override + public Value get() { + return range.getRangeLast(); + } + + @Override + public void set(Value val) { + range.setRangeLast((RValue) val); + } + + } + + /** Size inside a fixed size array. */ + class ProgramValueTypeArraySize implements ProgramValue { + private final SymbolTypeArray array; + + ProgramValueTypeArraySize(SymbolTypeArray array) { + this.array = array; + } + + @Override + public Value get() { + return array.getSize(); + } + + @Override + public void set(Value val) { + array.setSize((RValue) val); + } + + } } diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValueIterator.java b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValueIterator.java index 7ca0243de..6fe274204 100644 --- a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValueIterator.java +++ b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValueIterator.java @@ -50,10 +50,10 @@ public class ProgramValueIterator { */ public static void execute(SymbolVariable symbolVariable, ProgramValueHandler programValueHandler) { if(symbolVariable.getType() instanceof SymbolTypeArray) { - execute(new ProgramValue.TypeArraySize((SymbolTypeArray) symbolVariable.getType()), programValueHandler, null, null, null); + execute(new ProgramValue.ProgramValueTypeArraySize((SymbolTypeArray) symbolVariable.getType()), programValueHandler, null, null, null); } if(symbolVariable instanceof ConstantVar) { - execute(new ProgramValue.ConstantVariableValue((ConstantVar) symbolVariable), programValueHandler, null, null, null); + execute(new ProgramValue.ProgramValueConstantVar((ConstantVar) symbolVariable), programValueHandler, null, null, null); } } @@ -98,7 +98,7 @@ public class ProgramValueIterator { // The sequence RValue1, RValue2, LValue is important - as it is essential for {@link dk.camelot64.kickc.passes.Pass1GenerateSingleStaticAssignmentForm} to create the correct SSA execute(new ProgramValue.RValue1((StatementAssignment) statement), handler, statement, statementsIt, block); execute(new ProgramValue.RValue2((StatementAssignment) statement), handler, statement, statementsIt, block); - execute(new ProgramValue.LValue((StatementLValue) statement), handler, statement, statementsIt, block); + execute(new ProgramValue.ProgramValueLValue((StatementLValue) statement), handler, statement, statementsIt, block); } else if(statement instanceof StatementCall) { StatementCall call = (StatementCall) statement; if(call.getParameters() != null) { @@ -107,7 +107,7 @@ public class ProgramValueIterator { execute(new ProgramValue.CallParameter(call, i), handler, statement, statementsIt, block); } } - execute(new ProgramValue.LValue((StatementLValue) statement), handler, statement, statementsIt, block); + execute(new ProgramValue.ProgramValueLValue((StatementLValue) statement), handler, statement, statementsIt, block); } else if(statement instanceof StatementCallPointer) { StatementCallPointer call = (StatementCallPointer) statement; execute(new ProgramValue.CallPointerProcedure((StatementCallPointer) statement), handler, statement, statementsIt, block); @@ -117,7 +117,7 @@ public class ProgramValueIterator { execute(new ProgramValue.CallPointerParameter(call, i), handler, statement, statementsIt, block); } } - execute(new ProgramValue.LValue((StatementLValue) statement), handler, statement, statementsIt, block); + execute(new ProgramValue.ProgramValueLValue((StatementLValue) statement), handler, statement, statementsIt, block); } else if(statement instanceof StatementConditionalJump) { execute(new ProgramValue.CondRValue1((StatementConditionalJump) statement), handler, statement, statementsIt, block); execute(new ProgramValue.CondRValue2((StatementConditionalJump) statement), handler, statement, statementsIt, block); @@ -137,15 +137,15 @@ public class ProgramValueIterator { StatementKickAsm statementKickAsm = (StatementKickAsm) statement; RValue location = statementKickAsm.getLocation(); if(location!=null) { - execute(new ProgramValue.KickAsmLocation(statementKickAsm), handler, statement, statementsIt, block); + execute(new ProgramValue.ProgramValueKickAsmLocation(statementKickAsm), handler, statement, statementsIt, block); } RValue bytes = statementKickAsm.getLocation(); if(bytes!=null) { - execute(new ProgramValue.KickAsmBytes(statementKickAsm), handler, statement, statementsIt, block); + execute(new ProgramValue.ProgramValueKickAsmBytes(statementKickAsm), handler, statement, statementsIt, block); } RValue cycles = statementKickAsm.getLocation(); if(cycles!=null) { - execute(new ProgramValue.KickAsmCycles(statementKickAsm), handler, statement, statementsIt, block); + execute(new ProgramValue.ProgramValueKickAsmCycles(statementKickAsm), handler, statement, statementsIt, block); } List uses = statementKickAsm.getUses(); for(int i = 0; i < uses.size(); i++) { @@ -155,7 +155,7 @@ public class ProgramValueIterator { StatementAsm statementAsm = (StatementAsm) statement; Map referenced = statementAsm.getReferenced(); for(String label : referenced.keySet()) { - execute(new ProgramValue.AsmReferenced(statementAsm, label), handler, statement, statementsIt, block); + execute(new ProgramValue.ProgramValueAsmReferenced(statementAsm, label), handler, statement, statementsIt, block); } } } @@ -182,42 +182,42 @@ public class ProgramValueIterator { private static Collection getSubValues(Value value) { ArrayList subValues = new ArrayList<>(); if(value instanceof PointerDereferenceIndexed) { - subValues.add(new ProgramValue.Pointer((PointerDereference) value)); - subValues.add(new ProgramValue.PointerIndex((PointerDereferenceIndexed) value)); + subValues.add(new ProgramValue.ProgramValuePointer((PointerDereference) value)); + subValues.add(new ProgramValue.ProgramValuePointerIndex((PointerDereferenceIndexed) value)); } else if(value instanceof PointerDereferenceSimple) { - subValues.add(new ProgramValue.Pointer((PointerDereference) value)); + subValues.add(new ProgramValue.ProgramValuePointer((PointerDereference) value)); } else if(value instanceof ValueList) { ValueList valueList = (ValueList) value; int size = valueList.getList().size(); for(int i = 0; i < size; i++) { - subValues.add(new ProgramValue.ListElement(valueList, i)); + subValues.add(new ProgramValue.ProgramValueListElement(valueList, i)); } } else if(value instanceof ConstantArrayList) { ConstantArrayList constantArrayList = (ConstantArrayList) value; int size = constantArrayList.getElements().size(); for(int i = 0; i < size; i++) { - subValues.add(new ProgramValue.ConstantArrayElement(constantArrayList, i)); + subValues.add(new ProgramValue.ProgramValueConstantArrayElement(constantArrayList, i)); } } else if(value instanceof CastValue) { - subValues.add(new ProgramValue.CastValue((CastValue) value)); + subValues.add(new ProgramValue.ProgramValueCastValue((CastValue) value)); } else if(value instanceof ConstantCastValue) { - subValues.add(new ProgramValue.ConstantCastValue((ConstantCastValue) value)); + subValues.add(new ProgramValue.ProgramValueConstantCastValue((ConstantCastValue) value)); } else if(value instanceof ConstantSymbolPointer) { - subValues.add(new ProgramValue.ConstantSymbolPointerTo((ConstantSymbolPointer) value)); + subValues.add(new ProgramValue.ProgramValueConstantSymbolPointerTo((ConstantSymbolPointer) value)); } else if(value instanceof RangeValue) { - subValues.add(new ProgramValue.RangeFirst((RangeValue) value)); - subValues.add(new ProgramValue.RangeLast((RangeValue) value)); + subValues.add(new ProgramValue.ProgramValueRangeFirst((RangeValue) value)); + subValues.add(new ProgramValue.ProgramValueRangeLast((RangeValue) value)); } else if(value instanceof ConstantBinary) { - subValues.add(new ProgramValue.ConstantBinaryLeft((ConstantBinary) value)); - subValues.add(new ProgramValue.ConstantBinaryRight((ConstantBinary) value)); + subValues.add(new ProgramValue.ProgramValueConstantBinaryLeft((ConstantBinary) value)); + subValues.add(new ProgramValue.ProgramValueConstantBinaryRight((ConstantBinary) value)); } else if(value instanceof ConstantUnary) { - subValues.add(new ProgramValue.ConstantUnaryValue((ConstantUnary) value)); + subValues.add(new ProgramValue.ProgramValueConstantUnaryValue((ConstantUnary) value)); } else if(value instanceof ArrayFilled) { - subValues.add(new ProgramValue.ArrayFilledSize((ArrayFilled) value)); + subValues.add(new ProgramValue.ProgramValueArrayFilledSize((ArrayFilled) value)); } else if(value instanceof ConstantArrayFilled) { - subValues.add(new ProgramValue.ConstantArrayFilledSize((ConstantArrayFilled) value)); + subValues.add(new ProgramValue.ProgramValueConstantArrayFilledSize((ConstantArrayFilled) value)); } else if(value instanceof LvalueIntermediate) { - subValues.add(new ProgramValue.LValueIntermediateVariable((LvalueIntermediate) value)); + subValues.add(new ProgramValue.ProgramValueLValueIntermediateVariable((LvalueIntermediate) value)); } else if(value == null || value instanceof VariableRef || value instanceof ProcedureRef || diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseAnd.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseAnd.java index 022611a5b..e7906ff6f 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseAnd.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseAnd.java @@ -1,10 +1,7 @@ package dk.camelot64.kickc.model.operators; import dk.camelot64.kickc.model.CompileError; -import dk.camelot64.kickc.model.types.SymbolType; -import dk.camelot64.kickc.model.types.SymbolTypeInteger; -import dk.camelot64.kickc.model.types.SymbolTypePointer; -import dk.camelot64.kickc.model.types.SymbolTypeSimple; +import dk.camelot64.kickc.model.types.*; import dk.camelot64.kickc.model.values.ConstantInteger; import dk.camelot64.kickc.model.values.ConstantLiteral; @@ -34,7 +31,7 @@ public class OperatorBitwiseAnd extends OperatorBinary { } // Handle numeric types if(SymbolType.isInteger(type1) && SymbolType.isInteger(type2)) { - return SymbolType.convertedMathType((SymbolTypeInteger) type1, (SymbolTypeInteger) type2); + return SymbolTypeConversion.convertedMathType((SymbolTypeInteger) type1, (SymbolTypeInteger) type2); } throw new CompileError("Type inference case not handled " + type1 + " " + getOperator() + " " + type2); diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseOr.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseOr.java index cad932fb1..3e6a46208 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseOr.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseOr.java @@ -31,7 +31,7 @@ public class OperatorBitwiseOr extends OperatorBinary { } // Handle numeric types if(SymbolType.isInteger(type1) && SymbolType.isInteger(type2)) { - return SymbolType.convertedMathType((SymbolTypeInteger) type1, (SymbolTypeInteger) type2); + return SymbolTypeConversion.convertedMathType((SymbolTypeInteger) type1, (SymbolTypeInteger) type2); } throw new CompileError("Type inference case not handled " + type1 + " " + getOperator() + " " + type2); } diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseXor.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseXor.java index b383ac3f0..2d614f2ab 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseXor.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorBitwiseXor.java @@ -31,7 +31,7 @@ public class OperatorBitwiseXor extends OperatorBinary { } // Handle numeric types if(SymbolType.isInteger(type1) && SymbolType.isInteger(type2)) { - return SymbolType.convertedMathType((SymbolTypeInteger) type1, (SymbolTypeInteger) type2); + return SymbolTypeConversion.convertedMathType((SymbolTypeInteger) type1, (SymbolTypeInteger) type2); } throw new CompileError("Type inference case not handled " + type1 + " " + getOperator() + " " + type2); } diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCast.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCast.java new file mode 100644 index 000000000..8783a1e60 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCast.java @@ -0,0 +1,18 @@ +package dk.camelot64.kickc.model.operators; + +import dk.camelot64.kickc.model.types.SymbolType; + +/** Abstract cast operator. */ +public abstract class OperatorCast extends OperatorUnary { + + private SymbolType toType; + + public OperatorCast(String operator, String asmOperator, int precedence, SymbolType toType) { + super(operator, asmOperator, precedence); + this.toType = toType; + } + + public SymbolType getToType() { + return toType; + } +} diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastBool.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastBool.java index cb1c8a00e..24b02a921 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastBool.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastBool.java @@ -9,10 +9,10 @@ import dk.camelot64.kickc.model.values.ConstantLiteral; import dk.camelot64.kickc.model.values.ConstantPointer; /** Unary Cast to boolean operator ( (boolean) x ) */ -public class OperatorCastBool extends OperatorUnary { +public class OperatorCastBool extends OperatorCast { public OperatorCastBool(int precedence) { - super("((bool))", "_bool_", precedence); + super("((bool))", "_bool_", precedence, SymbolType.BOOLEAN); } @Override diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastByte.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastByte.java index ea24ee803..b00ba311a 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastByte.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastByte.java @@ -9,10 +9,10 @@ import dk.camelot64.kickc.model.values.ConstantLiteral; import dk.camelot64.kickc.model.values.ConstantPointer; /** Unary Cast to byte operator ( (byte) x ) */ -public class OperatorCastByte extends OperatorUnary { +public class OperatorCastByte extends OperatorCast { public OperatorCastByte(int precedence) { - super("((byte))", "_byte_", precedence); + super("((byte))", "_byte_", precedence, SymbolType.BYTE); } @Override diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastDWord.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastDWord.java index af76dbff4..111b94b7a 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastDWord.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastDWord.java @@ -9,10 +9,10 @@ import dk.camelot64.kickc.model.values.ConstantLiteral; import dk.camelot64.kickc.model.values.ConstantPointer; /** Unary Cast to double word operator ( (dword) x ) */ -public class OperatorCastDWord extends OperatorUnary { +public class OperatorCastDWord extends OperatorCast { public OperatorCastDWord(int precedence) { - super("((dword))", "_dword_", precedence); + super("((dword))", "_dword_", precedence, SymbolType.DWORD); } @Override diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastPtr.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastPtr.java index 33215cfdb..142ecc533 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastPtr.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastPtr.java @@ -10,12 +10,12 @@ import dk.camelot64.kickc.model.values.ConstantLiteral; import dk.camelot64.kickc.model.values.ConstantPointer; /** Unary Cast to a pointer ( type* ) */ -public class OperatorCastPtr extends OperatorUnary { +public class OperatorCastPtr extends OperatorCast { private final SymbolType elementType; public OperatorCastPtr(int precedence, SymbolType elementType) { - super("((" + elementType.toString() + "*))", "_ptr_", precedence); + super("((" + elementType.toString() + "*))", "_ptr_", precedence, new SymbolTypePointer(elementType)); this.elementType = elementType; } diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSByte.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSByte.java index d81cf7414..9487eae97 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSByte.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSByte.java @@ -8,10 +8,10 @@ import dk.camelot64.kickc.model.values.ConstantInteger; import dk.camelot64.kickc.model.values.ConstantLiteral; /** Unary Cast to signed byte operator ( (signed byte) x ) */ -public class OperatorCastSByte extends OperatorUnary { +public class OperatorCastSByte extends OperatorCast { public OperatorCastSByte(int precedence) { - super("((signed byte))", "_sbyte_", precedence); + super("((signed byte))", "_sbyte_", precedence, SymbolType.SBYTE); } @Override diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSDWord.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSDWord.java index a07c5cd38..6ec765ca7 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSDWord.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSDWord.java @@ -8,10 +8,10 @@ import dk.camelot64.kickc.model.values.ConstantInteger; import dk.camelot64.kickc.model.values.ConstantLiteral; /** Unary Cast to signed double word operator ( (signed dword) x ) */ -public class OperatorCastSDWord extends OperatorUnary { +public class OperatorCastSDWord extends OperatorCast { public OperatorCastSDWord(int precedence) { - super("((signed dword))", "_sdword_", precedence); + super("((signed dword))", "_sdword_", precedence, SymbolType.SDWORD); } @Override diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSWord.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSWord.java index 094be277d..b8a618979 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSWord.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastSWord.java @@ -8,10 +8,10 @@ import dk.camelot64.kickc.model.values.ConstantInteger; import dk.camelot64.kickc.model.values.ConstantLiteral; /** Unary Cast to signed word operator ( (signed word) x ) */ -public class OperatorCastSWord extends OperatorUnary { +public class OperatorCastSWord extends OperatorCast { public OperatorCastSWord(int precedence) { - super("((signed word))", "_sword_", precedence); + super("((signed word))", "_sword_", precedence, SymbolType.SWORD); } @Override diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastWord.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastWord.java index f84aec9f0..0b1097086 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastWord.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorCastWord.java @@ -9,10 +9,10 @@ import dk.camelot64.kickc.model.values.ConstantLiteral; import dk.camelot64.kickc.model.values.ConstantPointer; /** Unary Cast to word operator ( (word) x ) */ -public class OperatorCastWord extends OperatorUnary { +public class OperatorCastWord extends OperatorCast { public OperatorCastWord(int precedence) { - super("((word))", "_word_", precedence); + super("((word))", "_word_", precedence, SymbolType.WORD); } @Override diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorDivide.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorDivide.java index 2a4058f16..3ce383230 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorDivide.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorDivide.java @@ -38,7 +38,7 @@ public class OperatorDivide extends OperatorBinary { } // Handle numeric types through proper promotion if(SymbolType.isInteger(left) && SymbolType.isInteger(right)) { - return SymbolType.convertedMathType( (SymbolTypeInteger) left, (SymbolTypeInteger)right); + return SymbolTypeConversion.convertedMathType( (SymbolTypeInteger) left, (SymbolTypeInteger)right); } throw new RuntimeException("Type inference case not handled " + left + " " + getOperator() + " " + right); diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorMinus.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorMinus.java index c06f6b938..ce472ffd7 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorMinus.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorMinus.java @@ -38,7 +38,7 @@ public class OperatorMinus extends OperatorBinary { } // Handle numeric types through proper promotion if(SymbolType.isInteger(type1) && SymbolType.isInteger(type2)) { - return SymbolType.convertedMathType((SymbolTypeInteger) type1, (SymbolTypeInteger) type2); + return SymbolTypeConversion.convertedMathType((SymbolTypeInteger) type1, (SymbolTypeInteger) type2); } throw new RuntimeException("Type inference case not handled " + type1 + " " + getOperator() + " " + type2); } diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorModulo.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorModulo.java index 2931f6db1..4fc0a3388 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorModulo.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorModulo.java @@ -27,7 +27,7 @@ public class OperatorModulo extends OperatorBinary { public SymbolType inferType(SymbolTypeSimple left, SymbolTypeSimple right) { // Handle numeric types through proper promotion if(SymbolType.isInteger(left) && SymbolType.isInteger(right)) { - return SymbolType.convertedMathType((SymbolTypeInteger) left, (SymbolTypeInteger) right); + return SymbolTypeConversion.convertedMathType((SymbolTypeInteger) left, (SymbolTypeInteger) right); } if(left instanceof ConstantPointer && right instanceof ConstantInteger) { return ((ConstantInteger) right).getType(); diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorMultiply.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorMultiply.java index 7c3894bb5..76bb36ec6 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorMultiply.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorMultiply.java @@ -1,10 +1,7 @@ package dk.camelot64.kickc.model.operators; import dk.camelot64.kickc.model.CompileError; -import dk.camelot64.kickc.model.types.SymbolType; -import dk.camelot64.kickc.model.types.SymbolTypeInteger; -import dk.camelot64.kickc.model.types.SymbolTypeIntegerFixed; -import dk.camelot64.kickc.model.types.SymbolTypeSimple; +import dk.camelot64.kickc.model.types.*; import dk.camelot64.kickc.model.values.ConstantInteger; import dk.camelot64.kickc.model.values.ConstantLiteral; @@ -27,7 +24,7 @@ public class OperatorMultiply extends OperatorBinary { public SymbolType inferType(SymbolTypeSimple left, SymbolTypeSimple right) { // Handle numeric types through proper promotion if(SymbolType.isInteger(left) && SymbolType.isInteger(right)) { - return SymbolType.convertedMathType((SymbolTypeInteger) left, (SymbolTypeInteger) right); + return SymbolTypeConversion.convertedMathType((SymbolTypeInteger) left, (SymbolTypeInteger) right); } throw new RuntimeException("Type inference case not handled " + left + " " + getOperator() + " " + right); } diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorPlus.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorPlus.java index f4f6e0ec7..00844a779 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorPlus.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorPlus.java @@ -46,7 +46,7 @@ public class OperatorPlus extends OperatorBinary { } // Handle numeric types through proper promotion if(SymbolType.isInteger(type1) && SymbolType.isInteger(type2)) { - return SymbolType.convertedMathType( (SymbolTypeInteger) type1, (SymbolTypeInteger)type2); + return SymbolTypeConversion.convertedMathType( (SymbolTypeInteger) type1, (SymbolTypeInteger)type2); } throw new CompileError("Type inference case not handled " + type1 + " " + getOperator() + " " + type2); diff --git a/src/main/java/dk/camelot64/kickc/model/operators/Operators.java b/src/main/java/dk/camelot64/kickc/model/operators/Operators.java index d50decce2..173ab0e8c 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/Operators.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/Operators.java @@ -159,4 +159,5 @@ public class Operators { } } + } diff --git a/src/main/java/dk/camelot64/kickc/model/types/SymbolType.java b/src/main/java/dk/camelot64/kickc/model/types/SymbolType.java index 685017e26..2d6c20a6b 100644 --- a/src/main/java/dk/camelot64/kickc/model/types/SymbolType.java +++ b/src/main/java/dk/camelot64/kickc/model/types/SymbolType.java @@ -1,10 +1,5 @@ package dk.camelot64.kickc.model.types; -import dk.camelot64.kickc.model.CompileError; - -import java.util.ArrayList; -import java.util.Collection; - /** Symbol Types */ public interface SymbolType { @@ -91,6 +86,8 @@ public interface SymbolType { return BOOLEAN; case "void": return VOID; + case "number": + return NUMBER; } return null; } @@ -105,7 +102,7 @@ public interface SymbolType { /** * Get the size of the type (in bytes). - * @return The size + * @return The size. -1 if the type is compile-time only. */ int getSizeBytes(); @@ -215,74 +212,4 @@ public interface SymbolType { return SDWORD.equals(type) || DWORD.equals(type) || SWORD.equals(type) || WORD.equals(type) || SBYTE.equals(type) || BYTE.equals(type) || NUMBER.equals(type); } - /** - * Get all integer types. - * - * @return All integeer types - */ - static Collection getIntegerFixedTypes() { - ArrayList types = new ArrayList<>(); - types.add(BYTE); - types.add(SBYTE); - types.add(WORD); - types.add(SWORD); - types.add(DWORD); - types.add(SDWORD); - return types; - } - - /** - * Find the integer type that results from a binary operator according to C99 6.3.1.8 - * http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf#page=70 - * - * @param type1 Left type in a binary expression - * @param type2 Right type in a binary expression - * @return The type resulting from a binary operator performed on the two parameters - */ - static SymbolType convertedMathType(SymbolTypeInteger type1, SymbolTypeInteger type2) { - if(SymbolType.NUMBER.equals(type1) || SymbolType.NUMBER.equals(type2)) { - return NUMBER; - } - SymbolTypeIntegerFixed fixed1 = (SymbolTypeIntegerFixed) type1; - SymbolTypeIntegerFixed fixed2 = (SymbolTypeIntegerFixed) type2; - // C99 6.3.1.8 a. If two operands have the same type no conversion is performed - if(type1.equals(type2)) - return type1; - // C99 6.3.1.8 b. If both are signed or both are unsigned then the smallest type is converted to the size of the large type (byte->word->sword, sbyte->sword->sdword) - if(fixed1.isSigned()==fixed2.isSigned()) - return (fixed1.getBits()>fixed2.getBits()) ? fixed1 : fixed2; - // C99 6.3.1.8 c. One is signed and one unsigned. - // If the signed type can contain all values of the unsigned type then the unsigned value is converted to the signed type. (byte->sword, byte->sdword, word->sdword). - SymbolTypeIntegerFixed typeS, typeU; - if(fixed1.isSigned()) { - typeS = fixed1; - typeU = fixed2; - } else { - typeS = fixed2; - typeU = fixed1; - } - if(typeS.getBits()>typeU.getBits()) - return typeS; - // C99 6.3.1.8 d. The unsigned type is the same size as or larger than the signed type. - // The signed value is first converted to the size of the unsigned type and then converted to unsigned changing the sign and the value - // (sbyte->byte, sbyte->word, sbyte->dword, sword->word, sword->dword, sdword->dword). - return typeU; - } - - /** - * Find the unsigned integer type that contains both sub-types usable for binary operations ( & | ^ ). - * - * @param type1 Left type in a binary expression - * @param type2 Right type in a binary expression - * @return - */ - static SymbolType promotedBitwiseType(SymbolTypeIntegerFixed type1, SymbolTypeIntegerFixed type2) { - for(SymbolTypeIntegerFixed candidate : getIntegerFixedTypes()) { - if(!candidate.isSigned() && type1.getBits()<=candidate.getBits() && type2.getBits()<=candidate.getBits()) { - return candidate; - } - } - throw new CompileError("Cannot promote to a common type for "+type1.toString()+" and "+type2.toString()); - } - } diff --git a/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeConversion.java b/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeConversion.java new file mode 100644 index 000000000..7b93fa1de --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeConversion.java @@ -0,0 +1,134 @@ +package dk.camelot64.kickc.model.types; + +import dk.camelot64.kickc.model.CompileError; +import dk.camelot64.kickc.model.InternalError; +import dk.camelot64.kickc.model.statements.Statement; +import dk.camelot64.kickc.model.symbols.ProgramScope; +import dk.camelot64.kickc.model.values.ConstantInteger; +import dk.camelot64.kickc.model.values.ConstantLiteral; +import dk.camelot64.kickc.model.values.ConstantValue; +import dk.camelot64.kickc.model.values.RValue; + +/** + * Rules for converting integer types. + * + * Integer conversion implements C99 6.3.1.8 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf#page=70 + * + * The special number type is converted as described here https://gitlab.com/camelot/kickc/issues/181 + * + */ +public class SymbolTypeConversion { + + /** + * Find the integer type that results from a binary operator according to C99 6.3.1.8 + * http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf#page=70 + * + * @param type1 Left type in a binary expression + * @param type2 Right type in a binary expression + * @return The type resulting from a binary operator performed on the two parameters + */ + public static SymbolType convertedMathType(SymbolTypeInteger type1, SymbolTypeInteger type2) { + if(SymbolType.NUMBER.equals(type1) || SymbolType.NUMBER.equals(type2)) { + return SymbolType.NUMBER; + } + SymbolTypeIntegerFixed fixed1 = (SymbolTypeIntegerFixed) type1; + SymbolTypeIntegerFixed fixed2 = (SymbolTypeIntegerFixed) type2; + // C99 6.3.1.8 a. If two operands have the same type no conversion is performed + if(type1.equals(type2)) + return type1; + // C99 6.3.1.8 b. If both are signed or both are unsigned then the smallest type is converted to the size of the large type (byte->word->sword, sbyte->sword->sdword) + if(fixed1.isSigned()==fixed2.isSigned()) + return (fixed1.getBits()>fixed2.getBits()) ? fixed1 : fixed2; + // C99 6.3.1.8 c. One is signed and one unsigned. + // If the signed type can contain all values of the unsigned type then the unsigned value is converted to the signed type. (byte->sword, byte->sdword, word->sdword). + SymbolTypeIntegerFixed typeS, typeU; + if(fixed1.isSigned()) { + typeS = fixed1; + typeU = fixed2; + } else { + typeS = fixed2; + typeU = fixed1; + } + if(typeS.getBits()>typeU.getBits()) + return typeS; + // C99 6.3.1.8 d. The unsigned type is the same size as or larger than the signed type. + // The signed value is first converted to the size of the unsigned type and then converted to unsigned changing the sign and the value + // (sbyte->byte, sbyte->word, sbyte->dword, sword->word, sword->dword, sdword->dword). + return typeU; + } + + /** + * Find the integer type that results from a binary operator according to the special number type conversion https://gitlab.com/camelot/kickc/issues/181 + * @param left The left value + * @param right The right value + * @param symbols The program scope symbols (used for looking up symbols and constants) + * @param currentStmt The current statement (used only for exception context) + * @return a non-null fixed integer type if a number type conversion is relevant. + */ + public static SymbolType convertedNumberType(RValue left, RValue right, ProgramScope symbols, Statement currentStmt) { + + SymbolType leftType = SymbolTypeInference.inferType(symbols, left); + SymbolType rightType = SymbolTypeInference.inferType(symbols, right); + + if(SymbolType.NUMBER.equals(leftType) || SymbolType.NUMBER.equals(rightType)) { + // A special type number is assigned to integer constants without a postfix literal. + // Numbers are flexible and will take a type based on their actual value when they meet a typed number in a calculation. + // Number types are only usable at compile time. + + if(leftType.equals(rightType)) { + // a) If the two operands are numbers the result is a number + return null; + } + + RValue numberVal; + SymbolTypeIntegerFixed fixedType; + if(SymbolType.NUMBER.equals(leftType) && SymbolType.isInteger(rightType)) { + // Left is the number type - right is the fixed type + numberVal = left; + fixedType = (SymbolTypeIntegerFixed) rightType; + } else if(SymbolType.NUMBER.equals(rightType) && SymbolType.isInteger(leftType)) { + // Right is the number type - left is the fixed type + numberVal = right; + fixedType = (SymbolTypeIntegerFixed) leftType; + } else { + // Binary operator combining number and non-integer + throw new CompileError("Error! Incompatible operands " + left.toString() + " and " + right.toString(), currentStmt); + } + + if(numberVal instanceof ConstantValue) { + ConstantLiteral constantLiteral = ((ConstantValue) numberVal).calculateLiteral(symbols); + if(constantLiteral instanceof ConstantInteger) { + ConstantInteger constantInteger = (ConstantInteger) constantLiteral; + if(SymbolType.NUMBER.equals(constantInteger.getType())) { + Long value = constantInteger.getValue(); + if(fixedType.isSigned()) { + // b) If one operand is a signed type and the other a number they are both converted to the smallest signed type that can hold the values. + SymbolTypeIntegerFixed smallestSignedType = SymbolTypeIntegerFixed.getSmallestSigned(value); + if(smallestSignedType == null) { + throw new CompileError("Number constant has value that cannot be represented by a signed type " + value, currentStmt); + } + return smallestSignedType.getBits() > fixedType.getBits() ? smallestSignedType : fixedType; + } else { + // c) If one operand is an unsigned type and the other a number they are both converted to the smallest unsigned type that can hold the values. + // If the number value is negative it is converted to unsigned using two's complement. + SymbolTypeIntegerFixed smallestUnsignedType; + if(value < 0) { + smallestUnsignedType = SymbolTypeIntegerFixed.getSmallestUnsigned(-value); + } else { + smallestUnsignedType = SymbolTypeIntegerFixed.getSmallestUnsigned(value); + } + return smallestUnsignedType.getBits() > fixedType.getBits() ? smallestUnsignedType : fixedType; + } + } else { + throw new InternalError("Non-number constant has type number " + right.toString(), currentStmt); + } + } + } else { + // Postpone til later! + return null; + } + } + // No number conversion + return null; + } +} diff --git a/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeIntegerFixed.java b/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeIntegerFixed.java index 1c6a35cc5..42f4a2659 100644 --- a/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeIntegerFixed.java +++ b/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeIntegerFixed.java @@ -1,5 +1,8 @@ package dk.camelot64.kickc.model.types; +import java.util.ArrayList; +import java.util.Collection; + /** Integer type with a fixed size (byte, signed byte, word, ...). */ public class SymbolTypeIntegerFixed implements SymbolTypeInteger { @@ -17,6 +20,58 @@ public class SymbolTypeIntegerFixed implements SymbolTypeInteger { this.bits = bits; } + /** + * Get all fixed size integer types. + * + * @return All fixed size integer types + */ + public static Collection getIntegerFixedTypes() { + ArrayList types = new ArrayList<>(); + types.add(BYTE); + types.add(SBYTE); + types.add(WORD); + types.add(SWORD); + types.add(DWORD); + types.add(SDWORD); + return types; + } + /** + * Find the smallest signed type that can hold the passed value + * @param value The value + * @return The smallest signed type that can hold the value + */ + public static SymbolTypeIntegerFixed getSmallestSigned(Long value) { + for(SymbolTypeIntegerFixed fixedType : getIntegerFixedTypes()) { + if(fixedType.isSigned() && fixedType.contains(value)) + return fixedType; + } + return null; + } + + /** + * Find the smallest unsigned type that can hold the passed value + * @param value The value + * @return The smallest unsigned type that can hold the value + */ + public static SymbolTypeIntegerFixed getSmallestUnsigned(Long value) { + for(SymbolTypeIntegerFixed fixedType : getIntegerFixedTypes()) { + if(!fixedType.isSigned() && fixedType.contains(value)) + return fixedType; + } + return null; + } + + + /** + * Determines if a value can be represented by the type without loss of information + * + * @param value The value to examine + * @return true if the type contains the value + */ + public boolean contains(Long number) { + return number >= getMinValue() && number <= getMaxValue(); + } + @Override public String getTypeName() { return typeName; diff --git a/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeMulti.java b/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeMulti.java index ced732cb9..f3438573e 100644 --- a/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeMulti.java +++ b/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeMulti.java @@ -26,22 +26,6 @@ public class SymbolTypeMulti implements SymbolType { return types; } - - /** - * Get the multi-type that can contain the passed number. - * @param number The number - * @return The multi-type - */ - public static SymbolType getMultiType(Long number) { - ArrayList potentialTypes = new ArrayList<>(); - for(SymbolTypeIntegerFixed typeInteger : SymbolType.getIntegerFixedTypes()) { - if(number >= typeInteger.getMinValue() && number <= typeInteger.getMaxValue()) { - potentialTypes.add(typeInteger); - } - } - return new SymbolTypeMulti(potentialTypes); - } - @Override public int getSizeBytes() { // Find the minimal sizeof - and return that diff --git a/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeNumberInference.java b/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeNumberInference.java index 7473e4230..4967f0bfa 100644 --- a/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeNumberInference.java +++ b/src/main/java/dk/camelot64/kickc/model/types/SymbolTypeNumberInference.java @@ -90,8 +90,8 @@ public class SymbolTypeNumberInference { ArrayList potentialTypes = new ArrayList<>(); ConstantInteger constantInteger = (ConstantInteger) literal; Long number = constantInteger.getValue(); - for(SymbolTypeIntegerFixed typeInteger : SymbolType.getIntegerFixedTypes()) { - if(number >= typeInteger.getMinValue() && number <= typeInteger.getMaxValue()) { + for(SymbolTypeIntegerFixed typeInteger : SymbolTypeIntegerFixed.getIntegerFixedTypes()) { + if(typeInteger.contains(number)) { potentialTypes.add(typeInteger); } } diff --git a/src/main/java/dk/camelot64/kickc/model/values/AssignmentRValue.java b/src/main/java/dk/camelot64/kickc/model/values/AssignmentRValue.java index 6222c6fd2..36cb5d6ea 100644 --- a/src/main/java/dk/camelot64/kickc/model/values/AssignmentRValue.java +++ b/src/main/java/dk/camelot64/kickc/model/values/AssignmentRValue.java @@ -3,7 +3,7 @@ package dk.camelot64.kickc.model.values; import dk.camelot64.kickc.model.Program; import dk.camelot64.kickc.model.statements.StatementAssignment; -/** The "total" RValue of an assigment. */ +/** The "total" RValue of an assignment. */ public class AssignmentRValue implements RValue { private StatementAssignment assignment; diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1GenerateSingleStaticAssignmentForm.java b/src/main/java/dk/camelot64/kickc/passes/Pass1GenerateSingleStaticAssignmentForm.java index db834cb48..b1f4777da 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass1GenerateSingleStaticAssignmentForm.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass1GenerateSingleStaticAssignmentForm.java @@ -96,7 +96,7 @@ public class Pass1GenerateSingleStaticAssignmentForm extends Pass1Base { programValue.set(version.getRef()); } // Update map of versions encountered in the block - if(currentStmt instanceof StatementAssignment && programValue instanceof ProgramValue.LValue) { + if(currentStmt instanceof StatementAssignment && programValue instanceof ProgramValue.ProgramValueLValue) { StatementAssignment assignment = (StatementAssignment) currentStmt; LValue lValue = assignment.getlValue(); if(lValue instanceof VariableRef) { diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantCastSimplification.java b/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantCastSimplification.java new file mode 100644 index 000000000..a40c02fd0 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantCastSimplification.java @@ -0,0 +1,43 @@ +package dk.camelot64.kickc.passes; + +import dk.camelot64.kickc.model.Program; +import dk.camelot64.kickc.model.iterator.ProgramExpression; +import dk.camelot64.kickc.model.iterator.ProgramExpressionIterator; +import dk.camelot64.kickc.model.iterator.ProgramExpressionUnary; +import dk.camelot64.kickc.model.operators.OperatorCast; +import dk.camelot64.kickc.model.types.SymbolType; +import dk.camelot64.kickc.model.values.ConstantInteger; +import dk.camelot64.kickc.model.values.ConstantValue; + +import java.util.concurrent.atomic.AtomicBoolean; + +/** Simplifies casts of (number) constants to a type. */ +public class Pass2ConstantCastSimplification extends Pass2SsaOptimization { + + public Pass2ConstantCastSimplification(Program program) { + super(program); + } + + @Override + public boolean step() { + AtomicBoolean optimized = new AtomicBoolean(false); + ProgramExpressionIterator.execute(getProgram(), (programExpression, currentStmt, stmtIt, currentBlock) -> { + if(programExpression.getOperator() instanceof OperatorCast) { + OperatorCast operatorCast = (OperatorCast) programExpression.getOperator(); + ProgramExpressionUnary unary = (ProgramExpressionUnary) programExpression; + if(unary.getOperand() instanceof ConstantInteger) { + ConstantInteger constantInteger = (ConstantInteger) unary.getOperand(); + if(constantInteger.getType().equals(SymbolType.NUMBER)) { + SymbolType castType = operatorCast.getToType(); + ConstantInteger newConstInt = new ConstantInteger(constantInteger.getInteger(), castType); + programExpression.set(newConstInt); + getLog().append("Simplifying constant integer cast "+newConstInt); + } + } + } + }); + return optimized.get(); + } + + +} diff --git a/src/main/java/dk/camelot64/kickc/passes/PassNAddNumberTypeConversions.java b/src/main/java/dk/camelot64/kickc/passes/PassNAddNumberTypeConversions.java index b12ad19ca..39d15dc0c 100644 --- a/src/main/java/dk/camelot64/kickc/passes/PassNAddNumberTypeConversions.java +++ b/src/main/java/dk/camelot64/kickc/passes/PassNAddNumberTypeConversions.java @@ -1,15 +1,11 @@ package dk.camelot64.kickc.passes; -import dk.camelot64.kickc.model.CompileError; -import dk.camelot64.kickc.model.InternalError; import dk.camelot64.kickc.model.Program; -import dk.camelot64.kickc.model.iterator.BinaryExpressionIterator; +import dk.camelot64.kickc.model.iterator.ProgramExpressionBinary; +import dk.camelot64.kickc.model.iterator.ProgramExpressionIterator; import dk.camelot64.kickc.model.types.SymbolType; +import dk.camelot64.kickc.model.types.SymbolTypeConversion; import dk.camelot64.kickc.model.types.SymbolTypeInference; -import dk.camelot64.kickc.model.types.SymbolTypeIntegerFixed; -import dk.camelot64.kickc.model.values.ConstantInteger; -import dk.camelot64.kickc.model.values.ConstantLiteral; -import dk.camelot64.kickc.model.values.ConstantValue; import dk.camelot64.kickc.model.values.RValue; /** @@ -23,89 +19,29 @@ public class PassNAddNumberTypeConversions extends Pass2SsaOptimization { @Override public boolean step() { - BinaryExpressionIterator.execute(getProgram(), (binaryExpression, currentStmt, stmtIt, currentBlock) -> { - RValue left = binaryExpression.getLeft(); - RValue right = binaryExpression.getRight(); - SymbolType conversionType = getNumberConversionType(left, right); - if(conversionType != null) { - // Convert both left and right to the found type - - getLog().append("Adding number conversion cast (" + fixedType+ ") " + binaryExpression.getRight().toString() + " in " + currentStmt.toString(getProgram(), false)); - - + ProgramExpressionIterator.execute(getProgram(), (binaryExpression, currentStmt, stmtIt, currentBlock) -> { + if(binaryExpression instanceof ProgramExpressionBinary) { + ProgramExpressionBinary binary = (ProgramExpressionBinary) binaryExpression; + RValue left = binary.getLeft(); + RValue right = binary.getRight(); + SymbolType conversionType = SymbolTypeConversion.convertedNumberType(left, right, getScope(), currentStmt); + if(conversionType != null) { + // Convert both left and right to the found type + SymbolType leftType = SymbolTypeInference.inferType(getProgram().getScope(), left); + if(!leftType.equals(conversionType)) { + getLog().append("Adding number conversion cast (" + conversionType + ") " + binary.getLeft().toString() + " in " + currentStmt.toString(getProgram(), false)); + binary.addLeftCast(conversionType, stmtIt, currentBlock.getScope(), getScope()); + } + SymbolType rightType = SymbolTypeInference.inferType(getProgram().getScope(), right); + if(!rightType.equals(conversionType)) { + getLog().append("Adding number conversion cast (" + conversionType + ") " + binary.getRight().toString() + " in " + currentStmt.toString(getProgram(), false)); + binary.addRightCast(conversionType, stmtIt, currentBlock.getScope(), getScope()); + } + } } - }); return false; } - private SymbolType getNumberConversionType(RValue left, RValue right) { - - SymbolType leftType = SymbolTypeInference.inferType(getProgram().getScope(), left); - SymbolType rightType = SymbolTypeInference.inferType(getProgram().getScope(), right); - - if(SymbolType.NUMBER.equals(leftType) || SymbolType.NUMBER.equals(rightType)) { - // A special type number is assigned to integer constants without a postfix literal. - // Numbers are flexible and will take a type based on their actual value when they meet a typed number in a calculation. - // Number types are only usable at compile time. - - if(leftType.equals(rightType)) { - // a) If the two operands are numbers the result is a number - return null; - } - - RValue numberVal; - SymbolTypeIntegerFixed fixedType; - if(SymbolType.NUMBER.equals(leftType) && SymbolType.isInteger(rightType)) { - // Left is the number - numberVal = left; - fixedType = (SymbolTypeIntegerFixed) rightType; - } else if(SymbolType.NUMBER.equals(rightType) && SymbolType.isInteger(leftType)) { - // Right is the number - numberVal = right; - fixedType = (SymbolTypeIntegerFixed) leftType; - } else { - // Non-integer number binary - throw new CompileError("Error! Incompatible operands "+left.toString()+" and "+right.toString()); - } - - if(numberVal instanceof ConstantValue) { - ConstantLiteral constantLiteral = ((ConstantValue) numberVal).calculateLiteral(getProgram().getScope()); - if(constantLiteral instanceof ConstantInteger) { - ConstantInteger constantInteger = (ConstantInteger) constantLiteral; - if(SymbolType.NUMBER.equals(constantInteger.getType())) { - Long value = constantInteger.getValue(); - if(fixedType.getMinValue() <= value && fixedType.getMaxValue() >= value) { - // The value matches the left type! - binaryExpression.addRightCast(leftIntType); - } else { - throw new InternalError("TODO: Implement number conversion for non-equal types " + right.toString(), currentStmt); - } - } else { - throw new InternalError("Non-number constant has type number " + right.toString(), currentStmt); - } - } - } else { - // Postpone til later! - // Maybe handle AssignmentRValue separately! - getLog().append("Postponed number conversion " + right.toString()); - } - - - - - } - - // No number conversion - return null; - - if(SymbolType.isInteger(leftType) && !SymbolType.NUMBER.equals(leftType) && SymbolType.NUMBER.equals(rightType)) { - SymbolTypeIntegerFixed leftIntType = (SymbolTypeIntegerFixed) leftType; - // Attempt to find number conversion! - } - - return null; - } - } diff --git a/src/main/java/dk/camelot64/kickc/passes/PassNAddTypeConversions.java b/src/main/java/dk/camelot64/kickc/passes/PassNAddTypeConversions.java deleted file mode 100644 index 562d251f0..000000000 --- a/src/main/java/dk/camelot64/kickc/passes/PassNAddTypeConversions.java +++ /dev/null @@ -1,143 +0,0 @@ -package dk.camelot64.kickc.passes; - -import dk.camelot64.kickc.model.Comment; -import dk.camelot64.kickc.model.CompileError; -import dk.camelot64.kickc.model.ControlFlowBlock; -import dk.camelot64.kickc.model.Program; -import dk.camelot64.kickc.model.operators.Operators; -import dk.camelot64.kickc.model.statements.Statement; -import dk.camelot64.kickc.model.statements.StatementAssignment; -import dk.camelot64.kickc.model.symbols.Scope; -import dk.camelot64.kickc.model.symbols.VariableIntermediate; -import dk.camelot64.kickc.model.types.*; -import dk.camelot64.kickc.model.values.ConstantInteger; -import dk.camelot64.kickc.model.values.LValue; -import dk.camelot64.kickc.model.values.RValue; -import dk.camelot64.kickc.model.values.ScopeRef; - -import java.util.List; -import java.util.ListIterator; - -/** - * Add casts in all assignments where types are not equal, but the rValue type can be converted to the lValue type. - */ -public class PassNAddTypeConversions extends Pass2SsaOptimization { - - public PassNAddTypeConversions(Program program) { - super(program); - } - - @Override - public boolean step() { - for(ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) { - List statements = block.getStatements(); - ListIterator stmtIt = statements.listIterator(); - while(stmtIt.hasNext()) { - Statement statement = stmtIt.next(); - if(statement instanceof StatementAssignment) { - doConversionAssignment((StatementAssignment) statement, stmtIt, block); - } - // TODO: Implement conversion for calls - } - } - return false; - } - - /** - * Examines an assignment to determine if a cast of the rValue is needed (the lvalue type and the rvalue type is not equal) - * and possible (the types are conversion compatible). - *

- * If a conversion is needed it is added by adding a new tmp-var with a cast and modifying the statement. - * - * @param assignment The assignment to examine - * @param stmtIt Iterator allowing the method to add a tmp-var-assignment. - */ - private void doConversionAssignment(StatementAssignment assignment, ListIterator stmtIt, ControlFlowBlock block) { - LValue lValue = assignment.getlValue(); - SymbolType lValueType = SymbolTypeInference.inferType(getScope(), lValue); - SymbolType rValueType = SymbolTypeInference.inferTypeRValue(getScope(), assignment); - if(lValueType.equals(rValueType)) { - return; - } - if(SymbolType.NUMBER.equals(rValueType)) { - // If the rValue is number type - find the potential types based on the literal value - List potentialTypes = SymbolTypeNumberInference.inferTypesRValue(getScope(), assignment); - if(potentialTypes.size()==0) { - // number type cannot be calculated currently - save for later - return; - } - for(SymbolTypeIntegerFixed potentialType : potentialTypes) { - if(lValueType.equals(potentialType) || canConvert(lValueType, potentialType)) { - addConversionCast(assignment, stmtIt, block, lValueType, rValueType); - return; - } - } - } else { - // No direct type match - attempt conversion - if(canConvert(lValueType, rValueType)) { - addConversionCast(assignment, stmtIt, block, lValueType, rValueType); - return; - } - } - - // Conversion not possible - report a type error! - String msg = "ERROR! Type mismatch (" + lValueType.getTypeName() + ") cannot be assigned from (" + rValueType.getTypeName() + "). " + - "In " + assignment.toString(getProgram(), false); - getProgram().getLog().append(msg); - throw new CompileError(msg, assignment.getSource()); - } - - /** - * Add a conversion cast to the rvalue of an assignment - * - * @param assignment The assignment to add the cast to - * @param lValueType The type of the lValue - * @param rValueType The type of the rValue - */ - private void addConversionCast(StatementAssignment assignment, ListIterator stmtIt, ControlFlowBlock currentBlock, SymbolType lValueType, SymbolType rValueType) { - // Promotion possible - add tmp-var and a cast - if(assignment.getOperator() == null) { - // No operator - add cast directly! - RValue rValue = assignment.getrValue2(); - if((rValue instanceof ConstantInteger) && SymbolType.NUMBER.equals(((ConstantInteger) rValue).getType()) && SymbolType.isInteger(lValueType)) { - ((ConstantInteger) rValue).setType(lValueType); - } else { - assignment.setOperator(Operators.getCastUnary(lValueType)); - } - getLog().append("Converting " + rValueType + " to " + lValueType + " in " + assignment); - } else { - ScopeRef currentScope = currentBlock.getScope(); - Scope blockScope = getScope().getScope(currentScope); - VariableIntermediate tmpVar = blockScope.addVariableIntermediate(); - tmpVar.setType(rValueType); - StatementAssignment newAssignment = new StatementAssignment(assignment.getlValue(), Operators.getCastUnary(lValueType), tmpVar.getRef(), assignment.getSource(), Comment.NO_COMMENTS); - getLog().append("Converting " + rValueType + " to " + lValueType + " in " + assignment + " adding "+tmpVar); - assignment.setlValue(tmpVar.getRef()); - stmtIt.add(newAssignment); - } - } - - /** - * Determines if it is possible to convert one type to another - * as described in C99 6.3.1.8 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf#page=70 - * - * @param lValueType The type of the lValue - * @param rValueType The type of the rValue (that will be cast) - * @return True if a cast is possible without any loss - */ - private boolean canConvert(SymbolType lValueType, SymbolType rValueType) { - if(lValueType instanceof SymbolTypePointer && SymbolType.isWord(rValueType)) { - return true; - } - if(lValueType instanceof SymbolTypeInteger && rValueType instanceof SymbolTypeInteger) { - SymbolType convertedMathType = SymbolType.convertedMathType((SymbolTypeInteger) lValueType, (SymbolTypeInteger) rValueType); - if(lValueType.equals(convertedMathType)) { - return true; - } - } - // No type promotion found - return false; - } - - -} diff --git a/src/main/java/dk/camelot64/kickc/passes/PassNAddTypeConversionsNew.java b/src/main/java/dk/camelot64/kickc/passes/PassNAddTypeConversionsNew.java new file mode 100644 index 000000000..fd47ffd3c --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/passes/PassNAddTypeConversionsNew.java @@ -0,0 +1,55 @@ +package dk.camelot64.kickc.passes; + +import dk.camelot64.kickc.model.Program; +import dk.camelot64.kickc.model.iterator.ProgramExpressionBinary; +import dk.camelot64.kickc.model.iterator.ProgramExpressionIterator; +import dk.camelot64.kickc.model.types.*; +import dk.camelot64.kickc.model.values.RValue; + +/** + * Add casts in binary expressions where left/right types are not equal according to the C99 type conversion rules + * 6.3.1.8 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf#page=70. + */ +public class PassNAddTypeConversionsNew extends Pass2SsaOptimization { + + public PassNAddTypeConversionsNew(Program program) { + super(program); + } + + @Override + public boolean step() { + ProgramExpressionIterator.execute(getProgram(), (programExpression, currentStmt, stmtIt, currentBlock) -> { + if(programExpression instanceof ProgramExpressionBinary) { + ProgramExpressionBinary binary = (ProgramExpressionBinary) programExpression; + RValue left = binary.getLeft(); + RValue right = binary.getRight(); + SymbolType leftType = SymbolTypeInference.inferType(getProgram().getScope(), left); + SymbolType rightType = SymbolTypeInference.inferType(getProgram().getScope(), right); + + // Special handling of assigning a pointer from an unsigned word + if((programExpression instanceof ProgramExpressionBinary.ProgramExpressionBinaryAssignmentLValue) && (leftType instanceof SymbolTypePointer) && SymbolType.isInteger(rightType)) { + getLog().append("Adding pointer type conversion cast (" + leftType + ") " + binary.getLeft().toString() + " in " + currentStmt.toString(getProgram(), false)); + binary.addLeftCast(leftType, stmtIt, currentBlock.getScope(), getScope()); + } + + if(SymbolType.isInteger(leftType) && SymbolType.isInteger(rightType)) { + SymbolType conversionType = SymbolTypeConversion.convertedMathType((SymbolTypeInteger) leftType, (SymbolTypeInteger) rightType); + if(conversionType != null && !SymbolType.NUMBER.equals(conversionType)) { + // Convert both left and right to the found type + if(!leftType.equals(conversionType)) { + getLog().append("Adding type conversion cast (" + conversionType + ") " + binary.getLeft().toString() + " in " + currentStmt.toString(getProgram(), false)); + binary.addLeftCast(conversionType, stmtIt, currentBlock.getScope(), getScope()); + } + if(!rightType.equals(conversionType)) { + getLog().append("Adding type conversion cast (" + conversionType + ") " + binary.getRight().toString() + " in " + currentStmt.toString(getProgram(), false)); + binary.addRightCast(conversionType, stmtIt, currentBlock.getScope(), getScope()); + } + } + } + } + }); + return false; + } + + +} diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1TypeIdSimplification.java b/src/main/java/dk/camelot64/kickc/passes/PassNTypeIdSimplification.java similarity index 52% rename from src/main/java/dk/camelot64/kickc/passes/Pass1TypeIdSimplification.java rename to src/main/java/dk/camelot64/kickc/passes/PassNTypeIdSimplification.java index a1ffcf01a..43d47670d 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass1TypeIdSimplification.java +++ b/src/main/java/dk/camelot64/kickc/passes/PassNTypeIdSimplification.java @@ -1,50 +1,63 @@ package dk.camelot64.kickc.passes; -import dk.camelot64.kickc.model.ControlFlowBlock; -import dk.camelot64.kickc.model.InternalError; import dk.camelot64.kickc.model.Program; +import dk.camelot64.kickc.model.iterator.ProgramExpressionIterator; +import dk.camelot64.kickc.model.iterator.ProgramExpressionUnary; import dk.camelot64.kickc.model.operators.OperatorTypeId; import dk.camelot64.kickc.model.operators.Operators; -import dk.camelot64.kickc.model.statements.Statement; -import dk.camelot64.kickc.model.statements.StatementAssignment; import dk.camelot64.kickc.model.types.SymbolType; import dk.camelot64.kickc.model.types.SymbolTypeInference; -import dk.camelot64.kickc.model.types.SymbolTypeIntegerFixed; -import dk.camelot64.kickc.model.types.SymbolTypeNumberInference; -import dk.camelot64.kickc.model.values.ConstantLiteral; import dk.camelot64.kickc.model.values.ConstantRef; -import dk.camelot64.kickc.model.values.ConstantValue; import dk.camelot64.kickc.model.values.RValue; -import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; /** * Converts typeid() operators to constants */ -public class Pass1TypeIdSimplification extends Pass1Base { +public class PassNTypeIdSimplification extends Pass2SsaOptimization { - public Pass1TypeIdSimplification(Program program) { + public PassNTypeIdSimplification(Program program) { super(program); } @Override public boolean step() { - boolean modified = false; + AtomicBoolean modified = new AtomicBoolean(false); + ProgramExpressionIterator.execute(getProgram(), (programExpression, currentStmt, stmtIt, currentBlock) -> { + if(programExpression instanceof ProgramExpressionUnary) { + ProgramExpressionUnary unary = (ProgramExpressionUnary) programExpression; + if(Operators.TYPEID.equals(unary.getOperator())) { + RValue rValue = unary.getOperand(); + SymbolType symbolType = SymbolTypeInference.inferType(getScope(), rValue); + if(symbolType.equals(SymbolType.VAR) || symbolType.equals(SymbolType.NUMBER)) { + + } else { + getLog().append("Resolving typeid() " + currentStmt.toString(getProgram(), false)); + ConstantRef typeIDConstantVar = OperatorTypeId.getTypeIdConstantVar(getScope(), symbolType); + unary.set(typeIDConstantVar); + modified.set(true); + } + } + } + }); + + /* for(ControlFlowBlock block : getGraph().getAllBlocks()) { for(Statement statement : block.getStatements()) { if(statement instanceof StatementAssignment) { StatementAssignment assignment = (StatementAssignment) statement; if(Operators.TYPEID.equals(assignment.getOperator())) { RValue rValue = assignment.getrValue2(); - SymbolType symbolType = SymbolTypeInference.inferType(getScope(), rValue); + SymbolType symbolType = SymbolTypeInference.inferType(getSymbols(), rValue); if(SymbolType.NUMBER.equals(symbolType)) { if(rValue instanceof ConstantValue) { - List fixedTypes = SymbolTypeNumberInference.inferTypes(getScope(), (ConstantLiteral) rValue); + List fixedTypes = SymbolTypeNumberInference.inferTypes(getSymbols(), (ConstantLiteral) rValue); throw new InternalError("TODO: Implement typeof(const)!"); } } else { getLog().append("Resolving typeid() " + assignment.toString(getProgram(), false)); - ConstantRef typeIDConstantVar = OperatorTypeId.getTypeIdConstantVar(getScope(), symbolType); + ConstantRef typeIDConstantVar = OperatorTypeId.getTypeIdConstantVar(getSymbols(), symbolType); assignment.setrValue2(typeIDConstantVar); assignment.setOperator(null); modified = true; @@ -53,6 +66,7 @@ public class Pass1TypeIdSimplification extends Pass1Base { } } } - return modified; + */ + return modified.get(); } } diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index 95b07f371..b77d09e82 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -34,12 +34,12 @@ public class TestPrograms { @Test public void testNumberConversion() throws IOException, URISyntaxException { - compileAndCompare("number-conversion", log()); + compileAndCompare("number-conversion"); } @Test public void testNumberType() throws IOException, URISyntaxException { - compileAndCompare("number-type"); + compileAndCompare("number-type", log()); } @Test diff --git a/src/test/kc/number-conversion.kc b/src/test/kc/number-conversion.kc index 6d7a7b833..67ee702f6 100644 --- a/src/test/kc/number-conversion.kc +++ b/src/test/kc/number-conversion.kc @@ -10,15 +10,13 @@ void main() { idx = 0ub; assertType(typeid(12sb+12), typeid(signed byte)); assertType(typeid(12sb+130), typeid(signed word)); - assertType(typeid(12sb+32000), typeid(signed dword)); + assertType(typeid(12sb+33000), typeid(signed dword)); assertType(typeid(12sw+12), typeid(signed word)); assertType(typeid(12sw+130), typeid(signed word)); assertType(typeid(12sw+100000), typeid(signed dword)); assertType(typeid(12sd+12), typeid(signed dword)); assertType(typeid(12sd+130), typeid(signed dword)); assertType(typeid(12sd+100000), typeid(signed dword)); - // Test number larger than largest signed type - assertType(typeid(12sb+3000000000), typeid(unsigned dword)); // Unsigned type and positive number // b) If one operand is an unsigned type and the other a positive number. @@ -36,7 +34,7 @@ void main() { assertType(typeid(12ud+12), typeid(unsigned dword)); assertType(typeid(12ud+130), typeid(unsigned dword)); assertType(typeid(12ud+66000), typeid(unsigned dword)); - assertType(typeid(12sb+3000000000), typeid(unsigned dword)); + assertType(typeid(12ub+3000000000), typeid(unsigned dword)); // Unsigned type and negative number // If one operand is an unsigned type and the other a negative number. @@ -47,16 +45,19 @@ void main() { idx = 80ub; assertType(typeid(12ub+-12), typeid(unsigned byte)); assertType(typeid(12ub+-120), typeid(unsigned byte)); - assertType(typeid(12ub+-250), typeid(unsigned word)); - assertType(typeid(12ub+-32000), typeid(unsigned dword)); + assertType(typeid(12ub+-250), typeid(unsigned byte)); + assertType(typeid(12ub+-260), typeid(unsigned word)); + assertType(typeid(12ub+-65000), typeid(unsigned word)); assertType(typeid(12ub+-66000), typeid(unsigned dword)); assertType(typeid(12uw+-12), typeid(unsigned word)); assertType(typeid(12uw+-130), typeid(unsigned word)); - assertType(typeid(12uw+-32000), typeid(unsigned dword)); + assertType(typeid(12uw+-65000), typeid(unsigned word)); + assertType(typeid(12uw+-66000), typeid(unsigned dword)); assertType(typeid(12ud+-12), typeid(unsigned dword)); assertType(typeid(12ud+-130), typeid(unsigned dword)); assertType(typeid(12ud+-66000), typeid(unsigned dword)); - assertType(typeid(12sb+-3000000000), typeid(unsigned dword)); + assertType(typeid(12sb+-2100000000), typeid(unsigned dword)); + } diff --git a/src/test/ref/int-conversion.asm b/src/test/ref/int-conversion.asm new file mode 100644 index 000000000..9ad08351c --- /dev/null +++ b/src/test/ref/int-conversion.asm @@ -0,0 +1,242 @@ +// Tests different integer literal types +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + .const TYPEID_BYTE = 1 + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_WORD = 3 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_DWORD = 5 + .const TYPEID_SIGNED_DWORD = 6 + .const RED = 2 + .const GREEN = 5 + .label SCREEN = $400 + .label COLS = $d800 +main: { + .label s = 2 + lda #SCREEN + sta s+1 + b1: + lda #' ' + ldy #0 + sta (s),y + inc s + bne !+ + inc s+1 + !: + lda s+1 + cmp #>SCREEN+$3e8 + bcc b1 + bne !+ + lda s + cmp #@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + .label s = 2 + //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG12 [5] phi (byte*) main::s#2 = (const byte*) SCREEN#0 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #SCREEN + sta s+1 + jmp b1 + //SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + b1_from_b1: + //SEG14 [5] phi (byte*) main::s#2 = (byte*) main::s#1 [phi:main::@1->main::@1#0] -- register_copy + jmp b1 + //SEG15 main::@1 + b1: + //SEG16 [6] *((byte*) main::s#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + lda #' ' + ldy #0 + sta (s),y + //SEG17 [7] (byte*) main::s#1 ← ++ (byte*) main::s#2 -- pbuz1=_inc_pbuz1 + inc s + bne !+ + inc s+1 + !: + //SEG18 [8] if((byte*) main::s#1<(const byte*) SCREEN#0+(word) $3e8) goto main::@1 -- pbuz1_lt_pbuc1_then_la1 + lda s+1 + cmp #>SCREEN+$3e8 + bcc b1_from_b1 + bne !+ + lda s + cmp #main::@2] + b2_from_b1: + jmp b2 + //SEG20 main::@2 + b2: + //SEG21 [10] call testUnaryOperator + //SEG22 [94] phi from main::@2 to testUnaryOperator [phi:main::@2->testUnaryOperator] + testUnaryOperator_from_b2: + jsr testUnaryOperator + //SEG23 [11] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + b3_from_b2: + jmp b3 + //SEG24 main::@3 + b3: + //SEG25 [12] call testBinaryOperator + //SEG26 [14] phi from main::@3 to testBinaryOperator [phi:main::@3->testBinaryOperator] + testBinaryOperator_from_b3: + jsr testBinaryOperator + jmp breturn + //SEG27 main::@return + breturn: + //SEG28 [13] return + rts +} +//SEG29 testBinaryOperator +testBinaryOperator: { + //SEG30 [15] call assertType + //SEG31 [87] phi from testBinaryOperator to assertType [phi:testBinaryOperator->assertType] + assertType_from_testBinaryOperator: + //SEG32 [87] phi (byte) idx#105 = (byte) $28 [phi:testBinaryOperator->assertType#0] -- vbuz1=vbuc1 + lda #$28 + sta idx + //SEG33 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG34 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG35 [16] phi from testBinaryOperator to testBinaryOperator::@1 [phi:testBinaryOperator->testBinaryOperator::@1] + b1_from_testBinaryOperator: + jmp b1 + //SEG36 testBinaryOperator::@1 + b1: + //SEG37 [17] call assertType + //SEG38 [87] phi from testBinaryOperator::@1 to assertType [phi:testBinaryOperator::@1->assertType] + assertType_from_b1: + //SEG39 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@1->assertType#0] -- register_copy + //SEG40 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG41 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@1->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG42 [18] phi from testBinaryOperator::@1 to testBinaryOperator::@2 [phi:testBinaryOperator::@1->testBinaryOperator::@2] + b2_from_b1: + jmp b2 + //SEG43 testBinaryOperator::@2 + b2: + //SEG44 [19] call assertType + //SEG45 [87] phi from testBinaryOperator::@2 to assertType [phi:testBinaryOperator::@2->assertType] + assertType_from_b2: + //SEG46 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@2->assertType#0] -- register_copy + //SEG47 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG48 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@2->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG49 [20] phi from testBinaryOperator::@2 to testBinaryOperator::@3 [phi:testBinaryOperator::@2->testBinaryOperator::@3] + b3_from_b2: + jmp b3 + //SEG50 testBinaryOperator::@3 + b3: + //SEG51 [21] call assertType + //SEG52 [87] phi from testBinaryOperator::@3 to assertType [phi:testBinaryOperator::@3->assertType] + assertType_from_b3: + //SEG53 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@3->assertType#0] -- register_copy + //SEG54 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG55 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@3->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG56 [22] phi from testBinaryOperator::@3 to testBinaryOperator::@4 [phi:testBinaryOperator::@3->testBinaryOperator::@4] + b4_from_b3: + jmp b4 + //SEG57 testBinaryOperator::@4 + b4: + //SEG58 [23] call assertType + //SEG59 [87] phi from testBinaryOperator::@4 to assertType [phi:testBinaryOperator::@4->assertType] + assertType_from_b4: + //SEG60 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@4->assertType#0] -- register_copy + //SEG61 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG62 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@4->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG63 [24] phi from testBinaryOperator::@4 to testBinaryOperator::@5 [phi:testBinaryOperator::@4->testBinaryOperator::@5] + b5_from_b4: + jmp b5 + //SEG64 testBinaryOperator::@5 + b5: + //SEG65 [25] call assertType + //SEG66 [87] phi from testBinaryOperator::@5 to assertType [phi:testBinaryOperator::@5->assertType] + assertType_from_b5: + //SEG67 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@5->assertType#0] -- register_copy + //SEG68 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG69 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@5->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + jmp b6 + //SEG70 testBinaryOperator::@6 + b6: + //SEG71 [26] (byte) idx#19 ← ++ (byte) idx#108 -- vbuz1=_inc_vbuz1 + inc idx + //SEG72 [27] call assertType + //SEG73 [87] phi from testBinaryOperator::@6 to assertType [phi:testBinaryOperator::@6->assertType] + assertType_from_b6: + //SEG74 [87] phi (byte) idx#105 = (byte) idx#19 [phi:testBinaryOperator::@6->assertType#0] -- register_copy + //SEG75 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@6->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG76 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@6->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG77 [28] phi from testBinaryOperator::@6 to testBinaryOperator::@7 [phi:testBinaryOperator::@6->testBinaryOperator::@7] + b7_from_b6: + jmp b7 + //SEG78 testBinaryOperator::@7 + b7: + //SEG79 [29] call assertType + //SEG80 [87] phi from testBinaryOperator::@7 to assertType [phi:testBinaryOperator::@7->assertType] + assertType_from_b7: + //SEG81 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@7->assertType#0] -- register_copy + //SEG82 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testBinaryOperator::@7->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG83 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testBinaryOperator::@7->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t1 + jsr assertType + //SEG84 [30] phi from testBinaryOperator::@7 to testBinaryOperator::@8 [phi:testBinaryOperator::@7->testBinaryOperator::@8] + b8_from_b7: + jmp b8 + //SEG85 testBinaryOperator::@8 + b8: + //SEG86 [31] call assertType + //SEG87 [87] phi from testBinaryOperator::@8 to assertType [phi:testBinaryOperator::@8->assertType] + assertType_from_b8: + //SEG88 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@8->assertType#0] -- register_copy + //SEG89 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@8->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG90 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@8->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG91 [32] phi from testBinaryOperator::@8 to testBinaryOperator::@9 [phi:testBinaryOperator::@8->testBinaryOperator::@9] + b9_from_b8: + jmp b9 + //SEG92 testBinaryOperator::@9 + b9: + //SEG93 [33] call assertType + //SEG94 [87] phi from testBinaryOperator::@9 to assertType [phi:testBinaryOperator::@9->assertType] + assertType_from_b9: + //SEG95 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@9->assertType#0] -- register_copy + //SEG96 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@9->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG97 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@9->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG98 [34] phi from testBinaryOperator::@9 to testBinaryOperator::@10 [phi:testBinaryOperator::@9->testBinaryOperator::@10] + b10_from_b9: + jmp b10 + //SEG99 testBinaryOperator::@10 + b10: + //SEG100 [35] call assertType + //SEG101 [87] phi from testBinaryOperator::@10 to assertType [phi:testBinaryOperator::@10->assertType] + assertType_from_b10: + //SEG102 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@10->assertType#0] -- register_copy + //SEG103 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@10->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG104 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@10->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG105 [36] phi from testBinaryOperator::@10 to testBinaryOperator::@11 [phi:testBinaryOperator::@10->testBinaryOperator::@11] + b11_from_b10: + jmp b11 + //SEG106 testBinaryOperator::@11 + b11: + //SEG107 [37] call assertType + //SEG108 [87] phi from testBinaryOperator::@11 to assertType [phi:testBinaryOperator::@11->assertType] + assertType_from_b11: + //SEG109 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@11->assertType#0] -- register_copy + //SEG110 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@11->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG111 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@11->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + jmp b12 + //SEG112 testBinaryOperator::@12 + b12: + //SEG113 [38] (byte) idx#26 ← ++ (byte) idx#108 -- vbuz1=_inc_vbuz1 + inc idx + //SEG114 [39] call assertType + //SEG115 [87] phi from testBinaryOperator::@12 to assertType [phi:testBinaryOperator::@12->assertType] + assertType_from_b12: + //SEG116 [87] phi (byte) idx#105 = (byte) idx#26 [phi:testBinaryOperator::@12->assertType#0] -- register_copy + //SEG117 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@12->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG118 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@12->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG119 [40] phi from testBinaryOperator::@12 to testBinaryOperator::@13 [phi:testBinaryOperator::@12->testBinaryOperator::@13] + b13_from_b12: + jmp b13 + //SEG120 testBinaryOperator::@13 + b13: + //SEG121 [41] call assertType + //SEG122 [87] phi from testBinaryOperator::@13 to assertType [phi:testBinaryOperator::@13->assertType] + assertType_from_b13: + //SEG123 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@13->assertType#0] -- register_copy + //SEG124 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@13->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG125 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@13->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG126 [42] phi from testBinaryOperator::@13 to testBinaryOperator::@14 [phi:testBinaryOperator::@13->testBinaryOperator::@14] + b14_from_b13: + jmp b14 + //SEG127 testBinaryOperator::@14 + b14: + //SEG128 [43] call assertType + //SEG129 [87] phi from testBinaryOperator::@14 to assertType [phi:testBinaryOperator::@14->assertType] + assertType_from_b14: + //SEG130 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@14->assertType#0] -- register_copy + //SEG131 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@14->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG132 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@14->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG133 [44] phi from testBinaryOperator::@14 to testBinaryOperator::@15 [phi:testBinaryOperator::@14->testBinaryOperator::@15] + b15_from_b14: + jmp b15 + //SEG134 testBinaryOperator::@15 + b15: + //SEG135 [45] call assertType + //SEG136 [87] phi from testBinaryOperator::@15 to assertType [phi:testBinaryOperator::@15->assertType] + assertType_from_b15: + //SEG137 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@15->assertType#0] -- register_copy + //SEG138 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@15->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG139 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@15->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG140 [46] phi from testBinaryOperator::@15 to testBinaryOperator::@16 [phi:testBinaryOperator::@15->testBinaryOperator::@16] + b16_from_b15: + jmp b16 + //SEG141 testBinaryOperator::@16 + b16: + //SEG142 [47] call assertType + //SEG143 [87] phi from testBinaryOperator::@16 to assertType [phi:testBinaryOperator::@16->assertType] + assertType_from_b16: + //SEG144 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@16->assertType#0] -- register_copy + //SEG145 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@16->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG146 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@16->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG147 [48] phi from testBinaryOperator::@16 to testBinaryOperator::@17 [phi:testBinaryOperator::@16->testBinaryOperator::@17] + b17_from_b16: + jmp b17 + //SEG148 testBinaryOperator::@17 + b17: + //SEG149 [49] call assertType + //SEG150 [87] phi from testBinaryOperator::@17 to assertType [phi:testBinaryOperator::@17->assertType] + assertType_from_b17: + //SEG151 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@17->assertType#0] -- register_copy + //SEG152 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@17->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG153 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@17->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG154 [50] phi from testBinaryOperator::@17 to testBinaryOperator::@18 [phi:testBinaryOperator::@17->testBinaryOperator::@18] + b18_from_b17: + jmp b18 + //SEG155 testBinaryOperator::@18 + b18: + //SEG156 [51] call assertType + //SEG157 [87] phi from testBinaryOperator::@18 to assertType [phi:testBinaryOperator::@18->assertType] + assertType_from_b18: + //SEG158 [87] phi (byte) idx#105 = (byte) $50 [phi:testBinaryOperator::@18->assertType#0] -- vbuz1=vbuc1 + lda #$50 + sta idx + //SEG159 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@18->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG160 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@18->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG161 [52] phi from testBinaryOperator::@18 to testBinaryOperator::@19 [phi:testBinaryOperator::@18->testBinaryOperator::@19] + b19_from_b18: + jmp b19 + //SEG162 testBinaryOperator::@19 + b19: + //SEG163 [53] call assertType + //SEG164 [87] phi from testBinaryOperator::@19 to assertType [phi:testBinaryOperator::@19->assertType] + assertType_from_b19: + //SEG165 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@19->assertType#0] -- register_copy + //SEG166 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@19->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG167 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@19->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG168 [54] phi from testBinaryOperator::@19 to testBinaryOperator::@20 [phi:testBinaryOperator::@19->testBinaryOperator::@20] + b20_from_b19: + jmp b20 + //SEG169 testBinaryOperator::@20 + b20: + //SEG170 [55] call assertType + //SEG171 [87] phi from testBinaryOperator::@20 to assertType [phi:testBinaryOperator::@20->assertType] + assertType_from_b20: + //SEG172 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@20->assertType#0] -- register_copy + //SEG173 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@20->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG174 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@20->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG175 [56] phi from testBinaryOperator::@20 to testBinaryOperator::@21 [phi:testBinaryOperator::@20->testBinaryOperator::@21] + b21_from_b20: + jmp b21 + //SEG176 testBinaryOperator::@21 + b21: + //SEG177 [57] call assertType + //SEG178 [87] phi from testBinaryOperator::@21 to assertType [phi:testBinaryOperator::@21->assertType] + assertType_from_b21: + //SEG179 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@21->assertType#0] -- register_copy + //SEG180 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@21->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG181 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@21->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG182 [58] phi from testBinaryOperator::@21 to testBinaryOperator::@22 [phi:testBinaryOperator::@21->testBinaryOperator::@22] + b22_from_b21: + jmp b22 + //SEG183 testBinaryOperator::@22 + b22: + //SEG184 [59] call assertType + //SEG185 [87] phi from testBinaryOperator::@22 to assertType [phi:testBinaryOperator::@22->assertType] + assertType_from_b22: + //SEG186 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@22->assertType#0] -- register_copy + //SEG187 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@22->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG188 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@22->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG189 [60] phi from testBinaryOperator::@22 to testBinaryOperator::@23 [phi:testBinaryOperator::@22->testBinaryOperator::@23] + b23_from_b22: + jmp b23 + //SEG190 testBinaryOperator::@23 + b23: + //SEG191 [61] call assertType + //SEG192 [87] phi from testBinaryOperator::@23 to assertType [phi:testBinaryOperator::@23->assertType] + assertType_from_b23: + //SEG193 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@23->assertType#0] -- register_copy + //SEG194 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@23->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG195 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@23->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + jmp b24 + //SEG196 testBinaryOperator::@24 + b24: + //SEG197 [62] (byte) idx#40 ← ++ (byte) idx#108 -- vbuz1=_inc_vbuz1 + inc idx + //SEG198 [63] call assertType + //SEG199 [87] phi from testBinaryOperator::@24 to assertType [phi:testBinaryOperator::@24->assertType] + assertType_from_b24: + //SEG200 [87] phi (byte) idx#105 = (byte) idx#40 [phi:testBinaryOperator::@24->assertType#0] -- register_copy + //SEG201 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@24->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG202 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@24->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG203 [64] phi from testBinaryOperator::@24 to testBinaryOperator::@25 [phi:testBinaryOperator::@24->testBinaryOperator::@25] + b25_from_b24: + jmp b25 + //SEG204 testBinaryOperator::@25 + b25: + //SEG205 [65] call assertType + //SEG206 [87] phi from testBinaryOperator::@25 to assertType [phi:testBinaryOperator::@25->assertType] + assertType_from_b25: + //SEG207 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@25->assertType#0] -- register_copy + //SEG208 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@25->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG209 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@25->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG210 [66] phi from testBinaryOperator::@25 to testBinaryOperator::@26 [phi:testBinaryOperator::@25->testBinaryOperator::@26] + b26_from_b25: + jmp b26 + //SEG211 testBinaryOperator::@26 + b26: + //SEG212 [67] call assertType + //SEG213 [87] phi from testBinaryOperator::@26 to assertType [phi:testBinaryOperator::@26->assertType] + assertType_from_b26: + //SEG214 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@26->assertType#0] -- register_copy + //SEG215 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@26->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG216 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@26->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG217 [68] phi from testBinaryOperator::@26 to testBinaryOperator::@27 [phi:testBinaryOperator::@26->testBinaryOperator::@27] + b27_from_b26: + jmp b27 + //SEG218 testBinaryOperator::@27 + b27: + //SEG219 [69] call assertType + //SEG220 [87] phi from testBinaryOperator::@27 to assertType [phi:testBinaryOperator::@27->assertType] + assertType_from_b27: + //SEG221 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@27->assertType#0] -- register_copy + //SEG222 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@27->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG223 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@27->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG224 [70] phi from testBinaryOperator::@27 to testBinaryOperator::@28 [phi:testBinaryOperator::@27->testBinaryOperator::@28] + b28_from_b27: + jmp b28 + //SEG225 testBinaryOperator::@28 + b28: + //SEG226 [71] call assertType + //SEG227 [87] phi from testBinaryOperator::@28 to assertType [phi:testBinaryOperator::@28->assertType] + assertType_from_b28: + //SEG228 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@28->assertType#0] -- register_copy + //SEG229 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@28->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG230 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@28->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG231 [72] phi from testBinaryOperator::@28 to testBinaryOperator::@29 [phi:testBinaryOperator::@28->testBinaryOperator::@29] + b29_from_b28: + jmp b29 + //SEG232 testBinaryOperator::@29 + b29: + //SEG233 [73] call assertType + //SEG234 [87] phi from testBinaryOperator::@29 to assertType [phi:testBinaryOperator::@29->assertType] + assertType_from_b29: + //SEG235 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@29->assertType#0] -- register_copy + //SEG236 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@29->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG237 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@29->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + jmp b30 + //SEG238 testBinaryOperator::@30 + b30: + //SEG239 [74] (byte) idx#47 ← ++ (byte) idx#108 -- vbuz1=_inc_vbuz1 + inc idx + //SEG240 [75] call assertType + //SEG241 [87] phi from testBinaryOperator::@30 to assertType [phi:testBinaryOperator::@30->assertType] + assertType_from_b30: + //SEG242 [87] phi (byte) idx#105 = (byte) idx#47 [phi:testBinaryOperator::@30->assertType#0] -- register_copy + //SEG243 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@30->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG244 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@30->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG245 [76] phi from testBinaryOperator::@30 to testBinaryOperator::@31 [phi:testBinaryOperator::@30->testBinaryOperator::@31] + b31_from_b30: + jmp b31 + //SEG246 testBinaryOperator::@31 + b31: + //SEG247 [77] call assertType + //SEG248 [87] phi from testBinaryOperator::@31 to assertType [phi:testBinaryOperator::@31->assertType] + assertType_from_b31: + //SEG249 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@31->assertType#0] -- register_copy + //SEG250 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@31->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG251 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@31->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG252 [78] phi from testBinaryOperator::@31 to testBinaryOperator::@32 [phi:testBinaryOperator::@31->testBinaryOperator::@32] + b32_from_b31: + jmp b32 + //SEG253 testBinaryOperator::@32 + b32: + //SEG254 [79] call assertType + //SEG255 [87] phi from testBinaryOperator::@32 to assertType [phi:testBinaryOperator::@32->assertType] + assertType_from_b32: + //SEG256 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@32->assertType#0] -- register_copy + //SEG257 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@32->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG258 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@32->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG259 [80] phi from testBinaryOperator::@32 to testBinaryOperator::@33 [phi:testBinaryOperator::@32->testBinaryOperator::@33] + b33_from_b32: + jmp b33 + //SEG260 testBinaryOperator::@33 + b33: + //SEG261 [81] call assertType + //SEG262 [87] phi from testBinaryOperator::@33 to assertType [phi:testBinaryOperator::@33->assertType] + assertType_from_b33: + //SEG263 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@33->assertType#0] -- register_copy + //SEG264 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@33->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG265 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@33->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG266 [82] phi from testBinaryOperator::@33 to testBinaryOperator::@34 [phi:testBinaryOperator::@33->testBinaryOperator::@34] + b34_from_b33: + jmp b34 + //SEG267 testBinaryOperator::@34 + b34: + //SEG268 [83] call assertType + //SEG269 [87] phi from testBinaryOperator::@34 to assertType [phi:testBinaryOperator::@34->assertType] + assertType_from_b34: + //SEG270 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@34->assertType#0] -- register_copy + //SEG271 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@34->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG272 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@34->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG273 [84] phi from testBinaryOperator::@34 to testBinaryOperator::@35 [phi:testBinaryOperator::@34->testBinaryOperator::@35] + b35_from_b34: + jmp b35 + //SEG274 testBinaryOperator::@35 + b35: + //SEG275 [85] call assertType + //SEG276 [87] phi from testBinaryOperator::@35 to assertType [phi:testBinaryOperator::@35->assertType] + assertType_from_b35: + //SEG277 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@35->assertType#0] -- register_copy + //SEG278 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@35->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG279 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@35->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + jmp breturn + //SEG280 testBinaryOperator::@return + breturn: + //SEG281 [86] return + rts +} +//SEG282 assertType +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte zeropage(4) t1, byte zeropage(5) t2) +assertType: { + .label t1 = 4 + .label t2 = 5 + //SEG283 [88] if((byte) assertType::t1#42==(byte) assertType::t2#42) goto assertType::@1 -- vbuz1_eq_vbuz2_then_la1 + lda t1 + cmp t2 + beq b1 + jmp b3 + //SEG284 assertType::@3 + b3: + //SEG285 [89] *((const byte*) COLS#0 + (byte) idx#105) ← (const byte) RED#0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #RED + ldy idx + sta COLS,y + jmp b2 + //SEG286 assertType::@2 + b2: + //SEG287 [90] *((const byte*) SCREEN#0 + (byte) idx#105) ← (byte) assertType::t1#42 -- pbuc1_derefidx_vbuz1=vbuz2 + lda t1 + ldy idx + sta SCREEN,y + //SEG288 [91] (byte) idx#108 ← ++ (byte) idx#105 -- vbuz1=_inc_vbuz1 + inc idx + jmp breturn + //SEG289 assertType::@return + breturn: + //SEG290 [92] return + rts + //SEG291 assertType::@1 + b1: + //SEG292 [93] *((const byte*) COLS#0 + (byte) idx#105) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #GREEN + ldy idx + sta COLS,y + jmp b2 +} +//SEG293 testUnaryOperator +testUnaryOperator: { + //SEG294 [95] call assertType + //SEG295 [87] phi from testUnaryOperator to assertType [phi:testUnaryOperator->assertType] + assertType_from_testUnaryOperator: + //SEG296 [87] phi (byte) idx#105 = (byte) 0 [phi:testUnaryOperator->assertType#0] -- vbuz1=vbuc1 + lda #0 + sta idx + //SEG297 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testUnaryOperator->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG298 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testUnaryOperator->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG299 [96] phi from testUnaryOperator to testUnaryOperator::@1 [phi:testUnaryOperator->testUnaryOperator::@1] + b1_from_testUnaryOperator: + jmp b1 + //SEG300 testUnaryOperator::@1 + b1: + //SEG301 [97] call assertType + //SEG302 [87] phi from testUnaryOperator::@1 to assertType [phi:testUnaryOperator::@1->assertType] + assertType_from_b1: + //SEG303 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@1->assertType#0] -- register_copy + //SEG304 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testUnaryOperator::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG305 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testUnaryOperator::@1->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t1 + jsr assertType + //SEG306 [98] phi from testUnaryOperator::@1 to testUnaryOperator::@2 [phi:testUnaryOperator::@1->testUnaryOperator::@2] + b2_from_b1: + jmp b2 + //SEG307 testUnaryOperator::@2 + b2: + //SEG308 [99] call assertType + //SEG309 [87] phi from testUnaryOperator::@2 to assertType [phi:testUnaryOperator::@2->assertType] + assertType_from_b2: + //SEG310 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@2->assertType#0] -- register_copy + //SEG311 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testUnaryOperator::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG312 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testUnaryOperator::@2->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG313 [100] phi from testUnaryOperator::@2 to testUnaryOperator::@3 [phi:testUnaryOperator::@2->testUnaryOperator::@3] + b3_from_b2: + jmp b3 + //SEG314 testUnaryOperator::@3 + b3: + //SEG315 [101] call assertType + //SEG316 [87] phi from testUnaryOperator::@3 to assertType [phi:testUnaryOperator::@3->assertType] + assertType_from_b3: + //SEG317 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@3->assertType#0] -- register_copy + //SEG318 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testUnaryOperator::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG319 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testUnaryOperator::@3->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG320 [102] phi from testUnaryOperator::@3 to testUnaryOperator::@4 [phi:testUnaryOperator::@3->testUnaryOperator::@4] + b4_from_b3: + jmp b4 + //SEG321 testUnaryOperator::@4 + b4: + //SEG322 [103] call assertType + //SEG323 [87] phi from testUnaryOperator::@4 to assertType [phi:testUnaryOperator::@4->assertType] + assertType_from_b4: + //SEG324 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@4->assertType#0] -- register_copy + //SEG325 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testUnaryOperator::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG326 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testUnaryOperator::@4->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG327 [104] phi from testUnaryOperator::@4 to testUnaryOperator::@5 [phi:testUnaryOperator::@4->testUnaryOperator::@5] + b5_from_b4: + jmp b5 + //SEG328 testUnaryOperator::@5 + b5: + //SEG329 [105] call assertType + //SEG330 [87] phi from testUnaryOperator::@5 to assertType [phi:testUnaryOperator::@5->assertType] + assertType_from_b5: + //SEG331 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@5->assertType#0] -- register_copy + //SEG332 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testUnaryOperator::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG333 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testUnaryOperator::@5->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + jmp breturn + //SEG334 testUnaryOperator::@return + breturn: + //SEG335 [106] return + rts +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [6] *((byte*) main::s#2) ← (byte) ' ' [ main::s#2 ] ( main:2 [ main::s#2 ] ) always clobbers reg byte a reg byte y +Statement [8] if((byte*) main::s#1<(const byte*) SCREEN#0+(word) $3e8) goto main::@1 [ main::s#1 ] ( main:2 [ main::s#1 ] ) always clobbers reg byte a +Statement [89] *((const byte*) COLS#0 + (byte) idx#105) ← (const byte) RED#0 [ assertType::t1#42 idx#105 ] ( main:2::testBinaryOperator:12::assertType:15 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:17 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:19 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:21 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:23 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:25 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:27 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:29 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:31 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:33 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:35 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:37 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:39 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:41 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:43 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:45 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:47 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:49 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:51 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:53 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:55 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:57 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:59 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:61 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:63 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:65 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:67 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:69 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:71 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:73 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:75 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:77 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:79 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:81 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:83 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:85 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:95 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:97 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:99 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:101 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:103 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:105 [ assertType::t1#42 idx#105 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ assertType::t1#42 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ idx#105 idx#108 idx#26 idx#40 idx#47 idx#19 ] +Statement [90] *((const byte*) SCREEN#0 + (byte) idx#105) ← (byte) assertType::t1#42 [ idx#105 ] ( main:2::testBinaryOperator:12::assertType:15 [ idx#105 ] main:2::testBinaryOperator:12::assertType:17 [ idx#105 ] main:2::testBinaryOperator:12::assertType:19 [ idx#105 ] main:2::testBinaryOperator:12::assertType:21 [ idx#105 ] main:2::testBinaryOperator:12::assertType:23 [ idx#105 ] main:2::testBinaryOperator:12::assertType:25 [ idx#105 ] main:2::testBinaryOperator:12::assertType:27 [ idx#105 ] main:2::testBinaryOperator:12::assertType:29 [ idx#105 ] main:2::testBinaryOperator:12::assertType:31 [ idx#105 ] main:2::testBinaryOperator:12::assertType:33 [ idx#105 ] main:2::testBinaryOperator:12::assertType:35 [ idx#105 ] main:2::testBinaryOperator:12::assertType:37 [ idx#105 ] main:2::testBinaryOperator:12::assertType:39 [ idx#105 ] main:2::testBinaryOperator:12::assertType:41 [ idx#105 ] main:2::testBinaryOperator:12::assertType:43 [ idx#105 ] main:2::testBinaryOperator:12::assertType:45 [ idx#105 ] main:2::testBinaryOperator:12::assertType:47 [ idx#105 ] main:2::testBinaryOperator:12::assertType:49 [ idx#105 ] main:2::testBinaryOperator:12::assertType:51 [ idx#105 ] main:2::testBinaryOperator:12::assertType:53 [ idx#105 ] main:2::testBinaryOperator:12::assertType:55 [ idx#105 ] main:2::testBinaryOperator:12::assertType:57 [ idx#105 ] main:2::testBinaryOperator:12::assertType:59 [ idx#105 ] main:2::testBinaryOperator:12::assertType:61 [ idx#105 ] main:2::testBinaryOperator:12::assertType:63 [ idx#105 ] main:2::testBinaryOperator:12::assertType:65 [ idx#105 ] main:2::testBinaryOperator:12::assertType:67 [ idx#105 ] main:2::testBinaryOperator:12::assertType:69 [ idx#105 ] main:2::testBinaryOperator:12::assertType:71 [ idx#105 ] main:2::testBinaryOperator:12::assertType:73 [ idx#105 ] main:2::testBinaryOperator:12::assertType:75 [ idx#105 ] main:2::testBinaryOperator:12::assertType:77 [ idx#105 ] main:2::testBinaryOperator:12::assertType:79 [ idx#105 ] main:2::testBinaryOperator:12::assertType:81 [ idx#105 ] main:2::testBinaryOperator:12::assertType:83 [ idx#105 ] main:2::testBinaryOperator:12::assertType:85 [ idx#105 ] main:2::testUnaryOperator:10::assertType:95 [ idx#105 ] main:2::testUnaryOperator:10::assertType:97 [ idx#105 ] main:2::testUnaryOperator:10::assertType:99 [ idx#105 ] main:2::testUnaryOperator:10::assertType:101 [ idx#105 ] main:2::testUnaryOperator:10::assertType:103 [ idx#105 ] main:2::testUnaryOperator:10::assertType:105 [ idx#105 ] ) always clobbers reg byte a +Statement [93] *((const byte*) COLS#0 + (byte) idx#105) ← (const byte) GREEN#0 [ assertType::t1#42 idx#105 ] ( main:2::testBinaryOperator:12::assertType:15 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:17 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:19 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:21 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:23 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:25 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:27 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:29 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:31 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:33 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:35 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:37 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:39 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:41 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:43 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:45 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:47 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:49 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:51 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:53 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:55 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:57 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:59 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:61 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:63 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:65 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:67 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:69 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:71 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:73 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:75 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:77 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:79 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:81 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:83 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:85 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:95 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:97 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:99 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:101 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:103 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:105 [ assertType::t1#42 idx#105 ] ) always clobbers reg byte a +Statement [6] *((byte*) main::s#2) ← (byte) ' ' [ main::s#2 ] ( main:2 [ main::s#2 ] ) always clobbers reg byte a reg byte y +Statement [8] if((byte*) main::s#1<(const byte*) SCREEN#0+(word) $3e8) goto main::@1 [ main::s#1 ] ( main:2 [ main::s#1 ] ) always clobbers reg byte a +Statement [89] *((const byte*) COLS#0 + (byte) idx#105) ← (const byte) RED#0 [ assertType::t1#42 idx#105 ] ( main:2::testBinaryOperator:12::assertType:15 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:17 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:19 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:21 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:23 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:25 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:27 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:29 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:31 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:33 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:35 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:37 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:39 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:41 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:43 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:45 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:47 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:49 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:51 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:53 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:55 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:57 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:59 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:61 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:63 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:65 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:67 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:69 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:71 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:73 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:75 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:77 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:79 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:81 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:83 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:85 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:95 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:97 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:99 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:101 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:103 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:105 [ assertType::t1#42 idx#105 ] ) always clobbers reg byte a +Statement [90] *((const byte*) SCREEN#0 + (byte) idx#105) ← (byte) assertType::t1#42 [ idx#105 ] ( main:2::testBinaryOperator:12::assertType:15 [ idx#105 ] main:2::testBinaryOperator:12::assertType:17 [ idx#105 ] main:2::testBinaryOperator:12::assertType:19 [ idx#105 ] main:2::testBinaryOperator:12::assertType:21 [ idx#105 ] main:2::testBinaryOperator:12::assertType:23 [ idx#105 ] main:2::testBinaryOperator:12::assertType:25 [ idx#105 ] main:2::testBinaryOperator:12::assertType:27 [ idx#105 ] main:2::testBinaryOperator:12::assertType:29 [ idx#105 ] main:2::testBinaryOperator:12::assertType:31 [ idx#105 ] main:2::testBinaryOperator:12::assertType:33 [ idx#105 ] main:2::testBinaryOperator:12::assertType:35 [ idx#105 ] main:2::testBinaryOperator:12::assertType:37 [ idx#105 ] main:2::testBinaryOperator:12::assertType:39 [ idx#105 ] main:2::testBinaryOperator:12::assertType:41 [ idx#105 ] main:2::testBinaryOperator:12::assertType:43 [ idx#105 ] main:2::testBinaryOperator:12::assertType:45 [ idx#105 ] main:2::testBinaryOperator:12::assertType:47 [ idx#105 ] main:2::testBinaryOperator:12::assertType:49 [ idx#105 ] main:2::testBinaryOperator:12::assertType:51 [ idx#105 ] main:2::testBinaryOperator:12::assertType:53 [ idx#105 ] main:2::testBinaryOperator:12::assertType:55 [ idx#105 ] main:2::testBinaryOperator:12::assertType:57 [ idx#105 ] main:2::testBinaryOperator:12::assertType:59 [ idx#105 ] main:2::testBinaryOperator:12::assertType:61 [ idx#105 ] main:2::testBinaryOperator:12::assertType:63 [ idx#105 ] main:2::testBinaryOperator:12::assertType:65 [ idx#105 ] main:2::testBinaryOperator:12::assertType:67 [ idx#105 ] main:2::testBinaryOperator:12::assertType:69 [ idx#105 ] main:2::testBinaryOperator:12::assertType:71 [ idx#105 ] main:2::testBinaryOperator:12::assertType:73 [ idx#105 ] main:2::testBinaryOperator:12::assertType:75 [ idx#105 ] main:2::testBinaryOperator:12::assertType:77 [ idx#105 ] main:2::testBinaryOperator:12::assertType:79 [ idx#105 ] main:2::testBinaryOperator:12::assertType:81 [ idx#105 ] main:2::testBinaryOperator:12::assertType:83 [ idx#105 ] main:2::testBinaryOperator:12::assertType:85 [ idx#105 ] main:2::testUnaryOperator:10::assertType:95 [ idx#105 ] main:2::testUnaryOperator:10::assertType:97 [ idx#105 ] main:2::testUnaryOperator:10::assertType:99 [ idx#105 ] main:2::testUnaryOperator:10::assertType:101 [ idx#105 ] main:2::testUnaryOperator:10::assertType:103 [ idx#105 ] main:2::testUnaryOperator:10::assertType:105 [ idx#105 ] ) always clobbers reg byte a +Statement [93] *((const byte*) COLS#0 + (byte) idx#105) ← (const byte) GREEN#0 [ assertType::t1#42 idx#105 ] ( main:2::testBinaryOperator:12::assertType:15 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:17 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:19 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:21 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:23 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:25 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:27 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:29 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:31 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:33 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:35 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:37 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:39 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:41 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:43 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:45 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:47 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:49 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:51 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:53 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:55 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:57 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:59 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:61 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:63 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:65 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:67 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:69 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:71 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:73 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:75 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:77 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:79 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:81 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:83 [ assertType::t1#42 idx#105 ] main:2::testBinaryOperator:12::assertType:85 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:95 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:97 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:99 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:101 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:103 [ assertType::t1#42 idx#105 ] main:2::testUnaryOperator:10::assertType:105 [ assertType::t1#42 idx#105 ] ) always clobbers reg byte a +Potential registers zp ZP_WORD:2 [ main::s#2 main::s#1 ] : zp ZP_WORD:2 , +Potential registers zp ZP_BYTE:4 [ assertType::t1#42 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:5 [ assertType::t2#42 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:6 [ idx#105 idx#108 idx#26 idx#40 idx#47 idx#19 ] : zp ZP_BYTE:6 , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [] 34.25: zp ZP_BYTE:6 [ idx#105 idx#108 idx#26 idx#40 idx#47 idx#19 ] +Uplift Scope [main] 33: zp ZP_WORD:2 [ main::s#2 main::s#1 ] +Uplift Scope [assertType] 2: zp ZP_BYTE:5 [ assertType::t2#42 ] 1: zp ZP_BYTE:4 [ assertType::t1#42 ] +Uplift Scope [testUnaryOperator] +Uplift Scope [testBinaryOperator] + +Uplifting [] best 1503 combination reg byte x [ idx#105 idx#108 idx#26 idx#40 idx#47 idx#19 ] +Uplifting [main] best 1503 combination zp ZP_WORD:2 [ main::s#2 main::s#1 ] +Uplifting [assertType] best 1375 combination zp ZP_BYTE:5 [ assertType::t2#42 ] reg byte y [ assertType::t1#42 ] +Uplifting [testUnaryOperator] best 1375 combination +Uplifting [testBinaryOperator] best 1375 combination +Attempting to uplift remaining variables inzp ZP_BYTE:5 [ assertType::t2#42 ] +Uplifting [assertType] best 1375 combination zp ZP_BYTE:5 [ assertType::t2#42 ] +Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:4 [ assertType::t2#42 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 File Comments +// Tests different integer literal types +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const TYPEID_BYTE = 1 + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_WORD = 3 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_DWORD = 5 + .const TYPEID_SIGNED_DWORD = 6 + .const RED = 2 + .const GREEN = 5 + .label SCREEN = $400 + .label COLS = $d800 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + .label s = 2 + //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG12 [5] phi (byte*) main::s#2 = (const byte*) SCREEN#0 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #SCREEN + sta s+1 + jmp b1 + //SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + b1_from_b1: + //SEG14 [5] phi (byte*) main::s#2 = (byte*) main::s#1 [phi:main::@1->main::@1#0] -- register_copy + jmp b1 + //SEG15 main::@1 + b1: + //SEG16 [6] *((byte*) main::s#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + lda #' ' + ldy #0 + sta (s),y + //SEG17 [7] (byte*) main::s#1 ← ++ (byte*) main::s#2 -- pbuz1=_inc_pbuz1 + inc s + bne !+ + inc s+1 + !: + //SEG18 [8] if((byte*) main::s#1<(const byte*) SCREEN#0+(word) $3e8) goto main::@1 -- pbuz1_lt_pbuc1_then_la1 + lda s+1 + cmp #>SCREEN+$3e8 + bcc b1_from_b1 + bne !+ + lda s + cmp #main::@2] + b2_from_b1: + jmp b2 + //SEG20 main::@2 + b2: + //SEG21 [10] call testUnaryOperator + //SEG22 [94] phi from main::@2 to testUnaryOperator [phi:main::@2->testUnaryOperator] + testUnaryOperator_from_b2: + jsr testUnaryOperator + //SEG23 [11] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + b3_from_b2: + jmp b3 + //SEG24 main::@3 + b3: + //SEG25 [12] call testBinaryOperator + //SEG26 [14] phi from main::@3 to testBinaryOperator [phi:main::@3->testBinaryOperator] + testBinaryOperator_from_b3: + jsr testBinaryOperator + jmp breturn + //SEG27 main::@return + breturn: + //SEG28 [13] return + rts +} +//SEG29 testBinaryOperator +testBinaryOperator: { + //SEG30 [15] call assertType + //SEG31 [87] phi from testBinaryOperator to assertType [phi:testBinaryOperator->assertType] + assertType_from_testBinaryOperator: + //SEG32 [87] phi (byte) idx#105 = (byte) $28 [phi:testBinaryOperator->assertType#0] -- vbuxx=vbuc1 + ldx #$28 + //SEG33 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG34 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG35 [16] phi from testBinaryOperator to testBinaryOperator::@1 [phi:testBinaryOperator->testBinaryOperator::@1] + b1_from_testBinaryOperator: + jmp b1 + //SEG36 testBinaryOperator::@1 + b1: + //SEG37 [17] call assertType + //SEG38 [87] phi from testBinaryOperator::@1 to assertType [phi:testBinaryOperator::@1->assertType] + assertType_from_b1: + //SEG39 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@1->assertType#0] -- register_copy + //SEG40 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG41 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@1->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG42 [18] phi from testBinaryOperator::@1 to testBinaryOperator::@2 [phi:testBinaryOperator::@1->testBinaryOperator::@2] + b2_from_b1: + jmp b2 + //SEG43 testBinaryOperator::@2 + b2: + //SEG44 [19] call assertType + //SEG45 [87] phi from testBinaryOperator::@2 to assertType [phi:testBinaryOperator::@2->assertType] + assertType_from_b2: + //SEG46 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@2->assertType#0] -- register_copy + //SEG47 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG48 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@2->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG49 [20] phi from testBinaryOperator::@2 to testBinaryOperator::@3 [phi:testBinaryOperator::@2->testBinaryOperator::@3] + b3_from_b2: + jmp b3 + //SEG50 testBinaryOperator::@3 + b3: + //SEG51 [21] call assertType + //SEG52 [87] phi from testBinaryOperator::@3 to assertType [phi:testBinaryOperator::@3->assertType] + assertType_from_b3: + //SEG53 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@3->assertType#0] -- register_copy + //SEG54 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG55 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@3->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG56 [22] phi from testBinaryOperator::@3 to testBinaryOperator::@4 [phi:testBinaryOperator::@3->testBinaryOperator::@4] + b4_from_b3: + jmp b4 + //SEG57 testBinaryOperator::@4 + b4: + //SEG58 [23] call assertType + //SEG59 [87] phi from testBinaryOperator::@4 to assertType [phi:testBinaryOperator::@4->assertType] + assertType_from_b4: + //SEG60 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@4->assertType#0] -- register_copy + //SEG61 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG62 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@4->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG63 [24] phi from testBinaryOperator::@4 to testBinaryOperator::@5 [phi:testBinaryOperator::@4->testBinaryOperator::@5] + b5_from_b4: + jmp b5 + //SEG64 testBinaryOperator::@5 + b5: + //SEG65 [25] call assertType + //SEG66 [87] phi from testBinaryOperator::@5 to assertType [phi:testBinaryOperator::@5->assertType] + assertType_from_b5: + //SEG67 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@5->assertType#0] -- register_copy + //SEG68 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG69 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@5->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + jmp b6 + //SEG70 testBinaryOperator::@6 + b6: + //SEG71 [26] (byte) idx#19 ← ++ (byte) idx#108 -- vbuxx=_inc_vbuxx + inx + //SEG72 [27] call assertType + //SEG73 [87] phi from testBinaryOperator::@6 to assertType [phi:testBinaryOperator::@6->assertType] + assertType_from_b6: + //SEG74 [87] phi (byte) idx#105 = (byte) idx#19 [phi:testBinaryOperator::@6->assertType#0] -- register_copy + //SEG75 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@6->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG76 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@6->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG77 [28] phi from testBinaryOperator::@6 to testBinaryOperator::@7 [phi:testBinaryOperator::@6->testBinaryOperator::@7] + b7_from_b6: + jmp b7 + //SEG78 testBinaryOperator::@7 + b7: + //SEG79 [29] call assertType + //SEG80 [87] phi from testBinaryOperator::@7 to assertType [phi:testBinaryOperator::@7->assertType] + assertType_from_b7: + //SEG81 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@7->assertType#0] -- register_copy + //SEG82 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testBinaryOperator::@7->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG83 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testBinaryOperator::@7->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_BYTE + jsr assertType + //SEG84 [30] phi from testBinaryOperator::@7 to testBinaryOperator::@8 [phi:testBinaryOperator::@7->testBinaryOperator::@8] + b8_from_b7: + jmp b8 + //SEG85 testBinaryOperator::@8 + b8: + //SEG86 [31] call assertType + //SEG87 [87] phi from testBinaryOperator::@8 to assertType [phi:testBinaryOperator::@8->assertType] + assertType_from_b8: + //SEG88 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@8->assertType#0] -- register_copy + //SEG89 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@8->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG90 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@8->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG91 [32] phi from testBinaryOperator::@8 to testBinaryOperator::@9 [phi:testBinaryOperator::@8->testBinaryOperator::@9] + b9_from_b8: + jmp b9 + //SEG92 testBinaryOperator::@9 + b9: + //SEG93 [33] call assertType + //SEG94 [87] phi from testBinaryOperator::@9 to assertType [phi:testBinaryOperator::@9->assertType] + assertType_from_b9: + //SEG95 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@9->assertType#0] -- register_copy + //SEG96 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@9->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG97 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@9->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG98 [34] phi from testBinaryOperator::@9 to testBinaryOperator::@10 [phi:testBinaryOperator::@9->testBinaryOperator::@10] + b10_from_b9: + jmp b10 + //SEG99 testBinaryOperator::@10 + b10: + //SEG100 [35] call assertType + //SEG101 [87] phi from testBinaryOperator::@10 to assertType [phi:testBinaryOperator::@10->assertType] + assertType_from_b10: + //SEG102 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@10->assertType#0] -- register_copy + //SEG103 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@10->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG104 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@10->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG105 [36] phi from testBinaryOperator::@10 to testBinaryOperator::@11 [phi:testBinaryOperator::@10->testBinaryOperator::@11] + b11_from_b10: + jmp b11 + //SEG106 testBinaryOperator::@11 + b11: + //SEG107 [37] call assertType + //SEG108 [87] phi from testBinaryOperator::@11 to assertType [phi:testBinaryOperator::@11->assertType] + assertType_from_b11: + //SEG109 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@11->assertType#0] -- register_copy + //SEG110 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@11->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG111 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@11->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + jmp b12 + //SEG112 testBinaryOperator::@12 + b12: + //SEG113 [38] (byte) idx#26 ← ++ (byte) idx#108 -- vbuxx=_inc_vbuxx + inx + //SEG114 [39] call assertType + //SEG115 [87] phi from testBinaryOperator::@12 to assertType [phi:testBinaryOperator::@12->assertType] + assertType_from_b12: + //SEG116 [87] phi (byte) idx#105 = (byte) idx#26 [phi:testBinaryOperator::@12->assertType#0] -- register_copy + //SEG117 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@12->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG118 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@12->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG119 [40] phi from testBinaryOperator::@12 to testBinaryOperator::@13 [phi:testBinaryOperator::@12->testBinaryOperator::@13] + b13_from_b12: + jmp b13 + //SEG120 testBinaryOperator::@13 + b13: + //SEG121 [41] call assertType + //SEG122 [87] phi from testBinaryOperator::@13 to assertType [phi:testBinaryOperator::@13->assertType] + assertType_from_b13: + //SEG123 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@13->assertType#0] -- register_copy + //SEG124 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@13->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG125 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@13->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG126 [42] phi from testBinaryOperator::@13 to testBinaryOperator::@14 [phi:testBinaryOperator::@13->testBinaryOperator::@14] + b14_from_b13: + jmp b14 + //SEG127 testBinaryOperator::@14 + b14: + //SEG128 [43] call assertType + //SEG129 [87] phi from testBinaryOperator::@14 to assertType [phi:testBinaryOperator::@14->assertType] + assertType_from_b14: + //SEG130 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@14->assertType#0] -- register_copy + //SEG131 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@14->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG132 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@14->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG133 [44] phi from testBinaryOperator::@14 to testBinaryOperator::@15 [phi:testBinaryOperator::@14->testBinaryOperator::@15] + b15_from_b14: + jmp b15 + //SEG134 testBinaryOperator::@15 + b15: + //SEG135 [45] call assertType + //SEG136 [87] phi from testBinaryOperator::@15 to assertType [phi:testBinaryOperator::@15->assertType] + assertType_from_b15: + //SEG137 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@15->assertType#0] -- register_copy + //SEG138 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@15->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG139 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@15->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG140 [46] phi from testBinaryOperator::@15 to testBinaryOperator::@16 [phi:testBinaryOperator::@15->testBinaryOperator::@16] + b16_from_b15: + jmp b16 + //SEG141 testBinaryOperator::@16 + b16: + //SEG142 [47] call assertType + //SEG143 [87] phi from testBinaryOperator::@16 to assertType [phi:testBinaryOperator::@16->assertType] + assertType_from_b16: + //SEG144 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@16->assertType#0] -- register_copy + //SEG145 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@16->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG146 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@16->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG147 [48] phi from testBinaryOperator::@16 to testBinaryOperator::@17 [phi:testBinaryOperator::@16->testBinaryOperator::@17] + b17_from_b16: + jmp b17 + //SEG148 testBinaryOperator::@17 + b17: + //SEG149 [49] call assertType + //SEG150 [87] phi from testBinaryOperator::@17 to assertType [phi:testBinaryOperator::@17->assertType] + assertType_from_b17: + //SEG151 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@17->assertType#0] -- register_copy + //SEG152 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@17->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG153 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@17->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG154 [50] phi from testBinaryOperator::@17 to testBinaryOperator::@18 [phi:testBinaryOperator::@17->testBinaryOperator::@18] + b18_from_b17: + jmp b18 + //SEG155 testBinaryOperator::@18 + b18: + //SEG156 [51] call assertType + //SEG157 [87] phi from testBinaryOperator::@18 to assertType [phi:testBinaryOperator::@18->assertType] + assertType_from_b18: + //SEG158 [87] phi (byte) idx#105 = (byte) $50 [phi:testBinaryOperator::@18->assertType#0] -- vbuxx=vbuc1 + ldx #$50 + //SEG159 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@18->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG160 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@18->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG161 [52] phi from testBinaryOperator::@18 to testBinaryOperator::@19 [phi:testBinaryOperator::@18->testBinaryOperator::@19] + b19_from_b18: + jmp b19 + //SEG162 testBinaryOperator::@19 + b19: + //SEG163 [53] call assertType + //SEG164 [87] phi from testBinaryOperator::@19 to assertType [phi:testBinaryOperator::@19->assertType] + assertType_from_b19: + //SEG165 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@19->assertType#0] -- register_copy + //SEG166 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@19->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG167 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@19->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG168 [54] phi from testBinaryOperator::@19 to testBinaryOperator::@20 [phi:testBinaryOperator::@19->testBinaryOperator::@20] + b20_from_b19: + jmp b20 + //SEG169 testBinaryOperator::@20 + b20: + //SEG170 [55] call assertType + //SEG171 [87] phi from testBinaryOperator::@20 to assertType [phi:testBinaryOperator::@20->assertType] + assertType_from_b20: + //SEG172 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@20->assertType#0] -- register_copy + //SEG173 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@20->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG174 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@20->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG175 [56] phi from testBinaryOperator::@20 to testBinaryOperator::@21 [phi:testBinaryOperator::@20->testBinaryOperator::@21] + b21_from_b20: + jmp b21 + //SEG176 testBinaryOperator::@21 + b21: + //SEG177 [57] call assertType + //SEG178 [87] phi from testBinaryOperator::@21 to assertType [phi:testBinaryOperator::@21->assertType] + assertType_from_b21: + //SEG179 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@21->assertType#0] -- register_copy + //SEG180 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@21->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG181 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@21->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG182 [58] phi from testBinaryOperator::@21 to testBinaryOperator::@22 [phi:testBinaryOperator::@21->testBinaryOperator::@22] + b22_from_b21: + jmp b22 + //SEG183 testBinaryOperator::@22 + b22: + //SEG184 [59] call assertType + //SEG185 [87] phi from testBinaryOperator::@22 to assertType [phi:testBinaryOperator::@22->assertType] + assertType_from_b22: + //SEG186 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@22->assertType#0] -- register_copy + //SEG187 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@22->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG188 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@22->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG189 [60] phi from testBinaryOperator::@22 to testBinaryOperator::@23 [phi:testBinaryOperator::@22->testBinaryOperator::@23] + b23_from_b22: + jmp b23 + //SEG190 testBinaryOperator::@23 + b23: + //SEG191 [61] call assertType + //SEG192 [87] phi from testBinaryOperator::@23 to assertType [phi:testBinaryOperator::@23->assertType] + assertType_from_b23: + //SEG193 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@23->assertType#0] -- register_copy + //SEG194 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@23->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG195 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@23->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + jmp b24 + //SEG196 testBinaryOperator::@24 + b24: + //SEG197 [62] (byte) idx#40 ← ++ (byte) idx#108 -- vbuxx=_inc_vbuxx + inx + //SEG198 [63] call assertType + //SEG199 [87] phi from testBinaryOperator::@24 to assertType [phi:testBinaryOperator::@24->assertType] + assertType_from_b24: + //SEG200 [87] phi (byte) idx#105 = (byte) idx#40 [phi:testBinaryOperator::@24->assertType#0] -- register_copy + //SEG201 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@24->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG202 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@24->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG203 [64] phi from testBinaryOperator::@24 to testBinaryOperator::@25 [phi:testBinaryOperator::@24->testBinaryOperator::@25] + b25_from_b24: + jmp b25 + //SEG204 testBinaryOperator::@25 + b25: + //SEG205 [65] call assertType + //SEG206 [87] phi from testBinaryOperator::@25 to assertType [phi:testBinaryOperator::@25->assertType] + assertType_from_b25: + //SEG207 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@25->assertType#0] -- register_copy + //SEG208 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@25->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG209 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@25->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG210 [66] phi from testBinaryOperator::@25 to testBinaryOperator::@26 [phi:testBinaryOperator::@25->testBinaryOperator::@26] + b26_from_b25: + jmp b26 + //SEG211 testBinaryOperator::@26 + b26: + //SEG212 [67] call assertType + //SEG213 [87] phi from testBinaryOperator::@26 to assertType [phi:testBinaryOperator::@26->assertType] + assertType_from_b26: + //SEG214 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@26->assertType#0] -- register_copy + //SEG215 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@26->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG216 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@26->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG217 [68] phi from testBinaryOperator::@26 to testBinaryOperator::@27 [phi:testBinaryOperator::@26->testBinaryOperator::@27] + b27_from_b26: + jmp b27 + //SEG218 testBinaryOperator::@27 + b27: + //SEG219 [69] call assertType + //SEG220 [87] phi from testBinaryOperator::@27 to assertType [phi:testBinaryOperator::@27->assertType] + assertType_from_b27: + //SEG221 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@27->assertType#0] -- register_copy + //SEG222 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@27->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG223 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@27->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG224 [70] phi from testBinaryOperator::@27 to testBinaryOperator::@28 [phi:testBinaryOperator::@27->testBinaryOperator::@28] + b28_from_b27: + jmp b28 + //SEG225 testBinaryOperator::@28 + b28: + //SEG226 [71] call assertType + //SEG227 [87] phi from testBinaryOperator::@28 to assertType [phi:testBinaryOperator::@28->assertType] + assertType_from_b28: + //SEG228 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@28->assertType#0] -- register_copy + //SEG229 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@28->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG230 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@28->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG231 [72] phi from testBinaryOperator::@28 to testBinaryOperator::@29 [phi:testBinaryOperator::@28->testBinaryOperator::@29] + b29_from_b28: + jmp b29 + //SEG232 testBinaryOperator::@29 + b29: + //SEG233 [73] call assertType + //SEG234 [87] phi from testBinaryOperator::@29 to assertType [phi:testBinaryOperator::@29->assertType] + assertType_from_b29: + //SEG235 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@29->assertType#0] -- register_copy + //SEG236 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@29->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG237 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@29->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + jmp b30 + //SEG238 testBinaryOperator::@30 + b30: + //SEG239 [74] (byte) idx#47 ← ++ (byte) idx#108 -- vbuxx=_inc_vbuxx + inx + //SEG240 [75] call assertType + //SEG241 [87] phi from testBinaryOperator::@30 to assertType [phi:testBinaryOperator::@30->assertType] + assertType_from_b30: + //SEG242 [87] phi (byte) idx#105 = (byte) idx#47 [phi:testBinaryOperator::@30->assertType#0] -- register_copy + //SEG243 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@30->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG244 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@30->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG245 [76] phi from testBinaryOperator::@30 to testBinaryOperator::@31 [phi:testBinaryOperator::@30->testBinaryOperator::@31] + b31_from_b30: + jmp b31 + //SEG246 testBinaryOperator::@31 + b31: + //SEG247 [77] call assertType + //SEG248 [87] phi from testBinaryOperator::@31 to assertType [phi:testBinaryOperator::@31->assertType] + assertType_from_b31: + //SEG249 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@31->assertType#0] -- register_copy + //SEG250 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@31->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG251 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@31->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG252 [78] phi from testBinaryOperator::@31 to testBinaryOperator::@32 [phi:testBinaryOperator::@31->testBinaryOperator::@32] + b32_from_b31: + jmp b32 + //SEG253 testBinaryOperator::@32 + b32: + //SEG254 [79] call assertType + //SEG255 [87] phi from testBinaryOperator::@32 to assertType [phi:testBinaryOperator::@32->assertType] + assertType_from_b32: + //SEG256 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@32->assertType#0] -- register_copy + //SEG257 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@32->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG258 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@32->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG259 [80] phi from testBinaryOperator::@32 to testBinaryOperator::@33 [phi:testBinaryOperator::@32->testBinaryOperator::@33] + b33_from_b32: + jmp b33 + //SEG260 testBinaryOperator::@33 + b33: + //SEG261 [81] call assertType + //SEG262 [87] phi from testBinaryOperator::@33 to assertType [phi:testBinaryOperator::@33->assertType] + assertType_from_b33: + //SEG263 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@33->assertType#0] -- register_copy + //SEG264 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@33->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG265 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@33->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG266 [82] phi from testBinaryOperator::@33 to testBinaryOperator::@34 [phi:testBinaryOperator::@33->testBinaryOperator::@34] + b34_from_b33: + jmp b34 + //SEG267 testBinaryOperator::@34 + b34: + //SEG268 [83] call assertType + //SEG269 [87] phi from testBinaryOperator::@34 to assertType [phi:testBinaryOperator::@34->assertType] + assertType_from_b34: + //SEG270 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@34->assertType#0] -- register_copy + //SEG271 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@34->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG272 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@34->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG273 [84] phi from testBinaryOperator::@34 to testBinaryOperator::@35 [phi:testBinaryOperator::@34->testBinaryOperator::@35] + b35_from_b34: + jmp b35 + //SEG274 testBinaryOperator::@35 + b35: + //SEG275 [85] call assertType + //SEG276 [87] phi from testBinaryOperator::@35 to assertType [phi:testBinaryOperator::@35->assertType] + assertType_from_b35: + //SEG277 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@35->assertType#0] -- register_copy + //SEG278 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@35->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG279 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@35->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + jmp breturn + //SEG280 testBinaryOperator::@return + breturn: + //SEG281 [86] return + rts +} +//SEG282 assertType +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte register(Y) t1, byte zeropage(4) t2) +assertType: { + .label t2 = 4 + //SEG283 [88] if((byte) assertType::t1#42==(byte) assertType::t2#42) goto assertType::@1 -- vbuyy_eq_vbuz1_then_la1 + tya + cmp t2 + beq b1 + jmp b3 + //SEG284 assertType::@3 + b3: + //SEG285 [89] *((const byte*) COLS#0 + (byte) idx#105) ← (const byte) RED#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #RED + sta COLS,x + jmp b2 + //SEG286 assertType::@2 + b2: + //SEG287 [90] *((const byte*) SCREEN#0 + (byte) idx#105) ← (byte) assertType::t1#42 -- pbuc1_derefidx_vbuxx=vbuyy + tya + sta SCREEN,x + //SEG288 [91] (byte) idx#108 ← ++ (byte) idx#105 -- vbuxx=_inc_vbuxx + inx + jmp breturn + //SEG289 assertType::@return + breturn: + //SEG290 [92] return + rts + //SEG291 assertType::@1 + b1: + //SEG292 [93] *((const byte*) COLS#0 + (byte) idx#105) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #GREEN + sta COLS,x + jmp b2 +} +//SEG293 testUnaryOperator +testUnaryOperator: { + //SEG294 [95] call assertType + //SEG295 [87] phi from testUnaryOperator to assertType [phi:testUnaryOperator->assertType] + assertType_from_testUnaryOperator: + //SEG296 [87] phi (byte) idx#105 = (byte) 0 [phi:testUnaryOperator->assertType#0] -- vbuxx=vbuc1 + ldx #0 + //SEG297 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testUnaryOperator->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG298 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testUnaryOperator->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG299 [96] phi from testUnaryOperator to testUnaryOperator::@1 [phi:testUnaryOperator->testUnaryOperator::@1] + b1_from_testUnaryOperator: + jmp b1 + //SEG300 testUnaryOperator::@1 + b1: + //SEG301 [97] call assertType + //SEG302 [87] phi from testUnaryOperator::@1 to assertType [phi:testUnaryOperator::@1->assertType] + assertType_from_b1: + //SEG303 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@1->assertType#0] -- register_copy + //SEG304 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testUnaryOperator::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG305 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testUnaryOperator::@1->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_BYTE + jsr assertType + //SEG306 [98] phi from testUnaryOperator::@1 to testUnaryOperator::@2 [phi:testUnaryOperator::@1->testUnaryOperator::@2] + b2_from_b1: + jmp b2 + //SEG307 testUnaryOperator::@2 + b2: + //SEG308 [99] call assertType + //SEG309 [87] phi from testUnaryOperator::@2 to assertType [phi:testUnaryOperator::@2->assertType] + assertType_from_b2: + //SEG310 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@2->assertType#0] -- register_copy + //SEG311 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testUnaryOperator::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG312 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testUnaryOperator::@2->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG313 [100] phi from testUnaryOperator::@2 to testUnaryOperator::@3 [phi:testUnaryOperator::@2->testUnaryOperator::@3] + b3_from_b2: + jmp b3 + //SEG314 testUnaryOperator::@3 + b3: + //SEG315 [101] call assertType + //SEG316 [87] phi from testUnaryOperator::@3 to assertType [phi:testUnaryOperator::@3->assertType] + assertType_from_b3: + //SEG317 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@3->assertType#0] -- register_copy + //SEG318 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testUnaryOperator::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG319 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testUnaryOperator::@3->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG320 [102] phi from testUnaryOperator::@3 to testUnaryOperator::@4 [phi:testUnaryOperator::@3->testUnaryOperator::@4] + b4_from_b3: + jmp b4 + //SEG321 testUnaryOperator::@4 + b4: + //SEG322 [103] call assertType + //SEG323 [87] phi from testUnaryOperator::@4 to assertType [phi:testUnaryOperator::@4->assertType] + assertType_from_b4: + //SEG324 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@4->assertType#0] -- register_copy + //SEG325 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testUnaryOperator::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG326 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testUnaryOperator::@4->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG327 [104] phi from testUnaryOperator::@4 to testUnaryOperator::@5 [phi:testUnaryOperator::@4->testUnaryOperator::@5] + b5_from_b4: + jmp b5 + //SEG328 testUnaryOperator::@5 + b5: + //SEG329 [105] call assertType + //SEG330 [87] phi from testUnaryOperator::@5 to assertType [phi:testUnaryOperator::@5->assertType] + assertType_from_b5: + //SEG331 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@5->assertType#0] -- register_copy + //SEG332 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testUnaryOperator::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG333 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testUnaryOperator::@5->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + jmp breturn + //SEG334 testUnaryOperator::@return + breturn: + //SEG335 [106] return + rts +} + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b1 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp b4 +Removing instruction jmp b5 +Removing instruction jmp b6 +Removing instruction jmp b7 +Removing instruction jmp b8 +Removing instruction jmp b9 +Removing instruction jmp b10 +Removing instruction jmp b11 +Removing instruction jmp b12 +Removing instruction jmp b13 +Removing instruction jmp b14 +Removing instruction jmp b15 +Removing instruction jmp b16 +Removing instruction jmp b17 +Removing instruction jmp b18 +Removing instruction jmp b19 +Removing instruction jmp b20 +Removing instruction jmp b21 +Removing instruction jmp b22 +Removing instruction jmp b23 +Removing instruction jmp b24 +Removing instruction jmp b25 +Removing instruction jmp b26 +Removing instruction jmp b27 +Removing instruction jmp b28 +Removing instruction jmp b29 +Removing instruction jmp b30 +Removing instruction jmp b31 +Removing instruction jmp b32 +Removing instruction jmp b33 +Removing instruction jmp b34 +Removing instruction jmp b35 +Removing instruction jmp breturn +Removing instruction jmp b3 +Removing instruction jmp b2 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp b4 +Removing instruction jmp b5 +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_SIGNED_BYTE with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_SIGNED_BYTE with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing label b1_from_b1 with b1 +Replacing label b1_from_b1 with b1 +Removing instruction b1_from_bbegin: +Removing instruction b1: +Removing instruction main_from_b1: +Removing instruction bend_from_b1: +Removing instruction b1_from_b1: +Removing instruction b2_from_b1: +Removing instruction testUnaryOperator_from_b2: +Removing instruction b3_from_b2: +Removing instruction testBinaryOperator_from_b3: +Removing instruction b1_from_testBinaryOperator: +Removing instruction assertType_from_b1: +Removing instruction b2_from_b1: +Removing instruction assertType_from_b2: +Removing instruction b3_from_b2: +Removing instruction assertType_from_b3: +Removing instruction b4_from_b3: +Removing instruction assertType_from_b4: +Removing instruction b5_from_b4: +Removing instruction assertType_from_b5: +Removing instruction b7_from_b6: +Removing instruction assertType_from_b7: +Removing instruction b8_from_b7: +Removing instruction assertType_from_b8: +Removing instruction b9_from_b8: +Removing instruction assertType_from_b9: +Removing instruction b10_from_b9: +Removing instruction assertType_from_b10: +Removing instruction b11_from_b10: +Removing instruction assertType_from_b11: +Removing instruction b13_from_b12: +Removing instruction assertType_from_b13: +Removing instruction b14_from_b13: +Removing instruction assertType_from_b14: +Removing instruction b15_from_b14: +Removing instruction assertType_from_b15: +Removing instruction b16_from_b15: +Removing instruction assertType_from_b16: +Removing instruction b17_from_b16: +Removing instruction assertType_from_b17: +Removing instruction b18_from_b17: +Removing instruction assertType_from_b18: +Removing instruction b19_from_b18: +Removing instruction assertType_from_b19: +Removing instruction b20_from_b19: +Removing instruction assertType_from_b20: +Removing instruction b21_from_b20: +Removing instruction assertType_from_b21: +Removing instruction b22_from_b21: +Removing instruction assertType_from_b22: +Removing instruction b23_from_b22: +Removing instruction assertType_from_b23: +Removing instruction b25_from_b24: +Removing instruction assertType_from_b25: +Removing instruction b26_from_b25: +Removing instruction assertType_from_b26: +Removing instruction b27_from_b26: +Removing instruction assertType_from_b27: +Removing instruction b28_from_b27: +Removing instruction assertType_from_b28: +Removing instruction b29_from_b28: +Removing instruction assertType_from_b29: +Removing instruction b31_from_b30: +Removing instruction assertType_from_b31: +Removing instruction b32_from_b31: +Removing instruction assertType_from_b32: +Removing instruction b33_from_b32: +Removing instruction assertType_from_b33: +Removing instruction b34_from_b33: +Removing instruction assertType_from_b34: +Removing instruction b35_from_b34: +Removing instruction assertType_from_b35: +Removing instruction b1_from_testUnaryOperator: +Removing instruction assertType_from_b1: +Removing instruction b2_from_b1: +Removing instruction assertType_from_b2: +Removing instruction b3_from_b2: +Removing instruction assertType_from_b3: +Removing instruction b4_from_b3: +Removing instruction assertType_from_b4: +Removing instruction b5_from_b4: +Removing instruction assertType_from_b5: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bend: +Removing instruction b1_from_main: +Removing instruction b2: +Removing instruction b3: +Removing instruction breturn: +Removing instruction assertType_from_testBinaryOperator: +Removing instruction b1: +Removing instruction b2: +Removing instruction b3: +Removing instruction b4: +Removing instruction b5: +Removing instruction b6: +Removing instruction assertType_from_b6: +Removing instruction b7: +Removing instruction b8: +Removing instruction b9: +Removing instruction b10: +Removing instruction b11: +Removing instruction b12: +Removing instruction assertType_from_b12: +Removing instruction b13: +Removing instruction b14: +Removing instruction b15: +Removing instruction b16: +Removing instruction b17: +Removing instruction b18: +Removing instruction b19: +Removing instruction b20: +Removing instruction b21: +Removing instruction b22: +Removing instruction b23: +Removing instruction b24: +Removing instruction assertType_from_b24: +Removing instruction b25: +Removing instruction b26: +Removing instruction b27: +Removing instruction b28: +Removing instruction b29: +Removing instruction b30: +Removing instruction assertType_from_b30: +Removing instruction b31: +Removing instruction b32: +Removing instruction b33: +Removing instruction b34: +Removing instruction b35: +Removing instruction breturn: +Removing instruction b3: +Removing instruction breturn: +Removing instruction assertType_from_testUnaryOperator: +Removing instruction b1: +Removing instruction b2: +Removing instruction b3: +Removing instruction b4: +Removing instruction b5: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction jmp b1 +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @begin +(label) @end +(byte*) COLS +(const byte*) COLS#0 COLS = ((byte*))(word) $d800 +(byte) GREEN +(const byte) GREEN#0 GREEN = (byte) 5 +(byte) RED +(const byte) RED#0 RED = (byte) 2 +(byte*) SCREEN +(const byte*) SCREEN#0 SCREEN = ((byte*))(word) $400 +(const byte) TYPEID_BYTE TYPEID_BYTE = (number) 1 +(const byte) TYPEID_DWORD TYPEID_DWORD = (number) 5 +(const byte) TYPEID_SIGNED_BYTE TYPEID_SIGNED_BYTE = (number) 2 +(const byte) TYPEID_SIGNED_DWORD TYPEID_SIGNED_DWORD = (number) 6 +(const byte) TYPEID_SIGNED_WORD TYPEID_SIGNED_WORD = (number) 4 +(const byte) TYPEID_WORD TYPEID_WORD = (number) 3 +(void()) assertType((byte) assertType::t1 , (byte) assertType::t2) +(label) assertType::@1 +(label) assertType::@2 +(label) assertType::@3 +(label) assertType::@return +(byte) assertType::t1 +(byte) assertType::t1#42 reg byte y 1.0 +(byte) assertType::t2 +(byte) assertType::t2#42 t2 zp ZP_BYTE:4 2.0 +(byte) idx +(byte) idx#105 reg byte x 17.200000000000003 +(byte) idx#108 reg byte x 1.0526315789473677 +(byte) idx#19 reg byte x 4.0 +(byte) idx#26 reg byte x 4.0 +(byte) idx#40 reg byte x 4.0 +(byte) idx#47 reg byte x 4.0 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@return +(byte*) main::s +(byte*) main::s#1 s zp ZP_WORD:2 16.5 +(byte*) main::s#2 s zp ZP_WORD:2 16.5 +(void()) testBinaryOperator() +(label) testBinaryOperator::@1 +(label) testBinaryOperator::@10 +(label) testBinaryOperator::@11 +(label) testBinaryOperator::@12 +(label) testBinaryOperator::@13 +(label) testBinaryOperator::@14 +(label) testBinaryOperator::@15 +(label) testBinaryOperator::@16 +(label) testBinaryOperator::@17 +(label) testBinaryOperator::@18 +(label) testBinaryOperator::@19 +(label) testBinaryOperator::@2 +(label) testBinaryOperator::@20 +(label) testBinaryOperator::@21 +(label) testBinaryOperator::@22 +(label) testBinaryOperator::@23 +(label) testBinaryOperator::@24 +(label) testBinaryOperator::@25 +(label) testBinaryOperator::@26 +(label) testBinaryOperator::@27 +(label) testBinaryOperator::@28 +(label) testBinaryOperator::@29 +(label) testBinaryOperator::@3 +(label) testBinaryOperator::@30 +(label) testBinaryOperator::@31 +(label) testBinaryOperator::@32 +(label) testBinaryOperator::@33 +(label) testBinaryOperator::@34 +(label) testBinaryOperator::@35 +(label) testBinaryOperator::@4 +(label) testBinaryOperator::@5 +(label) testBinaryOperator::@6 +(label) testBinaryOperator::@7 +(label) testBinaryOperator::@8 +(label) testBinaryOperator::@9 +(label) testBinaryOperator::@return +(void()) testUnaryOperator() +(label) testUnaryOperator::@1 +(label) testUnaryOperator::@2 +(label) testUnaryOperator::@3 +(label) testUnaryOperator::@4 +(label) testUnaryOperator::@5 +(label) testUnaryOperator::@return + +zp ZP_WORD:2 [ main::s#2 main::s#1 ] +reg byte y [ assertType::t1#42 ] +zp ZP_BYTE:4 [ assertType::t2#42 ] +reg byte x [ idx#105 idx#108 idx#26 idx#40 idx#47 idx#19 ] + + +FINAL ASSEMBLER +Score: 1159 + +//SEG0 File Comments +// Tests different integer literal types +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const TYPEID_BYTE = 1 + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_WORD = 3 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_DWORD = 5 + .const TYPEID_SIGNED_DWORD = 6 + .const RED = 2 + .const GREEN = 5 + .label SCREEN = $400 + .label COLS = $d800 +//SEG3 @begin +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +//SEG5 @1 +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +//SEG9 @end +//SEG10 main +main: { + .label s = 2 + //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] + //SEG12 [5] phi (byte*) main::s#2 = (const byte*) SCREEN#0 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #SCREEN + sta s+1 + //SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + //SEG14 [5] phi (byte*) main::s#2 = (byte*) main::s#1 [phi:main::@1->main::@1#0] -- register_copy + //SEG15 main::@1 + b1: + //SEG16 [6] *((byte*) main::s#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + lda #' ' + ldy #0 + sta (s),y + //SEG17 [7] (byte*) main::s#1 ← ++ (byte*) main::s#2 -- pbuz1=_inc_pbuz1 + inc s + bne !+ + inc s+1 + !: + //SEG18 [8] if((byte*) main::s#1<(const byte*) SCREEN#0+(word) $3e8) goto main::@1 -- pbuz1_lt_pbuc1_then_la1 + lda s+1 + cmp #>SCREEN+$3e8 + bcc b1 + bne !+ + lda s + cmp #main::@2] + //SEG20 main::@2 + //SEG21 [10] call testUnaryOperator + //SEG22 [94] phi from main::@2 to testUnaryOperator [phi:main::@2->testUnaryOperator] + jsr testUnaryOperator + //SEG23 [11] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + //SEG24 main::@3 + //SEG25 [12] call testBinaryOperator + //SEG26 [14] phi from main::@3 to testBinaryOperator [phi:main::@3->testBinaryOperator] + jsr testBinaryOperator + //SEG27 main::@return + //SEG28 [13] return + rts +} +//SEG29 testBinaryOperator +testBinaryOperator: { + //SEG30 [15] call assertType + //SEG31 [87] phi from testBinaryOperator to assertType [phi:testBinaryOperator->assertType] + //SEG32 [87] phi (byte) idx#105 = (byte) $28 [phi:testBinaryOperator->assertType#0] -- vbuxx=vbuc1 + ldx #$28 + //SEG33 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG34 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG35 [16] phi from testBinaryOperator to testBinaryOperator::@1 [phi:testBinaryOperator->testBinaryOperator::@1] + //SEG36 testBinaryOperator::@1 + //SEG37 [17] call assertType + //SEG38 [87] phi from testBinaryOperator::@1 to assertType [phi:testBinaryOperator::@1->assertType] + //SEG39 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@1->assertType#0] -- register_copy + //SEG40 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG41 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@1->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG42 [18] phi from testBinaryOperator::@1 to testBinaryOperator::@2 [phi:testBinaryOperator::@1->testBinaryOperator::@2] + //SEG43 testBinaryOperator::@2 + //SEG44 [19] call assertType + //SEG45 [87] phi from testBinaryOperator::@2 to assertType [phi:testBinaryOperator::@2->assertType] + //SEG46 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@2->assertType#0] -- register_copy + //SEG47 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG48 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@2->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG49 [20] phi from testBinaryOperator::@2 to testBinaryOperator::@3 [phi:testBinaryOperator::@2->testBinaryOperator::@3] + //SEG50 testBinaryOperator::@3 + //SEG51 [21] call assertType + //SEG52 [87] phi from testBinaryOperator::@3 to assertType [phi:testBinaryOperator::@3->assertType] + //SEG53 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@3->assertType#0] -- register_copy + //SEG54 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG55 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@3->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG56 [22] phi from testBinaryOperator::@3 to testBinaryOperator::@4 [phi:testBinaryOperator::@3->testBinaryOperator::@4] + //SEG57 testBinaryOperator::@4 + //SEG58 [23] call assertType + //SEG59 [87] phi from testBinaryOperator::@4 to assertType [phi:testBinaryOperator::@4->assertType] + //SEG60 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@4->assertType#0] -- register_copy + //SEG61 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG62 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@4->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG63 [24] phi from testBinaryOperator::@4 to testBinaryOperator::@5 [phi:testBinaryOperator::@4->testBinaryOperator::@5] + //SEG64 testBinaryOperator::@5 + //SEG65 [25] call assertType + //SEG66 [87] phi from testBinaryOperator::@5 to assertType [phi:testBinaryOperator::@5->assertType] + //SEG67 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@5->assertType#0] -- register_copy + //SEG68 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG69 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@5->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG70 testBinaryOperator::@6 + //SEG71 [26] (byte) idx#19 ← ++ (byte) idx#108 -- vbuxx=_inc_vbuxx + inx + //SEG72 [27] call assertType + //SEG73 [87] phi from testBinaryOperator::@6 to assertType [phi:testBinaryOperator::@6->assertType] + //SEG74 [87] phi (byte) idx#105 = (byte) idx#19 [phi:testBinaryOperator::@6->assertType#0] -- register_copy + //SEG75 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@6->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG76 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testBinaryOperator::@6->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG77 [28] phi from testBinaryOperator::@6 to testBinaryOperator::@7 [phi:testBinaryOperator::@6->testBinaryOperator::@7] + //SEG78 testBinaryOperator::@7 + //SEG79 [29] call assertType + //SEG80 [87] phi from testBinaryOperator::@7 to assertType [phi:testBinaryOperator::@7->assertType] + //SEG81 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@7->assertType#0] -- register_copy + //SEG82 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testBinaryOperator::@7->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG83 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testBinaryOperator::@7->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG84 [30] phi from testBinaryOperator::@7 to testBinaryOperator::@8 [phi:testBinaryOperator::@7->testBinaryOperator::@8] + //SEG85 testBinaryOperator::@8 + //SEG86 [31] call assertType + //SEG87 [87] phi from testBinaryOperator::@8 to assertType [phi:testBinaryOperator::@8->assertType] + //SEG88 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@8->assertType#0] -- register_copy + //SEG89 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@8->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG90 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@8->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG91 [32] phi from testBinaryOperator::@8 to testBinaryOperator::@9 [phi:testBinaryOperator::@8->testBinaryOperator::@9] + //SEG92 testBinaryOperator::@9 + //SEG93 [33] call assertType + //SEG94 [87] phi from testBinaryOperator::@9 to assertType [phi:testBinaryOperator::@9->assertType] + //SEG95 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@9->assertType#0] -- register_copy + //SEG96 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@9->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG97 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@9->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG98 [34] phi from testBinaryOperator::@9 to testBinaryOperator::@10 [phi:testBinaryOperator::@9->testBinaryOperator::@10] + //SEG99 testBinaryOperator::@10 + //SEG100 [35] call assertType + //SEG101 [87] phi from testBinaryOperator::@10 to assertType [phi:testBinaryOperator::@10->assertType] + //SEG102 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@10->assertType#0] -- register_copy + //SEG103 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@10->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG104 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@10->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG105 [36] phi from testBinaryOperator::@10 to testBinaryOperator::@11 [phi:testBinaryOperator::@10->testBinaryOperator::@11] + //SEG106 testBinaryOperator::@11 + //SEG107 [37] call assertType + //SEG108 [87] phi from testBinaryOperator::@11 to assertType [phi:testBinaryOperator::@11->assertType] + //SEG109 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@11->assertType#0] -- register_copy + //SEG110 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@11->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG111 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@11->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG112 testBinaryOperator::@12 + //SEG113 [38] (byte) idx#26 ← ++ (byte) idx#108 -- vbuxx=_inc_vbuxx + inx + //SEG114 [39] call assertType + //SEG115 [87] phi from testBinaryOperator::@12 to assertType [phi:testBinaryOperator::@12->assertType] + //SEG116 [87] phi (byte) idx#105 = (byte) idx#26 [phi:testBinaryOperator::@12->assertType#0] -- register_copy + //SEG117 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@12->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG118 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@12->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG119 [40] phi from testBinaryOperator::@12 to testBinaryOperator::@13 [phi:testBinaryOperator::@12->testBinaryOperator::@13] + //SEG120 testBinaryOperator::@13 + //SEG121 [41] call assertType + //SEG122 [87] phi from testBinaryOperator::@13 to assertType [phi:testBinaryOperator::@13->assertType] + //SEG123 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@13->assertType#0] -- register_copy + //SEG124 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@13->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG125 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@13->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG126 [42] phi from testBinaryOperator::@13 to testBinaryOperator::@14 [phi:testBinaryOperator::@13->testBinaryOperator::@14] + //SEG127 testBinaryOperator::@14 + //SEG128 [43] call assertType + //SEG129 [87] phi from testBinaryOperator::@14 to assertType [phi:testBinaryOperator::@14->assertType] + //SEG130 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@14->assertType#0] -- register_copy + //SEG131 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@14->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG132 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@14->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG133 [44] phi from testBinaryOperator::@14 to testBinaryOperator::@15 [phi:testBinaryOperator::@14->testBinaryOperator::@15] + //SEG134 testBinaryOperator::@15 + //SEG135 [45] call assertType + //SEG136 [87] phi from testBinaryOperator::@15 to assertType [phi:testBinaryOperator::@15->assertType] + //SEG137 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@15->assertType#0] -- register_copy + //SEG138 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@15->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG139 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@15->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG140 [46] phi from testBinaryOperator::@15 to testBinaryOperator::@16 [phi:testBinaryOperator::@15->testBinaryOperator::@16] + //SEG141 testBinaryOperator::@16 + //SEG142 [47] call assertType + //SEG143 [87] phi from testBinaryOperator::@16 to assertType [phi:testBinaryOperator::@16->assertType] + //SEG144 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@16->assertType#0] -- register_copy + //SEG145 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@16->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG146 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@16->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG147 [48] phi from testBinaryOperator::@16 to testBinaryOperator::@17 [phi:testBinaryOperator::@16->testBinaryOperator::@17] + //SEG148 testBinaryOperator::@17 + //SEG149 [49] call assertType + //SEG150 [87] phi from testBinaryOperator::@17 to assertType [phi:testBinaryOperator::@17->assertType] + //SEG151 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@17->assertType#0] -- register_copy + //SEG152 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@17->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG153 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@17->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG154 [50] phi from testBinaryOperator::@17 to testBinaryOperator::@18 [phi:testBinaryOperator::@17->testBinaryOperator::@18] + //SEG155 testBinaryOperator::@18 + //SEG156 [51] call assertType + //SEG157 [87] phi from testBinaryOperator::@18 to assertType [phi:testBinaryOperator::@18->assertType] + //SEG158 [87] phi (byte) idx#105 = (byte) $50 [phi:testBinaryOperator::@18->assertType#0] -- vbuxx=vbuc1 + ldx #$50 + //SEG159 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@18->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG160 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@18->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG161 [52] phi from testBinaryOperator::@18 to testBinaryOperator::@19 [phi:testBinaryOperator::@18->testBinaryOperator::@19] + //SEG162 testBinaryOperator::@19 + //SEG163 [53] call assertType + //SEG164 [87] phi from testBinaryOperator::@19 to assertType [phi:testBinaryOperator::@19->assertType] + //SEG165 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@19->assertType#0] -- register_copy + //SEG166 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@19->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG167 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@19->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG168 [54] phi from testBinaryOperator::@19 to testBinaryOperator::@20 [phi:testBinaryOperator::@19->testBinaryOperator::@20] + //SEG169 testBinaryOperator::@20 + //SEG170 [55] call assertType + //SEG171 [87] phi from testBinaryOperator::@20 to assertType [phi:testBinaryOperator::@20->assertType] + //SEG172 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@20->assertType#0] -- register_copy + //SEG173 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@20->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG174 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testBinaryOperator::@20->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG175 [56] phi from testBinaryOperator::@20 to testBinaryOperator::@21 [phi:testBinaryOperator::@20->testBinaryOperator::@21] + //SEG176 testBinaryOperator::@21 + //SEG177 [57] call assertType + //SEG178 [87] phi from testBinaryOperator::@21 to assertType [phi:testBinaryOperator::@21->assertType] + //SEG179 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@21->assertType#0] -- register_copy + //SEG180 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@21->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG181 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testBinaryOperator::@21->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG182 [58] phi from testBinaryOperator::@21 to testBinaryOperator::@22 [phi:testBinaryOperator::@21->testBinaryOperator::@22] + //SEG183 testBinaryOperator::@22 + //SEG184 [59] call assertType + //SEG185 [87] phi from testBinaryOperator::@22 to assertType [phi:testBinaryOperator::@22->assertType] + //SEG186 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@22->assertType#0] -- register_copy + //SEG187 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@22->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG188 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@22->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG189 [60] phi from testBinaryOperator::@22 to testBinaryOperator::@23 [phi:testBinaryOperator::@22->testBinaryOperator::@23] + //SEG190 testBinaryOperator::@23 + //SEG191 [61] call assertType + //SEG192 [87] phi from testBinaryOperator::@23 to assertType [phi:testBinaryOperator::@23->assertType] + //SEG193 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@23->assertType#0] -- register_copy + //SEG194 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@23->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG195 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@23->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG196 testBinaryOperator::@24 + //SEG197 [62] (byte) idx#40 ← ++ (byte) idx#108 -- vbuxx=_inc_vbuxx + inx + //SEG198 [63] call assertType + //SEG199 [87] phi from testBinaryOperator::@24 to assertType [phi:testBinaryOperator::@24->assertType] + //SEG200 [87] phi (byte) idx#105 = (byte) idx#40 [phi:testBinaryOperator::@24->assertType#0] -- register_copy + //SEG201 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@24->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG202 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@24->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG203 [64] phi from testBinaryOperator::@24 to testBinaryOperator::@25 [phi:testBinaryOperator::@24->testBinaryOperator::@25] + //SEG204 testBinaryOperator::@25 + //SEG205 [65] call assertType + //SEG206 [87] phi from testBinaryOperator::@25 to assertType [phi:testBinaryOperator::@25->assertType] + //SEG207 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@25->assertType#0] -- register_copy + //SEG208 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@25->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG209 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@25->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG210 [66] phi from testBinaryOperator::@25 to testBinaryOperator::@26 [phi:testBinaryOperator::@25->testBinaryOperator::@26] + //SEG211 testBinaryOperator::@26 + //SEG212 [67] call assertType + //SEG213 [87] phi from testBinaryOperator::@26 to assertType [phi:testBinaryOperator::@26->assertType] + //SEG214 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@26->assertType#0] -- register_copy + //SEG215 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@26->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG216 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@26->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG217 [68] phi from testBinaryOperator::@26 to testBinaryOperator::@27 [phi:testBinaryOperator::@26->testBinaryOperator::@27] + //SEG218 testBinaryOperator::@27 + //SEG219 [69] call assertType + //SEG220 [87] phi from testBinaryOperator::@27 to assertType [phi:testBinaryOperator::@27->assertType] + //SEG221 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@27->assertType#0] -- register_copy + //SEG222 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@27->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG223 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@27->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG224 [70] phi from testBinaryOperator::@27 to testBinaryOperator::@28 [phi:testBinaryOperator::@27->testBinaryOperator::@28] + //SEG225 testBinaryOperator::@28 + //SEG226 [71] call assertType + //SEG227 [87] phi from testBinaryOperator::@28 to assertType [phi:testBinaryOperator::@28->assertType] + //SEG228 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@28->assertType#0] -- register_copy + //SEG229 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@28->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG230 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@28->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG231 [72] phi from testBinaryOperator::@28 to testBinaryOperator::@29 [phi:testBinaryOperator::@28->testBinaryOperator::@29] + //SEG232 testBinaryOperator::@29 + //SEG233 [73] call assertType + //SEG234 [87] phi from testBinaryOperator::@29 to assertType [phi:testBinaryOperator::@29->assertType] + //SEG235 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@29->assertType#0] -- register_copy + //SEG236 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@29->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG237 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@29->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG238 testBinaryOperator::@30 + //SEG239 [74] (byte) idx#47 ← ++ (byte) idx#108 -- vbuxx=_inc_vbuxx + inx + //SEG240 [75] call assertType + //SEG241 [87] phi from testBinaryOperator::@30 to assertType [phi:testBinaryOperator::@30->assertType] + //SEG242 [87] phi (byte) idx#105 = (byte) idx#47 [phi:testBinaryOperator::@30->assertType#0] -- register_copy + //SEG243 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@30->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG244 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@30->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG245 [76] phi from testBinaryOperator::@30 to testBinaryOperator::@31 [phi:testBinaryOperator::@30->testBinaryOperator::@31] + //SEG246 testBinaryOperator::@31 + //SEG247 [77] call assertType + //SEG248 [87] phi from testBinaryOperator::@31 to assertType [phi:testBinaryOperator::@31->assertType] + //SEG249 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@31->assertType#0] -- register_copy + //SEG250 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@31->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG251 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@31->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG252 [78] phi from testBinaryOperator::@31 to testBinaryOperator::@32 [phi:testBinaryOperator::@31->testBinaryOperator::@32] + //SEG253 testBinaryOperator::@32 + //SEG254 [79] call assertType + //SEG255 [87] phi from testBinaryOperator::@32 to assertType [phi:testBinaryOperator::@32->assertType] + //SEG256 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@32->assertType#0] -- register_copy + //SEG257 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@32->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG258 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@32->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG259 [80] phi from testBinaryOperator::@32 to testBinaryOperator::@33 [phi:testBinaryOperator::@32->testBinaryOperator::@33] + //SEG260 testBinaryOperator::@33 + //SEG261 [81] call assertType + //SEG262 [87] phi from testBinaryOperator::@33 to assertType [phi:testBinaryOperator::@33->assertType] + //SEG263 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@33->assertType#0] -- register_copy + //SEG264 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@33->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG265 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@33->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG266 [82] phi from testBinaryOperator::@33 to testBinaryOperator::@34 [phi:testBinaryOperator::@33->testBinaryOperator::@34] + //SEG267 testBinaryOperator::@34 + //SEG268 [83] call assertType + //SEG269 [87] phi from testBinaryOperator::@34 to assertType [phi:testBinaryOperator::@34->assertType] + //SEG270 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@34->assertType#0] -- register_copy + //SEG271 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@34->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG272 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testBinaryOperator::@34->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG273 [84] phi from testBinaryOperator::@34 to testBinaryOperator::@35 [phi:testBinaryOperator::@34->testBinaryOperator::@35] + //SEG274 testBinaryOperator::@35 + //SEG275 [85] call assertType + //SEG276 [87] phi from testBinaryOperator::@35 to assertType [phi:testBinaryOperator::@35->assertType] + //SEG277 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testBinaryOperator::@35->assertType#0] -- register_copy + //SEG278 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@35->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG279 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testBinaryOperator::@35->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG280 testBinaryOperator::@return + //SEG281 [86] return + rts +} +//SEG282 assertType +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte register(Y) t1, byte zeropage(4) t2) +assertType: { + .label t2 = 4 + //SEG283 [88] if((byte) assertType::t1#42==(byte) assertType::t2#42) goto assertType::@1 -- vbuyy_eq_vbuz1_then_la1 + tya + cmp t2 + beq b1 + //SEG284 assertType::@3 + //SEG285 [89] *((const byte*) COLS#0 + (byte) idx#105) ← (const byte) RED#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #RED + sta COLS,x + //SEG286 assertType::@2 + b2: + //SEG287 [90] *((const byte*) SCREEN#0 + (byte) idx#105) ← (byte) assertType::t1#42 -- pbuc1_derefidx_vbuxx=vbuyy + tya + sta SCREEN,x + //SEG288 [91] (byte) idx#108 ← ++ (byte) idx#105 -- vbuxx=_inc_vbuxx + inx + //SEG289 assertType::@return + //SEG290 [92] return + rts + //SEG291 assertType::@1 + b1: + //SEG292 [93] *((const byte*) COLS#0 + (byte) idx#105) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #GREEN + sta COLS,x + jmp b2 +} +//SEG293 testUnaryOperator +testUnaryOperator: { + //SEG294 [95] call assertType + //SEG295 [87] phi from testUnaryOperator to assertType [phi:testUnaryOperator->assertType] + //SEG296 [87] phi (byte) idx#105 = (byte) 0 [phi:testUnaryOperator->assertType#0] -- vbuxx=vbuc1 + ldx #0 + //SEG297 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_BYTE [phi:testUnaryOperator->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG298 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_BYTE [phi:testUnaryOperator->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG299 [96] phi from testUnaryOperator to testUnaryOperator::@1 [phi:testUnaryOperator->testUnaryOperator::@1] + //SEG300 testUnaryOperator::@1 + //SEG301 [97] call assertType + //SEG302 [87] phi from testUnaryOperator::@1 to assertType [phi:testUnaryOperator::@1->assertType] + //SEG303 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@1->assertType#0] -- register_copy + //SEG304 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testUnaryOperator::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG305 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_BYTE [phi:testUnaryOperator::@1->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG306 [98] phi from testUnaryOperator::@1 to testUnaryOperator::@2 [phi:testUnaryOperator::@1->testUnaryOperator::@2] + //SEG307 testUnaryOperator::@2 + //SEG308 [99] call assertType + //SEG309 [87] phi from testUnaryOperator::@2 to assertType [phi:testUnaryOperator::@2->assertType] + //SEG310 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@2->assertType#0] -- register_copy + //SEG311 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_WORD [phi:testUnaryOperator::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG312 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_WORD [phi:testUnaryOperator::@2->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG313 [100] phi from testUnaryOperator::@2 to testUnaryOperator::@3 [phi:testUnaryOperator::@2->testUnaryOperator::@3] + //SEG314 testUnaryOperator::@3 + //SEG315 [101] call assertType + //SEG316 [87] phi from testUnaryOperator::@3 to assertType [phi:testUnaryOperator::@3->assertType] + //SEG317 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@3->assertType#0] -- register_copy + //SEG318 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_WORD [phi:testUnaryOperator::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG319 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_WORD [phi:testUnaryOperator::@3->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG320 [102] phi from testUnaryOperator::@3 to testUnaryOperator::@4 [phi:testUnaryOperator::@3->testUnaryOperator::@4] + //SEG321 testUnaryOperator::@4 + //SEG322 [103] call assertType + //SEG323 [87] phi from testUnaryOperator::@4 to assertType [phi:testUnaryOperator::@4->assertType] + //SEG324 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@4->assertType#0] -- register_copy + //SEG325 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_DWORD [phi:testUnaryOperator::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG326 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_DWORD [phi:testUnaryOperator::@4->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG327 [104] phi from testUnaryOperator::@4 to testUnaryOperator::@5 [phi:testUnaryOperator::@4->testUnaryOperator::@5] + //SEG328 testUnaryOperator::@5 + //SEG329 [105] call assertType + //SEG330 [87] phi from testUnaryOperator::@5 to assertType [phi:testUnaryOperator::@5->assertType] + //SEG331 [87] phi (byte) idx#105 = (byte) idx#108 [phi:testUnaryOperator::@5->assertType#0] -- register_copy + //SEG332 [87] phi (byte) assertType::t2#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testUnaryOperator::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG333 [87] phi (byte) assertType::t1#42 = (const byte) TYPEID_SIGNED_DWORD [phi:testUnaryOperator::@5->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG334 testUnaryOperator::@return + //SEG335 [106] return + rts +} + diff --git a/src/test/ref/int-conversion.sym b/src/test/ref/int-conversion.sym new file mode 100644 index 000000000..c17ed3db6 --- /dev/null +++ b/src/test/ref/int-conversion.sym @@ -0,0 +1,90 @@ +(label) @1 +(label) @begin +(label) @end +(byte*) COLS +(const byte*) COLS#0 COLS = ((byte*))(word) $d800 +(byte) GREEN +(const byte) GREEN#0 GREEN = (byte) 5 +(byte) RED +(const byte) RED#0 RED = (byte) 2 +(byte*) SCREEN +(const byte*) SCREEN#0 SCREEN = ((byte*))(word) $400 +(const byte) TYPEID_BYTE TYPEID_BYTE = (number) 1 +(const byte) TYPEID_DWORD TYPEID_DWORD = (number) 5 +(const byte) TYPEID_SIGNED_BYTE TYPEID_SIGNED_BYTE = (number) 2 +(const byte) TYPEID_SIGNED_DWORD TYPEID_SIGNED_DWORD = (number) 6 +(const byte) TYPEID_SIGNED_WORD TYPEID_SIGNED_WORD = (number) 4 +(const byte) TYPEID_WORD TYPEID_WORD = (number) 3 +(void()) assertType((byte) assertType::t1 , (byte) assertType::t2) +(label) assertType::@1 +(label) assertType::@2 +(label) assertType::@3 +(label) assertType::@return +(byte) assertType::t1 +(byte) assertType::t1#42 reg byte y 1.0 +(byte) assertType::t2 +(byte) assertType::t2#42 t2 zp ZP_BYTE:4 2.0 +(byte) idx +(byte) idx#105 reg byte x 17.200000000000003 +(byte) idx#108 reg byte x 1.0526315789473677 +(byte) idx#19 reg byte x 4.0 +(byte) idx#26 reg byte x 4.0 +(byte) idx#40 reg byte x 4.0 +(byte) idx#47 reg byte x 4.0 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@return +(byte*) main::s +(byte*) main::s#1 s zp ZP_WORD:2 16.5 +(byte*) main::s#2 s zp ZP_WORD:2 16.5 +(void()) testBinaryOperator() +(label) testBinaryOperator::@1 +(label) testBinaryOperator::@10 +(label) testBinaryOperator::@11 +(label) testBinaryOperator::@12 +(label) testBinaryOperator::@13 +(label) testBinaryOperator::@14 +(label) testBinaryOperator::@15 +(label) testBinaryOperator::@16 +(label) testBinaryOperator::@17 +(label) testBinaryOperator::@18 +(label) testBinaryOperator::@19 +(label) testBinaryOperator::@2 +(label) testBinaryOperator::@20 +(label) testBinaryOperator::@21 +(label) testBinaryOperator::@22 +(label) testBinaryOperator::@23 +(label) testBinaryOperator::@24 +(label) testBinaryOperator::@25 +(label) testBinaryOperator::@26 +(label) testBinaryOperator::@27 +(label) testBinaryOperator::@28 +(label) testBinaryOperator::@29 +(label) testBinaryOperator::@3 +(label) testBinaryOperator::@30 +(label) testBinaryOperator::@31 +(label) testBinaryOperator::@32 +(label) testBinaryOperator::@33 +(label) testBinaryOperator::@34 +(label) testBinaryOperator::@35 +(label) testBinaryOperator::@4 +(label) testBinaryOperator::@5 +(label) testBinaryOperator::@6 +(label) testBinaryOperator::@7 +(label) testBinaryOperator::@8 +(label) testBinaryOperator::@9 +(label) testBinaryOperator::@return +(void()) testUnaryOperator() +(label) testUnaryOperator::@1 +(label) testUnaryOperator::@2 +(label) testUnaryOperator::@3 +(label) testUnaryOperator::@4 +(label) testUnaryOperator::@5 +(label) testUnaryOperator::@return + +zp ZP_WORD:2 [ main::s#2 main::s#1 ] +reg byte y [ assertType::t1#42 ] +zp ZP_BYTE:4 [ assertType::t2#42 ] +reg byte x [ idx#105 idx#108 idx#26 idx#40 idx#47 idx#19 ] diff --git a/src/test/ref/int-literals.asm b/src/test/ref/int-literals.asm new file mode 100644 index 000000000..8f7755754 --- /dev/null +++ b/src/test/ref/int-literals.asm @@ -0,0 +1,122 @@ +// Tests different integer literal types +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + .const TYPEID_BYTE = 1 + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_WORD = 3 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_DWORD = 5 + .const TYPEID_SIGNED_DWORD = 6 + .const RED = 2 + .const GREEN = 5 +main: { + .label s = 2 + lda #<$400 + sta s + lda #>$400 + sta s+1 + b1: + lda #' ' + ldy #0 + sta (s),y + inc s + bne !+ + inc s+1 + !: + lda s+1 + cmp #>$400+$3e8 + bcc b1 + bne !+ + lda s + cmp #<$400+$3e8 + bcc b1 + !: + jsr testSimpleTypes + rts +} +testSimpleTypes: { + ldx #0 + lda #TYPEID_BYTE + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_BYTE + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + tay + jsr assertType + rts +} +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte register(Y) t1, byte zeropage(4) t2) +assertType: { + .label t2 = 4 + tya + cmp t2 + beq b1 + lda #RED + sta $d800,x + b2: + tya + sta $400,x + inx + rts + b1: + lda #GREEN + sta $d800,x + jmp b2 +} diff --git a/src/test/ref/int-literals.cfg b/src/test/ref/int-literals.cfg new file mode 100644 index 000000000..eb00a0ab4 --- /dev/null +++ b/src/test/ref/int-literals.cfg @@ -0,0 +1,107 @@ +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + to:main::@1 +main::@1: scope:[main] from main main::@1 + [5] (byte*) main::s#2 ← phi( main/(byte*)(word) $400 main::@1/(byte*) main::s#1 ) + [6] *((byte*) main::s#2) ← (byte) ' ' + [7] (byte*) main::s#1 ← ++ (byte*) main::s#2 + [8] if((byte*) main::s#1<(byte*)(word) $400+(word) $3e8) goto main::@1 + to:main::@2 +main::@2: scope:[main] from main::@1 + [9] phi() + [10] call testSimpleTypes + to:main::@return +main::@return: scope:[main] from main::@2 + [11] return + to:@return +testSimpleTypes: scope:[testSimpleTypes] from main::@2 + [12] phi() + [13] call assertType + to:testSimpleTypes::@1 +testSimpleTypes::@1: scope:[testSimpleTypes] from testSimpleTypes + [14] phi() + [15] call assertType + to:testSimpleTypes::@2 +testSimpleTypes::@2: scope:[testSimpleTypes] from testSimpleTypes::@1 + [16] phi() + [17] call assertType + to:testSimpleTypes::@3 +testSimpleTypes::@3: scope:[testSimpleTypes] from testSimpleTypes::@2 + [18] phi() + [19] call assertType + to:testSimpleTypes::@4 +testSimpleTypes::@4: scope:[testSimpleTypes] from testSimpleTypes::@3 + [20] phi() + [21] call assertType + to:testSimpleTypes::@5 +testSimpleTypes::@5: scope:[testSimpleTypes] from testSimpleTypes::@4 + [22] phi() + [23] call assertType + to:testSimpleTypes::@6 +testSimpleTypes::@6: scope:[testSimpleTypes] from testSimpleTypes::@5 + [24] phi() + [25] call assertType + to:testSimpleTypes::@7 +testSimpleTypes::@7: scope:[testSimpleTypes] from testSimpleTypes::@6 + [26] phi() + [27] call assertType + to:testSimpleTypes::@8 +testSimpleTypes::@8: scope:[testSimpleTypes] from testSimpleTypes::@7 + [28] phi() + [29] call assertType + to:testSimpleTypes::@9 +testSimpleTypes::@9: scope:[testSimpleTypes] from testSimpleTypes::@8 + [30] phi() + [31] call assertType + to:testSimpleTypes::@10 +testSimpleTypes::@10: scope:[testSimpleTypes] from testSimpleTypes::@9 + [32] phi() + [33] call assertType + to:testSimpleTypes::@11 +testSimpleTypes::@11: scope:[testSimpleTypes] from testSimpleTypes::@10 + [34] phi() + [35] call assertType + to:testSimpleTypes::@12 +testSimpleTypes::@12: scope:[testSimpleTypes] from testSimpleTypes::@11 + [36] phi() + [37] call assertType + to:testSimpleTypes::@13 +testSimpleTypes::@13: scope:[testSimpleTypes] from testSimpleTypes::@12 + [38] phi() + [39] call assertType + to:testSimpleTypes::@14 +testSimpleTypes::@14: scope:[testSimpleTypes] from testSimpleTypes::@13 + [40] phi() + [41] call assertType + to:testSimpleTypes::@return +testSimpleTypes::@return: scope:[testSimpleTypes] from testSimpleTypes::@14 + [42] return + to:@return +assertType: scope:[assertType] from testSimpleTypes testSimpleTypes::@1 testSimpleTypes::@10 testSimpleTypes::@11 testSimpleTypes::@12 testSimpleTypes::@13 testSimpleTypes::@14 testSimpleTypes::@2 testSimpleTypes::@3 testSimpleTypes::@4 testSimpleTypes::@5 testSimpleTypes::@6 testSimpleTypes::@7 testSimpleTypes::@8 testSimpleTypes::@9 + [43] (byte) idx#41 ← phi( testSimpleTypes/(byte) 0 testSimpleTypes::@1/(byte) idx#20 testSimpleTypes::@10/(byte) idx#20 testSimpleTypes::@11/(byte) idx#20 testSimpleTypes::@12/(byte) idx#20 testSimpleTypes::@13/(byte) idx#20 testSimpleTypes::@14/(byte) idx#20 testSimpleTypes::@2/(byte) idx#20 testSimpleTypes::@3/(byte) idx#20 testSimpleTypes::@4/(byte) idx#20 testSimpleTypes::@5/(byte) idx#20 testSimpleTypes::@6/(byte) idx#20 testSimpleTypes::@7/(byte) idx#20 testSimpleTypes::@8/(byte) idx#20 testSimpleTypes::@9/(byte) idx#20 ) + [43] (byte) assertType::t2#15 ← phi( testSimpleTypes/(const byte) TYPEID_BYTE testSimpleTypes::@1/(const byte) TYPEID_BYTE testSimpleTypes::@10/(const byte) TYPEID_DWORD testSimpleTypes::@11/(const byte) TYPEID_DWORD testSimpleTypes::@12/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@13/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@14/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@2/(const byte) TYPEID_SIGNED_BYTE testSimpleTypes::@3/(const byte) TYPEID_SIGNED_BYTE testSimpleTypes::@4/(const byte) TYPEID_WORD testSimpleTypes::@5/(const byte) TYPEID_WORD testSimpleTypes::@6/(const byte) TYPEID_WORD testSimpleTypes::@7/(const byte) TYPEID_SIGNED_WORD testSimpleTypes::@8/(const byte) TYPEID_SIGNED_WORD testSimpleTypes::@9/(const byte) TYPEID_SIGNED_WORD ) + [43] (byte) assertType::t1#15 ← phi( testSimpleTypes/(const byte) TYPEID_BYTE testSimpleTypes::@1/(const byte) TYPEID_BYTE testSimpleTypes::@10/(const byte) TYPEID_DWORD testSimpleTypes::@11/(const byte) TYPEID_DWORD testSimpleTypes::@12/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@13/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@14/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@2/(const byte) TYPEID_SIGNED_BYTE testSimpleTypes::@3/(const byte) TYPEID_SIGNED_BYTE testSimpleTypes::@4/(const byte) TYPEID_WORD testSimpleTypes::@5/(const byte) TYPEID_WORD testSimpleTypes::@6/(const byte) TYPEID_WORD testSimpleTypes::@7/(const byte) TYPEID_SIGNED_WORD testSimpleTypes::@8/(const byte) TYPEID_SIGNED_WORD testSimpleTypes::@9/(const byte) TYPEID_SIGNED_WORD ) + [44] if((byte) assertType::t1#15==(byte) assertType::t2#15) goto assertType::@1 + to:assertType::@3 +assertType::@3: scope:[assertType] from assertType + [45] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) RED#0 + to:assertType::@2 +assertType::@2: scope:[assertType] from assertType::@1 assertType::@3 + [46] *((byte*)(word) $400 + (byte) idx#41) ← (byte) assertType::t1#15 + [47] (byte) idx#20 ← ++ (byte) idx#41 + to:assertType::@return +assertType::@return: scope:[assertType] from assertType::@2 + [48] return + to:@return +assertType::@1: scope:[assertType] from assertType + [49] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) GREEN#0 + to:assertType::@2 diff --git a/src/test/ref/int-literals.log b/src/test/ref/int-literals.log new file mode 100644 index 000000000..4030e6548 --- /dev/null +++ b/src/test/ref/int-literals.log @@ -0,0 +1,1947 @@ +Resolving typeid() (byte~) testSimpleTypes::$0 ← typeid (byte) $c +Resolving typeid() (byte~) testSimpleTypes::$2 ← typeid (byte) $c +Resolving typeid() (byte~) testSimpleTypes::$4 ← typeid (signed byte) $c +Resolving typeid() (byte~) testSimpleTypes::$6 ← typeid (signed byte) $c +Resolving typeid() (byte~) testSimpleTypes::$8 ← typeid (word) $c +Resolving typeid() (byte~) testSimpleTypes::$10 ← typeid (word) $c +Resolving typeid() (byte~) testSimpleTypes::$12 ← typeid (word) $c +Resolving typeid() (byte~) testSimpleTypes::$14 ← typeid (signed word) $c +Resolving typeid() (byte~) testSimpleTypes::$16 ← typeid (signed word) $c +Resolving typeid() (byte~) testSimpleTypes::$18 ← typeid (signed word) $c +Resolving typeid() (byte~) testSimpleTypes::$20 ← typeid (dword) $c +Resolving typeid() (byte~) testSimpleTypes::$22 ← typeid (dword) $c +Resolving typeid() (byte~) testSimpleTypes::$24 ← typeid (signed dword) $c +Resolving typeid() (byte~) testSimpleTypes::$26 ← typeid (signed dword) $c +Resolving typeid() (byte~) testSimpleTypes::$28 ← typeid (signed dword) $c +Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (word) $400 +Adding pointer type conversion cast (byte*) COLS in (byte*) COLS ← (word) $d800 + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + (byte) RED#0 ← (byte) 2 + (byte) GREEN#0 ← (byte) 5 + (word) $0 ← (word) $400 + (byte*) SCREEN#0 ← ((byte*)) (word) $0 + (word) $1 ← (word) $d800 + (byte*) COLS#0 ← ((byte*)) (word) $1 + (byte) idx#0 ← (byte) 0 + to:@3 +main: scope:[main] from @3 + (byte) idx#50 ← phi( @3/(byte) idx#48 ) + (byte*) main::s#0 ← (byte*) SCREEN#0 + to:main::@1 +main::@1: scope:[main] from main main::@1 + (byte) idx#49 ← phi( main/(byte) idx#50 main::@1/(byte) idx#49 ) + (byte*) main::s#2 ← phi( main/(byte*) main::s#0 main::@1/(byte*) main::s#1 ) + *((byte*) main::s#2) ← (byte) ' ' + (byte*) main::s#1 ← ++ (byte*) main::s#2 + (byte*~) main::$1 ← (byte*) SCREEN#0 + (word) $3e8 + (bool~) main::$2 ← (byte*) main::s#1 < (byte*~) main::$1 + if((bool~) main::$2) goto main::@1 + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte) idx#46 ← phi( main::@1/(byte) idx#49 ) + call testSimpleTypes + to:main::@3 +main::@3: scope:[main] from main::@2 + (byte) idx#23 ← phi( main::@2/(byte) idx#19 ) + (byte) idx#1 ← (byte) idx#23 + to:main::@return +main::@return: scope:[main] from main::@3 + (byte) idx#24 ← phi( main::@3/(byte) idx#1 ) + (byte) idx#2 ← (byte) idx#24 + return + to:@return +testSimpleTypes: scope:[testSimpleTypes] from main::@2 + (byte) idx#3 ← (byte) 0 + (byte~) testSimpleTypes::$0 ← (const byte) TYPEID_BYTE + (byte) assertType::t1#0 ← (byte~) testSimpleTypes::$0 + (byte) assertType::t2#0 ← (const byte) TYPEID_BYTE + call assertType + to:testSimpleTypes::@1 +testSimpleTypes::@1: scope:[testSimpleTypes] from testSimpleTypes + (byte) idx#25 ← phi( testSimpleTypes/(byte) idx#21 ) + (byte) idx#4 ← (byte) idx#25 + (byte~) testSimpleTypes::$2 ← (const byte) TYPEID_BYTE + (byte) assertType::t1#1 ← (byte~) testSimpleTypes::$2 + (byte) assertType::t2#1 ← (const byte) TYPEID_BYTE + call assertType + to:testSimpleTypes::@2 +testSimpleTypes::@2: scope:[testSimpleTypes] from testSimpleTypes::@1 + (byte) idx#26 ← phi( testSimpleTypes::@1/(byte) idx#21 ) + (byte) idx#5 ← (byte) idx#26 + (byte~) testSimpleTypes::$4 ← (const byte) TYPEID_SIGNED_BYTE + (byte) assertType::t1#2 ← (byte~) testSimpleTypes::$4 + (byte) assertType::t2#2 ← (const byte) TYPEID_SIGNED_BYTE + call assertType + to:testSimpleTypes::@3 +testSimpleTypes::@3: scope:[testSimpleTypes] from testSimpleTypes::@2 + (byte) idx#27 ← phi( testSimpleTypes::@2/(byte) idx#21 ) + (byte) idx#6 ← (byte) idx#27 + (byte~) testSimpleTypes::$6 ← (const byte) TYPEID_SIGNED_BYTE + (byte) assertType::t1#3 ← (byte~) testSimpleTypes::$6 + (byte) assertType::t2#3 ← (const byte) TYPEID_SIGNED_BYTE + call assertType + to:testSimpleTypes::@4 +testSimpleTypes::@4: scope:[testSimpleTypes] from testSimpleTypes::@3 + (byte) idx#28 ← phi( testSimpleTypes::@3/(byte) idx#21 ) + (byte) idx#7 ← (byte) idx#28 + (byte~) testSimpleTypes::$8 ← (const byte) TYPEID_WORD + (byte) assertType::t1#4 ← (byte~) testSimpleTypes::$8 + (byte) assertType::t2#4 ← (const byte) TYPEID_WORD + call assertType + to:testSimpleTypes::@5 +testSimpleTypes::@5: scope:[testSimpleTypes] from testSimpleTypes::@4 + (byte) idx#29 ← phi( testSimpleTypes::@4/(byte) idx#21 ) + (byte) idx#8 ← (byte) idx#29 + (byte~) testSimpleTypes::$10 ← (const byte) TYPEID_WORD + (byte) assertType::t1#5 ← (byte~) testSimpleTypes::$10 + (byte) assertType::t2#5 ← (const byte) TYPEID_WORD + call assertType + to:testSimpleTypes::@6 +testSimpleTypes::@6: scope:[testSimpleTypes] from testSimpleTypes::@5 + (byte) idx#30 ← phi( testSimpleTypes::@5/(byte) idx#21 ) + (byte) idx#9 ← (byte) idx#30 + (byte~) testSimpleTypes::$12 ← (const byte) TYPEID_WORD + (byte) assertType::t1#6 ← (byte~) testSimpleTypes::$12 + (byte) assertType::t2#6 ← (const byte) TYPEID_WORD + call assertType + to:testSimpleTypes::@7 +testSimpleTypes::@7: scope:[testSimpleTypes] from testSimpleTypes::@6 + (byte) idx#31 ← phi( testSimpleTypes::@6/(byte) idx#21 ) + (byte) idx#10 ← (byte) idx#31 + (byte~) testSimpleTypes::$14 ← (const byte) TYPEID_SIGNED_WORD + (byte) assertType::t1#7 ← (byte~) testSimpleTypes::$14 + (byte) assertType::t2#7 ← (const byte) TYPEID_SIGNED_WORD + call assertType + to:testSimpleTypes::@8 +testSimpleTypes::@8: scope:[testSimpleTypes] from testSimpleTypes::@7 + (byte) idx#32 ← phi( testSimpleTypes::@7/(byte) idx#21 ) + (byte) idx#11 ← (byte) idx#32 + (byte~) testSimpleTypes::$16 ← (const byte) TYPEID_SIGNED_WORD + (byte) assertType::t1#8 ← (byte~) testSimpleTypes::$16 + (byte) assertType::t2#8 ← (const byte) TYPEID_SIGNED_WORD + call assertType + to:testSimpleTypes::@9 +testSimpleTypes::@9: scope:[testSimpleTypes] from testSimpleTypes::@8 + (byte) idx#33 ← phi( testSimpleTypes::@8/(byte) idx#21 ) + (byte) idx#12 ← (byte) idx#33 + (byte~) testSimpleTypes::$18 ← (const byte) TYPEID_SIGNED_WORD + (byte) assertType::t1#9 ← (byte~) testSimpleTypes::$18 + (byte) assertType::t2#9 ← (const byte) TYPEID_SIGNED_WORD + call assertType + to:testSimpleTypes::@10 +testSimpleTypes::@10: scope:[testSimpleTypes] from testSimpleTypes::@9 + (byte) idx#34 ← phi( testSimpleTypes::@9/(byte) idx#21 ) + (byte) idx#13 ← (byte) idx#34 + (byte~) testSimpleTypes::$20 ← (const byte) TYPEID_DWORD + (byte) assertType::t1#10 ← (byte~) testSimpleTypes::$20 + (byte) assertType::t2#10 ← (const byte) TYPEID_DWORD + call assertType + to:testSimpleTypes::@11 +testSimpleTypes::@11: scope:[testSimpleTypes] from testSimpleTypes::@10 + (byte) idx#35 ← phi( testSimpleTypes::@10/(byte) idx#21 ) + (byte) idx#14 ← (byte) idx#35 + (byte~) testSimpleTypes::$22 ← (const byte) TYPEID_DWORD + (byte) assertType::t1#11 ← (byte~) testSimpleTypes::$22 + (byte) assertType::t2#11 ← (const byte) TYPEID_DWORD + call assertType + to:testSimpleTypes::@12 +testSimpleTypes::@12: scope:[testSimpleTypes] from testSimpleTypes::@11 + (byte) idx#36 ← phi( testSimpleTypes::@11/(byte) idx#21 ) + (byte) idx#15 ← (byte) idx#36 + (byte~) testSimpleTypes::$24 ← (const byte) TYPEID_SIGNED_DWORD + (byte) assertType::t1#12 ← (byte~) testSimpleTypes::$24 + (byte) assertType::t2#12 ← (const byte) TYPEID_SIGNED_DWORD + call assertType + to:testSimpleTypes::@13 +testSimpleTypes::@13: scope:[testSimpleTypes] from testSimpleTypes::@12 + (byte) idx#37 ← phi( testSimpleTypes::@12/(byte) idx#21 ) + (byte) idx#16 ← (byte) idx#37 + (byte~) testSimpleTypes::$26 ← (const byte) TYPEID_SIGNED_DWORD + (byte) assertType::t1#13 ← (byte~) testSimpleTypes::$26 + (byte) assertType::t2#13 ← (const byte) TYPEID_SIGNED_DWORD + call assertType + to:testSimpleTypes::@14 +testSimpleTypes::@14: scope:[testSimpleTypes] from testSimpleTypes::@13 + (byte) idx#38 ← phi( testSimpleTypes::@13/(byte) idx#21 ) + (byte) idx#17 ← (byte) idx#38 + (byte~) testSimpleTypes::$28 ← (const byte) TYPEID_SIGNED_DWORD + (byte) assertType::t1#14 ← (byte~) testSimpleTypes::$28 + (byte) assertType::t2#14 ← (const byte) TYPEID_SIGNED_DWORD + call assertType + to:testSimpleTypes::@15 +testSimpleTypes::@15: scope:[testSimpleTypes] from testSimpleTypes::@14 + (byte) idx#39 ← phi( testSimpleTypes::@14/(byte) idx#21 ) + (byte) idx#18 ← (byte) idx#39 + to:testSimpleTypes::@return +testSimpleTypes::@return: scope:[testSimpleTypes] from testSimpleTypes::@15 + (byte) idx#40 ← phi( testSimpleTypes::@15/(byte) idx#18 ) + (byte) idx#19 ← (byte) idx#40 + return + to:@return +assertType: scope:[assertType] from testSimpleTypes testSimpleTypes::@1 testSimpleTypes::@10 testSimpleTypes::@11 testSimpleTypes::@12 testSimpleTypes::@13 testSimpleTypes::@14 testSimpleTypes::@2 testSimpleTypes::@3 testSimpleTypes::@4 testSimpleTypes::@5 testSimpleTypes::@6 testSimpleTypes::@7 testSimpleTypes::@8 testSimpleTypes::@9 + (byte) idx#47 ← phi( testSimpleTypes/(byte) idx#3 testSimpleTypes::@1/(byte) idx#4 testSimpleTypes::@10/(byte) idx#13 testSimpleTypes::@11/(byte) idx#14 testSimpleTypes::@12/(byte) idx#15 testSimpleTypes::@13/(byte) idx#16 testSimpleTypes::@14/(byte) idx#17 testSimpleTypes::@2/(byte) idx#5 testSimpleTypes::@3/(byte) idx#6 testSimpleTypes::@4/(byte) idx#7 testSimpleTypes::@5/(byte) idx#8 testSimpleTypes::@6/(byte) idx#9 testSimpleTypes::@7/(byte) idx#10 testSimpleTypes::@8/(byte) idx#11 testSimpleTypes::@9/(byte) idx#12 ) + (byte) assertType::t2#15 ← phi( testSimpleTypes/(byte) assertType::t2#0 testSimpleTypes::@1/(byte) assertType::t2#1 testSimpleTypes::@10/(byte) assertType::t2#10 testSimpleTypes::@11/(byte) assertType::t2#11 testSimpleTypes::@12/(byte) assertType::t2#12 testSimpleTypes::@13/(byte) assertType::t2#13 testSimpleTypes::@14/(byte) assertType::t2#14 testSimpleTypes::@2/(byte) assertType::t2#2 testSimpleTypes::@3/(byte) assertType::t2#3 testSimpleTypes::@4/(byte) assertType::t2#4 testSimpleTypes::@5/(byte) assertType::t2#5 testSimpleTypes::@6/(byte) assertType::t2#6 testSimpleTypes::@7/(byte) assertType::t2#7 testSimpleTypes::@8/(byte) assertType::t2#8 testSimpleTypes::@9/(byte) assertType::t2#9 ) + (byte) assertType::t1#15 ← phi( testSimpleTypes/(byte) assertType::t1#0 testSimpleTypes::@1/(byte) assertType::t1#1 testSimpleTypes::@10/(byte) assertType::t1#10 testSimpleTypes::@11/(byte) assertType::t1#11 testSimpleTypes::@12/(byte) assertType::t1#12 testSimpleTypes::@13/(byte) assertType::t1#13 testSimpleTypes::@14/(byte) assertType::t1#14 testSimpleTypes::@2/(byte) assertType::t1#2 testSimpleTypes::@3/(byte) assertType::t1#3 testSimpleTypes::@4/(byte) assertType::t1#4 testSimpleTypes::@5/(byte) assertType::t1#5 testSimpleTypes::@6/(byte) assertType::t1#6 testSimpleTypes::@7/(byte) assertType::t1#7 testSimpleTypes::@8/(byte) assertType::t1#8 testSimpleTypes::@9/(byte) assertType::t1#9 ) + (bool~) assertType::$0 ← (byte) assertType::t1#15 == (byte) assertType::t2#15 + if((bool~) assertType::$0) goto assertType::@1 + to:assertType::@3 +assertType::@1: scope:[assertType] from assertType + (byte) assertType::t1#17 ← phi( assertType/(byte) assertType::t1#15 ) + (byte) idx#41 ← phi( assertType/(byte) idx#47 ) + *((byte*) COLS#0 + (byte) idx#41) ← (byte) GREEN#0 + to:assertType::@2 +assertType::@3: scope:[assertType] from assertType + (byte) assertType::t1#18 ← phi( assertType/(byte) assertType::t1#15 ) + (byte) idx#42 ← phi( assertType/(byte) idx#47 ) + *((byte*) COLS#0 + (byte) idx#42) ← (byte) RED#0 + to:assertType::@2 +assertType::@2: scope:[assertType] from assertType::@1 assertType::@3 + (byte) idx#43 ← phi( assertType::@1/(byte) idx#41 assertType::@3/(byte) idx#42 ) + (byte) assertType::t1#16 ← phi( assertType::@1/(byte) assertType::t1#17 assertType::@3/(byte) assertType::t1#18 ) + *((byte*) SCREEN#0 + (byte) idx#43) ← (byte) assertType::t1#16 + (byte) idx#20 ← ++ (byte) idx#43 + to:assertType::@return +assertType::@return: scope:[assertType] from assertType::@2 + (byte) idx#44 ← phi( assertType::@2/(byte) idx#20 ) + (byte) idx#21 ← (byte) idx#44 + return + to:@return +@3: scope:[] from @begin + (byte) idx#48 ← phi( @begin/(byte) idx#0 ) + call main + to:@4 +@4: scope:[] from @3 + (byte) idx#45 ← phi( @3/(byte) idx#2 ) + (byte) idx#22 ← (byte) idx#45 + to:@end +@end: scope:[] from @4 + +SYMBOL TABLE SSA +(word) $0 +(word) $1 +(label) @3 +(label) @4 +(label) @begin +(label) @end +(byte*) COLS +(byte*) COLS#0 +(byte) GREEN +(byte) GREEN#0 +(byte) RED +(byte) RED#0 +(byte*) SCREEN +(byte*) SCREEN#0 +(const byte) TYPEID_BYTE = (number) 1 +(const byte) TYPEID_DWORD = (number) 5 +(const byte) TYPEID_SIGNED_BYTE = (number) 2 +(const byte) TYPEID_SIGNED_DWORD = (number) 6 +(const byte) TYPEID_SIGNED_WORD = (number) 4 +(const byte) TYPEID_WORD = (number) 3 +(void()) assertType((byte) assertType::t1 , (byte) assertType::t2) +(bool~) assertType::$0 +(label) assertType::@1 +(label) assertType::@2 +(label) assertType::@3 +(label) assertType::@return +(byte) assertType::t1 +(byte) assertType::t1#0 +(byte) assertType::t1#1 +(byte) assertType::t1#10 +(byte) assertType::t1#11 +(byte) assertType::t1#12 +(byte) assertType::t1#13 +(byte) assertType::t1#14 +(byte) assertType::t1#15 +(byte) assertType::t1#16 +(byte) assertType::t1#17 +(byte) assertType::t1#18 +(byte) assertType::t1#2 +(byte) assertType::t1#3 +(byte) assertType::t1#4 +(byte) assertType::t1#5 +(byte) assertType::t1#6 +(byte) assertType::t1#7 +(byte) assertType::t1#8 +(byte) assertType::t1#9 +(byte) assertType::t2 +(byte) assertType::t2#0 +(byte) assertType::t2#1 +(byte) assertType::t2#10 +(byte) assertType::t2#11 +(byte) assertType::t2#12 +(byte) assertType::t2#13 +(byte) assertType::t2#14 +(byte) assertType::t2#15 +(byte) assertType::t2#2 +(byte) assertType::t2#3 +(byte) assertType::t2#4 +(byte) assertType::t2#5 +(byte) assertType::t2#6 +(byte) assertType::t2#7 +(byte) assertType::t2#8 +(byte) assertType::t2#9 +(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#17 +(byte) idx#18 +(byte) idx#19 +(byte) idx#2 +(byte) idx#20 +(byte) idx#21 +(byte) idx#22 +(byte) idx#23 +(byte) idx#24 +(byte) idx#25 +(byte) idx#26 +(byte) idx#27 +(byte) idx#28 +(byte) idx#29 +(byte) idx#3 +(byte) idx#30 +(byte) idx#31 +(byte) idx#32 +(byte) idx#33 +(byte) idx#34 +(byte) idx#35 +(byte) idx#36 +(byte) idx#37 +(byte) idx#38 +(byte) idx#39 +(byte) idx#4 +(byte) idx#40 +(byte) idx#41 +(byte) idx#42 +(byte) idx#43 +(byte) idx#44 +(byte) idx#45 +(byte) idx#46 +(byte) idx#47 +(byte) idx#48 +(byte) idx#49 +(byte) idx#5 +(byte) idx#50 +(byte) idx#6 +(byte) idx#7 +(byte) idx#8 +(byte) idx#9 +(void()) main() +(byte*~) main::$1 +(bool~) main::$2 +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@return +(byte*) main::s +(byte*) main::s#0 +(byte*) main::s#1 +(byte*) main::s#2 +(void()) testSimpleTypes() +(byte~) testSimpleTypes::$0 +(byte~) testSimpleTypes::$10 +(byte~) testSimpleTypes::$12 +(byte~) testSimpleTypes::$14 +(byte~) testSimpleTypes::$16 +(byte~) testSimpleTypes::$18 +(byte~) testSimpleTypes::$2 +(byte~) testSimpleTypes::$20 +(byte~) testSimpleTypes::$22 +(byte~) testSimpleTypes::$24 +(byte~) testSimpleTypes::$26 +(byte~) testSimpleTypes::$28 +(byte~) testSimpleTypes::$4 +(byte~) testSimpleTypes::$6 +(byte~) testSimpleTypes::$8 +(label) testSimpleTypes::@1 +(label) testSimpleTypes::@10 +(label) testSimpleTypes::@11 +(label) testSimpleTypes::@12 +(label) testSimpleTypes::@13 +(label) testSimpleTypes::@14 +(label) testSimpleTypes::@15 +(label) testSimpleTypes::@2 +(label) testSimpleTypes::@3 +(label) testSimpleTypes::@4 +(label) testSimpleTypes::@5 +(label) testSimpleTypes::@6 +(label) testSimpleTypes::@7 +(label) testSimpleTypes::@8 +(label) testSimpleTypes::@9 +(label) testSimpleTypes::@return + +Alias (byte) idx#46 = (byte) idx#49 +Alias (byte) idx#1 = (byte) idx#23 (byte) idx#24 (byte) idx#2 +Alias (byte) assertType::t1#0 = (byte~) testSimpleTypes::$0 +Alias (byte) idx#25 = (byte) idx#4 +Alias (byte) assertType::t1#1 = (byte~) testSimpleTypes::$2 +Alias (byte) idx#26 = (byte) idx#5 +Alias (byte) assertType::t1#2 = (byte~) testSimpleTypes::$4 +Alias (byte) idx#27 = (byte) idx#6 +Alias (byte) assertType::t1#3 = (byte~) testSimpleTypes::$6 +Alias (byte) idx#28 = (byte) idx#7 +Alias (byte) assertType::t1#4 = (byte~) testSimpleTypes::$8 +Alias (byte) idx#29 = (byte) idx#8 +Alias (byte) assertType::t1#5 = (byte~) testSimpleTypes::$10 +Alias (byte) idx#30 = (byte) idx#9 +Alias (byte) assertType::t1#6 = (byte~) testSimpleTypes::$12 +Alias (byte) idx#10 = (byte) idx#31 +Alias (byte) assertType::t1#7 = (byte~) testSimpleTypes::$14 +Alias (byte) idx#11 = (byte) idx#32 +Alias (byte) assertType::t1#8 = (byte~) testSimpleTypes::$16 +Alias (byte) idx#12 = (byte) idx#33 +Alias (byte) assertType::t1#9 = (byte~) testSimpleTypes::$18 +Alias (byte) idx#13 = (byte) idx#34 +Alias (byte) assertType::t1#10 = (byte~) testSimpleTypes::$20 +Alias (byte) idx#14 = (byte) idx#35 +Alias (byte) assertType::t1#11 = (byte~) testSimpleTypes::$22 +Alias (byte) idx#15 = (byte) idx#36 +Alias (byte) assertType::t1#12 = (byte~) testSimpleTypes::$24 +Alias (byte) idx#16 = (byte) idx#37 +Alias (byte) assertType::t1#13 = (byte~) testSimpleTypes::$26 +Alias (byte) idx#17 = (byte) idx#38 +Alias (byte) assertType::t1#14 = (byte~) testSimpleTypes::$28 +Alias (byte) idx#18 = (byte) idx#39 (byte) idx#40 (byte) idx#19 +Alias (byte) idx#41 = (byte) idx#47 (byte) idx#42 +Alias (byte) assertType::t1#15 = (byte) assertType::t1#17 (byte) assertType::t1#18 +Alias (byte) idx#20 = (byte) idx#44 (byte) idx#21 +Alias (byte) idx#0 = (byte) idx#48 +Alias (byte) idx#22 = (byte) idx#45 +Successful SSA optimization Pass2AliasElimination +Alias (byte) assertType::t1#15 = (byte) assertType::t1#16 +Alias (byte) idx#41 = (byte) idx#43 +Successful SSA optimization Pass2AliasElimination +Self Phi Eliminated (byte) idx#46 +Successful SSA optimization Pass2SelfPhiElimination +Redundant Phi (byte) idx#50 (byte) idx#0 +Redundant Phi (byte) idx#46 (byte) idx#50 +Redundant Phi (byte) idx#1 (byte) idx#18 +Redundant Phi (byte) idx#25 (byte) idx#20 +Redundant Phi (byte) idx#26 (byte) idx#20 +Redundant Phi (byte) idx#27 (byte) idx#20 +Redundant Phi (byte) idx#28 (byte) idx#20 +Redundant Phi (byte) idx#29 (byte) idx#20 +Redundant Phi (byte) idx#30 (byte) idx#20 +Redundant Phi (byte) idx#10 (byte) idx#20 +Redundant Phi (byte) idx#11 (byte) idx#20 +Redundant Phi (byte) idx#12 (byte) idx#20 +Redundant Phi (byte) idx#13 (byte) idx#20 +Redundant Phi (byte) idx#14 (byte) idx#20 +Redundant Phi (byte) idx#15 (byte) idx#20 +Redundant Phi (byte) idx#16 (byte) idx#20 +Redundant Phi (byte) idx#17 (byte) idx#20 +Redundant Phi (byte) idx#18 (byte) idx#20 +Redundant Phi (byte) idx#22 (byte) idx#1 +Successful SSA optimization Pass2RedundantPhiElimination +Simple Condition (bool~) main::$2 [14] if((byte*) main::s#1<(byte*~) main::$1) goto main::@1 +Simple Condition (bool~) assertType::$0 [118] if((byte) assertType::t1#15==(byte) assertType::t2#15) goto assertType::@1 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant (const byte) RED#0 = 2 +Constant (const byte) GREEN#0 = 5 +Constant (const word) $0 = $400 +Constant (const word) $1 = $d800 +Constant (const byte) idx#0 = 0 +Constant (const byte) idx#3 = 0 +Constant (const byte) assertType::t1#0 = TYPEID_BYTE +Constant (const byte) assertType::t2#0 = TYPEID_BYTE +Constant (const byte) assertType::t1#1 = TYPEID_BYTE +Constant (const byte) assertType::t2#1 = TYPEID_BYTE +Constant (const byte) assertType::t1#2 = TYPEID_SIGNED_BYTE +Constant (const byte) assertType::t2#2 = TYPEID_SIGNED_BYTE +Constant (const byte) assertType::t1#3 = TYPEID_SIGNED_BYTE +Constant (const byte) assertType::t2#3 = TYPEID_SIGNED_BYTE +Constant (const byte) assertType::t1#4 = TYPEID_WORD +Constant (const byte) assertType::t2#4 = TYPEID_WORD +Constant (const byte) assertType::t1#5 = TYPEID_WORD +Constant (const byte) assertType::t2#5 = TYPEID_WORD +Constant (const byte) assertType::t1#6 = TYPEID_WORD +Constant (const byte) assertType::t2#6 = TYPEID_WORD +Constant (const byte) assertType::t1#7 = TYPEID_SIGNED_WORD +Constant (const byte) assertType::t2#7 = TYPEID_SIGNED_WORD +Constant (const byte) assertType::t1#8 = TYPEID_SIGNED_WORD +Constant (const byte) assertType::t2#8 = TYPEID_SIGNED_WORD +Constant (const byte) assertType::t1#9 = TYPEID_SIGNED_WORD +Constant (const byte) assertType::t2#9 = TYPEID_SIGNED_WORD +Constant (const byte) assertType::t1#10 = TYPEID_DWORD +Constant (const byte) assertType::t2#10 = TYPEID_DWORD +Constant (const byte) assertType::t1#11 = TYPEID_DWORD +Constant (const byte) assertType::t2#11 = TYPEID_DWORD +Constant (const byte) assertType::t1#12 = TYPEID_SIGNED_DWORD +Constant (const byte) assertType::t2#12 = TYPEID_SIGNED_DWORD +Constant (const byte) assertType::t1#13 = TYPEID_SIGNED_DWORD +Constant (const byte) assertType::t2#13 = TYPEID_SIGNED_DWORD +Constant (const byte) assertType::t1#14 = TYPEID_SIGNED_DWORD +Constant (const byte) assertType::t2#14 = TYPEID_SIGNED_DWORD +Successful SSA optimization Pass2ConstantIdentification +Eliminating unused constant (const byte) idx#0 +Successful SSA optimization PassNEliminateUnusedVars +Eliminating Noop Cast (byte*) SCREEN#0 ← ((byte*)) (const word) $0 +Eliminating Noop Cast (byte*) COLS#0 ← ((byte*)) (const word) $1 +Successful SSA optimization Pass2NopCastElimination +Culled Empty Block (label) main::@3 +Culled Empty Block (label) testSimpleTypes::@15 +Culled Empty Block (label) @4 +Successful SSA optimization Pass2CullEmptyBlocks +Constant right-side identified [4] (byte*~) main::$1 ← (byte*)(const word) $0 + (word) $3e8 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte*) main::s#0 = (byte*)$0 +Constant (const byte*) main::$1 = (byte*)$0+$3e8 +Successful SSA optimization Pass2ConstantIdentification +Inlining constant with var siblings (const byte*) main::s#0 +Inlining constant with var siblings (const byte) assertType::t1#0 +Inlining constant with var siblings (const byte) assertType::t2#0 +Inlining constant with var siblings (const byte) assertType::t1#1 +Inlining constant with var siblings (const byte) assertType::t2#1 +Inlining constant with var siblings (const byte) assertType::t1#2 +Inlining constant with var siblings (const byte) assertType::t2#2 +Inlining constant with var siblings (const byte) assertType::t1#3 +Inlining constant with var siblings (const byte) assertType::t2#3 +Inlining constant with var siblings (const byte) assertType::t1#4 +Inlining constant with var siblings (const byte) assertType::t2#4 +Inlining constant with var siblings (const byte) assertType::t1#5 +Inlining constant with var siblings (const byte) assertType::t2#5 +Inlining constant with var siblings (const byte) assertType::t1#6 +Inlining constant with var siblings (const byte) assertType::t2#6 +Inlining constant with var siblings (const byte) assertType::t1#7 +Inlining constant with var siblings (const byte) assertType::t2#7 +Inlining constant with var siblings (const byte) assertType::t1#8 +Inlining constant with var siblings (const byte) assertType::t2#8 +Inlining constant with var siblings (const byte) assertType::t1#9 +Inlining constant with var siblings (const byte) assertType::t2#9 +Inlining constant with var siblings (const byte) assertType::t1#10 +Inlining constant with var siblings (const byte) assertType::t2#10 +Inlining constant with var siblings (const byte) assertType::t1#11 +Inlining constant with var siblings (const byte) assertType::t2#11 +Inlining constant with var siblings (const byte) assertType::t1#12 +Inlining constant with var siblings (const byte) assertType::t2#12 +Inlining constant with var siblings (const byte) assertType::t1#13 +Inlining constant with var siblings (const byte) assertType::t2#13 +Inlining constant with var siblings (const byte) assertType::t1#14 +Inlining constant with var siblings (const byte) assertType::t2#14 +Inlining constant with var siblings (const byte) idx#3 +Constant inlined assertType::t2#5 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#6 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#6 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#7 = (const byte) TYPEID_SIGNED_WORD +Constant inlined assertType::t2#7 = (const byte) TYPEID_SIGNED_WORD +Constant inlined assertType::t1#8 = (const byte) TYPEID_SIGNED_WORD +Constant inlined assertType::t2#8 = (const byte) TYPEID_SIGNED_WORD +Constant inlined assertType::t1#9 = (const byte) TYPEID_SIGNED_WORD +Constant inlined assertType::t2#9 = (const byte) TYPEID_SIGNED_WORD +Constant inlined $0 = (word) $400 +Constant inlined $1 = (word) $d800 +Constant inlined assertType::t2#11 = (const byte) TYPEID_DWORD +Constant inlined assertType::t2#10 = (const byte) TYPEID_DWORD +Constant inlined assertType::t2#13 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t2#12 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t2#14 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t1#0 = (const byte) TYPEID_BYTE +Constant inlined assertType::t2#0 = (const byte) TYPEID_BYTE +Constant inlined assertType::t1#1 = (const byte) TYPEID_BYTE +Constant inlined idx#3 = (byte) 0 +Constant inlined assertType::t2#1 = (const byte) TYPEID_BYTE +Constant inlined assertType::t1#2 = (const byte) TYPEID_SIGNED_BYTE +Constant inlined assertType::t2#2 = (const byte) TYPEID_SIGNED_BYTE +Constant inlined assertType::t1#3 = (const byte) TYPEID_SIGNED_BYTE +Constant inlined assertType::t2#3 = (const byte) TYPEID_SIGNED_BYTE +Constant inlined assertType::t1#4 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#4 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#5 = (const byte) TYPEID_WORD +Constant inlined main::s#0 = (byte*)(word) $400 +Constant inlined main::$1 = (byte*)(word) $400+(word) $3e8 +Constant inlined assertType::t1#10 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#12 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t1#11 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#14 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t1#13 = (const byte) TYPEID_SIGNED_DWORD +Successful SSA optimization Pass2ConstantInlining +Added new block during phi lifting main::@4(between main::@1 and main::@1) +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @3 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of testSimpleTypes +CALL GRAPH +Calls in [] to main:2 +Calls in [main] to testSimpleTypes:10 +Calls in [testSimpleTypes] to assertType:14 assertType:16 assertType:18 assertType:20 assertType:22 assertType:24 assertType:26 assertType:28 assertType:30 assertType:32 assertType:34 assertType:36 assertType:38 assertType:40 assertType:42 + +Created 4 initial phi equivalence classes +Coalesced [12] main::s#3 ← main::s#1 +Coalesced [15] idx#51 ← idx#20 +Coalesced (already) [17] idx#57 ← idx#20 +Coalesced (already) [19] idx#58 ← idx#20 +Coalesced (already) [21] idx#59 ← idx#20 +Coalesced (already) [23] idx#60 ← idx#20 +Coalesced (already) [25] idx#61 ← idx#20 +Coalesced (already) [27] idx#62 ← idx#20 +Coalesced (already) [29] idx#63 ← idx#20 +Coalesced (already) [31] idx#64 ← idx#20 +Coalesced (already) [33] idx#52 ← idx#20 +Coalesced (already) [35] idx#53 ← idx#20 +Coalesced (already) [37] idx#54 ← idx#20 +Coalesced (already) [39] idx#55 ← idx#20 +Coalesced (already) [41] idx#56 ← idx#20 +Coalesced down to 4 phi equivalence classes +Culled Empty Block (label) main::@4 +Renumbering block @3 to @1 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of testSimpleTypes +Adding NOP phi() at start of testSimpleTypes::@1 +Adding NOP phi() at start of testSimpleTypes::@2 +Adding NOP phi() at start of testSimpleTypes::@3 +Adding NOP phi() at start of testSimpleTypes::@4 +Adding NOP phi() at start of testSimpleTypes::@5 +Adding NOP phi() at start of testSimpleTypes::@6 +Adding NOP phi() at start of testSimpleTypes::@7 +Adding NOP phi() at start of testSimpleTypes::@8 +Adding NOP phi() at start of testSimpleTypes::@9 +Adding NOP phi() at start of testSimpleTypes::@10 +Adding NOP phi() at start of testSimpleTypes::@11 +Adding NOP phi() at start of testSimpleTypes::@12 +Adding NOP phi() at start of testSimpleTypes::@13 +Adding NOP phi() at start of testSimpleTypes::@14 + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + to:main::@1 +main::@1: scope:[main] from main main::@1 + [5] (byte*) main::s#2 ← phi( main/(byte*)(word) $400 main::@1/(byte*) main::s#1 ) + [6] *((byte*) main::s#2) ← (byte) ' ' + [7] (byte*) main::s#1 ← ++ (byte*) main::s#2 + [8] if((byte*) main::s#1<(byte*)(word) $400+(word) $3e8) goto main::@1 + to:main::@2 +main::@2: scope:[main] from main::@1 + [9] phi() + [10] call testSimpleTypes + to:main::@return +main::@return: scope:[main] from main::@2 + [11] return + to:@return +testSimpleTypes: scope:[testSimpleTypes] from main::@2 + [12] phi() + [13] call assertType + to:testSimpleTypes::@1 +testSimpleTypes::@1: scope:[testSimpleTypes] from testSimpleTypes + [14] phi() + [15] call assertType + to:testSimpleTypes::@2 +testSimpleTypes::@2: scope:[testSimpleTypes] from testSimpleTypes::@1 + [16] phi() + [17] call assertType + to:testSimpleTypes::@3 +testSimpleTypes::@3: scope:[testSimpleTypes] from testSimpleTypes::@2 + [18] phi() + [19] call assertType + to:testSimpleTypes::@4 +testSimpleTypes::@4: scope:[testSimpleTypes] from testSimpleTypes::@3 + [20] phi() + [21] call assertType + to:testSimpleTypes::@5 +testSimpleTypes::@5: scope:[testSimpleTypes] from testSimpleTypes::@4 + [22] phi() + [23] call assertType + to:testSimpleTypes::@6 +testSimpleTypes::@6: scope:[testSimpleTypes] from testSimpleTypes::@5 + [24] phi() + [25] call assertType + to:testSimpleTypes::@7 +testSimpleTypes::@7: scope:[testSimpleTypes] from testSimpleTypes::@6 + [26] phi() + [27] call assertType + to:testSimpleTypes::@8 +testSimpleTypes::@8: scope:[testSimpleTypes] from testSimpleTypes::@7 + [28] phi() + [29] call assertType + to:testSimpleTypes::@9 +testSimpleTypes::@9: scope:[testSimpleTypes] from testSimpleTypes::@8 + [30] phi() + [31] call assertType + to:testSimpleTypes::@10 +testSimpleTypes::@10: scope:[testSimpleTypes] from testSimpleTypes::@9 + [32] phi() + [33] call assertType + to:testSimpleTypes::@11 +testSimpleTypes::@11: scope:[testSimpleTypes] from testSimpleTypes::@10 + [34] phi() + [35] call assertType + to:testSimpleTypes::@12 +testSimpleTypes::@12: scope:[testSimpleTypes] from testSimpleTypes::@11 + [36] phi() + [37] call assertType + to:testSimpleTypes::@13 +testSimpleTypes::@13: scope:[testSimpleTypes] from testSimpleTypes::@12 + [38] phi() + [39] call assertType + to:testSimpleTypes::@14 +testSimpleTypes::@14: scope:[testSimpleTypes] from testSimpleTypes::@13 + [40] phi() + [41] call assertType + to:testSimpleTypes::@return +testSimpleTypes::@return: scope:[testSimpleTypes] from testSimpleTypes::@14 + [42] return + to:@return +assertType: scope:[assertType] from testSimpleTypes testSimpleTypes::@1 testSimpleTypes::@10 testSimpleTypes::@11 testSimpleTypes::@12 testSimpleTypes::@13 testSimpleTypes::@14 testSimpleTypes::@2 testSimpleTypes::@3 testSimpleTypes::@4 testSimpleTypes::@5 testSimpleTypes::@6 testSimpleTypes::@7 testSimpleTypes::@8 testSimpleTypes::@9 + [43] (byte) idx#41 ← phi( testSimpleTypes/(byte) 0 testSimpleTypes::@1/(byte) idx#20 testSimpleTypes::@10/(byte) idx#20 testSimpleTypes::@11/(byte) idx#20 testSimpleTypes::@12/(byte) idx#20 testSimpleTypes::@13/(byte) idx#20 testSimpleTypes::@14/(byte) idx#20 testSimpleTypes::@2/(byte) idx#20 testSimpleTypes::@3/(byte) idx#20 testSimpleTypes::@4/(byte) idx#20 testSimpleTypes::@5/(byte) idx#20 testSimpleTypes::@6/(byte) idx#20 testSimpleTypes::@7/(byte) idx#20 testSimpleTypes::@8/(byte) idx#20 testSimpleTypes::@9/(byte) idx#20 ) + [43] (byte) assertType::t2#15 ← phi( testSimpleTypes/(const byte) TYPEID_BYTE testSimpleTypes::@1/(const byte) TYPEID_BYTE testSimpleTypes::@10/(const byte) TYPEID_DWORD testSimpleTypes::@11/(const byte) TYPEID_DWORD testSimpleTypes::@12/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@13/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@14/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@2/(const byte) TYPEID_SIGNED_BYTE testSimpleTypes::@3/(const byte) TYPEID_SIGNED_BYTE testSimpleTypes::@4/(const byte) TYPEID_WORD testSimpleTypes::@5/(const byte) TYPEID_WORD testSimpleTypes::@6/(const byte) TYPEID_WORD testSimpleTypes::@7/(const byte) TYPEID_SIGNED_WORD testSimpleTypes::@8/(const byte) TYPEID_SIGNED_WORD testSimpleTypes::@9/(const byte) TYPEID_SIGNED_WORD ) + [43] (byte) assertType::t1#15 ← phi( testSimpleTypes/(const byte) TYPEID_BYTE testSimpleTypes::@1/(const byte) TYPEID_BYTE testSimpleTypes::@10/(const byte) TYPEID_DWORD testSimpleTypes::@11/(const byte) TYPEID_DWORD testSimpleTypes::@12/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@13/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@14/(const byte) TYPEID_SIGNED_DWORD testSimpleTypes::@2/(const byte) TYPEID_SIGNED_BYTE testSimpleTypes::@3/(const byte) TYPEID_SIGNED_BYTE testSimpleTypes::@4/(const byte) TYPEID_WORD testSimpleTypes::@5/(const byte) TYPEID_WORD testSimpleTypes::@6/(const byte) TYPEID_WORD testSimpleTypes::@7/(const byte) TYPEID_SIGNED_WORD testSimpleTypes::@8/(const byte) TYPEID_SIGNED_WORD testSimpleTypes::@9/(const byte) TYPEID_SIGNED_WORD ) + [44] if((byte) assertType::t1#15==(byte) assertType::t2#15) goto assertType::@1 + to:assertType::@3 +assertType::@3: scope:[assertType] from assertType + [45] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) RED#0 + to:assertType::@2 +assertType::@2: scope:[assertType] from assertType::@1 assertType::@3 + [46] *((byte*)(word) $400 + (byte) idx#41) ← (byte) assertType::t1#15 + [47] (byte) idx#20 ← ++ (byte) idx#41 + to:assertType::@return +assertType::@return: scope:[assertType] from assertType::@2 + [48] return + to:@return +assertType::@1: scope:[assertType] from assertType + [49] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) GREEN#0 + to:assertType::@2 + + +VARIABLE REGISTER WEIGHTS +(byte*) COLS +(byte) GREEN +(byte) RED +(byte*) SCREEN +(void()) assertType((byte) assertType::t1 , (byte) assertType::t2) +(byte) assertType::t1 +(byte) assertType::t1#15 1.0 +(byte) assertType::t2 +(byte) assertType::t2#15 2.0 +(byte) idx +(byte) idx#20 0.9999999999999999 +(byte) idx#41 7.200000000000002 +(void()) main() +(byte*) main::s +(byte*) main::s#1 16.5 +(byte*) main::s#2 16.5 +(void()) testSimpleTypes() + +Initial phi equivalence classes +[ main::s#2 main::s#1 ] +[ assertType::t1#15 ] +[ assertType::t2#15 ] +[ idx#41 idx#20 ] +Complete equivalence classes +[ main::s#2 main::s#1 ] +[ assertType::t1#15 ] +[ assertType::t2#15 ] +[ idx#41 idx#20 ] +Allocated zp ZP_WORD:2 [ main::s#2 main::s#1 ] +Allocated zp ZP_BYTE:4 [ assertType::t1#15 ] +Allocated zp ZP_BYTE:5 [ assertType::t2#15 ] +Allocated zp ZP_BYTE:6 [ idx#41 idx#20 ] + +INITIAL ASM +//SEG0 File Comments +// Tests different integer literal types +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const TYPEID_BYTE = 1 + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_WORD = 3 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_DWORD = 5 + .const TYPEID_SIGNED_DWORD = 6 + .const RED = 2 + .const GREEN = 5 + .label idx = 6 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + .label s = 2 + //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG12 [5] phi (byte*) main::s#2 = (byte*)(word) $400 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta s + lda #>$400 + sta s+1 + jmp b1 + //SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + b1_from_b1: + //SEG14 [5] phi (byte*) main::s#2 = (byte*) main::s#1 [phi:main::@1->main::@1#0] -- register_copy + jmp b1 + //SEG15 main::@1 + b1: + //SEG16 [6] *((byte*) main::s#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + lda #' ' + ldy #0 + sta (s),y + //SEG17 [7] (byte*) main::s#1 ← ++ (byte*) main::s#2 -- pbuz1=_inc_pbuz1 + inc s + bne !+ + inc s+1 + !: + //SEG18 [8] if((byte*) main::s#1<(byte*)(word) $400+(word) $3e8) goto main::@1 -- pbuz1_lt_pbuc1_then_la1 + lda s+1 + cmp #>$400+$3e8 + bcc b1_from_b1 + bne !+ + lda s + cmp #<$400+$3e8 + bcc b1_from_b1 + !: + //SEG19 [9] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + b2_from_b1: + jmp b2 + //SEG20 main::@2 + b2: + //SEG21 [10] call testSimpleTypes + //SEG22 [12] phi from main::@2 to testSimpleTypes [phi:main::@2->testSimpleTypes] + testSimpleTypes_from_b2: + jsr testSimpleTypes + jmp breturn + //SEG23 main::@return + breturn: + //SEG24 [11] return + rts +} +//SEG25 testSimpleTypes +testSimpleTypes: { + //SEG26 [13] call assertType + //SEG27 [43] phi from testSimpleTypes to assertType [phi:testSimpleTypes->assertType] + assertType_from_testSimpleTypes: + //SEG28 [43] phi (byte) idx#41 = (byte) 0 [phi:testSimpleTypes->assertType#0] -- vbuz1=vbuc1 + lda #0 + sta idx + //SEG29 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG30 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG31 [14] phi from testSimpleTypes to testSimpleTypes::@1 [phi:testSimpleTypes->testSimpleTypes::@1] + b1_from_testSimpleTypes: + jmp b1 + //SEG32 testSimpleTypes::@1 + b1: + //SEG33 [15] call assertType + //SEG34 [43] phi from testSimpleTypes::@1 to assertType [phi:testSimpleTypes::@1->assertType] + assertType_from_b1: + //SEG35 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@1->assertType#0] -- register_copy + //SEG36 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG37 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes::@1->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG38 [16] phi from testSimpleTypes::@1 to testSimpleTypes::@2 [phi:testSimpleTypes::@1->testSimpleTypes::@2] + b2_from_b1: + jmp b2 + //SEG39 testSimpleTypes::@2 + b2: + //SEG40 [17] call assertType + //SEG41 [43] phi from testSimpleTypes::@2 to assertType [phi:testSimpleTypes::@2->assertType] + assertType_from_b2: + //SEG42 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@2->assertType#0] -- register_copy + //SEG43 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG44 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@2->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t1 + jsr assertType + //SEG45 [18] phi from testSimpleTypes::@2 to testSimpleTypes::@3 [phi:testSimpleTypes::@2->testSimpleTypes::@3] + b3_from_b2: + jmp b3 + //SEG46 testSimpleTypes::@3 + b3: + //SEG47 [19] call assertType + //SEG48 [43] phi from testSimpleTypes::@3 to assertType [phi:testSimpleTypes::@3->assertType] + assertType_from_b3: + //SEG49 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@3->assertType#0] -- register_copy + //SEG50 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG51 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@3->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t1 + jsr assertType + //SEG52 [20] phi from testSimpleTypes::@3 to testSimpleTypes::@4 [phi:testSimpleTypes::@3->testSimpleTypes::@4] + b4_from_b3: + jmp b4 + //SEG53 testSimpleTypes::@4 + b4: + //SEG54 [21] call assertType + //SEG55 [43] phi from testSimpleTypes::@4 to assertType [phi:testSimpleTypes::@4->assertType] + assertType_from_b4: + //SEG56 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@4->assertType#0] -- register_copy + //SEG57 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG58 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@4->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG59 [22] phi from testSimpleTypes::@4 to testSimpleTypes::@5 [phi:testSimpleTypes::@4->testSimpleTypes::@5] + b5_from_b4: + jmp b5 + //SEG60 testSimpleTypes::@5 + b5: + //SEG61 [23] call assertType + //SEG62 [43] phi from testSimpleTypes::@5 to assertType [phi:testSimpleTypes::@5->assertType] + assertType_from_b5: + //SEG63 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@5->assertType#0] -- register_copy + //SEG64 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG65 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@5->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG66 [24] phi from testSimpleTypes::@5 to testSimpleTypes::@6 [phi:testSimpleTypes::@5->testSimpleTypes::@6] + b6_from_b5: + jmp b6 + //SEG67 testSimpleTypes::@6 + b6: + //SEG68 [25] call assertType + //SEG69 [43] phi from testSimpleTypes::@6 to assertType [phi:testSimpleTypes::@6->assertType] + assertType_from_b6: + //SEG70 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@6->assertType#0] -- register_copy + //SEG71 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@6->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG72 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@6->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG73 [26] phi from testSimpleTypes::@6 to testSimpleTypes::@7 [phi:testSimpleTypes::@6->testSimpleTypes::@7] + b7_from_b6: + jmp b7 + //SEG74 testSimpleTypes::@7 + b7: + //SEG75 [27] call assertType + //SEG76 [43] phi from testSimpleTypes::@7 to assertType [phi:testSimpleTypes::@7->assertType] + assertType_from_b7: + //SEG77 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@7->assertType#0] -- register_copy + //SEG78 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@7->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG79 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@7->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG80 [28] phi from testSimpleTypes::@7 to testSimpleTypes::@8 [phi:testSimpleTypes::@7->testSimpleTypes::@8] + b8_from_b7: + jmp b8 + //SEG81 testSimpleTypes::@8 + b8: + //SEG82 [29] call assertType + //SEG83 [43] phi from testSimpleTypes::@8 to assertType [phi:testSimpleTypes::@8->assertType] + assertType_from_b8: + //SEG84 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@8->assertType#0] -- register_copy + //SEG85 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@8->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG86 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@8->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG87 [30] phi from testSimpleTypes::@8 to testSimpleTypes::@9 [phi:testSimpleTypes::@8->testSimpleTypes::@9] + b9_from_b8: + jmp b9 + //SEG88 testSimpleTypes::@9 + b9: + //SEG89 [31] call assertType + //SEG90 [43] phi from testSimpleTypes::@9 to assertType [phi:testSimpleTypes::@9->assertType] + assertType_from_b9: + //SEG91 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@9->assertType#0] -- register_copy + //SEG92 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@9->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG93 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@9->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG94 [32] phi from testSimpleTypes::@9 to testSimpleTypes::@10 [phi:testSimpleTypes::@9->testSimpleTypes::@10] + b10_from_b9: + jmp b10 + //SEG95 testSimpleTypes::@10 + b10: + //SEG96 [33] call assertType + //SEG97 [43] phi from testSimpleTypes::@10 to assertType [phi:testSimpleTypes::@10->assertType] + assertType_from_b10: + //SEG98 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@10->assertType#0] -- register_copy + //SEG99 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@10->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG100 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@10->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG101 [34] phi from testSimpleTypes::@10 to testSimpleTypes::@11 [phi:testSimpleTypes::@10->testSimpleTypes::@11] + b11_from_b10: + jmp b11 + //SEG102 testSimpleTypes::@11 + b11: + //SEG103 [35] call assertType + //SEG104 [43] phi from testSimpleTypes::@11 to assertType [phi:testSimpleTypes::@11->assertType] + assertType_from_b11: + //SEG105 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@11->assertType#0] -- register_copy + //SEG106 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@11->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG107 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@11->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG108 [36] phi from testSimpleTypes::@11 to testSimpleTypes::@12 [phi:testSimpleTypes::@11->testSimpleTypes::@12] + b12_from_b11: + jmp b12 + //SEG109 testSimpleTypes::@12 + b12: + //SEG110 [37] call assertType + //SEG111 [43] phi from testSimpleTypes::@12 to assertType [phi:testSimpleTypes::@12->assertType] + assertType_from_b12: + //SEG112 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@12->assertType#0] -- register_copy + //SEG113 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@12->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG114 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@12->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG115 [38] phi from testSimpleTypes::@12 to testSimpleTypes::@13 [phi:testSimpleTypes::@12->testSimpleTypes::@13] + b13_from_b12: + jmp b13 + //SEG116 testSimpleTypes::@13 + b13: + //SEG117 [39] call assertType + //SEG118 [43] phi from testSimpleTypes::@13 to assertType [phi:testSimpleTypes::@13->assertType] + assertType_from_b13: + //SEG119 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@13->assertType#0] -- register_copy + //SEG120 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@13->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG121 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@13->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG122 [40] phi from testSimpleTypes::@13 to testSimpleTypes::@14 [phi:testSimpleTypes::@13->testSimpleTypes::@14] + b14_from_b13: + jmp b14 + //SEG123 testSimpleTypes::@14 + b14: + //SEG124 [41] call assertType + //SEG125 [43] phi from testSimpleTypes::@14 to assertType [phi:testSimpleTypes::@14->assertType] + assertType_from_b14: + //SEG126 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@14->assertType#0] -- register_copy + //SEG127 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@14->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG128 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@14->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + jmp breturn + //SEG129 testSimpleTypes::@return + breturn: + //SEG130 [42] return + rts +} +//SEG131 assertType +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte zeropage(4) t1, byte zeropage(5) t2) +assertType: { + .label t1 = 4 + .label t2 = 5 + //SEG132 [44] if((byte) assertType::t1#15==(byte) assertType::t2#15) goto assertType::@1 -- vbuz1_eq_vbuz2_then_la1 + lda t1 + cmp t2 + beq b1 + jmp b3 + //SEG133 assertType::@3 + b3: + //SEG134 [45] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) RED#0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #RED + ldy idx + sta $d800,y + jmp b2 + //SEG135 assertType::@2 + b2: + //SEG136 [46] *((byte*)(word) $400 + (byte) idx#41) ← (byte) assertType::t1#15 -- pbuc1_derefidx_vbuz1=vbuz2 + lda t1 + ldy idx + sta $400,y + //SEG137 [47] (byte) idx#20 ← ++ (byte) idx#41 -- vbuz1=_inc_vbuz1 + inc idx + jmp breturn + //SEG138 assertType::@return + breturn: + //SEG139 [48] return + rts + //SEG140 assertType::@1 + b1: + //SEG141 [49] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #GREEN + ldy idx + sta $d800,y + jmp b2 +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [6] *((byte*) main::s#2) ← (byte) ' ' [ main::s#2 ] ( main:2 [ main::s#2 ] ) always clobbers reg byte a reg byte y +Statement [8] if((byte*) main::s#1<(byte*)(word) $400+(word) $3e8) goto main::@1 [ main::s#1 ] ( main:2 [ main::s#1 ] ) always clobbers reg byte a +Statement [45] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) RED#0 [ assertType::t1#15 idx#41 ] ( main:2::testSimpleTypes:10::assertType:13 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:15 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:17 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:19 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:21 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:23 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:25 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:27 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:29 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:31 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:33 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:35 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:37 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:39 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:41 [ assertType::t1#15 idx#41 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ assertType::t1#15 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ idx#41 idx#20 ] +Statement [46] *((byte*)(word) $400 + (byte) idx#41) ← (byte) assertType::t1#15 [ idx#41 ] ( main:2::testSimpleTypes:10::assertType:13 [ idx#41 ] main:2::testSimpleTypes:10::assertType:15 [ idx#41 ] main:2::testSimpleTypes:10::assertType:17 [ idx#41 ] main:2::testSimpleTypes:10::assertType:19 [ idx#41 ] main:2::testSimpleTypes:10::assertType:21 [ idx#41 ] main:2::testSimpleTypes:10::assertType:23 [ idx#41 ] main:2::testSimpleTypes:10::assertType:25 [ idx#41 ] main:2::testSimpleTypes:10::assertType:27 [ idx#41 ] main:2::testSimpleTypes:10::assertType:29 [ idx#41 ] main:2::testSimpleTypes:10::assertType:31 [ idx#41 ] main:2::testSimpleTypes:10::assertType:33 [ idx#41 ] main:2::testSimpleTypes:10::assertType:35 [ idx#41 ] main:2::testSimpleTypes:10::assertType:37 [ idx#41 ] main:2::testSimpleTypes:10::assertType:39 [ idx#41 ] main:2::testSimpleTypes:10::assertType:41 [ idx#41 ] ) always clobbers reg byte a +Statement [49] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) GREEN#0 [ assertType::t1#15 idx#41 ] ( main:2::testSimpleTypes:10::assertType:13 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:15 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:17 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:19 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:21 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:23 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:25 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:27 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:29 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:31 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:33 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:35 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:37 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:39 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:41 [ assertType::t1#15 idx#41 ] ) always clobbers reg byte a +Statement [6] *((byte*) main::s#2) ← (byte) ' ' [ main::s#2 ] ( main:2 [ main::s#2 ] ) always clobbers reg byte a reg byte y +Statement [8] if((byte*) main::s#1<(byte*)(word) $400+(word) $3e8) goto main::@1 [ main::s#1 ] ( main:2 [ main::s#1 ] ) always clobbers reg byte a +Statement [45] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) RED#0 [ assertType::t1#15 idx#41 ] ( main:2::testSimpleTypes:10::assertType:13 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:15 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:17 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:19 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:21 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:23 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:25 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:27 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:29 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:31 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:33 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:35 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:37 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:39 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:41 [ assertType::t1#15 idx#41 ] ) always clobbers reg byte a +Statement [46] *((byte*)(word) $400 + (byte) idx#41) ← (byte) assertType::t1#15 [ idx#41 ] ( main:2::testSimpleTypes:10::assertType:13 [ idx#41 ] main:2::testSimpleTypes:10::assertType:15 [ idx#41 ] main:2::testSimpleTypes:10::assertType:17 [ idx#41 ] main:2::testSimpleTypes:10::assertType:19 [ idx#41 ] main:2::testSimpleTypes:10::assertType:21 [ idx#41 ] main:2::testSimpleTypes:10::assertType:23 [ idx#41 ] main:2::testSimpleTypes:10::assertType:25 [ idx#41 ] main:2::testSimpleTypes:10::assertType:27 [ idx#41 ] main:2::testSimpleTypes:10::assertType:29 [ idx#41 ] main:2::testSimpleTypes:10::assertType:31 [ idx#41 ] main:2::testSimpleTypes:10::assertType:33 [ idx#41 ] main:2::testSimpleTypes:10::assertType:35 [ idx#41 ] main:2::testSimpleTypes:10::assertType:37 [ idx#41 ] main:2::testSimpleTypes:10::assertType:39 [ idx#41 ] main:2::testSimpleTypes:10::assertType:41 [ idx#41 ] ) always clobbers reg byte a +Statement [49] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) GREEN#0 [ assertType::t1#15 idx#41 ] ( main:2::testSimpleTypes:10::assertType:13 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:15 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:17 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:19 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:21 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:23 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:25 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:27 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:29 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:31 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:33 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:35 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:37 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:39 [ assertType::t1#15 idx#41 ] main:2::testSimpleTypes:10::assertType:41 [ assertType::t1#15 idx#41 ] ) always clobbers reg byte a +Potential registers zp ZP_WORD:2 [ main::s#2 main::s#1 ] : zp ZP_WORD:2 , +Potential registers zp ZP_BYTE:4 [ assertType::t1#15 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:5 [ assertType::t2#15 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:6 [ idx#41 idx#20 ] : zp ZP_BYTE:6 , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [main] 33: zp ZP_WORD:2 [ main::s#2 main::s#1 ] +Uplift Scope [] 8.2: zp ZP_BYTE:6 [ idx#41 idx#20 ] +Uplift Scope [assertType] 2: zp ZP_BYTE:5 [ assertType::t2#15 ] 1: zp ZP_BYTE:4 [ assertType::t1#15 ] +Uplift Scope [testSimpleTypes] + +Uplifting [main] best 978 combination zp ZP_WORD:2 [ main::s#2 main::s#1 ] +Uplifting [] best 963 combination reg byte x [ idx#41 idx#20 ] +Uplifting [assertType] best 916 combination zp ZP_BYTE:5 [ assertType::t2#15 ] reg byte y [ assertType::t1#15 ] +Uplifting [testSimpleTypes] best 916 combination +Attempting to uplift remaining variables inzp ZP_BYTE:5 [ assertType::t2#15 ] +Uplifting [assertType] best 916 combination zp ZP_BYTE:5 [ assertType::t2#15 ] +Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:4 [ assertType::t2#15 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 File Comments +// Tests different integer literal types +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const TYPEID_BYTE = 1 + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_WORD = 3 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_DWORD = 5 + .const TYPEID_SIGNED_DWORD = 6 + .const RED = 2 + .const GREEN = 5 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + .label s = 2 + //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG12 [5] phi (byte*) main::s#2 = (byte*)(word) $400 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta s + lda #>$400 + sta s+1 + jmp b1 + //SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + b1_from_b1: + //SEG14 [5] phi (byte*) main::s#2 = (byte*) main::s#1 [phi:main::@1->main::@1#0] -- register_copy + jmp b1 + //SEG15 main::@1 + b1: + //SEG16 [6] *((byte*) main::s#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + lda #' ' + ldy #0 + sta (s),y + //SEG17 [7] (byte*) main::s#1 ← ++ (byte*) main::s#2 -- pbuz1=_inc_pbuz1 + inc s + bne !+ + inc s+1 + !: + //SEG18 [8] if((byte*) main::s#1<(byte*)(word) $400+(word) $3e8) goto main::@1 -- pbuz1_lt_pbuc1_then_la1 + lda s+1 + cmp #>$400+$3e8 + bcc b1_from_b1 + bne !+ + lda s + cmp #<$400+$3e8 + bcc b1_from_b1 + !: + //SEG19 [9] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + b2_from_b1: + jmp b2 + //SEG20 main::@2 + b2: + //SEG21 [10] call testSimpleTypes + //SEG22 [12] phi from main::@2 to testSimpleTypes [phi:main::@2->testSimpleTypes] + testSimpleTypes_from_b2: + jsr testSimpleTypes + jmp breturn + //SEG23 main::@return + breturn: + //SEG24 [11] return + rts +} +//SEG25 testSimpleTypes +testSimpleTypes: { + //SEG26 [13] call assertType + //SEG27 [43] phi from testSimpleTypes to assertType [phi:testSimpleTypes->assertType] + assertType_from_testSimpleTypes: + //SEG28 [43] phi (byte) idx#41 = (byte) 0 [phi:testSimpleTypes->assertType#0] -- vbuxx=vbuc1 + ldx #0 + //SEG29 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG30 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG31 [14] phi from testSimpleTypes to testSimpleTypes::@1 [phi:testSimpleTypes->testSimpleTypes::@1] + b1_from_testSimpleTypes: + jmp b1 + //SEG32 testSimpleTypes::@1 + b1: + //SEG33 [15] call assertType + //SEG34 [43] phi from testSimpleTypes::@1 to assertType [phi:testSimpleTypes::@1->assertType] + assertType_from_b1: + //SEG35 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@1->assertType#0] -- register_copy + //SEG36 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG37 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes::@1->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG38 [16] phi from testSimpleTypes::@1 to testSimpleTypes::@2 [phi:testSimpleTypes::@1->testSimpleTypes::@2] + b2_from_b1: + jmp b2 + //SEG39 testSimpleTypes::@2 + b2: + //SEG40 [17] call assertType + //SEG41 [43] phi from testSimpleTypes::@2 to assertType [phi:testSimpleTypes::@2->assertType] + assertType_from_b2: + //SEG42 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@2->assertType#0] -- register_copy + //SEG43 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG44 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@2->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_BYTE + jsr assertType + //SEG45 [18] phi from testSimpleTypes::@2 to testSimpleTypes::@3 [phi:testSimpleTypes::@2->testSimpleTypes::@3] + b3_from_b2: + jmp b3 + //SEG46 testSimpleTypes::@3 + b3: + //SEG47 [19] call assertType + //SEG48 [43] phi from testSimpleTypes::@3 to assertType [phi:testSimpleTypes::@3->assertType] + assertType_from_b3: + //SEG49 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@3->assertType#0] -- register_copy + //SEG50 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG51 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@3->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_BYTE + jsr assertType + //SEG52 [20] phi from testSimpleTypes::@3 to testSimpleTypes::@4 [phi:testSimpleTypes::@3->testSimpleTypes::@4] + b4_from_b3: + jmp b4 + //SEG53 testSimpleTypes::@4 + b4: + //SEG54 [21] call assertType + //SEG55 [43] phi from testSimpleTypes::@4 to assertType [phi:testSimpleTypes::@4->assertType] + assertType_from_b4: + //SEG56 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@4->assertType#0] -- register_copy + //SEG57 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG58 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@4->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG59 [22] phi from testSimpleTypes::@4 to testSimpleTypes::@5 [phi:testSimpleTypes::@4->testSimpleTypes::@5] + b5_from_b4: + jmp b5 + //SEG60 testSimpleTypes::@5 + b5: + //SEG61 [23] call assertType + //SEG62 [43] phi from testSimpleTypes::@5 to assertType [phi:testSimpleTypes::@5->assertType] + assertType_from_b5: + //SEG63 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@5->assertType#0] -- register_copy + //SEG64 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG65 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@5->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG66 [24] phi from testSimpleTypes::@5 to testSimpleTypes::@6 [phi:testSimpleTypes::@5->testSimpleTypes::@6] + b6_from_b5: + jmp b6 + //SEG67 testSimpleTypes::@6 + b6: + //SEG68 [25] call assertType + //SEG69 [43] phi from testSimpleTypes::@6 to assertType [phi:testSimpleTypes::@6->assertType] + assertType_from_b6: + //SEG70 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@6->assertType#0] -- register_copy + //SEG71 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@6->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG72 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@6->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG73 [26] phi from testSimpleTypes::@6 to testSimpleTypes::@7 [phi:testSimpleTypes::@6->testSimpleTypes::@7] + b7_from_b6: + jmp b7 + //SEG74 testSimpleTypes::@7 + b7: + //SEG75 [27] call assertType + //SEG76 [43] phi from testSimpleTypes::@7 to assertType [phi:testSimpleTypes::@7->assertType] + assertType_from_b7: + //SEG77 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@7->assertType#0] -- register_copy + //SEG78 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@7->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG79 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@7->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG80 [28] phi from testSimpleTypes::@7 to testSimpleTypes::@8 [phi:testSimpleTypes::@7->testSimpleTypes::@8] + b8_from_b7: + jmp b8 + //SEG81 testSimpleTypes::@8 + b8: + //SEG82 [29] call assertType + //SEG83 [43] phi from testSimpleTypes::@8 to assertType [phi:testSimpleTypes::@8->assertType] + assertType_from_b8: + //SEG84 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@8->assertType#0] -- register_copy + //SEG85 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@8->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG86 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@8->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG87 [30] phi from testSimpleTypes::@8 to testSimpleTypes::@9 [phi:testSimpleTypes::@8->testSimpleTypes::@9] + b9_from_b8: + jmp b9 + //SEG88 testSimpleTypes::@9 + b9: + //SEG89 [31] call assertType + //SEG90 [43] phi from testSimpleTypes::@9 to assertType [phi:testSimpleTypes::@9->assertType] + assertType_from_b9: + //SEG91 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@9->assertType#0] -- register_copy + //SEG92 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@9->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG93 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@9->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG94 [32] phi from testSimpleTypes::@9 to testSimpleTypes::@10 [phi:testSimpleTypes::@9->testSimpleTypes::@10] + b10_from_b9: + jmp b10 + //SEG95 testSimpleTypes::@10 + b10: + //SEG96 [33] call assertType + //SEG97 [43] phi from testSimpleTypes::@10 to assertType [phi:testSimpleTypes::@10->assertType] + assertType_from_b10: + //SEG98 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@10->assertType#0] -- register_copy + //SEG99 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@10->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG100 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@10->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG101 [34] phi from testSimpleTypes::@10 to testSimpleTypes::@11 [phi:testSimpleTypes::@10->testSimpleTypes::@11] + b11_from_b10: + jmp b11 + //SEG102 testSimpleTypes::@11 + b11: + //SEG103 [35] call assertType + //SEG104 [43] phi from testSimpleTypes::@11 to assertType [phi:testSimpleTypes::@11->assertType] + assertType_from_b11: + //SEG105 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@11->assertType#0] -- register_copy + //SEG106 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@11->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG107 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@11->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG108 [36] phi from testSimpleTypes::@11 to testSimpleTypes::@12 [phi:testSimpleTypes::@11->testSimpleTypes::@12] + b12_from_b11: + jmp b12 + //SEG109 testSimpleTypes::@12 + b12: + //SEG110 [37] call assertType + //SEG111 [43] phi from testSimpleTypes::@12 to assertType [phi:testSimpleTypes::@12->assertType] + assertType_from_b12: + //SEG112 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@12->assertType#0] -- register_copy + //SEG113 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@12->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG114 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@12->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG115 [38] phi from testSimpleTypes::@12 to testSimpleTypes::@13 [phi:testSimpleTypes::@12->testSimpleTypes::@13] + b13_from_b12: + jmp b13 + //SEG116 testSimpleTypes::@13 + b13: + //SEG117 [39] call assertType + //SEG118 [43] phi from testSimpleTypes::@13 to assertType [phi:testSimpleTypes::@13->assertType] + assertType_from_b13: + //SEG119 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@13->assertType#0] -- register_copy + //SEG120 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@13->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG121 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@13->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG122 [40] phi from testSimpleTypes::@13 to testSimpleTypes::@14 [phi:testSimpleTypes::@13->testSimpleTypes::@14] + b14_from_b13: + jmp b14 + //SEG123 testSimpleTypes::@14 + b14: + //SEG124 [41] call assertType + //SEG125 [43] phi from testSimpleTypes::@14 to assertType [phi:testSimpleTypes::@14->assertType] + assertType_from_b14: + //SEG126 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@14->assertType#0] -- register_copy + //SEG127 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@14->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG128 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@14->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + jmp breturn + //SEG129 testSimpleTypes::@return + breturn: + //SEG130 [42] return + rts +} +//SEG131 assertType +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte register(Y) t1, byte zeropage(4) t2) +assertType: { + .label t2 = 4 + //SEG132 [44] if((byte) assertType::t1#15==(byte) assertType::t2#15) goto assertType::@1 -- vbuyy_eq_vbuz1_then_la1 + tya + cmp t2 + beq b1 + jmp b3 + //SEG133 assertType::@3 + b3: + //SEG134 [45] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) RED#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #RED + sta $d800,x + jmp b2 + //SEG135 assertType::@2 + b2: + //SEG136 [46] *((byte*)(word) $400 + (byte) idx#41) ← (byte) assertType::t1#15 -- pbuc1_derefidx_vbuxx=vbuyy + tya + sta $400,x + //SEG137 [47] (byte) idx#20 ← ++ (byte) idx#41 -- vbuxx=_inc_vbuxx + inx + jmp breturn + //SEG138 assertType::@return + breturn: + //SEG139 [48] return + rts + //SEG140 assertType::@1 + b1: + //SEG141 [49] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #GREEN + sta $d800,x + jmp b2 +} + +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 b1 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp b4 +Removing instruction jmp b5 +Removing instruction jmp b6 +Removing instruction jmp b7 +Removing instruction jmp b8 +Removing instruction jmp b9 +Removing instruction jmp b10 +Removing instruction jmp b11 +Removing instruction jmp b12 +Removing instruction jmp b13 +Removing instruction jmp b14 +Removing instruction jmp breturn +Removing instruction jmp b3 +Removing instruction jmp b2 +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_SIGNED_BYTE with TAY +Replacing instruction ldy #TYPEID_SIGNED_BYTE with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing label b1_from_b1 with b1 +Replacing label b1_from_b1 with b1 +Removing instruction b1_from_bbegin: +Removing instruction b1: +Removing instruction main_from_b1: +Removing instruction bend_from_b1: +Removing instruction b1_from_b1: +Removing instruction b2_from_b1: +Removing instruction testSimpleTypes_from_b2: +Removing instruction b1_from_testSimpleTypes: +Removing instruction assertType_from_b1: +Removing instruction b2_from_b1: +Removing instruction assertType_from_b2: +Removing instruction b3_from_b2: +Removing instruction assertType_from_b3: +Removing instruction b4_from_b3: +Removing instruction assertType_from_b4: +Removing instruction b5_from_b4: +Removing instruction assertType_from_b5: +Removing instruction b6_from_b5: +Removing instruction assertType_from_b6: +Removing instruction b7_from_b6: +Removing instruction assertType_from_b7: +Removing instruction b8_from_b7: +Removing instruction assertType_from_b8: +Removing instruction b9_from_b8: +Removing instruction assertType_from_b9: +Removing instruction b10_from_b9: +Removing instruction assertType_from_b10: +Removing instruction b11_from_b10: +Removing instruction assertType_from_b11: +Removing instruction b12_from_b11: +Removing instruction assertType_from_b12: +Removing instruction b13_from_b12: +Removing instruction assertType_from_b13: +Removing instruction b14_from_b13: +Removing instruction assertType_from_b14: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bend: +Removing instruction b1_from_main: +Removing instruction b2: +Removing instruction breturn: +Removing instruction assertType_from_testSimpleTypes: +Removing instruction b1: +Removing instruction b2: +Removing instruction b3: +Removing instruction b4: +Removing instruction b5: +Removing instruction b6: +Removing instruction b7: +Removing instruction b8: +Removing instruction b9: +Removing instruction b10: +Removing instruction b11: +Removing instruction b12: +Removing instruction b13: +Removing instruction b14: +Removing instruction breturn: +Removing instruction b3: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction jmp b1 +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @begin +(label) @end +(byte*) COLS +(byte) GREEN +(const byte) GREEN#0 GREEN = (byte) 5 +(byte) RED +(const byte) RED#0 RED = (byte) 2 +(byte*) SCREEN +(const byte) TYPEID_BYTE TYPEID_BYTE = (number) 1 +(const byte) TYPEID_DWORD TYPEID_DWORD = (number) 5 +(const byte) TYPEID_SIGNED_BYTE TYPEID_SIGNED_BYTE = (number) 2 +(const byte) TYPEID_SIGNED_DWORD TYPEID_SIGNED_DWORD = (number) 6 +(const byte) TYPEID_SIGNED_WORD TYPEID_SIGNED_WORD = (number) 4 +(const byte) TYPEID_WORD TYPEID_WORD = (number) 3 +(void()) assertType((byte) assertType::t1 , (byte) assertType::t2) +(label) assertType::@1 +(label) assertType::@2 +(label) assertType::@3 +(label) assertType::@return +(byte) assertType::t1 +(byte) assertType::t1#15 reg byte y 1.0 +(byte) assertType::t2 +(byte) assertType::t2#15 t2 zp ZP_BYTE:4 2.0 +(byte) idx +(byte) idx#20 reg byte x 0.9999999999999999 +(byte) idx#41 reg byte x 7.200000000000002 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte*) main::s +(byte*) main::s#1 s zp ZP_WORD:2 16.5 +(byte*) main::s#2 s zp ZP_WORD:2 16.5 +(void()) testSimpleTypes() +(label) testSimpleTypes::@1 +(label) testSimpleTypes::@10 +(label) testSimpleTypes::@11 +(label) testSimpleTypes::@12 +(label) testSimpleTypes::@13 +(label) testSimpleTypes::@14 +(label) testSimpleTypes::@2 +(label) testSimpleTypes::@3 +(label) testSimpleTypes::@4 +(label) testSimpleTypes::@5 +(label) testSimpleTypes::@6 +(label) testSimpleTypes::@7 +(label) testSimpleTypes::@8 +(label) testSimpleTypes::@9 +(label) testSimpleTypes::@return + +zp ZP_WORD:2 [ main::s#2 main::s#1 ] +reg byte y [ assertType::t1#15 ] +zp ZP_BYTE:4 [ assertType::t2#15 ] +reg byte x [ idx#41 idx#20 ] + + +FINAL ASSEMBLER +Score: 784 + +//SEG0 File Comments +// Tests different integer literal types +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const TYPEID_BYTE = 1 + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_WORD = 3 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_DWORD = 5 + .const TYPEID_SIGNED_DWORD = 6 + .const RED = 2 + .const GREEN = 5 +//SEG3 @begin +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +//SEG5 @1 +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +//SEG9 @end +//SEG10 main +main: { + .label s = 2 + //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] + //SEG12 [5] phi (byte*) main::s#2 = (byte*)(word) $400 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta s + lda #>$400 + sta s+1 + //SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + //SEG14 [5] phi (byte*) main::s#2 = (byte*) main::s#1 [phi:main::@1->main::@1#0] -- register_copy + //SEG15 main::@1 + b1: + //SEG16 [6] *((byte*) main::s#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + lda #' ' + ldy #0 + sta (s),y + //SEG17 [7] (byte*) main::s#1 ← ++ (byte*) main::s#2 -- pbuz1=_inc_pbuz1 + inc s + bne !+ + inc s+1 + !: + //SEG18 [8] if((byte*) main::s#1<(byte*)(word) $400+(word) $3e8) goto main::@1 -- pbuz1_lt_pbuc1_then_la1 + lda s+1 + cmp #>$400+$3e8 + bcc b1 + bne !+ + lda s + cmp #<$400+$3e8 + bcc b1 + !: + //SEG19 [9] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + //SEG20 main::@2 + //SEG21 [10] call testSimpleTypes + //SEG22 [12] phi from main::@2 to testSimpleTypes [phi:main::@2->testSimpleTypes] + jsr testSimpleTypes + //SEG23 main::@return + //SEG24 [11] return + rts +} +//SEG25 testSimpleTypes +testSimpleTypes: { + //SEG26 [13] call assertType + //SEG27 [43] phi from testSimpleTypes to assertType [phi:testSimpleTypes->assertType] + //SEG28 [43] phi (byte) idx#41 = (byte) 0 [phi:testSimpleTypes->assertType#0] -- vbuxx=vbuc1 + ldx #0 + //SEG29 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG30 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG31 [14] phi from testSimpleTypes to testSimpleTypes::@1 [phi:testSimpleTypes->testSimpleTypes::@1] + //SEG32 testSimpleTypes::@1 + //SEG33 [15] call assertType + //SEG34 [43] phi from testSimpleTypes::@1 to assertType [phi:testSimpleTypes::@1->assertType] + //SEG35 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@1->assertType#0] -- register_copy + //SEG36 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG37 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_BYTE [phi:testSimpleTypes::@1->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG38 [16] phi from testSimpleTypes::@1 to testSimpleTypes::@2 [phi:testSimpleTypes::@1->testSimpleTypes::@2] + //SEG39 testSimpleTypes::@2 + //SEG40 [17] call assertType + //SEG41 [43] phi from testSimpleTypes::@2 to assertType [phi:testSimpleTypes::@2->assertType] + //SEG42 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@2->assertType#0] -- register_copy + //SEG43 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG44 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@2->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG45 [18] phi from testSimpleTypes::@2 to testSimpleTypes::@3 [phi:testSimpleTypes::@2->testSimpleTypes::@3] + //SEG46 testSimpleTypes::@3 + //SEG47 [19] call assertType + //SEG48 [43] phi from testSimpleTypes::@3 to assertType [phi:testSimpleTypes::@3->assertType] + //SEG49 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@3->assertType#0] -- register_copy + //SEG50 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG51 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_BYTE [phi:testSimpleTypes::@3->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG52 [20] phi from testSimpleTypes::@3 to testSimpleTypes::@4 [phi:testSimpleTypes::@3->testSimpleTypes::@4] + //SEG53 testSimpleTypes::@4 + //SEG54 [21] call assertType + //SEG55 [43] phi from testSimpleTypes::@4 to assertType [phi:testSimpleTypes::@4->assertType] + //SEG56 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@4->assertType#0] -- register_copy + //SEG57 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG58 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@4->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG59 [22] phi from testSimpleTypes::@4 to testSimpleTypes::@5 [phi:testSimpleTypes::@4->testSimpleTypes::@5] + //SEG60 testSimpleTypes::@5 + //SEG61 [23] call assertType + //SEG62 [43] phi from testSimpleTypes::@5 to assertType [phi:testSimpleTypes::@5->assertType] + //SEG63 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@5->assertType#0] -- register_copy + //SEG64 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG65 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@5->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG66 [24] phi from testSimpleTypes::@5 to testSimpleTypes::@6 [phi:testSimpleTypes::@5->testSimpleTypes::@6] + //SEG67 testSimpleTypes::@6 + //SEG68 [25] call assertType + //SEG69 [43] phi from testSimpleTypes::@6 to assertType [phi:testSimpleTypes::@6->assertType] + //SEG70 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@6->assertType#0] -- register_copy + //SEG71 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@6->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG72 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_WORD [phi:testSimpleTypes::@6->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG73 [26] phi from testSimpleTypes::@6 to testSimpleTypes::@7 [phi:testSimpleTypes::@6->testSimpleTypes::@7] + //SEG74 testSimpleTypes::@7 + //SEG75 [27] call assertType + //SEG76 [43] phi from testSimpleTypes::@7 to assertType [phi:testSimpleTypes::@7->assertType] + //SEG77 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@7->assertType#0] -- register_copy + //SEG78 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@7->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG79 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@7->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG80 [28] phi from testSimpleTypes::@7 to testSimpleTypes::@8 [phi:testSimpleTypes::@7->testSimpleTypes::@8] + //SEG81 testSimpleTypes::@8 + //SEG82 [29] call assertType + //SEG83 [43] phi from testSimpleTypes::@8 to assertType [phi:testSimpleTypes::@8->assertType] + //SEG84 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@8->assertType#0] -- register_copy + //SEG85 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@8->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG86 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@8->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG87 [30] phi from testSimpleTypes::@8 to testSimpleTypes::@9 [phi:testSimpleTypes::@8->testSimpleTypes::@9] + //SEG88 testSimpleTypes::@9 + //SEG89 [31] call assertType + //SEG90 [43] phi from testSimpleTypes::@9 to assertType [phi:testSimpleTypes::@9->assertType] + //SEG91 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@9->assertType#0] -- register_copy + //SEG92 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@9->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG93 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_WORD [phi:testSimpleTypes::@9->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG94 [32] phi from testSimpleTypes::@9 to testSimpleTypes::@10 [phi:testSimpleTypes::@9->testSimpleTypes::@10] + //SEG95 testSimpleTypes::@10 + //SEG96 [33] call assertType + //SEG97 [43] phi from testSimpleTypes::@10 to assertType [phi:testSimpleTypes::@10->assertType] + //SEG98 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@10->assertType#0] -- register_copy + //SEG99 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@10->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG100 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@10->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG101 [34] phi from testSimpleTypes::@10 to testSimpleTypes::@11 [phi:testSimpleTypes::@10->testSimpleTypes::@11] + //SEG102 testSimpleTypes::@11 + //SEG103 [35] call assertType + //SEG104 [43] phi from testSimpleTypes::@11 to assertType [phi:testSimpleTypes::@11->assertType] + //SEG105 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@11->assertType#0] -- register_copy + //SEG106 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@11->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG107 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_DWORD [phi:testSimpleTypes::@11->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG108 [36] phi from testSimpleTypes::@11 to testSimpleTypes::@12 [phi:testSimpleTypes::@11->testSimpleTypes::@12] + //SEG109 testSimpleTypes::@12 + //SEG110 [37] call assertType + //SEG111 [43] phi from testSimpleTypes::@12 to assertType [phi:testSimpleTypes::@12->assertType] + //SEG112 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@12->assertType#0] -- register_copy + //SEG113 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@12->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG114 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@12->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG115 [38] phi from testSimpleTypes::@12 to testSimpleTypes::@13 [phi:testSimpleTypes::@12->testSimpleTypes::@13] + //SEG116 testSimpleTypes::@13 + //SEG117 [39] call assertType + //SEG118 [43] phi from testSimpleTypes::@13 to assertType [phi:testSimpleTypes::@13->assertType] + //SEG119 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@13->assertType#0] -- register_copy + //SEG120 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@13->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG121 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@13->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG122 [40] phi from testSimpleTypes::@13 to testSimpleTypes::@14 [phi:testSimpleTypes::@13->testSimpleTypes::@14] + //SEG123 testSimpleTypes::@14 + //SEG124 [41] call assertType + //SEG125 [43] phi from testSimpleTypes::@14 to assertType [phi:testSimpleTypes::@14->assertType] + //SEG126 [43] phi (byte) idx#41 = (byte) idx#20 [phi:testSimpleTypes::@14->assertType#0] -- register_copy + //SEG127 [43] phi (byte) assertType::t2#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@14->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG128 [43] phi (byte) assertType::t1#15 = (const byte) TYPEID_SIGNED_DWORD [phi:testSimpleTypes::@14->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG129 testSimpleTypes::@return + //SEG130 [42] return + rts +} +//SEG131 assertType +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte register(Y) t1, byte zeropage(4) t2) +assertType: { + .label t2 = 4 + //SEG132 [44] if((byte) assertType::t1#15==(byte) assertType::t2#15) goto assertType::@1 -- vbuyy_eq_vbuz1_then_la1 + tya + cmp t2 + beq b1 + //SEG133 assertType::@3 + //SEG134 [45] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) RED#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #RED + sta $d800,x + //SEG135 assertType::@2 + b2: + //SEG136 [46] *((byte*)(word) $400 + (byte) idx#41) ← (byte) assertType::t1#15 -- pbuc1_derefidx_vbuxx=vbuyy + tya + sta $400,x + //SEG137 [47] (byte) idx#20 ← ++ (byte) idx#41 -- vbuxx=_inc_vbuxx + inx + //SEG138 assertType::@return + //SEG139 [48] return + rts + //SEG140 assertType::@1 + b1: + //SEG141 [49] *((byte*)(word) $d800 + (byte) idx#41) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #GREEN + sta $d800,x + jmp b2 +} + diff --git a/src/test/ref/int-literals.sym b/src/test/ref/int-literals.sym new file mode 100644 index 000000000..ea8cfda80 --- /dev/null +++ b/src/test/ref/int-literals.sym @@ -0,0 +1,55 @@ +(label) @1 +(label) @begin +(label) @end +(byte*) COLS +(byte) GREEN +(const byte) GREEN#0 GREEN = (byte) 5 +(byte) RED +(const byte) RED#0 RED = (byte) 2 +(byte*) SCREEN +(const byte) TYPEID_BYTE TYPEID_BYTE = (number) 1 +(const byte) TYPEID_DWORD TYPEID_DWORD = (number) 5 +(const byte) TYPEID_SIGNED_BYTE TYPEID_SIGNED_BYTE = (number) 2 +(const byte) TYPEID_SIGNED_DWORD TYPEID_SIGNED_DWORD = (number) 6 +(const byte) TYPEID_SIGNED_WORD TYPEID_SIGNED_WORD = (number) 4 +(const byte) TYPEID_WORD TYPEID_WORD = (number) 3 +(void()) assertType((byte) assertType::t1 , (byte) assertType::t2) +(label) assertType::@1 +(label) assertType::@2 +(label) assertType::@3 +(label) assertType::@return +(byte) assertType::t1 +(byte) assertType::t1#15 reg byte y 1.0 +(byte) assertType::t2 +(byte) assertType::t2#15 t2 zp ZP_BYTE:4 2.0 +(byte) idx +(byte) idx#20 reg byte x 0.9999999999999999 +(byte) idx#41 reg byte x 7.200000000000002 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte*) main::s +(byte*) main::s#1 s zp ZP_WORD:2 16.5 +(byte*) main::s#2 s zp ZP_WORD:2 16.5 +(void()) testSimpleTypes() +(label) testSimpleTypes::@1 +(label) testSimpleTypes::@10 +(label) testSimpleTypes::@11 +(label) testSimpleTypes::@12 +(label) testSimpleTypes::@13 +(label) testSimpleTypes::@14 +(label) testSimpleTypes::@2 +(label) testSimpleTypes::@3 +(label) testSimpleTypes::@4 +(label) testSimpleTypes::@5 +(label) testSimpleTypes::@6 +(label) testSimpleTypes::@7 +(label) testSimpleTypes::@8 +(label) testSimpleTypes::@9 +(label) testSimpleTypes::@return + +zp ZP_WORD:2 [ main::s#2 main::s#1 ] +reg byte y [ assertType::t1#15 ] +zp ZP_BYTE:4 [ assertType::t2#15 ] +reg byte x [ idx#41 idx#20 ] diff --git a/src/test/ref/number-conversion.asm b/src/test/ref/number-conversion.asm new file mode 100644 index 000000000..17df64b44 --- /dev/null +++ b/src/test/ref/number-conversion.asm @@ -0,0 +1,180 @@ +// Tests conversion of numbers to correct int types +// See https://gitlab.com/camelot/kickc/issues/181 +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_SIGNED_DWORD = 6 + .const TYPEID_BYTE = 1 + .const TYPEID_WORD = 3 + .const TYPEID_DWORD = 5 + .const RED = 2 + .const GREEN = 5 +main: { + ldx #0 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + tay + jsr assertType + ldx #$28 + lda #TYPEID_BYTE + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_BYTE + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + ldx #$50 + lda #TYPEID_BYTE + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_BYTE + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_BYTE + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_WORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + tay + jsr assertType + lda #TYPEID_DWORD + sta assertType.t2 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + rts +} +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte register(Y) t1, byte zeropage(2) t2) +assertType: { + .label t2 = 2 + tya + cmp t2 + beq b1 + lda #RED + sta $d800,x + b2: + tya + sta $400,x + inx + rts + b1: + lda #GREEN + sta $d800,x + jmp b2 +} diff --git a/src/test/ref/number-conversion.cfg b/src/test/ref/number-conversion.cfg new file mode 100644 index 000000000..746b50917 --- /dev/null +++ b/src/test/ref/number-conversion.cfg @@ -0,0 +1,171 @@ +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + [5] call assertType + to:main::@1 +main::@1: scope:[main] from main + [6] phi() + [7] call assertType + to:main::@2 +main::@2: scope:[main] from main::@1 + [8] phi() + [9] call assertType + to:main::@3 +main::@3: scope:[main] from main::@2 + [10] phi() + [11] call assertType + to:main::@4 +main::@4: scope:[main] from main::@3 + [12] phi() + [13] call assertType + to:main::@5 +main::@5: scope:[main] from main::@4 + [14] phi() + [15] call assertType + to:main::@6 +main::@6: scope:[main] from main::@5 + [16] phi() + [17] call assertType + to:main::@7 +main::@7: scope:[main] from main::@6 + [18] phi() + [19] call assertType + to:main::@8 +main::@8: scope:[main] from main::@7 + [20] phi() + [21] call assertType + to:main::@9 +main::@9: scope:[main] from main::@8 + [22] phi() + [23] call assertType + to:main::@10 +main::@10: scope:[main] from main::@9 + [24] phi() + [25] call assertType + to:main::@11 +main::@11: scope:[main] from main::@10 + [26] phi() + [27] call assertType + to:main::@12 +main::@12: scope:[main] from main::@11 + [28] phi() + [29] call assertType + to:main::@13 +main::@13: scope:[main] from main::@12 + [30] phi() + [31] call assertType + to:main::@14 +main::@14: scope:[main] from main::@13 + [32] phi() + [33] call assertType + to:main::@15 +main::@15: scope:[main] from main::@14 + [34] phi() + [35] call assertType + to:main::@16 +main::@16: scope:[main] from main::@15 + [36] phi() + [37] call assertType + to:main::@17 +main::@17: scope:[main] from main::@16 + [38] phi() + [39] call assertType + to:main::@18 +main::@18: scope:[main] from main::@17 + [40] phi() + [41] call assertType + to:main::@19 +main::@19: scope:[main] from main::@18 + [42] phi() + [43] call assertType + to:main::@20 +main::@20: scope:[main] from main::@19 + [44] phi() + [45] call assertType + to:main::@21 +main::@21: scope:[main] from main::@20 + [46] phi() + [47] call assertType + to:main::@22 +main::@22: scope:[main] from main::@21 + [48] phi() + [49] call assertType + to:main::@23 +main::@23: scope:[main] from main::@22 + [50] phi() + [51] call assertType + to:main::@24 +main::@24: scope:[main] from main::@23 + [52] phi() + [53] call assertType + to:main::@25 +main::@25: scope:[main] from main::@24 + [54] phi() + [55] call assertType + to:main::@26 +main::@26: scope:[main] from main::@25 + [56] phi() + [57] call assertType + to:main::@27 +main::@27: scope:[main] from main::@26 + [58] phi() + [59] call assertType + to:main::@28 +main::@28: scope:[main] from main::@27 + [60] phi() + [61] call assertType + to:main::@29 +main::@29: scope:[main] from main::@28 + [62] phi() + [63] call assertType + to:main::@30 +main::@30: scope:[main] from main::@29 + [64] phi() + [65] call assertType + to:main::@31 +main::@31: scope:[main] from main::@30 + [66] phi() + [67] call assertType + to:main::@32 +main::@32: scope:[main] from main::@31 + [68] phi() + [69] call assertType + to:main::@33 +main::@33: scope:[main] from main::@32 + [70] phi() + [71] call assertType + to:main::@34 +main::@34: scope:[main] from main::@33 + [72] phi() + [73] call assertType + to:main::@return +main::@return: scope:[main] from main::@34 + [74] return + to:@return +assertType: scope:[assertType] from main main::@1 main::@10 main::@11 main::@12 main::@13 main::@14 main::@15 main::@16 main::@17 main::@18 main::@19 main::@2 main::@20 main::@21 main::@22 main::@23 main::@24 main::@25 main::@26 main::@27 main::@28 main::@29 main::@3 main::@30 main::@31 main::@32 main::@33 main::@34 main::@4 main::@5 main::@6 main::@7 main::@8 main::@9 + [75] (byte) idx#79 ← phi( main/(byte) 0 main::@1/(byte) idx#40 main::@10/(byte) idx#40 main::@11/(byte) idx#40 main::@12/(byte) idx#40 main::@13/(byte) idx#40 main::@14/(byte) idx#40 main::@15/(byte) idx#40 main::@16/(byte) idx#40 main::@17/(byte) idx#40 main::@18/(byte) idx#40 main::@19/(byte) idx#40 main::@2/(byte) idx#40 main::@20/(byte) idx#40 main::@21/(byte) $50 main::@22/(byte) idx#40 main::@23/(byte) idx#40 main::@24/(byte) idx#40 main::@25/(byte) idx#40 main::@26/(byte) idx#40 main::@27/(byte) idx#40 main::@28/(byte) idx#40 main::@29/(byte) idx#40 main::@3/(byte) idx#40 main::@30/(byte) idx#40 main::@31/(byte) idx#40 main::@32/(byte) idx#40 main::@33/(byte) idx#40 main::@34/(byte) idx#40 main::@4/(byte) idx#40 main::@5/(byte) idx#40 main::@6/(byte) idx#40 main::@7/(byte) idx#40 main::@8/(byte) idx#40 main::@9/(byte) $28 ) + [75] (byte) assertType::t2#35 ← phi( main/(const byte) TYPEID_SIGNED_BYTE main::@1/(const byte) TYPEID_SIGNED_WORD main::@10/(const byte) TYPEID_BYTE main::@11/(const byte) TYPEID_WORD main::@12/(const byte) TYPEID_WORD main::@13/(const byte) TYPEID_DWORD main::@14/(const byte) TYPEID_WORD main::@15/(const byte) TYPEID_WORD main::@16/(const byte) TYPEID_DWORD main::@17/(const byte) TYPEID_DWORD main::@18/(const byte) TYPEID_DWORD main::@19/(const byte) TYPEID_DWORD main::@2/(const byte) TYPEID_SIGNED_DWORD main::@20/(const byte) TYPEID_DWORD main::@21/(const byte) TYPEID_BYTE main::@22/(const byte) TYPEID_BYTE main::@23/(const byte) TYPEID_BYTE main::@24/(const byte) TYPEID_WORD main::@25/(const byte) TYPEID_WORD main::@26/(const byte) TYPEID_DWORD main::@27/(const byte) TYPEID_WORD main::@28/(const byte) TYPEID_WORD main::@29/(const byte) TYPEID_WORD main::@3/(const byte) TYPEID_SIGNED_WORD main::@30/(const byte) TYPEID_DWORD main::@31/(const byte) TYPEID_DWORD main::@32/(const byte) TYPEID_DWORD main::@33/(const byte) TYPEID_DWORD main::@34/(const byte) TYPEID_DWORD main::@4/(const byte) TYPEID_SIGNED_WORD main::@5/(const byte) TYPEID_SIGNED_DWORD main::@6/(const byte) TYPEID_SIGNED_DWORD main::@7/(const byte) TYPEID_SIGNED_DWORD main::@8/(const byte) TYPEID_SIGNED_DWORD main::@9/(const byte) TYPEID_BYTE ) + [75] (byte) assertType::t1#35 ← phi( main/(const byte) TYPEID_SIGNED_BYTE main::@1/(const byte) TYPEID_SIGNED_WORD main::@10/(const byte) TYPEID_BYTE main::@11/(const byte) TYPEID_WORD main::@12/(const byte) TYPEID_WORD main::@13/(const byte) TYPEID_DWORD main::@14/(const byte) TYPEID_WORD main::@15/(const byte) TYPEID_WORD main::@16/(const byte) TYPEID_DWORD main::@17/(const byte) TYPEID_DWORD main::@18/(const byte) TYPEID_DWORD main::@19/(const byte) TYPEID_DWORD main::@2/(const byte) TYPEID_SIGNED_DWORD main::@20/(const byte) TYPEID_DWORD main::@21/(const byte) TYPEID_BYTE main::@22/(const byte) TYPEID_BYTE main::@23/(const byte) TYPEID_BYTE main::@24/(const byte) TYPEID_WORD main::@25/(const byte) TYPEID_WORD main::@26/(const byte) TYPEID_DWORD main::@27/(const byte) TYPEID_WORD main::@28/(const byte) TYPEID_WORD main::@29/(const byte) TYPEID_WORD main::@3/(const byte) TYPEID_SIGNED_WORD main::@30/(const byte) TYPEID_DWORD main::@31/(const byte) TYPEID_DWORD main::@32/(const byte) TYPEID_DWORD main::@33/(const byte) TYPEID_DWORD main::@34/(const byte) TYPEID_SIGNED_DWORD main::@4/(const byte) TYPEID_SIGNED_WORD main::@5/(const byte) TYPEID_SIGNED_DWORD main::@6/(const byte) TYPEID_SIGNED_DWORD main::@7/(const byte) TYPEID_SIGNED_DWORD main::@8/(const byte) TYPEID_SIGNED_DWORD main::@9/(const byte) TYPEID_BYTE ) + [76] if((byte) assertType::t1#35==(byte) assertType::t2#35) goto assertType::@1 + to:assertType::@3 +assertType::@3: scope:[assertType] from assertType + [77] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) RED#0 + to:assertType::@2 +assertType::@2: scope:[assertType] from assertType::@1 assertType::@3 + [78] *((byte*)(word) $400 + (byte) idx#79) ← (byte) assertType::t1#35 + [79] (byte) idx#40 ← ++ (byte) idx#79 + to:assertType::@return +assertType::@return: scope:[assertType] from assertType::@2 + [80] return + to:@return +assertType::@1: scope:[assertType] from assertType + [81] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) GREEN#0 + to:assertType::@2 diff --git a/src/test/ref/number-conversion.log b/src/test/ref/number-conversion.log new file mode 100644 index 000000000..72d68592f --- /dev/null +++ b/src/test/ref/number-conversion.log @@ -0,0 +1,3609 @@ +Resolved forward reference idx to (byte) idx +Resolved forward reference idx to (byte) idx +Resolved forward reference idx to (byte) idx +Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (word) $400 +Adding pointer type conversion cast (byte*) COLS in (byte*) COLS ← (word) $d800 + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + to:@1 +main: scope:[main] from @2 + (byte) idx#0 ← (byte) 0 + (number~) main::$0 ← (signed byte) $c + (number) $c + (byte~) main::$1 ← typeid (number~) main::$0 + (byte) assertType::t1#0 ← (byte~) main::$1 + (byte) assertType::t2#0 ← (const byte) TYPEID_SIGNED_BYTE + call assertType + to:main::@1 +main::@1: scope:[main] from main + (byte) idx#43 ← phi( main/(byte) idx#41 ) + (byte) idx#1 ← (byte) idx#43 + (number~) main::$3 ← (signed byte) $c + (number) $82 + (byte~) main::$4 ← typeid (number~) main::$3 + (byte) assertType::t1#1 ← (byte~) main::$4 + (byte) assertType::t2#1 ← (const byte) TYPEID_SIGNED_WORD + call assertType + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte) idx#44 ← phi( main::@1/(byte) idx#41 ) + (byte) idx#2 ← (byte) idx#44 + (number~) main::$6 ← (signed byte) $c + (number) $80e8 + (byte~) main::$7 ← typeid (number~) main::$6 + (byte) assertType::t1#2 ← (byte~) main::$7 + (byte) assertType::t2#2 ← (const byte) TYPEID_SIGNED_DWORD + call assertType + to:main::@3 +main::@3: scope:[main] from main::@2 + (byte) idx#45 ← phi( main::@2/(byte) idx#41 ) + (byte) idx#3 ← (byte) idx#45 + (number~) main::$9 ← (signed word) $c + (number) $c + (byte~) main::$10 ← typeid (number~) main::$9 + (byte) assertType::t1#3 ← (byte~) main::$10 + (byte) assertType::t2#3 ← (const byte) TYPEID_SIGNED_WORD + call assertType + to:main::@4 +main::@4: scope:[main] from main::@3 + (byte) idx#46 ← phi( main::@3/(byte) idx#41 ) + (byte) idx#4 ← (byte) idx#46 + (number~) main::$12 ← (signed word) $c + (number) $82 + (byte~) main::$13 ← typeid (number~) main::$12 + (byte) assertType::t1#4 ← (byte~) main::$13 + (byte) assertType::t2#4 ← (const byte) TYPEID_SIGNED_WORD + call assertType + to:main::@5 +main::@5: scope:[main] from main::@4 + (byte) idx#47 ← phi( main::@4/(byte) idx#41 ) + (byte) idx#5 ← (byte) idx#47 + (number~) main::$15 ← (signed word) $c + (number) $186a0 + (byte~) main::$16 ← typeid (number~) main::$15 + (byte) assertType::t1#5 ← (byte~) main::$16 + (byte) assertType::t2#5 ← (const byte) TYPEID_SIGNED_DWORD + call assertType + to:main::@6 +main::@6: scope:[main] from main::@5 + (byte) idx#48 ← phi( main::@5/(byte) idx#41 ) + (byte) idx#6 ← (byte) idx#48 + (number~) main::$18 ← (signed dword) $c + (number) $c + (byte~) main::$19 ← typeid (number~) main::$18 + (byte) assertType::t1#6 ← (byte~) main::$19 + (byte) assertType::t2#6 ← (const byte) TYPEID_SIGNED_DWORD + call assertType + to:main::@7 +main::@7: scope:[main] from main::@6 + (byte) idx#49 ← phi( main::@6/(byte) idx#41 ) + (byte) idx#7 ← (byte) idx#49 + (number~) main::$21 ← (signed dword) $c + (number) $82 + (byte~) main::$22 ← typeid (number~) main::$21 + (byte) assertType::t1#7 ← (byte~) main::$22 + (byte) assertType::t2#7 ← (const byte) TYPEID_SIGNED_DWORD + call assertType + to:main::@8 +main::@8: scope:[main] from main::@7 + (byte) idx#50 ← phi( main::@7/(byte) idx#41 ) + (byte) idx#8 ← (byte) idx#50 + (number~) main::$24 ← (signed dword) $c + (number) $186a0 + (byte~) main::$25 ← typeid (number~) main::$24 + (byte) assertType::t1#8 ← (byte~) main::$25 + (byte) assertType::t2#8 ← (const byte) TYPEID_SIGNED_DWORD + call assertType + to:main::@9 +main::@9: scope:[main] from main::@8 + (byte) idx#51 ← phi( main::@8/(byte) idx#41 ) + (byte) idx#9 ← (byte) idx#51 + (byte) idx#10 ← (byte) $28 + (number~) main::$27 ← (byte) $c + (number) $c + (byte~) main::$28 ← typeid (number~) main::$27 + (byte) assertType::t1#9 ← (byte~) main::$28 + (byte) assertType::t2#9 ← (const byte) TYPEID_BYTE + call assertType + to:main::@10 +main::@10: scope:[main] from main::@9 + (byte) idx#52 ← phi( main::@9/(byte) idx#41 ) + (byte) idx#11 ← (byte) idx#52 + (number~) main::$30 ← (byte) $c + (number) $fa + (byte~) main::$31 ← typeid (number~) main::$30 + (byte) assertType::t1#10 ← (byte~) main::$31 + (byte) assertType::t2#10 ← (const byte) TYPEID_BYTE + call assertType + to:main::@11 +main::@11: scope:[main] from main::@10 + (byte) idx#53 ← phi( main::@10/(byte) idx#41 ) + (byte) idx#12 ← (byte) idx#53 + (number~) main::$33 ← (byte) $c + (number) $12c + (byte~) main::$34 ← typeid (number~) main::$33 + (byte) assertType::t1#11 ← (byte~) main::$34 + (byte) assertType::t2#11 ← (const byte) TYPEID_WORD + call assertType + to:main::@12 +main::@12: scope:[main] from main::@11 + (byte) idx#54 ← phi( main::@11/(byte) idx#41 ) + (byte) idx#13 ← (byte) idx#54 + (number~) main::$36 ← (byte) $c + (number) $fffe + (byte~) main::$37 ← typeid (number~) main::$36 + (byte) assertType::t1#12 ← (byte~) main::$37 + (byte) assertType::t2#12 ← (const byte) TYPEID_WORD + call assertType + to:main::@13 +main::@13: scope:[main] from main::@12 + (byte) idx#55 ← phi( main::@12/(byte) idx#41 ) + (byte) idx#14 ← (byte) idx#55 + (number~) main::$39 ← (byte) $c + (number) $101d0 + (byte~) main::$40 ← typeid (number~) main::$39 + (byte) assertType::t1#13 ← (byte~) main::$40 + (byte) assertType::t2#13 ← (const byte) TYPEID_DWORD + call assertType + to:main::@14 +main::@14: scope:[main] from main::@13 + (byte) idx#56 ← phi( main::@13/(byte) idx#41 ) + (byte) idx#15 ← (byte) idx#56 + (number~) main::$42 ← (word) $c + (number) $c + (byte~) main::$43 ← typeid (number~) main::$42 + (byte) assertType::t1#14 ← (byte~) main::$43 + (byte) assertType::t2#14 ← (const byte) TYPEID_WORD + call assertType + to:main::@15 +main::@15: scope:[main] from main::@14 + (byte) idx#57 ← phi( main::@14/(byte) idx#41 ) + (byte) idx#16 ← (byte) idx#57 + (number~) main::$45 ← (word) $c + (number) $82 + (byte~) main::$46 ← typeid (number~) main::$45 + (byte) assertType::t1#15 ← (byte~) main::$46 + (byte) assertType::t2#15 ← (const byte) TYPEID_WORD + call assertType + to:main::@16 +main::@16: scope:[main] from main::@15 + (byte) idx#58 ← phi( main::@15/(byte) idx#41 ) + (byte) idx#17 ← (byte) idx#58 + (number~) main::$48 ← (word) $c + (number) $101d0 + (byte~) main::$49 ← typeid (number~) main::$48 + (byte) assertType::t1#16 ← (byte~) main::$49 + (byte) assertType::t2#16 ← (const byte) TYPEID_DWORD + call assertType + to:main::@17 +main::@17: scope:[main] from main::@16 + (byte) idx#59 ← phi( main::@16/(byte) idx#41 ) + (byte) idx#18 ← (byte) idx#59 + (number~) main::$51 ← (dword) $c + (number) $c + (byte~) main::$52 ← typeid (number~) main::$51 + (byte) assertType::t1#17 ← (byte~) main::$52 + (byte) assertType::t2#17 ← (const byte) TYPEID_DWORD + call assertType + to:main::@18 +main::@18: scope:[main] from main::@17 + (byte) idx#60 ← phi( main::@17/(byte) idx#41 ) + (byte) idx#19 ← (byte) idx#60 + (number~) main::$54 ← (dword) $c + (number) $82 + (byte~) main::$55 ← typeid (number~) main::$54 + (byte) assertType::t1#18 ← (byte~) main::$55 + (byte) assertType::t2#18 ← (const byte) TYPEID_DWORD + call assertType + to:main::@19 +main::@19: scope:[main] from main::@18 + (byte) idx#61 ← phi( main::@18/(byte) idx#41 ) + (byte) idx#20 ← (byte) idx#61 + (number~) main::$57 ← (dword) $c + (number) $101d0 + (byte~) main::$58 ← typeid (number~) main::$57 + (byte) assertType::t1#19 ← (byte~) main::$58 + (byte) assertType::t2#19 ← (const byte) TYPEID_DWORD + call assertType + to:main::@20 +main::@20: scope:[main] from main::@19 + (byte) idx#62 ← phi( main::@19/(byte) idx#41 ) + (byte) idx#21 ← (byte) idx#62 + (number~) main::$60 ← (byte) $c + (number) $b2d05e00 + (byte~) main::$61 ← typeid (number~) main::$60 + (byte) assertType::t1#20 ← (byte~) main::$61 + (byte) assertType::t2#20 ← (const byte) TYPEID_DWORD + call assertType + to:main::@21 +main::@21: scope:[main] from main::@20 + (byte) idx#63 ← phi( main::@20/(byte) idx#41 ) + (byte) idx#22 ← (byte) idx#63 + (byte) idx#23 ← (byte) $50 + (number~) main::$63 ← - (number) $c + (number~) main::$64 ← (byte) $c + (number~) main::$63 + (byte~) main::$65 ← typeid (number~) main::$64 + (byte) assertType::t1#21 ← (byte~) main::$65 + (byte) assertType::t2#21 ← (const byte) TYPEID_BYTE + call assertType + to:main::@22 +main::@22: scope:[main] from main::@21 + (byte) idx#64 ← phi( main::@21/(byte) idx#41 ) + (byte) idx#24 ← (byte) idx#64 + (number~) main::$67 ← - (number) $78 + (number~) main::$68 ← (byte) $c + (number~) main::$67 + (byte~) main::$69 ← typeid (number~) main::$68 + (byte) assertType::t1#22 ← (byte~) main::$69 + (byte) assertType::t2#22 ← (const byte) TYPEID_BYTE + call assertType + to:main::@23 +main::@23: scope:[main] from main::@22 + (byte) idx#65 ← phi( main::@22/(byte) idx#41 ) + (byte) idx#25 ← (byte) idx#65 + (number~) main::$71 ← - (number) $fa + (number~) main::$72 ← (byte) $c + (number~) main::$71 + (byte~) main::$73 ← typeid (number~) main::$72 + (byte) assertType::t1#23 ← (byte~) main::$73 + (byte) assertType::t2#23 ← (const byte) TYPEID_BYTE + call assertType + to:main::@24 +main::@24: scope:[main] from main::@23 + (byte) idx#66 ← phi( main::@23/(byte) idx#41 ) + (byte) idx#26 ← (byte) idx#66 + (number~) main::$75 ← - (number) $104 + (number~) main::$76 ← (byte) $c + (number~) main::$75 + (byte~) main::$77 ← typeid (number~) main::$76 + (byte) assertType::t1#24 ← (byte~) main::$77 + (byte) assertType::t2#24 ← (const byte) TYPEID_WORD + call assertType + to:main::@25 +main::@25: scope:[main] from main::@24 + (byte) idx#67 ← phi( main::@24/(byte) idx#41 ) + (byte) idx#27 ← (byte) idx#67 + (number~) main::$79 ← - (number) $fde8 + (number~) main::$80 ← (byte) $c + (number~) main::$79 + (byte~) main::$81 ← typeid (number~) main::$80 + (byte) assertType::t1#25 ← (byte~) main::$81 + (byte) assertType::t2#25 ← (const byte) TYPEID_WORD + call assertType + to:main::@26 +main::@26: scope:[main] from main::@25 + (byte) idx#68 ← phi( main::@25/(byte) idx#41 ) + (byte) idx#28 ← (byte) idx#68 + (number~) main::$83 ← - (number) $101d0 + (number~) main::$84 ← (byte) $c + (number~) main::$83 + (byte~) main::$85 ← typeid (number~) main::$84 + (byte) assertType::t1#26 ← (byte~) main::$85 + (byte) assertType::t2#26 ← (const byte) TYPEID_DWORD + call assertType + to:main::@27 +main::@27: scope:[main] from main::@26 + (byte) idx#69 ← phi( main::@26/(byte) idx#41 ) + (byte) idx#29 ← (byte) idx#69 + (number~) main::$87 ← - (number) $c + (number~) main::$88 ← (word) $c + (number~) main::$87 + (byte~) main::$89 ← typeid (number~) main::$88 + (byte) assertType::t1#27 ← (byte~) main::$89 + (byte) assertType::t2#27 ← (const byte) TYPEID_WORD + call assertType + to:main::@28 +main::@28: scope:[main] from main::@27 + (byte) idx#70 ← phi( main::@27/(byte) idx#41 ) + (byte) idx#30 ← (byte) idx#70 + (number~) main::$91 ← - (number) $82 + (number~) main::$92 ← (word) $c + (number~) main::$91 + (byte~) main::$93 ← typeid (number~) main::$92 + (byte) assertType::t1#28 ← (byte~) main::$93 + (byte) assertType::t2#28 ← (const byte) TYPEID_WORD + call assertType + to:main::@29 +main::@29: scope:[main] from main::@28 + (byte) idx#71 ← phi( main::@28/(byte) idx#41 ) + (byte) idx#31 ← (byte) idx#71 + (number~) main::$95 ← - (number) $fde8 + (number~) main::$96 ← (word) $c + (number~) main::$95 + (byte~) main::$97 ← typeid (number~) main::$96 + (byte) assertType::t1#29 ← (byte~) main::$97 + (byte) assertType::t2#29 ← (const byte) TYPEID_WORD + call assertType + to:main::@30 +main::@30: scope:[main] from main::@29 + (byte) idx#72 ← phi( main::@29/(byte) idx#41 ) + (byte) idx#32 ← (byte) idx#72 + (number~) main::$99 ← - (number) $101d0 + (number~) main::$100 ← (word) $c + (number~) main::$99 + (byte~) main::$101 ← typeid (number~) main::$100 + (byte) assertType::t1#30 ← (byte~) main::$101 + (byte) assertType::t2#30 ← (const byte) TYPEID_DWORD + call assertType + to:main::@31 +main::@31: scope:[main] from main::@30 + (byte) idx#73 ← phi( main::@30/(byte) idx#41 ) + (byte) idx#33 ← (byte) idx#73 + (number~) main::$103 ← - (number) $c + (number~) main::$104 ← (dword) $c + (number~) main::$103 + (byte~) main::$105 ← typeid (number~) main::$104 + (byte) assertType::t1#31 ← (byte~) main::$105 + (byte) assertType::t2#31 ← (const byte) TYPEID_DWORD + call assertType + to:main::@32 +main::@32: scope:[main] from main::@31 + (byte) idx#74 ← phi( main::@31/(byte) idx#41 ) + (byte) idx#34 ← (byte) idx#74 + (number~) main::$107 ← - (number) $82 + (number~) main::$108 ← (dword) $c + (number~) main::$107 + (byte~) main::$109 ← typeid (number~) main::$108 + (byte) assertType::t1#32 ← (byte~) main::$109 + (byte) assertType::t2#32 ← (const byte) TYPEID_DWORD + call assertType + to:main::@33 +main::@33: scope:[main] from main::@32 + (byte) idx#75 ← phi( main::@32/(byte) idx#41 ) + (byte) idx#35 ← (byte) idx#75 + (number~) main::$111 ← - (number) $101d0 + (number~) main::$112 ← (dword) $c + (number~) main::$111 + (byte~) main::$113 ← typeid (number~) main::$112 + (byte) assertType::t1#33 ← (byte~) main::$113 + (byte) assertType::t2#33 ← (const byte) TYPEID_DWORD + call assertType + to:main::@34 +main::@34: scope:[main] from main::@33 + (byte) idx#76 ← phi( main::@33/(byte) idx#41 ) + (byte) idx#36 ← (byte) idx#76 + (number~) main::$115 ← - (number) $7d2b7500 + (number~) main::$116 ← (signed byte) $c + (number~) main::$115 + (byte~) main::$117 ← typeid (number~) main::$116 + (byte) assertType::t1#34 ← (byte~) main::$117 + (byte) assertType::t2#34 ← (const byte) TYPEID_DWORD + call assertType + to:main::@35 +main::@35: scope:[main] from main::@34 + (byte) idx#77 ← phi( main::@34/(byte) idx#41 ) + (byte) idx#37 ← (byte) idx#77 + to:main::@return +main::@return: scope:[main] from main::@35 + (byte) idx#78 ← phi( main::@35/(byte) idx#37 ) + (byte) idx#38 ← (byte) idx#78 + return + to:@return +@1: scope:[] from @begin + (byte) RED#0 ← (byte) 2 + (byte) GREEN#0 ← (byte) 5 + (word) $0 ← (word) $400 + (byte*) SCREEN#0 ← ((byte*)) (word) $0 + (word) $1 ← (word) $d800 + (byte*) COLS#0 ← ((byte*)) (word) $1 + (byte) idx#39 ← (byte) 0 + to:@2 +assertType: scope:[assertType] from main main::@1 main::@10 main::@11 main::@12 main::@13 main::@14 main::@15 main::@16 main::@17 main::@18 main::@19 main::@2 main::@20 main::@21 main::@22 main::@23 main::@24 main::@25 main::@26 main::@27 main::@28 main::@29 main::@3 main::@30 main::@31 main::@32 main::@33 main::@34 main::@4 main::@5 main::@6 main::@7 main::@8 main::@9 + (byte) idx#84 ← phi( main/(byte) idx#0 main::@1/(byte) idx#1 main::@10/(byte) idx#11 main::@11/(byte) idx#12 main::@12/(byte) idx#13 main::@13/(byte) idx#14 main::@14/(byte) idx#15 main::@15/(byte) idx#16 main::@16/(byte) idx#17 main::@17/(byte) idx#18 main::@18/(byte) idx#19 main::@19/(byte) idx#20 main::@2/(byte) idx#2 main::@20/(byte) idx#21 main::@21/(byte) idx#23 main::@22/(byte) idx#24 main::@23/(byte) idx#25 main::@24/(byte) idx#26 main::@25/(byte) idx#27 main::@26/(byte) idx#28 main::@27/(byte) idx#29 main::@28/(byte) idx#30 main::@29/(byte) idx#31 main::@3/(byte) idx#3 main::@30/(byte) idx#32 main::@31/(byte) idx#33 main::@32/(byte) idx#34 main::@33/(byte) idx#35 main::@34/(byte) idx#36 main::@4/(byte) idx#4 main::@5/(byte) idx#5 main::@6/(byte) idx#6 main::@7/(byte) idx#7 main::@8/(byte) idx#8 main::@9/(byte) idx#10 ) + (byte) assertType::t2#35 ← phi( main/(byte) assertType::t2#0 main::@1/(byte) assertType::t2#1 main::@10/(byte) assertType::t2#10 main::@11/(byte) assertType::t2#11 main::@12/(byte) assertType::t2#12 main::@13/(byte) assertType::t2#13 main::@14/(byte) assertType::t2#14 main::@15/(byte) assertType::t2#15 main::@16/(byte) assertType::t2#16 main::@17/(byte) assertType::t2#17 main::@18/(byte) assertType::t2#18 main::@19/(byte) assertType::t2#19 main::@2/(byte) assertType::t2#2 main::@20/(byte) assertType::t2#20 main::@21/(byte) assertType::t2#21 main::@22/(byte) assertType::t2#22 main::@23/(byte) assertType::t2#23 main::@24/(byte) assertType::t2#24 main::@25/(byte) assertType::t2#25 main::@26/(byte) assertType::t2#26 main::@27/(byte) assertType::t2#27 main::@28/(byte) assertType::t2#28 main::@29/(byte) assertType::t2#29 main::@3/(byte) assertType::t2#3 main::@30/(byte) assertType::t2#30 main::@31/(byte) assertType::t2#31 main::@32/(byte) assertType::t2#32 main::@33/(byte) assertType::t2#33 main::@34/(byte) assertType::t2#34 main::@4/(byte) assertType::t2#4 main::@5/(byte) assertType::t2#5 main::@6/(byte) assertType::t2#6 main::@7/(byte) assertType::t2#7 main::@8/(byte) assertType::t2#8 main::@9/(byte) assertType::t2#9 ) + (byte) assertType::t1#35 ← phi( main/(byte) assertType::t1#0 main::@1/(byte) assertType::t1#1 main::@10/(byte) assertType::t1#10 main::@11/(byte) assertType::t1#11 main::@12/(byte) assertType::t1#12 main::@13/(byte) assertType::t1#13 main::@14/(byte) assertType::t1#14 main::@15/(byte) assertType::t1#15 main::@16/(byte) assertType::t1#16 main::@17/(byte) assertType::t1#17 main::@18/(byte) assertType::t1#18 main::@19/(byte) assertType::t1#19 main::@2/(byte) assertType::t1#2 main::@20/(byte) assertType::t1#20 main::@21/(byte) assertType::t1#21 main::@22/(byte) assertType::t1#22 main::@23/(byte) assertType::t1#23 main::@24/(byte) assertType::t1#24 main::@25/(byte) assertType::t1#25 main::@26/(byte) assertType::t1#26 main::@27/(byte) assertType::t1#27 main::@28/(byte) assertType::t1#28 main::@29/(byte) assertType::t1#29 main::@3/(byte) assertType::t1#3 main::@30/(byte) assertType::t1#30 main::@31/(byte) assertType::t1#31 main::@32/(byte) assertType::t1#32 main::@33/(byte) assertType::t1#33 main::@34/(byte) assertType::t1#34 main::@4/(byte) assertType::t1#4 main::@5/(byte) assertType::t1#5 main::@6/(byte) assertType::t1#6 main::@7/(byte) assertType::t1#7 main::@8/(byte) assertType::t1#8 main::@9/(byte) assertType::t1#9 ) + (bool~) assertType::$0 ← (byte) assertType::t1#35 == (byte) assertType::t2#35 + if((bool~) assertType::$0) goto assertType::@1 + to:assertType::@3 +assertType::@1: scope:[assertType] from assertType + (byte) assertType::t1#37 ← phi( assertType/(byte) assertType::t1#35 ) + (byte) idx#79 ← phi( assertType/(byte) idx#84 ) + *((byte*) COLS#0 + (byte) idx#79) ← (byte) GREEN#0 + to:assertType::@2 +assertType::@3: scope:[assertType] from assertType + (byte) assertType::t1#38 ← phi( assertType/(byte) assertType::t1#35 ) + (byte) idx#80 ← phi( assertType/(byte) idx#84 ) + *((byte*) COLS#0 + (byte) idx#80) ← (byte) RED#0 + to:assertType::@2 +assertType::@2: scope:[assertType] from assertType::@1 assertType::@3 + (byte) idx#81 ← phi( assertType::@1/(byte) idx#79 assertType::@3/(byte) idx#80 ) + (byte) assertType::t1#36 ← phi( assertType::@1/(byte) assertType::t1#37 assertType::@3/(byte) assertType::t1#38 ) + *((byte*) SCREEN#0 + (byte) idx#81) ← (byte) assertType::t1#36 + (byte) idx#40 ← ++ (byte) idx#81 + to:assertType::@return +assertType::@return: scope:[assertType] from assertType::@2 + (byte) idx#82 ← phi( assertType::@2/(byte) idx#40 ) + (byte) idx#41 ← (byte) idx#82 + return + to:@return +@2: scope:[] from @1 + (byte) idx#85 ← phi( @1/(byte) idx#39 ) + call main + to:@3 +@3: scope:[] from @2 + (byte) idx#83 ← phi( @2/(byte) idx#38 ) + (byte) idx#42 ← (byte) idx#83 + to:@end +@end: scope:[] from @3 + +SYMBOL TABLE SSA +(word) $0 +(word) $1 +(label) @1 +(label) @2 +(label) @3 +(label) @begin +(label) @end +(byte*) COLS +(byte*) COLS#0 +(byte) GREEN +(byte) GREEN#0 +(byte) RED +(byte) RED#0 +(byte*) SCREEN +(byte*) SCREEN#0 +(const byte) TYPEID_BYTE = (number) 1 +(const byte) TYPEID_DWORD = (number) 5 +(const byte) TYPEID_SIGNED_BYTE = (number) 2 +(const byte) TYPEID_SIGNED_DWORD = (number) 6 +(const byte) TYPEID_SIGNED_WORD = (number) 4 +(const byte) TYPEID_WORD = (number) 3 +(void()) assertType((byte) assertType::t1 , (byte) assertType::t2) +(bool~) assertType::$0 +(label) assertType::@1 +(label) assertType::@2 +(label) assertType::@3 +(label) assertType::@return +(byte) assertType::t1 +(byte) assertType::t1#0 +(byte) assertType::t1#1 +(byte) assertType::t1#10 +(byte) assertType::t1#11 +(byte) assertType::t1#12 +(byte) assertType::t1#13 +(byte) assertType::t1#14 +(byte) assertType::t1#15 +(byte) assertType::t1#16 +(byte) assertType::t1#17 +(byte) assertType::t1#18 +(byte) assertType::t1#19 +(byte) assertType::t1#2 +(byte) assertType::t1#20 +(byte) assertType::t1#21 +(byte) assertType::t1#22 +(byte) assertType::t1#23 +(byte) assertType::t1#24 +(byte) assertType::t1#25 +(byte) assertType::t1#26 +(byte) assertType::t1#27 +(byte) assertType::t1#28 +(byte) assertType::t1#29 +(byte) assertType::t1#3 +(byte) assertType::t1#30 +(byte) assertType::t1#31 +(byte) assertType::t1#32 +(byte) assertType::t1#33 +(byte) assertType::t1#34 +(byte) assertType::t1#35 +(byte) assertType::t1#36 +(byte) assertType::t1#37 +(byte) assertType::t1#38 +(byte) assertType::t1#4 +(byte) assertType::t1#5 +(byte) assertType::t1#6 +(byte) assertType::t1#7 +(byte) assertType::t1#8 +(byte) assertType::t1#9 +(byte) assertType::t2 +(byte) assertType::t2#0 +(byte) assertType::t2#1 +(byte) assertType::t2#10 +(byte) assertType::t2#11 +(byte) assertType::t2#12 +(byte) assertType::t2#13 +(byte) assertType::t2#14 +(byte) assertType::t2#15 +(byte) assertType::t2#16 +(byte) assertType::t2#17 +(byte) assertType::t2#18 +(byte) assertType::t2#19 +(byte) assertType::t2#2 +(byte) assertType::t2#20 +(byte) assertType::t2#21 +(byte) assertType::t2#22 +(byte) assertType::t2#23 +(byte) assertType::t2#24 +(byte) assertType::t2#25 +(byte) assertType::t2#26 +(byte) assertType::t2#27 +(byte) assertType::t2#28 +(byte) assertType::t2#29 +(byte) assertType::t2#3 +(byte) assertType::t2#30 +(byte) assertType::t2#31 +(byte) assertType::t2#32 +(byte) assertType::t2#33 +(byte) assertType::t2#34 +(byte) assertType::t2#35 +(byte) assertType::t2#4 +(byte) assertType::t2#5 +(byte) assertType::t2#6 +(byte) assertType::t2#7 +(byte) assertType::t2#8 +(byte) assertType::t2#9 +(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#17 +(byte) idx#18 +(byte) idx#19 +(byte) idx#2 +(byte) idx#20 +(byte) idx#21 +(byte) idx#22 +(byte) idx#23 +(byte) idx#24 +(byte) idx#25 +(byte) idx#26 +(byte) idx#27 +(byte) idx#28 +(byte) idx#29 +(byte) idx#3 +(byte) idx#30 +(byte) idx#31 +(byte) idx#32 +(byte) idx#33 +(byte) idx#34 +(byte) idx#35 +(byte) idx#36 +(byte) idx#37 +(byte) idx#38 +(byte) idx#39 +(byte) idx#4 +(byte) idx#40 +(byte) idx#41 +(byte) idx#42 +(byte) idx#43 +(byte) idx#44 +(byte) idx#45 +(byte) idx#46 +(byte) idx#47 +(byte) idx#48 +(byte) idx#49 +(byte) idx#5 +(byte) idx#50 +(byte) idx#51 +(byte) idx#52 +(byte) idx#53 +(byte) idx#54 +(byte) idx#55 +(byte) idx#56 +(byte) idx#57 +(byte) idx#58 +(byte) idx#59 +(byte) idx#6 +(byte) idx#60 +(byte) idx#61 +(byte) idx#62 +(byte) idx#63 +(byte) idx#64 +(byte) idx#65 +(byte) idx#66 +(byte) idx#67 +(byte) idx#68 +(byte) idx#69 +(byte) idx#7 +(byte) idx#70 +(byte) idx#71 +(byte) idx#72 +(byte) idx#73 +(byte) idx#74 +(byte) idx#75 +(byte) idx#76 +(byte) idx#77 +(byte) idx#78 +(byte) idx#79 +(byte) idx#8 +(byte) idx#80 +(byte) idx#81 +(byte) idx#82 +(byte) idx#83 +(byte) idx#84 +(byte) idx#85 +(byte) idx#9 +(void()) main() +(number~) main::$0 +(byte~) main::$1 +(byte~) main::$10 +(number~) main::$100 +(byte~) main::$101 +(number~) main::$103 +(number~) main::$104 +(byte~) main::$105 +(number~) main::$107 +(number~) main::$108 +(byte~) main::$109 +(number~) main::$111 +(number~) main::$112 +(byte~) main::$113 +(number~) main::$115 +(number~) main::$116 +(byte~) main::$117 +(number~) main::$12 +(byte~) main::$13 +(number~) main::$15 +(byte~) main::$16 +(number~) main::$18 +(byte~) main::$19 +(number~) main::$21 +(byte~) main::$22 +(number~) main::$24 +(byte~) main::$25 +(number~) main::$27 +(byte~) main::$28 +(number~) main::$3 +(number~) main::$30 +(byte~) main::$31 +(number~) main::$33 +(byte~) main::$34 +(number~) main::$36 +(byte~) main::$37 +(number~) main::$39 +(byte~) main::$4 +(byte~) main::$40 +(number~) main::$42 +(byte~) main::$43 +(number~) main::$45 +(byte~) main::$46 +(number~) main::$48 +(byte~) main::$49 +(number~) main::$51 +(byte~) main::$52 +(number~) main::$54 +(byte~) main::$55 +(number~) main::$57 +(byte~) main::$58 +(number~) main::$6 +(number~) main::$60 +(byte~) main::$61 +(number~) main::$63 +(number~) main::$64 +(byte~) main::$65 +(number~) main::$67 +(number~) main::$68 +(byte~) main::$69 +(byte~) main::$7 +(number~) main::$71 +(number~) main::$72 +(byte~) main::$73 +(number~) main::$75 +(number~) main::$76 +(byte~) main::$77 +(number~) main::$79 +(number~) main::$80 +(byte~) main::$81 +(number~) main::$83 +(number~) main::$84 +(byte~) main::$85 +(number~) main::$87 +(number~) main::$88 +(byte~) main::$89 +(number~) main::$9 +(number~) main::$91 +(number~) main::$92 +(byte~) main::$93 +(number~) main::$95 +(number~) main::$96 +(byte~) main::$97 +(number~) main::$99 +(label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@12 +(label) main::@13 +(label) main::@14 +(label) main::@15 +(label) main::@16 +(label) main::@17 +(label) main::@18 +(label) main::@19 +(label) main::@2 +(label) main::@20 +(label) main::@21 +(label) main::@22 +(label) main::@23 +(label) main::@24 +(label) main::@25 +(label) main::@26 +(label) main::@27 +(label) main::@28 +(label) main::@29 +(label) main::@3 +(label) main::@30 +(label) main::@31 +(label) main::@32 +(label) main::@33 +(label) main::@34 +(label) main::@35 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@7 +(label) main::@8 +(label) main::@9 +(label) main::@return + +Adding number conversion cast (signed byte) $c in (number~) main::$0 ← (signed byte) $c + (number) $c +Adding number conversion cast (signed word) $c in (number~) main::$3 ← (signed byte) $c + (number) $82 +Adding number conversion cast (signed word) $82 in (number~) main::$3 ← (signed word)(signed byte) $c + (number) $82 +Adding number conversion cast (signed dword) $c in (number~) main::$6 ← (signed byte) $c + (number) $80e8 +Adding number conversion cast (signed dword) $80e8 in (number~) main::$6 ← (signed dword)(signed byte) $c + (number) $80e8 +Adding number conversion cast (signed word) $c in (number~) main::$9 ← (signed word) $c + (number) $c +Adding number conversion cast (signed word) $82 in (number~) main::$12 ← (signed word) $c + (number) $82 +Adding number conversion cast (signed dword) $c in (number~) main::$15 ← (signed word) $c + (number) $186a0 +Adding number conversion cast (signed dword) $186a0 in (number~) main::$15 ← (signed dword)(signed word) $c + (number) $186a0 +Adding number conversion cast (signed dword) $c in (number~) main::$18 ← (signed dword) $c + (number) $c +Adding number conversion cast (signed dword) $82 in (number~) main::$21 ← (signed dword) $c + (number) $82 +Adding number conversion cast (signed dword) $186a0 in (number~) main::$24 ← (signed dword) $c + (number) $186a0 +Adding number conversion cast (byte) $c in (number~) main::$27 ← (byte) $c + (number) $c +Adding number conversion cast (byte) $fa in (number~) main::$30 ← (byte) $c + (number) $fa +Adding number conversion cast (word) $c in (number~) main::$33 ← (byte) $c + (number) $12c +Adding number conversion cast (word) $12c in (number~) main::$33 ← (word)(byte) $c + (number) $12c +Adding number conversion cast (word) $c in (number~) main::$36 ← (byte) $c + (number) $fffe +Adding number conversion cast (word) $fffe in (number~) main::$36 ← (word)(byte) $c + (number) $fffe +Adding number conversion cast (dword) $c in (number~) main::$39 ← (byte) $c + (number) $101d0 +Adding number conversion cast (dword) $101d0 in (number~) main::$39 ← (dword)(byte) $c + (number) $101d0 +Adding number conversion cast (word) $c in (number~) main::$42 ← (word) $c + (number) $c +Adding number conversion cast (word) $82 in (number~) main::$45 ← (word) $c + (number) $82 +Adding number conversion cast (dword) $c in (number~) main::$48 ← (word) $c + (number) $101d0 +Adding number conversion cast (dword) $101d0 in (number~) main::$48 ← (dword)(word) $c + (number) $101d0 +Adding number conversion cast (dword) $c in (number~) main::$51 ← (dword) $c + (number) $c +Adding number conversion cast (dword) $82 in (number~) main::$54 ← (dword) $c + (number) $82 +Adding number conversion cast (dword) $101d0 in (number~) main::$57 ← (dword) $c + (number) $101d0 +Adding number conversion cast (dword) $c in (number~) main::$60 ← (byte) $c + (number) $b2d05e00 +Adding number conversion cast (dword) $b2d05e00 in (number~) main::$60 ← (dword)(byte) $c + (number) $b2d05e00 +Inferred type updated to signed byte in (number~) main::$0 ← (signed byte) $c + (signed byte)(number) $c +Inferred type updated to signed word in (number~) main::$3 ← (signed word)(signed byte) $c + (signed word)(number) $82 +Inferred type updated to signed dword in (number~) main::$6 ← (signed dword)(signed byte) $c + (signed dword)(number) $80e8 +Inferred type updated to signed word in (number~) main::$9 ← (signed word) $c + (signed word)(number) $c +Inferred type updated to signed word in (number~) main::$12 ← (signed word) $c + (signed word)(number) $82 +Inferred type updated to signed dword in (number~) main::$15 ← (signed dword)(signed word) $c + (signed dword)(number) $186a0 +Inferred type updated to signed dword in (number~) main::$18 ← (signed dword) $c + (signed dword)(number) $c +Inferred type updated to signed dword in (number~) main::$21 ← (signed dword) $c + (signed dword)(number) $82 +Inferred type updated to signed dword in (number~) main::$24 ← (signed dword) $c + (signed dword)(number) $186a0 +Inferred type updated to byte in (number~) main::$27 ← (byte) $c + (byte)(number) $c +Inferred type updated to byte in (number~) main::$30 ← (byte) $c + (byte)(number) $fa +Inferred type updated to word in (number~) main::$33 ← (word)(byte) $c + (word)(number) $12c +Inferred type updated to word in (number~) main::$36 ← (word)(byte) $c + (word)(number) $fffe +Inferred type updated to dword in (number~) main::$39 ← (dword)(byte) $c + (dword)(number) $101d0 +Inferred type updated to word in (number~) main::$42 ← (word) $c + (word)(number) $c +Inferred type updated to word in (number~) main::$45 ← (word) $c + (word)(number) $82 +Inferred type updated to dword in (number~) main::$48 ← (dword)(word) $c + (dword)(number) $101d0 +Inferred type updated to dword in (number~) main::$51 ← (dword) $c + (dword)(number) $c +Inferred type updated to dword in (number~) main::$54 ← (dword) $c + (dword)(number) $82 +Inferred type updated to dword in (number~) main::$57 ← (dword) $c + (dword)(number) $101d0 +Inferred type updated to dword in (number~) main::$60 ← (dword)(byte) $c + (dword)(number) $b2d05e00 +Resolving typeid() (byte~) main::$1 ← typeid (signed byte~) main::$0 +Resolving typeid() (byte~) main::$4 ← typeid (signed word~) main::$3 +Resolving typeid() (byte~) main::$7 ← typeid (signed dword~) main::$6 +Resolving typeid() (byte~) main::$10 ← typeid (signed word~) main::$9 +Resolving typeid() (byte~) main::$13 ← typeid (signed word~) main::$12 +Resolving typeid() (byte~) main::$16 ← typeid (signed dword~) main::$15 +Resolving typeid() (byte~) main::$19 ← typeid (signed dword~) main::$18 +Resolving typeid() (byte~) main::$22 ← typeid (signed dword~) main::$21 +Resolving typeid() (byte~) main::$25 ← typeid (signed dword~) main::$24 +Resolving typeid() (byte~) main::$28 ← typeid (byte~) main::$27 +Resolving typeid() (byte~) main::$31 ← typeid (byte~) main::$30 +Resolving typeid() (byte~) main::$34 ← typeid (word~) main::$33 +Resolving typeid() (byte~) main::$37 ← typeid (word~) main::$36 +Resolving typeid() (byte~) main::$40 ← typeid (dword~) main::$39 +Resolving typeid() (byte~) main::$43 ← typeid (word~) main::$42 +Resolving typeid() (byte~) main::$46 ← typeid (word~) main::$45 +Resolving typeid() (byte~) main::$49 ← typeid (dword~) main::$48 +Resolving typeid() (byte~) main::$52 ← typeid (dword~) main::$51 +Resolving typeid() (byte~) main::$55 ← typeid (dword~) main::$54 +Resolving typeid() (byte~) main::$58 ← typeid (dword~) main::$57 +Resolving typeid() (byte~) main::$61 ← typeid (dword~) main::$60 +Successful SSA optimization PassNTypeIdSimplification +Alias (byte) assertType::t1#0 = (byte~) main::$1 +Alias (byte) idx#1 = (byte) idx#43 +Alias (byte) assertType::t1#1 = (byte~) main::$4 +Alias (byte) idx#2 = (byte) idx#44 +Alias (byte) assertType::t1#2 = (byte~) main::$7 +Alias (byte) idx#3 = (byte) idx#45 +Alias (byte) assertType::t1#3 = (byte~) main::$10 +Alias (byte) idx#4 = (byte) idx#46 +Alias (byte) assertType::t1#4 = (byte~) main::$13 +Alias (byte) idx#47 = (byte) idx#5 +Alias (byte) assertType::t1#5 = (byte~) main::$16 +Alias (byte) idx#48 = (byte) idx#6 +Alias (byte) assertType::t1#6 = (byte~) main::$19 +Alias (byte) idx#49 = (byte) idx#7 +Alias (byte) assertType::t1#7 = (byte~) main::$22 +Alias (byte) idx#50 = (byte) idx#8 +Alias (byte) assertType::t1#8 = (byte~) main::$25 +Alias (byte) idx#51 = (byte) idx#9 +Alias (byte) assertType::t1#9 = (byte~) main::$28 +Alias (byte) idx#11 = (byte) idx#52 +Alias (byte) assertType::t1#10 = (byte~) main::$31 +Alias (byte) idx#12 = (byte) idx#53 +Alias (byte) assertType::t1#11 = (byte~) main::$34 +Alias (byte) idx#13 = (byte) idx#54 +Alias (byte) assertType::t1#12 = (byte~) main::$37 +Alias (byte) idx#14 = (byte) idx#55 +Alias (byte) assertType::t1#13 = (byte~) main::$40 +Alias (byte) idx#15 = (byte) idx#56 +Alias (byte) assertType::t1#14 = (byte~) main::$43 +Alias (byte) idx#16 = (byte) idx#57 +Alias (byte) assertType::t1#15 = (byte~) main::$46 +Alias (byte) idx#17 = (byte) idx#58 +Alias (byte) assertType::t1#16 = (byte~) main::$49 +Alias (byte) idx#18 = (byte) idx#59 +Alias (byte) assertType::t1#17 = (byte~) main::$52 +Alias (byte) idx#19 = (byte) idx#60 +Alias (byte) assertType::t1#18 = (byte~) main::$55 +Alias (byte) idx#20 = (byte) idx#61 +Alias (byte) assertType::t1#19 = (byte~) main::$58 +Alias (byte) idx#21 = (byte) idx#62 +Alias (byte) assertType::t1#20 = (byte~) main::$61 +Alias (byte) idx#22 = (byte) idx#63 +Alias (byte) assertType::t1#21 = (byte~) main::$65 +Alias (byte) idx#24 = (byte) idx#64 +Alias (byte) assertType::t1#22 = (byte~) main::$69 +Alias (byte) idx#25 = (byte) idx#65 +Alias (byte) assertType::t1#23 = (byte~) main::$73 +Alias (byte) idx#26 = (byte) idx#66 +Alias (byte) assertType::t1#24 = (byte~) main::$77 +Alias (byte) idx#27 = (byte) idx#67 +Alias (byte) assertType::t1#25 = (byte~) main::$81 +Alias (byte) idx#28 = (byte) idx#68 +Alias (byte) assertType::t1#26 = (byte~) main::$85 +Alias (byte) idx#29 = (byte) idx#69 +Alias (byte) assertType::t1#27 = (byte~) main::$89 +Alias (byte) idx#30 = (byte) idx#70 +Alias (byte) assertType::t1#28 = (byte~) main::$93 +Alias (byte) idx#31 = (byte) idx#71 +Alias (byte) assertType::t1#29 = (byte~) main::$97 +Alias (byte) idx#32 = (byte) idx#72 +Alias (byte) assertType::t1#30 = (byte~) main::$101 +Alias (byte) idx#33 = (byte) idx#73 +Alias (byte) assertType::t1#31 = (byte~) main::$105 +Alias (byte) idx#34 = (byte) idx#74 +Alias (byte) assertType::t1#32 = (byte~) main::$109 +Alias (byte) idx#35 = (byte) idx#75 +Alias (byte) assertType::t1#33 = (byte~) main::$113 +Alias (byte) idx#36 = (byte) idx#76 +Alias (byte) assertType::t1#34 = (byte~) main::$117 +Alias (byte) idx#37 = (byte) idx#77 (byte) idx#78 (byte) idx#38 +Alias (byte) idx#79 = (byte) idx#84 (byte) idx#80 +Alias (byte) assertType::t1#35 = (byte) assertType::t1#37 (byte) assertType::t1#38 +Alias (byte) idx#40 = (byte) idx#82 (byte) idx#41 +Alias (byte) idx#39 = (byte) idx#85 +Alias (byte) idx#42 = (byte) idx#83 +Successful SSA optimization Pass2AliasElimination +Alias (byte) assertType::t1#35 = (byte) assertType::t1#36 +Alias (byte) idx#79 = (byte) idx#81 +Successful SSA optimization Pass2AliasElimination +Redundant Phi (byte) idx#1 (byte) idx#40 +Redundant Phi (byte) idx#2 (byte) idx#40 +Redundant Phi (byte) idx#3 (byte) idx#40 +Redundant Phi (byte) idx#4 (byte) idx#40 +Redundant Phi (byte) idx#47 (byte) idx#40 +Redundant Phi (byte) idx#48 (byte) idx#40 +Redundant Phi (byte) idx#49 (byte) idx#40 +Redundant Phi (byte) idx#50 (byte) idx#40 +Redundant Phi (byte) idx#51 (byte) idx#40 +Redundant Phi (byte) idx#11 (byte) idx#40 +Redundant Phi (byte) idx#12 (byte) idx#40 +Redundant Phi (byte) idx#13 (byte) idx#40 +Redundant Phi (byte) idx#14 (byte) idx#40 +Redundant Phi (byte) idx#15 (byte) idx#40 +Redundant Phi (byte) idx#16 (byte) idx#40 +Redundant Phi (byte) idx#17 (byte) idx#40 +Redundant Phi (byte) idx#18 (byte) idx#40 +Redundant Phi (byte) idx#19 (byte) idx#40 +Redundant Phi (byte) idx#20 (byte) idx#40 +Redundant Phi (byte) idx#21 (byte) idx#40 +Redundant Phi (byte) idx#22 (byte) idx#40 +Redundant Phi (byte) idx#24 (byte) idx#40 +Redundant Phi (byte) idx#25 (byte) idx#40 +Redundant Phi (byte) idx#26 (byte) idx#40 +Redundant Phi (byte) idx#27 (byte) idx#40 +Redundant Phi (byte) idx#28 (byte) idx#40 +Redundant Phi (byte) idx#29 (byte) idx#40 +Redundant Phi (byte) idx#30 (byte) idx#40 +Redundant Phi (byte) idx#31 (byte) idx#40 +Redundant Phi (byte) idx#32 (byte) idx#40 +Redundant Phi (byte) idx#33 (byte) idx#40 +Redundant Phi (byte) idx#34 (byte) idx#40 +Redundant Phi (byte) idx#35 (byte) idx#40 +Redundant Phi (byte) idx#36 (byte) idx#40 +Redundant Phi (byte) idx#37 (byte) idx#40 +Redundant Phi (byte) idx#42 (byte) idx#37 +Successful SSA optimization Pass2RedundantPhiElimination +Simple Condition (bool~) assertType::$0 [274] if((byte) assertType::t1#35==(byte) assertType::t2#35) goto assertType::@1 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant right-side identified [1] (signed byte~) main::$0 ← (signed byte) $c + (signed byte)(number) $c +Constant right-side identified [8] (signed word~) main::$3 ← (signed word)(signed byte) $c + (signed word)(number) $82 +Constant right-side identified [15] (signed dword~) main::$6 ← (signed dword)(signed byte) $c + (signed dword)(number) $80e8 +Constant right-side identified [22] (signed word~) main::$9 ← (signed word) $c + (signed word)(number) $c +Constant right-side identified [29] (signed word~) main::$12 ← (signed word) $c + (signed word)(number) $82 +Constant right-side identified [36] (signed dword~) main::$15 ← (signed dword)(signed word) $c + (signed dword)(number) $186a0 +Constant right-side identified [43] (signed dword~) main::$18 ← (signed dword) $c + (signed dword)(number) $c +Constant right-side identified [50] (signed dword~) main::$21 ← (signed dword) $c + (signed dword)(number) $82 +Constant right-side identified [57] (signed dword~) main::$24 ← (signed dword) $c + (signed dword)(number) $186a0 +Constant right-side identified [65] (byte~) main::$27 ← (byte) $c + (byte)(number) $c +Constant right-side identified [72] (byte~) main::$30 ← (byte) $c + (byte)(number) $fa +Constant right-side identified [79] (word~) main::$33 ← (word)(byte) $c + (word)(number) $12c +Constant right-side identified [86] (word~) main::$36 ← (word)(byte) $c + (word)(number) $fffe +Constant right-side identified [93] (dword~) main::$39 ← (dword)(byte) $c + (dword)(number) $101d0 +Constant right-side identified [100] (word~) main::$42 ← (word) $c + (word)(number) $c +Constant right-side identified [107] (word~) main::$45 ← (word) $c + (word)(number) $82 +Constant right-side identified [114] (dword~) main::$48 ← (dword)(word) $c + (dword)(number) $101d0 +Constant right-side identified [121] (dword~) main::$51 ← (dword) $c + (dword)(number) $c +Constant right-side identified [128] (dword~) main::$54 ← (dword) $c + (dword)(number) $82 +Constant right-side identified [135] (dword~) main::$57 ← (dword) $c + (dword)(number) $101d0 +Constant right-side identified [142] (dword~) main::$60 ← (dword)(byte) $c + (dword)(number) $b2d05e00 +Constant right-side identified [150] (number~) main::$63 ← - (number) $c +Constant right-side identified [158] (number~) main::$67 ← - (number) $78 +Constant right-side identified [166] (number~) main::$71 ← - (number) $fa +Constant right-side identified [174] (number~) main::$75 ← - (number) $104 +Constant right-side identified [182] (number~) main::$79 ← - (number) $fde8 +Constant right-side identified [190] (number~) main::$83 ← - (number) $101d0 +Constant right-side identified [198] (number~) main::$87 ← - (number) $c +Constant right-side identified [206] (number~) main::$91 ← - (number) $82 +Constant right-side identified [214] (number~) main::$95 ← - (number) $fde8 +Constant right-side identified [222] (number~) main::$99 ← - (number) $101d0 +Constant right-side identified [230] (number~) main::$103 ← - (number) $c +Constant right-side identified [238] (number~) main::$107 ← - (number) $82 +Constant right-side identified [246] (number~) main::$111 ← - (number) $101d0 +Constant right-side identified [254] (number~) main::$115 ← - (number) $7d2b7500 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) idx#0 = 0 +Constant (const signed byte) main::$0 = $c+(signed byte)$c +Constant (const byte) assertType::t1#0 = TYPEID_SIGNED_BYTE +Constant (const byte) assertType::t2#0 = TYPEID_SIGNED_BYTE +Constant (const signed word) main::$3 = (signed word)$c+(signed word)$82 +Constant (const byte) assertType::t1#1 = TYPEID_SIGNED_WORD +Constant (const byte) assertType::t2#1 = TYPEID_SIGNED_WORD +Constant (const signed dword) main::$6 = (signed dword)$c+(signed dword)$80e8 +Constant (const byte) assertType::t1#2 = TYPEID_SIGNED_DWORD +Constant (const byte) assertType::t2#2 = TYPEID_SIGNED_DWORD +Constant (const signed word) main::$9 = $c+(signed word)$c +Constant (const byte) assertType::t1#3 = TYPEID_SIGNED_WORD +Constant (const byte) assertType::t2#3 = TYPEID_SIGNED_WORD +Constant (const signed word) main::$12 = $c+(signed word)$82 +Constant (const byte) assertType::t1#4 = TYPEID_SIGNED_WORD +Constant (const byte) assertType::t2#4 = TYPEID_SIGNED_WORD +Constant (const signed dword) main::$15 = (signed dword)$c+(signed dword)$186a0 +Constant (const byte) assertType::t1#5 = TYPEID_SIGNED_DWORD +Constant (const byte) assertType::t2#5 = TYPEID_SIGNED_DWORD +Constant (const signed dword) main::$18 = $c+(signed dword)$c +Constant (const byte) assertType::t1#6 = TYPEID_SIGNED_DWORD +Constant (const byte) assertType::t2#6 = TYPEID_SIGNED_DWORD +Constant (const signed dword) main::$21 = $c+(signed dword)$82 +Constant (const byte) assertType::t1#7 = TYPEID_SIGNED_DWORD +Constant (const byte) assertType::t2#7 = TYPEID_SIGNED_DWORD +Constant (const signed dword) main::$24 = $c+(signed dword)$186a0 +Constant (const byte) assertType::t1#8 = TYPEID_SIGNED_DWORD +Constant (const byte) assertType::t2#8 = TYPEID_SIGNED_DWORD +Constant (const byte) idx#10 = $28 +Constant (const byte) main::$27 = $c+(byte)$c +Constant (const byte) assertType::t1#9 = TYPEID_BYTE +Constant (const byte) assertType::t2#9 = TYPEID_BYTE +Constant (const byte) main::$30 = $c+(byte)$fa +Constant (const byte) assertType::t1#10 = TYPEID_BYTE +Constant (const byte) assertType::t2#10 = TYPEID_BYTE +Constant (const word) main::$33 = (word)$c+(word)$12c +Constant (const byte) assertType::t1#11 = TYPEID_WORD +Constant (const byte) assertType::t2#11 = TYPEID_WORD +Constant (const word) main::$36 = (word)$c+(word)$fffe +Constant (const byte) assertType::t1#12 = TYPEID_WORD +Constant (const byte) assertType::t2#12 = TYPEID_WORD +Constant (const dword) main::$39 = (dword)$c+(dword)$101d0 +Constant (const byte) assertType::t1#13 = TYPEID_DWORD +Constant (const byte) assertType::t2#13 = TYPEID_DWORD +Constant (const word) main::$42 = $c+(word)$c +Constant (const byte) assertType::t1#14 = TYPEID_WORD +Constant (const byte) assertType::t2#14 = TYPEID_WORD +Constant (const word) main::$45 = $c+(word)$82 +Constant (const byte) assertType::t1#15 = TYPEID_WORD +Constant (const byte) assertType::t2#15 = TYPEID_WORD +Constant (const dword) main::$48 = (dword)$c+(dword)$101d0 +Constant (const byte) assertType::t1#16 = TYPEID_DWORD +Constant (const byte) assertType::t2#16 = TYPEID_DWORD +Constant (const dword) main::$51 = $c+(dword)$c +Constant (const byte) assertType::t1#17 = TYPEID_DWORD +Constant (const byte) assertType::t2#17 = TYPEID_DWORD +Constant (const dword) main::$54 = $c+(dword)$82 +Constant (const byte) assertType::t1#18 = TYPEID_DWORD +Constant (const byte) assertType::t2#18 = TYPEID_DWORD +Constant (const dword) main::$57 = $c+(dword)$101d0 +Constant (const byte) assertType::t1#19 = TYPEID_DWORD +Constant (const byte) assertType::t2#19 = TYPEID_DWORD +Constant (const dword) main::$60 = (dword)$c+(dword)$b2d05e00 +Constant (const byte) assertType::t1#20 = TYPEID_DWORD +Constant (const byte) assertType::t2#20 = TYPEID_DWORD +Constant (const byte) idx#23 = $50 +Constant (const number) main::$63 = -$c +Constant (const byte) assertType::t2#21 = TYPEID_BYTE +Constant (const number) main::$67 = -$78 +Constant (const byte) assertType::t2#22 = TYPEID_BYTE +Constant (const number) main::$71 = -$fa +Constant (const byte) assertType::t2#23 = TYPEID_BYTE +Constant (const number) main::$75 = -$104 +Constant (const byte) assertType::t2#24 = TYPEID_WORD +Constant (const number) main::$79 = -$fde8 +Constant (const byte) assertType::t2#25 = TYPEID_WORD +Constant (const number) main::$83 = -$101d0 +Constant (const byte) assertType::t2#26 = TYPEID_DWORD +Constant (const number) main::$87 = -$c +Constant (const byte) assertType::t2#27 = TYPEID_WORD +Constant (const number) main::$91 = -$82 +Constant (const byte) assertType::t2#28 = TYPEID_WORD +Constant (const number) main::$95 = -$fde8 +Constant (const byte) assertType::t2#29 = TYPEID_WORD +Constant (const number) main::$99 = -$101d0 +Constant (const byte) assertType::t2#30 = TYPEID_DWORD +Constant (const number) main::$103 = -$c +Constant (const byte) assertType::t2#31 = TYPEID_DWORD +Constant (const number) main::$107 = -$82 +Constant (const byte) assertType::t2#32 = TYPEID_DWORD +Constant (const number) main::$111 = -$101d0 +Constant (const byte) assertType::t2#33 = TYPEID_DWORD +Constant (const number) main::$115 = -$7d2b7500 +Constant (const byte) assertType::t2#34 = TYPEID_DWORD +Constant (const byte) RED#0 = 2 +Constant (const byte) GREEN#0 = 5 +Constant (const word) $0 = $400 +Constant (const word) $1 = $d800 +Constant (const byte) idx#39 = 0 +Successful SSA optimization Pass2ConstantIdentification +Eliminating unused constant (const signed byte) main::$0 +Eliminating unused constant (const signed word) main::$3 +Eliminating unused constant (const signed dword) main::$6 +Eliminating unused constant (const signed word) main::$9 +Eliminating unused constant (const signed word) main::$12 +Eliminating unused constant (const signed dword) main::$15 +Eliminating unused constant (const signed dword) main::$18 +Eliminating unused constant (const signed dword) main::$21 +Eliminating unused constant (const signed dword) main::$24 +Eliminating unused constant (const byte) main::$27 +Eliminating unused constant (const byte) main::$30 +Eliminating unused constant (const word) main::$33 +Eliminating unused constant (const word) main::$36 +Eliminating unused constant (const dword) main::$39 +Eliminating unused constant (const word) main::$42 +Eliminating unused constant (const word) main::$45 +Eliminating unused constant (const dword) main::$48 +Eliminating unused constant (const dword) main::$51 +Eliminating unused constant (const dword) main::$54 +Eliminating unused constant (const dword) main::$57 +Eliminating unused constant (const dword) main::$60 +Eliminating unused constant (const byte) idx#39 +Successful SSA optimization PassNEliminateUnusedVars +Eliminating Noop Cast (byte*) SCREEN#0 ← ((byte*)) (const word) $0 +Eliminating Noop Cast (byte*) COLS#0 ← ((byte*)) (const word) $1 +Successful SSA optimization Pass2NopCastElimination +Adding number conversion cast (byte) main::$63 in (number~) main::$64 ← (byte) $c + (const number) main::$63 +Adding number conversion cast (byte) main::$67 in (number~) main::$68 ← (byte) $c + (const number) main::$67 +Adding number conversion cast (byte) main::$71 in (number~) main::$72 ← (byte) $c + (const number) main::$71 +Adding number conversion cast (word) $c in (number~) main::$76 ← (byte) $c + (const number) main::$75 +Adding number conversion cast (word) main::$75 in (number~) main::$76 ← (word)(byte) $c + (const number) main::$75 +Adding number conversion cast (word) $c in (number~) main::$80 ← (byte) $c + (const number) main::$79 +Adding number conversion cast (word) main::$79 in (number~) main::$80 ← (word)(byte) $c + (const number) main::$79 +Adding number conversion cast (dword) $c in (number~) main::$84 ← (byte) $c + (const number) main::$83 +Adding number conversion cast (dword) main::$83 in (number~) main::$84 ← (dword)(byte) $c + (const number) main::$83 +Adding number conversion cast (word) main::$87 in (number~) main::$88 ← (word) $c + (const number) main::$87 +Adding number conversion cast (word) main::$91 in (number~) main::$92 ← (word) $c + (const number) main::$91 +Adding number conversion cast (word) main::$95 in (number~) main::$96 ← (word) $c + (const number) main::$95 +Adding number conversion cast (dword) $c in (number~) main::$100 ← (word) $c + (const number) main::$99 +Adding number conversion cast (dword) main::$99 in (number~) main::$100 ← (dword)(word) $c + (const number) main::$99 +Adding number conversion cast (dword) main::$103 in (number~) main::$104 ← (dword) $c + (const number) main::$103 +Adding number conversion cast (dword) main::$107 in (number~) main::$108 ← (dword) $c + (const number) main::$107 +Adding number conversion cast (dword) main::$111 in (number~) main::$112 ← (dword) $c + (const number) main::$111 +Adding number conversion cast (signed dword) $c in (number~) main::$116 ← (signed byte) $c + (const number) main::$115 +Adding number conversion cast (signed dword) main::$115 in (number~) main::$116 ← (signed dword)(signed byte) $c + (const number) main::$115 +Inferred type updated to byte in (number~) main::$64 ← (byte) $c + (byte)(const number) main::$63 +Inferred type updated to byte in (number~) main::$68 ← (byte) $c + (byte)(const number) main::$67 +Inferred type updated to byte in (number~) main::$72 ← (byte) $c + (byte)(const number) main::$71 +Inferred type updated to word in (number~) main::$76 ← (word)(byte) $c + (word)(const number) main::$75 +Inferred type updated to word in (number~) main::$80 ← (word)(byte) $c + (word)(const number) main::$79 +Inferred type updated to dword in (number~) main::$84 ← (dword)(byte) $c + (dword)(const number) main::$83 +Inferred type updated to word in (number~) main::$88 ← (word) $c + (word)(const number) main::$87 +Inferred type updated to word in (number~) main::$92 ← (word) $c + (word)(const number) main::$91 +Inferred type updated to word in (number~) main::$96 ← (word) $c + (word)(const number) main::$95 +Inferred type updated to dword in (number~) main::$100 ← (dword)(word) $c + (dword)(const number) main::$99 +Inferred type updated to dword in (number~) main::$104 ← (dword) $c + (dword)(const number) main::$103 +Inferred type updated to dword in (number~) main::$108 ← (dword) $c + (dword)(const number) main::$107 +Inferred type updated to dword in (number~) main::$112 ← (dword) $c + (dword)(const number) main::$111 +Inferred type updated to signed dword in (number~) main::$116 ← (signed dword)(signed byte) $c + (signed dword)(const number) main::$115 +Resolving typeid() (byte) assertType::t1#21 ← typeid (byte~) main::$64 +Resolving typeid() (byte) assertType::t1#22 ← typeid (byte~) main::$68 +Resolving typeid() (byte) assertType::t1#23 ← typeid (byte~) main::$72 +Resolving typeid() (byte) assertType::t1#24 ← typeid (word~) main::$76 +Resolving typeid() (byte) assertType::t1#25 ← typeid (word~) main::$80 +Resolving typeid() (byte) assertType::t1#26 ← typeid (dword~) main::$84 +Resolving typeid() (byte) assertType::t1#27 ← typeid (word~) main::$88 +Resolving typeid() (byte) assertType::t1#28 ← typeid (word~) main::$92 +Resolving typeid() (byte) assertType::t1#29 ← typeid (word~) main::$96 +Resolving typeid() (byte) assertType::t1#30 ← typeid (dword~) main::$100 +Resolving typeid() (byte) assertType::t1#31 ← typeid (dword~) main::$104 +Resolving typeid() (byte) assertType::t1#32 ← typeid (dword~) main::$108 +Resolving typeid() (byte) assertType::t1#33 ← typeid (dword~) main::$112 +Resolving typeid() (byte) assertType::t1#34 ← typeid (signed dword~) main::$116 +Successful SSA optimization PassNTypeIdSimplification +Culled Empty Block (label) main::@35 +Culled Empty Block (label) @1 +Culled Empty Block (label) @3 +Successful SSA optimization Pass2CullEmptyBlocks +Constant right-side identified [21] (byte~) main::$64 ← (byte) $c + (byte)(const number) main::$63 +Constant right-side identified [24] (byte~) main::$68 ← (byte) $c + (byte)(const number) main::$67 +Constant right-side identified [27] (byte~) main::$72 ← (byte) $c + (byte)(const number) main::$71 +Constant right-side identified [30] (word~) main::$76 ← (word)(byte) $c + (word)(const number) main::$75 +Constant right-side identified [33] (word~) main::$80 ← (word)(byte) $c + (word)(const number) main::$79 +Constant right-side identified [36] (dword~) main::$84 ← (dword)(byte) $c + (dword)(const number) main::$83 +Constant right-side identified [39] (word~) main::$88 ← (word) $c + (word)(const number) main::$87 +Constant right-side identified [42] (word~) main::$92 ← (word) $c + (word)(const number) main::$91 +Constant right-side identified [45] (word~) main::$96 ← (word) $c + (word)(const number) main::$95 +Constant right-side identified [48] (dword~) main::$100 ← (dword)(word) $c + (dword)(const number) main::$99 +Constant right-side identified [51] (dword~) main::$104 ← (dword) $c + (dword)(const number) main::$103 +Constant right-side identified [54] (dword~) main::$108 ← (dword) $c + (dword)(const number) main::$107 +Constant right-side identified [57] (dword~) main::$112 ← (dword) $c + (dword)(const number) main::$111 +Constant right-side identified [60] (signed dword~) main::$116 ← (signed dword)(signed byte) $c + (signed dword)(const number) main::$115 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) main::$64 = $c+(byte)main::$63 +Constant (const byte) assertType::t1#21 = TYPEID_BYTE +Constant (const byte) main::$68 = $c+(byte)main::$67 +Constant (const byte) assertType::t1#22 = TYPEID_BYTE +Constant (const byte) main::$72 = $c+(byte)main::$71 +Constant (const byte) assertType::t1#23 = TYPEID_BYTE +Constant (const word) main::$76 = (word)$c+(word)main::$75 +Constant (const byte) assertType::t1#24 = TYPEID_WORD +Constant (const word) main::$80 = (word)$c+(word)main::$79 +Constant (const byte) assertType::t1#25 = TYPEID_WORD +Constant (const dword) main::$84 = (dword)$c+(dword)main::$83 +Constant (const byte) assertType::t1#26 = TYPEID_DWORD +Constant (const word) main::$88 = $c+(word)main::$87 +Constant (const byte) assertType::t1#27 = TYPEID_WORD +Constant (const word) main::$92 = $c+(word)main::$91 +Constant (const byte) assertType::t1#28 = TYPEID_WORD +Constant (const word) main::$96 = $c+(word)main::$95 +Constant (const byte) assertType::t1#29 = TYPEID_WORD +Constant (const dword) main::$100 = (dword)$c+(dword)main::$99 +Constant (const byte) assertType::t1#30 = TYPEID_DWORD +Constant (const dword) main::$104 = $c+(dword)main::$103 +Constant (const byte) assertType::t1#31 = TYPEID_DWORD +Constant (const dword) main::$108 = $c+(dword)main::$107 +Constant (const byte) assertType::t1#32 = TYPEID_DWORD +Constant (const dword) main::$112 = $c+(dword)main::$111 +Constant (const byte) assertType::t1#33 = TYPEID_DWORD +Constant (const signed dword) main::$116 = (signed dword)$c+(signed dword)main::$115 +Constant (const byte) assertType::t1#34 = TYPEID_SIGNED_DWORD +Successful SSA optimization Pass2ConstantIdentification +Eliminating unused constant (const byte) main::$64 +Eliminating unused constant (const byte) main::$68 +Eliminating unused constant (const byte) main::$72 +Eliminating unused constant (const word) main::$76 +Eliminating unused constant (const word) main::$80 +Eliminating unused constant (const dword) main::$84 +Eliminating unused constant (const word) main::$88 +Eliminating unused constant (const word) main::$92 +Eliminating unused constant (const word) main::$96 +Eliminating unused constant (const dword) main::$100 +Eliminating unused constant (const dword) main::$104 +Eliminating unused constant (const dword) main::$108 +Eliminating unused constant (const dword) main::$112 +Eliminating unused constant (const signed dword) main::$116 +Successful SSA optimization PassNEliminateUnusedVars +Eliminating unused constant (const number) main::$63 +Eliminating unused constant (const number) main::$67 +Eliminating unused constant (const number) main::$71 +Eliminating unused constant (const number) main::$75 +Eliminating unused constant (const number) main::$79 +Eliminating unused constant (const number) main::$83 +Eliminating unused constant (const number) main::$87 +Eliminating unused constant (const number) main::$91 +Eliminating unused constant (const number) main::$95 +Eliminating unused constant (const number) main::$99 +Eliminating unused constant (const number) main::$103 +Eliminating unused constant (const number) main::$107 +Eliminating unused constant (const number) main::$111 +Eliminating unused constant (const number) main::$115 +Successful SSA optimization PassNEliminateUnusedVars +Inlining constant with var siblings (const byte) assertType::t1#0 +Inlining constant with var siblings (const byte) assertType::t2#0 +Inlining constant with var siblings (const byte) assertType::t1#1 +Inlining constant with var siblings (const byte) assertType::t2#1 +Inlining constant with var siblings (const byte) assertType::t1#2 +Inlining constant with var siblings (const byte) assertType::t2#2 +Inlining constant with var siblings (const byte) assertType::t1#3 +Inlining constant with var siblings (const byte) assertType::t2#3 +Inlining constant with var siblings (const byte) assertType::t1#4 +Inlining constant with var siblings (const byte) assertType::t2#4 +Inlining constant with var siblings (const byte) assertType::t1#5 +Inlining constant with var siblings (const byte) assertType::t2#5 +Inlining constant with var siblings (const byte) assertType::t1#6 +Inlining constant with var siblings (const byte) assertType::t2#6 +Inlining constant with var siblings (const byte) assertType::t1#7 +Inlining constant with var siblings (const byte) assertType::t2#7 +Inlining constant with var siblings (const byte) assertType::t1#8 +Inlining constant with var siblings (const byte) assertType::t2#8 +Inlining constant with var siblings (const byte) assertType::t1#9 +Inlining constant with var siblings (const byte) assertType::t2#9 +Inlining constant with var siblings (const byte) assertType::t1#10 +Inlining constant with var siblings (const byte) assertType::t2#10 +Inlining constant with var siblings (const byte) assertType::t1#11 +Inlining constant with var siblings (const byte) assertType::t2#11 +Inlining constant with var siblings (const byte) assertType::t1#12 +Inlining constant with var siblings (const byte) assertType::t2#12 +Inlining constant with var siblings (const byte) assertType::t1#13 +Inlining constant with var siblings (const byte) assertType::t2#13 +Inlining constant with var siblings (const byte) assertType::t1#14 +Inlining constant with var siblings (const byte) assertType::t2#14 +Inlining constant with var siblings (const byte) assertType::t1#15 +Inlining constant with var siblings (const byte) assertType::t2#15 +Inlining constant with var siblings (const byte) assertType::t1#16 +Inlining constant with var siblings (const byte) assertType::t2#16 +Inlining constant with var siblings (const byte) assertType::t1#17 +Inlining constant with var siblings (const byte) assertType::t2#17 +Inlining constant with var siblings (const byte) assertType::t1#18 +Inlining constant with var siblings (const byte) assertType::t2#18 +Inlining constant with var siblings (const byte) assertType::t1#19 +Inlining constant with var siblings (const byte) assertType::t2#19 +Inlining constant with var siblings (const byte) assertType::t1#20 +Inlining constant with var siblings (const byte) assertType::t2#20 +Inlining constant with var siblings (const byte) assertType::t2#21 +Inlining constant with var siblings (const byte) assertType::t2#22 +Inlining constant with var siblings (const byte) assertType::t2#23 +Inlining constant with var siblings (const byte) assertType::t2#24 +Inlining constant with var siblings (const byte) assertType::t2#25 +Inlining constant with var siblings (const byte) assertType::t2#26 +Inlining constant with var siblings (const byte) assertType::t2#27 +Inlining constant with var siblings (const byte) assertType::t2#28 +Inlining constant with var siblings (const byte) assertType::t2#29 +Inlining constant with var siblings (const byte) assertType::t2#30 +Inlining constant with var siblings (const byte) assertType::t2#31 +Inlining constant with var siblings (const byte) assertType::t2#32 +Inlining constant with var siblings (const byte) assertType::t2#33 +Inlining constant with var siblings (const byte) assertType::t2#34 +Inlining constant with var siblings (const byte) assertType::t1#21 +Inlining constant with var siblings (const byte) assertType::t1#22 +Inlining constant with var siblings (const byte) assertType::t1#23 +Inlining constant with var siblings (const byte) assertType::t1#24 +Inlining constant with var siblings (const byte) assertType::t1#25 +Inlining constant with var siblings (const byte) assertType::t1#26 +Inlining constant with var siblings (const byte) assertType::t1#27 +Inlining constant with var siblings (const byte) assertType::t1#28 +Inlining constant with var siblings (const byte) assertType::t1#29 +Inlining constant with var siblings (const byte) assertType::t1#30 +Inlining constant with var siblings (const byte) assertType::t1#31 +Inlining constant with var siblings (const byte) assertType::t1#32 +Inlining constant with var siblings (const byte) assertType::t1#33 +Inlining constant with var siblings (const byte) assertType::t1#34 +Inlining constant with var siblings (const byte) idx#0 +Inlining constant with var siblings (const byte) idx#10 +Inlining constant with var siblings (const byte) idx#23 +Constant inlined assertType::t2#5 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t2#6 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t2#7 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t2#8 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t2#9 = (const byte) TYPEID_BYTE +Constant inlined $0 = (word) $400 +Constant inlined $1 = (word) $d800 +Constant inlined assertType::t2#31 = (const byte) TYPEID_DWORD +Constant inlined assertType::t2#30 = (const byte) TYPEID_DWORD +Constant inlined assertType::t2#33 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#21 = (const byte) TYPEID_BYTE +Constant inlined assertType::t1#20 = (const byte) TYPEID_DWORD +Constant inlined assertType::t2#32 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#23 = (const byte) TYPEID_BYTE +Constant inlined assertType::t2#34 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#22 = (const byte) TYPEID_BYTE +Constant inlined assertType::t1#25 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#24 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#27 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#0 = (const byte) TYPEID_SIGNED_BYTE +Constant inlined assertType::t1#26 = (const byte) TYPEID_DWORD +Constant inlined assertType::t2#1 = (const byte) TYPEID_SIGNED_WORD +Constant inlined assertType::t1#29 = (const byte) TYPEID_WORD +Constant inlined idx#0 = (byte) 0 +Constant inlined assertType::t2#2 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t1#28 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#3 = (const byte) TYPEID_SIGNED_WORD +Constant inlined assertType::t2#4 = (const byte) TYPEID_SIGNED_WORD +Constant inlined idx#23 = (byte) $50 +Constant inlined assertType::t2#20 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#10 = (const byte) TYPEID_BYTE +Constant inlined assertType::t2#22 = (const byte) TYPEID_BYTE +Constant inlined assertType::t2#21 = (const byte) TYPEID_BYTE +Constant inlined assertType::t1#12 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#24 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#11 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#23 = (const byte) TYPEID_BYTE +Constant inlined assertType::t1#14 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#26 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#13 = (const byte) TYPEID_DWORD +Constant inlined assertType::t2#25 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#16 = (const byte) TYPEID_DWORD +Constant inlined assertType::t2#28 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#15 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#27 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#18 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#17 = (const byte) TYPEID_DWORD +Constant inlined assertType::t2#29 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#19 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#6 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined idx#10 = (byte) $28 +Constant inlined assertType::t1#7 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t1#8 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t1#9 = (const byte) TYPEID_BYTE +Constant inlined assertType::t2#11 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#10 = (const byte) TYPEID_BYTE +Constant inlined assertType::t2#13 = (const byte) TYPEID_DWORD +Constant inlined assertType::t2#12 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#15 = (const byte) TYPEID_WORD +Constant inlined assertType::t2#14 = (const byte) TYPEID_WORD +Constant inlined assertType::t1#0 = (const byte) TYPEID_SIGNED_BYTE +Constant inlined assertType::t2#17 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#1 = (const byte) TYPEID_SIGNED_WORD +Constant inlined assertType::t2#16 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#2 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t2#19 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#3 = (const byte) TYPEID_SIGNED_WORD +Constant inlined assertType::t2#18 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#4 = (const byte) TYPEID_SIGNED_WORD +Constant inlined assertType::t1#5 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t1#30 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#32 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#31 = (const byte) TYPEID_DWORD +Constant inlined assertType::t1#34 = (const byte) TYPEID_SIGNED_DWORD +Constant inlined assertType::t1#33 = (const byte) TYPEID_DWORD +Successful SSA optimization Pass2ConstantInlining +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @2 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@9 +Adding NOP phi() at start of main::@21 +CALL GRAPH +Calls in [] to main:2 +Calls in [main] to assertType:5 assertType:7 assertType:9 assertType:11 assertType:13 assertType:15 assertType:17 assertType:19 assertType:21 assertType:23 assertType:25 assertType:27 assertType:29 assertType:31 assertType:33 assertType:35 assertType:37 assertType:39 assertType:41 assertType:43 assertType:45 assertType:47 assertType:49 assertType:51 assertType:53 assertType:55 assertType:57 assertType:59 assertType:61 assertType:63 assertType:65 assertType:67 assertType:69 assertType:71 assertType:73 + +Created 3 initial phi equivalence classes +Coalesced [6] idx#86 ← idx#40 +Coalesced (already) [8] idx#97 ← idx#40 +Coalesced (already) [10] idx#107 ← idx#40 +Coalesced (already) [12] idx#113 ← idx#40 +Coalesced (already) [14] idx#114 ← idx#40 +Coalesced (already) [16] idx#115 ← idx#40 +Coalesced (already) [18] idx#116 ← idx#40 +Coalesced (already) [20] idx#117 ← idx#40 +Coalesced (already) [24] idx#87 ← idx#40 +Coalesced (already) [26] idx#88 ← idx#40 +Coalesced (already) [28] idx#89 ← idx#40 +Coalesced (already) [30] idx#90 ← idx#40 +Coalesced (already) [32] idx#91 ← idx#40 +Coalesced (already) [34] idx#92 ← idx#40 +Coalesced (already) [36] idx#93 ← idx#40 +Coalesced (already) [38] idx#94 ← idx#40 +Coalesced (already) [40] idx#95 ← idx#40 +Coalesced (already) [42] idx#96 ← idx#40 +Coalesced (already) [44] idx#98 ← idx#40 +Coalesced (already) [48] idx#99 ← idx#40 +Coalesced (already) [50] idx#100 ← idx#40 +Coalesced (already) [52] idx#101 ← idx#40 +Coalesced (already) [54] idx#102 ← idx#40 +Coalesced (already) [56] idx#103 ← idx#40 +Coalesced (already) [58] idx#104 ← idx#40 +Coalesced (already) [60] idx#105 ← idx#40 +Coalesced (already) [62] idx#106 ← idx#40 +Coalesced (already) [64] idx#108 ← idx#40 +Coalesced (already) [66] idx#109 ← idx#40 +Coalesced (already) [68] idx#110 ← idx#40 +Coalesced (already) [70] idx#111 ← idx#40 +Coalesced (already) [72] idx#112 ← idx#40 +Coalesced down to 3 phi equivalence classes +Renumbering block @2 to @1 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of main::@4 +Adding NOP phi() at start of main::@5 +Adding NOP phi() at start of main::@6 +Adding NOP phi() at start of main::@7 +Adding NOP phi() at start of main::@8 +Adding NOP phi() at start of main::@9 +Adding NOP phi() at start of main::@10 +Adding NOP phi() at start of main::@11 +Adding NOP phi() at start of main::@12 +Adding NOP phi() at start of main::@13 +Adding NOP phi() at start of main::@14 +Adding NOP phi() at start of main::@15 +Adding NOP phi() at start of main::@16 +Adding NOP phi() at start of main::@17 +Adding NOP phi() at start of main::@18 +Adding NOP phi() at start of main::@19 +Adding NOP phi() at start of main::@20 +Adding NOP phi() at start of main::@21 +Adding NOP phi() at start of main::@22 +Adding NOP phi() at start of main::@23 +Adding NOP phi() at start of main::@24 +Adding NOP phi() at start of main::@25 +Adding NOP phi() at start of main::@26 +Adding NOP phi() at start of main::@27 +Adding NOP phi() at start of main::@28 +Adding NOP phi() at start of main::@29 +Adding NOP phi() at start of main::@30 +Adding NOP phi() at start of main::@31 +Adding NOP phi() at start of main::@32 +Adding NOP phi() at start of main::@33 +Adding NOP phi() at start of main::@34 + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + [5] call assertType + to:main::@1 +main::@1: scope:[main] from main + [6] phi() + [7] call assertType + to:main::@2 +main::@2: scope:[main] from main::@1 + [8] phi() + [9] call assertType + to:main::@3 +main::@3: scope:[main] from main::@2 + [10] phi() + [11] call assertType + to:main::@4 +main::@4: scope:[main] from main::@3 + [12] phi() + [13] call assertType + to:main::@5 +main::@5: scope:[main] from main::@4 + [14] phi() + [15] call assertType + to:main::@6 +main::@6: scope:[main] from main::@5 + [16] phi() + [17] call assertType + to:main::@7 +main::@7: scope:[main] from main::@6 + [18] phi() + [19] call assertType + to:main::@8 +main::@8: scope:[main] from main::@7 + [20] phi() + [21] call assertType + to:main::@9 +main::@9: scope:[main] from main::@8 + [22] phi() + [23] call assertType + to:main::@10 +main::@10: scope:[main] from main::@9 + [24] phi() + [25] call assertType + to:main::@11 +main::@11: scope:[main] from main::@10 + [26] phi() + [27] call assertType + to:main::@12 +main::@12: scope:[main] from main::@11 + [28] phi() + [29] call assertType + to:main::@13 +main::@13: scope:[main] from main::@12 + [30] phi() + [31] call assertType + to:main::@14 +main::@14: scope:[main] from main::@13 + [32] phi() + [33] call assertType + to:main::@15 +main::@15: scope:[main] from main::@14 + [34] phi() + [35] call assertType + to:main::@16 +main::@16: scope:[main] from main::@15 + [36] phi() + [37] call assertType + to:main::@17 +main::@17: scope:[main] from main::@16 + [38] phi() + [39] call assertType + to:main::@18 +main::@18: scope:[main] from main::@17 + [40] phi() + [41] call assertType + to:main::@19 +main::@19: scope:[main] from main::@18 + [42] phi() + [43] call assertType + to:main::@20 +main::@20: scope:[main] from main::@19 + [44] phi() + [45] call assertType + to:main::@21 +main::@21: scope:[main] from main::@20 + [46] phi() + [47] call assertType + to:main::@22 +main::@22: scope:[main] from main::@21 + [48] phi() + [49] call assertType + to:main::@23 +main::@23: scope:[main] from main::@22 + [50] phi() + [51] call assertType + to:main::@24 +main::@24: scope:[main] from main::@23 + [52] phi() + [53] call assertType + to:main::@25 +main::@25: scope:[main] from main::@24 + [54] phi() + [55] call assertType + to:main::@26 +main::@26: scope:[main] from main::@25 + [56] phi() + [57] call assertType + to:main::@27 +main::@27: scope:[main] from main::@26 + [58] phi() + [59] call assertType + to:main::@28 +main::@28: scope:[main] from main::@27 + [60] phi() + [61] call assertType + to:main::@29 +main::@29: scope:[main] from main::@28 + [62] phi() + [63] call assertType + to:main::@30 +main::@30: scope:[main] from main::@29 + [64] phi() + [65] call assertType + to:main::@31 +main::@31: scope:[main] from main::@30 + [66] phi() + [67] call assertType + to:main::@32 +main::@32: scope:[main] from main::@31 + [68] phi() + [69] call assertType + to:main::@33 +main::@33: scope:[main] from main::@32 + [70] phi() + [71] call assertType + to:main::@34 +main::@34: scope:[main] from main::@33 + [72] phi() + [73] call assertType + to:main::@return +main::@return: scope:[main] from main::@34 + [74] return + to:@return +assertType: scope:[assertType] from main main::@1 main::@10 main::@11 main::@12 main::@13 main::@14 main::@15 main::@16 main::@17 main::@18 main::@19 main::@2 main::@20 main::@21 main::@22 main::@23 main::@24 main::@25 main::@26 main::@27 main::@28 main::@29 main::@3 main::@30 main::@31 main::@32 main::@33 main::@34 main::@4 main::@5 main::@6 main::@7 main::@8 main::@9 + [75] (byte) idx#79 ← phi( main/(byte) 0 main::@1/(byte) idx#40 main::@10/(byte) idx#40 main::@11/(byte) idx#40 main::@12/(byte) idx#40 main::@13/(byte) idx#40 main::@14/(byte) idx#40 main::@15/(byte) idx#40 main::@16/(byte) idx#40 main::@17/(byte) idx#40 main::@18/(byte) idx#40 main::@19/(byte) idx#40 main::@2/(byte) idx#40 main::@20/(byte) idx#40 main::@21/(byte) $50 main::@22/(byte) idx#40 main::@23/(byte) idx#40 main::@24/(byte) idx#40 main::@25/(byte) idx#40 main::@26/(byte) idx#40 main::@27/(byte) idx#40 main::@28/(byte) idx#40 main::@29/(byte) idx#40 main::@3/(byte) idx#40 main::@30/(byte) idx#40 main::@31/(byte) idx#40 main::@32/(byte) idx#40 main::@33/(byte) idx#40 main::@34/(byte) idx#40 main::@4/(byte) idx#40 main::@5/(byte) idx#40 main::@6/(byte) idx#40 main::@7/(byte) idx#40 main::@8/(byte) idx#40 main::@9/(byte) $28 ) + [75] (byte) assertType::t2#35 ← phi( main/(const byte) TYPEID_SIGNED_BYTE main::@1/(const byte) TYPEID_SIGNED_WORD main::@10/(const byte) TYPEID_BYTE main::@11/(const byte) TYPEID_WORD main::@12/(const byte) TYPEID_WORD main::@13/(const byte) TYPEID_DWORD main::@14/(const byte) TYPEID_WORD main::@15/(const byte) TYPEID_WORD main::@16/(const byte) TYPEID_DWORD main::@17/(const byte) TYPEID_DWORD main::@18/(const byte) TYPEID_DWORD main::@19/(const byte) TYPEID_DWORD main::@2/(const byte) TYPEID_SIGNED_DWORD main::@20/(const byte) TYPEID_DWORD main::@21/(const byte) TYPEID_BYTE main::@22/(const byte) TYPEID_BYTE main::@23/(const byte) TYPEID_BYTE main::@24/(const byte) TYPEID_WORD main::@25/(const byte) TYPEID_WORD main::@26/(const byte) TYPEID_DWORD main::@27/(const byte) TYPEID_WORD main::@28/(const byte) TYPEID_WORD main::@29/(const byte) TYPEID_WORD main::@3/(const byte) TYPEID_SIGNED_WORD main::@30/(const byte) TYPEID_DWORD main::@31/(const byte) TYPEID_DWORD main::@32/(const byte) TYPEID_DWORD main::@33/(const byte) TYPEID_DWORD main::@34/(const byte) TYPEID_DWORD main::@4/(const byte) TYPEID_SIGNED_WORD main::@5/(const byte) TYPEID_SIGNED_DWORD main::@6/(const byte) TYPEID_SIGNED_DWORD main::@7/(const byte) TYPEID_SIGNED_DWORD main::@8/(const byte) TYPEID_SIGNED_DWORD main::@9/(const byte) TYPEID_BYTE ) + [75] (byte) assertType::t1#35 ← phi( main/(const byte) TYPEID_SIGNED_BYTE main::@1/(const byte) TYPEID_SIGNED_WORD main::@10/(const byte) TYPEID_BYTE main::@11/(const byte) TYPEID_WORD main::@12/(const byte) TYPEID_WORD main::@13/(const byte) TYPEID_DWORD main::@14/(const byte) TYPEID_WORD main::@15/(const byte) TYPEID_WORD main::@16/(const byte) TYPEID_DWORD main::@17/(const byte) TYPEID_DWORD main::@18/(const byte) TYPEID_DWORD main::@19/(const byte) TYPEID_DWORD main::@2/(const byte) TYPEID_SIGNED_DWORD main::@20/(const byte) TYPEID_DWORD main::@21/(const byte) TYPEID_BYTE main::@22/(const byte) TYPEID_BYTE main::@23/(const byte) TYPEID_BYTE main::@24/(const byte) TYPEID_WORD main::@25/(const byte) TYPEID_WORD main::@26/(const byte) TYPEID_DWORD main::@27/(const byte) TYPEID_WORD main::@28/(const byte) TYPEID_WORD main::@29/(const byte) TYPEID_WORD main::@3/(const byte) TYPEID_SIGNED_WORD main::@30/(const byte) TYPEID_DWORD main::@31/(const byte) TYPEID_DWORD main::@32/(const byte) TYPEID_DWORD main::@33/(const byte) TYPEID_DWORD main::@34/(const byte) TYPEID_SIGNED_DWORD main::@4/(const byte) TYPEID_SIGNED_WORD main::@5/(const byte) TYPEID_SIGNED_DWORD main::@6/(const byte) TYPEID_SIGNED_DWORD main::@7/(const byte) TYPEID_SIGNED_DWORD main::@8/(const byte) TYPEID_SIGNED_DWORD main::@9/(const byte) TYPEID_BYTE ) + [76] if((byte) assertType::t1#35==(byte) assertType::t2#35) goto assertType::@1 + to:assertType::@3 +assertType::@3: scope:[assertType] from assertType + [77] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) RED#0 + to:assertType::@2 +assertType::@2: scope:[assertType] from assertType::@1 assertType::@3 + [78] *((byte*)(word) $400 + (byte) idx#79) ← (byte) assertType::t1#35 + [79] (byte) idx#40 ← ++ (byte) idx#79 + to:assertType::@return +assertType::@return: scope:[assertType] from assertType::@2 + [80] return + to:@return +assertType::@1: scope:[assertType] from assertType + [81] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) GREEN#0 + to:assertType::@2 + + +VARIABLE REGISTER WEIGHTS +(byte*) COLS +(byte) GREEN +(byte) RED +(byte*) SCREEN +(void()) assertType((byte) assertType::t1 , (byte) assertType::t2) +(byte) assertType::t1 +(byte) assertType::t1#35 1.0 +(byte) assertType::t2 +(byte) assertType::t2#35 2.0 +(byte) idx +(byte) idx#40 0.9999999999999993 +(byte) idx#79 14.400000000000007 +(void()) main() + +Initial phi equivalence classes +[ assertType::t1#35 ] +[ assertType::t2#35 ] +[ idx#79 idx#40 ] +Complete equivalence classes +[ assertType::t1#35 ] +[ assertType::t2#35 ] +[ idx#79 idx#40 ] +Allocated zp ZP_BYTE:2 [ assertType::t1#35 ] +Allocated zp ZP_BYTE:3 [ assertType::t2#35 ] +Allocated zp ZP_BYTE:4 [ idx#79 idx#40 ] + +INITIAL ASM +//SEG0 File Comments +// Tests conversion of numbers to correct int types +// See https://gitlab.com/camelot/kickc/issues/181 +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_SIGNED_DWORD = 6 + .const TYPEID_BYTE = 1 + .const TYPEID_WORD = 3 + .const TYPEID_DWORD = 5 + .const RED = 2 + .const GREEN = 5 + .label idx = 4 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + //SEG11 [5] call assertType + //SEG12 [75] phi from main to assertType [phi:main->assertType] + assertType_from_main: + //SEG13 [75] phi (byte) idx#79 = (byte) 0 [phi:main->assertType#0] -- vbuz1=vbuc1 + lda #0 + sta idx + //SEG14 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_BYTE [phi:main->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG15 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_BYTE [phi:main->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t1 + jsr assertType + //SEG16 [6] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + jmp b1 + //SEG17 main::@1 + b1: + //SEG18 [7] call assertType + //SEG19 [75] phi from main::@1 to assertType [phi:main::@1->assertType] + assertType_from_b1: + //SEG20 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@1->assertType#0] -- register_copy + //SEG21 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG22 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@1->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG23 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + b2_from_b1: + jmp b2 + //SEG24 main::@2 + b2: + //SEG25 [9] call assertType + //SEG26 [75] phi from main::@2 to assertType [phi:main::@2->assertType] + assertType_from_b2: + //SEG27 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@2->assertType#0] -- register_copy + //SEG28 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG29 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@2->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG30 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + b3_from_b2: + jmp b3 + //SEG31 main::@3 + b3: + //SEG32 [11] call assertType + //SEG33 [75] phi from main::@3 to assertType [phi:main::@3->assertType] + assertType_from_b3: + //SEG34 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@3->assertType#0] -- register_copy + //SEG35 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG36 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@3->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG37 [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + b4_from_b3: + jmp b4 + //SEG38 main::@4 + b4: + //SEG39 [13] call assertType + //SEG40 [75] phi from main::@4 to assertType [phi:main::@4->assertType] + assertType_from_b4: + //SEG41 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@4->assertType#0] -- register_copy + //SEG42 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG43 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@4->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t1 + jsr assertType + //SEG44 [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5] + b5_from_b4: + jmp b5 + //SEG45 main::@5 + b5: + //SEG46 [15] call assertType + //SEG47 [75] phi from main::@5 to assertType [phi:main::@5->assertType] + assertType_from_b5: + //SEG48 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@5->assertType#0] -- register_copy + //SEG49 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG50 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@5->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG51 [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6] + b6_from_b5: + jmp b6 + //SEG52 main::@6 + b6: + //SEG53 [17] call assertType + //SEG54 [75] phi from main::@6 to assertType [phi:main::@6->assertType] + assertType_from_b6: + //SEG55 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@6->assertType#0] -- register_copy + //SEG56 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@6->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG57 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@6->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG58 [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7] + b7_from_b6: + jmp b7 + //SEG59 main::@7 + b7: + //SEG60 [19] call assertType + //SEG61 [75] phi from main::@7 to assertType [phi:main::@7->assertType] + assertType_from_b7: + //SEG62 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@7->assertType#0] -- register_copy + //SEG63 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@7->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG64 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@7->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG65 [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8] + b8_from_b7: + jmp b8 + //SEG66 main::@8 + b8: + //SEG67 [21] call assertType + //SEG68 [75] phi from main::@8 to assertType [phi:main::@8->assertType] + assertType_from_b8: + //SEG69 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@8->assertType#0] -- register_copy + //SEG70 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@8->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG71 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@8->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + //SEG72 [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9] + b9_from_b8: + jmp b9 + //SEG73 main::@9 + b9: + //SEG74 [23] call assertType + //SEG75 [75] phi from main::@9 to assertType [phi:main::@9->assertType] + assertType_from_b9: + //SEG76 [75] phi (byte) idx#79 = (byte) $28 [phi:main::@9->assertType#0] -- vbuz1=vbuc1 + lda #$28 + sta idx + //SEG77 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@9->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG78 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@9->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG79 [24] phi from main::@9 to main::@10 [phi:main::@9->main::@10] + b10_from_b9: + jmp b10 + //SEG80 main::@10 + b10: + //SEG81 [25] call assertType + //SEG82 [75] phi from main::@10 to assertType [phi:main::@10->assertType] + assertType_from_b10: + //SEG83 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@10->assertType#0] -- register_copy + //SEG84 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@10->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG85 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@10->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG86 [26] phi from main::@10 to main::@11 [phi:main::@10->main::@11] + b11_from_b10: + jmp b11 + //SEG87 main::@11 + b11: + //SEG88 [27] call assertType + //SEG89 [75] phi from main::@11 to assertType [phi:main::@11->assertType] + assertType_from_b11: + //SEG90 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@11->assertType#0] -- register_copy + //SEG91 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@11->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG92 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@11->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG93 [28] phi from main::@11 to main::@12 [phi:main::@11->main::@12] + b12_from_b11: + jmp b12 + //SEG94 main::@12 + b12: + //SEG95 [29] call assertType + //SEG96 [75] phi from main::@12 to assertType [phi:main::@12->assertType] + assertType_from_b12: + //SEG97 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@12->assertType#0] -- register_copy + //SEG98 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@12->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG99 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@12->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG100 [30] phi from main::@12 to main::@13 [phi:main::@12->main::@13] + b13_from_b12: + jmp b13 + //SEG101 main::@13 + b13: + //SEG102 [31] call assertType + //SEG103 [75] phi from main::@13 to assertType [phi:main::@13->assertType] + assertType_from_b13: + //SEG104 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@13->assertType#0] -- register_copy + //SEG105 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@13->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG106 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@13->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG107 [32] phi from main::@13 to main::@14 [phi:main::@13->main::@14] + b14_from_b13: + jmp b14 + //SEG108 main::@14 + b14: + //SEG109 [33] call assertType + //SEG110 [75] phi from main::@14 to assertType [phi:main::@14->assertType] + assertType_from_b14: + //SEG111 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@14->assertType#0] -- register_copy + //SEG112 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@14->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG113 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@14->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG114 [34] phi from main::@14 to main::@15 [phi:main::@14->main::@15] + b15_from_b14: + jmp b15 + //SEG115 main::@15 + b15: + //SEG116 [35] call assertType + //SEG117 [75] phi from main::@15 to assertType [phi:main::@15->assertType] + assertType_from_b15: + //SEG118 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@15->assertType#0] -- register_copy + //SEG119 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@15->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG120 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@15->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG121 [36] phi from main::@15 to main::@16 [phi:main::@15->main::@16] + b16_from_b15: + jmp b16 + //SEG122 main::@16 + b16: + //SEG123 [37] call assertType + //SEG124 [75] phi from main::@16 to assertType [phi:main::@16->assertType] + assertType_from_b16: + //SEG125 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@16->assertType#0] -- register_copy + //SEG126 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@16->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG127 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@16->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG128 [38] phi from main::@16 to main::@17 [phi:main::@16->main::@17] + b17_from_b16: + jmp b17 + //SEG129 main::@17 + b17: + //SEG130 [39] call assertType + //SEG131 [75] phi from main::@17 to assertType [phi:main::@17->assertType] + assertType_from_b17: + //SEG132 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@17->assertType#0] -- register_copy + //SEG133 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@17->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG134 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@17->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG135 [40] phi from main::@17 to main::@18 [phi:main::@17->main::@18] + b18_from_b17: + jmp b18 + //SEG136 main::@18 + b18: + //SEG137 [41] call assertType + //SEG138 [75] phi from main::@18 to assertType [phi:main::@18->assertType] + assertType_from_b18: + //SEG139 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@18->assertType#0] -- register_copy + //SEG140 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@18->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG141 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@18->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG142 [42] phi from main::@18 to main::@19 [phi:main::@18->main::@19] + b19_from_b18: + jmp b19 + //SEG143 main::@19 + b19: + //SEG144 [43] call assertType + //SEG145 [75] phi from main::@19 to assertType [phi:main::@19->assertType] + assertType_from_b19: + //SEG146 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@19->assertType#0] -- register_copy + //SEG147 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@19->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG148 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@19->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG149 [44] phi from main::@19 to main::@20 [phi:main::@19->main::@20] + b20_from_b19: + jmp b20 + //SEG150 main::@20 + b20: + //SEG151 [45] call assertType + //SEG152 [75] phi from main::@20 to assertType [phi:main::@20->assertType] + assertType_from_b20: + //SEG153 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@20->assertType#0] -- register_copy + //SEG154 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@20->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG155 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@20->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG156 [46] phi from main::@20 to main::@21 [phi:main::@20->main::@21] + b21_from_b20: + jmp b21 + //SEG157 main::@21 + b21: + //SEG158 [47] call assertType + //SEG159 [75] phi from main::@21 to assertType [phi:main::@21->assertType] + assertType_from_b21: + //SEG160 [75] phi (byte) idx#79 = (byte) $50 [phi:main::@21->assertType#0] -- vbuz1=vbuc1 + lda #$50 + sta idx + //SEG161 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@21->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG162 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@21->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG163 [48] phi from main::@21 to main::@22 [phi:main::@21->main::@22] + b22_from_b21: + jmp b22 + //SEG164 main::@22 + b22: + //SEG165 [49] call assertType + //SEG166 [75] phi from main::@22 to assertType [phi:main::@22->assertType] + assertType_from_b22: + //SEG167 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@22->assertType#0] -- register_copy + //SEG168 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@22->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG169 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@22->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG170 [50] phi from main::@22 to main::@23 [phi:main::@22->main::@23] + b23_from_b22: + jmp b23 + //SEG171 main::@23 + b23: + //SEG172 [51] call assertType + //SEG173 [75] phi from main::@23 to assertType [phi:main::@23->assertType] + assertType_from_b23: + //SEG174 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@23->assertType#0] -- register_copy + //SEG175 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@23->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG176 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@23->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t1 + jsr assertType + //SEG177 [52] phi from main::@23 to main::@24 [phi:main::@23->main::@24] + b24_from_b23: + jmp b24 + //SEG178 main::@24 + b24: + //SEG179 [53] call assertType + //SEG180 [75] phi from main::@24 to assertType [phi:main::@24->assertType] + assertType_from_b24: + //SEG181 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@24->assertType#0] -- register_copy + //SEG182 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@24->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG183 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@24->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG184 [54] phi from main::@24 to main::@25 [phi:main::@24->main::@25] + b25_from_b24: + jmp b25 + //SEG185 main::@25 + b25: + //SEG186 [55] call assertType + //SEG187 [75] phi from main::@25 to assertType [phi:main::@25->assertType] + assertType_from_b25: + //SEG188 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@25->assertType#0] -- register_copy + //SEG189 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@25->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG190 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@25->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG191 [56] phi from main::@25 to main::@26 [phi:main::@25->main::@26] + b26_from_b25: + jmp b26 + //SEG192 main::@26 + b26: + //SEG193 [57] call assertType + //SEG194 [75] phi from main::@26 to assertType [phi:main::@26->assertType] + assertType_from_b26: + //SEG195 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@26->assertType#0] -- register_copy + //SEG196 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@26->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG197 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@26->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG198 [58] phi from main::@26 to main::@27 [phi:main::@26->main::@27] + b27_from_b26: + jmp b27 + //SEG199 main::@27 + b27: + //SEG200 [59] call assertType + //SEG201 [75] phi from main::@27 to assertType [phi:main::@27->assertType] + assertType_from_b27: + //SEG202 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@27->assertType#0] -- register_copy + //SEG203 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@27->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG204 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@27->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG205 [60] phi from main::@27 to main::@28 [phi:main::@27->main::@28] + b28_from_b27: + jmp b28 + //SEG206 main::@28 + b28: + //SEG207 [61] call assertType + //SEG208 [75] phi from main::@28 to assertType [phi:main::@28->assertType] + assertType_from_b28: + //SEG209 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@28->assertType#0] -- register_copy + //SEG210 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@28->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG211 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@28->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG212 [62] phi from main::@28 to main::@29 [phi:main::@28->main::@29] + b29_from_b28: + jmp b29 + //SEG213 main::@29 + b29: + //SEG214 [63] call assertType + //SEG215 [75] phi from main::@29 to assertType [phi:main::@29->assertType] + assertType_from_b29: + //SEG216 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@29->assertType#0] -- register_copy + //SEG217 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@29->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG218 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@29->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t1 + jsr assertType + //SEG219 [64] phi from main::@29 to main::@30 [phi:main::@29->main::@30] + b30_from_b29: + jmp b30 + //SEG220 main::@30 + b30: + //SEG221 [65] call assertType + //SEG222 [75] phi from main::@30 to assertType [phi:main::@30->assertType] + assertType_from_b30: + //SEG223 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@30->assertType#0] -- register_copy + //SEG224 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@30->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG225 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@30->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG226 [66] phi from main::@30 to main::@31 [phi:main::@30->main::@31] + b31_from_b30: + jmp b31 + //SEG227 main::@31 + b31: + //SEG228 [67] call assertType + //SEG229 [75] phi from main::@31 to assertType [phi:main::@31->assertType] + assertType_from_b31: + //SEG230 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@31->assertType#0] -- register_copy + //SEG231 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@31->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG232 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@31->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG233 [68] phi from main::@31 to main::@32 [phi:main::@31->main::@32] + b32_from_b31: + jmp b32 + //SEG234 main::@32 + b32: + //SEG235 [69] call assertType + //SEG236 [75] phi from main::@32 to assertType [phi:main::@32->assertType] + assertType_from_b32: + //SEG237 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@32->assertType#0] -- register_copy + //SEG238 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@32->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG239 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@32->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG240 [70] phi from main::@32 to main::@33 [phi:main::@32->main::@33] + b33_from_b32: + jmp b33 + //SEG241 main::@33 + b33: + //SEG242 [71] call assertType + //SEG243 [75] phi from main::@33 to assertType [phi:main::@33->assertType] + assertType_from_b33: + //SEG244 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@33->assertType#0] -- register_copy + //SEG245 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@33->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG246 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@33->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t1 + jsr assertType + //SEG247 [72] phi from main::@33 to main::@34 [phi:main::@33->main::@34] + b34_from_b33: + jmp b34 + //SEG248 main::@34 + b34: + //SEG249 [73] call assertType + //SEG250 [75] phi from main::@34 to assertType [phi:main::@34->assertType] + assertType_from_b34: + //SEG251 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@34->assertType#0] -- register_copy + //SEG252 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@34->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG253 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@34->assertType#2] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t1 + jsr assertType + jmp breturn + //SEG254 main::@return + breturn: + //SEG255 [74] return + rts +} +//SEG256 assertType +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte zeropage(2) t1, byte zeropage(3) t2) +assertType: { + .label t1 = 2 + .label t2 = 3 + //SEG257 [76] if((byte) assertType::t1#35==(byte) assertType::t2#35) goto assertType::@1 -- vbuz1_eq_vbuz2_then_la1 + lda t1 + cmp t2 + beq b1 + jmp b3 + //SEG258 assertType::@3 + b3: + //SEG259 [77] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) RED#0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #RED + ldy idx + sta $d800,y + jmp b2 + //SEG260 assertType::@2 + b2: + //SEG261 [78] *((byte*)(word) $400 + (byte) idx#79) ← (byte) assertType::t1#35 -- pbuc1_derefidx_vbuz1=vbuz2 + lda t1 + ldy idx + sta $400,y + //SEG262 [79] (byte) idx#40 ← ++ (byte) idx#79 -- vbuz1=_inc_vbuz1 + inc idx + jmp breturn + //SEG263 assertType::@return + breturn: + //SEG264 [80] return + rts + //SEG265 assertType::@1 + b1: + //SEG266 [81] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #GREEN + ldy idx + sta $d800,y + jmp b2 +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [77] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) RED#0 [ assertType::t1#35 idx#79 ] ( main:2::assertType:5 [ assertType::t1#35 idx#79 ] main:2::assertType:7 [ assertType::t1#35 idx#79 ] main:2::assertType:9 [ assertType::t1#35 idx#79 ] main:2::assertType:11 [ assertType::t1#35 idx#79 ] main:2::assertType:13 [ assertType::t1#35 idx#79 ] main:2::assertType:15 [ assertType::t1#35 idx#79 ] main:2::assertType:17 [ assertType::t1#35 idx#79 ] main:2::assertType:19 [ assertType::t1#35 idx#79 ] main:2::assertType:21 [ assertType::t1#35 idx#79 ] main:2::assertType:23 [ assertType::t1#35 idx#79 ] main:2::assertType:25 [ assertType::t1#35 idx#79 ] main:2::assertType:27 [ assertType::t1#35 idx#79 ] main:2::assertType:29 [ assertType::t1#35 idx#79 ] main:2::assertType:31 [ assertType::t1#35 idx#79 ] main:2::assertType:33 [ assertType::t1#35 idx#79 ] main:2::assertType:35 [ assertType::t1#35 idx#79 ] main:2::assertType:37 [ assertType::t1#35 idx#79 ] main:2::assertType:39 [ assertType::t1#35 idx#79 ] main:2::assertType:41 [ assertType::t1#35 idx#79 ] main:2::assertType:43 [ assertType::t1#35 idx#79 ] main:2::assertType:45 [ assertType::t1#35 idx#79 ] main:2::assertType:47 [ assertType::t1#35 idx#79 ] main:2::assertType:49 [ assertType::t1#35 idx#79 ] main:2::assertType:51 [ assertType::t1#35 idx#79 ] main:2::assertType:53 [ assertType::t1#35 idx#79 ] main:2::assertType:55 [ assertType::t1#35 idx#79 ] main:2::assertType:57 [ assertType::t1#35 idx#79 ] main:2::assertType:59 [ assertType::t1#35 idx#79 ] main:2::assertType:61 [ assertType::t1#35 idx#79 ] main:2::assertType:63 [ assertType::t1#35 idx#79 ] main:2::assertType:65 [ assertType::t1#35 idx#79 ] main:2::assertType:67 [ assertType::t1#35 idx#79 ] main:2::assertType:69 [ assertType::t1#35 idx#79 ] main:2::assertType:71 [ assertType::t1#35 idx#79 ] main:2::assertType:73 [ assertType::t1#35 idx#79 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ assertType::t1#35 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ idx#79 idx#40 ] +Statement [78] *((byte*)(word) $400 + (byte) idx#79) ← (byte) assertType::t1#35 [ idx#79 ] ( main:2::assertType:5 [ idx#79 ] main:2::assertType:7 [ idx#79 ] main:2::assertType:9 [ idx#79 ] main:2::assertType:11 [ idx#79 ] main:2::assertType:13 [ idx#79 ] main:2::assertType:15 [ idx#79 ] main:2::assertType:17 [ idx#79 ] main:2::assertType:19 [ idx#79 ] main:2::assertType:21 [ idx#79 ] main:2::assertType:23 [ idx#79 ] main:2::assertType:25 [ idx#79 ] main:2::assertType:27 [ idx#79 ] main:2::assertType:29 [ idx#79 ] main:2::assertType:31 [ idx#79 ] main:2::assertType:33 [ idx#79 ] main:2::assertType:35 [ idx#79 ] main:2::assertType:37 [ idx#79 ] main:2::assertType:39 [ idx#79 ] main:2::assertType:41 [ idx#79 ] main:2::assertType:43 [ idx#79 ] main:2::assertType:45 [ idx#79 ] main:2::assertType:47 [ idx#79 ] main:2::assertType:49 [ idx#79 ] main:2::assertType:51 [ idx#79 ] main:2::assertType:53 [ idx#79 ] main:2::assertType:55 [ idx#79 ] main:2::assertType:57 [ idx#79 ] main:2::assertType:59 [ idx#79 ] main:2::assertType:61 [ idx#79 ] main:2::assertType:63 [ idx#79 ] main:2::assertType:65 [ idx#79 ] main:2::assertType:67 [ idx#79 ] main:2::assertType:69 [ idx#79 ] main:2::assertType:71 [ idx#79 ] main:2::assertType:73 [ idx#79 ] ) always clobbers reg byte a +Statement [81] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) GREEN#0 [ assertType::t1#35 idx#79 ] ( main:2::assertType:5 [ assertType::t1#35 idx#79 ] main:2::assertType:7 [ assertType::t1#35 idx#79 ] main:2::assertType:9 [ assertType::t1#35 idx#79 ] main:2::assertType:11 [ assertType::t1#35 idx#79 ] main:2::assertType:13 [ assertType::t1#35 idx#79 ] main:2::assertType:15 [ assertType::t1#35 idx#79 ] main:2::assertType:17 [ assertType::t1#35 idx#79 ] main:2::assertType:19 [ assertType::t1#35 idx#79 ] main:2::assertType:21 [ assertType::t1#35 idx#79 ] main:2::assertType:23 [ assertType::t1#35 idx#79 ] main:2::assertType:25 [ assertType::t1#35 idx#79 ] main:2::assertType:27 [ assertType::t1#35 idx#79 ] main:2::assertType:29 [ assertType::t1#35 idx#79 ] main:2::assertType:31 [ assertType::t1#35 idx#79 ] main:2::assertType:33 [ assertType::t1#35 idx#79 ] main:2::assertType:35 [ assertType::t1#35 idx#79 ] main:2::assertType:37 [ assertType::t1#35 idx#79 ] main:2::assertType:39 [ assertType::t1#35 idx#79 ] main:2::assertType:41 [ assertType::t1#35 idx#79 ] main:2::assertType:43 [ assertType::t1#35 idx#79 ] main:2::assertType:45 [ assertType::t1#35 idx#79 ] main:2::assertType:47 [ assertType::t1#35 idx#79 ] main:2::assertType:49 [ assertType::t1#35 idx#79 ] main:2::assertType:51 [ assertType::t1#35 idx#79 ] main:2::assertType:53 [ assertType::t1#35 idx#79 ] main:2::assertType:55 [ assertType::t1#35 idx#79 ] main:2::assertType:57 [ assertType::t1#35 idx#79 ] main:2::assertType:59 [ assertType::t1#35 idx#79 ] main:2::assertType:61 [ assertType::t1#35 idx#79 ] main:2::assertType:63 [ assertType::t1#35 idx#79 ] main:2::assertType:65 [ assertType::t1#35 idx#79 ] main:2::assertType:67 [ assertType::t1#35 idx#79 ] main:2::assertType:69 [ assertType::t1#35 idx#79 ] main:2::assertType:71 [ assertType::t1#35 idx#79 ] main:2::assertType:73 [ assertType::t1#35 idx#79 ] ) always clobbers reg byte a +Statement [77] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) RED#0 [ assertType::t1#35 idx#79 ] ( main:2::assertType:5 [ assertType::t1#35 idx#79 ] main:2::assertType:7 [ assertType::t1#35 idx#79 ] main:2::assertType:9 [ assertType::t1#35 idx#79 ] main:2::assertType:11 [ assertType::t1#35 idx#79 ] main:2::assertType:13 [ assertType::t1#35 idx#79 ] main:2::assertType:15 [ assertType::t1#35 idx#79 ] main:2::assertType:17 [ assertType::t1#35 idx#79 ] main:2::assertType:19 [ assertType::t1#35 idx#79 ] main:2::assertType:21 [ assertType::t1#35 idx#79 ] main:2::assertType:23 [ assertType::t1#35 idx#79 ] main:2::assertType:25 [ assertType::t1#35 idx#79 ] main:2::assertType:27 [ assertType::t1#35 idx#79 ] main:2::assertType:29 [ assertType::t1#35 idx#79 ] main:2::assertType:31 [ assertType::t1#35 idx#79 ] main:2::assertType:33 [ assertType::t1#35 idx#79 ] main:2::assertType:35 [ assertType::t1#35 idx#79 ] main:2::assertType:37 [ assertType::t1#35 idx#79 ] main:2::assertType:39 [ assertType::t1#35 idx#79 ] main:2::assertType:41 [ assertType::t1#35 idx#79 ] main:2::assertType:43 [ assertType::t1#35 idx#79 ] main:2::assertType:45 [ assertType::t1#35 idx#79 ] main:2::assertType:47 [ assertType::t1#35 idx#79 ] main:2::assertType:49 [ assertType::t1#35 idx#79 ] main:2::assertType:51 [ assertType::t1#35 idx#79 ] main:2::assertType:53 [ assertType::t1#35 idx#79 ] main:2::assertType:55 [ assertType::t1#35 idx#79 ] main:2::assertType:57 [ assertType::t1#35 idx#79 ] main:2::assertType:59 [ assertType::t1#35 idx#79 ] main:2::assertType:61 [ assertType::t1#35 idx#79 ] main:2::assertType:63 [ assertType::t1#35 idx#79 ] main:2::assertType:65 [ assertType::t1#35 idx#79 ] main:2::assertType:67 [ assertType::t1#35 idx#79 ] main:2::assertType:69 [ assertType::t1#35 idx#79 ] main:2::assertType:71 [ assertType::t1#35 idx#79 ] main:2::assertType:73 [ assertType::t1#35 idx#79 ] ) always clobbers reg byte a +Statement [78] *((byte*)(word) $400 + (byte) idx#79) ← (byte) assertType::t1#35 [ idx#79 ] ( main:2::assertType:5 [ idx#79 ] main:2::assertType:7 [ idx#79 ] main:2::assertType:9 [ idx#79 ] main:2::assertType:11 [ idx#79 ] main:2::assertType:13 [ idx#79 ] main:2::assertType:15 [ idx#79 ] main:2::assertType:17 [ idx#79 ] main:2::assertType:19 [ idx#79 ] main:2::assertType:21 [ idx#79 ] main:2::assertType:23 [ idx#79 ] main:2::assertType:25 [ idx#79 ] main:2::assertType:27 [ idx#79 ] main:2::assertType:29 [ idx#79 ] main:2::assertType:31 [ idx#79 ] main:2::assertType:33 [ idx#79 ] main:2::assertType:35 [ idx#79 ] main:2::assertType:37 [ idx#79 ] main:2::assertType:39 [ idx#79 ] main:2::assertType:41 [ idx#79 ] main:2::assertType:43 [ idx#79 ] main:2::assertType:45 [ idx#79 ] main:2::assertType:47 [ idx#79 ] main:2::assertType:49 [ idx#79 ] main:2::assertType:51 [ idx#79 ] main:2::assertType:53 [ idx#79 ] main:2::assertType:55 [ idx#79 ] main:2::assertType:57 [ idx#79 ] main:2::assertType:59 [ idx#79 ] main:2::assertType:61 [ idx#79 ] main:2::assertType:63 [ idx#79 ] main:2::assertType:65 [ idx#79 ] main:2::assertType:67 [ idx#79 ] main:2::assertType:69 [ idx#79 ] main:2::assertType:71 [ idx#79 ] main:2::assertType:73 [ idx#79 ] ) always clobbers reg byte a +Statement [81] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) GREEN#0 [ assertType::t1#35 idx#79 ] ( main:2::assertType:5 [ assertType::t1#35 idx#79 ] main:2::assertType:7 [ assertType::t1#35 idx#79 ] main:2::assertType:9 [ assertType::t1#35 idx#79 ] main:2::assertType:11 [ assertType::t1#35 idx#79 ] main:2::assertType:13 [ assertType::t1#35 idx#79 ] main:2::assertType:15 [ assertType::t1#35 idx#79 ] main:2::assertType:17 [ assertType::t1#35 idx#79 ] main:2::assertType:19 [ assertType::t1#35 idx#79 ] main:2::assertType:21 [ assertType::t1#35 idx#79 ] main:2::assertType:23 [ assertType::t1#35 idx#79 ] main:2::assertType:25 [ assertType::t1#35 idx#79 ] main:2::assertType:27 [ assertType::t1#35 idx#79 ] main:2::assertType:29 [ assertType::t1#35 idx#79 ] main:2::assertType:31 [ assertType::t1#35 idx#79 ] main:2::assertType:33 [ assertType::t1#35 idx#79 ] main:2::assertType:35 [ assertType::t1#35 idx#79 ] main:2::assertType:37 [ assertType::t1#35 idx#79 ] main:2::assertType:39 [ assertType::t1#35 idx#79 ] main:2::assertType:41 [ assertType::t1#35 idx#79 ] main:2::assertType:43 [ assertType::t1#35 idx#79 ] main:2::assertType:45 [ assertType::t1#35 idx#79 ] main:2::assertType:47 [ assertType::t1#35 idx#79 ] main:2::assertType:49 [ assertType::t1#35 idx#79 ] main:2::assertType:51 [ assertType::t1#35 idx#79 ] main:2::assertType:53 [ assertType::t1#35 idx#79 ] main:2::assertType:55 [ assertType::t1#35 idx#79 ] main:2::assertType:57 [ assertType::t1#35 idx#79 ] main:2::assertType:59 [ assertType::t1#35 idx#79 ] main:2::assertType:61 [ assertType::t1#35 idx#79 ] main:2::assertType:63 [ assertType::t1#35 idx#79 ] main:2::assertType:65 [ assertType::t1#35 idx#79 ] main:2::assertType:67 [ assertType::t1#35 idx#79 ] main:2::assertType:69 [ assertType::t1#35 idx#79 ] main:2::assertType:71 [ assertType::t1#35 idx#79 ] main:2::assertType:73 [ assertType::t1#35 idx#79 ] ) always clobbers reg byte a +Potential registers zp ZP_BYTE:2 [ assertType::t1#35 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:3 [ assertType::t2#35 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:4 [ idx#79 idx#40 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [] 15.4: zp ZP_BYTE:4 [ idx#79 idx#40 ] +Uplift Scope [assertType] 2: zp ZP_BYTE:3 [ assertType::t2#35 ] 1: zp ZP_BYTE:2 [ assertType::t1#35 ] +Uplift Scope [main] + +Uplifting [] best 739 combination reg byte x [ idx#79 idx#40 ] +Uplifting [assertType] best 632 combination zp ZP_BYTE:3 [ assertType::t2#35 ] reg byte y [ assertType::t1#35 ] +Uplifting [main] best 632 combination +Attempting to uplift remaining variables inzp ZP_BYTE:3 [ assertType::t2#35 ] +Uplifting [assertType] best 632 combination zp ZP_BYTE:3 [ assertType::t2#35 ] +Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ assertType::t2#35 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 File Comments +// Tests conversion of numbers to correct int types +// See https://gitlab.com/camelot/kickc/issues/181 +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_SIGNED_DWORD = 6 + .const TYPEID_BYTE = 1 + .const TYPEID_WORD = 3 + .const TYPEID_DWORD = 5 + .const RED = 2 + .const GREEN = 5 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + //SEG11 [5] call assertType + //SEG12 [75] phi from main to assertType [phi:main->assertType] + assertType_from_main: + //SEG13 [75] phi (byte) idx#79 = (byte) 0 [phi:main->assertType#0] -- vbuxx=vbuc1 + ldx #0 + //SEG14 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_BYTE [phi:main->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG15 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_BYTE [phi:main->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_BYTE + jsr assertType + //SEG16 [6] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + jmp b1 + //SEG17 main::@1 + b1: + //SEG18 [7] call assertType + //SEG19 [75] phi from main::@1 to assertType [phi:main::@1->assertType] + assertType_from_b1: + //SEG20 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@1->assertType#0] -- register_copy + //SEG21 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG22 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@1->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG23 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + b2_from_b1: + jmp b2 + //SEG24 main::@2 + b2: + //SEG25 [9] call assertType + //SEG26 [75] phi from main::@2 to assertType [phi:main::@2->assertType] + assertType_from_b2: + //SEG27 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@2->assertType#0] -- register_copy + //SEG28 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG29 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@2->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG30 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + b3_from_b2: + jmp b3 + //SEG31 main::@3 + b3: + //SEG32 [11] call assertType + //SEG33 [75] phi from main::@3 to assertType [phi:main::@3->assertType] + assertType_from_b3: + //SEG34 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@3->assertType#0] -- register_copy + //SEG35 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG36 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@3->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG37 [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + b4_from_b3: + jmp b4 + //SEG38 main::@4 + b4: + //SEG39 [13] call assertType + //SEG40 [75] phi from main::@4 to assertType [phi:main::@4->assertType] + assertType_from_b4: + //SEG41 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@4->assertType#0] -- register_copy + //SEG42 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG43 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@4->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_WORD + jsr assertType + //SEG44 [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5] + b5_from_b4: + jmp b5 + //SEG45 main::@5 + b5: + //SEG46 [15] call assertType + //SEG47 [75] phi from main::@5 to assertType [phi:main::@5->assertType] + assertType_from_b5: + //SEG48 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@5->assertType#0] -- register_copy + //SEG49 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG50 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@5->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG51 [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6] + b6_from_b5: + jmp b6 + //SEG52 main::@6 + b6: + //SEG53 [17] call assertType + //SEG54 [75] phi from main::@6 to assertType [phi:main::@6->assertType] + assertType_from_b6: + //SEG55 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@6->assertType#0] -- register_copy + //SEG56 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@6->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG57 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@6->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG58 [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7] + b7_from_b6: + jmp b7 + //SEG59 main::@7 + b7: + //SEG60 [19] call assertType + //SEG61 [75] phi from main::@7 to assertType [phi:main::@7->assertType] + assertType_from_b7: + //SEG62 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@7->assertType#0] -- register_copy + //SEG63 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@7->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG64 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@7->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG65 [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8] + b8_from_b7: + jmp b8 + //SEG66 main::@8 + b8: + //SEG67 [21] call assertType + //SEG68 [75] phi from main::@8 to assertType [phi:main::@8->assertType] + assertType_from_b8: + //SEG69 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@8->assertType#0] -- register_copy + //SEG70 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@8->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG71 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@8->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG72 [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9] + b9_from_b8: + jmp b9 + //SEG73 main::@9 + b9: + //SEG74 [23] call assertType + //SEG75 [75] phi from main::@9 to assertType [phi:main::@9->assertType] + assertType_from_b9: + //SEG76 [75] phi (byte) idx#79 = (byte) $28 [phi:main::@9->assertType#0] -- vbuxx=vbuc1 + ldx #$28 + //SEG77 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@9->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG78 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@9->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG79 [24] phi from main::@9 to main::@10 [phi:main::@9->main::@10] + b10_from_b9: + jmp b10 + //SEG80 main::@10 + b10: + //SEG81 [25] call assertType + //SEG82 [75] phi from main::@10 to assertType [phi:main::@10->assertType] + assertType_from_b10: + //SEG83 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@10->assertType#0] -- register_copy + //SEG84 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@10->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG85 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@10->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG86 [26] phi from main::@10 to main::@11 [phi:main::@10->main::@11] + b11_from_b10: + jmp b11 + //SEG87 main::@11 + b11: + //SEG88 [27] call assertType + //SEG89 [75] phi from main::@11 to assertType [phi:main::@11->assertType] + assertType_from_b11: + //SEG90 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@11->assertType#0] -- register_copy + //SEG91 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@11->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG92 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@11->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG93 [28] phi from main::@11 to main::@12 [phi:main::@11->main::@12] + b12_from_b11: + jmp b12 + //SEG94 main::@12 + b12: + //SEG95 [29] call assertType + //SEG96 [75] phi from main::@12 to assertType [phi:main::@12->assertType] + assertType_from_b12: + //SEG97 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@12->assertType#0] -- register_copy + //SEG98 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@12->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG99 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@12->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG100 [30] phi from main::@12 to main::@13 [phi:main::@12->main::@13] + b13_from_b12: + jmp b13 + //SEG101 main::@13 + b13: + //SEG102 [31] call assertType + //SEG103 [75] phi from main::@13 to assertType [phi:main::@13->assertType] + assertType_from_b13: + //SEG104 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@13->assertType#0] -- register_copy + //SEG105 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@13->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG106 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@13->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG107 [32] phi from main::@13 to main::@14 [phi:main::@13->main::@14] + b14_from_b13: + jmp b14 + //SEG108 main::@14 + b14: + //SEG109 [33] call assertType + //SEG110 [75] phi from main::@14 to assertType [phi:main::@14->assertType] + assertType_from_b14: + //SEG111 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@14->assertType#0] -- register_copy + //SEG112 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@14->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG113 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@14->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG114 [34] phi from main::@14 to main::@15 [phi:main::@14->main::@15] + b15_from_b14: + jmp b15 + //SEG115 main::@15 + b15: + //SEG116 [35] call assertType + //SEG117 [75] phi from main::@15 to assertType [phi:main::@15->assertType] + assertType_from_b15: + //SEG118 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@15->assertType#0] -- register_copy + //SEG119 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@15->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG120 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@15->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG121 [36] phi from main::@15 to main::@16 [phi:main::@15->main::@16] + b16_from_b15: + jmp b16 + //SEG122 main::@16 + b16: + //SEG123 [37] call assertType + //SEG124 [75] phi from main::@16 to assertType [phi:main::@16->assertType] + assertType_from_b16: + //SEG125 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@16->assertType#0] -- register_copy + //SEG126 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@16->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG127 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@16->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG128 [38] phi from main::@16 to main::@17 [phi:main::@16->main::@17] + b17_from_b16: + jmp b17 + //SEG129 main::@17 + b17: + //SEG130 [39] call assertType + //SEG131 [75] phi from main::@17 to assertType [phi:main::@17->assertType] + assertType_from_b17: + //SEG132 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@17->assertType#0] -- register_copy + //SEG133 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@17->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG134 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@17->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG135 [40] phi from main::@17 to main::@18 [phi:main::@17->main::@18] + b18_from_b17: + jmp b18 + //SEG136 main::@18 + b18: + //SEG137 [41] call assertType + //SEG138 [75] phi from main::@18 to assertType [phi:main::@18->assertType] + assertType_from_b18: + //SEG139 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@18->assertType#0] -- register_copy + //SEG140 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@18->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG141 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@18->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG142 [42] phi from main::@18 to main::@19 [phi:main::@18->main::@19] + b19_from_b18: + jmp b19 + //SEG143 main::@19 + b19: + //SEG144 [43] call assertType + //SEG145 [75] phi from main::@19 to assertType [phi:main::@19->assertType] + assertType_from_b19: + //SEG146 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@19->assertType#0] -- register_copy + //SEG147 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@19->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG148 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@19->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG149 [44] phi from main::@19 to main::@20 [phi:main::@19->main::@20] + b20_from_b19: + jmp b20 + //SEG150 main::@20 + b20: + //SEG151 [45] call assertType + //SEG152 [75] phi from main::@20 to assertType [phi:main::@20->assertType] + assertType_from_b20: + //SEG153 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@20->assertType#0] -- register_copy + //SEG154 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@20->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG155 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@20->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG156 [46] phi from main::@20 to main::@21 [phi:main::@20->main::@21] + b21_from_b20: + jmp b21 + //SEG157 main::@21 + b21: + //SEG158 [47] call assertType + //SEG159 [75] phi from main::@21 to assertType [phi:main::@21->assertType] + assertType_from_b21: + //SEG160 [75] phi (byte) idx#79 = (byte) $50 [phi:main::@21->assertType#0] -- vbuxx=vbuc1 + ldx #$50 + //SEG161 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@21->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG162 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@21->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG163 [48] phi from main::@21 to main::@22 [phi:main::@21->main::@22] + b22_from_b21: + jmp b22 + //SEG164 main::@22 + b22: + //SEG165 [49] call assertType + //SEG166 [75] phi from main::@22 to assertType [phi:main::@22->assertType] + assertType_from_b22: + //SEG167 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@22->assertType#0] -- register_copy + //SEG168 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@22->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG169 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@22->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG170 [50] phi from main::@22 to main::@23 [phi:main::@22->main::@23] + b23_from_b22: + jmp b23 + //SEG171 main::@23 + b23: + //SEG172 [51] call assertType + //SEG173 [75] phi from main::@23 to assertType [phi:main::@23->assertType] + assertType_from_b23: + //SEG174 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@23->assertType#0] -- register_copy + //SEG175 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@23->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG176 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@23->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_BYTE + jsr assertType + //SEG177 [52] phi from main::@23 to main::@24 [phi:main::@23->main::@24] + b24_from_b23: + jmp b24 + //SEG178 main::@24 + b24: + //SEG179 [53] call assertType + //SEG180 [75] phi from main::@24 to assertType [phi:main::@24->assertType] + assertType_from_b24: + //SEG181 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@24->assertType#0] -- register_copy + //SEG182 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@24->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG183 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@24->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG184 [54] phi from main::@24 to main::@25 [phi:main::@24->main::@25] + b25_from_b24: + jmp b25 + //SEG185 main::@25 + b25: + //SEG186 [55] call assertType + //SEG187 [75] phi from main::@25 to assertType [phi:main::@25->assertType] + assertType_from_b25: + //SEG188 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@25->assertType#0] -- register_copy + //SEG189 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@25->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG190 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@25->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG191 [56] phi from main::@25 to main::@26 [phi:main::@25->main::@26] + b26_from_b25: + jmp b26 + //SEG192 main::@26 + b26: + //SEG193 [57] call assertType + //SEG194 [75] phi from main::@26 to assertType [phi:main::@26->assertType] + assertType_from_b26: + //SEG195 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@26->assertType#0] -- register_copy + //SEG196 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@26->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG197 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@26->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG198 [58] phi from main::@26 to main::@27 [phi:main::@26->main::@27] + b27_from_b26: + jmp b27 + //SEG199 main::@27 + b27: + //SEG200 [59] call assertType + //SEG201 [75] phi from main::@27 to assertType [phi:main::@27->assertType] + assertType_from_b27: + //SEG202 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@27->assertType#0] -- register_copy + //SEG203 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@27->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG204 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@27->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG205 [60] phi from main::@27 to main::@28 [phi:main::@27->main::@28] + b28_from_b27: + jmp b28 + //SEG206 main::@28 + b28: + //SEG207 [61] call assertType + //SEG208 [75] phi from main::@28 to assertType [phi:main::@28->assertType] + assertType_from_b28: + //SEG209 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@28->assertType#0] -- register_copy + //SEG210 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@28->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG211 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@28->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG212 [62] phi from main::@28 to main::@29 [phi:main::@28->main::@29] + b29_from_b28: + jmp b29 + //SEG213 main::@29 + b29: + //SEG214 [63] call assertType + //SEG215 [75] phi from main::@29 to assertType [phi:main::@29->assertType] + assertType_from_b29: + //SEG216 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@29->assertType#0] -- register_copy + //SEG217 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@29->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG218 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@29->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_WORD + jsr assertType + //SEG219 [64] phi from main::@29 to main::@30 [phi:main::@29->main::@30] + b30_from_b29: + jmp b30 + //SEG220 main::@30 + b30: + //SEG221 [65] call assertType + //SEG222 [75] phi from main::@30 to assertType [phi:main::@30->assertType] + assertType_from_b30: + //SEG223 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@30->assertType#0] -- register_copy + //SEG224 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@30->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG225 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@30->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG226 [66] phi from main::@30 to main::@31 [phi:main::@30->main::@31] + b31_from_b30: + jmp b31 + //SEG227 main::@31 + b31: + //SEG228 [67] call assertType + //SEG229 [75] phi from main::@31 to assertType [phi:main::@31->assertType] + assertType_from_b31: + //SEG230 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@31->assertType#0] -- register_copy + //SEG231 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@31->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG232 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@31->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG233 [68] phi from main::@31 to main::@32 [phi:main::@31->main::@32] + b32_from_b31: + jmp b32 + //SEG234 main::@32 + b32: + //SEG235 [69] call assertType + //SEG236 [75] phi from main::@32 to assertType [phi:main::@32->assertType] + assertType_from_b32: + //SEG237 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@32->assertType#0] -- register_copy + //SEG238 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@32->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG239 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@32->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG240 [70] phi from main::@32 to main::@33 [phi:main::@32->main::@33] + b33_from_b32: + jmp b33 + //SEG241 main::@33 + b33: + //SEG242 [71] call assertType + //SEG243 [75] phi from main::@33 to assertType [phi:main::@33->assertType] + assertType_from_b33: + //SEG244 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@33->assertType#0] -- register_copy + //SEG245 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@33->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG246 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@33->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_DWORD + jsr assertType + //SEG247 [72] phi from main::@33 to main::@34 [phi:main::@33->main::@34] + b34_from_b33: + jmp b34 + //SEG248 main::@34 + b34: + //SEG249 [73] call assertType + //SEG250 [75] phi from main::@34 to assertType [phi:main::@34->assertType] + assertType_from_b34: + //SEG251 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@34->assertType#0] -- register_copy + //SEG252 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@34->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG253 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@34->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + jmp breturn + //SEG254 main::@return + breturn: + //SEG255 [74] return + rts +} +//SEG256 assertType +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte register(Y) t1, byte zeropage(2) t2) +assertType: { + .label t2 = 2 + //SEG257 [76] if((byte) assertType::t1#35==(byte) assertType::t2#35) goto assertType::@1 -- vbuyy_eq_vbuz1_then_la1 + tya + cmp t2 + beq b1 + jmp b3 + //SEG258 assertType::@3 + b3: + //SEG259 [77] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) RED#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #RED + sta $d800,x + jmp b2 + //SEG260 assertType::@2 + b2: + //SEG261 [78] *((byte*)(word) $400 + (byte) idx#79) ← (byte) assertType::t1#35 -- pbuc1_derefidx_vbuxx=vbuyy + tya + sta $400,x + //SEG262 [79] (byte) idx#40 ← ++ (byte) idx#79 -- vbuxx=_inc_vbuxx + inx + jmp breturn + //SEG263 assertType::@return + breturn: + //SEG264 [80] return + rts + //SEG265 assertType::@1 + b1: + //SEG266 [81] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #GREEN + sta $d800,x + jmp b2 +} + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b1 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp b4 +Removing instruction jmp b5 +Removing instruction jmp b6 +Removing instruction jmp b7 +Removing instruction jmp b8 +Removing instruction jmp b9 +Removing instruction jmp b10 +Removing instruction jmp b11 +Removing instruction jmp b12 +Removing instruction jmp b13 +Removing instruction jmp b14 +Removing instruction jmp b15 +Removing instruction jmp b16 +Removing instruction jmp b17 +Removing instruction jmp b18 +Removing instruction jmp b19 +Removing instruction jmp b20 +Removing instruction jmp b21 +Removing instruction jmp b22 +Removing instruction jmp b23 +Removing instruction jmp b24 +Removing instruction jmp b25 +Removing instruction jmp b26 +Removing instruction jmp b27 +Removing instruction jmp b28 +Removing instruction jmp b29 +Removing instruction jmp b30 +Removing instruction jmp b31 +Removing instruction jmp b32 +Removing instruction jmp b33 +Removing instruction jmp b34 +Removing instruction jmp breturn +Removing instruction jmp b3 +Removing instruction jmp b2 +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Replacing instruction ldy #TYPEID_SIGNED_BYTE with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_WORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_SIGNED_DWORD with TAY +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_BYTE with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_WORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Replacing instruction ldy #TYPEID_DWORD with TAY +Removing instruction b1_from_bbegin: +Removing instruction b1: +Removing instruction main_from_b1: +Removing instruction bend_from_b1: +Removing instruction b1_from_main: +Removing instruction assertType_from_b1: +Removing instruction b2_from_b1: +Removing instruction assertType_from_b2: +Removing instruction b3_from_b2: +Removing instruction assertType_from_b3: +Removing instruction b4_from_b3: +Removing instruction assertType_from_b4: +Removing instruction b5_from_b4: +Removing instruction assertType_from_b5: +Removing instruction b6_from_b5: +Removing instruction assertType_from_b6: +Removing instruction b7_from_b6: +Removing instruction assertType_from_b7: +Removing instruction b8_from_b7: +Removing instruction assertType_from_b8: +Removing instruction b9_from_b8: +Removing instruction assertType_from_b9: +Removing instruction b10_from_b9: +Removing instruction assertType_from_b10: +Removing instruction b11_from_b10: +Removing instruction assertType_from_b11: +Removing instruction b12_from_b11: +Removing instruction assertType_from_b12: +Removing instruction b13_from_b12: +Removing instruction assertType_from_b13: +Removing instruction b14_from_b13: +Removing instruction assertType_from_b14: +Removing instruction b15_from_b14: +Removing instruction assertType_from_b15: +Removing instruction b16_from_b15: +Removing instruction assertType_from_b16: +Removing instruction b17_from_b16: +Removing instruction assertType_from_b17: +Removing instruction b18_from_b17: +Removing instruction assertType_from_b18: +Removing instruction b19_from_b18: +Removing instruction assertType_from_b19: +Removing instruction b20_from_b19: +Removing instruction assertType_from_b20: +Removing instruction b21_from_b20: +Removing instruction assertType_from_b21: +Removing instruction b22_from_b21: +Removing instruction assertType_from_b22: +Removing instruction b23_from_b22: +Removing instruction assertType_from_b23: +Removing instruction b24_from_b23: +Removing instruction assertType_from_b24: +Removing instruction b25_from_b24: +Removing instruction assertType_from_b25: +Removing instruction b26_from_b25: +Removing instruction assertType_from_b26: +Removing instruction b27_from_b26: +Removing instruction assertType_from_b27: +Removing instruction b28_from_b27: +Removing instruction assertType_from_b28: +Removing instruction b29_from_b28: +Removing instruction assertType_from_b29: +Removing instruction b30_from_b29: +Removing instruction assertType_from_b30: +Removing instruction b31_from_b30: +Removing instruction assertType_from_b31: +Removing instruction b32_from_b31: +Removing instruction assertType_from_b32: +Removing instruction b33_from_b32: +Removing instruction assertType_from_b33: +Removing instruction b34_from_b33: +Removing instruction assertType_from_b34: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bend: +Removing instruction assertType_from_main: +Removing instruction b1: +Removing instruction b2: +Removing instruction b3: +Removing instruction b4: +Removing instruction b5: +Removing instruction b6: +Removing instruction b7: +Removing instruction b8: +Removing instruction b9: +Removing instruction b10: +Removing instruction b11: +Removing instruction b12: +Removing instruction b13: +Removing instruction b14: +Removing instruction b15: +Removing instruction b16: +Removing instruction b17: +Removing instruction b18: +Removing instruction b19: +Removing instruction b20: +Removing instruction b21: +Removing instruction b22: +Removing instruction b23: +Removing instruction b24: +Removing instruction b25: +Removing instruction b26: +Removing instruction b27: +Removing instruction b28: +Removing instruction b29: +Removing instruction b30: +Removing instruction b31: +Removing instruction b32: +Removing instruction b33: +Removing instruction b34: +Removing instruction breturn: +Removing instruction b3: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @begin +(label) @end +(byte*) COLS +(byte) GREEN +(const byte) GREEN#0 GREEN = (byte) 5 +(byte) RED +(const byte) RED#0 RED = (byte) 2 +(byte*) SCREEN +(const byte) TYPEID_BYTE TYPEID_BYTE = (number) 1 +(const byte) TYPEID_DWORD TYPEID_DWORD = (number) 5 +(const byte) TYPEID_SIGNED_BYTE TYPEID_SIGNED_BYTE = (number) 2 +(const byte) TYPEID_SIGNED_DWORD TYPEID_SIGNED_DWORD = (number) 6 +(const byte) TYPEID_SIGNED_WORD TYPEID_SIGNED_WORD = (number) 4 +(const byte) TYPEID_WORD TYPEID_WORD = (number) 3 +(void()) assertType((byte) assertType::t1 , (byte) assertType::t2) +(label) assertType::@1 +(label) assertType::@2 +(label) assertType::@3 +(label) assertType::@return +(byte) assertType::t1 +(byte) assertType::t1#35 reg byte y 1.0 +(byte) assertType::t2 +(byte) assertType::t2#35 t2 zp ZP_BYTE:2 2.0 +(byte) idx +(byte) idx#40 reg byte x 0.9999999999999993 +(byte) idx#79 reg byte x 14.400000000000007 +(void()) main() +(label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@12 +(label) main::@13 +(label) main::@14 +(label) main::@15 +(label) main::@16 +(label) main::@17 +(label) main::@18 +(label) main::@19 +(label) main::@2 +(label) main::@20 +(label) main::@21 +(label) main::@22 +(label) main::@23 +(label) main::@24 +(label) main::@25 +(label) main::@26 +(label) main::@27 +(label) main::@28 +(label) main::@29 +(label) main::@3 +(label) main::@30 +(label) main::@31 +(label) main::@32 +(label) main::@33 +(label) main::@34 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@7 +(label) main::@8 +(label) main::@9 +(label) main::@return + +reg byte y [ assertType::t1#35 ] +zp ZP_BYTE:2 [ assertType::t2#35 ] +reg byte x [ idx#79 idx#40 ] + + +FINAL ASSEMBLER +Score: 506 + +//SEG0 File Comments +// Tests conversion of numbers to correct int types +// See https://gitlab.com/camelot/kickc/issues/181 +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const TYPEID_SIGNED_BYTE = 2 + .const TYPEID_SIGNED_WORD = 4 + .const TYPEID_SIGNED_DWORD = 6 + .const TYPEID_BYTE = 1 + .const TYPEID_WORD = 3 + .const TYPEID_DWORD = 5 + .const RED = 2 + .const GREEN = 5 +//SEG3 @begin +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +//SEG5 @1 +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +//SEG9 @end +//SEG10 main +main: { + //SEG11 [5] call assertType + //SEG12 [75] phi from main to assertType [phi:main->assertType] + //SEG13 [75] phi (byte) idx#79 = (byte) 0 [phi:main->assertType#0] -- vbuxx=vbuc1 + ldx #0 + //SEG14 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_BYTE [phi:main->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_BYTE + sta assertType.t2 + //SEG15 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_BYTE [phi:main->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG16 [6] phi from main to main::@1 [phi:main->main::@1] + //SEG17 main::@1 + //SEG18 [7] call assertType + //SEG19 [75] phi from main::@1 to assertType [phi:main::@1->assertType] + //SEG20 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@1->assertType#0] -- register_copy + //SEG21 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@1->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG22 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@1->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG23 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + //SEG24 main::@2 + //SEG25 [9] call assertType + //SEG26 [75] phi from main::@2 to assertType [phi:main::@2->assertType] + //SEG27 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@2->assertType#0] -- register_copy + //SEG28 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@2->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG29 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@2->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG30 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + //SEG31 main::@3 + //SEG32 [11] call assertType + //SEG33 [75] phi from main::@3 to assertType [phi:main::@3->assertType] + //SEG34 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@3->assertType#0] -- register_copy + //SEG35 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@3->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG36 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@3->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG37 [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + //SEG38 main::@4 + //SEG39 [13] call assertType + //SEG40 [75] phi from main::@4 to assertType [phi:main::@4->assertType] + //SEG41 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@4->assertType#0] -- register_copy + //SEG42 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@4->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_WORD + sta assertType.t2 + //SEG43 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_WORD [phi:main::@4->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG44 [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5] + //SEG45 main::@5 + //SEG46 [15] call assertType + //SEG47 [75] phi from main::@5 to assertType [phi:main::@5->assertType] + //SEG48 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@5->assertType#0] -- register_copy + //SEG49 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@5->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG50 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@5->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG51 [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6] + //SEG52 main::@6 + //SEG53 [17] call assertType + //SEG54 [75] phi from main::@6 to assertType [phi:main::@6->assertType] + //SEG55 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@6->assertType#0] -- register_copy + //SEG56 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@6->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG57 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@6->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG58 [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7] + //SEG59 main::@7 + //SEG60 [19] call assertType + //SEG61 [75] phi from main::@7 to assertType [phi:main::@7->assertType] + //SEG62 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@7->assertType#0] -- register_copy + //SEG63 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@7->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG64 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@7->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG65 [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8] + //SEG66 main::@8 + //SEG67 [21] call assertType + //SEG68 [75] phi from main::@8 to assertType [phi:main::@8->assertType] + //SEG69 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@8->assertType#0] -- register_copy + //SEG70 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@8->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_SIGNED_DWORD + sta assertType.t2 + //SEG71 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@8->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG72 [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9] + //SEG73 main::@9 + //SEG74 [23] call assertType + //SEG75 [75] phi from main::@9 to assertType [phi:main::@9->assertType] + //SEG76 [75] phi (byte) idx#79 = (byte) $28 [phi:main::@9->assertType#0] -- vbuxx=vbuc1 + ldx #$28 + //SEG77 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@9->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG78 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@9->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG79 [24] phi from main::@9 to main::@10 [phi:main::@9->main::@10] + //SEG80 main::@10 + //SEG81 [25] call assertType + //SEG82 [75] phi from main::@10 to assertType [phi:main::@10->assertType] + //SEG83 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@10->assertType#0] -- register_copy + //SEG84 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@10->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG85 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@10->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG86 [26] phi from main::@10 to main::@11 [phi:main::@10->main::@11] + //SEG87 main::@11 + //SEG88 [27] call assertType + //SEG89 [75] phi from main::@11 to assertType [phi:main::@11->assertType] + //SEG90 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@11->assertType#0] -- register_copy + //SEG91 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@11->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG92 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@11->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG93 [28] phi from main::@11 to main::@12 [phi:main::@11->main::@12] + //SEG94 main::@12 + //SEG95 [29] call assertType + //SEG96 [75] phi from main::@12 to assertType [phi:main::@12->assertType] + //SEG97 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@12->assertType#0] -- register_copy + //SEG98 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@12->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG99 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@12->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG100 [30] phi from main::@12 to main::@13 [phi:main::@12->main::@13] + //SEG101 main::@13 + //SEG102 [31] call assertType + //SEG103 [75] phi from main::@13 to assertType [phi:main::@13->assertType] + //SEG104 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@13->assertType#0] -- register_copy + //SEG105 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@13->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG106 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@13->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG107 [32] phi from main::@13 to main::@14 [phi:main::@13->main::@14] + //SEG108 main::@14 + //SEG109 [33] call assertType + //SEG110 [75] phi from main::@14 to assertType [phi:main::@14->assertType] + //SEG111 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@14->assertType#0] -- register_copy + //SEG112 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@14->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG113 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@14->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG114 [34] phi from main::@14 to main::@15 [phi:main::@14->main::@15] + //SEG115 main::@15 + //SEG116 [35] call assertType + //SEG117 [75] phi from main::@15 to assertType [phi:main::@15->assertType] + //SEG118 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@15->assertType#0] -- register_copy + //SEG119 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@15->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG120 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@15->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG121 [36] phi from main::@15 to main::@16 [phi:main::@15->main::@16] + //SEG122 main::@16 + //SEG123 [37] call assertType + //SEG124 [75] phi from main::@16 to assertType [phi:main::@16->assertType] + //SEG125 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@16->assertType#0] -- register_copy + //SEG126 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@16->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG127 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@16->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG128 [38] phi from main::@16 to main::@17 [phi:main::@16->main::@17] + //SEG129 main::@17 + //SEG130 [39] call assertType + //SEG131 [75] phi from main::@17 to assertType [phi:main::@17->assertType] + //SEG132 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@17->assertType#0] -- register_copy + //SEG133 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@17->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG134 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@17->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG135 [40] phi from main::@17 to main::@18 [phi:main::@17->main::@18] + //SEG136 main::@18 + //SEG137 [41] call assertType + //SEG138 [75] phi from main::@18 to assertType [phi:main::@18->assertType] + //SEG139 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@18->assertType#0] -- register_copy + //SEG140 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@18->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG141 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@18->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG142 [42] phi from main::@18 to main::@19 [phi:main::@18->main::@19] + //SEG143 main::@19 + //SEG144 [43] call assertType + //SEG145 [75] phi from main::@19 to assertType [phi:main::@19->assertType] + //SEG146 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@19->assertType#0] -- register_copy + //SEG147 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@19->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG148 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@19->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG149 [44] phi from main::@19 to main::@20 [phi:main::@19->main::@20] + //SEG150 main::@20 + //SEG151 [45] call assertType + //SEG152 [75] phi from main::@20 to assertType [phi:main::@20->assertType] + //SEG153 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@20->assertType#0] -- register_copy + //SEG154 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@20->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG155 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@20->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG156 [46] phi from main::@20 to main::@21 [phi:main::@20->main::@21] + //SEG157 main::@21 + //SEG158 [47] call assertType + //SEG159 [75] phi from main::@21 to assertType [phi:main::@21->assertType] + //SEG160 [75] phi (byte) idx#79 = (byte) $50 [phi:main::@21->assertType#0] -- vbuxx=vbuc1 + ldx #$50 + //SEG161 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@21->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG162 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@21->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG163 [48] phi from main::@21 to main::@22 [phi:main::@21->main::@22] + //SEG164 main::@22 + //SEG165 [49] call assertType + //SEG166 [75] phi from main::@22 to assertType [phi:main::@22->assertType] + //SEG167 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@22->assertType#0] -- register_copy + //SEG168 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@22->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG169 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@22->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG170 [50] phi from main::@22 to main::@23 [phi:main::@22->main::@23] + //SEG171 main::@23 + //SEG172 [51] call assertType + //SEG173 [75] phi from main::@23 to assertType [phi:main::@23->assertType] + //SEG174 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@23->assertType#0] -- register_copy + //SEG175 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_BYTE [phi:main::@23->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_BYTE + sta assertType.t2 + //SEG176 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_BYTE [phi:main::@23->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG177 [52] phi from main::@23 to main::@24 [phi:main::@23->main::@24] + //SEG178 main::@24 + //SEG179 [53] call assertType + //SEG180 [75] phi from main::@24 to assertType [phi:main::@24->assertType] + //SEG181 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@24->assertType#0] -- register_copy + //SEG182 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@24->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG183 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@24->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG184 [54] phi from main::@24 to main::@25 [phi:main::@24->main::@25] + //SEG185 main::@25 + //SEG186 [55] call assertType + //SEG187 [75] phi from main::@25 to assertType [phi:main::@25->assertType] + //SEG188 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@25->assertType#0] -- register_copy + //SEG189 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@25->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG190 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@25->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG191 [56] phi from main::@25 to main::@26 [phi:main::@25->main::@26] + //SEG192 main::@26 + //SEG193 [57] call assertType + //SEG194 [75] phi from main::@26 to assertType [phi:main::@26->assertType] + //SEG195 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@26->assertType#0] -- register_copy + //SEG196 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@26->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG197 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@26->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG198 [58] phi from main::@26 to main::@27 [phi:main::@26->main::@27] + //SEG199 main::@27 + //SEG200 [59] call assertType + //SEG201 [75] phi from main::@27 to assertType [phi:main::@27->assertType] + //SEG202 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@27->assertType#0] -- register_copy + //SEG203 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@27->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG204 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@27->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG205 [60] phi from main::@27 to main::@28 [phi:main::@27->main::@28] + //SEG206 main::@28 + //SEG207 [61] call assertType + //SEG208 [75] phi from main::@28 to assertType [phi:main::@28->assertType] + //SEG209 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@28->assertType#0] -- register_copy + //SEG210 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@28->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG211 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@28->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG212 [62] phi from main::@28 to main::@29 [phi:main::@28->main::@29] + //SEG213 main::@29 + //SEG214 [63] call assertType + //SEG215 [75] phi from main::@29 to assertType [phi:main::@29->assertType] + //SEG216 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@29->assertType#0] -- register_copy + //SEG217 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_WORD [phi:main::@29->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_WORD + sta assertType.t2 + //SEG218 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_WORD [phi:main::@29->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG219 [64] phi from main::@29 to main::@30 [phi:main::@29->main::@30] + //SEG220 main::@30 + //SEG221 [65] call assertType + //SEG222 [75] phi from main::@30 to assertType [phi:main::@30->assertType] + //SEG223 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@30->assertType#0] -- register_copy + //SEG224 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@30->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG225 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@30->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG226 [66] phi from main::@30 to main::@31 [phi:main::@30->main::@31] + //SEG227 main::@31 + //SEG228 [67] call assertType + //SEG229 [75] phi from main::@31 to assertType [phi:main::@31->assertType] + //SEG230 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@31->assertType#0] -- register_copy + //SEG231 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@31->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG232 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@31->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG233 [68] phi from main::@31 to main::@32 [phi:main::@31->main::@32] + //SEG234 main::@32 + //SEG235 [69] call assertType + //SEG236 [75] phi from main::@32 to assertType [phi:main::@32->assertType] + //SEG237 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@32->assertType#0] -- register_copy + //SEG238 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@32->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG239 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@32->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG240 [70] phi from main::@32 to main::@33 [phi:main::@32->main::@33] + //SEG241 main::@33 + //SEG242 [71] call assertType + //SEG243 [75] phi from main::@33 to assertType [phi:main::@33->assertType] + //SEG244 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@33->assertType#0] -- register_copy + //SEG245 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@33->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG246 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_DWORD [phi:main::@33->assertType#2] -- vbuyy=vbuc1 + tay + jsr assertType + //SEG247 [72] phi from main::@33 to main::@34 [phi:main::@33->main::@34] + //SEG248 main::@34 + //SEG249 [73] call assertType + //SEG250 [75] phi from main::@34 to assertType [phi:main::@34->assertType] + //SEG251 [75] phi (byte) idx#79 = (byte) idx#40 [phi:main::@34->assertType#0] -- register_copy + //SEG252 [75] phi (byte) assertType::t2#35 = (const byte) TYPEID_DWORD [phi:main::@34->assertType#1] -- vbuz1=vbuc1 + lda #TYPEID_DWORD + sta assertType.t2 + //SEG253 [75] phi (byte) assertType::t1#35 = (const byte) TYPEID_SIGNED_DWORD [phi:main::@34->assertType#2] -- vbuyy=vbuc1 + ldy #TYPEID_SIGNED_DWORD + jsr assertType + //SEG254 main::@return + //SEG255 [74] return + rts +} +//SEG256 assertType +// Check that the two passed type IDs are equal. +// Shows a letter symbolizing t1 +// If they are equal the letter is green - if not it is red. +// assertType(byte register(Y) t1, byte zeropage(2) t2) +assertType: { + .label t2 = 2 + //SEG257 [76] if((byte) assertType::t1#35==(byte) assertType::t2#35) goto assertType::@1 -- vbuyy_eq_vbuz1_then_la1 + tya + cmp t2 + beq b1 + //SEG258 assertType::@3 + //SEG259 [77] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) RED#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #RED + sta $d800,x + //SEG260 assertType::@2 + b2: + //SEG261 [78] *((byte*)(word) $400 + (byte) idx#79) ← (byte) assertType::t1#35 -- pbuc1_derefidx_vbuxx=vbuyy + tya + sta $400,x + //SEG262 [79] (byte) idx#40 ← ++ (byte) idx#79 -- vbuxx=_inc_vbuxx + inx + //SEG263 assertType::@return + //SEG264 [80] return + rts + //SEG265 assertType::@1 + b1: + //SEG266 [81] *((byte*)(word) $d800 + (byte) idx#79) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2 + lda #GREEN + sta $d800,x + jmp b2 +} + diff --git a/src/test/ref/number-conversion.sym b/src/test/ref/number-conversion.sym new file mode 100644 index 000000000..78d7bc585 --- /dev/null +++ b/src/test/ref/number-conversion.sym @@ -0,0 +1,67 @@ +(label) @1 +(label) @begin +(label) @end +(byte*) COLS +(byte) GREEN +(const byte) GREEN#0 GREEN = (byte) 5 +(byte) RED +(const byte) RED#0 RED = (byte) 2 +(byte*) SCREEN +(const byte) TYPEID_BYTE TYPEID_BYTE = (number) 1 +(const byte) TYPEID_DWORD TYPEID_DWORD = (number) 5 +(const byte) TYPEID_SIGNED_BYTE TYPEID_SIGNED_BYTE = (number) 2 +(const byte) TYPEID_SIGNED_DWORD TYPEID_SIGNED_DWORD = (number) 6 +(const byte) TYPEID_SIGNED_WORD TYPEID_SIGNED_WORD = (number) 4 +(const byte) TYPEID_WORD TYPEID_WORD = (number) 3 +(void()) assertType((byte) assertType::t1 , (byte) assertType::t2) +(label) assertType::@1 +(label) assertType::@2 +(label) assertType::@3 +(label) assertType::@return +(byte) assertType::t1 +(byte) assertType::t1#35 reg byte y 1.0 +(byte) assertType::t2 +(byte) assertType::t2#35 t2 zp ZP_BYTE:2 2.0 +(byte) idx +(byte) idx#40 reg byte x 0.9999999999999993 +(byte) idx#79 reg byte x 14.400000000000007 +(void()) main() +(label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@12 +(label) main::@13 +(label) main::@14 +(label) main::@15 +(label) main::@16 +(label) main::@17 +(label) main::@18 +(label) main::@19 +(label) main::@2 +(label) main::@20 +(label) main::@21 +(label) main::@22 +(label) main::@23 +(label) main::@24 +(label) main::@25 +(label) main::@26 +(label) main::@27 +(label) main::@28 +(label) main::@29 +(label) main::@3 +(label) main::@30 +(label) main::@31 +(label) main::@32 +(label) main::@33 +(label) main::@34 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@7 +(label) main::@8 +(label) main::@9 +(label) main::@return + +reg byte y [ assertType::t1#35 ] +zp ZP_BYTE:2 [ assertType::t2#35 ] +reg byte x [ idx#79 idx#40 ] diff --git a/src/test/ref/number-type.asm b/src/test/ref/number-type.asm new file mode 100644 index 000000000..8944e6dbf --- /dev/null +++ b/src/test/ref/number-type.asm @@ -0,0 +1,69 @@ +// Tests the number type used for constant expressions +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +main: { + jsr testBytes + jsr testSBytes + rts +} +testSBytes: { + // Constant values resolvable to signed bytes + .label SCREEN = $428 + lda #-$c + sta SCREEN + lda #-6-6 + sta SCREEN+1 + lda #-$12+6 + sta SCREEN+2 + lda #-$714+$708 + sta SCREEN+3 + lda #-1-2-3-6 + sta SCREEN+4 + lda #-2*6 + sta SCREEN+5 + lda #-3<<2 + sta SCREEN+6 + lda #-$18>>1 + sta SCREEN+7 + lda #-4&-9 + sta SCREEN+8 + lda #-$10|-$fc + sta SCREEN+9 + lda #(-2-2)*$f/5 + sta SCREEN+$a + lda #$ff&$1000-$c + sta SCREEN+$b + rts +} +testBytes: { + // Constant values resolvable to bytes + .label SCREEN = $400 + lda #$c + sta SCREEN + lda #6+6 + sta SCREEN+1 + lda #$12-6 + sta SCREEN+2 + lda #$714-$708 + sta SCREEN+3 + lda #1+2+3+6 + sta SCREEN+4 + lda #2*6 + sta SCREEN+5 + lda #3<<2 + sta SCREEN+6 + lda #$18>>1 + sta SCREEN+7 + lda #$f&$1c + sta SCREEN+8 + lda #4|8 + sta SCREEN+9 + lda #5^9 + sta SCREEN+$a + lda #(2+2)*$f/5 + sta SCREEN+$b + lda #$ff&$1000+$c + sta SCREEN+$c + rts +} diff --git a/src/test/ref/number-type.cfg b/src/test/ref/number-type.cfg new file mode 100644 index 000000000..11a77d0ae --- /dev/null +++ b/src/test/ref/number-type.cfg @@ -0,0 +1,55 @@ +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + [5] call testBytes + to:main::@1 +main::@1: scope:[main] from main + [6] phi() + [7] call testSBytes + to:main::@return +main::@return: scope:[main] from main::@1 + [8] return + to:@return +testSBytes: scope:[testSBytes] from main::@1 + [9] *((const signed byte*) testSBytes::SCREEN#0) ← ((signed byte))-(number) $c + [10] *((const signed byte*) testSBytes::SCREEN#0+(number) 1) ← ((signed byte))-(number) 6-(number) 6 + [11] *((const signed byte*) testSBytes::SCREEN#0+(number) 2) ← ((signed byte))-(number) $12+(number) 6 + [12] *((const signed byte*) testSBytes::SCREEN#0+(number) 3) ← ((signed byte))-(number) $714+(number) $708 + [13] *((const signed byte*) testSBytes::SCREEN#0+(number) 4) ← ((signed byte))-(number) 1-(number) 2-(number) 3-(number) 6 + [14] *((const signed byte*) testSBytes::SCREEN#0+(number) 5) ← ((signed byte))-(number) 2*(number) 6 + [15] *((const signed byte*) testSBytes::SCREEN#0+(number) 6) ← ((signed byte))-(number) 3<<(number) 2 + [16] *((const signed byte*) testSBytes::SCREEN#0+(number) 7) ← ((signed byte))-(number) $18>>(number) 1 + [17] *((const signed byte*) testSBytes::SCREEN#0+(number) 8) ← ((signed byte))-(number) 4&-(number) 9 + [18] *((const signed byte*) testSBytes::SCREEN#0+(number) 9) ← ((signed byte))-(number) $10|-(number) $fc + [19] *((const signed byte*) testSBytes::SCREEN#0+(number) $a) ← ((signed byte))-(number) 2-(number) 2*(number) $f/(number) 5 + [20] *((const signed byte*) testSBytes::SCREEN#0+(number) $b) ← ((signed byte))(number) $1000-(number) $c + to:testSBytes::@return +testSBytes::@return: scope:[testSBytes] from testSBytes + [21] return + to:@return +testBytes: scope:[testBytes] from main + [22] *((const byte*) testBytes::SCREEN#0) ← (byte) $c + [23] *((const byte*) testBytes::SCREEN#0+(number) 1) ← ((byte))(number) 6+(number) 6 + [24] *((const byte*) testBytes::SCREEN#0+(number) 2) ← ((byte))(number) $12-(number) 6 + [25] *((const byte*) testBytes::SCREEN#0+(number) 3) ← ((byte))(number) $714-(number) $708 + [26] *((const byte*) testBytes::SCREEN#0+(number) 4) ← ((byte))(number) 1+(number) 2+(number) 3+(number) 6 + [27] *((const byte*) testBytes::SCREEN#0+(number) 5) ← ((byte))(number) 2*(number) 6 + [28] *((const byte*) testBytes::SCREEN#0+(number) 6) ← ((byte))(number) 3<<(number) 2 + [29] *((const byte*) testBytes::SCREEN#0+(number) 7) ← ((byte))(number) $18>>(number) 1 + [30] *((const byte*) testBytes::SCREEN#0+(number) 8) ← ((byte))(number) $f&(number) $1c + [31] *((const byte*) testBytes::SCREEN#0+(number) 9) ← ((byte))(number) 4|(number) 8 + [32] *((const byte*) testBytes::SCREEN#0+(number) $a) ← ((byte))(number) 5^(number) 9 + [33] *((const byte*) testBytes::SCREEN#0+(number) $b) ← ((byte))(number) 2+(number) 2*(number) $f/(number) 5 + [34] *((const byte*) testBytes::SCREEN#0+(number) $c) ← ((byte))(number) $1000+(number) $c + to:testBytes::@return +testBytes::@return: scope:[testBytes] from testBytes + [35] return + to:@return diff --git a/src/test/ref/number-type.log b/src/test/ref/number-type.log new file mode 100644 index 000000000..55a8e6375 --- /dev/null +++ b/src/test/ref/number-type.log @@ -0,0 +1,1204 @@ +Adding pointer type conversion cast (byte*) testBytes::SCREEN in (byte*) testBytes::SCREEN ← (number) $400 +Adding pointer type conversion cast (signed byte*) testSBytes::SCREEN in (signed byte*) testSBytes::SCREEN ← (number) $428 + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + to:@3 +main: scope:[main] from @3 + call testBytes + to:main::@1 +main::@1: scope:[main] from main + call testSBytes + to:main::@2 +main::@2: scope:[main] from main::@1 + to:main::@return +main::@return: scope:[main] from main::@2 + return + to:@return +testBytes: scope:[testBytes] from main + (number) testBytes::$17 ← (number) $400 + (byte*) testBytes::SCREEN#0 ← ((byte*)) (number) testBytes::$17 + (byte) testBytes::idx#0 ← (number) 0 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#0) ← (number) $c + (byte) testBytes::idx#1 ← ++ (byte) testBytes::idx#0 + (number~) testBytes::$0 ← (number) 6 + (number) 6 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#1) ← (number~) testBytes::$0 + (byte) testBytes::idx#2 ← ++ (byte) testBytes::idx#1 + (number~) testBytes::$1 ← (number) $12 - (number) 6 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#2) ← (number~) testBytes::$1 + (byte) testBytes::idx#3 ← ++ (byte) testBytes::idx#2 + (number~) testBytes::$2 ← (number) $714 - (number) $708 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#3) ← (number~) testBytes::$2 + (byte) testBytes::idx#4 ← ++ (byte) testBytes::idx#3 + (number~) testBytes::$3 ← (number) 1 + (number) 2 + (number~) testBytes::$4 ← (number~) testBytes::$3 + (number) 3 + (number~) testBytes::$5 ← (number~) testBytes::$4 + (number) 6 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#4) ← (number~) testBytes::$5 + (byte) testBytes::idx#5 ← ++ (byte) testBytes::idx#4 + (number~) testBytes::$6 ← (number) 2 * (number) 6 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#5) ← (number~) testBytes::$6 + (byte) testBytes::idx#6 ← ++ (byte) testBytes::idx#5 + (number~) testBytes::$7 ← (number) 3 << (number) 2 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#6) ← (number~) testBytes::$7 + (byte) testBytes::idx#7 ← ++ (byte) testBytes::idx#6 + (number~) testBytes::$8 ← (number) $18 >> (number) 1 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#7) ← (number~) testBytes::$8 + (byte) testBytes::idx#8 ← ++ (byte) testBytes::idx#7 + (number~) testBytes::$9 ← (number) $f & (number) $1c + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#8) ← (number~) testBytes::$9 + (byte) testBytes::idx#9 ← ++ (byte) testBytes::idx#8 + (number~) testBytes::$10 ← (number) 4 | (number) 8 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#9) ← (number~) testBytes::$10 + (byte) testBytes::idx#10 ← ++ (byte) testBytes::idx#9 + (number~) testBytes::$11 ← (number) 5 ^ (number) 9 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#10) ← (number~) testBytes::$11 + (byte) testBytes::idx#11 ← ++ (byte) testBytes::idx#10 + (number~) testBytes::$12 ← (number) 2 + (number) 2 + (number~) testBytes::$13 ← (number) $f / (number) 5 + (number~) testBytes::$14 ← (number~) testBytes::$12 * (number~) testBytes::$13 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#11) ← (number~) testBytes::$14 + (byte) testBytes::idx#12 ← ++ (byte) testBytes::idx#11 + (number~) testBytes::$15 ← (number) $1000 + (number) $c + (byte~) testBytes::$16 ← ((byte)) (number~) testBytes::$15 + *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#12) ← (byte~) testBytes::$16 + (byte) testBytes::idx#13 ← ++ (byte) testBytes::idx#12 + to:testBytes::@return +testBytes::@return: scope:[testBytes] from testBytes + return + to:@return +testSBytes: scope:[testSBytes] from main::@1 + (number) testSBytes::$29 ← (number) $428 + (signed byte*) testSBytes::SCREEN#0 ← ((signed byte*)) (number) testSBytes::$29 + (byte) testSBytes::idx#0 ← (number) 0 + (number~) testSBytes::$0 ← - (number) $c + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#0) ← (number~) testSBytes::$0 + (byte) testSBytes::idx#1 ← ++ (byte) testSBytes::idx#0 + (number~) testSBytes::$1 ← - (number) 6 + (number~) testSBytes::$2 ← (number~) testSBytes::$1 - (number) 6 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#1) ← (number~) testSBytes::$2 + (byte) testSBytes::idx#2 ← ++ (byte) testSBytes::idx#1 + (number~) testSBytes::$3 ← - (number) $12 + (number~) testSBytes::$4 ← (number~) testSBytes::$3 + (number) 6 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#2) ← (number~) testSBytes::$4 + (byte) testSBytes::idx#3 ← ++ (byte) testSBytes::idx#2 + (number~) testSBytes::$5 ← - (number) $714 + (number~) testSBytes::$6 ← (number~) testSBytes::$5 + (number) $708 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#3) ← (number~) testSBytes::$6 + (byte) testSBytes::idx#4 ← ++ (byte) testSBytes::idx#3 + (number~) testSBytes::$7 ← - (number) 1 + (number~) testSBytes::$8 ← (number~) testSBytes::$7 - (number) 2 + (number~) testSBytes::$9 ← (number~) testSBytes::$8 - (number) 3 + (number~) testSBytes::$10 ← (number~) testSBytes::$9 - (number) 6 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#4) ← (number~) testSBytes::$10 + (byte) testSBytes::idx#5 ← ++ (byte) testSBytes::idx#4 + (number~) testSBytes::$11 ← - (number) 2 + (number~) testSBytes::$12 ← (number~) testSBytes::$11 * (number) 6 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#5) ← (number~) testSBytes::$12 + (byte) testSBytes::idx#6 ← ++ (byte) testSBytes::idx#5 + (number~) testSBytes::$13 ← - (number) 3 + (number~) testSBytes::$14 ← (number~) testSBytes::$13 << (number) 2 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#6) ← (number~) testSBytes::$14 + (byte) testSBytes::idx#7 ← ++ (byte) testSBytes::idx#6 + (number~) testSBytes::$15 ← - (number) $18 + (number~) testSBytes::$16 ← (number~) testSBytes::$15 >> (number) 1 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#7) ← (number~) testSBytes::$16 + (byte) testSBytes::idx#8 ← ++ (byte) testSBytes::idx#7 + (number~) testSBytes::$17 ← - (number) 4 + (number~) testSBytes::$18 ← - (number) 9 + (number~) testSBytes::$19 ← (number~) testSBytes::$17 & (number~) testSBytes::$18 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#8) ← (number~) testSBytes::$19 + (byte) testSBytes::idx#9 ← ++ (byte) testSBytes::idx#8 + (number~) testSBytes::$20 ← - (number) $10 + (number~) testSBytes::$21 ← - (number) $fc + (number~) testSBytes::$22 ← (number~) testSBytes::$20 | (number~) testSBytes::$21 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#9) ← (number~) testSBytes::$22 + (byte) testSBytes::idx#10 ← ++ (byte) testSBytes::idx#9 + (number~) testSBytes::$23 ← - (number) 2 + (number~) testSBytes::$24 ← (number~) testSBytes::$23 - (number) 2 + (number~) testSBytes::$25 ← (number) $f / (number) 5 + (number~) testSBytes::$26 ← (number~) testSBytes::$24 * (number~) testSBytes::$25 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#10) ← (number~) testSBytes::$26 + (byte) testSBytes::idx#11 ← ++ (byte) testSBytes::idx#10 + (number~) testSBytes::$27 ← (number) $1000 - (number) $c + (signed byte~) testSBytes::$28 ← ((signed byte)) (number~) testSBytes::$27 + *((signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#11) ← (signed byte~) testSBytes::$28 + (byte) testSBytes::idx#12 ← ++ (byte) testSBytes::idx#11 + to:testSBytes::@return +testSBytes::@return: scope:[testSBytes] from testSBytes + return + to:@return +@3: scope:[] from @begin + call main + to:@4 +@4: scope:[] from @3 + to:@end +@end: scope:[] from @4 + +SYMBOL TABLE SSA +(label) @3 +(label) @4 +(label) @begin +(label) @end +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@return +(void()) testBytes() +(number~) testBytes::$0 +(number~) testBytes::$1 +(number~) testBytes::$10 +(number~) testBytes::$11 +(number~) testBytes::$12 +(number~) testBytes::$13 +(number~) testBytes::$14 +(number~) testBytes::$15 +(byte~) testBytes::$16 +(number) testBytes::$17 +(number~) testBytes::$2 +(number~) testBytes::$3 +(number~) testBytes::$4 +(number~) testBytes::$5 +(number~) testBytes::$6 +(number~) testBytes::$7 +(number~) testBytes::$8 +(number~) testBytes::$9 +(label) testBytes::@return +(byte*) testBytes::SCREEN +(byte*) testBytes::SCREEN#0 +(byte) testBytes::idx +(byte) testBytes::idx#0 +(byte) testBytes::idx#1 +(byte) testBytes::idx#10 +(byte) testBytes::idx#11 +(byte) testBytes::idx#12 +(byte) testBytes::idx#13 +(byte) testBytes::idx#2 +(byte) testBytes::idx#3 +(byte) testBytes::idx#4 +(byte) testBytes::idx#5 +(byte) testBytes::idx#6 +(byte) testBytes::idx#7 +(byte) testBytes::idx#8 +(byte) testBytes::idx#9 +(void()) testSBytes() +(number~) testSBytes::$0 +(number~) testSBytes::$1 +(number~) testSBytes::$10 +(number~) testSBytes::$11 +(number~) testSBytes::$12 +(number~) testSBytes::$13 +(number~) testSBytes::$14 +(number~) testSBytes::$15 +(number~) testSBytes::$16 +(number~) testSBytes::$17 +(number~) testSBytes::$18 +(number~) testSBytes::$19 +(number~) testSBytes::$2 +(number~) testSBytes::$20 +(number~) testSBytes::$21 +(number~) testSBytes::$22 +(number~) testSBytes::$23 +(number~) testSBytes::$24 +(number~) testSBytes::$25 +(number~) testSBytes::$26 +(number~) testSBytes::$27 +(signed byte~) testSBytes::$28 +(number) testSBytes::$29 +(number~) testSBytes::$3 +(number~) testSBytes::$4 +(number~) testSBytes::$5 +(number~) testSBytes::$6 +(number~) testSBytes::$7 +(number~) testSBytes::$8 +(number~) testSBytes::$9 +(label) testSBytes::@return +(signed byte*) testSBytes::SCREEN +(signed byte*) testSBytes::SCREEN#0 +(byte) testSBytes::idx +(byte) testSBytes::idx#0 +(byte) testSBytes::idx#1 +(byte) testSBytes::idx#10 +(byte) testSBytes::idx#11 +(byte) testSBytes::idx#12 +(byte) testSBytes::idx#2 +(byte) testSBytes::idx#3 +(byte) testSBytes::idx#4 +(byte) testSBytes::idx#5 +(byte) testSBytes::idx#6 +(byte) testSBytes::idx#7 +(byte) testSBytes::idx#8 +(byte) testSBytes::idx#9 + +Adding number conversion cast (byte) 0 in (byte) testBytes::idx#0 ← (number) 0 +Adding number conversion cast (byte) $c in *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#0) ← (number) $c +Adding number conversion cast (byte) 0 in (byte) testSBytes::idx#0 ← (number) 0 +Culled Empty Block (label) main::@2 +Culled Empty Block (label) @4 +Successful SSA optimization Pass2CullEmptyBlocks +Constant right-side identified [5] (byte) testBytes::idx#0 ← ((byte)) (number) 0 +Constant right-side identified [6] *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#0) ← ((byte)) (number) $c +Constant right-side identified [8] (number~) testBytes::$0 ← (number) 6 + (number) 6 +Constant right-side identified [11] (number~) testBytes::$1 ← (number) $12 - (number) 6 +Constant right-side identified [14] (number~) testBytes::$2 ← (number) $714 - (number) $708 +Constant right-side identified [17] (number~) testBytes::$3 ← (number) 1 + (number) 2 +Constant right-side identified [22] (number~) testBytes::$6 ← (number) 2 * (number) 6 +Constant right-side identified [25] (number~) testBytes::$7 ← (number) 3 << (number) 2 +Constant right-side identified [28] (number~) testBytes::$8 ← (number) $18 >> (number) 1 +Constant right-side identified [31] (number~) testBytes::$9 ← (number) $f & (number) $1c +Constant right-side identified [34] (number~) testBytes::$10 ← (number) 4 | (number) 8 +Constant right-side identified [37] (number~) testBytes::$11 ← (number) 5 ^ (number) 9 +Constant right-side identified [40] (number~) testBytes::$12 ← (number) 2 + (number) 2 +Constant right-side identified [41] (number~) testBytes::$13 ← (number) $f / (number) 5 +Constant right-side identified [45] (number~) testBytes::$15 ← (number) $1000 + (number) $c +Constant right-side identified [52] (byte) testSBytes::idx#0 ← ((byte)) (number) 0 +Constant right-side identified [53] (number~) testSBytes::$0 ← - (number) $c +Constant right-side identified [56] (number~) testSBytes::$1 ← - (number) 6 +Constant right-side identified [60] (number~) testSBytes::$3 ← - (number) $12 +Constant right-side identified [64] (number~) testSBytes::$5 ← - (number) $714 +Constant right-side identified [68] (number~) testSBytes::$7 ← - (number) 1 +Constant right-side identified [74] (number~) testSBytes::$11 ← - (number) 2 +Constant right-side identified [78] (number~) testSBytes::$13 ← - (number) 3 +Constant right-side identified [82] (number~) testSBytes::$15 ← - (number) $18 +Constant right-side identified [86] (number~) testSBytes::$17 ← - (number) 4 +Constant right-side identified [87] (number~) testSBytes::$18 ← - (number) 9 +Constant right-side identified [91] (number~) testSBytes::$20 ← - (number) $10 +Constant right-side identified [92] (number~) testSBytes::$21 ← - (number) $fc +Constant right-side identified [96] (number~) testSBytes::$23 ← - (number) 2 +Constant right-side identified [98] (number~) testSBytes::$25 ← (number) $f / (number) 5 +Constant right-side identified [102] (number~) testSBytes::$27 ← (number) $1000 - (number) $c +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const number) testBytes::$17 = $400 +Constant (const byte) testBytes::idx#0 = ((byte))0 +Constant (const number) testBytes::$0 = 6+6 +Constant (const number) testBytes::$1 = $12-6 +Constant (const number) testBytes::$2 = $714-$708 +Constant (const number) testBytes::$3 = 1+2 +Constant (const number) testBytes::$6 = 2*6 +Constant (const number) testBytes::$7 = 3<<2 +Constant (const number) testBytes::$8 = $18>>1 +Constant (const number) testBytes::$9 = $f&$1c +Constant (const number) testBytes::$10 = 4|8 +Constant (const number) testBytes::$11 = 5^9 +Constant (const number) testBytes::$12 = 2+2 +Constant (const number) testBytes::$13 = $f/5 +Constant (const number) testBytes::$15 = $1000+$c +Constant (const number) testSBytes::$29 = $428 +Constant (const byte) testSBytes::idx#0 = ((byte))0 +Constant (const number) testSBytes::$0 = -$c +Constant (const number) testSBytes::$1 = -6 +Constant (const number) testSBytes::$3 = -$12 +Constant (const number) testSBytes::$5 = -$714 +Constant (const number) testSBytes::$7 = -1 +Constant (const number) testSBytes::$11 = -2 +Constant (const number) testSBytes::$13 = -3 +Constant (const number) testSBytes::$15 = -$18 +Constant (const number) testSBytes::$17 = -4 +Constant (const number) testSBytes::$18 = -9 +Constant (const number) testSBytes::$20 = -$10 +Constant (const number) testSBytes::$21 = -$fc +Constant (const number) testSBytes::$23 = -2 +Constant (const number) testSBytes::$25 = $f/5 +Constant (const number) testSBytes::$27 = $1000-$c +Successful SSA optimization Pass2ConstantIdentification +Eliminating unused variable (byte) testBytes::idx#13 and assignment [33] (byte) testBytes::idx#13 ← ++ (byte) testBytes::idx#12 +Eliminating unused variable (byte) testSBytes::idx#12 and assignment [73] (byte) testSBytes::idx#12 ← ++ (byte) testSBytes::idx#11 +Successful SSA optimization PassNEliminateUnusedVars +Simplifying constant integer cast $c +Adding number conversion cast (byte) testBytes::$0 in *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#1) ← (const number) testBytes::$0 +Adding number conversion cast (byte) testBytes::$1 in *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#2) ← (const number) testBytes::$1 +Adding number conversion cast (byte) testBytes::$2 in *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#3) ← (const number) testBytes::$2 +Adding number conversion cast (byte) testBytes::$6 in *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#5) ← (const number) testBytes::$6 +Adding number conversion cast (byte) testBytes::$7 in *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#6) ← (const number) testBytes::$7 +Adding number conversion cast (byte) testBytes::$8 in *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#7) ← (const number) testBytes::$8 +Adding number conversion cast (byte) testBytes::$9 in *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#8) ← (const number) testBytes::$9 +Adding number conversion cast (byte) testBytes::$10 in *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#9) ← (const number) testBytes::$10 +Adding number conversion cast (byte) testBytes::$11 in *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#10) ← (const number) testBytes::$11 +Adding number conversion cast (signed byte) testSBytes::$0 in *((signed byte*) testSBytes::SCREEN#0 + (const byte) testSBytes::idx#0) ← (const number) testSBytes::$0 +Constant right-side identified [3] (byte*) testBytes::SCREEN#0 ← ((byte*)) (const number) testBytes::$17 +Constant right-side identified [5] (byte) testBytes::idx#1 ← ++ (const byte) testBytes::idx#0 +Constant right-side identified [6] *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#1) ← ((byte)) (const number) testBytes::$0 +Constant right-side identified [8] *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#2) ← ((byte)) (const number) testBytes::$1 +Constant right-side identified [10] *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#3) ← ((byte)) (const number) testBytes::$2 +Constant right-side identified [12] (number~) testBytes::$4 ← (const number) testBytes::$3 + (number) 3 +Constant right-side identified [16] *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#5) ← ((byte)) (const number) testBytes::$6 +Constant right-side identified [18] *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#6) ← ((byte)) (const number) testBytes::$7 +Constant right-side identified [20] *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#7) ← ((byte)) (const number) testBytes::$8 +Constant right-side identified [22] *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#8) ← ((byte)) (const number) testBytes::$9 +Constant right-side identified [24] *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#9) ← ((byte)) (const number) testBytes::$10 +Constant right-side identified [26] *((byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#10) ← ((byte)) (const number) testBytes::$11 +Constant right-side identified [28] (number~) testBytes::$14 ← (const number) testBytes::$12 * (const number) testBytes::$13 +Constant right-side identified [31] (byte~) testBytes::$16 ← ((byte)) (const number) testBytes::$15 +Constant right-side identified [34] (signed byte*) testSBytes::SCREEN#0 ← ((signed byte*)) (const number) testSBytes::$29 +Constant right-side identified [35] *((signed byte*) testSBytes::SCREEN#0 + (const byte) testSBytes::idx#0) ← ((signed byte)) (const number) testSBytes::$0 +Constant right-side identified [36] (byte) testSBytes::idx#1 ← ++ (const byte) testSBytes::idx#0 +Constant right-side identified [37] (number~) testSBytes::$2 ← (const number) testSBytes::$1 - (number) 6 +Constant right-side identified [40] (number~) testSBytes::$4 ← (const number) testSBytes::$3 + (number) 6 +Constant right-side identified [43] (number~) testSBytes::$6 ← (const number) testSBytes::$5 + (number) $708 +Constant right-side identified [46] (number~) testSBytes::$8 ← (const number) testSBytes::$7 - (number) 2 +Constant right-side identified [51] (number~) testSBytes::$12 ← (const number) testSBytes::$11 * (number) 6 +Constant right-side identified [54] (number~) testSBytes::$14 ← (const number) testSBytes::$13 << (number) 2 +Constant right-side identified [57] (number~) testSBytes::$16 ← (const number) testSBytes::$15 >> (number) 1 +Constant right-side identified [60] (number~) testSBytes::$19 ← (const number) testSBytes::$17 & (const number) testSBytes::$18 +Constant right-side identified [63] (number~) testSBytes::$22 ← (const number) testSBytes::$20 | (const number) testSBytes::$21 +Constant right-side identified [66] (number~) testSBytes::$24 ← (const number) testSBytes::$23 - (number) 2 +Constant right-side identified [70] (signed byte~) testSBytes::$28 ← ((signed byte)) (const number) testSBytes::$27 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte*) testBytes::SCREEN#0 = ((byte*))testBytes::$17 +Constant (const byte) testBytes::idx#1 = ++testBytes::idx#0 +Constant (const number) testBytes::$4 = testBytes::$3+3 +Constant (const number) testBytes::$14 = testBytes::$12*testBytes::$13 +Constant (const byte) testBytes::$16 = ((byte))testBytes::$15 +Constant (const signed byte*) testSBytes::SCREEN#0 = ((signed byte*))testSBytes::$29 +Constant (const byte) testSBytes::idx#1 = ++testSBytes::idx#0 +Constant (const number) testSBytes::$2 = testSBytes::$1-6 +Constant (const number) testSBytes::$4 = testSBytes::$3+6 +Constant (const number) testSBytes::$6 = testSBytes::$5+$708 +Constant (const number) testSBytes::$8 = testSBytes::$7-2 +Constant (const number) testSBytes::$12 = testSBytes::$11*6 +Constant (const number) testSBytes::$14 = testSBytes::$13<<2 +Constant (const number) testSBytes::$16 = testSBytes::$15>>1 +Constant (const number) testSBytes::$19 = testSBytes::$17&testSBytes::$18 +Constant (const number) testSBytes::$22 = testSBytes::$20|testSBytes::$21 +Constant (const number) testSBytes::$24 = testSBytes::$23-2 +Constant (const signed byte) testSBytes::$28 = ((signed byte))testSBytes::$27 +Successful SSA optimization Pass2ConstantIdentification +Adding number conversion cast (byte) testBytes::$14 in *((const byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#11) ← (const number) testBytes::$14 +Adding number conversion cast (signed byte) testSBytes::$2 in *((const signed byte*) testSBytes::SCREEN#0 + (const byte) testSBytes::idx#1) ← (const number) testSBytes::$2 +Adding number conversion cast (signed byte) testSBytes::$4 in *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#2) ← (const number) testSBytes::$4 +Adding number conversion cast (signed byte) testSBytes::$6 in *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#3) ← (const number) testSBytes::$6 +Adding number conversion cast (signed byte) testSBytes::$12 in *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#5) ← (const number) testSBytes::$12 +Adding number conversion cast (signed byte) testSBytes::$14 in *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#6) ← (const number) testSBytes::$14 +Adding number conversion cast (signed byte) testSBytes::$16 in *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#7) ← (const number) testSBytes::$16 +Adding number conversion cast (signed byte) testSBytes::$19 in *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#8) ← (const number) testSBytes::$19 +Adding number conversion cast (signed byte) testSBytes::$22 in *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#9) ← (const number) testSBytes::$22 +Constant right-side identified [5] (byte) testBytes::idx#2 ← ++ (const byte) testBytes::idx#1 +Constant right-side identified [10] (number~) testBytes::$5 ← (const number) testBytes::$4 + (number) 6 +Constant right-side identified [25] *((const byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#11) ← ((byte)) (const number) testBytes::$14 +Constant right-side identified [30] *((const signed byte*) testSBytes::SCREEN#0 + (const byte) testSBytes::idx#1) ← ((signed byte)) (const number) testSBytes::$2 +Constant right-side identified [31] (byte) testSBytes::idx#2 ← ++ (const byte) testSBytes::idx#1 +Constant right-side identified [32] *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#2) ← ((signed byte)) (const number) testSBytes::$4 +Constant right-side identified [34] *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#3) ← ((signed byte)) (const number) testSBytes::$6 +Constant right-side identified [36] (number~) testSBytes::$9 ← (const number) testSBytes::$8 - (number) 3 +Constant right-side identified [40] *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#5) ← ((signed byte)) (const number) testSBytes::$12 +Constant right-side identified [42] *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#6) ← ((signed byte)) (const number) testSBytes::$14 +Constant right-side identified [44] *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#7) ← ((signed byte)) (const number) testSBytes::$16 +Constant right-side identified [46] *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#8) ← ((signed byte)) (const number) testSBytes::$19 +Constant right-side identified [48] *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#9) ← ((signed byte)) (const number) testSBytes::$22 +Constant right-side identified [50] (number~) testSBytes::$26 ← (const number) testSBytes::$24 * (const number) testSBytes::$25 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#2 = ++testBytes::idx#1 +Constant (const number) testBytes::$5 = testBytes::$4+6 +Constant (const byte) testSBytes::idx#2 = ++testSBytes::idx#1 +Constant (const number) testSBytes::$9 = testSBytes::$8-3 +Constant (const number) testSBytes::$26 = testSBytes::$24*testSBytes::$25 +Successful SSA optimization Pass2ConstantIdentification +Adding number conversion cast (byte) testBytes::$5 in *((const byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#4) ← (const number) testBytes::$5 +Adding number conversion cast (signed byte) testSBytes::$26 in *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#10) ← (const number) testSBytes::$26 +Constant right-side identified [6] (byte) testBytes::idx#3 ← ++ (const byte) testBytes::idx#2 +Constant right-side identified [9] *((const byte*) testBytes::SCREEN#0 + (byte) testBytes::idx#4) ← ((byte)) (const number) testBytes::$5 +Constant right-side identified [30] (byte) testSBytes::idx#3 ← ++ (const byte) testSBytes::idx#2 +Constant right-side identified [33] (number~) testSBytes::$10 ← (const number) testSBytes::$9 - (number) 6 +Constant right-side identified [46] *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#10) ← ((signed byte)) (const number) testSBytes::$26 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#3 = ++testBytes::idx#2 +Constant (const byte) testSBytes::idx#3 = ++testSBytes::idx#2 +Constant (const number) testSBytes::$10 = testSBytes::$9-6 +Successful SSA optimization Pass2ConstantIdentification +Adding number conversion cast (signed byte) testSBytes::$10 in *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#4) ← (const number) testSBytes::$10 +Constant right-side identified [7] (byte) testBytes::idx#4 ← ++ (const byte) testBytes::idx#3 +Constant right-side identified [30] (byte) testSBytes::idx#4 ← ++ (const byte) testSBytes::idx#3 +Constant right-side identified [31] *((const signed byte*) testSBytes::SCREEN#0 + (byte) testSBytes::idx#4) ← ((signed byte)) (const number) testSBytes::$10 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#4 = ++testBytes::idx#3 +Constant (const byte) testSBytes::idx#4 = ++testSBytes::idx#3 +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [8] (byte) testBytes::idx#5 ← ++ (const byte) testBytes::idx#4 +Constant right-side identified [30] (byte) testSBytes::idx#5 ← ++ (const byte) testSBytes::idx#4 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#5 = ++testBytes::idx#4 +Constant (const byte) testSBytes::idx#5 = ++testSBytes::idx#4 +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [9] (byte) testBytes::idx#6 ← ++ (const byte) testBytes::idx#5 +Constant right-side identified [30] (byte) testSBytes::idx#6 ← ++ (const byte) testSBytes::idx#5 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#6 = ++testBytes::idx#5 +Constant (const byte) testSBytes::idx#6 = ++testSBytes::idx#5 +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [10] (byte) testBytes::idx#7 ← ++ (const byte) testBytes::idx#6 +Constant right-side identified [30] (byte) testSBytes::idx#7 ← ++ (const byte) testSBytes::idx#6 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#7 = ++testBytes::idx#6 +Constant (const byte) testSBytes::idx#7 = ++testSBytes::idx#6 +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [11] (byte) testBytes::idx#8 ← ++ (const byte) testBytes::idx#7 +Constant right-side identified [30] (byte) testSBytes::idx#8 ← ++ (const byte) testSBytes::idx#7 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#8 = ++testBytes::idx#7 +Constant (const byte) testSBytes::idx#8 = ++testSBytes::idx#7 +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [12] (byte) testBytes::idx#9 ← ++ (const byte) testBytes::idx#8 +Constant right-side identified [30] (byte) testSBytes::idx#9 ← ++ (const byte) testSBytes::idx#8 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#9 = ++testBytes::idx#8 +Constant (const byte) testSBytes::idx#9 = ++testSBytes::idx#8 +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [13] (byte) testBytes::idx#10 ← ++ (const byte) testBytes::idx#9 +Constant right-side identified [30] (byte) testSBytes::idx#10 ← ++ (const byte) testSBytes::idx#9 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#10 = ++testBytes::idx#9 +Constant (const byte) testSBytes::idx#10 = ++testSBytes::idx#9 +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [14] (byte) testBytes::idx#11 ← ++ (const byte) testBytes::idx#10 +Constant right-side identified [30] (byte) testSBytes::idx#11 ← ++ (const byte) testSBytes::idx#10 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#11 = ++testBytes::idx#10 +Constant (const byte) testSBytes::idx#11 = ++testSBytes::idx#10 +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [15] (byte) testBytes::idx#12 ← ++ (const byte) testBytes::idx#11 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) testBytes::idx#12 = ++testBytes::idx#11 +Successful SSA optimization Pass2ConstantIdentification +Inlining constant with different constant siblings (const byte) testBytes::idx#0 +Inlining constant with different constant siblings (const byte) testBytes::idx#1 +Inlining constant with different constant siblings (const byte) testBytes::idx#2 +Inlining constant with different constant siblings (const byte) testBytes::idx#3 +Inlining constant with different constant siblings (const byte) testBytes::idx#4 +Inlining constant with different constant siblings (const byte) testBytes::idx#5 +Inlining constant with different constant siblings (const byte) testBytes::idx#6 +Inlining constant with different constant siblings (const byte) testBytes::idx#7 +Inlining constant with different constant siblings (const byte) testBytes::idx#8 +Inlining constant with different constant siblings (const byte) testBytes::idx#9 +Inlining constant with different constant siblings (const byte) testBytes::idx#10 +Inlining constant with different constant siblings (const byte) testBytes::idx#11 +Inlining constant with different constant siblings (const byte) testBytes::idx#12 +Inlining constant with different constant siblings (const byte) testSBytes::idx#0 +Inlining constant with different constant siblings (const byte) testSBytes::idx#1 +Inlining constant with different constant siblings (const byte) testSBytes::idx#2 +Inlining constant with different constant siblings (const byte) testSBytes::idx#3 +Inlining constant with different constant siblings (const byte) testSBytes::idx#4 +Inlining constant with different constant siblings (const byte) testSBytes::idx#5 +Inlining constant with different constant siblings (const byte) testSBytes::idx#6 +Inlining constant with different constant siblings (const byte) testSBytes::idx#7 +Inlining constant with different constant siblings (const byte) testSBytes::idx#8 +Inlining constant with different constant siblings (const byte) testSBytes::idx#9 +Inlining constant with different constant siblings (const byte) testSBytes::idx#10 +Inlining constant with different constant siblings (const byte) testSBytes::idx#11 +Constant inlined testBytes::idx#5 = ++++++++++((byte))(number) 0 +Constant inlined testBytes::idx#6 = ++++++++++++((byte))(number) 0 +Constant inlined testBytes::idx#3 = ++++++((byte))(number) 0 +Constant inlined testBytes::idx#4 = ++++++++((byte))(number) 0 +Constant inlined testBytes::idx#1 = ++((byte))(number) 0 +Constant inlined testBytes::idx#2 = ++++((byte))(number) 0 +Constant inlined testBytes::idx#0 = ((byte))(number) 0 +Constant inlined testBytes::idx#9 = ++++++++++++++++++((byte))(number) 0 +Constant inlined testBytes::idx#7 = ++++++++++++++((byte))(number) 0 +Constant inlined testBytes::idx#8 = ++++++++++++++++((byte))(number) 0 +Constant inlined testSBytes::$28 = ((signed byte))(number) $1000-(number) $c +Constant inlined testSBytes::$29 = (number) $428 +Constant inlined testSBytes::$7 = -(number) 1 +Constant inlined testSBytes::$6 = -(number) $714+(number) $708 +Constant inlined testSBytes::$9 = -(number) 1-(number) 2-(number) 3 +Constant inlined testSBytes::$8 = -(number) 1-(number) 2 +Constant inlined testSBytes::$3 = -(number) $12 +Constant inlined testSBytes::$2 = -(number) 6-(number) 6 +Constant inlined testSBytes::$5 = -(number) $714 +Constant inlined testSBytes::$4 = -(number) $12+(number) 6 +Constant inlined testSBytes::$1 = -(number) 6 +Constant inlined testSBytes::$0 = -(number) $c +Constant inlined testSBytes::$13 = -(number) 3 +Constant inlined testSBytes::$14 = -(number) 3<<(number) 2 +Constant inlined testSBytes::$15 = -(number) $18 +Constant inlined testSBytes::$16 = -(number) $18>>(number) 1 +Constant inlined testSBytes::$10 = -(number) 1-(number) 2-(number) 3-(number) 6 +Constant inlined testSBytes::$11 = -(number) 2 +Constant inlined testSBytes::$12 = -(number) 2*(number) 6 +Constant inlined testBytes::idx#12 = ++++++++++++++++++++++++((byte))(number) 0 +Constant inlined testBytes::$2 = (number) $714-(number) $708 +Constant inlined testBytes::$14 = (number) 2+(number) 2*(number) $f/(number) 5 +Constant inlined testSBytes::$24 = -(number) 2-(number) 2 +Constant inlined testBytes::idx#11 = ++++++++++++++++++++++((byte))(number) 0 +Constant inlined testBytes::$1 = (number) $12-(number) 6 +Constant inlined testBytes::$15 = (number) $1000+(number) $c +Constant inlined testSBytes::$25 = (number) $f/(number) 5 +Constant inlined testBytes::idx#10 = ++++++++++++++++++++((byte))(number) 0 +Constant inlined testBytes::$0 = (number) 6+(number) 6 +Constant inlined testBytes::$12 = (number) 2+(number) 2 +Constant inlined testSBytes::$26 = -(number) 2-(number) 2*(number) $f/(number) 5 +Constant inlined testBytes::$13 = (number) $f/(number) 5 +Constant inlined testSBytes::$27 = (number) $1000-(number) $c +Constant inlined testBytes::$10 = (number) 4|(number) 8 +Constant inlined testSBytes::$20 = -(number) $10 +Constant inlined testBytes::$11 = (number) 5^(number) 9 +Constant inlined testSBytes::$21 = -(number) $fc +Constant inlined testSBytes::$22 = -(number) $10|-(number) $fc +Constant inlined testSBytes::$23 = -(number) 2 +Constant inlined testBytes::$9 = (number) $f&(number) $1c +Constant inlined testBytes::$8 = (number) $18>>(number) 1 +Constant inlined testBytes::$7 = (number) 3<<(number) 2 +Constant inlined testSBytes::idx#10 = ++++++++++++++++++++((byte))(number) 0 +Constant inlined testBytes::$6 = (number) 2*(number) 6 +Constant inlined testBytes::$5 = (number) 1+(number) 2+(number) 3+(number) 6 +Constant inlined testBytes::$4 = (number) 1+(number) 2+(number) 3 +Constant inlined testBytes::$3 = (number) 1+(number) 2 +Constant inlined testSBytes::idx#9 = ++++++++++++++++++((byte))(number) 0 +Constant inlined testSBytes::idx#11 = ++++++++++++++++++++++((byte))(number) 0 +Constant inlined testSBytes::idx#8 = ++++++++++++++++((byte))(number) 0 +Constant inlined testSBytes::idx#5 = ++++++++++((byte))(number) 0 +Constant inlined testSBytes::idx#4 = ++++++++((byte))(number) 0 +Constant inlined testSBytes::idx#7 = ++++++++++++++((byte))(number) 0 +Constant inlined testSBytes::idx#6 = ++++++++++++((byte))(number) 0 +Constant inlined testSBytes::$17 = -(number) 4 +Constant inlined testSBytes::idx#1 = ++((byte))(number) 0 +Constant inlined testSBytes::$18 = -(number) 9 +Constant inlined testSBytes::idx#0 = ((byte))(number) 0 +Constant inlined testBytes::$16 = ((byte))(number) $1000+(number) $c +Constant inlined testSBytes::$19 = -(number) 4&-(number) 9 +Constant inlined testSBytes::idx#3 = ++++++((byte))(number) 0 +Constant inlined testBytes::$17 = (number) $400 +Constant inlined testSBytes::idx#2 = ++++((byte))(number) 0 +Successful SSA optimization Pass2ConstantInlining +Consolidated array index constant in *(testBytes::SCREEN#0+((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++++++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++++++++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++++++++++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++++++++++++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++++++++++++++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++++++++++++++++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++++++++++++++++++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++++++++++++++++++++((byte))0) +Consolidated array index constant in *(testBytes::SCREEN#0+++++++++++++++++++++++++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++++++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++++++++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++++++++++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++++++++++++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++++++++++++++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++++++++++++++++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++++++++++++++++++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++++++++++++++++++++((byte))0) +Consolidated array index constant in *(testSBytes::SCREEN#0+++++++++++++++++++++++((byte))0) +Successful SSA optimization Pass2ConstantAdditionElimination +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant plus zero testBytes::SCREEN#0+0 +Simplifying constant integer increment ++0 +Simplifying constant integer increment ++0 +Simplifying constant integer increment ++1 +Simplifying constant integer increment ++2 +Simplifying constant integer increment ++3 +Simplifying constant integer increment ++4 +Simplifying constant integer increment ++5 +Simplifying constant integer increment ++6 +Simplifying constant integer increment ++7 +Simplifying constant integer increment ++8 +Simplifying constant integer increment ++9 +Simplifying constant integer increment ++$a +Simplifying constant plus zero testSBytes::SCREEN#0+0 +Simplifying constant integer increment ++0 +Simplifying constant integer increment ++0 +Simplifying constant integer increment ++1 +Simplifying constant integer increment ++2 +Simplifying constant integer increment ++3 +Simplifying constant integer increment ++4 +Simplifying constant integer increment ++5 +Simplifying constant integer increment ++6 +Simplifying constant integer increment ++7 +Simplifying constant integer increment ++8 +Simplifying constant integer increment ++9 +Successful SSA optimization Pass2ConstantSimplification +Simplifying constant integer increment ++1 +Simplifying constant integer increment ++2 +Simplifying constant integer increment ++3 +Simplifying constant integer increment ++4 +Simplifying constant integer increment ++5 +Simplifying constant integer increment ++6 +Simplifying constant integer increment ++7 +Simplifying constant integer increment ++8 +Simplifying constant integer increment ++9 +Simplifying constant integer increment ++$a +Simplifying constant integer increment ++$b +Simplifying constant integer increment ++1 +Simplifying constant integer increment ++2 +Simplifying constant integer increment ++3 +Simplifying constant integer increment ++4 +Simplifying constant integer increment ++5 +Simplifying constant integer increment ++6 +Simplifying constant integer increment ++7 +Simplifying constant integer increment ++8 +Simplifying constant integer increment ++9 +Simplifying constant integer increment ++$a +Successful SSA optimization Pass2ConstantSimplification +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @3 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@1 +CALL GRAPH +Calls in [] to main:2 +Calls in [main] to testBytes:5 testSBytes:7 + +Created 0 initial phi equivalence classes +Coalesced down to 0 phi equivalence classes +Renumbering block @3 to @1 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@1 + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + [5] call testBytes + to:main::@1 +main::@1: scope:[main] from main + [6] phi() + [7] call testSBytes + to:main::@return +main::@return: scope:[main] from main::@1 + [8] return + to:@return +testSBytes: scope:[testSBytes] from main::@1 + [9] *((const signed byte*) testSBytes::SCREEN#0) ← ((signed byte))-(number) $c + [10] *((const signed byte*) testSBytes::SCREEN#0+(number) 1) ← ((signed byte))-(number) 6-(number) 6 + [11] *((const signed byte*) testSBytes::SCREEN#0+(number) 2) ← ((signed byte))-(number) $12+(number) 6 + [12] *((const signed byte*) testSBytes::SCREEN#0+(number) 3) ← ((signed byte))-(number) $714+(number) $708 + [13] *((const signed byte*) testSBytes::SCREEN#0+(number) 4) ← ((signed byte))-(number) 1-(number) 2-(number) 3-(number) 6 + [14] *((const signed byte*) testSBytes::SCREEN#0+(number) 5) ← ((signed byte))-(number) 2*(number) 6 + [15] *((const signed byte*) testSBytes::SCREEN#0+(number) 6) ← ((signed byte))-(number) 3<<(number) 2 + [16] *((const signed byte*) testSBytes::SCREEN#0+(number) 7) ← ((signed byte))-(number) $18>>(number) 1 + [17] *((const signed byte*) testSBytes::SCREEN#0+(number) 8) ← ((signed byte))-(number) 4&-(number) 9 + [18] *((const signed byte*) testSBytes::SCREEN#0+(number) 9) ← ((signed byte))-(number) $10|-(number) $fc + [19] *((const signed byte*) testSBytes::SCREEN#0+(number) $a) ← ((signed byte))-(number) 2-(number) 2*(number) $f/(number) 5 + [20] *((const signed byte*) testSBytes::SCREEN#0+(number) $b) ← ((signed byte))(number) $1000-(number) $c + to:testSBytes::@return +testSBytes::@return: scope:[testSBytes] from testSBytes + [21] return + to:@return +testBytes: scope:[testBytes] from main + [22] *((const byte*) testBytes::SCREEN#0) ← (byte) $c + [23] *((const byte*) testBytes::SCREEN#0+(number) 1) ← ((byte))(number) 6+(number) 6 + [24] *((const byte*) testBytes::SCREEN#0+(number) 2) ← ((byte))(number) $12-(number) 6 + [25] *((const byte*) testBytes::SCREEN#0+(number) 3) ← ((byte))(number) $714-(number) $708 + [26] *((const byte*) testBytes::SCREEN#0+(number) 4) ← ((byte))(number) 1+(number) 2+(number) 3+(number) 6 + [27] *((const byte*) testBytes::SCREEN#0+(number) 5) ← ((byte))(number) 2*(number) 6 + [28] *((const byte*) testBytes::SCREEN#0+(number) 6) ← ((byte))(number) 3<<(number) 2 + [29] *((const byte*) testBytes::SCREEN#0+(number) 7) ← ((byte))(number) $18>>(number) 1 + [30] *((const byte*) testBytes::SCREEN#0+(number) 8) ← ((byte))(number) $f&(number) $1c + [31] *((const byte*) testBytes::SCREEN#0+(number) 9) ← ((byte))(number) 4|(number) 8 + [32] *((const byte*) testBytes::SCREEN#0+(number) $a) ← ((byte))(number) 5^(number) 9 + [33] *((const byte*) testBytes::SCREEN#0+(number) $b) ← ((byte))(number) 2+(number) 2*(number) $f/(number) 5 + [34] *((const byte*) testBytes::SCREEN#0+(number) $c) ← ((byte))(number) $1000+(number) $c + to:testBytes::@return +testBytes::@return: scope:[testBytes] from testBytes + [35] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(void()) main() +(void()) testBytes() +(byte*) testBytes::SCREEN +(byte) testBytes::idx +(void()) testSBytes() +(signed byte*) testSBytes::SCREEN +(byte) testSBytes::idx + +Initial phi equivalence classes +Complete equivalence classes + +INITIAL ASM +//SEG0 File Comments +// Tests the number type used for constant expressions +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + //SEG11 [5] call testBytes + jsr testBytes + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + jmp b1 + //SEG13 main::@1 + b1: + //SEG14 [7] call testSBytes + jsr testSBytes + jmp breturn + //SEG15 main::@return + breturn: + //SEG16 [8] return + rts +} +//SEG17 testSBytes +testSBytes: { + // Constant values resolvable to signed bytes + .label SCREEN = $428 + //SEG18 [9] *((const signed byte*) testSBytes::SCREEN#0) ← ((signed byte))-(number) $c -- _deref_pbsc1=vbsc2 + lda #-$c + sta SCREEN + //SEG19 [10] *((const signed byte*) testSBytes::SCREEN#0+(number) 1) ← ((signed byte))-(number) 6-(number) 6 -- _deref_pbsc1=vbsc2 + lda #-6-6 + sta SCREEN+1 + //SEG20 [11] *((const signed byte*) testSBytes::SCREEN#0+(number) 2) ← ((signed byte))-(number) $12+(number) 6 -- _deref_pbsc1=vbsc2 + lda #-$12+6 + sta SCREEN+2 + //SEG21 [12] *((const signed byte*) testSBytes::SCREEN#0+(number) 3) ← ((signed byte))-(number) $714+(number) $708 -- _deref_pbsc1=vbsc2 + lda #-$714+$708 + sta SCREEN+3 + //SEG22 [13] *((const signed byte*) testSBytes::SCREEN#0+(number) 4) ← ((signed byte))-(number) 1-(number) 2-(number) 3-(number) 6 -- _deref_pbsc1=vbsc2 + lda #-1-2-3-6 + sta SCREEN+4 + //SEG23 [14] *((const signed byte*) testSBytes::SCREEN#0+(number) 5) ← ((signed byte))-(number) 2*(number) 6 -- _deref_pbsc1=vbsc2 + lda #-2*6 + sta SCREEN+5 + //SEG24 [15] *((const signed byte*) testSBytes::SCREEN#0+(number) 6) ← ((signed byte))-(number) 3<<(number) 2 -- _deref_pbsc1=vbsc2 + lda #-3<<2 + sta SCREEN+6 + //SEG25 [16] *((const signed byte*) testSBytes::SCREEN#0+(number) 7) ← ((signed byte))-(number) $18>>(number) 1 -- _deref_pbsc1=vbsc2 + lda #-$18>>1 + sta SCREEN+7 + //SEG26 [17] *((const signed byte*) testSBytes::SCREEN#0+(number) 8) ← ((signed byte))-(number) 4&-(number) 9 -- _deref_pbsc1=vbsc2 + lda #-4&-9 + sta SCREEN+8 + //SEG27 [18] *((const signed byte*) testSBytes::SCREEN#0+(number) 9) ← ((signed byte))-(number) $10|-(number) $fc -- _deref_pbsc1=vbsc2 + lda #-$10|-$fc + sta SCREEN+9 + //SEG28 [19] *((const signed byte*) testSBytes::SCREEN#0+(number) $a) ← ((signed byte))-(number) 2-(number) 2*(number) $f/(number) 5 -- _deref_pbsc1=vbsc2 + lda #(-2-2)*$f/5 + sta SCREEN+$a + //SEG29 [20] *((const signed byte*) testSBytes::SCREEN#0+(number) $b) ← ((signed byte))(number) $1000-(number) $c -- _deref_pbsc1=vbsc2 + lda #$ff&$1000-$c + sta SCREEN+$b + jmp breturn + //SEG30 testSBytes::@return + breturn: + //SEG31 [21] return + rts +} +//SEG32 testBytes +testBytes: { + // Constant values resolvable to bytes + .label SCREEN = $400 + //SEG33 [22] *((const byte*) testBytes::SCREEN#0) ← (byte) $c -- _deref_pbuc1=vbuc2 + lda #$c + sta SCREEN + //SEG34 [23] *((const byte*) testBytes::SCREEN#0+(number) 1) ← ((byte))(number) 6+(number) 6 -- _deref_pbuc1=vbuc2 + lda #6+6 + sta SCREEN+1 + //SEG35 [24] *((const byte*) testBytes::SCREEN#0+(number) 2) ← ((byte))(number) $12-(number) 6 -- _deref_pbuc1=vbuc2 + lda #$12-6 + sta SCREEN+2 + //SEG36 [25] *((const byte*) testBytes::SCREEN#0+(number) 3) ← ((byte))(number) $714-(number) $708 -- _deref_pbuc1=vbuc2 + lda #$714-$708 + sta SCREEN+3 + //SEG37 [26] *((const byte*) testBytes::SCREEN#0+(number) 4) ← ((byte))(number) 1+(number) 2+(number) 3+(number) 6 -- _deref_pbuc1=vbuc2 + lda #1+2+3+6 + sta SCREEN+4 + //SEG38 [27] *((const byte*) testBytes::SCREEN#0+(number) 5) ← ((byte))(number) 2*(number) 6 -- _deref_pbuc1=vbuc2 + lda #2*6 + sta SCREEN+5 + //SEG39 [28] *((const byte*) testBytes::SCREEN#0+(number) 6) ← ((byte))(number) 3<<(number) 2 -- _deref_pbuc1=vbuc2 + lda #3<<2 + sta SCREEN+6 + //SEG40 [29] *((const byte*) testBytes::SCREEN#0+(number) 7) ← ((byte))(number) $18>>(number) 1 -- _deref_pbuc1=vbuc2 + lda #$18>>1 + sta SCREEN+7 + //SEG41 [30] *((const byte*) testBytes::SCREEN#0+(number) 8) ← ((byte))(number) $f&(number) $1c -- _deref_pbuc1=vbuc2 + lda #$f&$1c + sta SCREEN+8 + //SEG42 [31] *((const byte*) testBytes::SCREEN#0+(number) 9) ← ((byte))(number) 4|(number) 8 -- _deref_pbuc1=vbuc2 + lda #4|8 + sta SCREEN+9 + //SEG43 [32] *((const byte*) testBytes::SCREEN#0+(number) $a) ← ((byte))(number) 5^(number) 9 -- _deref_pbuc1=vbuc2 + lda #5^9 + sta SCREEN+$a + //SEG44 [33] *((const byte*) testBytes::SCREEN#0+(number) $b) ← ((byte))(number) 2+(number) 2*(number) $f/(number) 5 -- _deref_pbuc1=vbuc2 + lda #(2+2)*$f/5 + sta SCREEN+$b + //SEG45 [34] *((const byte*) testBytes::SCREEN#0+(number) $c) ← ((byte))(number) $1000+(number) $c -- _deref_pbuc1=vbuc2 + lda #$ff&$1000+$c + sta SCREEN+$c + jmp breturn + //SEG46 testBytes::@return + breturn: + //SEG47 [35] return + rts +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [9] *((const signed byte*) testSBytes::SCREEN#0) ← ((signed byte))-(number) $c [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [10] *((const signed byte*) testSBytes::SCREEN#0+(number) 1) ← ((signed byte))-(number) 6-(number) 6 [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [11] *((const signed byte*) testSBytes::SCREEN#0+(number) 2) ← ((signed byte))-(number) $12+(number) 6 [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [12] *((const signed byte*) testSBytes::SCREEN#0+(number) 3) ← ((signed byte))-(number) $714+(number) $708 [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [13] *((const signed byte*) testSBytes::SCREEN#0+(number) 4) ← ((signed byte))-(number) 1-(number) 2-(number) 3-(number) 6 [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [14] *((const signed byte*) testSBytes::SCREEN#0+(number) 5) ← ((signed byte))-(number) 2*(number) 6 [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [15] *((const signed byte*) testSBytes::SCREEN#0+(number) 6) ← ((signed byte))-(number) 3<<(number) 2 [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [16] *((const signed byte*) testSBytes::SCREEN#0+(number) 7) ← ((signed byte))-(number) $18>>(number) 1 [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [17] *((const signed byte*) testSBytes::SCREEN#0+(number) 8) ← ((signed byte))-(number) 4&-(number) 9 [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [18] *((const signed byte*) testSBytes::SCREEN#0+(number) 9) ← ((signed byte))-(number) $10|-(number) $fc [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [19] *((const signed byte*) testSBytes::SCREEN#0+(number) $a) ← ((signed byte))-(number) 2-(number) 2*(number) $f/(number) 5 [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [20] *((const signed byte*) testSBytes::SCREEN#0+(number) $b) ← ((signed byte))(number) $1000-(number) $c [ ] ( main:2::testSBytes:7 [ ] ) always clobbers reg byte a +Statement [22] *((const byte*) testBytes::SCREEN#0) ← (byte) $c [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [23] *((const byte*) testBytes::SCREEN#0+(number) 1) ← ((byte))(number) 6+(number) 6 [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [24] *((const byte*) testBytes::SCREEN#0+(number) 2) ← ((byte))(number) $12-(number) 6 [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [25] *((const byte*) testBytes::SCREEN#0+(number) 3) ← ((byte))(number) $714-(number) $708 [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [26] *((const byte*) testBytes::SCREEN#0+(number) 4) ← ((byte))(number) 1+(number) 2+(number) 3+(number) 6 [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [27] *((const byte*) testBytes::SCREEN#0+(number) 5) ← ((byte))(number) 2*(number) 6 [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [28] *((const byte*) testBytes::SCREEN#0+(number) 6) ← ((byte))(number) 3<<(number) 2 [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [29] *((const byte*) testBytes::SCREEN#0+(number) 7) ← ((byte))(number) $18>>(number) 1 [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [30] *((const byte*) testBytes::SCREEN#0+(number) 8) ← ((byte))(number) $f&(number) $1c [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [31] *((const byte*) testBytes::SCREEN#0+(number) 9) ← ((byte))(number) 4|(number) 8 [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [32] *((const byte*) testBytes::SCREEN#0+(number) $a) ← ((byte))(number) 5^(number) 9 [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [33] *((const byte*) testBytes::SCREEN#0+(number) $b) ← ((byte))(number) 2+(number) 2*(number) $f/(number) 5 [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a +Statement [34] *((const byte*) testBytes::SCREEN#0+(number) $c) ← ((byte))(number) $1000+(number) $c [ ] ( main:2::testBytes:5 [ ] ) always clobbers reg byte a + +REGISTER UPLIFT SCOPES +Uplift Scope [main] +Uplift Scope [testBytes] +Uplift Scope [testSBytes] +Uplift Scope [] + +Uplifting [main] best 204 combination +Uplifting [testBytes] best 204 combination +Uplifting [testSBytes] best 204 combination +Uplifting [] best 204 combination + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 File Comments +// Tests the number type used for constant expressions +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + //SEG11 [5] call testBytes + jsr testBytes + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + jmp b1 + //SEG13 main::@1 + b1: + //SEG14 [7] call testSBytes + jsr testSBytes + jmp breturn + //SEG15 main::@return + breturn: + //SEG16 [8] return + rts +} +//SEG17 testSBytes +testSBytes: { + // Constant values resolvable to signed bytes + .label SCREEN = $428 + //SEG18 [9] *((const signed byte*) testSBytes::SCREEN#0) ← ((signed byte))-(number) $c -- _deref_pbsc1=vbsc2 + lda #-$c + sta SCREEN + //SEG19 [10] *((const signed byte*) testSBytes::SCREEN#0+(number) 1) ← ((signed byte))-(number) 6-(number) 6 -- _deref_pbsc1=vbsc2 + lda #-6-6 + sta SCREEN+1 + //SEG20 [11] *((const signed byte*) testSBytes::SCREEN#0+(number) 2) ← ((signed byte))-(number) $12+(number) 6 -- _deref_pbsc1=vbsc2 + lda #-$12+6 + sta SCREEN+2 + //SEG21 [12] *((const signed byte*) testSBytes::SCREEN#0+(number) 3) ← ((signed byte))-(number) $714+(number) $708 -- _deref_pbsc1=vbsc2 + lda #-$714+$708 + sta SCREEN+3 + //SEG22 [13] *((const signed byte*) testSBytes::SCREEN#0+(number) 4) ← ((signed byte))-(number) 1-(number) 2-(number) 3-(number) 6 -- _deref_pbsc1=vbsc2 + lda #-1-2-3-6 + sta SCREEN+4 + //SEG23 [14] *((const signed byte*) testSBytes::SCREEN#0+(number) 5) ← ((signed byte))-(number) 2*(number) 6 -- _deref_pbsc1=vbsc2 + lda #-2*6 + sta SCREEN+5 + //SEG24 [15] *((const signed byte*) testSBytes::SCREEN#0+(number) 6) ← ((signed byte))-(number) 3<<(number) 2 -- _deref_pbsc1=vbsc2 + lda #-3<<2 + sta SCREEN+6 + //SEG25 [16] *((const signed byte*) testSBytes::SCREEN#0+(number) 7) ← ((signed byte))-(number) $18>>(number) 1 -- _deref_pbsc1=vbsc2 + lda #-$18>>1 + sta SCREEN+7 + //SEG26 [17] *((const signed byte*) testSBytes::SCREEN#0+(number) 8) ← ((signed byte))-(number) 4&-(number) 9 -- _deref_pbsc1=vbsc2 + lda #-4&-9 + sta SCREEN+8 + //SEG27 [18] *((const signed byte*) testSBytes::SCREEN#0+(number) 9) ← ((signed byte))-(number) $10|-(number) $fc -- _deref_pbsc1=vbsc2 + lda #-$10|-$fc + sta SCREEN+9 + //SEG28 [19] *((const signed byte*) testSBytes::SCREEN#0+(number) $a) ← ((signed byte))-(number) 2-(number) 2*(number) $f/(number) 5 -- _deref_pbsc1=vbsc2 + lda #(-2-2)*$f/5 + sta SCREEN+$a + //SEG29 [20] *((const signed byte*) testSBytes::SCREEN#0+(number) $b) ← ((signed byte))(number) $1000-(number) $c -- _deref_pbsc1=vbsc2 + lda #$ff&$1000-$c + sta SCREEN+$b + jmp breturn + //SEG30 testSBytes::@return + breturn: + //SEG31 [21] return + rts +} +//SEG32 testBytes +testBytes: { + // Constant values resolvable to bytes + .label SCREEN = $400 + //SEG33 [22] *((const byte*) testBytes::SCREEN#0) ← (byte) $c -- _deref_pbuc1=vbuc2 + lda #$c + sta SCREEN + //SEG34 [23] *((const byte*) testBytes::SCREEN#0+(number) 1) ← ((byte))(number) 6+(number) 6 -- _deref_pbuc1=vbuc2 + lda #6+6 + sta SCREEN+1 + //SEG35 [24] *((const byte*) testBytes::SCREEN#0+(number) 2) ← ((byte))(number) $12-(number) 6 -- _deref_pbuc1=vbuc2 + lda #$12-6 + sta SCREEN+2 + //SEG36 [25] *((const byte*) testBytes::SCREEN#0+(number) 3) ← ((byte))(number) $714-(number) $708 -- _deref_pbuc1=vbuc2 + lda #$714-$708 + sta SCREEN+3 + //SEG37 [26] *((const byte*) testBytes::SCREEN#0+(number) 4) ← ((byte))(number) 1+(number) 2+(number) 3+(number) 6 -- _deref_pbuc1=vbuc2 + lda #1+2+3+6 + sta SCREEN+4 + //SEG38 [27] *((const byte*) testBytes::SCREEN#0+(number) 5) ← ((byte))(number) 2*(number) 6 -- _deref_pbuc1=vbuc2 + lda #2*6 + sta SCREEN+5 + //SEG39 [28] *((const byte*) testBytes::SCREEN#0+(number) 6) ← ((byte))(number) 3<<(number) 2 -- _deref_pbuc1=vbuc2 + lda #3<<2 + sta SCREEN+6 + //SEG40 [29] *((const byte*) testBytes::SCREEN#0+(number) 7) ← ((byte))(number) $18>>(number) 1 -- _deref_pbuc1=vbuc2 + lda #$18>>1 + sta SCREEN+7 + //SEG41 [30] *((const byte*) testBytes::SCREEN#0+(number) 8) ← ((byte))(number) $f&(number) $1c -- _deref_pbuc1=vbuc2 + lda #$f&$1c + sta SCREEN+8 + //SEG42 [31] *((const byte*) testBytes::SCREEN#0+(number) 9) ← ((byte))(number) 4|(number) 8 -- _deref_pbuc1=vbuc2 + lda #4|8 + sta SCREEN+9 + //SEG43 [32] *((const byte*) testBytes::SCREEN#0+(number) $a) ← ((byte))(number) 5^(number) 9 -- _deref_pbuc1=vbuc2 + lda #5^9 + sta SCREEN+$a + //SEG44 [33] *((const byte*) testBytes::SCREEN#0+(number) $b) ← ((byte))(number) 2+(number) 2*(number) $f/(number) 5 -- _deref_pbuc1=vbuc2 + lda #(2+2)*$f/5 + sta SCREEN+$b + //SEG45 [34] *((const byte*) testBytes::SCREEN#0+(number) $c) ← ((byte))(number) $1000+(number) $c -- _deref_pbuc1=vbuc2 + lda #$ff&$1000+$c + sta SCREEN+$c + jmp breturn + //SEG46 testBytes::@return + breturn: + //SEG47 [35] return + rts +} + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b1 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp breturn +Removing instruction jmp breturn +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction b1_from_bbegin: +Removing instruction b1: +Removing instruction main_from_b1: +Removing instruction bend_from_b1: +Removing instruction b1_from_main: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bend: +Removing instruction b1: +Removing instruction breturn: +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 +(void()) main() +(label) main::@1 +(label) main::@return +(void()) testBytes() +(label) testBytes::@return +(byte*) testBytes::SCREEN +(const byte*) testBytes::SCREEN#0 SCREEN = ((byte*))(number) $400 +(byte) testBytes::idx +(void()) testSBytes() +(label) testSBytes::@return +(signed byte*) testSBytes::SCREEN +(const signed byte*) testSBytes::SCREEN#0 SCREEN = ((signed byte*))(number) $428 +(byte) testSBytes::idx + + + +FINAL ASSEMBLER +Score: 180 + +//SEG0 File Comments +// Tests the number type used for constant expressions +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG2 Global Constants & labels +//SEG3 @begin +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +//SEG5 @1 +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +//SEG9 @end +//SEG10 main +main: { + //SEG11 [5] call testBytes + jsr testBytes + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + //SEG13 main::@1 + //SEG14 [7] call testSBytes + jsr testSBytes + //SEG15 main::@return + //SEG16 [8] return + rts +} +//SEG17 testSBytes +testSBytes: { + // Constant values resolvable to signed bytes + .label SCREEN = $428 + //SEG18 [9] *((const signed byte*) testSBytes::SCREEN#0) ← ((signed byte))-(number) $c -- _deref_pbsc1=vbsc2 + lda #-$c + sta SCREEN + //SEG19 [10] *((const signed byte*) testSBytes::SCREEN#0+(number) 1) ← ((signed byte))-(number) 6-(number) 6 -- _deref_pbsc1=vbsc2 + lda #-6-6 + sta SCREEN+1 + //SEG20 [11] *((const signed byte*) testSBytes::SCREEN#0+(number) 2) ← ((signed byte))-(number) $12+(number) 6 -- _deref_pbsc1=vbsc2 + lda #-$12+6 + sta SCREEN+2 + //SEG21 [12] *((const signed byte*) testSBytes::SCREEN#0+(number) 3) ← ((signed byte))-(number) $714+(number) $708 -- _deref_pbsc1=vbsc2 + lda #-$714+$708 + sta SCREEN+3 + //SEG22 [13] *((const signed byte*) testSBytes::SCREEN#0+(number) 4) ← ((signed byte))-(number) 1-(number) 2-(number) 3-(number) 6 -- _deref_pbsc1=vbsc2 + lda #-1-2-3-6 + sta SCREEN+4 + //SEG23 [14] *((const signed byte*) testSBytes::SCREEN#0+(number) 5) ← ((signed byte))-(number) 2*(number) 6 -- _deref_pbsc1=vbsc2 + lda #-2*6 + sta SCREEN+5 + //SEG24 [15] *((const signed byte*) testSBytes::SCREEN#0+(number) 6) ← ((signed byte))-(number) 3<<(number) 2 -- _deref_pbsc1=vbsc2 + lda #-3<<2 + sta SCREEN+6 + //SEG25 [16] *((const signed byte*) testSBytes::SCREEN#0+(number) 7) ← ((signed byte))-(number) $18>>(number) 1 -- _deref_pbsc1=vbsc2 + lda #-$18>>1 + sta SCREEN+7 + //SEG26 [17] *((const signed byte*) testSBytes::SCREEN#0+(number) 8) ← ((signed byte))-(number) 4&-(number) 9 -- _deref_pbsc1=vbsc2 + lda #-4&-9 + sta SCREEN+8 + //SEG27 [18] *((const signed byte*) testSBytes::SCREEN#0+(number) 9) ← ((signed byte))-(number) $10|-(number) $fc -- _deref_pbsc1=vbsc2 + lda #-$10|-$fc + sta SCREEN+9 + //SEG28 [19] *((const signed byte*) testSBytes::SCREEN#0+(number) $a) ← ((signed byte))-(number) 2-(number) 2*(number) $f/(number) 5 -- _deref_pbsc1=vbsc2 + lda #(-2-2)*$f/5 + sta SCREEN+$a + //SEG29 [20] *((const signed byte*) testSBytes::SCREEN#0+(number) $b) ← ((signed byte))(number) $1000-(number) $c -- _deref_pbsc1=vbsc2 + lda #$ff&$1000-$c + sta SCREEN+$b + //SEG30 testSBytes::@return + //SEG31 [21] return + rts +} +//SEG32 testBytes +testBytes: { + // Constant values resolvable to bytes + .label SCREEN = $400 + //SEG33 [22] *((const byte*) testBytes::SCREEN#0) ← (byte) $c -- _deref_pbuc1=vbuc2 + lda #$c + sta SCREEN + //SEG34 [23] *((const byte*) testBytes::SCREEN#0+(number) 1) ← ((byte))(number) 6+(number) 6 -- _deref_pbuc1=vbuc2 + lda #6+6 + sta SCREEN+1 + //SEG35 [24] *((const byte*) testBytes::SCREEN#0+(number) 2) ← ((byte))(number) $12-(number) 6 -- _deref_pbuc1=vbuc2 + lda #$12-6 + sta SCREEN+2 + //SEG36 [25] *((const byte*) testBytes::SCREEN#0+(number) 3) ← ((byte))(number) $714-(number) $708 -- _deref_pbuc1=vbuc2 + lda #$714-$708 + sta SCREEN+3 + //SEG37 [26] *((const byte*) testBytes::SCREEN#0+(number) 4) ← ((byte))(number) 1+(number) 2+(number) 3+(number) 6 -- _deref_pbuc1=vbuc2 + lda #1+2+3+6 + sta SCREEN+4 + //SEG38 [27] *((const byte*) testBytes::SCREEN#0+(number) 5) ← ((byte))(number) 2*(number) 6 -- _deref_pbuc1=vbuc2 + lda #2*6 + sta SCREEN+5 + //SEG39 [28] *((const byte*) testBytes::SCREEN#0+(number) 6) ← ((byte))(number) 3<<(number) 2 -- _deref_pbuc1=vbuc2 + lda #3<<2 + sta SCREEN+6 + //SEG40 [29] *((const byte*) testBytes::SCREEN#0+(number) 7) ← ((byte))(number) $18>>(number) 1 -- _deref_pbuc1=vbuc2 + lda #$18>>1 + sta SCREEN+7 + //SEG41 [30] *((const byte*) testBytes::SCREEN#0+(number) 8) ← ((byte))(number) $f&(number) $1c -- _deref_pbuc1=vbuc2 + lda #$f&$1c + sta SCREEN+8 + //SEG42 [31] *((const byte*) testBytes::SCREEN#0+(number) 9) ← ((byte))(number) 4|(number) 8 -- _deref_pbuc1=vbuc2 + lda #4|8 + sta SCREEN+9 + //SEG43 [32] *((const byte*) testBytes::SCREEN#0+(number) $a) ← ((byte))(number) 5^(number) 9 -- _deref_pbuc1=vbuc2 + lda #5^9 + sta SCREEN+$a + //SEG44 [33] *((const byte*) testBytes::SCREEN#0+(number) $b) ← ((byte))(number) 2+(number) 2*(number) $f/(number) 5 -- _deref_pbuc1=vbuc2 + lda #(2+2)*$f/5 + sta SCREEN+$b + //SEG45 [34] *((const byte*) testBytes::SCREEN#0+(number) $c) ← ((byte))(number) $1000+(number) $c -- _deref_pbuc1=vbuc2 + lda #$ff&$1000+$c + sta SCREEN+$c + //SEG46 testBytes::@return + //SEG47 [35] return + rts +} + diff --git a/src/test/ref/number-type.sym b/src/test/ref/number-type.sym new file mode 100644 index 000000000..fa464be74 --- /dev/null +++ b/src/test/ref/number-type.sym @@ -0,0 +1,17 @@ +(label) @1 +(label) @begin +(label) @end +(void()) main() +(label) main::@1 +(label) main::@return +(void()) testBytes() +(label) testBytes::@return +(byte*) testBytes::SCREEN +(const byte*) testBytes::SCREEN#0 SCREEN = ((byte*))(number) $400 +(byte) testBytes::idx +(void()) testSBytes() +(label) testSBytes::@return +(signed byte*) testSBytes::SCREEN +(const signed byte*) testSBytes::SCREEN#0 SCREEN = ((signed byte*))(number) $428 +(byte) testSBytes::idx +