mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-04-11 20:37:40 +00:00
Added array zero initializer and ASM .fill for arrays declared with a size but without initializer.
This commit is contained in:
parent
62a56f23fb
commit
19a040345f
55
src/main/java/dk/camelot64/kickc/asm/AsmDataFill.java
Normal file
55
src/main/java/dk/camelot64/kickc/asm/AsmDataFill.java
Normal file
@ -0,0 +1,55 @@
|
||||
package dk.camelot64.kickc.asm;
|
||||
|
||||
/** A labelled numeric data directive. */
|
||||
public class AsmDataFill implements AsmLine {
|
||||
|
||||
private String label;
|
||||
private AsmDataNumeric.Type type;
|
||||
private int size;
|
||||
private String fillValue;
|
||||
private int index;
|
||||
|
||||
|
||||
public AsmDataFill(String label, AsmDataNumeric.Type type, int size, String fillValue) {
|
||||
this.label = label;
|
||||
this.type = type;
|
||||
this.size = size;
|
||||
this.fillValue = fillValue;
|
||||
}
|
||||
|
||||
public int getElementBytes() {
|
||||
return type.bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLineBytes() {
|
||||
return size*getElementBytes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLineCycles() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsm() {
|
||||
StringBuilder asm = new StringBuilder();
|
||||
asm.append(label+": ");
|
||||
asm.append(".fill ");
|
||||
asm.append(size*type.bytes);
|
||||
asm.append(", ");
|
||||
asm.append(fillValue);
|
||||
return asm.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
}
|
@ -93,6 +93,17 @@ public class AsmProgram {
|
||||
addLine(new AsmDataNumeric(label, type, asmElements));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a FILL data declaration to the ASM
|
||||
* @param label The label of the data
|
||||
* @param type The type of the data
|
||||
* @param size The size of data to fill
|
||||
*/
|
||||
public void addDataFilled(String label, AsmDataNumeric.Type type, int size, String fillValue) {
|
||||
addLine(new AsmDataFill(label, type, size, fillValue));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a string data declaration tot the ASM
|
||||
* @param label The label of the data
|
||||
|
@ -166,7 +166,7 @@ public class AsmSegment {
|
||||
printState.decIndent();
|
||||
}
|
||||
out.append(printState.getIndent());
|
||||
if (line instanceof AsmComment || line instanceof AsmInstruction || line instanceof AsmLabelDecl || line instanceof AsmConstant || line instanceof AsmDataNumeric|| line instanceof AsmDataString) {
|
||||
if (line instanceof AsmComment || line instanceof AsmInstruction || line instanceof AsmLabelDecl || line instanceof AsmConstant || line instanceof AsmDataNumeric || line instanceof AsmDataFill || line instanceof AsmDataString) {
|
||||
out.append(" ");
|
||||
}
|
||||
out.append(line.getAsm() + "\n");
|
||||
|
@ -0,0 +1,44 @@
|
||||
package dk.camelot64.kickc.model;
|
||||
|
||||
/**
|
||||
* An zero-filled constant array. The array is allocated in the code memory (as a .fill() ).
|
||||
*/
|
||||
public class ConstantArrayFilled implements ConstantValue {
|
||||
|
||||
private int size;
|
||||
|
||||
private SymbolType elementType;
|
||||
|
||||
public ConstantArrayFilled(SymbolType elementType, int size) {
|
||||
this.size = size;
|
||||
this.elementType = elementType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SymbolType getType(ProgramScope scope) {
|
||||
return new SymbolTypeArray(elementType);
|
||||
}
|
||||
|
||||
public SymbolType getElementType() {
|
||||
return elementType;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Program program) {
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append("{ fill( ");
|
||||
out.append(size);
|
||||
out.append(", 0) }");
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
}
|
@ -5,13 +5,13 @@ import java.util.List;
|
||||
/**
|
||||
* An array of constants. The array is allocated in the code memory (eg. as a set of .byte's ).
|
||||
*/
|
||||
public class ConstantArray implements ConstantValue {
|
||||
public class ConstantArrayList implements ConstantValue {
|
||||
|
||||
private List<ConstantValue> list;
|
||||
|
||||
private SymbolType elementType;
|
||||
|
||||
public ConstantArray(List<ConstantValue> list, SymbolType elementType) {
|
||||
public ConstantArrayList(List<ConstantValue> list, SymbolType elementType) {
|
||||
this.list = list;
|
||||
this.elementType = elementType;
|
||||
}
|
@ -21,7 +21,10 @@ public class ConstantValueCalculator {
|
||||
} else if(value instanceof ConstantBinary) {
|
||||
ConstantBinary binary = (ConstantBinary) value;
|
||||
return calcValue(programScope, binary.getLeft(), binary.getOperator(), binary.getRight());
|
||||
} else if(value instanceof ConstantArray) {
|
||||
} else if(value instanceof ConstantArrayList) {
|
||||
// Cannot calculate value of inline array
|
||||
return null;
|
||||
} else if(value instanceof ConstantArrayFilled) {
|
||||
// Cannot calculate value of inline array
|
||||
return null;
|
||||
} else {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dk.camelot64.kickc.model;
|
||||
|
||||
/**
|
||||
* LValue containing an intermediate variable during parsing. Must be resolved to a proper LValue in Pass 1 - or result in failure
|
||||
* LValue containing an intermediate variable during parsing. Must be resolved to a proper LValue (pointer, array, lo/hi, ...) in Pass 1 - or result in failure
|
||||
*/
|
||||
public class LvalueIntermediate implements LValue {
|
||||
|
||||
|
@ -1,18 +1,16 @@
|
||||
package dk.camelot64.kickc.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/** A fixed size array of another type */
|
||||
/**
|
||||
* A fixed size array of another type
|
||||
*/
|
||||
public class SymbolTypeArray extends SymbolTypePointer {
|
||||
|
||||
/** The fixed size of the array. Can by null, if the type is not known yet. (It will be constant before the compilation is done) */
|
||||
/**
|
||||
* The fixed size of the array. Can by null, if the type is not known yet. (It will be constant before the compilation is done)
|
||||
*/
|
||||
private Integer size;
|
||||
|
||||
@JsonCreator
|
||||
public SymbolTypeArray(
|
||||
@JsonProperty("elementType") SymbolType elementType,
|
||||
@JsonProperty("size") int size) {
|
||||
public SymbolTypeArray(SymbolType elementType, Integer size) {
|
||||
super(elementType);
|
||||
this.size = size;
|
||||
}
|
||||
@ -22,7 +20,7 @@ public class SymbolTypeArray extends SymbolTypePointer {
|
||||
this.size = null;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
public Integer getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -34,17 +32,17 @@ public class SymbolTypeArray extends SymbolTypePointer {
|
||||
public String getTypeName() {
|
||||
SymbolType elementType = getElementType();
|
||||
if(elementType instanceof SymbolTypeInline) {
|
||||
return "("+elementType.getTypeName()+")"+"["+(size==null?"":size)+"]";
|
||||
}else {
|
||||
return elementType.getTypeName()+"["+(size==null?"":size)+"]";
|
||||
return "(" + elementType.getTypeName() + ")" + "[" + (size == null ? "" : size) + "]";
|
||||
} else {
|
||||
return elementType.getTypeName() + "[" + (size == null ? "" : size) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
if(this == o) return true;
|
||||
if(o == null || getClass() != o.getClass()) return false;
|
||||
if(!super.equals(o)) return false;
|
||||
|
||||
SymbolTypeArray that = (SymbolTypeArray) o;
|
||||
|
||||
|
@ -279,8 +279,10 @@ public class SymbolTypeInference {
|
||||
} else {
|
||||
throw new RuntimeException("Cannot infer pointer element type from pointer type " + pointerType);
|
||||
}
|
||||
} else if(rValue instanceof ConstantArray) {
|
||||
return new SymbolTypeArray(((ConstantArray) rValue).getElementType());
|
||||
} else if(rValue instanceof ConstantArrayList) {
|
||||
return new SymbolTypeArray(((ConstantArrayList) rValue).getElementType());
|
||||
} else if(rValue instanceof ConstantArrayFilled) {
|
||||
return new SymbolTypeArray(((ConstantArrayFilled) rValue).getElementType(), ((ConstantArrayFilled) rValue).getSize());
|
||||
}
|
||||
if(type == null) {
|
||||
throw new RuntimeException("Cannot infer type for " + rValue);
|
||||
@ -424,12 +426,12 @@ public class SymbolTypeInference {
|
||||
SymbolType type = inferType(programScope, assignment.getrValue1(), assignment.getOperator(), assignment.getrValue2());
|
||||
symbol.setTypeInferred(type);
|
||||
}
|
||||
}
|
||||
// If the type is an array or a string the symbol is constant
|
||||
if(symbol.getType() instanceof SymbolTypeArray) {
|
||||
symbol.setDeclaredConstant(true);
|
||||
} else if(SymbolType.STRING.equals(symbol.getType())) {
|
||||
symbol.setDeclaredConstant(true);
|
||||
// If the type is an array or a string the symbol is constant
|
||||
if(symbol.getType() instanceof SymbolTypeArray) {
|
||||
symbol.setDeclaredConstant(true);
|
||||
} else if(SymbolType.STRING.equals(symbol.getType())) {
|
||||
symbol.setDeclaredConstant(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,11 +56,11 @@ public class AliasReplacer implements ValueReplacer.Replacer {
|
||||
}
|
||||
return new ConstantBinary(aliasLeft, constantBinary.getOperator(), aliasRight);
|
||||
}
|
||||
} else if (rValue instanceof ConstantArray) {
|
||||
ConstantArray constantArray = (ConstantArray) rValue;
|
||||
} else if (rValue instanceof ConstantArrayList) {
|
||||
ConstantArrayList constantArrayList = (ConstantArrayList) rValue;
|
||||
ArrayList<ConstantValue> replacementList = new ArrayList<>();
|
||||
boolean any = false;
|
||||
for (ConstantValue elemValue : constantArray.getElements()) {
|
||||
for (ConstantValue elemValue : constantArrayList.getElements()) {
|
||||
RValue elemReplacement = getReplacement(elemValue, aliases);
|
||||
if (elemReplacement != null) {
|
||||
replacementList.add((ConstantValue) elemReplacement);
|
||||
@ -70,7 +70,7 @@ public class AliasReplacer implements ValueReplacer.Replacer {
|
||||
}
|
||||
}
|
||||
if (any) {
|
||||
return new ConstantArray(replacementList, constantArray.getElementType());
|
||||
return new ConstantArrayList(replacementList, constantArrayList.getElementType());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ public class Pass2ConstantIdentification extends Pass2SsaOptimization {
|
||||
}
|
||||
}
|
||||
if (allConstant && elementType != null) {
|
||||
ConstantValue constant = new ConstantArray(elements, elementType);
|
||||
ConstantValue constant = new ConstantArrayList(elements, elementType);
|
||||
constants.put(variable, constant);
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class Pass2ConstantInlining extends Pass2SsaOptimization {
|
||||
Collection<ConstantVar> allConstants = getProgram().getScope().getAllConstants(true);
|
||||
for (ConstantVar constant : allConstants) {
|
||||
if(constant.getRef().isIntermediate()) {
|
||||
if(!(constant.getType().equals(SymbolType.STRING)) && !(constant.getValue() instanceof ConstantArray)) {
|
||||
if(!(constant.getType().equals(SymbolType.STRING)) && !(constant.getValue() instanceof ConstantArrayList)&& !(constant.getValue() instanceof ConstantArrayFilled)) {
|
||||
unnamed.put(constant.getRef(), constant.getValue());
|
||||
}
|
||||
}
|
||||
@ -144,7 +144,7 @@ public class Pass2ConstantInlining extends Pass2SsaOptimization {
|
||||
// break;
|
||||
} else if(symbol instanceof ConstantVar) {
|
||||
ConstantValue otherValue = ((ConstantVar) symbol).getValue();
|
||||
if(!otherValue.equals(value) && !(value instanceof ConstantString) && !(value instanceof ConstantArray) && !(otherValue instanceof ConstantRef)) {
|
||||
if(!otherValue.equals(value) && !(value instanceof ConstantString) && !(value instanceof ConstantArrayList) && !(value instanceof ConstantArrayFilled) && !(otherValue instanceof ConstantRef)) {
|
||||
aliases.put(constant.getRef(), value);
|
||||
getLog().append("Inlining constant with different constant siblings "+constant);
|
||||
// break;
|
||||
|
@ -104,7 +104,7 @@ public class Pass4CodeGeneration {
|
||||
Collection<ConstantVar> scopeConstants = scope.getAllConstants(false);
|
||||
Set<String> added = new LinkedHashSet<>();
|
||||
for (ConstantVar constantVar : scopeConstants) {
|
||||
if(! (constantVar.getValue() instanceof ConstantArray || constantVar.getType().equals(SymbolType.STRING))) {
|
||||
if(!(constantVar.getValue() instanceof ConstantArrayList || constantVar.getValue() instanceof ConstantArrayFilled|| constantVar.getType().equals(SymbolType.STRING))) {
|
||||
String asmName = constantVar.getAsmName() == null ? constantVar.getLocalName() : constantVar.getAsmName();
|
||||
if (asmName != null && !added.contains(asmName)) {
|
||||
asm.addConstant(asmName.replace("#", "_").replace("$", "_"), AsmFragment.getAsmConstant(program, constantVar.getValue(), 99, scopeRef));
|
||||
@ -125,22 +125,31 @@ public class Pass4CodeGeneration {
|
||||
Collection<ConstantVar> scopeConstants = scope.getAllConstants(false);
|
||||
Set<String> added = new LinkedHashSet<>();
|
||||
for (ConstantVar constantVar : scopeConstants) {
|
||||
if(constantVar.getValue() instanceof ConstantArray) {
|
||||
ConstantArray constantArray = (ConstantArray) constantVar.getValue();
|
||||
if(constantVar.getValue() instanceof ConstantArrayList) {
|
||||
ConstantArrayList constantArrayList = (ConstantArrayList) constantVar.getValue();
|
||||
String asmName = constantVar.getAsmName() == null ? constantVar.getLocalName() : constantVar.getAsmName();
|
||||
if (asmName != null && !added.contains(asmName)) {
|
||||
List<String> asmElements = new ArrayList<>();
|
||||
for (ConstantValue element : constantArray.getElements()) {
|
||||
for (ConstantValue element : constantArrayList.getElements()) {
|
||||
String asmElement = AsmFragment.getAsmConstant(program, element, 99, scopeRef);
|
||||
asmElements.add(asmElement);
|
||||
}
|
||||
if(SymbolType.isByte(constantArray.getElementType())) {
|
||||
if(SymbolType.isByte(constantArrayList.getElementType())) {
|
||||
asm.addDataNumeric(asmName.replace("#", "_").replace("$", "_"), AsmDataNumeric.Type.BYTE, asmElements);
|
||||
added.add(asmName);
|
||||
} else {
|
||||
throw new RuntimeException("Unhandled constant array element type "+constantArray.toString(program));
|
||||
throw new RuntimeException("Unhandled constant array element type "+ constantArrayList.toString(program));
|
||||
}
|
||||
}
|
||||
} else if(constantVar.getValue() instanceof ConstantArrayFilled) {
|
||||
String asmName = constantVar.getAsmName() == null ? constantVar.getLocalName() : constantVar.getAsmName();
|
||||
ConstantArrayFilled constantArrayFilled = (ConstantArrayFilled) constantVar.getValue();
|
||||
if(SymbolType.isByte(constantArrayFilled.getElementType())) {
|
||||
asm.addDataFilled(asmName.replace("#", "_").replace("$", "_"), AsmDataNumeric.Type.BYTE, constantArrayFilled.getSize(), "0");
|
||||
added.add(asmName);
|
||||
} else {
|
||||
throw new RuntimeException("Unhandled constant array element type "+ constantArrayFilled.toString(program));
|
||||
}
|
||||
} else if(constantVar.getType().equals(SymbolType.STRING)) {
|
||||
String asmName = constantVar.getAsmName() == null ? constantVar.getLocalName() : constantVar.getAsmName();
|
||||
String asmConstant = AsmFragment.getAsmConstant(program, constantVar.getValue(), 99, scopeRef);
|
||||
|
@ -36,7 +36,7 @@ public class Pass5DoubleJumpElimination extends Pass5AsmOptimization {
|
||||
currentLabel = ((AsmLabel) line).getLabel();
|
||||
} else if (line instanceof AsmComment || line instanceof AsmConstant || line instanceof AsmLabelDecl) {
|
||||
// ignore
|
||||
} else if (line instanceof AsmBasicUpstart || line instanceof AsmDataNumeric || line instanceof AsmDataString || line instanceof AsmSetPc) {
|
||||
} else if (line instanceof AsmBasicUpstart || line instanceof AsmDataNumeric || line instanceof AsmDataFill || line instanceof AsmDataString || line instanceof AsmSetPc) {
|
||||
currentLabel = null;
|
||||
} else if (line instanceof AsmInstruction) {
|
||||
if (currentLabel != null) {
|
||||
|
@ -293,12 +293,14 @@ public class PassNVariableReferenceInfos extends Pass2Base {
|
||||
used.addAll(getReferenced(((ConstantBinary) rValue).getLeft()));
|
||||
used.addAll(getReferenced(((ConstantBinary) rValue).getRight()));
|
||||
return used;
|
||||
} else if (rValue instanceof ConstantArray) {
|
||||
} else if (rValue instanceof ConstantArrayList) {
|
||||
Collection<SymbolRef> used = new LinkedHashSet<>();
|
||||
for(ConstantValue elem : ((ConstantArray) rValue).getElements()) {
|
||||
for(ConstantValue elem : ((ConstantArrayList) rValue).getElements()) {
|
||||
used.addAll(getReferenced(elem));
|
||||
}
|
||||
return used;
|
||||
} else if (rValue instanceof ConstantArrayFilled) {
|
||||
return new ArrayList<>();
|
||||
} else if (rValue instanceof ConstantUnary) {
|
||||
return getReferenced(((ConstantUnary) rValue).getOperand());
|
||||
} else if (rValue instanceof ConstantRef) {
|
||||
|
@ -33,8 +33,8 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
}
|
||||
|
||||
private Procedure getCurrentProcedure() {
|
||||
for (Scope scope : scopeStack) {
|
||||
if (scope instanceof Procedure) {
|
||||
for(Scope scope : scopeStack) {
|
||||
if(scope instanceof Procedure) {
|
||||
return (Procedure) scope;
|
||||
}
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
|
||||
@Override
|
||||
public Object visitImportSeq(KickCParser.ImportSeqContext ctx) {
|
||||
for (KickCParser.ImportDeclContext importDeclContext : ctx.importDecl()) {
|
||||
for(KickCParser.ImportDeclContext importDeclContext : ctx.importDecl()) {
|
||||
this.visit(importDeclContext);
|
||||
}
|
||||
return null;
|
||||
@ -64,14 +64,14 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
public Object visitImportDecl(KickCParser.ImportDeclContext ctx) {
|
||||
String importName = ctx.STRING().getText();
|
||||
String importFileName = importName.substring(1, importName.length() - 1);
|
||||
program.getLog().append("Importing "+ importFileName);
|
||||
program.getLog().append("Importing " + importFileName);
|
||||
Compiler.loadAndParseFile(importFileName, program, this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visitDeclSeq(KickCParser.DeclSeqContext ctx) {
|
||||
for (KickCParser.DeclContext declContext : ctx.decl()) {
|
||||
for(KickCParser.DeclContext declContext : ctx.decl()) {
|
||||
this.visit(declContext);
|
||||
}
|
||||
return null;
|
||||
@ -85,24 +85,24 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
scopeStack.push(procedure);
|
||||
Label procExit = procedure.addLabel(SymbolRef.PROCEXIT_BLOCK_NAME);
|
||||
VariableUnversioned returnVar = null;
|
||||
if (!SymbolType.VOID.equals(type)) {
|
||||
if(!SymbolType.VOID.equals(type)) {
|
||||
returnVar = procedure.addVariable("return", type);
|
||||
}
|
||||
List<Variable> parameterList = new ArrayList<>();
|
||||
if (ctx.parameterListDecl() != null) {
|
||||
if(ctx.parameterListDecl() != null) {
|
||||
parameterList = (List<Variable>) this.visit(ctx.parameterListDecl());
|
||||
}
|
||||
procedure.setParameters(parameterList);
|
||||
sequence.addStatement(new StatementProcedureBegin(procedure.getRef()));
|
||||
if (ctx.stmtSeq() != null) {
|
||||
if(ctx.stmtSeq() != null) {
|
||||
this.visit(ctx.stmtSeq());
|
||||
}
|
||||
sequence.addStatement(new StatementLabel(procExit.getRef()));
|
||||
if (returnVar != null) {
|
||||
if(returnVar != null) {
|
||||
sequence.addStatement(new StatementAssignment(returnVar, returnVar));
|
||||
}
|
||||
VariableRef returnVarRef = null;
|
||||
if (returnVar != null) {
|
||||
if(returnVar != null) {
|
||||
returnVarRef = returnVar.getRef();
|
||||
}
|
||||
sequence.addStatement(new StatementReturn(returnVarRef));
|
||||
@ -114,7 +114,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
@Override
|
||||
public List<Variable> visitParameterListDecl(KickCParser.ParameterListDeclContext ctx) {
|
||||
ArrayList<Variable> parameterDecls = new ArrayList<>();
|
||||
for (KickCParser.ParameterDeclContext parameterDeclCtx : ctx.parameterDecl()) {
|
||||
for(KickCParser.ParameterDeclContext parameterDeclCtx : ctx.parameterDecl()) {
|
||||
Variable parameterDecl = (Variable) this.visit(parameterDeclCtx);
|
||||
parameterDecls.add(parameterDecl);
|
||||
}
|
||||
@ -139,19 +139,31 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
SymbolType type = (SymbolType) visit(ctx.typeDecl());
|
||||
String varName = ctx.NAME().getText();
|
||||
VariableUnversioned lValue = getCurrentSymbols().addVariable(varName, type);
|
||||
if (ctx.getChild(0).getText().equals("const")) {
|
||||
if(ctx.getChild(0).getText().equals("const")) {
|
||||
lValue.setDeclaredConstant(true);
|
||||
}
|
||||
if(type instanceof SymbolTypeArray || type.equals(SymbolType.STRING)) {
|
||||
lValue.setDeclaredConstant(true);
|
||||
}
|
||||
KickCParser.ExprContext initializer = ctx.expr();
|
||||
if (initializer != null) {
|
||||
if(initializer != null) {
|
||||
addInitialAssignment(initializer, lValue);
|
||||
} else if(type instanceof SymbolTypeArray) {
|
||||
// Add an zero-array initializer
|
||||
SymbolTypeArray typeArray = (SymbolTypeArray) type;
|
||||
Integer size = typeArray.getSize();
|
||||
if(size==null) {
|
||||
throw new CompileError("Error! Cannot determine array size. "+lValue.toString(program));
|
||||
}
|
||||
Statement stmt = new StatementAssignment(lValue, new ConstantArrayFilled(typeArray.getElementType(), size));
|
||||
sequence.addStatement(stmt);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitStmtSeq(KickCParser.StmtSeqContext ctx) {
|
||||
for (int i = 0; i < ctx.getChildCount(); i++) {
|
||||
for(int i = 0; i < ctx.getChildCount(); i++) {
|
||||
this.visit(ctx.stmt(i));
|
||||
}
|
||||
return null;
|
||||
@ -159,7 +171,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
|
||||
@Override
|
||||
public Void visitStmtBlock(KickCParser.StmtBlockContext ctx) {
|
||||
if (ctx.stmtSeq() != null) {
|
||||
if(ctx.stmtSeq() != null) {
|
||||
this.visit(ctx.stmtSeq());
|
||||
}
|
||||
return null;
|
||||
@ -187,7 +199,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
this.visit(ctx.stmt(0));
|
||||
|
||||
KickCParser.StmtContext elseStmt = ctx.stmt(1);
|
||||
if (elseStmt != null) {
|
||||
if(elseStmt != null) {
|
||||
// There is an else statement - add the else part and any needed labels/jumps
|
||||
Label endJumpLabel = getCurrentSymbols().addLabelIntermediate();
|
||||
Statement endJmpStmt = new StatementJump(endJumpLabel.getRef());
|
||||
@ -234,7 +246,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
Label beginJumpLabel = getCurrentSymbols().addLabelIntermediate();
|
||||
StatementLabel beginJumpTarget = new StatementLabel(beginJumpLabel.getRef());
|
||||
sequence.addStatement(beginJumpTarget);
|
||||
if (ctx.stmt() != null) {
|
||||
if(ctx.stmt() != null) {
|
||||
this.visit(ctx.stmt());
|
||||
}
|
||||
PrePostModifierHandler.addPreModifiers(this, ctx.expr());
|
||||
@ -263,14 +275,14 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
// Create and assign declared loop variable
|
||||
String varName = forDeclCtx.NAME().getText();
|
||||
Variable lValue;
|
||||
if (forDeclCtx.typeDecl() != null) {
|
||||
if(forDeclCtx.typeDecl() != null) {
|
||||
SymbolType type = (SymbolType) visit(forDeclCtx.typeDecl());
|
||||
lValue = getCurrentSymbols().addVariable(varName, type);
|
||||
} else {
|
||||
lValue = getCurrentSymbols().getVariable(varName);
|
||||
}
|
||||
KickCParser.ExprContext initializer = forDeclCtx.expr();
|
||||
if (initializer != null) {
|
||||
if(initializer != null) {
|
||||
addInitialAssignment(initializer, lValue);
|
||||
}
|
||||
// Add label
|
||||
@ -278,11 +290,11 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
StatementLabel repeatTarget = new StatementLabel(repeatLabel.getRef());
|
||||
sequence.addStatement(repeatTarget);
|
||||
// Add body
|
||||
if (stmtForCtx.stmt() != null) {
|
||||
if(stmtForCtx.stmt() != null) {
|
||||
this.visit(stmtForCtx.stmt());
|
||||
}
|
||||
// Add increment
|
||||
if (ctx.expr(1) != null) {
|
||||
if(ctx.expr(1) != null) {
|
||||
PrePostModifierHandler.addPreModifiers(this, ctx.expr(1));
|
||||
this.visit(ctx.expr(1));
|
||||
PrePostModifierHandler.addPostModifiers(this, ctx.expr(1));
|
||||
@ -304,7 +316,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
// Create declared loop variable
|
||||
String varName = forDeclCtx.NAME().getText();
|
||||
Variable lValue;
|
||||
if (forDeclCtx.typeDecl() != null) {
|
||||
if(forDeclCtx.typeDecl() != null) {
|
||||
SymbolType type = (SymbolType) visit(forDeclCtx.typeDecl());
|
||||
lValue = getCurrentSymbols().addVariable(varName, type);
|
||||
} else {
|
||||
@ -324,15 +336,15 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
StatementLabel repeatTarget = new StatementLabel(repeatLabel.getRef());
|
||||
sequence.addStatement(repeatTarget);
|
||||
// Add body
|
||||
if (stmtForCtx.stmt() != null) {
|
||||
if(stmtForCtx.stmt() != null) {
|
||||
this.visit(stmtForCtx.stmt());
|
||||
}
|
||||
// Add increment
|
||||
ConstantInteger beyondLastVal;
|
||||
if (rangeFirst.getNumber() > rangeLast.getNumber()) {
|
||||
if(rangeFirst.getNumber() > rangeLast.getNumber()) {
|
||||
Statement stmtInc = new StatementAssignment(lValue.getRef(), Operator.DECREMENT, lValue.getRef());
|
||||
sequence.addStatement(stmtInc);
|
||||
if (rangeLast.getNumber() == 0) {
|
||||
if(rangeLast.getNumber() == 0) {
|
||||
beyondLastVal = new ConstantInteger(255);
|
||||
} else {
|
||||
beyondLastVal = new ConstantInteger(rangeLast.getNumber() - 1);
|
||||
@ -340,7 +352,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
} else {
|
||||
Statement stmtInc = new StatementAssignment(lValue.getRef(), Operator.INCREMENT, lValue.getRef());
|
||||
sequence.addStatement(stmtInc);
|
||||
if (rangeLast.getNumber() == 255) {
|
||||
if(rangeLast.getNumber() == 255) {
|
||||
beyondLastVal = new ConstantInteger(0);
|
||||
} else {
|
||||
beyondLastVal = new ConstantInteger(rangeLast.getNumber() + 1);
|
||||
@ -370,7 +382,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
Procedure procedure = getCurrentProcedure();
|
||||
KickCParser.ExprContext exprCtx = ctx.expr();
|
||||
RValue rValue;
|
||||
if (exprCtx != null) {
|
||||
if(exprCtx != null) {
|
||||
PrePostModifierHandler.addPreModifiers(this, exprCtx);
|
||||
rValue = (RValue) this.visit(exprCtx);
|
||||
Variable returnVar = procedure.getVariable("return");
|
||||
@ -399,7 +411,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
@Override
|
||||
public RValue visitInitList(KickCParser.InitListContext ctx) {
|
||||
List<RValue> initValues = new ArrayList<>();
|
||||
for (KickCParser.ExprContext initializer : ctx.expr()) {
|
||||
for(KickCParser.ExprContext initializer : ctx.expr()) {
|
||||
RValue rValue = (RValue) visit(initializer);
|
||||
initValues.add(rValue);
|
||||
}
|
||||
@ -425,9 +437,9 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
@Override
|
||||
public SymbolType visitTypeArray(KickCParser.TypeArrayContext ctx) {
|
||||
SymbolType elementType = (SymbolType) visit(ctx.typeDecl());
|
||||
if (ctx.expr() != null) {
|
||||
if(ctx.expr() != null) {
|
||||
ConstantValue size = ParseTreeConstantEvaluator.evaluate(ctx.expr());
|
||||
if (size instanceof ConstantInteger) {
|
||||
if(size instanceof ConstantInteger) {
|
||||
return new SymbolTypeArray(elementType, ((ConstantInteger) size).getNumber());
|
||||
} else {
|
||||
throw new RuntimeException("Array size not a constant integer " + ctx.getText());
|
||||
@ -466,7 +478,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
public Object visitExprCall(KickCParser.ExprCallContext ctx) {
|
||||
List<RValue> parameters;
|
||||
KickCParser.ParameterListContext parameterList = ctx.parameterList();
|
||||
if (parameterList != null) {
|
||||
if(parameterList != null) {
|
||||
parameters = (List<RValue>) this.visit(parameterList);
|
||||
} else {
|
||||
parameters = new ArrayList<>();
|
||||
@ -480,7 +492,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
@Override
|
||||
public List<RValue> visitParameterList(KickCParser.ParameterListContext ctx) {
|
||||
List<RValue> parameters = new ArrayList<>();
|
||||
for (KickCParser.ExprContext exprContext : ctx.expr()) {
|
||||
for(KickCParser.ExprContext exprContext : ctx.expr()) {
|
||||
RValue param = (RValue) this.visit(exprContext);
|
||||
parameters.add(param);
|
||||
}
|
||||
@ -497,7 +509,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
@Override
|
||||
public RValue visitExprNumber(KickCParser.ExprNumberContext ctx) {
|
||||
Number number = NumberParser.parseLiteral(ctx.getText());
|
||||
if (number instanceof Integer) {
|
||||
if(number instanceof Integer) {
|
||||
return new ConstantInteger((Integer) number);
|
||||
} else {
|
||||
return new ConstantDouble((Double) number);
|
||||
@ -572,7 +584,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
@Override
|
||||
public RValue visitExprId(KickCParser.ExprIdContext ctx) {
|
||||
Variable variable = getCurrentSymbols().getVariable(ctx.NAME().getText());
|
||||
if (variable == null) {
|
||||
if(variable == null) {
|
||||
program.getLog().append("ERROR! Line " + ctx.getStart().getLine() + ". Unknown variable " + ctx.NAME().getText());
|
||||
throw new CompileError("ERROR! Line " + ctx.getStart().getLine() + ". Unknown variable " + ctx.NAME().getText());
|
||||
}
|
||||
@ -620,7 +632,7 @@ public class StatementSequenceGenerator extends KickCBaseVisitor<Object> {
|
||||
private static void addModifierStatements(
|
||||
StatementSequenceGenerator parser,
|
||||
List<PrePostModifier> modifiers) {
|
||||
for (PrePostModifier mod : modifiers) {
|
||||
for(PrePostModifier mod : modifiers) {
|
||||
Statement stmt = new StatementAssignment((LValue) mod.child, mod.operator, mod.child);
|
||||
parser.sequence.addStatement(stmt);
|
||||
parser.program.getLog().append("Adding pre/post-modifier " + stmt.toString(parser.program, true));
|
||||
|
@ -22,6 +22,10 @@ public class TestPrograms extends TestCase {
|
||||
helper = new ReferenceHelper("dk/camelot64/kickc/test/ref/");
|
||||
}
|
||||
|
||||
public void testArraysInit() throws IOException, URISyntaxException {
|
||||
compileAndCompare("arrays-init");
|
||||
}
|
||||
|
||||
public void testConstantStringConcat() throws IOException, URISyntaxException {
|
||||
compileAndCompare("constant-string-concat");
|
||||
}
|
||||
@ -343,6 +347,10 @@ public class TestPrograms extends TestCase {
|
||||
assertError("valuelist-error", "Value list not resolved to word constructor");
|
||||
}
|
||||
|
||||
public void testArrayUninitialized() throws IOException, URISyntaxException {
|
||||
assertError("array-uninitialized", "Cannot determine array size.");
|
||||
}
|
||||
|
||||
private void assertError(String kcFile, String expectError) throws IOException, URISyntaxException {
|
||||
try {
|
||||
compileAndCompare(kcFile);
|
||||
|
@ -0,0 +1,2 @@
|
||||
byte[] b;
|
||||
|
13
src/main/java/dk/camelot64/kickc/test/arrays-init.kc
Normal file
13
src/main/java/dk/camelot64/kickc/test/arrays-init.kc
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
byte[3] b;
|
||||
byte[] c = {'c', 'm', 'l'};
|
||||
byte[] d = "cml";
|
||||
|
||||
byte* SCREEN = $400;
|
||||
|
||||
void main() {
|
||||
b[0] = 'c';
|
||||
*SCREEN = b[0];
|
||||
*(SCREEN+1) = c[1];
|
||||
*(SCREEN+2) = d[2];
|
||||
}
|
@ -18,11 +18,11 @@ byte CSEL = %00001000;
|
||||
byte* SCREEN = $400;
|
||||
const byte* BITMAP = $2000;
|
||||
|
||||
const byte[] plot_xlo = $1000;
|
||||
const byte[] plot_xhi = $1100;
|
||||
const byte[] plot_ylo = $1200;
|
||||
const byte[] plot_yhi = $1300;
|
||||
const byte[] plot_bit = $1400;
|
||||
const byte[256] plot_xlo;
|
||||
const byte[256] plot_xhi;
|
||||
const byte[256] plot_ylo;
|
||||
const byte[256] plot_yhi;
|
||||
const byte[256] plot_bit;
|
||||
|
||||
byte[] lines_x = { 60, 80, 110, 80, 60, 40, 10, 40, 60 };
|
||||
byte[] lines_y = { 10, 40, 60, 80, 110, 80, 60, 40, 10 };
|
||||
|
@ -43,11 +43,11 @@ void plots() {
|
||||
}
|
||||
}
|
||||
|
||||
const byte[] plot_xlo = $1000;
|
||||
const byte[] plot_xhi = $1100;
|
||||
const byte[] plot_ylo = $1200;
|
||||
const byte[] plot_yhi = $1300;
|
||||
const byte[] plot_bit = $1400;
|
||||
const byte[256] plot_xlo;
|
||||
const byte[256] plot_xhi;
|
||||
const byte[256] plot_ylo;
|
||||
const byte[256] plot_yhi;
|
||||
const byte[256] plot_bit;
|
||||
|
||||
void plot(byte x, byte y) {
|
||||
byte* plotter_x = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
const byte[] plots = $1000;
|
||||
const byte* plots = $1000;
|
||||
const byte* SCREEN = $0400;
|
||||
|
||||
void main() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
byte[1000] SCREEN = $0400;
|
||||
byte[16*16] buffer1 = $1000;
|
||||
byte[16*16] buffer2 = $1100;
|
||||
byte[16*16] buffer1;
|
||||
byte[16*16] buffer2;
|
||||
byte *RASTER = $d012;
|
||||
byte* SCREEN = $0400;
|
||||
|
||||
void main() {
|
||||
prepare();
|
||||
|
18
src/main/java/dk/camelot64/kickc/test/ref/arrays-init.asm
Normal file
18
src/main/java/dk/camelot64/kickc/test/ref/arrays-init.asm
Normal file
@ -0,0 +1,18 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.const SCREEN = $400
|
||||
b: .fill 3, 0
|
||||
c: .byte 'c', 'm', 'l'
|
||||
d: .text "cml"
|
||||
jsr main
|
||||
main: {
|
||||
lda #'c'
|
||||
sta b+0
|
||||
sta SCREEN
|
||||
lda c+1
|
||||
sta SCREEN+1
|
||||
lda d+2
|
||||
sta SCREEN+2
|
||||
rts
|
||||
}
|
18
src/main/java/dk/camelot64/kickc/test/ref/arrays-init.cfg
Normal file
18
src/main/java/dk/camelot64/kickc/test/ref/arrays-init.cfg
Normal file
@ -0,0 +1,18 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @1
|
||||
[4] *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c' [ ] ( main:2 [ ] )
|
||||
[5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) [ ] ( main:2 [ ] )
|
||||
[6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1) [ ] ( main:2 [ ] )
|
||||
[7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2) ← *((const string) d#0+(byte/signed byte/word/signed word) 2) [ ] ( main:2 [ ] )
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[8] return [ ] ( main:2 [ ] )
|
||||
to:@return
|
660
src/main/java/dk/camelot64/kickc/test/ref/arrays-init.log
Normal file
660
src/main/java/dk/camelot64/kickc/test/ref/arrays-init.log
Normal file
@ -0,0 +1,660 @@
|
||||
|
||||
byte[3] b;
|
||||
byte[] c = {'c', 'm', 'l'};
|
||||
byte[] d = "cml";
|
||||
|
||||
byte* SCREEN = $400;
|
||||
|
||||
void main() {
|
||||
b[0] = 'c';
|
||||
*SCREEN = b[0];
|
||||
*(SCREEN+1) = c[1];
|
||||
*(SCREEN+2) = d[2];
|
||||
}
|
||||
PROGRAM
|
||||
(byte[3]) b ← { fill( 3, 0) }
|
||||
(byte[]) c ← { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d ← (string) "cml"
|
||||
(byte*) SCREEN ← (word/signed word) 1024
|
||||
proc (void()) main()
|
||||
*((byte[3]) b + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((byte*) SCREEN) ← *((byte[3]) b + (byte/signed byte/word/signed word) 0)
|
||||
(byte*~) main::$0 ← (byte*) SCREEN + (byte/signed byte/word/signed word) 1
|
||||
*((byte*~) main::$0) ← *((byte[]) c + (byte/signed byte/word/signed word) 1)
|
||||
(byte*~) main::$1 ← (byte*) SCREEN + (byte/signed byte/word/signed word) 2
|
||||
*((byte*~) main::$1) ← *((byte[]) d + (byte/signed byte/word/signed word) 2)
|
||||
main::@return:
|
||||
return
|
||||
endproc // main()
|
||||
call main
|
||||
|
||||
SYMBOLS
|
||||
(byte*) SCREEN
|
||||
(byte[3]) b
|
||||
(byte[]) c
|
||||
(byte[]) d
|
||||
(void()) main()
|
||||
(byte*~) main::$0
|
||||
(byte*~) main::$1
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[3]) b ← { fill( 3, 0) }
|
||||
(byte[]) c ← { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d ← (string) "cml"
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
*((byte[3]) b + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((byte*) SCREEN) ← *((byte[3]) b + (byte/signed byte/word/signed word) 0)
|
||||
(byte*~) main::$0 ← (byte*) SCREEN + (byte/signed byte/word/signed word) 1
|
||||
*((byte*~) main::$0) ← *((byte[]) c + (byte/signed byte/word/signed word) 1)
|
||||
(byte*~) main::$1 ← (byte*) SCREEN + (byte/signed byte/word/signed word) 2
|
||||
*((byte*~) main::$1) ← *((byte[]) d + (byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Creating constant string variable for inline (const string) $0 "cml"
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[3]) b ← { fill( 3, 0) }
|
||||
(byte[]) c ← { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d ← (const string) $0
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
*((byte[3]) b + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((byte*) SCREEN) ← *((byte[3]) b + (byte/signed byte/word/signed word) 0)
|
||||
(byte*~) main::$0 ← (byte*) SCREEN + (byte/signed byte/word/signed word) 1
|
||||
*((byte*~) main::$0) ← *((byte[]) c + (byte/signed byte/word/signed word) 1)
|
||||
(byte*~) main::$1 ← (byte*) SCREEN + (byte/signed byte/word/signed word) 2
|
||||
*((byte*~) main::$1) ← *((byte[]) d + (byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
|
||||
@begin: scope:[] from
|
||||
(byte[3]) b ← { fill( 3, 0) }
|
||||
(byte[]) c ← { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d ← (const string) $0
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word) 1024
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
*((byte[3]) b + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((byte*) SCREEN) ← *((byte[3]) b + (byte/signed byte/word/signed word) 0)
|
||||
(byte*~) main::$0 ← (byte*) SCREEN + (byte/signed byte/word/signed word) 1
|
||||
*((byte*~) main::$0) ← *((byte[]) c + (byte/signed byte/word/signed word) 1)
|
||||
(byte*~) main::$1 ← (byte*) SCREEN + (byte/signed byte/word/signed word) 2
|
||||
*((byte*~) main::$1) ← *((byte[]) d + (byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main param-assignment
|
||||
to:@2
|
||||
@2: scope:[] from @1
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte[3]) b#0 ← { fill( 3, 0) }
|
||||
(byte[]) c#0 ← { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d#0 ← (const string) $0
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte*) SCREEN#1 ← phi( @1/(byte*) SCREEN#2 )
|
||||
*((byte[3]) b#0 + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((byte*) SCREEN#1) ← *((byte[3]) b#0 + (byte/signed byte/word/signed word) 0)
|
||||
(byte*~) main::$0 ← (byte*) SCREEN#1 + (byte/signed byte/word/signed word) 1
|
||||
*((byte*~) main::$0) ← *((byte[]) c#0 + (byte/signed byte/word/signed word) 1)
|
||||
(byte*~) main::$1 ← (byte*) SCREEN#1 + (byte/signed byte/word/signed word) 2
|
||||
*((byte*~) main::$1) ← *((byte[]) d#0 + (byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
(byte*) SCREEN#2 ← phi( @begin/(byte*) SCREEN#0 )
|
||||
call main param-assignment
|
||||
to:@2
|
||||
@2: scope:[] from @1
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
|
||||
@begin: scope:[] from
|
||||
(byte[3]) b#0 ← { fill( 3, 0) }
|
||||
(byte[]) c#0 ← { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d#0 ← (const string) $0
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte*) SCREEN#1 ← phi( @1/(byte*) SCREEN#2 )
|
||||
*((byte[3]) b#0 + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((byte*) SCREEN#1) ← *((byte[3]) b#0 + (byte/signed byte/word/signed word) 0)
|
||||
(byte*~) main::$0 ← (byte*) SCREEN#1 + (byte/signed byte/word/signed word) 1
|
||||
*((byte*~) main::$0) ← *((byte[]) c#0 + (byte/signed byte/word/signed word) 1)
|
||||
(byte*~) main::$1 ← (byte*) SCREEN#1 + (byte/signed byte/word/signed word) 2
|
||||
*((byte*~) main::$1) ← *((byte[]) d#0 + (byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
(byte*) SCREEN#2 ← phi( @begin/(byte*) SCREEN#0 )
|
||||
call main param-assignment
|
||||
to:@2
|
||||
@2: scope:[] from @1
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
INITIAL SSA SYMBOL TABLE
|
||||
(const string) $0 = (string) "cml"
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(byte*) SCREEN#0
|
||||
(byte*) SCREEN#1
|
||||
(byte*) SCREEN#2
|
||||
(byte[3]) b
|
||||
(byte[3]) b#0
|
||||
(byte[]) c
|
||||
(byte[]) c#0
|
||||
(byte[]) d
|
||||
(byte[]) d#0
|
||||
(void()) main()
|
||||
(byte*~) main::$0
|
||||
(byte*~) main::$1
|
||||
(label) main::@return
|
||||
|
||||
Culled Empty Block (label) @2
|
||||
Succesful SSA optimization Pass2CullEmptyBlocks
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[3]) b#0 ← { fill( 3, 0) }
|
||||
(byte[]) c#0 ← { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d#0 ← (const string) $0
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte*) SCREEN#1 ← phi( @1/(byte*) SCREEN#2 )
|
||||
*((byte[3]) b#0 + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((byte*) SCREEN#1) ← *((byte[3]) b#0 + (byte/signed byte/word/signed word) 0)
|
||||
(byte*~) main::$0 ← (byte*) SCREEN#1 + (byte/signed byte/word/signed word) 1
|
||||
*((byte*~) main::$0) ← *((byte[]) c#0 + (byte/signed byte/word/signed word) 1)
|
||||
(byte*~) main::$1 ← (byte*) SCREEN#1 + (byte/signed byte/word/signed word) 2
|
||||
*((byte*~) main::$1) ← *((byte[]) d#0 + (byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
(byte*) SCREEN#2 ← phi( @begin/(byte*) SCREEN#0 )
|
||||
call main param-assignment
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Not aliassing across scopes: SCREEN#1 SCREEN#2
|
||||
Alias (byte*) SCREEN#0 = (byte*) SCREEN#2
|
||||
Succesful SSA optimization Pass2AliasElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[3]) b#0 ← { fill( 3, 0) }
|
||||
(byte[]) c#0 ← { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d#0 ← (const string) $0
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte*) SCREEN#1 ← phi( @1/(byte*) SCREEN#0 )
|
||||
*((byte[3]) b#0 + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((byte*) SCREEN#1) ← *((byte[3]) b#0 + (byte/signed byte/word/signed word) 0)
|
||||
(byte*~) main::$0 ← (byte*) SCREEN#1 + (byte/signed byte/word/signed word) 1
|
||||
*((byte*~) main::$0) ← *((byte[]) c#0 + (byte/signed byte/word/signed word) 1)
|
||||
(byte*~) main::$1 ← (byte*) SCREEN#1 + (byte/signed byte/word/signed word) 2
|
||||
*((byte*~) main::$1) ← *((byte[]) d#0 + (byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main param-assignment
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Not aliassing across scopes: SCREEN#1 SCREEN#0
|
||||
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#0
|
||||
Succesful SSA optimization Pass2RedundantPhiElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[3]) b#0 ← { fill( 3, 0) }
|
||||
(byte[]) c#0 ← { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d#0 ← (const string) $0
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
*((byte[3]) b#0 + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((byte*) SCREEN#0) ← *((byte[3]) b#0 + (byte/signed byte/word/signed word) 0)
|
||||
(byte*~) main::$0 ← (byte*) SCREEN#0 + (byte/signed byte/word/signed word) 1
|
||||
*((byte*~) main::$0) ← *((byte[]) c#0 + (byte/signed byte/word/signed word) 1)
|
||||
(byte*~) main::$1 ← (byte*) SCREEN#0 + (byte/signed byte/word/signed word) 2
|
||||
*((byte*~) main::$1) ← *((byte[]) d#0 + (byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main param-assignment
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Constant (const byte[3]) b#0 = { fill( 3, 0) }
|
||||
Constant (const byte[]) c#0 = { 'c', 'm', 'l' }
|
||||
Constant (const string) d#0 = $0
|
||||
Constant (const byte*) SCREEN#0 = ((byte*))1024
|
||||
Succesful SSA optimization Pass2ConstantIdentification
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
*((const byte[3]) b#0 + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((const byte*) SCREEN#0) ← *((const byte[3]) b#0 + (byte/signed byte/word/signed word) 0)
|
||||
(byte*~) main::$0 ← (const byte*) SCREEN#0 + (byte/signed byte/word/signed word) 1
|
||||
*((byte*~) main::$0) ← *((const byte[]) c#0 + (byte/signed byte/word/signed word) 1)
|
||||
(byte*~) main::$1 ← (const byte*) SCREEN#0 + (byte/signed byte/word/signed word) 2
|
||||
*((byte*~) main::$1) ← *((const string) d#0 + (byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main param-assignment
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Constant (const byte*) main::$0 = SCREEN#0+1
|
||||
Constant (const byte*) main::$1 = SCREEN#0+2
|
||||
Succesful SSA optimization Pass2ConstantIdentification
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
*((const byte[3]) b#0 + (byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((const byte*) SCREEN#0) ← *((const byte[3]) b#0 + (byte/signed byte/word/signed word) 0)
|
||||
*((const byte*) main::$0) ← *((const byte[]) c#0 + (byte/signed byte/word/signed word) 1)
|
||||
*((const byte*) main::$1) ← *((const string) d#0 + (byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main param-assignment
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Consolidated array index constant in *(b#0+0)
|
||||
Consolidated array index constant in *(b#0+0)
|
||||
Consolidated array index constant in *(c#0+1)
|
||||
Consolidated array index constant in *(d#0+2)
|
||||
Succesful SSA optimization Pass2ConstantAdditionElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
*((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0)
|
||||
*((const byte*) main::$0) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1)
|
||||
*((const byte*) main::$1) ← *((const string) d#0+(byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main param-assignment
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Constant inlined main::$1 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2
|
||||
Constant inlined $0 = (const string) d#0
|
||||
Constant inlined main::$0 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1
|
||||
Succesful SSA optimization Pass2ConstantInlining
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
*((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0)
|
||||
*((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1)
|
||||
*((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2) ← *((const string) d#0+(byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main param-assignment
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 = ((byte*))(word/signed word) 1024
|
||||
(byte[3]) b
|
||||
(const byte[3]) b#0 = { fill( 3, 0) }
|
||||
(byte[]) c
|
||||
(const byte[]) c#0 = { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d
|
||||
(const string) d#0 = (string) "cml"
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
||||
Block Sequence Planned @begin @1 @end main main::@return
|
||||
Block Sequence Planned @begin @1 @end main main::@return
|
||||
CONTROL FLOW GRAPH - PHI LIFTED
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
call main param-assignment
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
main: scope:[main] from @1
|
||||
*((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c'
|
||||
*((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0)
|
||||
*((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1)
|
||||
*((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2) ← *((const string) d#0+(byte/signed byte/word/signed word) 2)
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
CONTROL FLOW GRAPH - LIVE RANGES FOUND
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ]
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
[1] phi() [ ]
|
||||
[2] call main param-assignment [ ]
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
[3] phi() [ ]
|
||||
main: scope:[main] from @1
|
||||
[4] *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c' [ ]
|
||||
[5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) [ ]
|
||||
[6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1) [ ]
|
||||
[7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2) ← *((const string) d#0+(byte/signed byte/word/signed word) 2) [ ]
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[8] return [ ]
|
||||
to:@return
|
||||
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Block Sequence Planned @begin @1 @end main main::@return
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
CONTROL FLOW GRAPH - BEFORE EFFECTIVE LIVE RANGES
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ]
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
[1] phi() [ ]
|
||||
[2] call main param-assignment [ ]
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
[3] phi() [ ]
|
||||
main: scope:[main] from @1
|
||||
[4] *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c' [ ]
|
||||
[5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) [ ]
|
||||
[6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1) [ ]
|
||||
[7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2) ← *((const string) d#0+(byte/signed byte/word/signed word) 2) [ ]
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[8] return [ ]
|
||||
to:@return
|
||||
|
||||
CONTROL FLOW GRAPH - PHI MEM COALESCED
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @1
|
||||
[4] *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c' [ ] ( main:2 [ ] )
|
||||
[5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) [ ] ( main:2 [ ] )
|
||||
[6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1) [ ] ( main:2 [ ] )
|
||||
[7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2) ← *((const string) d#0+(byte/signed byte/word/signed word) 2) [ ] ( main:2 [ ] )
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[8] return [ ] ( main:2 [ ] )
|
||||
to:@return
|
||||
|
||||
DOMINATORS
|
||||
@begin dominated by @begin
|
||||
@1 dominated by @1 @begin
|
||||
@end dominated by @1 @begin @end
|
||||
main dominated by @1 @begin main
|
||||
main::@return dominated by main::@return @1 @begin main
|
||||
|
||||
NATURAL LOOPS
|
||||
|
||||
Found 0 loops in scope []
|
||||
Found 0 loops in scope [main]
|
||||
NATURAL LOOPS WITH DEPTH
|
||||
|
||||
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
(byte*) SCREEN
|
||||
(byte[3]) b
|
||||
(byte[]) c
|
||||
(byte[]) d
|
||||
(void()) main()
|
||||
|
||||
Initial phi equivalence classes
|
||||
Complete equivalence classes
|
||||
INITIAL ASM
|
||||
//SEG0 Basic Upstart
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
//SEG1 Global Constants & labels
|
||||
.const SCREEN = $400
|
||||
b: .fill 3, 0
|
||||
c: .byte 'c', 'm', 'l'
|
||||
d: .text "cml"
|
||||
//SEG2 @begin
|
||||
bbegin:
|
||||
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
|
||||
b1_from_bbegin:
|
||||
jmp b1
|
||||
//SEG4 @1
|
||||
b1:
|
||||
//SEG5 [2] call main param-assignment [ ] ( )
|
||||
jsr main
|
||||
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
|
||||
bend_from_b1:
|
||||
jmp bend
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
main: {
|
||||
//SEG9 [4] *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c' [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2
|
||||
lda #'c'
|
||||
sta b+0
|
||||
//SEG10 [5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) [ ] ( main:2 [ ] ) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda b+0
|
||||
sta SCREEN
|
||||
//SEG11 [6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1) [ ] ( main:2 [ ] ) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda c+1
|
||||
sta SCREEN+1
|
||||
//SEG12 [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2) ← *((const string) d#0+(byte/signed byte/word/signed word) 2) [ ] ( main:2 [ ] ) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda d+2
|
||||
sta SCREEN+2
|
||||
jmp breturn
|
||||
//SEG13 main::@return
|
||||
breturn:
|
||||
//SEG14 [8] return [ ] ( main:2 [ ] )
|
||||
rts
|
||||
}
|
||||
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [4] *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c' [ ] ( main:2 [ ] ) always clobbers reg byte a
|
||||
Statement [5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) [ ] ( main:2 [ ] ) always clobbers reg byte a
|
||||
Statement [6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1) [ ] ( main:2 [ ] ) always clobbers reg byte a
|
||||
Statement [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2) ← *((const string) d#0+(byte/signed byte/word/signed word) 2) [ ] ( main:2 [ ] ) always clobbers reg byte a
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 51 combination
|
||||
Uplifting [] best 51 combination
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
//SEG0 Basic Upstart
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
//SEG1 Global Constants & labels
|
||||
.const SCREEN = $400
|
||||
b: .fill 3, 0
|
||||
c: .byte 'c', 'm', 'l'
|
||||
d: .text "cml"
|
||||
//SEG2 @begin
|
||||
bbegin:
|
||||
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
|
||||
b1_from_bbegin:
|
||||
jmp b1
|
||||
//SEG4 @1
|
||||
b1:
|
||||
//SEG5 [2] call main param-assignment [ ] ( )
|
||||
jsr main
|
||||
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
|
||||
bend_from_b1:
|
||||
jmp bend
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
main: {
|
||||
//SEG9 [4] *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c' [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2
|
||||
lda #'c'
|
||||
sta b+0
|
||||
//SEG10 [5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) [ ] ( main:2 [ ] ) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda b+0
|
||||
sta SCREEN
|
||||
//SEG11 [6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1) [ ] ( main:2 [ ] ) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda c+1
|
||||
sta SCREEN+1
|
||||
//SEG12 [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2) ← *((const string) d#0+(byte/signed byte/word/signed word) 2) [ ] ( main:2 [ ] ) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda d+2
|
||||
sta SCREEN+2
|
||||
jmp breturn
|
||||
//SEG13 main::@return
|
||||
breturn:
|
||||
//SEG14 [8] return [ ] ( main:2 [ ] )
|
||||
rts
|
||||
}
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp b1
|
||||
Removing instruction jmp bend
|
||||
Removing instruction jmp breturn
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction lda b+0
|
||||
Succesful ASM optimization Pass5UnnecesaryLoadElimination
|
||||
Removing instruction bbegin:
|
||||
Removing instruction b1_from_bbegin:
|
||||
Removing instruction bend_from_b1:
|
||||
Succesful ASM optimization Pass5RedundantLabelElimination
|
||||
Removing instruction b1:
|
||||
Removing instruction bend:
|
||||
Removing instruction breturn:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word) 1024
|
||||
(byte[3]) b
|
||||
(const byte[3]) b#0 b = { fill( 3, 0) }
|
||||
(byte[]) c
|
||||
(const byte[]) c#0 c = { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d
|
||||
(const string) d#0 d = (string) "cml"
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
||||
|
||||
FINAL CODE
|
||||
//SEG0 Basic Upstart
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
//SEG1 Global Constants & labels
|
||||
.const SCREEN = $400
|
||||
b: .fill 3, 0
|
||||
c: .byte 'c', 'm', 'l'
|
||||
d: .text "cml"
|
||||
//SEG2 @begin
|
||||
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
|
||||
//SEG4 @1
|
||||
//SEG5 [2] call main param-assignment [ ] ( )
|
||||
jsr main
|
||||
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG7 @end
|
||||
//SEG8 main
|
||||
main: {
|
||||
//SEG9 [4] *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) ← (byte) 'c' [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2
|
||||
lda #'c'
|
||||
sta b+0
|
||||
//SEG10 [5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0+(byte/signed byte/word/signed word) 0) [ ] ( main:2 [ ] ) -- _deref_pbuc1=_deref_pbuc2
|
||||
sta SCREEN
|
||||
//SEG11 [6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word) 1) [ ] ( main:2 [ ] ) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda c+1
|
||||
sta SCREEN+1
|
||||
//SEG12 [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word) 2) ← *((const string) d#0+(byte/signed byte/word/signed word) 2) [ ] ( main:2 [ ] ) -- _deref_pbuc1=_deref_pbuc2
|
||||
lda d+2
|
||||
sta SCREEN+2
|
||||
//SEG13 main::@return
|
||||
//SEG14 [8] return [ ] ( main:2 [ ] )
|
||||
rts
|
||||
}
|
||||
|
14
src/main/java/dk/camelot64/kickc/test/ref/arrays-init.sym
Normal file
14
src/main/java/dk/camelot64/kickc/test/ref/arrays-init.sym
Normal file
@ -0,0 +1,14 @@
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word) 1024
|
||||
(byte[3]) b
|
||||
(const byte[3]) b#0 b = { fill( 3, 0) }
|
||||
(byte[]) c
|
||||
(const byte[]) c#0 c = { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
(byte[]) d
|
||||
(const string) d#0 d = (string) "cml"
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
@ -10,12 +10,12 @@
|
||||
.const RSEL = 8
|
||||
.const SCREEN = $400
|
||||
.const BITMAP = $2000
|
||||
.const plot_xlo = $1000
|
||||
.const plot_xhi = $1100
|
||||
.const plot_ylo = $1200
|
||||
.const plot_yhi = $1300
|
||||
.const plot_bit = $1400
|
||||
.const lines_cnt = 8
|
||||
plot_xlo: .fill 256, 0
|
||||
plot_xhi: .fill 256, 0
|
||||
plot_ylo: .fill 256, 0
|
||||
plot_yhi: .fill 256, 0
|
||||
plot_bit: .fill 256, 0
|
||||
lines_x: .byte $3c, $50, $6e, $50, $3c, $28, $a, $28, $3c
|
||||
lines_y: .byte $a, $28, $3c, $50, $6e, $50, $3c, $28, $a
|
||||
jsr main
|
||||
|
@ -177,11 +177,11 @@ line_ydxi::@return: scope:[line_ydxi] from line_ydxi::@2
|
||||
plot: scope:[plot] from line_xdyd::@1 line_xdyi::@1 line_ydxd::@1 line_ydxi::@1
|
||||
[102] (byte) plot::y#4 ← phi( line_xdyd::@1/(byte) plot::y#1 line_xdyi::@1/(byte) plot::y#0 line_ydxd::@1/(byte) plot::y#3 line_ydxi::@1/(byte) plot::y#2 ) [ plot::x#4 plot::y#4 ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::y#4 ] )
|
||||
[102] (byte) plot::x#4 ← phi( line_xdyd::@1/(byte) plot::x#1 line_xdyi::@1/(byte) plot::x#0 line_ydxd::@1/(byte) plot::x#3 line_ydxi::@1/(byte) plot::x#2 ) [ plot::x#4 plot::y#4 ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::y#4 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::y#4 ] )
|
||||
[103] (word) plot::plotter_x#0 ← *((const byte*) plot_xhi#0 + (byte) plot::x#4) w= *((const byte*) plot_xlo#0 + (byte) plot::x#4) [ plot::x#4 plot::y#4 plot::plotter_x#0 ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] )
|
||||
[104] (word) plot::plotter_y#0 ← *((const byte*) plot_yhi#0 + (byte) plot::y#4) w= *((const byte*) plot_ylo#0 + (byte) plot::y#4) [ plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] )
|
||||
[103] (word) plot::plotter_x#0 ← *((const byte[256]) plot_xhi#0 + (byte) plot::x#4) w= *((const byte[256]) plot_xlo#0 + (byte) plot::x#4) [ plot::x#4 plot::y#4 plot::plotter_x#0 ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::y#4 plot::plotter_x#0 ] )
|
||||
[104] (word) plot::plotter_y#0 ← *((const byte[256]) plot_yhi#0 + (byte) plot::y#4) w= *((const byte[256]) plot_ylo#0 + (byte) plot::y#4) [ plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::plotter_x#0 plot::plotter_y#0 ] )
|
||||
[105] (word~) plot::$0 ← (word) plot::plotter_x#0 + (word) plot::plotter_y#0 [ plot::x#4 plot::$0 ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::$0 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::$0 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::$0 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::$0 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::$0 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::$0 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::$0 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::$0 ] )
|
||||
[106] (byte*) plot::plotter#0 ← ((byte*)) (word~) plot::$0 [ plot::x#4 plot::plotter#0 ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::plotter#0 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::x#4 plot::plotter#0 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::plotter#0 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::x#4 plot::plotter#0 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::plotter#0 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::x#4 plot::plotter#0 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::plotter#0 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::x#4 plot::plotter#0 ] )
|
||||
[107] (byte~) plot::$1 ← *((byte*) plot::plotter#0) | *((const byte*) plot_bit#0 + (byte) plot::x#4) [ plot::plotter#0 plot::$1 ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::plotter#0 plot::$1 ] )
|
||||
[107] (byte~) plot::$1 ← *((byte*) plot::plotter#0) | *((const byte[256]) plot_bit#0 + (byte) plot::x#4) [ plot::plotter#0 plot::$1 ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::plotter#0 plot::$1 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 plot::plotter#0 plot::$1 ] )
|
||||
[108] *((byte*) plot::plotter#0) ← (byte~) plot::$1 [ ] ( main:2::lines:12::line:21::line_ydxi:42::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 ] main:2::lines:12::line:21::line_ydxi:86::plot:92 [ lines::l#2 line_ydxi::xd#2 line_ydxi::yd#5 line_ydxi::y1#6 line_ydxi::x#3 line_ydxi::y#3 line_ydxi::e#3 ] main:2::lines:12::line:21::line_xdyi:35::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 ] main:2::lines:12::line:21::line_xdyi:80::plot:115 [ lines::l#2 line_xdyi::yd#2 line_xdyi::xd#5 line_xdyi::x1#6 line_xdyi::x#3 line_xdyi::y#3 line_xdyi::e#3 ] main:2::lines:12::line:21::line_ydxd:56::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 ] main:2::lines:12::line:21::line_ydxd:72::plot:130 [ lines::l#2 line_ydxd::xd#2 line_ydxd::yd#5 line_ydxd::y1#6 line_ydxd::x#3 line_ydxd::y#3 line_ydxd::e#3 ] main:2::lines:12::line:21::line_xdyd:50::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 ] main:2::lines:12::line:21::line_xdyd:66::plot:145 [ lines::l#2 line_xdyd::yd#2 line_xdyd::xd#5 line_xdyd::x1#6 line_xdyd::x#3 line_xdyd::y#3 line_xdyd::e#3 ] )
|
||||
to:plot::@return
|
||||
plot::@return: scope:[plot] from plot
|
||||
@ -296,9 +296,9 @@ init_plot_tables::@1: scope:[init_plot_tables] from init_plot_tables init_plot_
|
||||
[156] (byte) init_plot_tables::bits#3 ← phi( init_plot_tables/(byte/word/signed word) 128 init_plot_tables::@2/(byte) init_plot_tables::bits#4 ) [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[156] (byte) init_plot_tables::x#2 ← phi( init_plot_tables/(byte/signed byte/word/signed word) 0 init_plot_tables::@2/(byte) init_plot_tables::x#1 ) [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[157] (byte~) init_plot_tables::$0 ← (byte) init_plot_tables::x#2 & (byte/word/signed word) 248 [ init_plot_tables::x#2 init_plot_tables::bits#3 init_plot_tables::$0 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 init_plot_tables::$0 ] )
|
||||
[158] *((const byte*) plot_xlo#0 + (byte) init_plot_tables::x#2) ← (byte~) init_plot_tables::$0 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[159] *((const byte*) plot_xhi#0 + (byte) init_plot_tables::x#2) ← >(const byte*) BITMAP#0 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[160] *((const byte*) plot_bit#0 + (byte) init_plot_tables::x#2) ← (byte) init_plot_tables::bits#3 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[158] *((const byte[256]) plot_xlo#0 + (byte) init_plot_tables::x#2) ← (byte~) init_plot_tables::$0 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[159] *((const byte[256]) plot_xhi#0 + (byte) init_plot_tables::x#2) ← >(const byte*) BITMAP#0 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[160] *((const byte[256]) plot_bit#0 + (byte) init_plot_tables::x#2) ← (byte) init_plot_tables::bits#3 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[161] (byte) init_plot_tables::bits#1 ← (byte) init_plot_tables::bits#3 >> (byte/signed byte/word/signed word) 1 [ init_plot_tables::x#2 init_plot_tables::bits#1 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#1 ] )
|
||||
[162] if((byte) init_plot_tables::bits#1!=(byte/signed byte/word/signed word) 0) goto init_plot_tables::@10 [ init_plot_tables::x#2 init_plot_tables::bits#1 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#1 ] )
|
||||
to:init_plot_tables::@2
|
||||
@ -313,9 +313,9 @@ init_plot_tables::@3: scope:[init_plot_tables] from init_plot_tables::@2 init_p
|
||||
[167] (byte~) init_plot_tables::$6 ← (byte) init_plot_tables::y#2 & (byte/signed byte/word/signed word) 7 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$6 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$6 ] )
|
||||
[168] (byte~) init_plot_tables::$7 ← < (byte*) init_plot_tables::yoffs#2 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$6 init_plot_tables::$7 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$6 init_plot_tables::$7 ] )
|
||||
[169] (byte~) init_plot_tables::$8 ← (byte~) init_plot_tables::$6 | (byte~) init_plot_tables::$7 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$8 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$8 ] )
|
||||
[170] *((const byte*) plot_ylo#0 + (byte) init_plot_tables::y#2) ← (byte~) init_plot_tables::$8 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] )
|
||||
[170] *((const byte[256]) plot_ylo#0 + (byte) init_plot_tables::y#2) ← (byte~) init_plot_tables::$8 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] )
|
||||
[171] (byte~) init_plot_tables::$9 ← > (byte*) init_plot_tables::yoffs#2 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$9 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$9 ] )
|
||||
[172] *((const byte*) plot_yhi#0 + (byte) init_plot_tables::y#2) ← (byte~) init_plot_tables::$9 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] )
|
||||
[172] *((const byte[256]) plot_yhi#0 + (byte) init_plot_tables::y#2) ← (byte~) init_plot_tables::$9 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] )
|
||||
[173] (byte~) init_plot_tables::$10 ← (byte) init_plot_tables::y#2 & (byte/signed byte/word/signed word) 7 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$10 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$10 ] )
|
||||
[174] if((byte~) init_plot_tables::$10!=(byte/signed byte/word/signed word) 7) goto init_plot_tables::@4 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] )
|
||||
to:init_plot_tables::@7
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -281,16 +281,16 @@
|
||||
(byte) plot::y#2 reg byte y 22.0
|
||||
(byte) plot::y#3 reg byte y 22.0
|
||||
(byte) plot::y#4 reg byte y 24.0
|
||||
(byte[]) plot_bit
|
||||
(const byte*) plot_bit#0 plot_bit = ((byte*))(word/signed word) 5120
|
||||
(byte[]) plot_xhi
|
||||
(const byte*) plot_xhi#0 plot_xhi = ((byte*))(word/signed word) 4352
|
||||
(byte[]) plot_xlo
|
||||
(const byte*) plot_xlo#0 plot_xlo = ((byte*))(word/signed word) 4096
|
||||
(byte[]) plot_yhi
|
||||
(const byte*) plot_yhi#0 plot_yhi = ((byte*))(word/signed word) 4864
|
||||
(byte[]) plot_ylo
|
||||
(const byte*) plot_ylo#0 plot_ylo = ((byte*))(word/signed word) 4608
|
||||
(byte[256]) plot_bit
|
||||
(const byte[256]) plot_bit#0 plot_bit = { fill( 256, 0) }
|
||||
(byte[256]) plot_xhi
|
||||
(const byte[256]) plot_xhi#0 plot_xhi = { fill( 256, 0) }
|
||||
(byte[256]) plot_xlo
|
||||
(const byte[256]) plot_xlo#0 plot_xlo = { fill( 256, 0) }
|
||||
(byte[256]) plot_yhi
|
||||
(const byte[256]) plot_yhi#0 plot_yhi = { fill( 256, 0) }
|
||||
(byte[256]) plot_ylo
|
||||
(const byte[256]) plot_ylo#0 plot_ylo = { fill( 256, 0) }
|
||||
|
||||
zp ZP_BYTE:2 [ lines::l#2 lines::l#1 init_plot_tables::$6 ]
|
||||
zp ZP_BYTE:3 [ line_ydxi::xd#2 line_ydxi::xd#1 line_ydxi::xd#0 line_xdyi::yd#2 line_xdyi::yd#0 line_xdyi::yd#1 line_ydxd::xd#2 line_ydxd::xd#1 line_ydxd::xd#0 line_xdyd::yd#2 line_xdyd::yd#0 line_xdyd::yd#1 line::x0#0 ]
|
||||
|
@ -12,13 +12,13 @@
|
||||
.const SCREEN = $400
|
||||
.const BITMAP = $2000
|
||||
.const plots_cnt = 8
|
||||
.const plot_xlo = $1000
|
||||
.const plot_xhi = $1100
|
||||
.const plot_ylo = $1200
|
||||
.const plot_yhi = $1300
|
||||
.const plot_bit = $1400
|
||||
plots_x: .byte $3c, $50, $6e, $50, $3c, $28, $a, $28
|
||||
plots_y: .byte $a, $28, $3c, $50, $6e, $50, $3c, $28
|
||||
plot_xlo: .fill 256, 0
|
||||
plot_xhi: .fill 256, 0
|
||||
plot_ylo: .fill 256, 0
|
||||
plot_yhi: .fill 256, 0
|
||||
plot_bit: .fill 256, 0
|
||||
jsr main
|
||||
main: {
|
||||
lda #0
|
||||
|
@ -49,16 +49,16 @@ plots::@return: scope:[plots] from plots::@3
|
||||
[24] return [ ] ( main:2::plots:13 [ ] )
|
||||
to:@return
|
||||
plot: scope:[plot] from plots::@1
|
||||
[25] (byte~) plot::$6 ← *((const byte*) plot_xhi#0 + (byte) plot::x#0) [ plot::x#0 plot::y#0 plot::$6 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::y#0 plot::$6 ] )
|
||||
[25] (byte~) plot::$6 ← *((const byte[256]) plot_xhi#0 + (byte) plot::x#0) [ plot::x#0 plot::y#0 plot::$6 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::y#0 plot::$6 ] )
|
||||
[26] (byte*) plot::plotter_x#1 ← ((byte*))(byte/signed byte/word/signed word) 0 hi= (byte~) plot::$6 [ plot::x#0 plot::y#0 plot::plotter_x#1 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::y#0 plot::plotter_x#1 ] )
|
||||
[27] (byte~) plot::$7 ← *((const byte*) plot_xlo#0 + (byte) plot::x#0) [ plot::x#0 plot::y#0 plot::plotter_x#1 plot::$7 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::y#0 plot::plotter_x#1 plot::$7 ] )
|
||||
[27] (byte~) plot::$7 ← *((const byte[256]) plot_xlo#0 + (byte) plot::x#0) [ plot::x#0 plot::y#0 plot::plotter_x#1 plot::$7 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::y#0 plot::plotter_x#1 plot::$7 ] )
|
||||
[28] (byte*) plot::plotter_x#2 ← (byte*) plot::plotter_x#1 lo= (byte~) plot::$7 [ plot::x#0 plot::y#0 plot::plotter_x#2 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::y#0 plot::plotter_x#2 ] )
|
||||
[29] (byte~) plot::$8 ← *((const byte*) plot_yhi#0 + (byte) plot::y#0) [ plot::x#0 plot::y#0 plot::plotter_x#2 plot::$8 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::y#0 plot::plotter_x#2 plot::$8 ] )
|
||||
[29] (byte~) plot::$8 ← *((const byte[256]) plot_yhi#0 + (byte) plot::y#0) [ plot::x#0 plot::y#0 plot::plotter_x#2 plot::$8 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::y#0 plot::plotter_x#2 plot::$8 ] )
|
||||
[30] (word) plot::plotter_y#1 ← (byte/signed byte/word/signed word) 0 hi= (byte~) plot::$8 [ plot::x#0 plot::y#0 plot::plotter_x#2 plot::plotter_y#1 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::y#0 plot::plotter_x#2 plot::plotter_y#1 ] )
|
||||
[31] (byte~) plot::$9 ← *((const byte*) plot_ylo#0 + (byte) plot::y#0) [ plot::x#0 plot::plotter_x#2 plot::plotter_y#1 plot::$9 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::plotter_x#2 plot::plotter_y#1 plot::$9 ] )
|
||||
[31] (byte~) plot::$9 ← *((const byte[256]) plot_ylo#0 + (byte) plot::y#0) [ plot::x#0 plot::plotter_x#2 plot::plotter_y#1 plot::$9 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::plotter_x#2 plot::plotter_y#1 plot::$9 ] )
|
||||
[32] (word) plot::plotter_y#2 ← (word) plot::plotter_y#1 lo= (byte~) plot::$9 [ plot::x#0 plot::plotter_x#2 plot::plotter_y#2 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::plotter_x#2 plot::plotter_y#2 ] )
|
||||
[33] (byte*) plot::plotter#0 ← (byte*) plot::plotter_x#2 + (word) plot::plotter_y#2 [ plot::x#0 plot::plotter#0 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::x#0 plot::plotter#0 ] )
|
||||
[34] (byte~) plot::$5 ← *((byte*) plot::plotter#0) | *((const byte*) plot_bit#0 + (byte) plot::x#0) [ plot::plotter#0 plot::$5 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::plotter#0 plot::$5 ] )
|
||||
[34] (byte~) plot::$5 ← *((byte*) plot::plotter#0) | *((const byte[256]) plot_bit#0 + (byte) plot::x#0) [ plot::plotter#0 plot::$5 ] ( main:2::plots:13::plot:21 [ plots::i#2 plot::plotter#0 plot::$5 ] )
|
||||
[35] *((byte*) plot::plotter#0) ← (byte~) plot::$5 [ ] ( main:2::plots:13::plot:21 [ plots::i#2 ] )
|
||||
to:plot::@return
|
||||
plot::@return: scope:[plot] from plot
|
||||
@ -71,9 +71,9 @@ init_plot_tables::@1: scope:[init_plot_tables] from init_plot_tables init_plot_
|
||||
[38] (byte) init_plot_tables::bits#3 ← phi( init_plot_tables/(byte/word/signed word) 128 init_plot_tables::@2/(byte) init_plot_tables::bits#4 ) [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[38] (byte) init_plot_tables::x#2 ← phi( init_plot_tables/(byte/signed byte/word/signed word) 0 init_plot_tables::@2/(byte) init_plot_tables::x#1 ) [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[39] (byte~) init_plot_tables::$0 ← (byte) init_plot_tables::x#2 & (byte/word/signed word) 248 [ init_plot_tables::x#2 init_plot_tables::bits#3 init_plot_tables::$0 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 init_plot_tables::$0 ] )
|
||||
[40] *((const byte*) plot_xlo#0 + (byte) init_plot_tables::x#2) ← (byte~) init_plot_tables::$0 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[41] *((const byte*) plot_xhi#0 + (byte) init_plot_tables::x#2) ← >(const byte*) BITMAP#0 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[42] *((const byte*) plot_bit#0 + (byte) init_plot_tables::x#2) ← (byte) init_plot_tables::bits#3 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[40] *((const byte[256]) plot_xlo#0 + (byte) init_plot_tables::x#2) ← (byte~) init_plot_tables::$0 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[41] *((const byte[256]) plot_xhi#0 + (byte) init_plot_tables::x#2) ← >(const byte*) BITMAP#0 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[42] *((const byte[256]) plot_bit#0 + (byte) init_plot_tables::x#2) ← (byte) init_plot_tables::bits#3 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] )
|
||||
[43] (byte) init_plot_tables::bits#1 ← (byte) init_plot_tables::bits#3 >> (byte/signed byte/word/signed word) 1 [ init_plot_tables::x#2 init_plot_tables::bits#1 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#1 ] )
|
||||
[44] if((byte) init_plot_tables::bits#1!=(byte/signed byte/word/signed word) 0) goto init_plot_tables::@10 [ init_plot_tables::x#2 init_plot_tables::bits#1 ] ( main:2::init_plot_tables:10 [ init_plot_tables::x#2 init_plot_tables::bits#1 ] )
|
||||
to:init_plot_tables::@2
|
||||
@ -88,9 +88,9 @@ init_plot_tables::@3: scope:[init_plot_tables] from init_plot_tables::@2 init_p
|
||||
[49] (byte~) init_plot_tables::$6 ← (byte) init_plot_tables::y#2 & (byte/signed byte/word/signed word) 7 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$6 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$6 ] )
|
||||
[50] (byte~) init_plot_tables::$7 ← < (byte*) init_plot_tables::yoffs#2 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$6 init_plot_tables::$7 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$6 init_plot_tables::$7 ] )
|
||||
[51] (byte~) init_plot_tables::$8 ← (byte~) init_plot_tables::$6 | (byte~) init_plot_tables::$7 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$8 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$8 ] )
|
||||
[52] *((const byte*) plot_ylo#0 + (byte) init_plot_tables::y#2) ← (byte~) init_plot_tables::$8 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] )
|
||||
[52] *((const byte[256]) plot_ylo#0 + (byte) init_plot_tables::y#2) ← (byte~) init_plot_tables::$8 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] )
|
||||
[53] (byte~) init_plot_tables::$9 ← > (byte*) init_plot_tables::yoffs#2 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$9 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$9 ] )
|
||||
[54] *((const byte*) plot_yhi#0 + (byte) init_plot_tables::y#2) ← (byte~) init_plot_tables::$9 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] )
|
||||
[54] *((const byte[256]) plot_yhi#0 + (byte) init_plot_tables::y#2) ← (byte~) init_plot_tables::$9 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] )
|
||||
[55] (byte~) init_plot_tables::$10 ← (byte) init_plot_tables::y#2 & (byte/signed byte/word/signed word) 7 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$10 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$10 ] )
|
||||
[56] if((byte~) init_plot_tables::$10!=(byte/signed byte/word/signed word) 7) goto init_plot_tables::@4 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] ( main:2::init_plot_tables:10 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 ] )
|
||||
to:init_plot_tables::@7
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -84,16 +84,16 @@
|
||||
(byte) plot::x#0 reg byte y 9.727272727272727
|
||||
(byte) plot::y
|
||||
(byte) plot::y#0 reg byte x 15.000000000000002
|
||||
(byte[]) plot_bit
|
||||
(const byte*) plot_bit#0 plot_bit = ((byte*))(word/signed word) 5120
|
||||
(byte[]) plot_xhi
|
||||
(const byte*) plot_xhi#0 plot_xhi = ((byte*))(word/signed word) 4352
|
||||
(byte[]) plot_xlo
|
||||
(const byte*) plot_xlo#0 plot_xlo = ((byte*))(word/signed word) 4096
|
||||
(byte[]) plot_yhi
|
||||
(const byte*) plot_yhi#0 plot_yhi = ((byte*))(word/signed word) 4864
|
||||
(byte[]) plot_ylo
|
||||
(const byte*) plot_ylo#0 plot_ylo = ((byte*))(word/signed word) 4608
|
||||
(byte[256]) plot_bit
|
||||
(const byte[256]) plot_bit#0 plot_bit = { fill( 256, 0) }
|
||||
(byte[256]) plot_xhi
|
||||
(const byte[256]) plot_xhi#0 plot_xhi = { fill( 256, 0) }
|
||||
(byte[256]) plot_xlo
|
||||
(const byte[256]) plot_xlo#0 plot_xlo = { fill( 256, 0) }
|
||||
(byte[256]) plot_yhi
|
||||
(const byte[256]) plot_yhi#0 plot_yhi = { fill( 256, 0) }
|
||||
(byte[256]) plot_ylo
|
||||
(const byte[256]) plot_ylo#0 plot_ylo = { fill( 256, 0) }
|
||||
(void()) plots()
|
||||
(label) plots::@1
|
||||
(label) plots::@3
|
||||
|
@ -1,4 +1,4 @@
|
||||
const byte[] plots = $1000;
|
||||
const byte* plots = $1000;
|
||||
const byte* SCREEN = $0400;
|
||||
|
||||
void main() {
|
||||
@ -28,12 +28,12 @@ void plot(byte x) {
|
||||
|
||||
Adding pre/post-modifier (byte) line::x ← ++ (byte) line::x
|
||||
PROGRAM
|
||||
(byte[]) plots ← (word/signed word) 4096
|
||||
(byte*) plots ← (word/signed word) 4096
|
||||
(byte*) SCREEN ← (word/signed word) 1024
|
||||
proc (void()) main()
|
||||
(byte) main::i ← (byte/signed byte/word/signed word) 0
|
||||
main::@1:
|
||||
*((byte[]) plots + (byte) main::i) ← (byte) main::i
|
||||
*((byte*) plots + (byte) main::i) ← (byte) main::i
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(boolean~) main::$0 ← (byte) main::i != (byte/signed byte/word/signed word) 40
|
||||
@ -62,7 +62,7 @@ line::@return:
|
||||
return
|
||||
endproc // line()
|
||||
proc (void()) plot((byte) plot::x)
|
||||
(byte) plot::idx ← *((byte[]) plots + (byte) plot::x)
|
||||
(byte) plot::idx ← *((byte*) plots + (byte) plot::x)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN + (byte) plot::idx) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN + (byte) plot::idx) ← (byte/word~) plot::$0
|
||||
plot::@return:
|
||||
@ -97,20 +97,20 @@ SYMBOLS
|
||||
(label) plot::@return
|
||||
(byte) plot::idx
|
||||
(byte) plot::x
|
||||
(byte[]) plots
|
||||
(byte*) plots
|
||||
|
||||
Promoting word/signed word to byte[] in plots ← ((byte*)) 4096
|
||||
Promoting word/signed word to byte* in plots ← ((byte*)) 4096
|
||||
Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte[]) plots + (byte) main::i) ← (byte) main::i
|
||||
*((byte*) plots + (byte) main::i) ← (byte) main::i
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(boolean~) main::$0 ← (byte) main::i != (byte/signed byte/word/signed word) 40
|
||||
@ -158,7 +158,7 @@ line::@return: scope:[line] from line::@3
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
plot: scope:[plot] from
|
||||
(byte) plot::idx ← *((byte[]) plots + (byte) plot::x)
|
||||
(byte) plot::idx ← *((byte*) plots + (byte) plot::x)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN + (byte) plot::idx) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN + (byte) plot::idx) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -182,14 +182,14 @@ Removing empty block line::@6
|
||||
Removing empty block @2
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word) 1024
|
||||
to:@3
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte[]) plots + (byte) main::i) ← (byte) main::i
|
||||
*((byte*) plots + (byte) main::i) ← (byte) main::i
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(boolean~) main::$0 ← (byte) main::i != (byte/signed byte/word/signed word) 40
|
||||
@ -223,7 +223,7 @@ line::@return: scope:[line] from line::@1 line::@2
|
||||
return
|
||||
to:@return
|
||||
plot: scope:[plot] from
|
||||
(byte) plot::idx ← *((byte[]) plots + (byte) plot::x)
|
||||
(byte) plot::idx ← *((byte*) plots + (byte) plot::x)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN + (byte) plot::idx) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN + (byte) plot::idx) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -239,14 +239,14 @@ PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word) 1024
|
||||
to:@3
|
||||
main: scope:[main] from @3
|
||||
(byte) main::i ← (byte/signed byte/word/signed word) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte[]) plots + (byte) main::i) ← (byte) main::i
|
||||
*((byte*) plots + (byte) main::i) ← (byte) main::i
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(boolean~) main::$0 ← (byte) main::i != (byte/signed byte/word/signed word) 40
|
||||
@ -290,7 +290,7 @@ line::@return: scope:[line] from line::@7 line::@8
|
||||
return
|
||||
to:@return
|
||||
plot: scope:[plot] from line::@1 line::@2
|
||||
(byte) plot::idx ← *((byte[]) plots + (byte) plot::x)
|
||||
(byte) plot::idx ← *((byte*) plots + (byte) plot::x)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN + (byte) plot::idx) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN + (byte) plot::idx) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -309,7 +309,7 @@ Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@3
|
||||
main: scope:[main] from @3
|
||||
@ -317,7 +317,7 @@ main: scope:[main] from @3
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
|
||||
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i#1 ← ++ (byte) main::i#2
|
||||
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
|
||||
@ -371,7 +371,7 @@ line::@return: scope:[line] from line::@7 line::@8
|
||||
to:@return
|
||||
plot: scope:[plot] from line::@1 line::@2
|
||||
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
|
||||
(byte) plot::idx#0 ← *((byte[]) plots#0 + (byte) plot::x#2)
|
||||
(byte) plot::idx#0 ← *((byte*) plots#0 + (byte) plot::x#2)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -387,7 +387,7 @@ plot::@return: scope:[plot] from plot
|
||||
|
||||
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@3
|
||||
main: scope:[main] from @3
|
||||
@ -395,7 +395,7 @@ main: scope:[main] from @3
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
|
||||
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i#1 ← ++ (byte) main::i#2
|
||||
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
|
||||
@ -449,7 +449,7 @@ line::@return: scope:[line] from line::@7 line::@8
|
||||
to:@return
|
||||
plot: scope:[plot] from line::@1 line::@2
|
||||
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
|
||||
(byte) plot::idx#0 ← *((byte[]) plots#0 + (byte) plot::x#2)
|
||||
(byte) plot::idx#0 ← *((byte*) plots#0 + (byte) plot::x#2)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -515,15 +515,15 @@ INITIAL SSA SYMBOL TABLE
|
||||
(byte) plot::x#0
|
||||
(byte) plot::x#1
|
||||
(byte) plot::x#2
|
||||
(byte[]) plots
|
||||
(byte[]) plots#0
|
||||
(byte*) plots
|
||||
(byte*) plots#0
|
||||
|
||||
Culled Empty Block (label) line::@7
|
||||
Culled Empty Block (label) @4
|
||||
Succesful SSA optimization Pass2CullEmptyBlocks
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@3
|
||||
main: scope:[main] from @3
|
||||
@ -531,7 +531,7 @@ main: scope:[main] from @3
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
|
||||
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i#1 ← ++ (byte) main::i#2
|
||||
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
|
||||
@ -583,7 +583,7 @@ line::@return: scope:[line] from line::@1 line::@8
|
||||
to:@return
|
||||
plot: scope:[plot] from line::@1 line::@2
|
||||
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
|
||||
(byte) plot::idx#0 ← *((byte[]) plots#0 + (byte) plot::x#2)
|
||||
(byte) plot::idx#0 ← *((byte*) plots#0 + (byte) plot::x#2)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -599,7 +599,7 @@ Inversing boolean not (boolean~) line::$1 ← (byte) line::x0#1 >= (byte) line::
|
||||
Succesful SSA optimization Pass2UnaryNotSimplification
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@3
|
||||
main: scope:[main] from @3
|
||||
@ -607,7 +607,7 @@ main: scope:[main] from @3
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
|
||||
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i#1 ← ++ (byte) main::i#2
|
||||
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
|
||||
@ -658,7 +658,7 @@ line::@return: scope:[line] from line::@1 line::@8
|
||||
to:@return
|
||||
plot: scope:[plot] from line::@1 line::@2
|
||||
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
|
||||
(byte) plot::idx#0 ← *((byte[]) plots#0 + (byte) plot::x#2)
|
||||
(byte) plot::idx#0 ← *((byte*) plots#0 + (byte) plot::x#2)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -682,7 +682,7 @@ Alias (byte) line::x1#2 = (byte) line::x1#3
|
||||
Succesful SSA optimization Pass2AliasElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@3
|
||||
main: scope:[main] from @3
|
||||
@ -690,7 +690,7 @@ main: scope:[main] from @3
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
|
||||
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i#1 ← ++ (byte) main::i#2
|
||||
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
|
||||
@ -735,7 +735,7 @@ line::@return: scope:[line] from line::@1 line::@8
|
||||
to:@return
|
||||
plot: scope:[plot] from line::@1 line::@2
|
||||
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
|
||||
(byte) plot::idx#0 ← *((byte[]) plots#0 + (byte) plot::x#2)
|
||||
(byte) plot::idx#0 ← *((byte*) plots#0 + (byte) plot::x#2)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -756,7 +756,7 @@ Self Phi Eliminated (byte) line::x1#2
|
||||
Succesful SSA optimization Pass2SelfPhiElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@3
|
||||
main: scope:[main] from @3
|
||||
@ -764,7 +764,7 @@ main: scope:[main] from @3
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
|
||||
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i#1 ← ++ (byte) main::i#2
|
||||
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
|
||||
@ -809,7 +809,7 @@ line::@return: scope:[line] from line::@1 line::@8
|
||||
to:@return
|
||||
plot: scope:[plot] from line::@1 line::@2
|
||||
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
|
||||
(byte) plot::idx#0 ← *((byte[]) plots#0 + (byte) plot::x#2)
|
||||
(byte) plot::idx#0 ← *((byte*) plots#0 + (byte) plot::x#2)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -827,7 +827,7 @@ Redundant Phi (byte) line::x1#2 (byte) line::x1#1
|
||||
Succesful SSA optimization Pass2RedundantPhiElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@3
|
||||
main: scope:[main] from @3
|
||||
@ -835,7 +835,7 @@ main: scope:[main] from @3
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
|
||||
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i#1 ← ++ (byte) main::i#2
|
||||
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
|
||||
@ -877,7 +877,7 @@ line::@return: scope:[line] from line::@1 line::@8
|
||||
to:@return
|
||||
plot: scope:[plot] from line::@1 line::@2
|
||||
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
|
||||
(byte) plot::idx#0 ← *((byte[]) plots#0 + (byte) plot::x#2)
|
||||
(byte) plot::idx#0 ← *((byte*) plots#0 + (byte) plot::x#2)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -895,7 +895,7 @@ Simple Condition (boolean~) line::$3 if((byte) line::x#1<=(byte) line::x1#0) got
|
||||
Succesful SSA optimization Pass2ConditionalJumpSimplification
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) plots#0 ← ((byte*)) (word/signed word) 4096
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
|
||||
to:@3
|
||||
main: scope:[main] from @3
|
||||
@ -903,7 +903,7 @@ main: scope:[main] from @3
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
|
||||
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2
|
||||
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
|
||||
(byte) main::i#1 ← ++ (byte) main::i#2
|
||||
if((byte) main::i#1!=(byte/signed byte/word/signed word) 40) goto main::@1
|
||||
@ -942,7 +942,7 @@ line::@return: scope:[line] from line::@1 line::@8
|
||||
to:@return
|
||||
plot: scope:[plot] from line::@1 line::@2
|
||||
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
|
||||
(byte) plot::idx#0 ← *((byte[]) plots#0 + (byte) plot::x#2)
|
||||
(byte) plot::idx#0 ← *((byte*) plots#0 + (byte) plot::x#2)
|
||||
(byte/word~) plot::$0 ← *((byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1
|
||||
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0
|
||||
to:plot::@return
|
||||
@ -1230,7 +1230,7 @@ FINAL SYMBOL TABLE
|
||||
(byte) plot::x
|
||||
(byte) plot::x#1
|
||||
(byte) plot::x#2
|
||||
(byte[]) plots
|
||||
(byte*) plots
|
||||
(const byte*) plots#0 = ((byte*))(word/signed word) 4096
|
||||
|
||||
Block Sequence Planned @begin @3 @end main main::@1 main::@2 main::@5 main::@return line line::@2 line::@8 line::@return line::@1 plot plot::@return
|
||||
@ -1573,7 +1573,7 @@ VARIABLE REGISTER WEIGHTS
|
||||
(byte) plot::x
|
||||
(byte) plot::x#1 202.0
|
||||
(byte) plot::x#2 103.0
|
||||
(byte[]) plots
|
||||
(byte*) plots
|
||||
|
||||
Initial phi equivalence classes
|
||||
[ main::i#2 main::i#1 ]
|
||||
@ -2000,7 +2000,7 @@ FINAL SYMBOL TABLE
|
||||
(byte) plot::x
|
||||
(byte) plot::x#1 reg byte y 202.0
|
||||
(byte) plot::x#2 reg byte y 103.0
|
||||
(byte[]) plots
|
||||
(byte*) plots
|
||||
(const byte*) plots#0 plots = ((byte*))(word/signed word) 4096
|
||||
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
|
@ -31,7 +31,7 @@
|
||||
(byte) plot::x
|
||||
(byte) plot::x#1 reg byte y 202.0
|
||||
(byte) plot::x#2 reg byte y 103.0
|
||||
(byte[]) plots
|
||||
(byte*) plots
|
||||
(const byte*) plots#0 plots = ((byte*))(word/signed word) 4096
|
||||
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
|
@ -1,10 +1,10 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.const SCREEN = $400
|
||||
.const buffer1 = $1000
|
||||
.const buffer2 = $1100
|
||||
.const RASTER = $d012
|
||||
.const SCREEN = $400
|
||||
buffer1: .fill 256, 0
|
||||
buffer2: .fill 256, 0
|
||||
jsr main
|
||||
main: {
|
||||
jsr prepare
|
||||
|
@ -47,7 +47,7 @@ plot::@1: scope:[plot] from plot plot::@3
|
||||
plot::@2: scope:[plot] from plot::@1 plot::@2
|
||||
[19] (byte) plot::x#2 ← phi( plot::@1/(byte/signed byte/word/signed word) 0 plot::@2/(byte) plot::x#1 ) [ plot::line#4 plot::y#4 plot::i#2 plot::x#2 ] ( main:2::plot:14 [ plot::line#4 plot::y#4 plot::i#2 plot::x#2 ] )
|
||||
[19] (byte) plot::i#2 ← phi( plot::@1/(byte) plot::i#3 plot::@2/(byte) plot::i#1 ) [ plot::line#4 plot::y#4 plot::i#2 plot::x#2 ] ( main:2::plot:14 [ plot::line#4 plot::y#4 plot::i#2 plot::x#2 ] )
|
||||
[20] *((byte*) plot::line#4 + (byte) plot::x#2) ← *((const byte*) buffer1#0 + (byte) plot::i#2) [ plot::line#4 plot::y#4 plot::i#2 plot::x#2 ] ( main:2::plot:14 [ plot::line#4 plot::y#4 plot::i#2 plot::x#2 ] )
|
||||
[20] *((byte*) plot::line#4 + (byte) plot::x#2) ← *((const byte[256]) buffer1#0 + (byte) plot::i#2) [ plot::line#4 plot::y#4 plot::i#2 plot::x#2 ] ( main:2::plot:14 [ plot::line#4 plot::y#4 plot::i#2 plot::x#2 ] )
|
||||
[21] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#4 plot::y#4 plot::i#1 plot::x#2 ] ( main:2::plot:14 [ plot::line#4 plot::y#4 plot::i#1 plot::x#2 ] )
|
||||
[22] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#4 plot::y#4 plot::i#1 plot::x#1 ] ( main:2::plot:14 [ plot::line#4 plot::y#4 plot::i#1 plot::x#1 ] )
|
||||
[23] if((byte) plot::x#1<(byte/signed byte/word/signed word) 16) goto plot::@2 [ plot::line#4 plot::y#4 plot::i#1 plot::x#1 ] ( main:2::plot:14 [ plot::line#4 plot::y#4 plot::i#1 plot::x#1 ] )
|
||||
@ -72,7 +72,7 @@ flip::@2: scope:[flip] from flip::@1 flip::@2
|
||||
[30] (byte) flip::c#2 ← phi( flip::@1/(byte/signed byte/word/signed word) 16 flip::@2/(byte) flip::c#1 ) [ flip::r#4 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] ( main:2::flip:12 [ flip::r#4 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] )
|
||||
[30] (byte) flip::dstIdx#3 ← phi( flip::@1/(byte) flip::dstIdx#5 flip::@2/(byte) flip::dstIdx#1 ) [ flip::r#4 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] ( main:2::flip:12 [ flip::r#4 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] )
|
||||
[30] (byte) flip::srcIdx#2 ← phi( flip::@1/(byte) flip::srcIdx#3 flip::@2/(byte) flip::srcIdx#1 ) [ flip::r#4 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] ( main:2::flip:12 [ flip::r#4 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] )
|
||||
[31] *((const byte*) buffer2#0 + (byte) flip::dstIdx#3) ← *((const byte*) buffer1#0 + (byte) flip::srcIdx#2) [ flip::r#4 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] ( main:2::flip:12 [ flip::r#4 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] )
|
||||
[31] *((const byte[256]) buffer2#0 + (byte) flip::dstIdx#3) ← *((const byte[256]) buffer1#0 + (byte) flip::srcIdx#2) [ flip::r#4 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] ( main:2::flip:12 [ flip::r#4 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] )
|
||||
[32] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#4 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] ( main:2::flip:12 [ flip::r#4 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] )
|
||||
[33] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte/signed byte/word/signed word) 16 [ flip::r#4 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] ( main:2::flip:12 [ flip::r#4 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] )
|
||||
[34] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#4 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] ( main:2::flip:12 [ flip::r#4 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] )
|
||||
@ -85,7 +85,7 @@ flip::@4: scope:[flip] from flip::@2
|
||||
to:flip::@3
|
||||
flip::@3: scope:[flip] from flip::@3 flip::@4
|
||||
[39] (byte) flip::i#2 ← phi( flip::@3/(byte) flip::i#1 flip::@4/(byte/signed byte/word/signed word) 0 ) [ flip::i#2 ] ( main:2::flip:12 [ flip::i#2 ] )
|
||||
[40] *((const byte*) buffer1#0 + (byte) flip::i#2) ← *((const byte*) buffer2#0 + (byte) flip::i#2) [ flip::i#2 ] ( main:2::flip:12 [ flip::i#2 ] )
|
||||
[40] *((const byte[256]) buffer1#0 + (byte) flip::i#2) ← *((const byte[256]) buffer2#0 + (byte) flip::i#2) [ flip::i#2 ] ( main:2::flip:12 [ flip::i#2 ] )
|
||||
[41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] ( main:2::flip:12 [ flip::i#1 ] )
|
||||
[42] if((byte) flip::i#1!=(byte/signed byte/word/signed word) 0) goto flip::@3 [ flip::i#1 ] ( main:2::flip:12 [ flip::i#1 ] )
|
||||
to:flip::@return
|
||||
@ -97,7 +97,7 @@ prepare: scope:[prepare] from main
|
||||
to:prepare::@1
|
||||
prepare::@1: scope:[prepare] from prepare prepare::@1
|
||||
[45] (byte) prepare::i#2 ← phi( prepare/(byte/signed byte/word/signed word) 0 prepare::@1/(byte) prepare::i#1 ) [ prepare::i#2 ] ( main:2::prepare:5 [ prepare::i#2 ] )
|
||||
[46] *((const byte*) buffer1#0 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] ( main:2::prepare:5 [ prepare::i#2 ] )
|
||||
[46] *((const byte[256]) buffer1#0 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] ( main:2::prepare:5 [ prepare::i#2 ] )
|
||||
[47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] ( main:2::prepare:5 [ prepare::i#1 ] )
|
||||
[48] if((byte) prepare::i#1!=(byte/signed byte/word/signed word) 0) goto prepare::@1 [ prepare::i#1 ] ( main:2::prepare:5 [ prepare::i#1 ] )
|
||||
to:prepare::@return
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,12 +3,12 @@
|
||||
(label) @end
|
||||
(byte*) RASTER
|
||||
(const byte*) RASTER#0 RASTER = ((byte*))(word) 53266
|
||||
(byte[1000]) SCREEN
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word) 1024
|
||||
(byte[256]) buffer1
|
||||
(const byte*) buffer1#0 buffer1 = ((byte*))(word/signed word) 4096
|
||||
(const byte[256]) buffer1#0 buffer1 = { fill( 256, 0) }
|
||||
(byte[256]) buffer2
|
||||
(const byte*) buffer2#0 buffer2 = ((byte*))(word/signed word) 4352
|
||||
(const byte[256]) buffer2#0 buffer2 = { fill( 256, 0) }
|
||||
(void()) flip()
|
||||
(label) flip::@1
|
||||
(label) flip::@2
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -91,21 +91,21 @@
|
||||
(byte) scroll_hard::i
|
||||
(byte) scroll_hard::i#1 reg byte x 16.5
|
||||
(byte) scroll_hard::i#2 reg byte x 21.999999999999993
|
||||
(byte[]) scroll_hard::line0
|
||||
(byte*) scroll_hard::line0
|
||||
(const byte*) scroll_hard::line0#0 line0 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 0
|
||||
(byte[]) scroll_hard::line1
|
||||
(byte*) scroll_hard::line1
|
||||
(const byte*) scroll_hard::line1#0 line1 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 1
|
||||
(byte[]) scroll_hard::line2
|
||||
(byte*) scroll_hard::line2
|
||||
(const byte*) scroll_hard::line2#0 line2 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 2
|
||||
(byte[]) scroll_hard::line3
|
||||
(byte*) scroll_hard::line3
|
||||
(const byte*) scroll_hard::line3#0 line3 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 3
|
||||
(byte[]) scroll_hard::line4
|
||||
(byte*) scroll_hard::line4
|
||||
(const byte*) scroll_hard::line4#0 line4 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 4
|
||||
(byte[]) scroll_hard::line5
|
||||
(byte*) scroll_hard::line5
|
||||
(const byte*) scroll_hard::line5#0 line5 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 5
|
||||
(byte[]) scroll_hard::line6
|
||||
(byte*) scroll_hard::line6
|
||||
(const byte*) scroll_hard::line6#0 line6 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 6
|
||||
(byte[]) scroll_hard::line7
|
||||
(byte*) scroll_hard::line7
|
||||
(const byte*) scroll_hard::line7#0 line7 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 7
|
||||
(void()) scroll_soft()
|
||||
(label) scroll_soft::@1
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
void main() {
|
||||
byte[] screen = $0400;
|
||||
byte* screen = $0400;
|
||||
byte j = 0;
|
||||
signed byte i = -127;
|
||||
while(i<127) {
|
||||
@ -14,7 +14,7 @@ Adding pre/post-modifier (signed byte) main::i ← ++ (signed byte) main::i
|
||||
Adding pre/post-modifier (byte) main::j ← ++ (byte) main::j
|
||||
PROGRAM
|
||||
proc (void()) main()
|
||||
(byte[]) main::screen ← (word/signed word) 1024
|
||||
(byte*) main::screen ← (word/signed word) 1024
|
||||
(byte) main::j ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte/signed word~) main::$0 ← - (byte/signed byte/word/signed word) 127
|
||||
(signed byte) main::i ← (signed byte/signed word~) main::$0
|
||||
@ -24,7 +24,7 @@ main::@1:
|
||||
goto main::@3
|
||||
main::@2:
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i
|
||||
*((byte[]) main::screen + (byte) main::j) ← (byte~) main::$2
|
||||
*((byte*) main::screen + (byte) main::j) ← (byte~) main::$2
|
||||
(signed byte) main::i ← ++ (signed byte) main::i
|
||||
(byte) main::j ← ++ (byte) main::j
|
||||
goto main::@1
|
||||
@ -45,14 +45,14 @@ SYMBOLS
|
||||
(label) main::@return
|
||||
(signed byte) main::i
|
||||
(byte) main::j
|
||||
(byte[]) main::screen
|
||||
(byte*) main::screen
|
||||
|
||||
Promoting word/signed word to byte[] in main::screen ← ((byte*)) 1024
|
||||
Promoting word/signed word to byte* in main::screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte[]) main::screen ← ((byte*)) (word/signed word) 1024
|
||||
(byte*) main::screen ← ((byte*)) (word/signed word) 1024
|
||||
(byte) main::j ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte/signed word~) main::$0 ← - (byte/signed byte/word/signed word) 127
|
||||
(signed byte) main::i ← (signed byte/signed word~) main::$0
|
||||
@ -63,7 +63,7 @@ main::@1: scope:[main] from main main::@2
|
||||
to:main::@4
|
||||
main::@2: scope:[main] from main::@1 main::@5
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i
|
||||
*((byte[]) main::screen + (byte) main::j) ← (byte~) main::$2
|
||||
*((byte*) main::screen + (byte) main::j) ← (byte~) main::$2
|
||||
(signed byte) main::i ← ++ (signed byte) main::i
|
||||
(byte) main::j ← ++ (byte) main::j
|
||||
to:main::@1
|
||||
@ -91,7 +91,7 @@ CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte[]) main::screen ← ((byte*)) (word/signed word) 1024
|
||||
(byte*) main::screen ← ((byte*)) (word/signed word) 1024
|
||||
(byte) main::j ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte/signed word~) main::$0 ← - (byte/signed byte/word/signed word) 127
|
||||
(signed byte) main::i ← (signed byte/signed word~) main::$0
|
||||
@ -102,7 +102,7 @@ main::@1: scope:[main] from main main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i
|
||||
*((byte[]) main::screen + (byte) main::j) ← (byte~) main::$2
|
||||
*((byte*) main::screen + (byte) main::j) ← (byte~) main::$2
|
||||
(signed byte) main::i ← ++ (signed byte) main::i
|
||||
(byte) main::j ← ++ (byte) main::j
|
||||
to:main::@1
|
||||
@ -120,7 +120,7 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte[]) main::screen ← ((byte*)) (word/signed word) 1024
|
||||
(byte*) main::screen ← ((byte*)) (word/signed word) 1024
|
||||
(byte) main::j ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte/signed word~) main::$0 ← - (byte/signed byte/word/signed word) 127
|
||||
(signed byte) main::i ← (signed byte/signed word~) main::$0
|
||||
@ -131,7 +131,7 @@ main::@1: scope:[main] from main main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i
|
||||
*((byte[]) main::screen + (byte) main::j) ← (byte~) main::$2
|
||||
*((byte*) main::screen + (byte) main::j) ← (byte~) main::$2
|
||||
(signed byte) main::i ← ++ (signed byte) main::i
|
||||
(byte) main::j ← ++ (byte) main::j
|
||||
to:main::@1
|
||||
@ -151,22 +151,24 @@ CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte[]) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte) main::j#0 ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte/signed word~) main::$0 ← - (byte/signed byte/word/signed word) 127
|
||||
(signed byte) main::i#0 ← (signed byte/signed word~) main::$0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
(byte) main::j#3 ← phi( main/(byte) main::j#0 main::@2/(byte) main::j#1 )
|
||||
(byte*) main::screen#2 ← phi( main/(byte*) main::screen#0 main::@2/(byte*) main::screen#1 )
|
||||
(signed byte) main::i#2 ← phi( main/(signed byte) main::i#0 main::@2/(signed byte) main::i#1 )
|
||||
(boolean~) main::$1 ← (signed byte) main::i#2 < (byte/signed byte/word/signed word) 127
|
||||
if((boolean~) main::$1) goto main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
(byte) main::j#2 ← phi( main::@1/(byte) main::j#3 )
|
||||
(byte*) main::screen#1 ← phi( main::@1/(byte*) main::screen#2 )
|
||||
(signed byte) main::i#3 ← phi( main::@1/(signed byte) main::i#2 )
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i#3
|
||||
*((byte[]) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2
|
||||
*((byte*) main::screen#1 + (byte) main::j#2) ← (byte~) main::$2
|
||||
(signed byte) main::i#1 ← ++ (signed byte) main::i#3
|
||||
(byte) main::j#1 ← ++ (byte) main::j#2
|
||||
to:main::@1
|
||||
@ -184,22 +186,24 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte[]) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte) main::j#0 ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte/signed word~) main::$0 ← - (byte/signed byte/word/signed word) 127
|
||||
(signed byte) main::i#0 ← (signed byte/signed word~) main::$0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
(byte) main::j#3 ← phi( main/(byte) main::j#0 main::@2/(byte) main::j#1 )
|
||||
(byte*) main::screen#2 ← phi( main/(byte*) main::screen#0 main::@2/(byte*) main::screen#1 )
|
||||
(signed byte) main::i#2 ← phi( main/(signed byte) main::i#0 main::@2/(signed byte) main::i#1 )
|
||||
(boolean~) main::$1 ← (signed byte) main::i#2 < (byte/signed byte/word/signed word) 127
|
||||
if((boolean~) main::$1) goto main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
(byte) main::j#2 ← phi( main::@1/(byte) main::j#3 )
|
||||
(byte*) main::screen#1 ← phi( main::@1/(byte*) main::screen#2 )
|
||||
(signed byte) main::i#3 ← phi( main::@1/(signed byte) main::i#2 )
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i#3
|
||||
*((byte[]) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2
|
||||
*((byte*) main::screen#1 + (byte) main::j#2) ← (byte~) main::$2
|
||||
(signed byte) main::i#1 ← ++ (signed byte) main::i#3
|
||||
(byte) main::j#1 ← ++ (byte) main::j#2
|
||||
to:main::@1
|
||||
@ -235,8 +239,10 @@ INITIAL SSA SYMBOL TABLE
|
||||
(byte) main::j#1
|
||||
(byte) main::j#2
|
||||
(byte) main::j#3
|
||||
(byte[]) main::screen
|
||||
(byte[]) main::screen#0
|
||||
(byte*) main::screen
|
||||
(byte*) main::screen#0
|
||||
(byte*) main::screen#1
|
||||
(byte*) main::screen#2
|
||||
|
||||
Culled Empty Block (label) @2
|
||||
Succesful SSA optimization Pass2CullEmptyBlocks
|
||||
@ -244,22 +250,24 @@ CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte[]) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte) main::j#0 ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte/signed word~) main::$0 ← - (byte/signed byte/word/signed word) 127
|
||||
(signed byte) main::i#0 ← (signed byte/signed word~) main::$0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
(byte) main::j#3 ← phi( main/(byte) main::j#0 main::@2/(byte) main::j#1 )
|
||||
(byte*) main::screen#2 ← phi( main/(byte*) main::screen#0 main::@2/(byte*) main::screen#1 )
|
||||
(signed byte) main::i#2 ← phi( main/(signed byte) main::i#0 main::@2/(signed byte) main::i#1 )
|
||||
(boolean~) main::$1 ← (signed byte) main::i#2 < (byte/signed byte/word/signed word) 127
|
||||
if((boolean~) main::$1) goto main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
(byte) main::j#2 ← phi( main::@1/(byte) main::j#3 )
|
||||
(byte*) main::screen#1 ← phi( main::@1/(byte*) main::screen#2 )
|
||||
(signed byte) main::i#3 ← phi( main::@1/(signed byte) main::i#2 )
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i#3
|
||||
*((byte[]) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2
|
||||
*((byte*) main::screen#1 + (byte) main::j#2) ← (byte~) main::$2
|
||||
(signed byte) main::i#1 ← ++ (signed byte) main::i#3
|
||||
(byte) main::j#1 ← ++ (byte) main::j#2
|
||||
to:main::@1
|
||||
@ -273,13 +281,76 @@ main::@return: scope:[main] from main::@1
|
||||
|
||||
Alias (signed byte) main::i#0 = (signed byte/signed word~) main::$0
|
||||
Alias (signed byte) main::i#2 = (signed byte) main::i#3
|
||||
Alias (byte*) main::screen#1 = (byte*) main::screen#2
|
||||
Alias (byte) main::j#2 = (byte) main::j#3
|
||||
Succesful SSA optimization Pass2AliasElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte[]) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte) main::j#0 ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte) main::i#0 ← - (byte/signed byte/word/signed word) 127
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
(byte) main::j#2 ← phi( main/(byte) main::j#0 main::@2/(byte) main::j#1 )
|
||||
(byte*) main::screen#1 ← phi( main/(byte*) main::screen#0 main::@2/(byte*) main::screen#1 )
|
||||
(signed byte) main::i#2 ← phi( main/(signed byte) main::i#0 main::@2/(signed byte) main::i#1 )
|
||||
(boolean~) main::$1 ← (signed byte) main::i#2 < (byte/signed byte/word/signed word) 127
|
||||
if((boolean~) main::$1) goto main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i#2
|
||||
*((byte*) main::screen#1 + (byte) main::j#2) ← (byte~) main::$2
|
||||
(signed byte) main::i#1 ← ++ (signed byte) main::i#2
|
||||
(byte) main::j#1 ← ++ (byte) main::j#2
|
||||
to:main::@1
|
||||
main::@return: scope:[main] from main::@1
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main param-assignment
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Self Phi Eliminated (byte*) main::screen#1
|
||||
Succesful SSA optimization Pass2SelfPhiElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte) main::j#0 ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte) main::i#0 ← - (byte/signed byte/word/signed word) 127
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
(byte) main::j#2 ← phi( main/(byte) main::j#0 main::@2/(byte) main::j#1 )
|
||||
(byte*) main::screen#1 ← phi( main/(byte*) main::screen#0 )
|
||||
(signed byte) main::i#2 ← phi( main/(signed byte) main::i#0 main::@2/(signed byte) main::i#1 )
|
||||
(boolean~) main::$1 ← (signed byte) main::i#2 < (byte/signed byte/word/signed word) 127
|
||||
if((boolean~) main::$1) goto main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i#2
|
||||
*((byte*) main::screen#1 + (byte) main::j#2) ← (byte~) main::$2
|
||||
(signed byte) main::i#1 ← ++ (signed byte) main::i#2
|
||||
(byte) main::j#1 ← ++ (byte) main::j#2
|
||||
to:main::@1
|
||||
main::@return: scope:[main] from main::@1
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main param-assignment
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Redundant Phi (byte*) main::screen#1 (byte*) main::screen#0
|
||||
Succesful SSA optimization Pass2RedundantPhiElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte) main::j#0 ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte) main::i#0 ← - (byte/signed byte/word/signed word) 127
|
||||
to:main::@1
|
||||
@ -291,7 +362,7 @@ main::@1: scope:[main] from main main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i#2
|
||||
*((byte[]) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2
|
||||
*((byte*) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2
|
||||
(signed byte) main::i#1 ← ++ (signed byte) main::i#2
|
||||
(byte) main::j#1 ← ++ (byte) main::j#2
|
||||
to:main::@1
|
||||
@ -309,7 +380,7 @@ CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
(byte[]) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte) main::j#0 ← (byte/signed byte/word/signed word) 0
|
||||
(signed byte) main::i#0 ← - (byte/signed byte/word/signed word) 127
|
||||
to:main::@1
|
||||
@ -320,7 +391,7 @@ main::@1: scope:[main] from main main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
(byte~) main::$2 ← ((byte)) (signed byte) main::i#2
|
||||
*((byte[]) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2
|
||||
*((byte*) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2
|
||||
(signed byte) main::i#1 ← ++ (signed byte) main::i#2
|
||||
(byte) main::j#1 ← ++ (byte) main::j#2
|
||||
to:main::@1
|
||||
@ -406,7 +477,7 @@ FINAL SYMBOL TABLE
|
||||
(byte) main::j
|
||||
(byte) main::j#1
|
||||
(byte) main::j#2
|
||||
(byte[]) main::screen
|
||||
(byte*) main::screen
|
||||
(const byte*) main::screen#0 = ((byte*))(word/signed word) 1024
|
||||
|
||||
Block Sequence Planned @begin @1 @end main main::@1 main::@return main::@2
|
||||
@ -577,7 +648,7 @@ VARIABLE REGISTER WEIGHTS
|
||||
(byte) main::j
|
||||
(byte) main::j#1 22.0
|
||||
(byte) main::j#2 6.6000000000000005
|
||||
(byte[]) main::screen
|
||||
(byte*) main::screen
|
||||
|
||||
Initial phi equivalence classes
|
||||
[ main::i#2 main::i#1 ]
|
||||
@ -794,7 +865,7 @@ FINAL SYMBOL TABLE
|
||||
(byte) main::j
|
||||
(byte) main::j#1 reg byte x 22.0
|
||||
(byte) main::j#2 reg byte x 6.6000000000000005
|
||||
(byte[]) main::screen
|
||||
(byte*) main::screen
|
||||
(const byte*) main::screen#0 screen = ((byte*))(word/signed word) 1024
|
||||
|
||||
zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
|
||||
|
@ -12,7 +12,7 @@
|
||||
(byte) main::j
|
||||
(byte) main::j#1 reg byte x 22.0
|
||||
(byte) main::j#2 reg byte x 6.6000000000000005
|
||||
(byte[]) main::screen
|
||||
(byte*) main::screen
|
||||
(const byte*) main::screen#0 screen = ((byte*))(word/signed word) 1024
|
||||
|
||||
zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
|
||||
|
@ -17,14 +17,14 @@
|
||||
.const memHi = $ff
|
||||
.const SCREEN = $400
|
||||
.const sinlen_x = $dd
|
||||
.const sintab_x = $1000
|
||||
.const sinlen_y = $c5
|
||||
.const sintab_y = $1100
|
||||
.const sprites = $2000
|
||||
.label progress_idx = 4
|
||||
.label progress_cursor = $a
|
||||
.label sin_idx_x = 2
|
||||
.label sin_idx_y = 3
|
||||
sintab_x: .fill 221, 0
|
||||
sintab_y: .fill 197, 0
|
||||
jsr main
|
||||
main: {
|
||||
jsr init
|
||||
|
@ -37,13 +37,13 @@ anim::@1: scope:[anim] from anim anim::@3
|
||||
[15] (byte) anim::j2#3 ← phi( anim/(byte/signed byte/word/signed word) 12 anim::@3/(byte) anim::j2#2 ) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::x_msb#2 anim::j2#3 anim::yidx#3 anim::j#2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::x_msb#2 anim::j2#3 anim::yidx#3 anim::j#2 ] )
|
||||
[15] (byte) anim::x_msb#2 ← phi( anim/(byte/signed byte/word/signed word) 0 anim::@3/(byte) anim::x_msb#1 ) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::x_msb#2 anim::j2#3 anim::yidx#3 anim::j#2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::x_msb#2 anim::j2#3 anim::yidx#3 anim::j#2 ] )
|
||||
[15] (byte) anim::xidx#3 ← phi( anim/(byte) anim::xidx#0 anim::@3/(byte) anim::xidx#5 ) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::x_msb#2 anim::j2#3 anim::yidx#3 anim::j#2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::x_msb#2 anim::j2#3 anim::yidx#3 anim::j#2 ] )
|
||||
[16] (word) anim::x#0 ← ((word))(byte/signed byte/word/signed word) 30 + *((const byte*) sintab_x#0 + (byte) anim::xidx#3) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::x_msb#2 anim::j2#3 anim::yidx#3 anim::j#2 anim::x#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::x_msb#2 anim::j2#3 anim::yidx#3 anim::j#2 anim::x#0 ] )
|
||||
[16] (word) anim::x#0 ← ((word))(byte/signed byte/word/signed word) 30 + *((const byte[221]) sintab_x#0 + (byte) anim::xidx#3) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::x_msb#2 anim::j2#3 anim::yidx#3 anim::j#2 anim::x#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::x_msb#2 anim::j2#3 anim::yidx#3 anim::j#2 anim::x#0 ] )
|
||||
[17] (byte~) anim::$2 ← (byte) anim::x_msb#2 << (byte/signed byte/word/signed word) 1 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 ] )
|
||||
[18] (byte~) anim::$3 ← > (word) anim::x#0 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 anim::$3 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 anim::$3 ] )
|
||||
[19] (byte) anim::x_msb#1 ← (byte~) anim::$2 | (byte~) anim::$3 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::x#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::x#0 ] )
|
||||
[20] (byte~) anim::$5 ← < (word) anim::x#0 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::$5 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::$5 ] )
|
||||
[21] *((const byte*) SPRITES_XPOS#0 + (byte) anim::j2#3) ← (byte~) anim::$5 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 ] )
|
||||
[22] *((const byte*) SPRITES_YPOS#0 + (byte) anim::j2#3) ← *((const byte*) sintab_y#0 + (byte) anim::yidx#3) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 ] )
|
||||
[22] *((const byte*) SPRITES_YPOS#0 + (byte) anim::j2#3) ← *((const byte[197]) sintab_y#0 + (byte) anim::yidx#3) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 ] )
|
||||
[23] (byte) anim::xidx#1 ← (byte) anim::xidx#3 + (byte/signed byte/word/signed word) 10 [ sin_idx_x#13 sin_idx_y#13 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::xidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::xidx#1 ] )
|
||||
[24] if((byte) anim::xidx#1<(const byte) sinlen_x#0) goto anim::@2 [ sin_idx_x#13 sin_idx_y#13 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::xidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#3 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::xidx#1 ] )
|
||||
to:anim::@6
|
||||
@ -143,7 +143,7 @@ clear_screen::@return: scope:[clear_screen] from clear_screen::@1
|
||||
[73] return [ ] ( main:2::init:5::clear_screen:47 [ ] main:2::init:5::clear_screen:66 [ ] )
|
||||
to:@return
|
||||
gen_sintab: scope:[gen_sintab] from init::@6 init::@8
|
||||
[74] (byte*) gen_sintab::sintab#12 ← phi( init::@6/(const byte*) sintab_x#0 init::@8/(const byte*) sintab_y#0 ) [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] ( main:2::init:5::gen_sintab:60 [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] main:2::init:5::gen_sintab:64 [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] )
|
||||
[74] (byte*) gen_sintab::sintab#12 ← phi( init::@6/(const byte[221]) sintab_x#0 init::@8/(const byte[197]) sintab_y#0 ) [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] ( main:2::init:5::gen_sintab:60 [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] main:2::init:5::gen_sintab:64 [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] )
|
||||
[74] (byte) gen_sintab::length#10 ← phi( init::@6/(const byte) sinlen_x#0 init::@8/(const byte) sinlen_y#0 ) [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] ( main:2::init:5::gen_sintab:60 [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] main:2::init:5::gen_sintab:64 [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] )
|
||||
[74] (byte) gen_sintab::min#2 ← phi( init::@6/(byte/signed byte/word/signed word) 0 init::@8/(byte/signed byte/word/signed word) 50 ) [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] ( main:2::init:5::gen_sintab:60 [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] main:2::init:5::gen_sintab:64 [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] )
|
||||
[74] (byte) gen_sintab::max#2 ← phi( init::@6/(byte/word/signed word) 255 init::@8/(byte/word/signed word) 208 ) [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] ( main:2::init:5::gen_sintab:60 [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] main:2::init:5::gen_sintab:64 [ gen_sintab::max#2 gen_sintab::min#2 gen_sintab::length#10 gen_sintab::sintab#12 progress_init::line#2 ] )
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -304,11 +304,11 @@
|
||||
(const byte) sinlen_x#0 sinlen_x = (byte/word/signed word) 221
|
||||
(byte) sinlen_y
|
||||
(const byte) sinlen_y#0 sinlen_y = (byte/word/signed word) 197
|
||||
(byte[]) sintab_x
|
||||
(const byte*) sintab_x#0 sintab_x = ((byte*))(word/signed word) 4096
|
||||
(byte[]) sintab_y
|
||||
(const byte*) sintab_y#0 sintab_y = ((byte*))(word/signed word) 4352
|
||||
(byte[]) sprites
|
||||
(byte[221]) sintab_x
|
||||
(const byte[221]) sintab_x#0 sintab_x = { fill( 221, 0) }
|
||||
(byte[197]) sintab_y
|
||||
(const byte[197]) sintab_y#0 sintab_y = { fill( 197, 0) }
|
||||
(byte*) sprites
|
||||
(const byte*) sprites#0 sprites = ((byte*))(word/signed word) 8192
|
||||
(void()) subFACfromARG()
|
||||
(label) subFACfromARG::@return
|
||||
|
@ -71,14 +71,14 @@ byte next_char() {
|
||||
|
||||
void scroll_hard() {
|
||||
// Hard scroll
|
||||
byte[] line0 = SCREEN+40*0;
|
||||
byte[] line1 = SCREEN+40*1;
|
||||
byte[] line2 = SCREEN+40*2;
|
||||
byte[] line3 = SCREEN+40*3;
|
||||
byte[] line4 = SCREEN+40*4;
|
||||
byte[] line5 = SCREEN+40*5;
|
||||
byte[] line6 = SCREEN+40*6;
|
||||
byte[] line7 = SCREEN+40*7;
|
||||
byte* line0 = SCREEN+40*0;
|
||||
byte* line1 = SCREEN+40*1;
|
||||
byte* line2 = SCREEN+40*2;
|
||||
byte* line3 = SCREEN+40*3;
|
||||
byte* line4 = SCREEN+40*4;
|
||||
byte* line5 = SCREEN+40*5;
|
||||
byte* line6 = SCREEN+40*6;
|
||||
byte* line7 = SCREEN+40*7;
|
||||
for(byte i=0;i!=39;i++) {
|
||||
line0[i]=line0[i+1];
|
||||
line1[i]=line1[i+1];
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
void main() {
|
||||
byte[] screen = $0400;
|
||||
byte* screen = $0400;
|
||||
byte j = 0;
|
||||
signed byte i = -127;
|
||||
while(i<127) {
|
||||
|
@ -5,10 +5,10 @@ import "print"
|
||||
const byte* SCREEN = $0400;
|
||||
|
||||
const byte sinlen_x = 221;
|
||||
const byte[] sintab_x = $1000;
|
||||
const byte[221] sintab_x;
|
||||
const byte sinlen_y = 197;
|
||||
const byte[] sintab_y = $1100;
|
||||
const byte[] sprites = $2000;
|
||||
const byte[197] sintab_y;
|
||||
const byte* sprites = $2000;
|
||||
|
||||
void main() {
|
||||
init();
|
||||
|
Loading…
x
Reference in New Issue
Block a user