mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-04-13 03:39:12 +00:00
Removed a bit more logging.
This commit is contained in:
parent
2c6fab8fe4
commit
63badba136
@ -52,6 +52,16 @@ public class CompileLog {
|
||||
*/
|
||||
private boolean verboseSequencePlan = false;
|
||||
|
||||
/**
|
||||
* Should the parsing be verbose.
|
||||
*/
|
||||
private boolean verboseParse = false;
|
||||
|
||||
/**
|
||||
* Should the creation of the SSA be verbose.
|
||||
*/
|
||||
private boolean verboseCreateSsa = false;
|
||||
|
||||
|
||||
/**
|
||||
* Should the log be output to System.out while being built
|
||||
@ -130,6 +140,14 @@ public class CompileLog {
|
||||
return verboseSequencePlan;
|
||||
}
|
||||
|
||||
public boolean isVerboseParse() {
|
||||
return verboseParse;
|
||||
}
|
||||
|
||||
public boolean isVerbosePass1CreateSsa() {
|
||||
return verboseCreateSsa;
|
||||
}
|
||||
|
||||
public boolean isSysOut() {
|
||||
return sysOut;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class Compiler {
|
||||
this.program = new Program();
|
||||
}
|
||||
|
||||
public static void loadAndParseFile(String fileName, Program program, Pass0GenerateStatementSequence pass0GenerateStatementSequence) {
|
||||
public static void loadAndParseFile(String fileName, Program program, Pass0GenerateStatementSequence pass0GenerateStatementSequence, boolean isImport) {
|
||||
try {
|
||||
if(!fileName.endsWith(".kc")) {
|
||||
fileName += ".kc";
|
||||
@ -39,8 +39,10 @@ public class Compiler {
|
||||
}
|
||||
final CharStream fileStream = CharStreams.fromPath(file.toPath());
|
||||
imported.add(file.getAbsolutePath());
|
||||
program.getLog().append("PARSING " + file.getPath().replace("\\", "/"));
|
||||
program.getLog().append(fileStream.toString());
|
||||
if(program.getLog().isVerboseParse()) {
|
||||
program.getLog().append("PARSING " + file.getPath().replace("\\", "/"));
|
||||
program.getLog().append(fileStream.toString());
|
||||
}
|
||||
KickCLexer lexer = new KickCLexer(fileStream);
|
||||
KickCParser parser = new KickCParser(new CommonTokenStream(lexer));
|
||||
parser.setBuildParseTree(true);
|
||||
@ -89,7 +91,7 @@ public class Compiler {
|
||||
program.setFileName(fileName);
|
||||
try {
|
||||
Pass0GenerateStatementSequence pass0GenerateStatementSequence = new Pass0GenerateStatementSequence(program);
|
||||
loadAndParseFile(fileName, program, pass0GenerateStatementSequence);
|
||||
loadAndParseFile(fileName, program, pass0GenerateStatementSequence, false);
|
||||
StatementSequence sequence = pass0GenerateStatementSequence.getSequence();
|
||||
sequence.addStatement(new StatementCall(null, "main", new ArrayList<>(), new StatementSource(RuleContext.EMPTY)));
|
||||
program.setStatementSequence(sequence);
|
||||
@ -118,8 +120,10 @@ public class Compiler {
|
||||
new Pass1ResolveForwardReferences(program).execute();
|
||||
new Pass1TypeInference(program).execute();
|
||||
|
||||
getLog().append("SYMBOLS");
|
||||
getLog().append(program.getScope().getSymbolTableContents(program));
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("SYMBOLS");
|
||||
getLog().append(program.getScope().getSymbolTableContents(program));
|
||||
}
|
||||
|
||||
new Pass1FixLValuesLoHi(program).execute();
|
||||
new Pass1AssertNoLValueIntermediate(program).execute();
|
||||
@ -127,27 +131,26 @@ public class Compiler {
|
||||
new Pass1AssertNoRecursion(program).execute();
|
||||
new Pass1AssertInterrupts(program).execute();
|
||||
|
||||
getLog().append("INITIAL CONTROL FLOW GRAPH");
|
||||
getLog().append(program.getGraph().toString(program));
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("INITIAL CONTROL FLOW GRAPH");
|
||||
getLog().append(program.getGraph().toString(program));
|
||||
}
|
||||
|
||||
new Pass1AssertReturn(program).execute();
|
||||
new Pass1AssertUsedVars(program).execute();
|
||||
|
||||
new Pass1ProcedureInline(program).execute();
|
||||
//getLog().append("INLINED CONTROL FLOW GRAPH");
|
||||
//getLog().append(program.getGraph().toString(program));
|
||||
|
||||
new Pass1EliminateUncalledProcedures(program).execute();
|
||||
new PassNEliminateUnusedVars(program).execute();
|
||||
new Pass1ExtractInlineStrings(program).execute();
|
||||
new Pass1EliminateEmptyBlocks(program).execute();
|
||||
|
||||
//getLog().append("CONTROL FLOW GRAPH");
|
||||
//getLog().append(program.getGraph().toString(program));
|
||||
|
||||
getLog().append("PROCEDURE MODIFY VARIABLE ANALYSIS");
|
||||
new Pass1ModifiedVarsAnalysis(program).execute();
|
||||
getLog().append(program.getProcedureModifiedVars().toString(program));
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("PROCEDURE MODIFY VARIABLE ANALYSIS");
|
||||
getLog().append(program.getProcedureModifiedVars().toString(program));
|
||||
}
|
||||
|
||||
new Pass1ProcedureCallParameters(program).generate();
|
||||
//getLog().append("CONTROL FLOW GRAPH WITH ASSIGNMENT CALL");
|
||||
@ -160,7 +163,7 @@ public class Compiler {
|
||||
|
||||
program.setGraph(new Pass1ProcedureCallsReturnValue(program).generate());
|
||||
|
||||
getLog().append("\nCONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN");
|
||||
getLog().append("\nCONTROL FLOW GRAPH SSA");
|
||||
getLog().append(program.getGraph().toString(program));
|
||||
|
||||
getLog().append("SYMBOL TABLE SSA");
|
||||
|
@ -79,8 +79,10 @@ public class Pass0GenerateStatementSequence 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);
|
||||
Compiler.loadAndParseFile(importFileName, program, this);
|
||||
if(program.getLog().isVerboseParse()) {
|
||||
program.getLog().append("Importing " + importFileName);
|
||||
}
|
||||
Compiler.loadAndParseFile(importFileName, program, this, true);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -268,7 +270,9 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
resourceName = resourceName.substring(1, resourceName.length() - 1);
|
||||
File resourceFile = Compiler.loadFile(resourceName, program);
|
||||
program.addAsmResourceFile(resourceFile.toPath());
|
||||
program.getLog().append("Added resource " + resourceFile.getPath().replace('\\', '/'));
|
||||
if(program.getLog().isVerboseParse()) {
|
||||
program.getLog().append("Added resource " + resourceFile.getPath().replace('\\', '/'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -974,7 +978,9 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
for(PrePostModifier mod : modifiers) {
|
||||
Statement stmt = new StatementAssignment((LValue) mod.child, mod.operator, mod.child, source);
|
||||
parser.sequence.addStatement(stmt);
|
||||
parser.program.getLog().append("Adding pre/post-modifier " + stmt.toString(parser.program, true));
|
||||
if(parser.program.getLog().isVerboseParse()) {
|
||||
parser.program.getLog().append("Adding pre/post-modifier " + stmt.toString(parser.program, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,9 @@ public class Pass1AddTypePromotions extends Pass1Base {
|
||||
if(assignment.getOperator() == null) {
|
||||
// No operator - add cast directly!
|
||||
assignment.setOperator(Operators.getCastUnary(lValueType));
|
||||
getProgram().getLog().append("Promoting " + rValueType + " to " + lValueType + " in " + assignment);
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("Promoting " + rValueType + " to " + lValueType + " in " + assignment);
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Tmp-var promotions not implemented yet " + assignment);
|
||||
}
|
||||
|
@ -54,7 +54,9 @@ public class Pass1EliminateEmptyBlocks extends Pass1Base {
|
||||
Label label = (Label) removeSymbol;
|
||||
graph.remove(labelRef);
|
||||
label.getScope().remove(label);
|
||||
log.append("Removing empty block " + labelRef);
|
||||
if(log.isVerbosePass1CreateSsa()) {
|
||||
log.append("Removing empty block " + labelRef);
|
||||
}
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,9 @@ public class Pass1EliminateUncalledProcedures extends Pass1Base {
|
||||
}
|
||||
|
||||
for(ProcedureRef unusedProcedure : unusedProcedures) {
|
||||
getLog().append("Removing unused procedure " + unusedProcedure);
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("Removing unused procedure " + unusedProcedure);
|
||||
}
|
||||
Procedure procedure = getProgram().getScope().getProcedure(unusedProcedure);
|
||||
List<ControlFlowBlock> procedureBlocks = getProgram().getGraph().getScopeBlocks(unusedProcedure);
|
||||
for(ControlFlowBlock procedureBlock : procedureBlocks) {
|
||||
|
@ -61,7 +61,9 @@ public class Pass1ExtractInlineStrings extends Pass1Base {
|
||||
}
|
||||
ConstantVar strConst = new ConstantVar(name, blockScope, SymbolType.STRING, constantString);
|
||||
blockScope.add(strConst);
|
||||
getLog().append("Creating constant string variable for inline " + strConst.toString(getProgram()) + " \"" + constantString.getValue() + "\"");
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("Creating constant string variable for inline " + strConst.toString(getProgram()) + " \"" + constantString.getValue() + "\"");
|
||||
}
|
||||
return strConst;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,9 @@ public class Pass1FixLValuesLoHi extends Pass1Base {
|
||||
// Insert an extra "set low" assignment statement
|
||||
Statement setLoHiAssignment = new StatementAssignment(loHiVar, loHiVar, loHiOperator, tmpVarRef, statementLValue.getSource());
|
||||
statementsIt.add(setLoHiAssignment);
|
||||
getLog().append("Fixing lo/hi-lvalue with new tmpVar " + tmpVarRef + " " + statementLValue.toString());
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("Fixing lo/hi-lvalue with new tmpVar " + tmpVarRef + " " + statementLValue.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,9 @@ public class Pass1GenerateSingleStaticAssignmentForm extends Pass1Base {
|
||||
versionAllUses();
|
||||
boolean done;
|
||||
do {
|
||||
getLog().append("Completing Phi functions...");
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("Completing Phi functions...");
|
||||
}
|
||||
done = completePhiFunctions();
|
||||
//log.append(this.controlFlowGraph.toString(symbols));
|
||||
} while(!done);
|
||||
|
@ -129,7 +129,9 @@ public class Pass2AliasElimination extends Pass2SsaOptimization {
|
||||
alias = null;
|
||||
break;
|
||||
} else if(variable.equals(alias)) {
|
||||
program.getLog().append("Not aliassing identity: " + variable + " " + alias);
|
||||
if(program.getLog().isVerboseNonOptimization()) {
|
||||
program.getLog().append("Not aliassing identity: " + variable + " " + alias);
|
||||
}
|
||||
alias = null;
|
||||
break;
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
|
||||
do {
|
||||
propagating = calculateLiveRanges(liveRanges);
|
||||
getProgram().setLiveRangeVariables(liveRanges);
|
||||
getLog().append("Propagating live ranges...");
|
||||
if(getLog().isVerboseLiveRanges()) {
|
||||
getLog().append("Propagating live ranges...");
|
||||
getLog().append("CONTROL FLOW GRAPH - LIVE RANGES IN PROGRESS");
|
||||
getLog().append(getProgram().getGraph().toString(getProgram()));
|
||||
}
|
||||
|
@ -36,7 +36,9 @@ public class PassNEliminateUnusedVars extends Pass2SsaOptimization {
|
||||
StatementAssignment assignment = (StatementAssignment) statement;
|
||||
LValue lValue = assignment.getlValue();
|
||||
if(lValue instanceof VariableRef && referenceInfos.isUnused((VariableRef) lValue) && !Pass2ConstantIdentification.isAddressOfUsed((VariableRef) lValue, getProgram())) {
|
||||
getLog().append("Eliminating unused variable " + lValue.toString(getProgram()) + " and assignment " + assignment.toString(getProgram(), false));
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("Eliminating unused variable " + lValue.toString(getProgram()) + " and assignment " + assignment.toString(getProgram(), false));
|
||||
}
|
||||
stmtIt.remove();
|
||||
Variable variable = getScope().getVariable((VariableRef) lValue);
|
||||
if(variable!=null) {
|
||||
@ -48,7 +50,9 @@ public class PassNEliminateUnusedVars extends Pass2SsaOptimization {
|
||||
StatementCall call = (StatementCall) statement;
|
||||
LValue lValue = call.getlValue();
|
||||
if(lValue instanceof VariableRef && referenceInfos.isUnused((VariableRef) lValue) && !Pass2ConstantIdentification.isAddressOfUsed((VariableRef) lValue, getProgram())) {
|
||||
getLog().append("Eliminating unused variable - keeping the call " + lValue.toString(getProgram()));
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("Eliminating unused variable - keeping the call " + lValue.toString(getProgram()));
|
||||
}
|
||||
Variable variable = getScope().getVariable((VariableRef) lValue);
|
||||
if(variable!=null) {
|
||||
variable.getScope().remove(variable);
|
||||
@ -63,7 +67,9 @@ public class PassNEliminateUnusedVars extends Pass2SsaOptimization {
|
||||
StatementPhiBlock.PhiVariable phiVariable = phiVarIt.next();
|
||||
VariableRef variableRef = phiVariable.getVariable();
|
||||
if(referenceInfos.isUnused(variableRef) && !Pass2ConstantIdentification.isAddressOfUsed(variableRef, getProgram())) {
|
||||
getLog().append("Eliminating unused variable - keeping the phi block " + variableRef.toString(getProgram()));
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("Eliminating unused variable - keeping the phi block " + variableRef.toString(getProgram()));
|
||||
}
|
||||
Variable variable = getScope().getVariable(variableRef);
|
||||
if(variable!=null) {
|
||||
variable.getScope().remove(variable);
|
||||
|
@ -1,63 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/array-length-symbolic-min.kc
|
||||
// Illustrates symbolic array lengths
|
||||
|
||||
byte SZ = 15;
|
||||
byte[SZ] items;
|
||||
|
||||
// Fills the array item by item with $is, where i is the item# and s is the sub#
|
||||
void main() {
|
||||
byte* cur_item = items;
|
||||
for( byte sub: 0..SZ) {
|
||||
cur_item[sub] = sub;
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte) SZ
|
||||
(byte[SZ]) items
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte*) main::cur_item
|
||||
(byte) main::sub
|
||||
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte) SZ ← (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
(byte[SZ]) items ← { fill( SZ, 0) }
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::cur_item ← (byte[SZ]) items
|
||||
(byte) main::sub ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) main::cur_item + (byte) main::sub) ← (byte) main::sub
|
||||
(byte) main::sub ← (byte) main::sub + rangenext(0,SZ)
|
||||
(bool~) main::$0 ← (byte) main::sub != rangelast(0,SZ)
|
||||
if((bool~) main::$0) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte) SZ#0 ← (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
(byte[SZ#0]) items#0 ← { fill( SZ#0, 0) }
|
||||
@ -145,8 +87,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [10] main::sub#3 ← main::sub#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -155,8 +95,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,93 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/array-length-symbolic.kc
|
||||
// Illustrates symbolic array lengths
|
||||
|
||||
byte ITEM_COUNT = 3;
|
||||
byte ITEM_SIZE = 5;
|
||||
|
||||
byte[ITEM_COUNT*ITEM_SIZE] items = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
// Fills the array item by item with $is, where i is the item# and s is the sub#
|
||||
void main() {
|
||||
byte* cur_item = items;
|
||||
for( byte item: 0..ITEM_COUNT-1) {
|
||||
for( byte sub: 0..ITEM_SIZE-1) {
|
||||
cur_item[sub] = item<<4|sub;
|
||||
}
|
||||
cur_item += ITEM_SIZE;
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(byte~) $0
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte) ITEM_COUNT
|
||||
(byte) ITEM_SIZE
|
||||
(byte[$0]) items
|
||||
(void()) main()
|
||||
(byte/signed word/word/dword/signed dword~) main::$0
|
||||
(byte/signed word/word/dword/signed dword~) main::$1
|
||||
(byte~) main::$2
|
||||
(byte~) main::$3
|
||||
(bool~) main::$4
|
||||
(bool~) main::$5
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte*) main::cur_item
|
||||
(byte) main::item
|
||||
(byte) main::sub
|
||||
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte) ITEM_COUNT ← (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(byte) ITEM_SIZE ← (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
(byte~) $0 ← (byte) ITEM_COUNT * (byte) ITEM_SIZE
|
||||
(byte[$0]) items ← { (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 0 }
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::cur_item ← (byte[$0]) items
|
||||
(byte/signed word/word/dword/signed dword~) main::$0 ← (byte) ITEM_COUNT - (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::item ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@3
|
||||
(byte/signed word/word/dword/signed dword~) main::$1 ← (byte) ITEM_SIZE - (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::sub ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1 main::@2
|
||||
(byte~) main::$2 ← (byte) main::item << (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte~) main::$3 ← (byte~) main::$2 | (byte) main::sub
|
||||
*((byte*) main::cur_item + (byte) main::sub) ← (byte~) main::$3
|
||||
(byte) main::sub ← (byte) main::sub + rangenext(0,main::$1)
|
||||
(bool~) main::$4 ← (byte) main::sub != rangelast(0,main::$1)
|
||||
if((bool~) main::$4) goto main::@2
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2
|
||||
(byte*) main::cur_item ← (byte*) main::cur_item + (byte) ITEM_SIZE
|
||||
(byte) main::item ← (byte) main::item + rangenext(0,main::$0)
|
||||
(bool~) main::$5 ← (byte) main::item != rangelast(0,main::$0)
|
||||
if((bool~) main::$5) goto main::@1
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte) ITEM_COUNT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(byte) ITEM_SIZE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
@ -248,13 +160,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 3 initial phi equivalence classes
|
||||
Coalesced [16] main::item#5 ← main::item#1
|
||||
Coalesced [17] main::cur_item#5 ← main::cur_item#1
|
||||
@ -266,12 +171,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,61 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/arrays-init.kc
|
||||
|
||||
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];
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(byte[3]) b
|
||||
(byte[]) c
|
||||
(byte[]) d
|
||||
(void()) main()
|
||||
(byte*~) main::$0
|
||||
(byte*~) main::$1
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword 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/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
*((byte[3]) b + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) 'c'
|
||||
*((byte*) SCREEN) ← *((byte[3]) b + (byte/signed byte/word/signed word/dword/signed dword) 0)
|
||||
(byte*~) main::$0 ← (byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
*((byte*~) main::$0) ← *((byte[]) c + (byte/signed byte/word/signed word/dword/signed dword) 1)
|
||||
(byte*~) main::$1 ← (byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
*((byte*~) main::$1) ← *((byte[]) d + (byte/signed byte/word/signed word/dword/signed dword) 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"
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte[3]) b#0 ← { fill( 3, 0) }
|
||||
(byte[]) c#0 ← { (byte) 'c', (byte) 'm', (byte) 'l' }
|
||||
@ -134,13 +78,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,109 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/asm-clobber.kc
|
||||
// Tests that inline ASM clobbering is taken into account when assigning registers
|
||||
byte* SCREEN = $0400;
|
||||
void main() {
|
||||
// First loop with no clobber
|
||||
for(byte i : 0..100) {
|
||||
for(byte j: 0..100) {
|
||||
SCREEN[i] = j;
|
||||
}
|
||||
}
|
||||
// Then loop with clobbering A&X
|
||||
for(byte k : 0..100) {
|
||||
for(byte l: 0..100) {
|
||||
asm {
|
||||
// Clobber all registers
|
||||
eor #$55
|
||||
tax
|
||||
}
|
||||
SCREEN[k] = l;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(bool~) main::$1
|
||||
(bool~) main::$2
|
||||
(bool~) main::$3
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@7
|
||||
(label) main::@8
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(byte) main::j
|
||||
(byte) main::k
|
||||
(byte) main::l
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@5
|
||||
(byte) main::j ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1 main::@2
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte) main::j
|
||||
(byte) main::j ← (byte) main::j + rangenext(0,100)
|
||||
(bool~) main::$0 ← (byte) main::j != rangelast(0,100)
|
||||
if((bool~) main::$0) goto main::@2
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@2
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,100)
|
||||
(bool~) main::$1 ← (byte) main::i != rangelast(0,100)
|
||||
if((bool~) main::$1) goto main::@1
|
||||
to:main::@6
|
||||
main::@6: scope:[main] from main::@5
|
||||
(byte) main::k ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@6 main::@7
|
||||
(byte) main::l ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3 main::@4
|
||||
asm { eor#$55 tax }
|
||||
*((byte*) SCREEN + (byte) main::k) ← (byte) main::l
|
||||
(byte) main::l ← (byte) main::l + rangenext(0,100)
|
||||
(bool~) main::$2 ← (byte) main::l != rangelast(0,100)
|
||||
if((bool~) main::$2) goto main::@4
|
||||
to:main::@7
|
||||
main::@7: scope:[main] from main::@4
|
||||
(byte) main::k ← (byte) main::k + rangenext(0,100)
|
||||
(bool~) main::$3 ← (byte) main::k != rangelast(0,100)
|
||||
if((bool~) main::$3) goto main::@3
|
||||
to:main::@8
|
||||
main::@8: scope:[main] from main::@7
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@8
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@8
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
@ -285,10 +181,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 4 initial phi equivalence classes
|
||||
Coalesced [21] main::k#5 ← main::k#1
|
||||
Coalesced [22] main::l#3 ← main::l#1
|
||||
@ -303,10 +195,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,455 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/bitmap-plotter.kc
|
||||
byte* D011 = $d011;
|
||||
byte RST8 = %10000000;
|
||||
byte ECM = %01000000;
|
||||
byte BMM = %00100000;
|
||||
byte DEN = %00010000;
|
||||
byte RSEL = %00001000;
|
||||
byte* RASTER = $d012;
|
||||
byte* D016 = $d016;
|
||||
byte MCM = %00010000;
|
||||
byte CSEL = %00001000;
|
||||
byte* D018 = $d018;
|
||||
byte* BGCOL = $d020;
|
||||
byte* FGCOL = $d021;
|
||||
|
||||
byte* COLS = $d800;
|
||||
|
||||
|
||||
byte* SCREEN = $400;
|
||||
const byte* BITMAP = $2000;
|
||||
|
||||
void main() {
|
||||
*BGCOL = 0;
|
||||
*FGCOL = 0;
|
||||
*D011 = BMM|DEN|RSEL|3;
|
||||
*D018 = (byte)(((word)SCREEN/$40)|((word)BITMAP/$400));
|
||||
init_screen();
|
||||
init_plot_tables();
|
||||
do {
|
||||
do {} while (*RASTER!=$ff);
|
||||
(*BGCOL)++;
|
||||
plots();
|
||||
(*BGCOL)--;
|
||||
} while (true);
|
||||
}
|
||||
|
||||
byte[] plots_x = { 60, 80, 110, 80, 60, 40, 10, 40 };
|
||||
byte[] plots_y = { 10, 40, 60, 80, 110, 80, 60, 40 };
|
||||
byte plots_cnt = 8;
|
||||
|
||||
void plots() {
|
||||
for(byte i=0; i<plots_cnt;i++) {
|
||||
plot(plots_x[i], plots_y[i]);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
word plotter_y = 0;
|
||||
>plotter_x = plot_xhi[x]; // Needs word arrays arranged as two underlying byte arrays to allow byte* plotter_x = plot_x[x]; - and eventually - byte* plotter = plot_x[x] + plot_y[y];
|
||||
<plotter_x = plot_xlo[x];
|
||||
>plotter_y = plot_yhi[y];
|
||||
<plotter_y = plot_ylo[y];
|
||||
byte* plotter = plotter_x+plotter_y;
|
||||
*plotter = *plotter | plot_bit[x];
|
||||
}
|
||||
|
||||
void init_plot_tables() {
|
||||
byte bits = $80;
|
||||
for(byte x : 0..255) {
|
||||
plot_xlo[x] = x&$f8;
|
||||
plot_xhi[x] = >BITMAP;
|
||||
plot_bit[x] = bits;
|
||||
bits = bits>>1;
|
||||
if(bits==0) {
|
||||
bits = $80;
|
||||
}
|
||||
}
|
||||
byte* yoffs = $0;
|
||||
for(byte y : 0..255) {
|
||||
plot_ylo[y] = y&$7 | <yoffs;
|
||||
plot_yhi[y] = >yoffs;
|
||||
if((y&$7)==7) {
|
||||
yoffs = yoffs + 40*8; // Needs better constant type inference for yoffs = yoffs + 40*8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_screen() {
|
||||
for(byte* b = BITMAP; b!=BITMAP+$2000; b++) {
|
||||
*b = 0;
|
||||
}
|
||||
for(byte* c = SCREEN; c!=SCREEN+$400;c++) {
|
||||
*c = $14;
|
||||
}
|
||||
}
|
||||
|
||||
Adding pre/post-modifier *((byte*) BGCOL) ← ++ *((byte*) BGCOL)
|
||||
Adding pre/post-modifier *((byte*) BGCOL) ← -- *((byte*) BGCOL)
|
||||
Adding pre/post-modifier (byte) plots::i ← ++ (byte) plots::i
|
||||
Adding pre/post-modifier (byte*) init_screen::b ← ++ (byte*) init_screen::b
|
||||
Adding pre/post-modifier (byte*) init_screen::c ← ++ (byte*) init_screen::c
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @5
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte*) BITMAP
|
||||
(byte) BMM
|
||||
(byte*) COLS
|
||||
(byte) CSEL
|
||||
(byte*) D011
|
||||
(byte*) D016
|
||||
(byte*) D018
|
||||
(byte) DEN
|
||||
(byte) ECM
|
||||
(byte*) FGCOL
|
||||
(byte) MCM
|
||||
(byte*) RASTER
|
||||
(byte) RSEL
|
||||
(byte) RST8
|
||||
(byte*) SCREEN
|
||||
(void()) init_plot_tables()
|
||||
(byte~) init_plot_tables::$0
|
||||
(byte~) init_plot_tables::$1
|
||||
(byte~) init_plot_tables::$10
|
||||
(bool~) init_plot_tables::$11
|
||||
(bool~) init_plot_tables::$12
|
||||
(word/signed word/dword/signed dword~) init_plot_tables::$13
|
||||
(byte*~) init_plot_tables::$14
|
||||
(bool~) init_plot_tables::$15
|
||||
(byte~) init_plot_tables::$2
|
||||
(bool~) init_plot_tables::$3
|
||||
(bool~) init_plot_tables::$4
|
||||
(bool~) init_plot_tables::$5
|
||||
(byte~) init_plot_tables::$6
|
||||
(byte~) init_plot_tables::$7
|
||||
(byte~) init_plot_tables::$8
|
||||
(byte~) init_plot_tables::$9
|
||||
(label) init_plot_tables::@1
|
||||
(label) init_plot_tables::@2
|
||||
(label) init_plot_tables::@3
|
||||
(label) init_plot_tables::@4
|
||||
(label) init_plot_tables::@5
|
||||
(label) init_plot_tables::@6
|
||||
(label) init_plot_tables::@7
|
||||
(label) init_plot_tables::@8
|
||||
(label) init_plot_tables::@return
|
||||
(byte) init_plot_tables::bits
|
||||
(byte) init_plot_tables::x
|
||||
(byte) init_plot_tables::y
|
||||
(byte*) init_plot_tables::yoffs
|
||||
(void()) init_screen()
|
||||
(byte*~) init_screen::$0
|
||||
(bool~) init_screen::$1
|
||||
(byte*~) init_screen::$2
|
||||
(bool~) init_screen::$3
|
||||
(label) init_screen::@1
|
||||
(label) init_screen::@2
|
||||
(label) init_screen::@3
|
||||
(label) init_screen::@4
|
||||
(label) init_screen::@return
|
||||
(byte*) init_screen::b
|
||||
(byte*) init_screen::c
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(byte~) main::$1
|
||||
(void~) main::$10
|
||||
(bool~) main::$11
|
||||
(void~) main::$12
|
||||
(byte/word/dword~) main::$2
|
||||
(word~) main::$3
|
||||
(word/signed dword/dword~) main::$4
|
||||
(word~) main::$5
|
||||
(word/signed dword/dword~) main::$6
|
||||
(word/dword~) main::$7
|
||||
(byte~) main::$8
|
||||
(void~) main::$9
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(void()) plot((byte) plot::x , (byte) plot::y)
|
||||
(byte~) plot::$0
|
||||
(byte~) plot::$1
|
||||
(byte~) plot::$2
|
||||
(byte~) plot::$3
|
||||
(byte*~) plot::$4
|
||||
(byte~) plot::$5
|
||||
(label) plot::@return
|
||||
(byte*) plot::plotter
|
||||
(byte*) plot::plotter_x
|
||||
(word) plot::plotter_y
|
||||
(byte) plot::x
|
||||
(byte) plot::y
|
||||
(byte[256]) plot_bit
|
||||
(byte[256]) plot_xhi
|
||||
(byte[256]) plot_xlo
|
||||
(byte[256]) plot_yhi
|
||||
(byte[256]) plot_ylo
|
||||
(void()) plots()
|
||||
(void~) plots::$0
|
||||
(bool~) plots::$1
|
||||
(label) plots::@1
|
||||
(label) plots::@2
|
||||
(label) plots::@return
|
||||
(byte) plots::i
|
||||
(byte) plots_cnt
|
||||
(byte[]) plots_x
|
||||
(byte[]) plots_y
|
||||
|
||||
Fixing lo/hi-lvalue with new tmpVar plot::$6 plot::$6 ← *(plot_xhi + plot::x)
|
||||
Fixing lo/hi-lvalue with new tmpVar plot::$7 plot::$7 ← *(plot_xlo + plot::x)
|
||||
Fixing lo/hi-lvalue with new tmpVar plot::$8 plot::$8 ← *(plot_yhi + plot::y)
|
||||
Fixing lo/hi-lvalue with new tmpVar plot::$9 plot::$9 ← *(plot_ylo + plot::y)
|
||||
Promoting word/dword/signed dword to byte* in D011 ← ((byte*)) 53265
|
||||
Promoting word/dword/signed dword to byte* in RASTER ← ((byte*)) 53266
|
||||
Promoting word/dword/signed dword to byte* in D016 ← ((byte*)) 53270
|
||||
Promoting word/dword/signed dword to byte* in D018 ← ((byte*)) 53272
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53280
|
||||
Promoting word/dword/signed dword to byte* in FGCOL ← ((byte*)) 53281
|
||||
Promoting word/dword/signed dword to byte* in COLS ← ((byte*)) 55296
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
Promoting word/signed word/dword/signed dword to byte* in BITMAP ← ((byte*)) 8192
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in plot::plotter_x ← ((byte*)) 0
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in init_plot_tables::yoffs ← ((byte*)) 0
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) D011 ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte) RST8 ← (byte/word/signed word/dword/signed dword) 128
|
||||
(byte) ECM ← (byte/signed byte/word/signed word/dword/signed dword) 64
|
||||
(byte) BMM ← (byte/signed byte/word/signed word/dword/signed dword) 32
|
||||
(byte) DEN ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
(byte) RSEL ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) RASTER ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) D016 ← ((byte*)) (word/dword/signed dword) 53270
|
||||
(byte) MCM ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
(byte) CSEL ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) D018 ← ((byte*)) (word/dword/signed dword) 53272
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53280
|
||||
(byte*) FGCOL ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) BITMAP ← ((byte*)) (word/signed word/dword/signed dword) 8192
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
*((byte*) BGCOL) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
*((byte*) FGCOL) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte~) main::$0 ← (byte) BMM | (byte) DEN
|
||||
(byte~) main::$1 ← (byte~) main::$0 | (byte) RSEL
|
||||
(byte/word/dword~) main::$2 ← (byte~) main::$1 | (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
*((byte*) D011) ← (byte/word/dword~) main::$2
|
||||
(word~) main::$3 ← ((word)) (byte*) SCREEN
|
||||
(word/signed dword/dword~) main::$4 ← (word~) main::$3 / (byte/signed byte/word/signed word/dword/signed dword) 64
|
||||
(word~) main::$5 ← ((word)) (byte*) BITMAP
|
||||
(word/signed dword/dword~) main::$6 ← (word~) main::$5 / (word/signed word/dword/signed dword) 1024
|
||||
(word/dword~) main::$7 ← (word/signed dword/dword~) main::$4 | (word/signed dword/dword~) main::$6
|
||||
(byte~) main::$8 ← ((byte)) (word/dword~) main::$7
|
||||
*((byte*) D018) ← (byte~) main::$8
|
||||
(void~) main::$9 ← call init_screen
|
||||
(void~) main::$10 ← call init_plot_tables
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@3
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1 main::@2
|
||||
(bool~) main::$11 ← *((byte*) RASTER) != (byte/word/signed word/dword/signed dword) 255
|
||||
if((bool~) main::$11) goto main::@2
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2
|
||||
*((byte*) BGCOL) ← ++ *((byte*) BGCOL)
|
||||
(void~) main::$12 ← call plots
|
||||
*((byte*) BGCOL) ← -- *((byte*) BGCOL)
|
||||
if(true) goto main::@1
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
(byte[]) plots_x ← { (byte/signed byte/word/signed word/dword/signed dword) 60, (byte/signed byte/word/signed word/dword/signed dword) 80, (byte/signed byte/word/signed word/dword/signed dword) 110, (byte/signed byte/word/signed word/dword/signed dword) 80, (byte/signed byte/word/signed word/dword/signed dword) 60, (byte/signed byte/word/signed word/dword/signed dword) 40, (byte/signed byte/word/signed word/dword/signed dword) 10, (byte/signed byte/word/signed word/dword/signed dword) 40 }
|
||||
(byte[]) plots_y ← { (byte/signed byte/word/signed word/dword/signed dword) 10, (byte/signed byte/word/signed word/dword/signed dword) 40, (byte/signed byte/word/signed word/dword/signed dword) 60, (byte/signed byte/word/signed word/dword/signed dword) 80, (byte/signed byte/word/signed word/dword/signed dword) 110, (byte/signed byte/word/signed word/dword/signed dword) 80, (byte/signed byte/word/signed word/dword/signed dword) 60, (byte/signed byte/word/signed word/dword/signed dword) 40 }
|
||||
(byte) plots_cnt ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
to:@2
|
||||
plots: scope:[plots] from
|
||||
(byte) plots::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:plots::@1
|
||||
plots::@1: scope:[plots] from plots plots::@1
|
||||
(void~) plots::$0 ← call plot *((byte[]) plots_x + (byte) plots::i) *((byte[]) plots_y + (byte) plots::i)
|
||||
(byte) plots::i ← ++ (byte) plots::i
|
||||
(bool~) plots::$1 ← (byte) plots::i < (byte) plots_cnt
|
||||
if((bool~) plots::$1) goto plots::@1
|
||||
to:plots::@2
|
||||
plots::@2: scope:[plots] from plots::@1
|
||||
to:plots::@return
|
||||
plots::@return: scope:[plots] from plots::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
(byte[256]) plot_xlo ← { fill( 256, 0) }
|
||||
(byte[256]) plot_xhi ← { fill( 256, 0) }
|
||||
(byte[256]) plot_ylo ← { fill( 256, 0) }
|
||||
(byte[256]) plot_yhi ← { fill( 256, 0) }
|
||||
(byte[256]) plot_bit ← { fill( 256, 0) }
|
||||
to:@3
|
||||
plot: scope:[plot] from
|
||||
(byte*) plot::plotter_x ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(word) plot::plotter_y ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte~) plot::$0 ← > (byte*) plot::plotter_x
|
||||
(byte~) plot::$6 ← *((byte[256]) plot_xhi + (byte) plot::x)
|
||||
(byte*) plot::plotter_x ← (byte*) plot::plotter_x hi= (byte~) plot::$6
|
||||
(byte~) plot::$1 ← < (byte*) plot::plotter_x
|
||||
(byte~) plot::$7 ← *((byte[256]) plot_xlo + (byte) plot::x)
|
||||
(byte*) plot::plotter_x ← (byte*) plot::plotter_x lo= (byte~) plot::$7
|
||||
(byte~) plot::$2 ← > (word) plot::plotter_y
|
||||
(byte~) plot::$8 ← *((byte[256]) plot_yhi + (byte) plot::y)
|
||||
(word) plot::plotter_y ← (word) plot::plotter_y hi= (byte~) plot::$8
|
||||
(byte~) plot::$3 ← < (word) plot::plotter_y
|
||||
(byte~) plot::$9 ← *((byte[256]) plot_ylo + (byte) plot::y)
|
||||
(word) plot::plotter_y ← (word) plot::plotter_y lo= (byte~) plot::$9
|
||||
(byte*~) plot::$4 ← (byte*) plot::plotter_x + (word) plot::plotter_y
|
||||
(byte*) plot::plotter ← (byte*~) plot::$4
|
||||
(byte~) plot::$5 ← *((byte*) plot::plotter) | *((byte[256]) plot_bit + (byte) plot::x)
|
||||
*((byte*) plot::plotter) ← (byte~) plot::$5
|
||||
to:plot::@return
|
||||
plot::@return: scope:[plot] from plot
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
init_plot_tables: scope:[init_plot_tables] from
|
||||
(byte) init_plot_tables::bits ← (byte/word/signed word/dword/signed dword) 128
|
||||
(byte) init_plot_tables::x ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:init_plot_tables::@1
|
||||
init_plot_tables::@1: scope:[init_plot_tables] from init_plot_tables init_plot_tables::@2
|
||||
(byte~) init_plot_tables::$0 ← (byte) init_plot_tables::x & (byte/word/signed word/dword/signed dword) 248
|
||||
*((byte[256]) plot_xlo + (byte) init_plot_tables::x) ← (byte~) init_plot_tables::$0
|
||||
(byte~) init_plot_tables::$1 ← > (byte*) BITMAP
|
||||
*((byte[256]) plot_xhi + (byte) init_plot_tables::x) ← (byte~) init_plot_tables::$1
|
||||
*((byte[256]) plot_bit + (byte) init_plot_tables::x) ← (byte) init_plot_tables::bits
|
||||
(byte~) init_plot_tables::$2 ← (byte) init_plot_tables::bits >> (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) init_plot_tables::bits ← (byte~) init_plot_tables::$2
|
||||
(bool~) init_plot_tables::$3 ← (byte) init_plot_tables::bits == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) init_plot_tables::$4 ← ! (bool~) init_plot_tables::$3
|
||||
if((bool~) init_plot_tables::$4) goto init_plot_tables::@2
|
||||
to:init_plot_tables::@5
|
||||
init_plot_tables::@2: scope:[init_plot_tables] from init_plot_tables::@1 init_plot_tables::@5
|
||||
(byte) init_plot_tables::x ← (byte) init_plot_tables::x + rangenext(0,255)
|
||||
(bool~) init_plot_tables::$5 ← (byte) init_plot_tables::x != rangelast(0,255)
|
||||
if((bool~) init_plot_tables::$5) goto init_plot_tables::@1
|
||||
to:init_plot_tables::@6
|
||||
init_plot_tables::@5: scope:[init_plot_tables] from init_plot_tables::@1
|
||||
(byte) init_plot_tables::bits ← (byte/word/signed word/dword/signed dword) 128
|
||||
to:init_plot_tables::@2
|
||||
init_plot_tables::@6: scope:[init_plot_tables] from init_plot_tables::@2
|
||||
(byte*) init_plot_tables::yoffs ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) init_plot_tables::y ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:init_plot_tables::@3
|
||||
init_plot_tables::@3: scope:[init_plot_tables] from init_plot_tables::@4 init_plot_tables::@6
|
||||
(byte~) init_plot_tables::$6 ← (byte) init_plot_tables::y & (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
(byte~) init_plot_tables::$7 ← < (byte*) init_plot_tables::yoffs
|
||||
(byte~) init_plot_tables::$8 ← (byte~) init_plot_tables::$6 | (byte~) init_plot_tables::$7
|
||||
*((byte[256]) plot_ylo + (byte) init_plot_tables::y) ← (byte~) init_plot_tables::$8
|
||||
(byte~) init_plot_tables::$9 ← > (byte*) init_plot_tables::yoffs
|
||||
*((byte[256]) plot_yhi + (byte) init_plot_tables::y) ← (byte~) init_plot_tables::$9
|
||||
(byte~) init_plot_tables::$10 ← (byte) init_plot_tables::y & (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
(bool~) init_plot_tables::$11 ← (byte~) init_plot_tables::$10 == (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
(bool~) init_plot_tables::$12 ← ! (bool~) init_plot_tables::$11
|
||||
if((bool~) init_plot_tables::$12) goto init_plot_tables::@4
|
||||
to:init_plot_tables::@7
|
||||
init_plot_tables::@4: scope:[init_plot_tables] from init_plot_tables::@3 init_plot_tables::@7
|
||||
(byte) init_plot_tables::y ← (byte) init_plot_tables::y + rangenext(0,255)
|
||||
(bool~) init_plot_tables::$15 ← (byte) init_plot_tables::y != rangelast(0,255)
|
||||
if((bool~) init_plot_tables::$15) goto init_plot_tables::@3
|
||||
to:init_plot_tables::@8
|
||||
init_plot_tables::@7: scope:[init_plot_tables] from init_plot_tables::@3
|
||||
(word/signed word/dword/signed dword~) init_plot_tables::$13 ← (byte/signed byte/word/signed word/dword/signed dword) 40 * (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*~) init_plot_tables::$14 ← (byte*) init_plot_tables::yoffs + (word/signed word/dword/signed dword~) init_plot_tables::$13
|
||||
(byte*) init_plot_tables::yoffs ← (byte*~) init_plot_tables::$14
|
||||
to:init_plot_tables::@4
|
||||
init_plot_tables::@8: scope:[init_plot_tables] from init_plot_tables::@4
|
||||
to:init_plot_tables::@return
|
||||
init_plot_tables::@return: scope:[init_plot_tables] from init_plot_tables::@8
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
init_screen: scope:[init_screen] from
|
||||
(byte*) init_screen::b ← (byte*) BITMAP
|
||||
to:init_screen::@1
|
||||
init_screen::@1: scope:[init_screen] from init_screen init_screen::@1
|
||||
*((byte*) init_screen::b) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte*) init_screen::b ← ++ (byte*) init_screen::b
|
||||
(byte*~) init_screen::$0 ← (byte*) BITMAP + (word/signed word/dword/signed dword) 8192
|
||||
(bool~) init_screen::$1 ← (byte*) init_screen::b != (byte*~) init_screen::$0
|
||||
if((bool~) init_screen::$1) goto init_screen::@1
|
||||
to:init_screen::@3
|
||||
init_screen::@3: scope:[init_screen] from init_screen::@1
|
||||
(byte*) init_screen::c ← (byte*) SCREEN
|
||||
to:init_screen::@2
|
||||
init_screen::@2: scope:[init_screen] from init_screen::@2 init_screen::@3
|
||||
*((byte*) init_screen::c) ← (byte/signed byte/word/signed word/dword/signed dword) 20
|
||||
(byte*) init_screen::c ← ++ (byte*) init_screen::c
|
||||
(byte*~) init_screen::$2 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 1024
|
||||
(bool~) init_screen::$3 ← (byte*) init_screen::c != (byte*~) init_screen::$2
|
||||
if((bool~) init_screen::$3) goto init_screen::@2
|
||||
to:init_screen::@4
|
||||
init_screen::@4: scope:[init_screen] from init_screen::@2
|
||||
to:init_screen::@return
|
||||
init_screen::@return: scope:[init_screen] from init_screen::@4
|
||||
return
|
||||
to:@return
|
||||
@5: scope:[] from @4
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @5
|
||||
|
||||
Eliminating unused variable (byte) RST8 and assignment [1] (byte) RST8 ← (byte/word/signed word/dword/signed dword) 128
|
||||
Eliminating unused variable (byte) ECM and assignment [2] (byte) ECM ← (byte/signed byte/word/signed word/dword/signed dword) 64
|
||||
Eliminating unused variable (byte*) D016 and assignment [7] (byte*) D016 ← ((byte*)) (word/dword/signed dword) 53270
|
||||
Eliminating unused variable (byte) MCM and assignment [8] (byte) MCM ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
Eliminating unused variable (byte) CSEL and assignment [9] (byte) CSEL ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Eliminating unused variable (byte*) COLS and assignment [13] (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296
|
||||
Eliminating unused variable - keeping the call (void~) main::$9
|
||||
Eliminating unused variable - keeping the call (void~) main::$10
|
||||
Eliminating unused variable - keeping the call (void~) main::$12
|
||||
Eliminating unused variable - keeping the call (void~) plots::$0
|
||||
Eliminating unused variable (byte~) plot::$0 and assignment [54] (byte~) plot::$0 ← > (byte*) plot::plotter_x
|
||||
Eliminating unused variable (byte~) plot::$1 and assignment [57] (byte~) plot::$1 ← < (byte*) plot::plotter_x
|
||||
Eliminating unused variable (byte~) plot::$2 and assignment [60] (byte~) plot::$2 ← > (word) plot::plotter_y
|
||||
Eliminating unused variable (byte~) plot::$3 and assignment [63] (byte~) plot::$3 ← < (word) plot::plotter_y
|
||||
Removing empty block main::@4
|
||||
Removing empty block plots::@2
|
||||
Removing empty block @3
|
||||
Removing empty block init_plot_tables::@8
|
||||
Removing empty block @4
|
||||
Removing empty block init_screen::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) D011#0 ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte) BMM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32
|
||||
@ -942,7 +492,6 @@ Successful SSA optimization Pass2CullEmptyBlocks
|
||||
Inversing boolean not (bool~) init_plot_tables::$4 ← (byte) init_plot_tables::bits#1 != (byte/signed byte/word/signed word/dword/signed dword) 0 from (bool~) init_plot_tables::$3 ← (byte) init_plot_tables::bits#1 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
Inversing boolean not (bool~) init_plot_tables::$12 ← (byte~) init_plot_tables::$10 != (byte/signed byte/word/signed word/dword/signed dword) 7 from (bool~) init_plot_tables::$11 ← (byte~) init_plot_tables::$10 == (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
Successful SSA optimization Pass2UnaryNotSimplification
|
||||
Not aliassing identity: SCREEN#3 SCREEN#3
|
||||
Alias (byte*) RASTER#3 = (byte*) RASTER#4 (byte*) RASTER#6
|
||||
Alias (byte*) BGCOL#1 = (byte*) BGCOL#9 (byte*) BGCOL#7
|
||||
Alias (byte) plots_cnt#10 = (byte) plots_cnt#8 (byte) plots_cnt#7
|
||||
@ -969,17 +518,9 @@ Alias (byte) init_plot_tables::y#2 = (byte) init_plot_tables::y#4
|
||||
Alias (byte*) init_plot_tables::yoffs#1 = (byte*~) init_plot_tables::$14
|
||||
Alias (byte*) SCREEN#2 = (byte*) SCREEN#5
|
||||
Successful SSA optimization Pass2AliasElimination
|
||||
Not aliassing identity: RASTER#1 RASTER#1
|
||||
Not aliassing identity: BGCOL#2 BGCOL#2
|
||||
Not aliassing identity: plots_cnt#4 plots_cnt#4
|
||||
Not aliassing identity: SCREEN#3 SCREEN#3
|
||||
Alias (byte) init_plot_tables::x#2 = (byte) init_plot_tables::x#3
|
||||
Alias (byte) init_plot_tables::y#2 = (byte) init_plot_tables::y#3
|
||||
Successful SSA optimization Pass2AliasElimination
|
||||
Not aliassing identity: RASTER#1 RASTER#1
|
||||
Not aliassing identity: BGCOL#2 BGCOL#2
|
||||
Not aliassing identity: plots_cnt#4 plots_cnt#4
|
||||
Not aliassing identity: SCREEN#3 SCREEN#3
|
||||
Self Phi Eliminated (byte*) RASTER#1
|
||||
Self Phi Eliminated (byte*) RASTER#1
|
||||
Self Phi Eliminated (byte*) BGCOL#2
|
||||
@ -1135,14 +676,6 @@ Calls in [] to main:2
|
||||
Calls in [main] to init_screen:8 init_plot_tables:10 plots:13
|
||||
Calls in [plots] to plot:19
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 9 initial phi equivalence classes
|
||||
Coalesced [23] plots::i#4 ← plots::i#1
|
||||
Coalesced [58] init_plot_tables::yoffs#7 ← init_plot_tables::yoffs#1
|
||||
@ -1170,14 +703,6 @@ Adding NOP phi() at start of plots
|
||||
Adding NOP phi() at start of init_plot_tables
|
||||
Adding NOP phi() at start of init_plot_tables::@10
|
||||
Adding NOP phi() at start of init_screen
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,219 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/bool-const.kc
|
||||
// A Minimal test of boolean constants.
|
||||
|
||||
const byte* SCREEN = $400;
|
||||
|
||||
void main() {
|
||||
bool_const_if();
|
||||
bool_const_vars();
|
||||
bool_const_inline();
|
||||
}
|
||||
|
||||
// A constant boolean inside an if()
|
||||
void bool_const_if() {
|
||||
bool b = true;
|
||||
if(b) {
|
||||
SCREEN[0] = 't';
|
||||
} else {
|
||||
SCREEN[0] = 'f';
|
||||
}
|
||||
}
|
||||
|
||||
// A bunch of constant boolean vars (used in an if)
|
||||
void bool_const_vars() {
|
||||
byte a = 14;
|
||||
bool b1 = (a==15) || !(21<a);
|
||||
bool b2 = (a!=44) || (a>=-8);
|
||||
bool b = b1 && !b2 || false;
|
||||
if(b) {
|
||||
SCREEN[1] = 't';
|
||||
} else {
|
||||
SCREEN[1] = 'f';
|
||||
}
|
||||
}
|
||||
|
||||
// A constant boolean inside an if()
|
||||
void bool_const_inline() {
|
||||
byte a = 23;
|
||||
if((a!=44) || (a>=-8) && (a==15) || !(21<a)) {
|
||||
SCREEN[2] = 't';
|
||||
} else {
|
||||
SCREEN[2] = 'f';
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(void()) bool_const_if()
|
||||
(label) bool_const_if::@1
|
||||
(label) bool_const_if::@2
|
||||
(label) bool_const_if::@3
|
||||
(label) bool_const_if::@4
|
||||
(label) bool_const_if::@return
|
||||
(bool) bool_const_if::b
|
||||
(void()) bool_const_inline()
|
||||
(bool~) bool_const_inline::$0
|
||||
(signed byte/signed word/signed dword~) bool_const_inline::$1
|
||||
(bool~) bool_const_inline::$2
|
||||
(bool~) bool_const_inline::$3
|
||||
(bool~) bool_const_inline::$4
|
||||
(bool~) bool_const_inline::$5
|
||||
(bool~) bool_const_inline::$6
|
||||
(bool~) bool_const_inline::$7
|
||||
(bool~) bool_const_inline::$8
|
||||
(label) bool_const_inline::@1
|
||||
(label) bool_const_inline::@2
|
||||
(label) bool_const_inline::@3
|
||||
(label) bool_const_inline::@4
|
||||
(label) bool_const_inline::@return
|
||||
(byte) bool_const_inline::a
|
||||
(void()) bool_const_vars()
|
||||
(bool~) bool_const_vars::$0
|
||||
(bool~) bool_const_vars::$1
|
||||
(bool~) bool_const_vars::$10
|
||||
(bool~) bool_const_vars::$2
|
||||
(bool~) bool_const_vars::$3
|
||||
(bool~) bool_const_vars::$4
|
||||
(signed byte/signed word/signed dword~) bool_const_vars::$5
|
||||
(bool~) bool_const_vars::$6
|
||||
(bool~) bool_const_vars::$7
|
||||
(bool~) bool_const_vars::$8
|
||||
(bool~) bool_const_vars::$9
|
||||
(label) bool_const_vars::@1
|
||||
(label) bool_const_vars::@2
|
||||
(label) bool_const_vars::@3
|
||||
(label) bool_const_vars::@4
|
||||
(label) bool_const_vars::@return
|
||||
(byte) bool_const_vars::a
|
||||
(bool) bool_const_vars::b
|
||||
(bool) bool_const_vars::b1
|
||||
(bool) bool_const_vars::b2
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(void~) main::$2
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call bool_const_if
|
||||
(void~) main::$1 ← call bool_const_vars
|
||||
(void~) main::$2 ← call bool_const_inline
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
bool_const_if: scope:[bool_const_if] from
|
||||
(bool) bool_const_if::b ← true
|
||||
if((bool) bool_const_if::b) goto bool_const_if::@1
|
||||
to:bool_const_if::@3
|
||||
bool_const_if::@1: scope:[bool_const_if] from bool_const_if bool_const_if::@4
|
||||
*((byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) 't'
|
||||
to:bool_const_if::@2
|
||||
bool_const_if::@3: scope:[bool_const_if] from bool_const_if
|
||||
*((byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) 'f'
|
||||
to:bool_const_if::@2
|
||||
bool_const_if::@2: scope:[bool_const_if] from bool_const_if::@1 bool_const_if::@3
|
||||
to:bool_const_if::@return
|
||||
bool_const_if::@4: scope:[bool_const_if] from
|
||||
to:bool_const_if::@1
|
||||
bool_const_if::@return: scope:[bool_const_if] from bool_const_if::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
bool_const_vars: scope:[bool_const_vars] from
|
||||
(byte) bool_const_vars::a ← (byte/signed byte/word/signed word/dword/signed dword) 14
|
||||
(bool~) bool_const_vars::$0 ← (byte) bool_const_vars::a == (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
(bool~) bool_const_vars::$1 ← (byte/signed byte/word/signed word/dword/signed dword) 21 < (byte) bool_const_vars::a
|
||||
(bool~) bool_const_vars::$2 ← ! (bool~) bool_const_vars::$1
|
||||
(bool~) bool_const_vars::$3 ← (bool~) bool_const_vars::$0 || (bool~) bool_const_vars::$2
|
||||
(bool) bool_const_vars::b1 ← (bool~) bool_const_vars::$3
|
||||
(bool~) bool_const_vars::$4 ← (byte) bool_const_vars::a != (byte/signed byte/word/signed word/dword/signed dword) 44
|
||||
(signed byte/signed word/signed dword~) bool_const_vars::$5 ← - (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(bool~) bool_const_vars::$6 ← (byte) bool_const_vars::a >= (signed byte/signed word/signed dword~) bool_const_vars::$5
|
||||
(bool~) bool_const_vars::$7 ← (bool~) bool_const_vars::$4 || (bool~) bool_const_vars::$6
|
||||
(bool) bool_const_vars::b2 ← (bool~) bool_const_vars::$7
|
||||
(bool~) bool_const_vars::$8 ← ! (bool) bool_const_vars::b2
|
||||
(bool~) bool_const_vars::$9 ← (bool) bool_const_vars::b1 && (bool~) bool_const_vars::$8
|
||||
(bool~) bool_const_vars::$10 ← (bool~) bool_const_vars::$9 || false
|
||||
(bool) bool_const_vars::b ← (bool~) bool_const_vars::$10
|
||||
if((bool) bool_const_vars::b) goto bool_const_vars::@1
|
||||
to:bool_const_vars::@3
|
||||
bool_const_vars::@1: scope:[bool_const_vars] from bool_const_vars bool_const_vars::@4
|
||||
*((byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 't'
|
||||
to:bool_const_vars::@2
|
||||
bool_const_vars::@3: scope:[bool_const_vars] from bool_const_vars
|
||||
*((byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f'
|
||||
to:bool_const_vars::@2
|
||||
bool_const_vars::@2: scope:[bool_const_vars] from bool_const_vars::@1 bool_const_vars::@3
|
||||
to:bool_const_vars::@return
|
||||
bool_const_vars::@4: scope:[bool_const_vars] from
|
||||
to:bool_const_vars::@1
|
||||
bool_const_vars::@return: scope:[bool_const_vars] from bool_const_vars::@2
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
bool_const_inline: scope:[bool_const_inline] from
|
||||
(byte) bool_const_inline::a ← (byte/signed byte/word/signed word/dword/signed dword) 23
|
||||
(bool~) bool_const_inline::$0 ← (byte) bool_const_inline::a != (byte/signed byte/word/signed word/dword/signed dword) 44
|
||||
(signed byte/signed word/signed dword~) bool_const_inline::$1 ← - (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(bool~) bool_const_inline::$2 ← (byte) bool_const_inline::a >= (signed byte/signed word/signed dword~) bool_const_inline::$1
|
||||
(bool~) bool_const_inline::$3 ← (byte) bool_const_inline::a == (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
(bool~) bool_const_inline::$4 ← (bool~) bool_const_inline::$2 && (bool~) bool_const_inline::$3
|
||||
(bool~) bool_const_inline::$5 ← (bool~) bool_const_inline::$0 || (bool~) bool_const_inline::$4
|
||||
(bool~) bool_const_inline::$6 ← (byte/signed byte/word/signed word/dword/signed dword) 21 < (byte) bool_const_inline::a
|
||||
(bool~) bool_const_inline::$7 ← ! (bool~) bool_const_inline::$6
|
||||
(bool~) bool_const_inline::$8 ← (bool~) bool_const_inline::$5 || (bool~) bool_const_inline::$7
|
||||
if((bool~) bool_const_inline::$8) goto bool_const_inline::@1
|
||||
to:bool_const_inline::@3
|
||||
bool_const_inline::@1: scope:[bool_const_inline] from bool_const_inline bool_const_inline::@4
|
||||
*((byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't'
|
||||
to:bool_const_inline::@2
|
||||
bool_const_inline::@3: scope:[bool_const_inline] from bool_const_inline
|
||||
*((byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 'f'
|
||||
to:bool_const_inline::@2
|
||||
bool_const_inline::@2: scope:[bool_const_inline] from bool_const_inline::@1 bool_const_inline::@3
|
||||
to:bool_const_inline::@return
|
||||
bool_const_inline::@4: scope:[bool_const_inline] from
|
||||
to:bool_const_inline::@1
|
||||
bool_const_inline::@return: scope:[bool_const_inline] from bool_const_inline::@2
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @4
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Eliminating unused variable - keeping the call (void~) main::$2
|
||||
Removing empty block @1
|
||||
Removing empty block bool_const_if::@2
|
||||
Removing empty block bool_const_if::@4
|
||||
Removing empty block @2
|
||||
Removing empty block bool_const_vars::@2
|
||||
Removing empty block bool_const_vars::@4
|
||||
Removing empty block @3
|
||||
Removing empty block bool_const_inline::@2
|
||||
Removing empty block bool_const_inline::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@4
|
||||
@ -458,7 +244,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to bool_const_if:5 bool_const_vars:7 bool_const_inline:9
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
@ -470,7 +255,6 @@ Adding NOP phi() at start of main::@2
|
||||
Adding NOP phi() at start of bool_const_inline
|
||||
Adding NOP phi() at start of bool_const_vars
|
||||
Adding NOP phi() at start of bool_const_if
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,114 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/bool-function.kc
|
||||
// Test a function taking boolean parameter and returning boolean result
|
||||
|
||||
void main() {
|
||||
byte* screen = $400;
|
||||
for(byte i: 0..100) {
|
||||
if( isSet(i, (i&1)==0)) {
|
||||
screen[i] = '*';
|
||||
} else {
|
||||
screen[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Determine whether to set a char to '*.
|
||||
// Returns true if i&8!=0 or b=true
|
||||
bool isSet(byte i, bool b) {
|
||||
return b || ((i&8)!=0);
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(bool()) isSet((byte) isSet::i , (bool) isSet::b)
|
||||
(byte~) isSet::$0
|
||||
(bool~) isSet::$1
|
||||
(bool~) isSet::$2
|
||||
(label) isSet::@1
|
||||
(label) isSet::@return
|
||||
(bool) isSet::b
|
||||
(byte) isSet::i
|
||||
(bool) isSet::return
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(bool~) main::$1
|
||||
(bool~) main::$2
|
||||
(bool~) main::$3
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(byte*) main::screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword 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/dword/signed dword) 1024
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@3
|
||||
(byte~) main::$0 ← (byte) main::i & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) main::$1 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) main::$2 ← call isSet (byte) main::i (bool~) main::$1
|
||||
if((bool~) main::$2) goto main::@2
|
||||
to:main::@4
|
||||
main::@2: scope:[main] from main::@1 main::@5
|
||||
*((byte*) main::screen + (byte) main::i) ← (byte) '*'
|
||||
to:main::@3
|
||||
main::@4: scope:[main] from main::@1
|
||||
*((byte*) main::screen + (byte) main::i) ← (byte) ' '
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2 main::@4
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,100)
|
||||
(bool~) main::$3 ← (byte) main::i != rangelast(0,100)
|
||||
if((bool~) main::$3) goto main::@1
|
||||
to:main::@6
|
||||
main::@5: scope:[main] from
|
||||
to:main::@2
|
||||
main::@6: scope:[main] from main::@3
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@6
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
isSet: scope:[isSet] from
|
||||
(byte~) isSet::$0 ← (byte) isSet::i & (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(bool~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) isSet::$2 ← (bool) isSet::b || (bool~) isSet::$1
|
||||
(bool) isSet::return ← (bool~) isSet::$2
|
||||
to:isSet::@return
|
||||
isSet::@return: scope:[isSet] from isSet isSet::@1
|
||||
(bool) isSet::return ← (bool) isSet::return
|
||||
return (bool) isSet::return
|
||||
to:@return
|
||||
isSet::@1: scope:[isSet] from
|
||||
to:isSet::@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Removing empty block main::@5
|
||||
Removing empty block main::@6
|
||||
Removing empty block @1
|
||||
Removing empty block isSet::@1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@2
|
||||
main: scope:[main] from @2
|
||||
@ -257,12 +148,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to isSet:9
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [17] main::i#7 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -271,12 +156,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,312 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/bool-ifs.kc
|
||||
// A test of boolean conditions using && || and !
|
||||
|
||||
void main() {
|
||||
bool_and();
|
||||
bool_or();
|
||||
bool_not();
|
||||
bool_complex();
|
||||
}
|
||||
|
||||
void bool_and() {
|
||||
const byte* screen = $400;
|
||||
for( byte i : 0..20) {
|
||||
if( (i<10) && ((i&1)==0) ) {
|
||||
screen[i] = '*';
|
||||
} else {
|
||||
screen[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bool_or() {
|
||||
const byte* screen = $428;
|
||||
for( byte i : 0..20) {
|
||||
if( (i<10) || ((i&1)==0) ) {
|
||||
screen[i] = '*';
|
||||
} else {
|
||||
screen[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bool_not() {
|
||||
const byte* screen = $450;
|
||||
for( byte i : 0..20) {
|
||||
if( !((i<10) || (i&1)==0)) {
|
||||
screen[i] = '*';
|
||||
} else {
|
||||
screen[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bool_complex() {
|
||||
const byte* screen = $478;
|
||||
for( byte i : 0..20) {
|
||||
if( ((i<10) && (i&1)==0) || !((i<10) || (i&1)==0) ) {
|
||||
screen[i] = '*';
|
||||
} else {
|
||||
screen[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @5
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) bool_and()
|
||||
(bool~) bool_and::$0
|
||||
(byte~) bool_and::$1
|
||||
(bool~) bool_and::$2
|
||||
(bool~) bool_and::$3
|
||||
(bool~) bool_and::$4
|
||||
(label) bool_and::@1
|
||||
(label) bool_and::@2
|
||||
(label) bool_and::@3
|
||||
(label) bool_and::@4
|
||||
(label) bool_and::@5
|
||||
(label) bool_and::@6
|
||||
(label) bool_and::@return
|
||||
(byte) bool_and::i
|
||||
(byte*) bool_and::screen
|
||||
(void()) bool_complex()
|
||||
(bool~) bool_complex::$0
|
||||
(byte~) bool_complex::$1
|
||||
(bool~) bool_complex::$10
|
||||
(bool~) bool_complex::$2
|
||||
(bool~) bool_complex::$3
|
||||
(bool~) bool_complex::$4
|
||||
(byte~) bool_complex::$5
|
||||
(bool~) bool_complex::$6
|
||||
(bool~) bool_complex::$7
|
||||
(bool~) bool_complex::$8
|
||||
(bool~) bool_complex::$9
|
||||
(label) bool_complex::@1
|
||||
(label) bool_complex::@2
|
||||
(label) bool_complex::@3
|
||||
(label) bool_complex::@4
|
||||
(label) bool_complex::@5
|
||||
(label) bool_complex::@6
|
||||
(label) bool_complex::@return
|
||||
(byte) bool_complex::i
|
||||
(byte*) bool_complex::screen
|
||||
(void()) bool_not()
|
||||
(bool~) bool_not::$0
|
||||
(byte~) bool_not::$1
|
||||
(bool~) bool_not::$2
|
||||
(bool~) bool_not::$3
|
||||
(bool~) bool_not::$4
|
||||
(bool~) bool_not::$5
|
||||
(label) bool_not::@1
|
||||
(label) bool_not::@2
|
||||
(label) bool_not::@3
|
||||
(label) bool_not::@4
|
||||
(label) bool_not::@5
|
||||
(label) bool_not::@6
|
||||
(label) bool_not::@return
|
||||
(byte) bool_not::i
|
||||
(byte*) bool_not::screen
|
||||
(void()) bool_or()
|
||||
(bool~) bool_or::$0
|
||||
(byte~) bool_or::$1
|
||||
(bool~) bool_or::$2
|
||||
(bool~) bool_or::$3
|
||||
(bool~) bool_or::$4
|
||||
(label) bool_or::@1
|
||||
(label) bool_or::@2
|
||||
(label) bool_or::@3
|
||||
(label) bool_or::@4
|
||||
(label) bool_or::@5
|
||||
(label) bool_or::@6
|
||||
(label) bool_or::@return
|
||||
(byte) bool_or::i
|
||||
(byte*) bool_or::screen
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(void~) main::$2
|
||||
(void~) main::$3
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in bool_and::screen ← ((byte*)) 1024
|
||||
Promoting word/signed word/dword/signed dword to byte* in bool_or::screen ← ((byte*)) 1064
|
||||
Promoting word/signed word/dword/signed dword to byte* in bool_not::screen ← ((byte*)) 1104
|
||||
Promoting word/signed word/dword/signed dword to byte* in bool_complex::screen ← ((byte*)) 1144
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call bool_and
|
||||
(void~) main::$1 ← call bool_or
|
||||
(void~) main::$2 ← call bool_not
|
||||
(void~) main::$3 ← call bool_complex
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
bool_and: scope:[bool_and] from
|
||||
(byte*) bool_and::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte) bool_and::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:bool_and::@1
|
||||
bool_and::@1: scope:[bool_and] from bool_and bool_and::@3
|
||||
(bool~) bool_and::$0 ← (byte) bool_and::i < (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(byte~) bool_and::$1 ← (byte) bool_and::i & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) bool_and::$2 ← (byte~) bool_and::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) bool_and::$3 ← (bool~) bool_and::$0 && (bool~) bool_and::$2
|
||||
if((bool~) bool_and::$3) goto bool_and::@2
|
||||
to:bool_and::@4
|
||||
bool_and::@2: scope:[bool_and] from bool_and::@1 bool_and::@5
|
||||
*((byte*) bool_and::screen + (byte) bool_and::i) ← (byte) '*'
|
||||
to:bool_and::@3
|
||||
bool_and::@4: scope:[bool_and] from bool_and::@1
|
||||
*((byte*) bool_and::screen + (byte) bool_and::i) ← (byte) ' '
|
||||
to:bool_and::@3
|
||||
bool_and::@3: scope:[bool_and] from bool_and::@2 bool_and::@4
|
||||
(byte) bool_and::i ← (byte) bool_and::i + rangenext(0,20)
|
||||
(bool~) bool_and::$4 ← (byte) bool_and::i != rangelast(0,20)
|
||||
if((bool~) bool_and::$4) goto bool_and::@1
|
||||
to:bool_and::@6
|
||||
bool_and::@5: scope:[bool_and] from
|
||||
to:bool_and::@2
|
||||
bool_and::@6: scope:[bool_and] from bool_and::@3
|
||||
to:bool_and::@return
|
||||
bool_and::@return: scope:[bool_and] from bool_and::@6
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
bool_or: scope:[bool_or] from
|
||||
(byte*) bool_or::screen ← ((byte*)) (word/signed word/dword/signed dword) 1064
|
||||
(byte) bool_or::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:bool_or::@1
|
||||
bool_or::@1: scope:[bool_or] from bool_or bool_or::@3
|
||||
(bool~) bool_or::$0 ← (byte) bool_or::i < (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(byte~) bool_or::$1 ← (byte) bool_or::i & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) bool_or::$2 ← (byte~) bool_or::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) bool_or::$3 ← (bool~) bool_or::$0 || (bool~) bool_or::$2
|
||||
if((bool~) bool_or::$3) goto bool_or::@2
|
||||
to:bool_or::@4
|
||||
bool_or::@2: scope:[bool_or] from bool_or::@1 bool_or::@5
|
||||
*((byte*) bool_or::screen + (byte) bool_or::i) ← (byte) '*'
|
||||
to:bool_or::@3
|
||||
bool_or::@4: scope:[bool_or] from bool_or::@1
|
||||
*((byte*) bool_or::screen + (byte) bool_or::i) ← (byte) ' '
|
||||
to:bool_or::@3
|
||||
bool_or::@3: scope:[bool_or] from bool_or::@2 bool_or::@4
|
||||
(byte) bool_or::i ← (byte) bool_or::i + rangenext(0,20)
|
||||
(bool~) bool_or::$4 ← (byte) bool_or::i != rangelast(0,20)
|
||||
if((bool~) bool_or::$4) goto bool_or::@1
|
||||
to:bool_or::@6
|
||||
bool_or::@5: scope:[bool_or] from
|
||||
to:bool_or::@2
|
||||
bool_or::@6: scope:[bool_or] from bool_or::@3
|
||||
to:bool_or::@return
|
||||
bool_or::@return: scope:[bool_or] from bool_or::@6
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
bool_not: scope:[bool_not] from
|
||||
(byte*) bool_not::screen ← ((byte*)) (word/signed word/dword/signed dword) 1104
|
||||
(byte) bool_not::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:bool_not::@1
|
||||
bool_not::@1: scope:[bool_not] from bool_not bool_not::@3
|
||||
(bool~) bool_not::$0 ← (byte) bool_not::i < (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(byte~) bool_not::$1 ← (byte) bool_not::i & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) bool_not::$2 ← (byte~) bool_not::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) bool_not::$3 ← (bool~) bool_not::$0 || (bool~) bool_not::$2
|
||||
(bool~) bool_not::$4 ← ! (bool~) bool_not::$3
|
||||
if((bool~) bool_not::$4) goto bool_not::@2
|
||||
to:bool_not::@4
|
||||
bool_not::@2: scope:[bool_not] from bool_not::@1 bool_not::@5
|
||||
*((byte*) bool_not::screen + (byte) bool_not::i) ← (byte) '*'
|
||||
to:bool_not::@3
|
||||
bool_not::@4: scope:[bool_not] from bool_not::@1
|
||||
*((byte*) bool_not::screen + (byte) bool_not::i) ← (byte) ' '
|
||||
to:bool_not::@3
|
||||
bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4
|
||||
(byte) bool_not::i ← (byte) bool_not::i + rangenext(0,20)
|
||||
(bool~) bool_not::$5 ← (byte) bool_not::i != rangelast(0,20)
|
||||
if((bool~) bool_not::$5) goto bool_not::@1
|
||||
to:bool_not::@6
|
||||
bool_not::@5: scope:[bool_not] from
|
||||
to:bool_not::@2
|
||||
bool_not::@6: scope:[bool_not] from bool_not::@3
|
||||
to:bool_not::@return
|
||||
bool_not::@return: scope:[bool_not] from bool_not::@6
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
bool_complex: scope:[bool_complex] from
|
||||
(byte*) bool_complex::screen ← ((byte*)) (word/signed word/dword/signed dword) 1144
|
||||
(byte) bool_complex::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:bool_complex::@1
|
||||
bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3
|
||||
(bool~) bool_complex::$0 ← (byte) bool_complex::i < (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(byte~) bool_complex::$1 ← (byte) bool_complex::i & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) bool_complex::$2 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) bool_complex::$3 ← (bool~) bool_complex::$0 && (bool~) bool_complex::$2
|
||||
(bool~) bool_complex::$4 ← (byte) bool_complex::i < (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(byte~) bool_complex::$5 ← (byte) bool_complex::i & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) bool_complex::$6 ← (byte~) bool_complex::$5 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) bool_complex::$7 ← (bool~) bool_complex::$4 || (bool~) bool_complex::$6
|
||||
(bool~) bool_complex::$8 ← ! (bool~) bool_complex::$7
|
||||
(bool~) bool_complex::$9 ← (bool~) bool_complex::$3 || (bool~) bool_complex::$8
|
||||
if((bool~) bool_complex::$9) goto bool_complex::@2
|
||||
to:bool_complex::@4
|
||||
bool_complex::@2: scope:[bool_complex] from bool_complex::@1 bool_complex::@5
|
||||
*((byte*) bool_complex::screen + (byte) bool_complex::i) ← (byte) '*'
|
||||
to:bool_complex::@3
|
||||
bool_complex::@4: scope:[bool_complex] from bool_complex::@1
|
||||
*((byte*) bool_complex::screen + (byte) bool_complex::i) ← (byte) ' '
|
||||
to:bool_complex::@3
|
||||
bool_complex::@3: scope:[bool_complex] from bool_complex::@2 bool_complex::@4
|
||||
(byte) bool_complex::i ← (byte) bool_complex::i + rangenext(0,20)
|
||||
(bool~) bool_complex::$10 ← (byte) bool_complex::i != rangelast(0,20)
|
||||
if((bool~) bool_complex::$10) goto bool_complex::@1
|
||||
to:bool_complex::@6
|
||||
bool_complex::@5: scope:[bool_complex] from
|
||||
to:bool_complex::@2
|
||||
bool_complex::@6: scope:[bool_complex] from bool_complex::@3
|
||||
to:bool_complex::@return
|
||||
bool_complex::@return: scope:[bool_complex] from bool_complex::@6
|
||||
return
|
||||
to:@return
|
||||
@5: scope:[] from @4
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @5
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Eliminating unused variable - keeping the call (void~) main::$2
|
||||
Eliminating unused variable - keeping the call (void~) main::$3
|
||||
Removing empty block @1
|
||||
Removing empty block bool_and::@5
|
||||
Removing empty block bool_and::@6
|
||||
Removing empty block @2
|
||||
Removing empty block bool_or::@5
|
||||
Removing empty block bool_or::@6
|
||||
Removing empty block @3
|
||||
Removing empty block bool_not::@5
|
||||
Removing empty block bool_not::@6
|
||||
Removing empty block @4
|
||||
Removing empty block bool_complex::@5
|
||||
Removing empty block bool_complex::@6
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@5
|
||||
main: scope:[main] from @5
|
||||
@ -645,10 +338,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to bool_and:5 bool_or:7 bool_not:9 bool_complex:11
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 4 initial phi equivalence classes
|
||||
Coalesced [24] bool_complex::i#6 ← bool_complex::i#1
|
||||
Coalesced [36] bool_not::i#6 ← bool_not::i#1
|
||||
@ -670,10 +359,6 @@ Adding NOP phi() at start of bool_complex
|
||||
Adding NOP phi() at start of bool_not
|
||||
Adding NOP phi() at start of bool_or
|
||||
Adding NOP phi() at start of bool_and
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,63 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/bool-pointer.kc
|
||||
// Tests a pointer to a boolean
|
||||
|
||||
void main() {
|
||||
bool* bscreen = $400;
|
||||
bscreen[0] = true;
|
||||
bscreen[1] = false;
|
||||
bscreen = bscreen+2;
|
||||
*bscreen = true;
|
||||
if(*bscreen) {
|
||||
*(++bscreen)= true;
|
||||
}
|
||||
|
||||
}
|
||||
Adding pre/post-modifier (bool*) main::bscreen ← ++ (bool*) main::bscreen
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(bool*~) main::$0
|
||||
(bool~) main::$1
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(bool*) main::bscreen
|
||||
|
||||
Promoting word/signed word/dword/signed dword to bool* in main::bscreen ← ((bool*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(bool*) main::bscreen ← ((bool*)) (word/signed word/dword/signed dword) 1024
|
||||
*((bool*) main::bscreen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← true
|
||||
*((bool*) main::bscreen + (byte/signed byte/word/signed word/dword/signed dword) 1) ← false
|
||||
(bool*~) main::$0 ← (bool*) main::bscreen + (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(bool*) main::bscreen ← (bool*~) main::$0
|
||||
*((bool*) main::bscreen) ← true
|
||||
(bool~) main::$1 ← ! *((bool*) main::bscreen)
|
||||
if((bool~) main::$1) goto main::@1
|
||||
to:main::@2
|
||||
main::@1: scope:[main] from main main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main
|
||||
(bool*) main::bscreen ← ++ (bool*) main::bscreen
|
||||
*((bool*) main::bscreen) ← true
|
||||
to:main::@1
|
||||
main::@return: scope:[main] from main::@1
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -134,13 +76,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,348 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/bool-vars.kc
|
||||
// A test of boolean conditions using && || and !
|
||||
|
||||
void main() {
|
||||
bool_and();
|
||||
bool_or();
|
||||
bool_not();
|
||||
bool_complex();
|
||||
}
|
||||
|
||||
void bool_and() {
|
||||
const byte* screen = $400;
|
||||
for( byte i : 0..20) {
|
||||
bool o1 = (i<10);
|
||||
bool o2 = ((i&1)==0);
|
||||
bool o3 = o1 && o2;
|
||||
if(o3) {
|
||||
screen[i] = '*';
|
||||
} else {
|
||||
screen[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bool_or() {
|
||||
const byte* screen = $428;
|
||||
for( byte i : 0..20) {
|
||||
bool o1 = (i<10);
|
||||
bool o2 = ((i&1)==0);
|
||||
bool o3 = o1 || o2;
|
||||
if(o3) {
|
||||
screen[i] = '*';
|
||||
} else {
|
||||
screen[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bool_not() {
|
||||
const byte* screen = $450;
|
||||
for( byte i : 0..20) {
|
||||
bool o1 = (i<10);
|
||||
bool o2 = (i&1)==0;
|
||||
bool o3 = !( o1 || o2);
|
||||
if(o3) {
|
||||
screen[i] = '*';
|
||||
} else {
|
||||
screen[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bool_complex() {
|
||||
const byte* screen = $478;
|
||||
for( byte i : 0..20) {
|
||||
bool o1 = (i<10);
|
||||
bool o2 = (i&1)==0;
|
||||
bool o3 = (o1 && o2);
|
||||
bool o4 = !(o1 || o2);
|
||||
bool o5 = o3 || o4;
|
||||
if( o5 ) {
|
||||
screen[i] = '*';
|
||||
} else {
|
||||
screen[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @5
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) bool_and()
|
||||
(bool~) bool_and::$0
|
||||
(byte~) bool_and::$1
|
||||
(bool~) bool_and::$2
|
||||
(bool~) bool_and::$3
|
||||
(bool~) bool_and::$4
|
||||
(label) bool_and::@1
|
||||
(label) bool_and::@2
|
||||
(label) bool_and::@3
|
||||
(label) bool_and::@4
|
||||
(label) bool_and::@5
|
||||
(label) bool_and::@6
|
||||
(label) bool_and::@return
|
||||
(byte) bool_and::i
|
||||
(bool) bool_and::o1
|
||||
(bool) bool_and::o2
|
||||
(bool) bool_and::o3
|
||||
(byte*) bool_and::screen
|
||||
(void()) bool_complex()
|
||||
(bool~) bool_complex::$0
|
||||
(byte~) bool_complex::$1
|
||||
(bool~) bool_complex::$2
|
||||
(bool~) bool_complex::$3
|
||||
(bool~) bool_complex::$4
|
||||
(bool~) bool_complex::$5
|
||||
(bool~) bool_complex::$6
|
||||
(bool~) bool_complex::$7
|
||||
(label) bool_complex::@1
|
||||
(label) bool_complex::@2
|
||||
(label) bool_complex::@3
|
||||
(label) bool_complex::@4
|
||||
(label) bool_complex::@5
|
||||
(label) bool_complex::@6
|
||||
(label) bool_complex::@return
|
||||
(byte) bool_complex::i
|
||||
(bool) bool_complex::o1
|
||||
(bool) bool_complex::o2
|
||||
(bool) bool_complex::o3
|
||||
(bool) bool_complex::o4
|
||||
(bool) bool_complex::o5
|
||||
(byte*) bool_complex::screen
|
||||
(void()) bool_not()
|
||||
(bool~) bool_not::$0
|
||||
(byte~) bool_not::$1
|
||||
(bool~) bool_not::$2
|
||||
(bool~) bool_not::$3
|
||||
(bool~) bool_not::$4
|
||||
(bool~) bool_not::$5
|
||||
(label) bool_not::@1
|
||||
(label) bool_not::@2
|
||||
(label) bool_not::@3
|
||||
(label) bool_not::@4
|
||||
(label) bool_not::@5
|
||||
(label) bool_not::@6
|
||||
(label) bool_not::@return
|
||||
(byte) bool_not::i
|
||||
(bool) bool_not::o1
|
||||
(bool) bool_not::o2
|
||||
(bool) bool_not::o3
|
||||
(byte*) bool_not::screen
|
||||
(void()) bool_or()
|
||||
(bool~) bool_or::$0
|
||||
(byte~) bool_or::$1
|
||||
(bool~) bool_or::$2
|
||||
(bool~) bool_or::$3
|
||||
(bool~) bool_or::$4
|
||||
(label) bool_or::@1
|
||||
(label) bool_or::@2
|
||||
(label) bool_or::@3
|
||||
(label) bool_or::@4
|
||||
(label) bool_or::@5
|
||||
(label) bool_or::@6
|
||||
(label) bool_or::@return
|
||||
(byte) bool_or::i
|
||||
(bool) bool_or::o1
|
||||
(bool) bool_or::o2
|
||||
(bool) bool_or::o3
|
||||
(byte*) bool_or::screen
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(void~) main::$2
|
||||
(void~) main::$3
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in bool_and::screen ← ((byte*)) 1024
|
||||
Promoting word/signed word/dword/signed dword to byte* in bool_or::screen ← ((byte*)) 1064
|
||||
Promoting word/signed word/dword/signed dword to byte* in bool_not::screen ← ((byte*)) 1104
|
||||
Promoting word/signed word/dword/signed dword to byte* in bool_complex::screen ← ((byte*)) 1144
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call bool_and
|
||||
(void~) main::$1 ← call bool_or
|
||||
(void~) main::$2 ← call bool_not
|
||||
(void~) main::$3 ← call bool_complex
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
bool_and: scope:[bool_and] from
|
||||
(byte*) bool_and::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte) bool_and::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:bool_and::@1
|
||||
bool_and::@1: scope:[bool_and] from bool_and bool_and::@3
|
||||
(bool~) bool_and::$0 ← (byte) bool_and::i < (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(bool) bool_and::o1 ← (bool~) bool_and::$0
|
||||
(byte~) bool_and::$1 ← (byte) bool_and::i & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) bool_and::$2 ← (byte~) bool_and::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool) bool_and::o2 ← (bool~) bool_and::$2
|
||||
(bool~) bool_and::$3 ← (bool) bool_and::o1 && (bool) bool_and::o2
|
||||
(bool) bool_and::o3 ← (bool~) bool_and::$3
|
||||
if((bool) bool_and::o3) goto bool_and::@2
|
||||
to:bool_and::@4
|
||||
bool_and::@2: scope:[bool_and] from bool_and::@1 bool_and::@5
|
||||
*((byte*) bool_and::screen + (byte) bool_and::i) ← (byte) '*'
|
||||
to:bool_and::@3
|
||||
bool_and::@4: scope:[bool_and] from bool_and::@1
|
||||
*((byte*) bool_and::screen + (byte) bool_and::i) ← (byte) ' '
|
||||
to:bool_and::@3
|
||||
bool_and::@3: scope:[bool_and] from bool_and::@2 bool_and::@4
|
||||
(byte) bool_and::i ← (byte) bool_and::i + rangenext(0,20)
|
||||
(bool~) bool_and::$4 ← (byte) bool_and::i != rangelast(0,20)
|
||||
if((bool~) bool_and::$4) goto bool_and::@1
|
||||
to:bool_and::@6
|
||||
bool_and::@5: scope:[bool_and] from
|
||||
to:bool_and::@2
|
||||
bool_and::@6: scope:[bool_and] from bool_and::@3
|
||||
to:bool_and::@return
|
||||
bool_and::@return: scope:[bool_and] from bool_and::@6
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
bool_or: scope:[bool_or] from
|
||||
(byte*) bool_or::screen ← ((byte*)) (word/signed word/dword/signed dword) 1064
|
||||
(byte) bool_or::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:bool_or::@1
|
||||
bool_or::@1: scope:[bool_or] from bool_or bool_or::@3
|
||||
(bool~) bool_or::$0 ← (byte) bool_or::i < (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(bool) bool_or::o1 ← (bool~) bool_or::$0
|
||||
(byte~) bool_or::$1 ← (byte) bool_or::i & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) bool_or::$2 ← (byte~) bool_or::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool) bool_or::o2 ← (bool~) bool_or::$2
|
||||
(bool~) bool_or::$3 ← (bool) bool_or::o1 || (bool) bool_or::o2
|
||||
(bool) bool_or::o3 ← (bool~) bool_or::$3
|
||||
if((bool) bool_or::o3) goto bool_or::@2
|
||||
to:bool_or::@4
|
||||
bool_or::@2: scope:[bool_or] from bool_or::@1 bool_or::@5
|
||||
*((byte*) bool_or::screen + (byte) bool_or::i) ← (byte) '*'
|
||||
to:bool_or::@3
|
||||
bool_or::@4: scope:[bool_or] from bool_or::@1
|
||||
*((byte*) bool_or::screen + (byte) bool_or::i) ← (byte) ' '
|
||||
to:bool_or::@3
|
||||
bool_or::@3: scope:[bool_or] from bool_or::@2 bool_or::@4
|
||||
(byte) bool_or::i ← (byte) bool_or::i + rangenext(0,20)
|
||||
(bool~) bool_or::$4 ← (byte) bool_or::i != rangelast(0,20)
|
||||
if((bool~) bool_or::$4) goto bool_or::@1
|
||||
to:bool_or::@6
|
||||
bool_or::@5: scope:[bool_or] from
|
||||
to:bool_or::@2
|
||||
bool_or::@6: scope:[bool_or] from bool_or::@3
|
||||
to:bool_or::@return
|
||||
bool_or::@return: scope:[bool_or] from bool_or::@6
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
bool_not: scope:[bool_not] from
|
||||
(byte*) bool_not::screen ← ((byte*)) (word/signed word/dword/signed dword) 1104
|
||||
(byte) bool_not::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:bool_not::@1
|
||||
bool_not::@1: scope:[bool_not] from bool_not bool_not::@3
|
||||
(bool~) bool_not::$0 ← (byte) bool_not::i < (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(bool) bool_not::o1 ← (bool~) bool_not::$0
|
||||
(byte~) bool_not::$1 ← (byte) bool_not::i & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) bool_not::$2 ← (byte~) bool_not::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool) bool_not::o2 ← (bool~) bool_not::$2
|
||||
(bool~) bool_not::$3 ← (bool) bool_not::o1 || (bool) bool_not::o2
|
||||
(bool~) bool_not::$4 ← ! (bool~) bool_not::$3
|
||||
(bool) bool_not::o3 ← (bool~) bool_not::$4
|
||||
if((bool) bool_not::o3) goto bool_not::@2
|
||||
to:bool_not::@4
|
||||
bool_not::@2: scope:[bool_not] from bool_not::@1 bool_not::@5
|
||||
*((byte*) bool_not::screen + (byte) bool_not::i) ← (byte) '*'
|
||||
to:bool_not::@3
|
||||
bool_not::@4: scope:[bool_not] from bool_not::@1
|
||||
*((byte*) bool_not::screen + (byte) bool_not::i) ← (byte) ' '
|
||||
to:bool_not::@3
|
||||
bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4
|
||||
(byte) bool_not::i ← (byte) bool_not::i + rangenext(0,20)
|
||||
(bool~) bool_not::$5 ← (byte) bool_not::i != rangelast(0,20)
|
||||
if((bool~) bool_not::$5) goto bool_not::@1
|
||||
to:bool_not::@6
|
||||
bool_not::@5: scope:[bool_not] from
|
||||
to:bool_not::@2
|
||||
bool_not::@6: scope:[bool_not] from bool_not::@3
|
||||
to:bool_not::@return
|
||||
bool_not::@return: scope:[bool_not] from bool_not::@6
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
bool_complex: scope:[bool_complex] from
|
||||
(byte*) bool_complex::screen ← ((byte*)) (word/signed word/dword/signed dword) 1144
|
||||
(byte) bool_complex::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:bool_complex::@1
|
||||
bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3
|
||||
(bool~) bool_complex::$0 ← (byte) bool_complex::i < (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(bool) bool_complex::o1 ← (bool~) bool_complex::$0
|
||||
(byte~) bool_complex::$1 ← (byte) bool_complex::i & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) bool_complex::$2 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool) bool_complex::o2 ← (bool~) bool_complex::$2
|
||||
(bool~) bool_complex::$3 ← (bool) bool_complex::o1 && (bool) bool_complex::o2
|
||||
(bool) bool_complex::o3 ← (bool~) bool_complex::$3
|
||||
(bool~) bool_complex::$4 ← (bool) bool_complex::o1 || (bool) bool_complex::o2
|
||||
(bool~) bool_complex::$5 ← ! (bool~) bool_complex::$4
|
||||
(bool) bool_complex::o4 ← (bool~) bool_complex::$5
|
||||
(bool~) bool_complex::$6 ← (bool) bool_complex::o3 || (bool) bool_complex::o4
|
||||
(bool) bool_complex::o5 ← (bool~) bool_complex::$6
|
||||
if((bool) bool_complex::o5) goto bool_complex::@2
|
||||
to:bool_complex::@4
|
||||
bool_complex::@2: scope:[bool_complex] from bool_complex::@1 bool_complex::@5
|
||||
*((byte*) bool_complex::screen + (byte) bool_complex::i) ← (byte) '*'
|
||||
to:bool_complex::@3
|
||||
bool_complex::@4: scope:[bool_complex] from bool_complex::@1
|
||||
*((byte*) bool_complex::screen + (byte) bool_complex::i) ← (byte) ' '
|
||||
to:bool_complex::@3
|
||||
bool_complex::@3: scope:[bool_complex] from bool_complex::@2 bool_complex::@4
|
||||
(byte) bool_complex::i ← (byte) bool_complex::i + rangenext(0,20)
|
||||
(bool~) bool_complex::$7 ← (byte) bool_complex::i != rangelast(0,20)
|
||||
if((bool~) bool_complex::$7) goto bool_complex::@1
|
||||
to:bool_complex::@6
|
||||
bool_complex::@5: scope:[bool_complex] from
|
||||
to:bool_complex::@2
|
||||
bool_complex::@6: scope:[bool_complex] from bool_complex::@3
|
||||
to:bool_complex::@return
|
||||
bool_complex::@return: scope:[bool_complex] from bool_complex::@6
|
||||
return
|
||||
to:@return
|
||||
@5: scope:[] from @4
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @5
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Eliminating unused variable - keeping the call (void~) main::$2
|
||||
Eliminating unused variable - keeping the call (void~) main::$3
|
||||
Removing empty block @1
|
||||
Removing empty block bool_and::@5
|
||||
Removing empty block bool_and::@6
|
||||
Removing empty block @2
|
||||
Removing empty block bool_or::@5
|
||||
Removing empty block bool_or::@6
|
||||
Removing empty block @3
|
||||
Removing empty block bool_not::@5
|
||||
Removing empty block bool_not::@6
|
||||
Removing empty block @4
|
||||
Removing empty block bool_complex::@5
|
||||
Removing empty block bool_complex::@6
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@5
|
||||
main: scope:[main] from @5
|
||||
@ -727,10 +384,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to bool_and:5 bool_or:7 bool_not:9 bool_complex:11
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 4 initial phi equivalence classes
|
||||
Coalesced [25] bool_complex::i#6 ← bool_complex::i#1
|
||||
Coalesced [37] bool_not::i#6 ← bool_not::i#1
|
||||
@ -752,10 +405,6 @@ Adding NOP phi() at start of bool_complex
|
||||
Adding NOP phi() at start of bool_not
|
||||
Adding NOP phi() at start of bool_or
|
||||
Adding NOP phi() at start of bool_and
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,138 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/bresenham.kc
|
||||
byte STAR = 81;
|
||||
byte[40*25] SCREEN = $0400;
|
||||
|
||||
void main() {
|
||||
byte x0 = 4;
|
||||
byte y0 = 4;
|
||||
byte x1 = 39;
|
||||
byte y1 = 24;
|
||||
byte xd = x1-x0;
|
||||
byte yd = y1-y0;
|
||||
byte x = x0;
|
||||
byte y = y0;
|
||||
byte e = yd/2;
|
||||
byte *cursor = SCREEN+y*40+x;
|
||||
do {
|
||||
*cursor = STAR;
|
||||
x = x + 1;
|
||||
cursor = cursor + 1;
|
||||
e = e+yd;
|
||||
if(xd<=e) {
|
||||
y = y+1;
|
||||
cursor = cursor + 40;
|
||||
e = e - xd;
|
||||
}
|
||||
} while (x<(x1+1));
|
||||
}
|
||||
SYMBOLS
|
||||
(word/signed word/dword/signed dword~) $0
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte[$0]) SCREEN
|
||||
(byte) STAR
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(byte~) main::$1
|
||||
(bool~) main::$10
|
||||
(byte/signed word/word/dword/signed dword~) main::$11
|
||||
(byte*~) main::$12
|
||||
(byte~) main::$13
|
||||
(byte/signed word/word/dword/signed dword~) main::$14
|
||||
(bool~) main::$15
|
||||
(byte/signed word/word/dword/signed dword~) main::$2
|
||||
(byte/signed word/word/dword/signed dword~) main::$3
|
||||
(byte*~) main::$4
|
||||
(byte*~) main::$5
|
||||
(byte/signed word/word/dword/signed dword~) main::$6
|
||||
(byte*~) main::$7
|
||||
(byte~) main::$8
|
||||
(bool~) main::$9
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte*) main::cursor
|
||||
(byte) main::e
|
||||
(byte) main::x
|
||||
(byte) main::x0
|
||||
(byte) main::x1
|
||||
(byte) main::xd
|
||||
(byte) main::y
|
||||
(byte) main::y0
|
||||
(byte) main::y1
|
||||
(byte) main::yd
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte[$0] in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte) STAR ← (byte/signed byte/word/signed word/dword/signed dword) 81
|
||||
(word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 40 * (byte/signed byte/word/signed word/dword/signed dword) 25
|
||||
(byte[$0]) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::x0 ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) main::y0 ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) main::x1 ← (byte/signed byte/word/signed word/dword/signed dword) 39
|
||||
(byte) main::y1 ← (byte/signed byte/word/signed word/dword/signed dword) 24
|
||||
(byte~) main::$0 ← (byte) main::x1 - (byte) main::x0
|
||||
(byte) main::xd ← (byte~) main::$0
|
||||
(byte~) main::$1 ← (byte) main::y1 - (byte) main::y0
|
||||
(byte) main::yd ← (byte~) main::$1
|
||||
(byte) main::x ← (byte) main::x0
|
||||
(byte) main::y ← (byte) main::y0
|
||||
(byte/signed word/word/dword/signed dword~) main::$2 ← (byte) main::yd / (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) main::e ← (byte/signed word/word/dword/signed dword~) main::$2
|
||||
(byte/signed word/word/dword/signed dword~) main::$3 ← (byte) main::y * (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*~) main::$4 ← (byte[$0]) SCREEN + (byte/signed word/word/dword/signed dword~) main::$3
|
||||
(byte*~) main::$5 ← (byte*~) main::$4 + (byte) main::x
|
||||
(byte*) main::cursor ← (byte*~) main::$5
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
*((byte*) main::cursor) ← (byte) STAR
|
||||
(byte/signed word/word/dword/signed dword~) main::$6 ← (byte) main::x + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::x ← (byte/signed word/word/dword/signed dword~) main::$6
|
||||
(byte*~) main::$7 ← (byte*) main::cursor + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte*) main::cursor ← (byte*~) main::$7
|
||||
(byte~) main::$8 ← (byte) main::e + (byte) main::yd
|
||||
(byte) main::e ← (byte~) main::$8
|
||||
(bool~) main::$9 ← (byte) main::xd <= (byte) main::e
|
||||
(bool~) main::$10 ← ! (bool~) main::$9
|
||||
if((bool~) main::$10) goto main::@2
|
||||
to:main::@3
|
||||
main::@2: scope:[main] from main::@1 main::@3
|
||||
(byte/signed word/word/dword/signed dword~) main::$14 ← (byte) main::x1 + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) main::$15 ← (byte) main::x < (byte/signed word/word/dword/signed dword~) main::$14
|
||||
if((bool~) main::$15) goto main::@1
|
||||
to:main::@4
|
||||
main::@3: scope:[main] from main::@1
|
||||
(byte/signed word/word/dword/signed dword~) main::$11 ← (byte) main::y + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::y ← (byte/signed word/word/dword/signed dword~) main::$11
|
||||
(byte*~) main::$12 ← (byte*) main::cursor + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*) main::cursor ← (byte*~) main::$12
|
||||
(byte~) main::$13 ← (byte) main::e - (byte) main::xd
|
||||
(byte) main::e ← (byte~) main::$13
|
||||
to:main::@2
|
||||
main::@4: scope:[main] from main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte) STAR#0 ← (byte/signed byte/word/signed word/dword/signed dword) 81
|
||||
(word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 40 * (byte/signed byte/word/signed word/dword/signed dword) 25
|
||||
@ -384,14 +251,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 7 initial phi equivalence classes
|
||||
Coalesced [14] main::cursor#8 ← main::cursor#2
|
||||
Coalesced [15] main::e#8 ← main::e#2
|
||||
@ -410,13 +269,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,136 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/bresenhamarr.kc
|
||||
|
||||
void main() {
|
||||
byte STAR = 81;
|
||||
byte[40*25] screen = $0400;
|
||||
byte x0 = 0;
|
||||
byte y0 = 0;
|
||||
byte x1 = 39;
|
||||
byte y1 = 24;
|
||||
byte xd = x1-x0;
|
||||
byte yd = y1-y0;
|
||||
byte x = x0;
|
||||
byte y = y0;
|
||||
byte e = yd/2;
|
||||
word idx = x+y*40;
|
||||
do {
|
||||
screen[idx] = STAR;
|
||||
x = x + 1;
|
||||
idx = idx + 1;
|
||||
e = e+yd;
|
||||
if(xd<e) {
|
||||
y = y+1;
|
||||
idx = idx + 40;
|
||||
e = e - xd;
|
||||
}
|
||||
} while (x<(x1+1));
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(word/signed word/dword/signed dword~) main::$0
|
||||
(byte~) main::$1
|
||||
(bool~) main::$10
|
||||
(byte/signed word/word/dword/signed dword~) main::$11
|
||||
(word/signed dword/dword~) main::$12
|
||||
(byte~) main::$13
|
||||
(byte/signed word/word/dword/signed dword~) main::$14
|
||||
(bool~) main::$15
|
||||
(byte~) main::$2
|
||||
(byte/signed word/word/dword/signed dword~) main::$3
|
||||
(byte/signed word/word/dword/signed dword~) main::$4
|
||||
(byte/signed word/word/dword/signed dword~) main::$5
|
||||
(byte/signed word/word/dword/signed dword~) main::$6
|
||||
(word/signed dword/dword~) main::$7
|
||||
(byte~) main::$8
|
||||
(bool~) main::$9
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte) main::STAR
|
||||
(byte) main::e
|
||||
(word) main::idx
|
||||
(byte[main::$0]) main::screen
|
||||
(byte) main::x
|
||||
(byte) main::x0
|
||||
(byte) main::x1
|
||||
(byte) main::xd
|
||||
(byte) main::y
|
||||
(byte) main::y0
|
||||
(byte) main::y1
|
||||
(byte) main::yd
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte[main::$0] in main::screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::STAR ← (byte/signed byte/word/signed word/dword/signed dword) 81
|
||||
(word/signed word/dword/signed dword~) main::$0 ← (byte/signed byte/word/signed word/dword/signed dword) 40 * (byte/signed byte/word/signed word/dword/signed dword) 25
|
||||
(byte[main::$0]) main::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte) main::x0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) main::y0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) main::x1 ← (byte/signed byte/word/signed word/dword/signed dword) 39
|
||||
(byte) main::y1 ← (byte/signed byte/word/signed word/dword/signed dword) 24
|
||||
(byte~) main::$1 ← (byte) main::x1 - (byte) main::x0
|
||||
(byte) main::xd ← (byte~) main::$1
|
||||
(byte~) main::$2 ← (byte) main::y1 - (byte) main::y0
|
||||
(byte) main::yd ← (byte~) main::$2
|
||||
(byte) main::x ← (byte) main::x0
|
||||
(byte) main::y ← (byte) main::y0
|
||||
(byte/signed word/word/dword/signed dword~) main::$3 ← (byte) main::yd / (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) main::e ← (byte/signed word/word/dword/signed dword~) main::$3
|
||||
(byte/signed word/word/dword/signed dword~) main::$4 ← (byte) main::y * (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte/signed word/word/dword/signed dword~) main::$5 ← (byte) main::x + (byte/signed word/word/dword/signed dword~) main::$4
|
||||
(word) main::idx ← (byte/signed word/word/dword/signed dword~) main::$5
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
*((byte[main::$0]) main::screen + (word) main::idx) ← (byte) main::STAR
|
||||
(byte/signed word/word/dword/signed dword~) main::$6 ← (byte) main::x + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::x ← (byte/signed word/word/dword/signed dword~) main::$6
|
||||
(word/signed dword/dword~) main::$7 ← (word) main::idx + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(word) main::idx ← (word/signed dword/dword~) main::$7
|
||||
(byte~) main::$8 ← (byte) main::e + (byte) main::yd
|
||||
(byte) main::e ← (byte~) main::$8
|
||||
(bool~) main::$9 ← (byte) main::xd < (byte) main::e
|
||||
(bool~) main::$10 ← ! (bool~) main::$9
|
||||
if((bool~) main::$10) goto main::@2
|
||||
to:main::@3
|
||||
main::@2: scope:[main] from main::@1 main::@3
|
||||
(byte/signed word/word/dword/signed dword~) main::$14 ← (byte) main::x1 + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(bool~) main::$15 ← (byte) main::x < (byte/signed word/word/dword/signed dword~) main::$14
|
||||
if((bool~) main::$15) goto main::@1
|
||||
to:main::@4
|
||||
main::@3: scope:[main] from main::@1
|
||||
(byte/signed word/word/dword/signed dword~) main::$11 ← (byte) main::y + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::y ← (byte/signed word/word/dword/signed dword~) main::$11
|
||||
(word/signed dword/dword~) main::$12 ← (word) main::idx + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(word) main::idx ← (word/signed dword/dword~) main::$12
|
||||
(byte~) main::$13 ← (byte) main::e - (byte) main::xd
|
||||
(byte) main::e ← (byte~) main::$13
|
||||
to:main::@2
|
||||
main::@4: scope:[main] from main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -373,14 +242,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 7 initial phi equivalence classes
|
||||
Coalesced [14] main::idx#8 ← main::idx#2
|
||||
Coalesced [15] main::e#8 ← main::e#2
|
||||
@ -399,13 +260,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,89 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/callconstparam.kc
|
||||
// Multiple calls with different (constant?) parameters should yield different values at runtime
|
||||
// Currently the same constant parameter is passed on every call.
|
||||
// Reason: Multiple versioned parameter constants x0#0, x0#1 are only output as a single constant in the ASM .const x0 = 0
|
||||
|
||||
byte* screen = $0400;
|
||||
|
||||
void main() {
|
||||
line(1,2);
|
||||
line(3,5);
|
||||
}
|
||||
|
||||
void line(byte x0, byte x1) {
|
||||
for(byte x = x0; x<x1; x++) {
|
||||
*screen = x;
|
||||
screen++;
|
||||
}
|
||||
|
||||
}
|
||||
Adding pre/post-modifier (byte*) screen ← ++ (byte*) screen
|
||||
Adding pre/post-modifier (byte) line::x ← ++ (byte) line::x
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) line((byte) line::x0 , (byte) line::x1)
|
||||
(bool~) line::$0
|
||||
(label) line::@1
|
||||
(label) line::@2
|
||||
(label) line::@return
|
||||
(byte) line::x
|
||||
(byte) line::x0
|
||||
(byte) line::x1
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(label) main::@return
|
||||
(byte*) screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call line (byte/signed byte/word/signed word/dword/signed dword) 1 (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(void~) main::$1 ← call line (byte/signed byte/word/signed word/dword/signed dword) 3 (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
line: scope:[line] from
|
||||
(byte) line::x ← (byte) line::x0
|
||||
to:line::@1
|
||||
line::@1: scope:[line] from line line::@1
|
||||
*((byte*) screen) ← (byte) line::x
|
||||
(byte*) screen ← ++ (byte*) screen
|
||||
(byte) line::x ← ++ (byte) line::x
|
||||
(bool~) line::$0 ← (byte) line::x < (byte) line::x1
|
||||
if((bool~) line::$0) goto line::@1
|
||||
to:line::@2
|
||||
line::@2: scope:[line] from line::@1
|
||||
to:line::@return
|
||||
line::@return: scope:[line] from line::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Removing empty block @1
|
||||
Removing empty block line::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
main modifies screen
|
||||
line modifies screen
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@2
|
||||
@ -230,14 +146,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to line:5 line:7
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 5 initial phi equivalence classes
|
||||
Coalesced [6] screen#16 ← screen#11
|
||||
Coalesced [10] line::x#3 ← line::x#0
|
||||
@ -251,12 +159,6 @@ Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@1
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,67 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/cast-deref.kc
|
||||
// Example of NOP-casting a dereferenced signed byte to a byte
|
||||
|
||||
void main() {
|
||||
signed byte[] sbs = { -1, -2, -3, -4};
|
||||
byte* SCREEN = $0400;
|
||||
for(byte i : 0..3) {
|
||||
SCREEN[i] = (byte) sbs[i];
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(signed byte/signed word/signed dword~) main::$0
|
||||
(signed byte/signed word/signed dword~) main::$1
|
||||
(signed byte/signed word/signed dword~) main::$2
|
||||
(signed byte/signed word/signed dword~) main::$3
|
||||
(byte~) main::$4
|
||||
(bool~) main::$5
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte*) main::SCREEN
|
||||
(byte) main::i
|
||||
(signed byte[]) main::sbs
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(signed byte/signed word/signed dword~) main::$0 ← - (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(signed byte/signed word/signed dword~) main::$1 ← - (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(signed byte/signed word/signed dword~) main::$2 ← - (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(signed byte/signed word/signed dword~) main::$3 ← - (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(signed byte[]) main::sbs ← { (signed byte/signed word/signed dword~) main::$0, (signed byte/signed word/signed dword~) main::$1, (signed byte/signed word/signed dword~) main::$2, (signed byte/signed word/signed dword~) main::$3 }
|
||||
(byte*) main::SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte~) main::$4 ← ((byte)) *((signed byte[]) main::sbs + (byte) main::i)
|
||||
*((byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$4
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,3)
|
||||
(bool~) main::$5 ← (byte) main::i != rangelast(0,3)
|
||||
if((bool~) main::$5) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -152,8 +90,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [10] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -162,8 +98,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,103 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/cast-precedence-problem.kc
|
||||
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
|
||||
|
||||
void main() {
|
||||
byte* SCREEN = $400;
|
||||
byte min = 10;
|
||||
byte max = 200;
|
||||
word sumw = min+max;
|
||||
byte midw = (byte)(sumw>>1)+1;
|
||||
SCREEN[0] = midw;
|
||||
byte sumb = min+max;
|
||||
byte midb = (sumb>>1)+1;
|
||||
SCREEN[1] = midb;
|
||||
byte* BGCOL = $d021;
|
||||
if(SCREEN[0]==SCREEN[1]) {
|
||||
*BGCOL = 5;
|
||||
} else {
|
||||
*BGCOL = 2;
|
||||
}
|
||||
}
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(word~) main::$1
|
||||
(byte~) main::$2
|
||||
(byte/signed word/word/dword/signed dword~) main::$3
|
||||
(byte~) main::$4
|
||||
(byte~) main::$5
|
||||
(byte/signed word/word/dword/signed dword~) main::$6
|
||||
(bool~) main::$7
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte*) main::BGCOL
|
||||
(byte*) main::SCREEN
|
||||
(byte) main::max
|
||||
(byte) main::midb
|
||||
(byte) main::midw
|
||||
(byte) main::min
|
||||
(byte) main::sumb
|
||||
(word) main::sumw
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::SCREEN ← ((byte*)) 1024
|
||||
Promoting byte to word in main::sumw ← ((word)) main::$0
|
||||
Promoting word/dword/signed dword to byte* in main::BGCOL ← ((byte*)) 53281
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte) main::min ← (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(byte) main::max ← (byte/word/signed word/dword/signed dword) 200
|
||||
(byte~) main::$0 ← (byte) main::min + (byte) main::max
|
||||
(word) main::sumw ← ((word)) (byte~) main::$0
|
||||
(word~) main::$1 ← (word) main::sumw >> (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte~) main::$2 ← ((byte)) (word~) main::$1
|
||||
(byte/signed word/word/dword/signed dword~) main::$3 ← (byte~) main::$2 + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::midw ← (byte/signed word/word/dword/signed dword~) main::$3
|
||||
*((byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) main::midw
|
||||
(byte~) main::$4 ← (byte) main::min + (byte) main::max
|
||||
(byte) main::sumb ← (byte~) main::$4
|
||||
(byte~) main::$5 ← (byte) main::sumb >> (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte/signed word/word/dword/signed dword~) main::$6 ← (byte~) main::$5 + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::midb ← (byte/signed word/word/dword/signed dword~) main::$6
|
||||
*((byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::midb
|
||||
(byte*) main::BGCOL ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(bool~) main::$7 ← *((byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 0) == *((byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 1)
|
||||
if((bool~) main::$7) goto main::@1
|
||||
to:main::@3
|
||||
main::@1: scope:[main] from main main::@4
|
||||
*((byte*) main::BGCOL) ← (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
to:main::@2
|
||||
main::@3: scope:[main] from main
|
||||
*((byte*) main::BGCOL) ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1 main::@3
|
||||
to:main::@return
|
||||
main::@4: scope:[main] from
|
||||
to:main::@1
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -220,13 +122,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,155 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/casting.kc
|
||||
byte* SCREEN = $0400;
|
||||
byte* SCREEN2 = SCREEN+40*3;
|
||||
byte* SCREEN3 = SCREEN+40*6;
|
||||
byte* SCREEN4 = SCREEN+40*9;
|
||||
|
||||
void main() {
|
||||
for( byte b: 0..100) {
|
||||
//Subtract unsigned byte from unsigned byte
|
||||
byte b2 = 200-b;
|
||||
SCREEN[b] = b2;
|
||||
// Cast unsigned byte to signed byte & negate
|
||||
signed byte sb = - (signed byte)b;
|
||||
SCREEN2[b] = (byte)sb;
|
||||
}
|
||||
w();
|
||||
}
|
||||
|
||||
|
||||
void w() {
|
||||
for(byte i : 0..10) {
|
||||
word w1 = 1300;
|
||||
word w2 = 1250;
|
||||
byte b = (byte)(w1-w2);
|
||||
byte b2 = 1400-1350+i;
|
||||
SCREEN3[i] = b;
|
||||
SCREEN4[i] = b2;
|
||||
}
|
||||
}
|
||||
|
||||
SYMBOLS
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) $0
|
||||
(byte*~) $1
|
||||
(byte/word/signed word/dword/signed dword~) $2
|
||||
(byte*~) $3
|
||||
(word/signed word/dword/signed dword~) $4
|
||||
(byte*~) $5
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(byte*) SCREEN2
|
||||
(byte*) SCREEN3
|
||||
(byte*) SCREEN4
|
||||
(void()) main()
|
||||
(byte/word/signed word/dword/signed dword~) main::$0
|
||||
(signed byte~) main::$1
|
||||
(signed byte~) main::$2
|
||||
(byte~) main::$3
|
||||
(bool~) main::$4
|
||||
(void~) main::$5
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::b
|
||||
(byte) main::b2
|
||||
(signed byte) main::sb
|
||||
(void()) w()
|
||||
(word~) w::$0
|
||||
(byte~) w::$1
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) w::$2
|
||||
(byte/signed word/word/dword/signed dword~) w::$3
|
||||
(bool~) w::$4
|
||||
(label) w::@1
|
||||
(label) w::@2
|
||||
(label) w::@return
|
||||
(byte) w::b
|
||||
(byte) w::b2
|
||||
(byte) w::i
|
||||
(word) w::w1
|
||||
(word) w::w2
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 40 * (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(byte*~) $1 ← (byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword~) $0
|
||||
(byte*) SCREEN2 ← (byte*~) $1
|
||||
(byte/word/signed word/dword/signed dword~) $2 ← (byte/signed byte/word/signed word/dword/signed dword) 40 * (byte/signed byte/word/signed word/dword/signed dword) 6
|
||||
(byte*~) $3 ← (byte*) SCREEN + (byte/word/signed word/dword/signed dword~) $2
|
||||
(byte*) SCREEN3 ← (byte*~) $3
|
||||
(word/signed word/dword/signed dword~) $4 ← (byte/signed byte/word/signed word/dword/signed dword) 40 * (byte/signed byte/word/signed word/dword/signed dword) 9
|
||||
(byte*~) $5 ← (byte*) SCREEN + (word/signed word/dword/signed dword~) $4
|
||||
(byte*) SCREEN4 ← (byte*~) $5
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::b ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte/word/signed word/dword/signed dword~) main::$0 ← (byte/word/signed word/dword/signed dword) 200 - (byte) main::b
|
||||
(byte) main::b2 ← (byte/word/signed word/dword/signed dword~) main::$0
|
||||
*((byte*) SCREEN + (byte) main::b) ← (byte) main::b2
|
||||
(signed byte~) main::$1 ← ((signed byte)) (byte) main::b
|
||||
(signed byte~) main::$2 ← - (signed byte~) main::$1
|
||||
(signed byte) main::sb ← (signed byte~) main::$2
|
||||
(byte~) main::$3 ← ((byte)) (signed byte) main::sb
|
||||
*((byte*) SCREEN2 + (byte) main::b) ← (byte~) main::$3
|
||||
(byte) main::b ← (byte) main::b + rangenext(0,100)
|
||||
(bool~) main::$4 ← (byte) main::b != rangelast(0,100)
|
||||
if((bool~) main::$4) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
(void~) main::$5 ← call w
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
w: scope:[w] from
|
||||
(byte) w::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:w::@1
|
||||
w::@1: scope:[w] from w w::@1
|
||||
(word) w::w1 ← (word/signed word/dword/signed dword) 1300
|
||||
(word) w::w2 ← (word/signed word/dword/signed dword) 1250
|
||||
(word~) w::$0 ← (word) w::w1 - (word) w::w2
|
||||
(byte~) w::$1 ← ((byte)) (word~) w::$0
|
||||
(byte) w::b ← (byte~) w::$1
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) w::$2 ← (word/signed word/dword/signed dword) 1400 - (word/signed word/dword/signed dword) 1350
|
||||
(byte/signed word/word/dword/signed dword~) w::$3 ← (byte/signed byte/word/signed word/dword/signed dword~) w::$2 + (byte) w::i
|
||||
(byte) w::b2 ← (byte/signed word/word/dword/signed dword~) w::$3
|
||||
*((byte*) SCREEN3 + (byte) w::i) ← (byte) w::b
|
||||
*((byte*) SCREEN4 + (byte) w::i) ← (byte) w::b2
|
||||
(byte) w::i ← (byte) w::i + rangenext(0,10)
|
||||
(bool~) w::$4 ← (byte) w::i != rangelast(0,10)
|
||||
if((bool~) w::$4) goto w::@1
|
||||
to:w::@2
|
||||
w::@2: scope:[w] from w::@1
|
||||
to:w::@return
|
||||
w::@return: scope:[w] from w::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$5
|
||||
Removing empty block @1
|
||||
Removing empty block w::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 40 * (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
@ -393,9 +243,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to w:13
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 2 initial phi equivalence classes
|
||||
Coalesced [15] main::b#3 ← main::b#1
|
||||
Coalesced [24] w::i#3 ← w::i#1
|
||||
@ -408,9 +255,6 @@ Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@2
|
||||
Adding NOP phi() at start of w
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,56 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/chained-assignment.kc
|
||||
// Tests that chained assignments work as intended
|
||||
|
||||
void main() {
|
||||
byte* screen = $400;
|
||||
byte a;
|
||||
screen[0] = a = 'c';
|
||||
screen[40] = a;
|
||||
a = screen[1] = 'm';
|
||||
screen[41] = a;
|
||||
screen[2] = 1 + (a = 'l'); // Chained assignment with a modification of the result
|
||||
screen[42] = a;
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte/signed word/word/dword/signed dword~) main::$0
|
||||
(label) main::@return
|
||||
(byte) main::a
|
||||
(byte*) main::screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword 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/dword/signed dword) 1024
|
||||
(byte) main::a ← (byte) 'c'
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) main::a
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 40) ← (byte) main::a
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'm'
|
||||
(byte) main::a ← *((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 1)
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 41) ← (byte) main::a
|
||||
(byte) main::a ← (byte) 'l'
|
||||
(byte/signed word/word/dword/signed dword~) main::$0 ← (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) main::a
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte/signed word/word/dword/signed dword~) main::$0
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 42) ← (byte) main::a
|
||||
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
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -120,15 +69,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,129 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/chargen.kc
|
||||
byte* PROCPORT = $01;
|
||||
byte* CHARGEN = $d000;
|
||||
byte* SCREEN = $0400;
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
byte* CHAR_A = CHARGEN+8;
|
||||
*PROCPORT = $32;
|
||||
byte* sc = SCREEN;
|
||||
for(byte y:0..7) {
|
||||
byte bits = CHAR_A[y];
|
||||
for(byte x:0..7) {
|
||||
byte c = '.';
|
||||
if((bits & $80) != 0) {
|
||||
c = '*';
|
||||
}
|
||||
*sc = c;
|
||||
sc++;
|
||||
bits = bits<<1;
|
||||
}
|
||||
sc = sc+32;
|
||||
}
|
||||
*PROCPORT = $37;
|
||||
asm { cli }
|
||||
}
|
||||
|
||||
Adding pre/post-modifier (byte*) main::sc ← ++ (byte*) main::sc
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) CHARGEN
|
||||
(byte*) PROCPORT
|
||||
(byte*) SCREEN
|
||||
(void()) main()
|
||||
(byte*~) main::$0
|
||||
(byte~) main::$1
|
||||
(bool~) main::$2
|
||||
(bool~) main::$3
|
||||
(byte~) main::$4
|
||||
(bool~) main::$5
|
||||
(byte*~) main::$6
|
||||
(bool~) main::$7
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@return
|
||||
(byte*) main::CHAR_A
|
||||
(byte) main::bits
|
||||
(byte) main::c
|
||||
(byte*) main::sc
|
||||
(byte) main::x
|
||||
(byte) main::y
|
||||
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in PROCPORT ← ((byte*)) 1
|
||||
Promoting word/dword/signed dword to byte* in CHARGEN ← ((byte*)) 53248
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte*) CHARGEN ← ((byte*)) (word/dword/signed dword) 53248
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
asm { sei }
|
||||
(byte*~) main::$0 ← (byte*) CHARGEN + (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) main::CHAR_A ← (byte*~) main::$0
|
||||
*((byte*) PROCPORT) ← (byte/signed byte/word/signed word/dword/signed dword) 50
|
||||
(byte*) main::sc ← (byte*) SCREEN
|
||||
(byte) main::y ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@5
|
||||
(byte) main::bits ← *((byte*) main::CHAR_A + (byte) main::y)
|
||||
(byte) main::x ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1 main::@3
|
||||
(byte) main::c ← (byte) '.'
|
||||
(byte~) main::$1 ← (byte) main::bits & (byte/word/signed word/dword/signed dword) 128
|
||||
(bool~) main::$2 ← (byte~) main::$1 != (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) main::$3 ← ! (bool~) main::$2
|
||||
if((bool~) main::$3) goto main::@3
|
||||
to:main::@4
|
||||
main::@3: scope:[main] from main::@2 main::@4
|
||||
*((byte*) main::sc) ← (byte) main::c
|
||||
(byte*) main::sc ← ++ (byte*) main::sc
|
||||
(byte~) main::$4 ← (byte) main::bits << (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::bits ← (byte~) main::$4
|
||||
(byte) main::x ← (byte) main::x + rangenext(0,7)
|
||||
(bool~) main::$5 ← (byte) main::x != rangelast(0,7)
|
||||
if((bool~) main::$5) goto main::@2
|
||||
to:main::@5
|
||||
main::@4: scope:[main] from main::@2
|
||||
(byte) main::c ← (byte) '*'
|
||||
to:main::@3
|
||||
main::@5: scope:[main] from main::@3
|
||||
(byte*~) main::$6 ← (byte*) main::sc + (byte/signed byte/word/signed word/dword/signed dword) 32
|
||||
(byte*) main::sc ← (byte*~) main::$6
|
||||
(byte) main::y ← (byte) main::y + rangenext(0,7)
|
||||
(bool~) main::$7 ← (byte) main::y != rangelast(0,7)
|
||||
if((bool~) main::$7) goto main::@1
|
||||
to:main::@6
|
||||
main::@6: scope:[main] from main::@5
|
||||
*((byte*) PROCPORT) ← (byte/signed byte/word/signed word/dword/signed dword) 55
|
||||
asm { cli }
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@6
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) PROCPORT#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte*) CHARGEN#0 ← ((byte*)) (word/dword/signed dword) 53248
|
||||
@ -379,20 +255,6 @@ Adding NOP phi() at start of main::@4
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 6 initial phi equivalence classes
|
||||
Coalesced [8] main::bits#5 ← main::bits#0
|
||||
Coalesced [9] main::sc#9 ← main::sc#7
|
||||
@ -408,18 +270,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main::@4
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,95 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/chessboard.kc
|
||||
// Draws a chess board in the upper left corner of the screen
|
||||
void main() {
|
||||
byte* screen = $0400;
|
||||
byte* colors = $d800;
|
||||
byte color = 1;
|
||||
for( byte row: 0..7) {
|
||||
for( byte column: 0..7) {
|
||||
screen[column] = $a0;
|
||||
colors[column] = color;
|
||||
color = color^1;
|
||||
}
|
||||
color = color^1;
|
||||
screen = screen+40;
|
||||
colors = colors+40;
|
||||
}
|
||||
}
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte/word/dword~) main::$0
|
||||
(bool~) main::$1
|
||||
(byte/word/dword~) main::$2
|
||||
(byte*~) main::$3
|
||||
(byte*~) main::$4
|
||||
(bool~) main::$5
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte) main::color
|
||||
(byte*) main::colors
|
||||
(byte) main::column
|
||||
(byte) main::row
|
||||
(byte*) main::screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::screen ← ((byte*)) 1024
|
||||
Promoting word/dword/signed dword to byte* in main::colors ← ((byte*)) 55296
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) main::colors ← ((byte*)) (word/dword/signed dword) 55296
|
||||
(byte) main::color ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::row ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@3
|
||||
(byte) main::column ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1 main::@2
|
||||
*((byte*) main::screen + (byte) main::column) ← (byte/word/signed word/dword/signed dword) 160
|
||||
*((byte*) main::colors + (byte) main::column) ← (byte) main::color
|
||||
(byte/word/dword~) main::$0 ← (byte) main::color ^ (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::color ← (byte/word/dword~) main::$0
|
||||
(byte) main::column ← (byte) main::column + rangenext(0,7)
|
||||
(bool~) main::$1 ← (byte) main::column != rangelast(0,7)
|
||||
if((bool~) main::$1) goto main::@2
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2
|
||||
(byte/word/dword~) main::$2 ← (byte) main::color ^ (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::color ← (byte/word/dword~) main::$2
|
||||
(byte*~) main::$3 ← (byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*) main::screen ← (byte*~) main::$3
|
||||
(byte*~) main::$4 ← (byte*) main::colors + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*) main::colors ← (byte*~) main::$4
|
||||
(byte) main::row ← (byte) main::row + rangenext(0,7)
|
||||
(bool~) main::$5 ← (byte) main::row != rangelast(0,7)
|
||||
if((bool~) main::$5) goto main::@1
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -241,18 +151,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 6 initial phi equivalence classes
|
||||
Coalesced [6] main::color#7 ← main::color#5
|
||||
Coalesced [19] main::screen#5 ← main::screen#1
|
||||
@ -268,17 +166,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,196 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/compound-assignment.kc
|
||||
// Test compound assignment operators
|
||||
byte[] ref = { 3, 4, 3, 18, 9, 1, 4, 2, 4, 5, 1 , 0};
|
||||
byte* screen1 = $400;
|
||||
byte* screen2 = screen1+40;
|
||||
byte* cols = $d800;
|
||||
byte GREEN = 5;
|
||||
byte RED = 2;
|
||||
|
||||
void main() {
|
||||
|
||||
byte i =0;
|
||||
byte a = 3; //3
|
||||
test(i++, a);
|
||||
a += 1; //4
|
||||
test(i++, a);
|
||||
a -= 1; //3
|
||||
test(i++, a);
|
||||
a *= 6; //18
|
||||
test(i++, a);
|
||||
a /= 2; //9
|
||||
test(i++, a);
|
||||
a %= 2; //1
|
||||
test(i++, a);
|
||||
a <<= 2; //4
|
||||
test(i++, a);
|
||||
a >>= 1; //2
|
||||
test(i++, a);
|
||||
a ^= %110; //4
|
||||
test(i++, a);
|
||||
a |= %1; //5
|
||||
test(i++, a);
|
||||
a &= %1; //1
|
||||
test(i++, a);
|
||||
|
||||
}
|
||||
|
||||
void test(byte i, byte a) {
|
||||
screen1[i] = a;
|
||||
screen2[i] = ref[i];
|
||||
if(ref[i]==a) {
|
||||
cols[i] = GREEN;
|
||||
} else {
|
||||
cols[i] = RED;
|
||||
}
|
||||
}
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
SYMBOLS
|
||||
(byte*~) $0
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte) GREEN
|
||||
(byte) RED
|
||||
(byte*) cols
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(void~) main::$10
|
||||
(void~) main::$2
|
||||
(void~) main::$3
|
||||
(void~) main::$4
|
||||
(void~) main::$5
|
||||
(void~) main::$6
|
||||
(void~) main::$7
|
||||
(void~) main::$8
|
||||
(void~) main::$9
|
||||
(label) main::@return
|
||||
(byte) main::a
|
||||
(byte) main::i
|
||||
(byte[]) ref
|
||||
(byte*) screen1
|
||||
(byte*) screen2
|
||||
(void()) test((byte) test::i , (byte) test::a)
|
||||
(bool~) test::$0
|
||||
(label) test::@1
|
||||
(label) test::@2
|
||||
(label) test::@3
|
||||
(label) test::@4
|
||||
(label) test::@return
|
||||
(byte) test::a
|
||||
(byte) test::i
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in screen1 ← ((byte*)) 1024
|
||||
Promoting word/dword/signed dword to byte* in cols ← ((byte*)) 55296
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[]) ref ← { (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 18, (byte/signed byte/word/signed word/dword/signed dword) 9, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 5, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0 }
|
||||
(byte*) screen1 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*~) $0 ← (byte*) screen1 + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*) screen2 ← (byte*~) $0
|
||||
(byte*) cols ← ((byte*)) (word/dword/signed dword) 55296
|
||||
(byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
(byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) main::a ← (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(void~) main::$0 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(byte) main::a ← (byte) main::a + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(void~) main::$1 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(byte) main::a ← (byte) main::a - (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(void~) main::$2 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(byte) main::a ← (byte) main::a * (byte/signed byte/word/signed word/dword/signed dword) 6
|
||||
(void~) main::$3 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(byte) main::a ← (byte) main::a / (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(void~) main::$4 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(byte) main::a ← (byte) main::a % (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(void~) main::$5 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(byte) main::a ← (byte) main::a << (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(void~) main::$6 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(byte) main::a ← (byte) main::a >> (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(void~) main::$7 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(byte) main::a ← (byte) main::a ^ (byte/signed byte/word/signed word/dword/signed dword) 6
|
||||
(void~) main::$8 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(byte) main::a ← (byte) main::a | (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(void~) main::$9 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(byte) main::a ← (byte) main::a & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(void~) main::$10 ← call test (byte) main::i (byte) main::a
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
test: scope:[test] from
|
||||
*((byte*) screen1 + (byte) test::i) ← (byte) test::a
|
||||
*((byte*) screen2 + (byte) test::i) ← *((byte[]) ref + (byte) test::i)
|
||||
(bool~) test::$0 ← *((byte[]) ref + (byte) test::i) == (byte) test::a
|
||||
if((bool~) test::$0) goto test::@1
|
||||
to:test::@3
|
||||
test::@1: scope:[test] from test test::@4
|
||||
*((byte*) cols + (byte) test::i) ← (byte) GREEN
|
||||
to:test::@2
|
||||
test::@3: scope:[test] from test
|
||||
*((byte*) cols + (byte) test::i) ← (byte) RED
|
||||
to:test::@2
|
||||
test::@2: scope:[test] from test::@1 test::@3
|
||||
to:test::@return
|
||||
test::@4: scope:[test] from
|
||||
to:test::@1
|
||||
test::@return: scope:[test] from test::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Eliminating unused variable - keeping the call (void~) main::$2
|
||||
Eliminating unused variable - keeping the call (void~) main::$3
|
||||
Eliminating unused variable - keeping the call (void~) main::$4
|
||||
Eliminating unused variable - keeping the call (void~) main::$5
|
||||
Eliminating unused variable - keeping the call (void~) main::$6
|
||||
Eliminating unused variable - keeping the call (void~) main::$7
|
||||
Eliminating unused variable - keeping the call (void~) main::$8
|
||||
Eliminating unused variable - keeping the call (void~) main::$9
|
||||
Eliminating unused variable - keeping the call (void~) main::$10
|
||||
Removing empty block @1
|
||||
Removing empty block test::@2
|
||||
Removing empty block test::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte[]) ref#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 18, (byte/signed byte/word/signed word/dword/signed dword) 9, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 5, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 0 }
|
||||
(byte*) screen1#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
@ -826,9 +635,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to test:5 test:7 test:9 test:11 test:13 test:15 test:17 test:19 test:21 test:23 test:25
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 2 initial phi equivalence classes
|
||||
Coalesced down to 2 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
@ -845,9 +651,6 @@ Adding NOP phi() at start of main::@7
|
||||
Adding NOP phi() at start of main::@8
|
||||
Adding NOP phi() at start of main::@9
|
||||
Adding NOP phi() at start of main::@10
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,63 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/concat-char.kc
|
||||
// Concatenate a char to a string
|
||||
|
||||
void main() {
|
||||
byte* screen = $400;
|
||||
byte l = 'l';
|
||||
byte[] msg = "cm"+l;
|
||||
for( byte i: 0..2 ) {
|
||||
screen[i] = msg[i];
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(string~) main::$0
|
||||
(bool~) main::$1
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(byte) main::l
|
||||
(byte[]) main::msg
|
||||
(byte*) main::screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword 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/dword/signed dword) 1024
|
||||
(byte) main::l ← (byte) 'l'
|
||||
(string~) main::$0 ← (string) "cm" + (byte) main::l
|
||||
(byte[]) main::msg ← (string~) main::$0
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) main::screen + (byte) main::i) ← *((byte[]) main::msg + (byte) main::i)
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,2)
|
||||
(bool~) main::$1 ← (byte) main::i != rangelast(0,2)
|
||||
if((bool~) main::$1) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Creating constant string variable for inline (const string) main::$2 "cm"
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -140,8 +82,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [10] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -150,8 +90,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,63 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/const-condition.kc
|
||||
// Ensure that if()'s with constant comparisons are identified and eliminated
|
||||
|
||||
void main() {
|
||||
const byte* SCREEN = $0400;
|
||||
if(7<4) {
|
||||
SCREEN[0] = '*';
|
||||
} else {
|
||||
SCREEN[0] = '!';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte*) main::SCREEN
|
||||
|
||||
Promoting word/signed word/dword/signed dword 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/dword/signed dword) 1024
|
||||
(bool~) main::$0 ← (byte/signed byte/word/signed word/dword/signed dword) 7 < (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
if((bool~) main::$0) goto main::@1
|
||||
to:main::@3
|
||||
main::@1: scope:[main] from main main::@4
|
||||
*((byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) '*'
|
||||
to:main::@2
|
||||
main::@3: scope:[main] from main
|
||||
*((byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) '!'
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1 main::@3
|
||||
to:main::@return
|
||||
main::@4: scope:[main] from
|
||||
to:main::@1
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -115,14 +57,12 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,158 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/const-identification.kc
|
||||
const byte* plots = $1000;
|
||||
const byte* SCREEN = $0400;
|
||||
|
||||
void main() {
|
||||
for(byte i : 0..39) {
|
||||
plots[i] = i;
|
||||
SCREEN[i] = 0;
|
||||
}
|
||||
do {
|
||||
line(0, 10);
|
||||
} while (true);
|
||||
}
|
||||
|
||||
void line(byte x0, byte x1) {
|
||||
if(x0<x1) {
|
||||
for(byte x = x0; x<=x1; x++) {
|
||||
plot(x);
|
||||
}
|
||||
} else {
|
||||
plot(x0);
|
||||
}
|
||||
}
|
||||
|
||||
void plot(byte x) {
|
||||
byte idx = plots[x];
|
||||
SCREEN[idx] = SCREEN[idx]+1;
|
||||
}
|
||||
|
||||
Adding pre/post-modifier (byte) line::x ← ++ (byte) line::x
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(void()) line((byte) line::x0 , (byte) line::x1)
|
||||
(bool~) line::$0
|
||||
(void~) line::$1
|
||||
(void~) line::$2
|
||||
(bool~) line::$3
|
||||
(label) line::@1
|
||||
(label) line::@2
|
||||
(label) line::@3
|
||||
(label) line::@4
|
||||
(label) line::@5
|
||||
(label) line::@6
|
||||
(label) line::@return
|
||||
(byte) line::x
|
||||
(byte) line::x0
|
||||
(byte) line::x1
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(void~) main::$1
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(void()) plot((byte) plot::x)
|
||||
(byte/signed word/word/dword/signed dword~) plot::$0
|
||||
(label) plot::@return
|
||||
(byte) plot::idx
|
||||
(byte) plot::x
|
||||
(byte*) plots
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in plots ← ((byte*)) 4096
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) plots ← ((byte*)) (word/signed word/dword/signed dword) 4096
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) plots + (byte) main::i) ← (byte) main::i
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,39)
|
||||
(bool~) main::$0 ← (byte) main::i != rangelast(0,39)
|
||||
if((bool~) main::$0) goto main::@1
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@2 main::@3
|
||||
(void~) main::$1 ← call line (byte/signed byte/word/signed word/dword/signed dword) 0 (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
if(true) goto main::@2
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
line: scope:[line] from
|
||||
(bool~) line::$0 ← (byte) line::x0 < (byte) line::x1
|
||||
if((bool~) line::$0) goto line::@1
|
||||
to:line::@4
|
||||
line::@1: scope:[line] from line line::@5
|
||||
(byte) line::x ← (byte) line::x0
|
||||
to:line::@3
|
||||
line::@4: scope:[line] from line
|
||||
(void~) line::$1 ← call plot (byte) line::x0
|
||||
to:line::@2
|
||||
line::@2: scope:[line] from line::@4 line::@6
|
||||
to:line::@return
|
||||
line::@5: scope:[line] from
|
||||
to:line::@1
|
||||
line::@3: scope:[line] from line::@1 line::@3
|
||||
(void~) line::$2 ← call plot (byte) line::x
|
||||
(byte) line::x ← ++ (byte) line::x
|
||||
(bool~) line::$3 ← (byte) line::x <= (byte) line::x1
|
||||
if((bool~) line::$3) goto line::@3
|
||||
to:line::@6
|
||||
line::@6: scope:[line] from line::@3
|
||||
to:line::@2
|
||||
line::@return: scope:[line] from line::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
plot: scope:[plot] from
|
||||
(byte) plot::idx ← *((byte*) plots + (byte) plot::x)
|
||||
(byte/signed word/word/dword/signed dword~) plot::$0 ← *((byte*) SCREEN + (byte) plot::idx) + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
*((byte*) SCREEN + (byte) plot::idx) ← (byte/signed word/word/dword/signed dword~) plot::$0
|
||||
to:plot::@return
|
||||
plot::@return: scope:[plot] from plot
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @3
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Eliminating unused variable - keeping the call (void~) line::$1
|
||||
Eliminating unused variable - keeping the call (void~) line::$2
|
||||
Removing empty block main::@3
|
||||
Removing empty block main::@4
|
||||
Removing empty block @1
|
||||
Removing empty block line::@2
|
||||
Removing empty block line::@5
|
||||
Removing empty block line::@6
|
||||
Removing empty block @2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) plots#0 ← ((byte*)) (word/signed word/dword/signed dword) 4096
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
@ -341,9 +188,6 @@ Calls in [] to main:2
|
||||
Calls in [main] to line:11
|
||||
Calls in [line] to plot:16
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 2 initial phi equivalence classes
|
||||
Coalesced [12] main::i#3 ← main::i#1
|
||||
Coalesced [20] line::x#4 ← line::x#1
|
||||
@ -356,9 +200,6 @@ Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@2
|
||||
Adding NOP phi() at start of line
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,50 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/const-mult-div.kc
|
||||
// Test a constant with multiplication and division
|
||||
|
||||
void main() {
|
||||
byte b = 6*(14/3) + 22%3;
|
||||
byte* screen = $400;
|
||||
screen[0] = b;
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) main::$0
|
||||
(byte/signed word/word/dword/signed dword/signed byte~) main::$1
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) main::$2
|
||||
(byte/signed word/word/dword/signed dword/signed byte~) main::$3
|
||||
(label) main::@return
|
||||
(byte) main::b
|
||||
(byte*) main::screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) main::$0 ← (byte/signed byte/word/signed word/dword/signed dword) 14 / (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(byte/signed word/word/dword/signed dword/signed byte~) main::$1 ← (byte/signed byte/word/signed word/dword/signed dword) 6 * (byte/signed byte/word/signed word/dword/signed dword~) main::$0
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) main::$2 ← (byte/signed byte/word/signed word/dword/signed dword) 22 % (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(byte/signed word/word/dword/signed dword/signed byte~) main::$3 ← (byte/signed word/word/dword/signed dword/signed byte~) main::$1 + (byte/signed byte/word/signed word/dword/signed dword~) main::$2
|
||||
(byte) main::b ← (byte/signed word/word/dword/signed dword/signed byte~) main::$3
|
||||
(byte*) main::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) main::b
|
||||
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
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -107,13 +62,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,78 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/const-param.kc
|
||||
// Test that the compiler optimizes when the same parameter value is passed into a function in all calls
|
||||
|
||||
void main() {
|
||||
byte* screen = $400;
|
||||
const byte reverse = $80;
|
||||
screen[0] = sum(reverse, 'c');
|
||||
screen[1] = sum(reverse, 'm');
|
||||
screen[2] = sum(reverse, 'l');
|
||||
}
|
||||
|
||||
byte sum(byte a, byte b) {
|
||||
return a+b;
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(byte~) main::$1
|
||||
(byte~) main::$2
|
||||
(label) main::@return
|
||||
(byte) main::reverse
|
||||
(byte*) main::screen
|
||||
(byte()) sum((byte) sum::a , (byte) sum::b)
|
||||
(byte~) sum::$0
|
||||
(label) sum::@1
|
||||
(label) sum::@return
|
||||
(byte) sum::a
|
||||
(byte) sum::b
|
||||
(byte) sum::return
|
||||
|
||||
Promoting word/signed word/dword/signed dword 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/dword/signed dword) 1024
|
||||
(byte) main::reverse ← (byte/word/signed word/dword/signed dword) 128
|
||||
(byte~) main::$0 ← call sum (byte) main::reverse (byte) 'c'
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte~) main::$0
|
||||
(byte~) main::$1 ← call sum (byte) main::reverse (byte) 'm'
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$1
|
||||
(byte~) main::$2 ← call sum (byte) main::reverse (byte) 'l'
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
sum: scope:[sum] from
|
||||
(byte~) sum::$0 ← (byte) sum::a + (byte) sum::b
|
||||
(byte) sum::return ← (byte~) sum::$0
|
||||
to:sum::@return
|
||||
sum::@return: scope:[sum] from sum sum::@1
|
||||
(byte) sum::return ← (byte) sum::return
|
||||
return (byte) sum::return
|
||||
to:@return
|
||||
sum::@1: scope:[sum] from
|
||||
to:sum::@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Removing empty block @1
|
||||
Removing empty block sum::@1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@2
|
||||
main: scope:[main] from @2
|
||||
@ -220,18 +147,12 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to sum:5 sum:9 sum:13
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,70 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/const-pointer.kc
|
||||
//Test that constant pointers are detected correctly
|
||||
|
||||
void main() {
|
||||
byte* screen = $400;
|
||||
byte* NULL = $0;
|
||||
byte* rem = $ff;
|
||||
|
||||
if(rem!=NULL) {
|
||||
screen[0] = '*';
|
||||
} else {
|
||||
screen[0] = '.';
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte*) main::NULL
|
||||
(byte*) main::rem
|
||||
(byte*) main::screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::screen ← ((byte*)) 1024
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in main::NULL ← ((byte*)) 0
|
||||
Promoting byte/word/signed word/dword/signed dword to byte* in main::rem ← ((byte*)) 255
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) main::NULL ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte*) main::rem ← ((byte*)) (byte/word/signed word/dword/signed dword) 255
|
||||
(bool~) main::$0 ← (byte*) main::rem != (byte*) main::NULL
|
||||
if((bool~) main::$0) goto main::@1
|
||||
to:main::@3
|
||||
main::@1: scope:[main] from main main::@4
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) '*'
|
||||
to:main::@2
|
||||
main::@3: scope:[main] from main
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) '.'
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1 main::@3
|
||||
to:main::@return
|
||||
main::@4: scope:[main] from
|
||||
to:main::@1
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -139,14 +74,12 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,65 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/const-word-pointer.kc
|
||||
// Test a constant word pointers (pointing to a word placed on zeropage).
|
||||
// The result when running is "CML!" on the screen.
|
||||
|
||||
void main () {
|
||||
byte* screen = $400;
|
||||
word w = $0d03;
|
||||
word* wp = &w;
|
||||
screen[0] = <*wp;
|
||||
screen[1] = >*wp;
|
||||
*wp = $210c;
|
||||
screen[2] = <*wp;
|
||||
screen[3] = >*wp;
|
||||
}
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(word*~) main::$0
|
||||
(byte~) main::$1
|
||||
(byte~) main::$2
|
||||
(byte~) main::$3
|
||||
(byte~) main::$4
|
||||
(label) main::@return
|
||||
(byte*) main::screen
|
||||
(word) main::w
|
||||
(word*) main::wp
|
||||
|
||||
Promoting word/signed word/dword/signed dword 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/dword/signed dword) 1024
|
||||
(word) main::w ← (word/signed word/dword/signed dword) 3331
|
||||
(word*~) main::$0 ← & (word) main::w
|
||||
(word*) main::wp ← (word*~) main::$0
|
||||
(byte~) main::$1 ← < *((word*) main::wp)
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte~) main::$1
|
||||
(byte~) main::$2 ← > *((word*) main::wp)
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$2
|
||||
*((word*) main::wp) ← (word/signed word/dword/signed dword) 8460
|
||||
(byte~) main::$3 ← < *((word*) main::wp)
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$3
|
||||
(byte~) main::$4 ← > *((word*) main::wp)
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte~) main::$4
|
||||
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
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -125,15 +65,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,38 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/constabsmin.kc
|
||||
const byte* SCREEN = $0400;
|
||||
|
||||
void main() {
|
||||
*SCREEN = 1;
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
*((byte*) SCREEN) ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
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
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
@ -69,13 +36,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,87 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/constant-string-concat.kc
|
||||
// Concatenates string constants in different ways
|
||||
void main() {
|
||||
byte[] s = "e"+"l";
|
||||
byte[] s2 = s+'o';
|
||||
byte[] s3 = "cam"+s2;
|
||||
byte e = '!';
|
||||
byte[] s4 = ""+'t'+ e;
|
||||
byte[] s5 = s3+s4;
|
||||
byte* SCREEN = $400;
|
||||
for( byte i: 0..7) {
|
||||
SCREEN[i] = s5[i];
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(string~) main::$0
|
||||
(byte*~) main::$1
|
||||
(string~) main::$2
|
||||
(string~) main::$3
|
||||
(string~) main::$4
|
||||
(byte[]~) main::$5
|
||||
(bool~) main::$6
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte*) main::SCREEN
|
||||
(byte) main::e
|
||||
(byte) main::i
|
||||
(byte[]) main::s
|
||||
(byte[]) main::s2
|
||||
(byte[]) main::s3
|
||||
(byte[]) main::s4
|
||||
(byte[]) main::s5
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(string~) main::$0 ← (string) "e" + (string) "l"
|
||||
(byte[]) main::s ← (string~) main::$0
|
||||
(byte*~) main::$1 ← (byte[]) main::s + (byte) 'o'
|
||||
(byte[]) main::s2 ← (byte*~) main::$1
|
||||
(string~) main::$2 ← (string) "cam" + (byte[]) main::s2
|
||||
(byte[]) main::s3 ← (string~) main::$2
|
||||
(byte) main::e ← (byte) '!'
|
||||
(string~) main::$3 ← (string) "" + (byte) 't'
|
||||
(string~) main::$4 ← (string~) main::$3 + (byte) main::e
|
||||
(byte[]) main::s4 ← (string~) main::$4
|
||||
(byte[]~) main::$5 ← (byte[]) main::s3 + (byte[]) main::s4
|
||||
(byte[]) main::s5 ← (byte[]~) main::$5
|
||||
(byte*) main::SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) main::SCREEN + (byte) main::i) ← *((byte[]) main::s5 + (byte) main::i)
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,7)
|
||||
(bool~) main::$6 ← (byte) main::i != rangelast(0,7)
|
||||
if((bool~) main::$6) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Creating constant string variable for inline (const string) main::$7 "e"
|
||||
Creating constant string variable for inline (const string) main::$8 "l"
|
||||
Creating constant string variable for inline (const string) main::$9 "cam"
|
||||
Creating constant string variable for inline (const string) main::$10 ""
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -205,8 +123,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [10] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -215,8 +131,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,80 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/constantmin.kc
|
||||
const byte* SCREEN = $0400;
|
||||
const byte STAR = 81;
|
||||
|
||||
byte* VIC = $d000;
|
||||
byte* BGCOL = VIC+$10*2+1;
|
||||
byte RED = 2;
|
||||
|
||||
void main() {
|
||||
*SCREEN = STAR;
|
||||
*BGCOL = RED;
|
||||
for(byte i: 40..79) {
|
||||
SCREEN[i] = (STAR+1);
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) $0
|
||||
(byte*~) $1
|
||||
(byte*~) $2
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte) RED
|
||||
(byte*) SCREEN
|
||||
(byte) STAR
|
||||
(byte*) VIC
|
||||
(void()) main()
|
||||
(byte/signed word/word/dword/signed dword~) main::$0
|
||||
(bool~) main::$1
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
Promoting word/dword/signed dword to byte* in VIC ← ((byte*)) 53248
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte) STAR ← (byte/signed byte/word/signed word/dword/signed dword) 81
|
||||
(byte*) VIC ← ((byte*)) (word/dword/signed dword) 53248
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 16 * (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte*~) $1 ← (byte*) VIC + (byte/signed byte/word/signed word/dword/signed dword~) $0
|
||||
(byte*~) $2 ← (byte*~) $1 + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte*) BGCOL ← (byte*~) $2
|
||||
(byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
*((byte*) SCREEN) ← (byte) STAR
|
||||
*((byte*) BGCOL) ← (byte) RED
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte/signed word/word/dword/signed dword~) main::$0 ← (byte) STAR + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte/signed word/word/dword/signed dword~) main::$0
|
||||
(byte) main::i ← (byte) main::i + rangenext(40,79)
|
||||
(bool~) main::$1 ← (byte) main::i != rangelast(40,79)
|
||||
if((bool~) main::$1) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte) STAR#0 ← (byte/signed byte/word/signed word/dword/signed dword) 81
|
||||
@ -181,8 +106,6 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [11] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -190,8 +113,6 @@ Culled Empty Block (label) main::@3
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,853 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/constants.kc
|
||||
import "print.kc"
|
||||
const byte* BGCOL = $d021;
|
||||
const byte GREEN = 5;
|
||||
const byte RED = 2 ;
|
||||
|
||||
void main() {
|
||||
print_cls();
|
||||
*BGCOL = GREEN;
|
||||
test_bytes();
|
||||
test_sbytes();
|
||||
}
|
||||
|
||||
// Test different byte constants
|
||||
void test_bytes() {
|
||||
byte bb=0;
|
||||
assert_byte("0=0@", bb, 0);
|
||||
byte bc=bb+2;
|
||||
assert_byte("0+2=2@", bc, 2);
|
||||
byte bd=(byte)((signed byte)bc-4);
|
||||
assert_byte("0+2-4=254@", bd, 254);
|
||||
}
|
||||
|
||||
void assert_byte(byte* msg, byte b, byte c) {
|
||||
print_str(msg);
|
||||
print_str(" @");
|
||||
if(b!=c) {
|
||||
*BGCOL = RED;
|
||||
print_str("fail!@");
|
||||
} else {
|
||||
print_str("ok@");
|
||||
}
|
||||
print_ln();
|
||||
}
|
||||
|
||||
// Test different signed byte constants
|
||||
void test_sbytes() {
|
||||
signed byte bb=0;
|
||||
assert_sbyte("0=0@", bb, 0);
|
||||
signed byte bc=bb+2;
|
||||
assert_sbyte("0+2=2@", bc, 2);
|
||||
signed byte bd=bc-4;
|
||||
assert_sbyte("0+2-4=-2@", bd, -2);
|
||||
signed byte be=-bd;
|
||||
assert_sbyte("-(0+2-4)=2@", be, 2);
|
||||
signed byte bf=(signed byte)(-127-127);
|
||||
assert_sbyte("-127-127=2@", bf, 2);
|
||||
}
|
||||
|
||||
void assert_sbyte(byte* msg, signed byte b, signed byte c) {
|
||||
print_str(msg);
|
||||
print_str(" @");
|
||||
if(b!=c) {
|
||||
*BGCOL = RED;
|
||||
print_str("fail!@");
|
||||
} else {
|
||||
print_str("ok@");
|
||||
}
|
||||
print_ln();
|
||||
}
|
||||
|
||||
Importing print.kc
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/print.kc
|
||||
|
||||
byte* print_screen = $0400;
|
||||
byte* print_line_cursor = print_screen;
|
||||
byte* print_char_cursor = print_line_cursor;
|
||||
|
||||
// Print a number of zero-terminated strings, each followed by a newline.
|
||||
// The sequence of lines is terminated by another zero.
|
||||
void print_str_lines(byte* str) {
|
||||
while(*str!='@') {
|
||||
do {
|
||||
byte ch = *(str++);
|
||||
if(ch!='@') {
|
||||
*(print_char_cursor++) = ch;
|
||||
}
|
||||
} while (ch!='@');
|
||||
print_ln();
|
||||
}
|
||||
}
|
||||
|
||||
// Print a zero-terminated string followed by a newline
|
||||
void print_str_ln(byte* str) {
|
||||
print_str(str);
|
||||
print_ln();
|
||||
}
|
||||
|
||||
// Print a zero-terminated string
|
||||
void print_str(byte* str) {
|
||||
while(*str!='@') {
|
||||
*(print_char_cursor++) = *(str++);
|
||||
}
|
||||
}
|
||||
|
||||
// Print a string at a specific screen position
|
||||
void print_str_at(byte* str, byte* at) {
|
||||
while(*str!='@') {
|
||||
*(at++) = *(str++);
|
||||
}
|
||||
}
|
||||
|
||||
// Print a newline
|
||||
void print_ln() {
|
||||
do {
|
||||
print_line_cursor = print_line_cursor + $28;
|
||||
} while (print_line_cursor<print_char_cursor);
|
||||
print_char_cursor = print_line_cursor;
|
||||
}
|
||||
|
||||
// Print a signed word as HEX
|
||||
void print_sword(signed word w) {
|
||||
if(w<0) {
|
||||
print_char('-');
|
||||
w = -w;
|
||||
}
|
||||
print_word((word)w);
|
||||
}
|
||||
|
||||
// Print a signed byte as HEX
|
||||
void print_sbyte(signed byte b) {
|
||||
if(b<0) {
|
||||
print_char('-');
|
||||
b = -b;
|
||||
}
|
||||
print_byte((byte)b);
|
||||
}
|
||||
|
||||
// Print a word as HEX
|
||||
void print_word(word w) {
|
||||
print_byte(>w);
|
||||
print_byte(<w);
|
||||
}
|
||||
|
||||
// Print a dword as HEX
|
||||
void print_dword(dword dw) {
|
||||
print_word(>dw);
|
||||
print_word(<dw);
|
||||
}
|
||||
|
||||
// Print a signed dword as HEX
|
||||
void print_sdword(signed dword dw) {
|
||||
if(dw<0) {
|
||||
print_char('-');
|
||||
dw = -dw;
|
||||
}
|
||||
print_dword((dword)dw);
|
||||
}
|
||||
|
||||
const byte[] print_hextab = "0123456789abcdef";
|
||||
|
||||
// Print a byte as HEX
|
||||
void print_byte(byte b) {
|
||||
// Table of hexadecimal digits
|
||||
print_char(print_hextab[b>>4]);
|
||||
print_char(print_hextab[b&$f]);
|
||||
}
|
||||
|
||||
// Print a single char
|
||||
void print_char(byte ch) {
|
||||
*(print_char_cursor++) = ch;
|
||||
}
|
||||
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
void print_cls() {
|
||||
for(byte* sc=print_screen; sc!=print_screen+1000; sc++) {
|
||||
*sc = ' ';
|
||||
}
|
||||
print_line_cursor = print_screen;
|
||||
print_char_cursor = print_line_cursor;
|
||||
}
|
||||
|
||||
// Set the screen to print on. Also resets current line/char cursor.
|
||||
void print_set_screen(byte* screen) {
|
||||
print_screen = screen;
|
||||
print_line_cursor = print_screen;
|
||||
print_char_cursor = print_line_cursor;
|
||||
}
|
||||
|
||||
Adding pre/post-modifier (byte*) print_str_lines::str ← ++ (byte*) print_str_lines::str
|
||||
Adding pre/post-modifier (byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
Adding pre/post-modifier (byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
Adding pre/post-modifier (byte*) print_str::str ← ++ (byte*) print_str::str
|
||||
Adding pre/post-modifier (byte*) print_str_at::at ← ++ (byte*) print_str_at::at
|
||||
Adding pre/post-modifier (byte*) print_str_at::str ← ++ (byte*) print_str_at::str
|
||||
Adding pre/post-modifier (byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
Adding pre/post-modifier (byte*) print_cls::sc ← ++ (byte*) print_cls::sc
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @10
|
||||
(label) @11
|
||||
(label) @12
|
||||
(label) @13
|
||||
(label) @14
|
||||
(label) @15
|
||||
(label) @16
|
||||
(label) @17
|
||||
(label) @18
|
||||
(label) @19
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @5
|
||||
(label) @6
|
||||
(label) @7
|
||||
(label) @8
|
||||
(label) @9
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte) GREEN
|
||||
(byte) RED
|
||||
(void()) assert_byte((byte*) assert_byte::msg , (byte) assert_byte::b , (byte) assert_byte::c)
|
||||
(void~) assert_byte::$0
|
||||
(void~) assert_byte::$1
|
||||
(bool~) assert_byte::$2
|
||||
(void~) assert_byte::$3
|
||||
(void~) assert_byte::$4
|
||||
(void~) assert_byte::$5
|
||||
(label) assert_byte::@1
|
||||
(label) assert_byte::@2
|
||||
(label) assert_byte::@3
|
||||
(label) assert_byte::@4
|
||||
(label) assert_byte::@return
|
||||
(byte) assert_byte::b
|
||||
(byte) assert_byte::c
|
||||
(byte*) assert_byte::msg
|
||||
(void()) assert_sbyte((byte*) assert_sbyte::msg , (signed byte) assert_sbyte::b , (signed byte) assert_sbyte::c)
|
||||
(void~) assert_sbyte::$0
|
||||
(void~) assert_sbyte::$1
|
||||
(bool~) assert_sbyte::$2
|
||||
(void~) assert_sbyte::$3
|
||||
(void~) assert_sbyte::$4
|
||||
(void~) assert_sbyte::$5
|
||||
(label) assert_sbyte::@1
|
||||
(label) assert_sbyte::@2
|
||||
(label) assert_sbyte::@3
|
||||
(label) assert_sbyte::@4
|
||||
(label) assert_sbyte::@return
|
||||
(signed byte) assert_sbyte::b
|
||||
(signed byte) assert_sbyte::c
|
||||
(byte*) assert_sbyte::msg
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(void~) main::$2
|
||||
(label) main::@return
|
||||
(void()) print_byte((byte) print_byte::b)
|
||||
(byte~) print_byte::$0
|
||||
(void~) print_byte::$1
|
||||
(byte~) print_byte::$2
|
||||
(void~) print_byte::$3
|
||||
(label) print_byte::@return
|
||||
(byte) print_byte::b
|
||||
(void()) print_char((byte) print_char::ch)
|
||||
(label) print_char::@return
|
||||
(byte) print_char::ch
|
||||
(byte*) print_char_cursor
|
||||
(void()) print_cls()
|
||||
(byte*~) print_cls::$0
|
||||
(bool~) print_cls::$1
|
||||
(label) print_cls::@1
|
||||
(label) print_cls::@2
|
||||
(label) print_cls::@return
|
||||
(byte*) print_cls::sc
|
||||
(void()) print_dword((dword) print_dword::dw)
|
||||
(word~) print_dword::$0
|
||||
(void~) print_dword::$1
|
||||
(word~) print_dword::$2
|
||||
(void~) print_dword::$3
|
||||
(label) print_dword::@return
|
||||
(dword) print_dword::dw
|
||||
(byte[]) print_hextab
|
||||
(byte*) print_line_cursor
|
||||
(void()) print_ln()
|
||||
(byte*~) print_ln::$0
|
||||
(bool~) print_ln::$1
|
||||
(label) print_ln::@1
|
||||
(label) print_ln::@2
|
||||
(label) print_ln::@return
|
||||
(void()) print_sbyte((signed byte) print_sbyte::b)
|
||||
(bool~) print_sbyte::$0
|
||||
(bool~) print_sbyte::$1
|
||||
(void~) print_sbyte::$2
|
||||
(signed byte~) print_sbyte::$3
|
||||
(byte~) print_sbyte::$4
|
||||
(void~) print_sbyte::$5
|
||||
(label) print_sbyte::@1
|
||||
(label) print_sbyte::@2
|
||||
(label) print_sbyte::@return
|
||||
(signed byte) print_sbyte::b
|
||||
(byte*) print_screen
|
||||
(void()) print_sdword((signed dword) print_sdword::dw)
|
||||
(bool~) print_sdword::$0
|
||||
(bool~) print_sdword::$1
|
||||
(void~) print_sdword::$2
|
||||
(signed dword~) print_sdword::$3
|
||||
(dword~) print_sdword::$4
|
||||
(void~) print_sdword::$5
|
||||
(label) print_sdword::@1
|
||||
(label) print_sdword::@2
|
||||
(label) print_sdword::@return
|
||||
(signed dword) print_sdword::dw
|
||||
(void()) print_set_screen((byte*) print_set_screen::screen)
|
||||
(label) print_set_screen::@return
|
||||
(byte*) print_set_screen::screen
|
||||
(void()) print_str((byte*) print_str::str)
|
||||
(bool~) print_str::$0
|
||||
(label) print_str::@1
|
||||
(label) print_str::@2
|
||||
(label) print_str::@3
|
||||
(label) print_str::@4
|
||||
(label) print_str::@5
|
||||
(label) print_str::@6
|
||||
(label) print_str::@return
|
||||
(byte*) print_str::str
|
||||
(void()) print_str_at((byte*) print_str_at::str , (byte*) print_str_at::at)
|
||||
(bool~) print_str_at::$0
|
||||
(label) print_str_at::@1
|
||||
(label) print_str_at::@2
|
||||
(label) print_str_at::@3
|
||||
(label) print_str_at::@4
|
||||
(label) print_str_at::@5
|
||||
(label) print_str_at::@6
|
||||
(label) print_str_at::@return
|
||||
(byte*) print_str_at::at
|
||||
(byte*) print_str_at::str
|
||||
(void()) print_str_lines((byte*) print_str_lines::str)
|
||||
(bool~) print_str_lines::$0
|
||||
(bool~) print_str_lines::$1
|
||||
(bool~) print_str_lines::$2
|
||||
(bool~) print_str_lines::$3
|
||||
(void~) print_str_lines::$4
|
||||
(label) print_str_lines::@1
|
||||
(label) print_str_lines::@10
|
||||
(label) print_str_lines::@2
|
||||
(label) print_str_lines::@3
|
||||
(label) print_str_lines::@4
|
||||
(label) print_str_lines::@5
|
||||
(label) print_str_lines::@6
|
||||
(label) print_str_lines::@7
|
||||
(label) print_str_lines::@8
|
||||
(label) print_str_lines::@9
|
||||
(label) print_str_lines::@return
|
||||
(byte) print_str_lines::ch
|
||||
(byte*) print_str_lines::str
|
||||
(void()) print_str_ln((byte*) print_str_ln::str)
|
||||
(void~) print_str_ln::$0
|
||||
(void~) print_str_ln::$1
|
||||
(label) print_str_ln::@return
|
||||
(byte*) print_str_ln::str
|
||||
(void()) print_sword((signed word) print_sword::w)
|
||||
(bool~) print_sword::$0
|
||||
(bool~) print_sword::$1
|
||||
(void~) print_sword::$2
|
||||
(signed word~) print_sword::$3
|
||||
(word~) print_sword::$4
|
||||
(void~) print_sword::$5
|
||||
(label) print_sword::@1
|
||||
(label) print_sword::@2
|
||||
(label) print_sword::@return
|
||||
(signed word) print_sword::w
|
||||
(void()) print_word((word) print_word::w)
|
||||
(byte~) print_word::$0
|
||||
(void~) print_word::$1
|
||||
(byte~) print_word::$2
|
||||
(void~) print_word::$3
|
||||
(label) print_word::@return
|
||||
(word) print_word::w
|
||||
(void()) test_bytes()
|
||||
(void~) test_bytes::$0
|
||||
(byte/signed word/word/dword/signed dword~) test_bytes::$1
|
||||
(void~) test_bytes::$2
|
||||
(signed byte~) test_bytes::$3
|
||||
(signed word/signed byte/signed dword~) test_bytes::$4
|
||||
(byte~) test_bytes::$5
|
||||
(void~) test_bytes::$6
|
||||
(label) test_bytes::@return
|
||||
(byte) test_bytes::bb
|
||||
(byte) test_bytes::bc
|
||||
(byte) test_bytes::bd
|
||||
(void()) test_sbytes()
|
||||
(void~) test_sbytes::$0
|
||||
(signed word/signed byte/signed dword~) test_sbytes::$1
|
||||
(signed byte~) test_sbytes::$10
|
||||
(void~) test_sbytes::$11
|
||||
(void~) test_sbytes::$2
|
||||
(signed word/signed byte/signed dword~) test_sbytes::$3
|
||||
(signed byte/signed word/signed dword~) test_sbytes::$4
|
||||
(void~) test_sbytes::$5
|
||||
(signed byte~) test_sbytes::$6
|
||||
(void~) test_sbytes::$7
|
||||
(signed byte/signed word/signed dword~) test_sbytes::$8
|
||||
(signed word/signed byte/signed dword~) test_sbytes::$9
|
||||
(label) test_sbytes::@return
|
||||
(signed byte) test_sbytes::bb
|
||||
(signed byte) test_sbytes::bc
|
||||
(signed byte) test_sbytes::bd
|
||||
(signed byte) test_sbytes::be
|
||||
(signed byte) test_sbytes::bf
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in print_screen ← ((byte*)) 1024
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53281
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) print_screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) print_line_cursor ← (byte*) print_screen
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:@1
|
||||
print_str_lines: scope:[print_str_lines] from
|
||||
to:print_str_lines::@1
|
||||
print_str_lines::@1: scope:[print_str_lines] from print_str_lines print_str_lines::@9
|
||||
(bool~) print_str_lines::$0 ← *((byte*) print_str_lines::str) != (byte) '@'
|
||||
if((bool~) print_str_lines::$0) goto print_str_lines::@2
|
||||
to:print_str_lines::@6
|
||||
print_str_lines::@2: scope:[print_str_lines] from print_str_lines::@1 print_str_lines::@7
|
||||
to:print_str_lines::@4
|
||||
print_str_lines::@6: scope:[print_str_lines] from print_str_lines::@1
|
||||
to:print_str_lines::@3
|
||||
print_str_lines::@3: scope:[print_str_lines] from print_str_lines::@10 print_str_lines::@6
|
||||
to:print_str_lines::@return
|
||||
print_str_lines::@7: scope:[print_str_lines] from
|
||||
to:print_str_lines::@2
|
||||
print_str_lines::@4: scope:[print_str_lines] from print_str_lines::@2 print_str_lines::@5
|
||||
(byte) print_str_lines::ch ← *((byte*) print_str_lines::str)
|
||||
(byte*) print_str_lines::str ← ++ (byte*) print_str_lines::str
|
||||
(bool~) print_str_lines::$1 ← (byte) print_str_lines::ch != (byte) '@'
|
||||
(bool~) print_str_lines::$2 ← ! (bool~) print_str_lines::$1
|
||||
if((bool~) print_str_lines::$2) goto print_str_lines::@5
|
||||
to:print_str_lines::@8
|
||||
print_str_lines::@5: scope:[print_str_lines] from print_str_lines::@4 print_str_lines::@8
|
||||
(bool~) print_str_lines::$3 ← (byte) print_str_lines::ch != (byte) '@'
|
||||
if((bool~) print_str_lines::$3) goto print_str_lines::@4
|
||||
to:print_str_lines::@9
|
||||
print_str_lines::@8: scope:[print_str_lines] from print_str_lines::@4
|
||||
*((byte*) print_char_cursor) ← (byte) print_str_lines::ch
|
||||
(byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
to:print_str_lines::@5
|
||||
print_str_lines::@9: scope:[print_str_lines] from print_str_lines::@5
|
||||
(void~) print_str_lines::$4 ← call print_ln
|
||||
to:print_str_lines::@1
|
||||
print_str_lines::@10: scope:[print_str_lines] from
|
||||
to:print_str_lines::@3
|
||||
print_str_lines::@return: scope:[print_str_lines] from print_str_lines::@3
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
print_str_ln: scope:[print_str_ln] from
|
||||
(void~) print_str_ln::$0 ← call print_str (byte*) print_str_ln::str
|
||||
(void~) print_str_ln::$1 ← call print_ln
|
||||
to:print_str_ln::@return
|
||||
print_str_ln::@return: scope:[print_str_ln] from print_str_ln
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
print_str: scope:[print_str] from
|
||||
to:print_str::@1
|
||||
print_str::@1: scope:[print_str] from print_str print_str::@2
|
||||
(bool~) print_str::$0 ← *((byte*) print_str::str) != (byte) '@'
|
||||
if((bool~) print_str::$0) goto print_str::@2
|
||||
to:print_str::@4
|
||||
print_str::@2: scope:[print_str] from print_str::@1 print_str::@5
|
||||
*((byte*) print_char_cursor) ← *((byte*) print_str::str)
|
||||
(byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
(byte*) print_str::str ← ++ (byte*) print_str::str
|
||||
to:print_str::@1
|
||||
print_str::@4: scope:[print_str] from print_str::@1
|
||||
to:print_str::@3
|
||||
print_str::@3: scope:[print_str] from print_str::@4 print_str::@6
|
||||
to:print_str::@return
|
||||
print_str::@5: scope:[print_str] from
|
||||
to:print_str::@2
|
||||
print_str::@6: scope:[print_str] from
|
||||
to:print_str::@3
|
||||
print_str::@return: scope:[print_str] from print_str::@3
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
print_str_at: scope:[print_str_at] from
|
||||
to:print_str_at::@1
|
||||
print_str_at::@1: scope:[print_str_at] from print_str_at print_str_at::@2
|
||||
(bool~) print_str_at::$0 ← *((byte*) print_str_at::str) != (byte) '@'
|
||||
if((bool~) print_str_at::$0) goto print_str_at::@2
|
||||
to:print_str_at::@4
|
||||
print_str_at::@2: scope:[print_str_at] from print_str_at::@1 print_str_at::@5
|
||||
*((byte*) print_str_at::at) ← *((byte*) print_str_at::str)
|
||||
(byte*) print_str_at::at ← ++ (byte*) print_str_at::at
|
||||
(byte*) print_str_at::str ← ++ (byte*) print_str_at::str
|
||||
to:print_str_at::@1
|
||||
print_str_at::@4: scope:[print_str_at] from print_str_at::@1
|
||||
to:print_str_at::@3
|
||||
print_str_at::@3: scope:[print_str_at] from print_str_at::@4 print_str_at::@6
|
||||
to:print_str_at::@return
|
||||
print_str_at::@5: scope:[print_str_at] from
|
||||
to:print_str_at::@2
|
||||
print_str_at::@6: scope:[print_str_at] from
|
||||
to:print_str_at::@3
|
||||
print_str_at::@return: scope:[print_str_at] from print_str_at::@3
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
print_ln: scope:[print_ln] from
|
||||
to:print_ln::@1
|
||||
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
|
||||
(byte*~) print_ln::$0 ← (byte*) print_line_cursor + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*) print_line_cursor ← (byte*~) print_ln::$0
|
||||
(bool~) print_ln::$1 ← (byte*) print_line_cursor < (byte*) print_char_cursor
|
||||
if((bool~) print_ln::$1) goto print_ln::@1
|
||||
to:print_ln::@2
|
||||
print_ln::@2: scope:[print_ln] from print_ln::@1
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:print_ln::@return
|
||||
print_ln::@return: scope:[print_ln] from print_ln::@2
|
||||
return
|
||||
to:@return
|
||||
@5: scope:[] from @4
|
||||
to:@6
|
||||
print_sword: scope:[print_sword] from
|
||||
(bool~) print_sword::$0 ← (signed word) print_sword::w < (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) print_sword::$1 ← ! (bool~) print_sword::$0
|
||||
if((bool~) print_sword::$1) goto print_sword::@1
|
||||
to:print_sword::@2
|
||||
print_sword::@1: scope:[print_sword] from print_sword print_sword::@2
|
||||
(word~) print_sword::$4 ← ((word)) (signed word) print_sword::w
|
||||
(void~) print_sword::$5 ← call print_word (word~) print_sword::$4
|
||||
to:print_sword::@return
|
||||
print_sword::@2: scope:[print_sword] from print_sword
|
||||
(void~) print_sword::$2 ← call print_char (byte) '-'
|
||||
(signed word~) print_sword::$3 ← - (signed word) print_sword::w
|
||||
(signed word) print_sword::w ← (signed word~) print_sword::$3
|
||||
to:print_sword::@1
|
||||
print_sword::@return: scope:[print_sword] from print_sword::@1
|
||||
return
|
||||
to:@return
|
||||
@6: scope:[] from @5
|
||||
to:@7
|
||||
print_sbyte: scope:[print_sbyte] from
|
||||
(bool~) print_sbyte::$0 ← (signed byte) print_sbyte::b < (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) print_sbyte::$1 ← ! (bool~) print_sbyte::$0
|
||||
if((bool~) print_sbyte::$1) goto print_sbyte::@1
|
||||
to:print_sbyte::@2
|
||||
print_sbyte::@1: scope:[print_sbyte] from print_sbyte print_sbyte::@2
|
||||
(byte~) print_sbyte::$4 ← ((byte)) (signed byte) print_sbyte::b
|
||||
(void~) print_sbyte::$5 ← call print_byte (byte~) print_sbyte::$4
|
||||
to:print_sbyte::@return
|
||||
print_sbyte::@2: scope:[print_sbyte] from print_sbyte
|
||||
(void~) print_sbyte::$2 ← call print_char (byte) '-'
|
||||
(signed byte~) print_sbyte::$3 ← - (signed byte) print_sbyte::b
|
||||
(signed byte) print_sbyte::b ← (signed byte~) print_sbyte::$3
|
||||
to:print_sbyte::@1
|
||||
print_sbyte::@return: scope:[print_sbyte] from print_sbyte::@1
|
||||
return
|
||||
to:@return
|
||||
@7: scope:[] from @6
|
||||
to:@8
|
||||
print_word: scope:[print_word] from
|
||||
(byte~) print_word::$0 ← > (word) print_word::w
|
||||
(void~) print_word::$1 ← call print_byte (byte~) print_word::$0
|
||||
(byte~) print_word::$2 ← < (word) print_word::w
|
||||
(void~) print_word::$3 ← call print_byte (byte~) print_word::$2
|
||||
to:print_word::@return
|
||||
print_word::@return: scope:[print_word] from print_word
|
||||
return
|
||||
to:@return
|
||||
@8: scope:[] from @7
|
||||
to:@9
|
||||
print_dword: scope:[print_dword] from
|
||||
(word~) print_dword::$0 ← > (dword) print_dword::dw
|
||||
(void~) print_dword::$1 ← call print_word (word~) print_dword::$0
|
||||
(word~) print_dword::$2 ← < (dword) print_dword::dw
|
||||
(void~) print_dword::$3 ← call print_word (word~) print_dword::$2
|
||||
to:print_dword::@return
|
||||
print_dword::@return: scope:[print_dword] from print_dword
|
||||
return
|
||||
to:@return
|
||||
@9: scope:[] from @8
|
||||
to:@10
|
||||
print_sdword: scope:[print_sdword] from
|
||||
(bool~) print_sdword::$0 ← (signed dword) print_sdword::dw < (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) print_sdword::$1 ← ! (bool~) print_sdword::$0
|
||||
if((bool~) print_sdword::$1) goto print_sdword::@1
|
||||
to:print_sdword::@2
|
||||
print_sdword::@1: scope:[print_sdword] from print_sdword print_sdword::@2
|
||||
(dword~) print_sdword::$4 ← ((dword)) (signed dword) print_sdword::dw
|
||||
(void~) print_sdword::$5 ← call print_dword (dword~) print_sdword::$4
|
||||
to:print_sdword::@return
|
||||
print_sdword::@2: scope:[print_sdword] from print_sdword
|
||||
(void~) print_sdword::$2 ← call print_char (byte) '-'
|
||||
(signed dword~) print_sdword::$3 ← - (signed dword) print_sdword::dw
|
||||
(signed dword) print_sdword::dw ← (signed dword~) print_sdword::$3
|
||||
to:print_sdword::@1
|
||||
print_sdword::@return: scope:[print_sdword] from print_sdword::@1
|
||||
return
|
||||
to:@return
|
||||
@10: scope:[] from @9
|
||||
(byte[]) print_hextab ← (string) "0123456789abcdef"
|
||||
to:@11
|
||||
print_byte: scope:[print_byte] from
|
||||
(byte~) print_byte::$0 ← (byte) print_byte::b >> (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(void~) print_byte::$1 ← call print_char *((byte[]) print_hextab + (byte~) print_byte::$0)
|
||||
(byte~) print_byte::$2 ← (byte) print_byte::b & (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
(void~) print_byte::$3 ← call print_char *((byte[]) print_hextab + (byte~) print_byte::$2)
|
||||
to:print_byte::@return
|
||||
print_byte::@return: scope:[print_byte] from print_byte
|
||||
return
|
||||
to:@return
|
||||
@11: scope:[] from @10
|
||||
to:@12
|
||||
print_char: scope:[print_char] from
|
||||
*((byte*) print_char_cursor) ← (byte) print_char::ch
|
||||
(byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
to:print_char::@return
|
||||
print_char::@return: scope:[print_char] from print_char
|
||||
return
|
||||
to:@return
|
||||
@12: scope:[] from @11
|
||||
to:@13
|
||||
print_cls: scope:[print_cls] from
|
||||
(byte*) print_cls::sc ← (byte*) print_screen
|
||||
to:print_cls::@1
|
||||
print_cls::@1: scope:[print_cls] from print_cls print_cls::@1
|
||||
*((byte*) print_cls::sc) ← (byte) ' '
|
||||
(byte*) print_cls::sc ← ++ (byte*) print_cls::sc
|
||||
(byte*~) print_cls::$0 ← (byte*) print_screen + (word/signed word/dword/signed dword) 1000
|
||||
(bool~) print_cls::$1 ← (byte*) print_cls::sc != (byte*~) print_cls::$0
|
||||
if((bool~) print_cls::$1) goto print_cls::@1
|
||||
to:print_cls::@2
|
||||
print_cls::@2: scope:[print_cls] from print_cls::@1
|
||||
(byte*) print_line_cursor ← (byte*) print_screen
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:print_cls::@return
|
||||
print_cls::@return: scope:[print_cls] from print_cls::@2
|
||||
return
|
||||
to:@return
|
||||
@13: scope:[] from @12
|
||||
to:@14
|
||||
print_set_screen: scope:[print_set_screen] from
|
||||
(byte*) print_screen ← (byte*) print_set_screen::screen
|
||||
(byte*) print_line_cursor ← (byte*) print_screen
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:print_set_screen::@return
|
||||
print_set_screen::@return: scope:[print_set_screen] from print_set_screen
|
||||
return
|
||||
to:@return
|
||||
@14: scope:[] from @13
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
(byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
to:@15
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call print_cls
|
||||
*((byte*) BGCOL) ← (byte) GREEN
|
||||
(void~) main::$1 ← call test_bytes
|
||||
(void~) main::$2 ← call test_sbytes
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@15: scope:[] from @14
|
||||
to:@16
|
||||
test_bytes: scope:[test_bytes] from
|
||||
(byte) test_bytes::bb ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(void~) test_bytes::$0 ← call assert_byte (string) "0=0@" (byte) test_bytes::bb (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte/signed word/word/dword/signed dword~) test_bytes::$1 ← (byte) test_bytes::bb + (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) test_bytes::bc ← (byte/signed word/word/dword/signed dword~) test_bytes::$1
|
||||
(void~) test_bytes::$2 ← call assert_byte (string) "0+2=2@" (byte) test_bytes::bc (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(signed byte~) test_bytes::$3 ← ((signed byte)) (byte) test_bytes::bc
|
||||
(signed word/signed byte/signed dword~) test_bytes::$4 ← (signed byte~) test_bytes::$3 - (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte~) test_bytes::$5 ← ((byte)) (signed word/signed byte/signed dword~) test_bytes::$4
|
||||
(byte) test_bytes::bd ← (byte~) test_bytes::$5
|
||||
(void~) test_bytes::$6 ← call assert_byte (string) "0+2-4=254@" (byte) test_bytes::bd (byte/word/signed word/dword/signed dword) 254
|
||||
to:test_bytes::@return
|
||||
test_bytes::@return: scope:[test_bytes] from test_bytes
|
||||
return
|
||||
to:@return
|
||||
@16: scope:[] from @15
|
||||
to:@17
|
||||
assert_byte: scope:[assert_byte] from
|
||||
(void~) assert_byte::$0 ← call print_str (byte*) assert_byte::msg
|
||||
(void~) assert_byte::$1 ← call print_str (string) " @"
|
||||
(bool~) assert_byte::$2 ← (byte) assert_byte::b != (byte) assert_byte::c
|
||||
if((bool~) assert_byte::$2) goto assert_byte::@1
|
||||
to:assert_byte::@3
|
||||
assert_byte::@1: scope:[assert_byte] from assert_byte assert_byte::@4
|
||||
*((byte*) BGCOL) ← (byte) RED
|
||||
(void~) assert_byte::$4 ← call print_str (string) "fail!@"
|
||||
to:assert_byte::@2
|
||||
assert_byte::@3: scope:[assert_byte] from assert_byte
|
||||
(void~) assert_byte::$3 ← call print_str (string) "ok@"
|
||||
to:assert_byte::@2
|
||||
assert_byte::@2: scope:[assert_byte] from assert_byte::@1 assert_byte::@3
|
||||
(void~) assert_byte::$5 ← call print_ln
|
||||
to:assert_byte::@return
|
||||
assert_byte::@4: scope:[assert_byte] from
|
||||
to:assert_byte::@1
|
||||
assert_byte::@return: scope:[assert_byte] from assert_byte::@2
|
||||
return
|
||||
to:@return
|
||||
@17: scope:[] from @16
|
||||
to:@18
|
||||
test_sbytes: scope:[test_sbytes] from
|
||||
(signed byte) test_sbytes::bb ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(void~) test_sbytes::$0 ← call assert_sbyte (string) "0=0@" (signed byte) test_sbytes::bb (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(signed word/signed byte/signed dword~) test_sbytes::$1 ← (signed byte) test_sbytes::bb + (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(signed byte) test_sbytes::bc ← (signed word/signed byte/signed dword~) test_sbytes::$1
|
||||
(void~) test_sbytes::$2 ← call assert_sbyte (string) "0+2=2@" (signed byte) test_sbytes::bc (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(signed word/signed byte/signed dword~) test_sbytes::$3 ← (signed byte) test_sbytes::bc - (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(signed byte) test_sbytes::bd ← (signed word/signed byte/signed dword~) test_sbytes::$3
|
||||
(signed byte/signed word/signed dword~) test_sbytes::$4 ← - (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(void~) test_sbytes::$5 ← call assert_sbyte (string) "0+2-4=-2@" (signed byte) test_sbytes::bd (signed byte/signed word/signed dword~) test_sbytes::$4
|
||||
(signed byte~) test_sbytes::$6 ← - (signed byte) test_sbytes::bd
|
||||
(signed byte) test_sbytes::be ← (signed byte~) test_sbytes::$6
|
||||
(void~) test_sbytes::$7 ← call assert_sbyte (string) "-(0+2-4)=2@" (signed byte) test_sbytes::be (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(signed byte/signed word/signed dword~) test_sbytes::$8 ← - (byte/signed byte/word/signed word/dword/signed dword) 127
|
||||
(signed word/signed byte/signed dword~) test_sbytes::$9 ← (signed byte/signed word/signed dword~) test_sbytes::$8 - (byte/signed byte/word/signed word/dword/signed dword) 127
|
||||
(signed byte~) test_sbytes::$10 ← ((signed byte)) (signed word/signed byte/signed dword~) test_sbytes::$9
|
||||
(signed byte) test_sbytes::bf ← (signed byte~) test_sbytes::$10
|
||||
(void~) test_sbytes::$11 ← call assert_sbyte (string) "-127-127=2@" (signed byte) test_sbytes::bf (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
to:test_sbytes::@return
|
||||
test_sbytes::@return: scope:[test_sbytes] from test_sbytes
|
||||
return
|
||||
to:@return
|
||||
@18: scope:[] from @17
|
||||
to:@19
|
||||
assert_sbyte: scope:[assert_sbyte] from
|
||||
(void~) assert_sbyte::$0 ← call print_str (byte*) assert_sbyte::msg
|
||||
(void~) assert_sbyte::$1 ← call print_str (string) " @"
|
||||
(bool~) assert_sbyte::$2 ← (signed byte) assert_sbyte::b != (signed byte) assert_sbyte::c
|
||||
if((bool~) assert_sbyte::$2) goto assert_sbyte::@1
|
||||
to:assert_sbyte::@3
|
||||
assert_sbyte::@1: scope:[assert_sbyte] from assert_sbyte assert_sbyte::@4
|
||||
*((byte*) BGCOL) ← (byte) RED
|
||||
(void~) assert_sbyte::$4 ← call print_str (string) "fail!@"
|
||||
to:assert_sbyte::@2
|
||||
assert_sbyte::@3: scope:[assert_sbyte] from assert_sbyte
|
||||
(void~) assert_sbyte::$3 ← call print_str (string) "ok@"
|
||||
to:assert_sbyte::@2
|
||||
assert_sbyte::@2: scope:[assert_sbyte] from assert_sbyte::@1 assert_sbyte::@3
|
||||
(void~) assert_sbyte::$5 ← call print_ln
|
||||
to:assert_sbyte::@return
|
||||
assert_sbyte::@4: scope:[assert_sbyte] from
|
||||
to:assert_sbyte::@1
|
||||
assert_sbyte::@return: scope:[assert_sbyte] from assert_sbyte::@2
|
||||
return
|
||||
to:@return
|
||||
@19: scope:[] from @18
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @19
|
||||
|
||||
Removing unused procedure print_str_lines
|
||||
Removing unused procedure print_str_ln
|
||||
Removing unused procedure print_str_at
|
||||
Removing unused procedure print_sword
|
||||
Removing unused procedure print_sbyte
|
||||
Removing unused procedure print_sdword
|
||||
Removing unused procedure print_set_screen
|
||||
Removing unused procedure print_dword
|
||||
Removing unused procedure print_word
|
||||
Removing unused procedure print_byte
|
||||
Removing unused procedure print_char
|
||||
Eliminating unused variable (byte[]) print_hextab and assignment [15] (byte[]) print_hextab ← (string) "0123456789abcdef"
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Eliminating unused variable - keeping the call (void~) main::$2
|
||||
Eliminating unused variable - keeping the call (void~) test_bytes::$0
|
||||
Eliminating unused variable - keeping the call (void~) test_bytes::$2
|
||||
Eliminating unused variable - keeping the call (void~) test_bytes::$6
|
||||
Eliminating unused variable - keeping the call (void~) assert_byte::$0
|
||||
Eliminating unused variable - keeping the call (void~) assert_byte::$1
|
||||
Eliminating unused variable - keeping the call (void~) assert_byte::$4
|
||||
Eliminating unused variable - keeping the call (void~) assert_byte::$3
|
||||
Eliminating unused variable - keeping the call (void~) assert_byte::$5
|
||||
Eliminating unused variable - keeping the call (void~) test_sbytes::$0
|
||||
Eliminating unused variable - keeping the call (void~) test_sbytes::$2
|
||||
Eliminating unused variable - keeping the call (void~) test_sbytes::$5
|
||||
Eliminating unused variable - keeping the call (void~) test_sbytes::$7
|
||||
Eliminating unused variable - keeping the call (void~) test_sbytes::$11
|
||||
Eliminating unused variable - keeping the call (void~) assert_sbyte::$0
|
||||
Eliminating unused variable - keeping the call (void~) assert_sbyte::$1
|
||||
Eliminating unused variable - keeping the call (void~) assert_sbyte::$4
|
||||
Eliminating unused variable - keeping the call (void~) assert_sbyte::$3
|
||||
Eliminating unused variable - keeping the call (void~) assert_sbyte::$5
|
||||
Creating constant string variable for inline (const string) test_bytes::msg "0=0@"
|
||||
Creating constant string variable for inline (const string) test_bytes::msg1 "0+2=2@"
|
||||
Creating constant string variable for inline (const string) test_bytes::msg2 "0+2-4=254@"
|
||||
Creating constant string variable for inline (const string) assert_byte::str " @"
|
||||
Creating constant string variable for inline (const string) assert_byte::str1 "fail!@"
|
||||
Creating constant string variable for inline (const string) assert_byte::str2 "ok@"
|
||||
Creating constant string variable for inline (const string) test_sbytes::msg "0=0@"
|
||||
Creating constant string variable for inline (const string) test_sbytes::msg1 "0+2=2@"
|
||||
Creating constant string variable for inline (const string) test_sbytes::msg2 "0+2-4=-2@"
|
||||
Creating constant string variable for inline (const string) test_sbytes::msg3 "-(0+2-4)=2@"
|
||||
Creating constant string variable for inline (const string) test_sbytes::msg4 "-127-127=2@"
|
||||
Creating constant string variable for inline (const string) assert_sbyte::str " @"
|
||||
Creating constant string variable for inline (const string) assert_sbyte::str1 "fail!@"
|
||||
Creating constant string variable for inline (const string) assert_sbyte::str2 "ok@"
|
||||
Removing empty block @1
|
||||
Removing empty block @2
|
||||
Removing empty block print_str::@4
|
||||
Removing empty block print_str::@3
|
||||
Removing empty block print_str::@5
|
||||
Removing empty block print_str::@6
|
||||
Removing empty block @3
|
||||
Removing empty block @4
|
||||
Removing empty block @5
|
||||
Removing empty block @6
|
||||
Removing empty block @7
|
||||
Removing empty block @8
|
||||
Removing empty block @9
|
||||
Removing empty block @10
|
||||
Removing empty block @11
|
||||
Removing empty block @12
|
||||
Removing empty block @13
|
||||
Removing empty block @15
|
||||
Removing empty block @16
|
||||
Removing empty block assert_byte::@4
|
||||
Removing empty block @17
|
||||
Removing empty block @18
|
||||
Removing empty block assert_sbyte::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
print_str modifies print_char_cursor
|
||||
print_ln modifies print_line_cursor
|
||||
print_ln modifies print_char_cursor
|
||||
print_cls modifies print_line_cursor
|
||||
print_cls modifies print_char_cursor
|
||||
main modifies print_line_cursor
|
||||
main modifies print_char_cursor
|
||||
test_bytes modifies print_char_cursor
|
||||
test_bytes modifies print_line_cursor
|
||||
assert_byte modifies print_char_cursor
|
||||
assert_byte modifies print_line_cursor
|
||||
test_sbytes modifies print_char_cursor
|
||||
test_sbytes modifies print_line_cursor
|
||||
assert_sbyte modifies print_char_cursor
|
||||
assert_sbyte modifies print_line_cursor
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) print_line_cursor#0 ← (byte*) print_screen#0
|
||||
@ -1861,17 +1013,6 @@ Calls in [assert_sbyte] to print_str:26 print_str:28 print_str:31 print_ln:33 pr
|
||||
Calls in [test_bytes] to assert_byte:57 assert_byte:60 assert_byte:63
|
||||
Calls in [assert_byte] to print_str:69 print_str:71 print_str:74 print_ln:76 print_str:80
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 15 initial phi equivalence classes
|
||||
Coalesced [24] print_str::str#13 ← print_str::str#5
|
||||
Not coalescing [25] print_char_cursor#86 ← print_line_cursor#1
|
||||
@ -1917,14 +1058,6 @@ Adding NOP phi() at start of assert_byte::@5
|
||||
Adding NOP phi() at start of assert_byte::@3
|
||||
Adding NOP phi() at start of assert_byte::@2
|
||||
Adding NOP phi() at start of print_cls
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,49 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/double-assignment.kc
|
||||
// Test that a double-assignment works.
|
||||
|
||||
void main() {
|
||||
byte a;
|
||||
byte b;
|
||||
byte* screen = $400;
|
||||
a = b = 12;
|
||||
screen[0] = a;
|
||||
screen[1] = b;
|
||||
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
(byte) main::a
|
||||
(byte) main::b
|
||||
(byte*) main::screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword 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/dword/signed dword) 1024
|
||||
(byte) main::b ← (byte/signed byte/word/signed word/dword/signed dword) 12
|
||||
(byte) main::a ← (byte) main::b
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) main::a
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::b
|
||||
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
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -94,13 +50,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,47 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/double-import.kc
|
||||
import "imported"
|
||||
import "imported"
|
||||
|
||||
void main() {
|
||||
*BGCOL = RED;
|
||||
}
|
||||
Importing imported
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/imported.kc
|
||||
const byte *BGCOL = $d021;
|
||||
const byte RED = 2;
|
||||
|
||||
Importing imported
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte) RED
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53281
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
*((byte*) BGCOL) ← (byte) RED
|
||||
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
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte) RED#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
@ -82,13 +40,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,67 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/dword.kc
|
||||
|
||||
|
||||
void main() {
|
||||
dword a = 4000000000;
|
||||
for( byte i: 0..100) {
|
||||
dword b = a + i;
|
||||
byte c = (byte) b;
|
||||
const byte* SCREEN = $400;
|
||||
SCREEN[i] = c;
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(dword~) main::$0
|
||||
(byte~) main::$1
|
||||
(bool~) main::$2
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte*) main::SCREEN
|
||||
(dword) main::a
|
||||
(dword) main::b
|
||||
(byte) main::c
|
||||
(byte) main::i
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(dword) main::a ← (dword) 4000000000
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(dword~) main::$0 ← (dword) main::a + (byte) main::i
|
||||
(dword) main::b ← (dword~) main::$0
|
||||
(byte~) main::$1 ← ((byte)) (dword) main::b
|
||||
(byte) main::c ← (byte~) main::$1
|
||||
(byte*) main::SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
*((byte*) main::SCREEN + (byte) main::i) ← (byte) main::c
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,100)
|
||||
(bool~) main::$2 ← (byte) main::i != rangelast(0,100)
|
||||
if((bool~) main::$2) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -144,9 +82,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [12] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -155,9 +90,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,186 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/emptyblock-error.kc
|
||||
// Error cleaning up unused blocks
|
||||
|
||||
|
||||
void main() {
|
||||
while(true) {
|
||||
menu();
|
||||
}
|
||||
}
|
||||
|
||||
void menu() {
|
||||
while(true) {
|
||||
mode();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
byte a = 0;
|
||||
byte *B = $1000;
|
||||
|
||||
void mode() {
|
||||
while(true) {
|
||||
if(*B == 0) {
|
||||
a = *B;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) B
|
||||
(byte) a
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@return
|
||||
(void()) menu()
|
||||
(void~) menu::$0
|
||||
(label) menu::@1
|
||||
(label) menu::@2
|
||||
(label) menu::@3
|
||||
(label) menu::@4
|
||||
(label) menu::@5
|
||||
(label) menu::@6
|
||||
(label) menu::@7
|
||||
(label) menu::@return
|
||||
(void()) mode()
|
||||
(bool~) mode::$0
|
||||
(bool~) mode::$1
|
||||
(label) mode::@1
|
||||
(label) mode::@2
|
||||
(label) mode::@3
|
||||
(label) mode::@4
|
||||
(label) mode::@5
|
||||
(label) mode::@6
|
||||
(label) mode::@7
|
||||
(label) mode::@8
|
||||
(label) mode::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in B ← ((byte*)) 4096
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
if(true) goto main::@2
|
||||
to:main::@4
|
||||
main::@2: scope:[main] from main::@1 main::@5
|
||||
(void~) main::$0 ← call menu
|
||||
to:main::@1
|
||||
main::@4: scope:[main] from main::@1
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@4 main::@6
|
||||
to:main::@return
|
||||
main::@5: scope:[main] from
|
||||
to:main::@2
|
||||
main::@6: scope:[main] from
|
||||
to:main::@3
|
||||
main::@return: scope:[main] from main::@3
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
menu: scope:[menu] from
|
||||
to:menu::@1
|
||||
menu::@1: scope:[menu] from menu menu::@6
|
||||
if(true) goto menu::@2
|
||||
to:menu::@4
|
||||
menu::@2: scope:[menu] from menu::@1 menu::@5
|
||||
(void~) menu::$0 ← call mode
|
||||
to:menu::@return
|
||||
menu::@4: scope:[menu] from menu::@1
|
||||
to:menu::@3
|
||||
menu::@3: scope:[menu] from menu::@4 menu::@7
|
||||
to:menu::@return
|
||||
menu::@5: scope:[menu] from
|
||||
to:menu::@2
|
||||
menu::@return: scope:[menu] from menu::@2 menu::@3
|
||||
return
|
||||
to:@return
|
||||
menu::@6: scope:[menu] from
|
||||
to:menu::@1
|
||||
menu::@7: scope:[menu] from
|
||||
to:menu::@3
|
||||
@2: scope:[] from @1
|
||||
(byte) a ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte*) B ← ((byte*)) (word/signed word/dword/signed dword) 4096
|
||||
to:@3
|
||||
mode: scope:[mode] from
|
||||
to:mode::@1
|
||||
mode::@1: scope:[mode] from mode mode::@4
|
||||
if(true) goto mode::@2
|
||||
to:mode::@5
|
||||
mode::@2: scope:[mode] from mode::@1 mode::@6
|
||||
(bool~) mode::$0 ← *((byte*) B) == (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) mode::$1 ← ! (bool~) mode::$0
|
||||
if((bool~) mode::$1) goto mode::@4
|
||||
to:mode::@7
|
||||
mode::@5: scope:[mode] from mode::@1
|
||||
to:mode::@3
|
||||
mode::@3: scope:[mode] from mode::@5 mode::@8
|
||||
to:mode::@return
|
||||
mode::@6: scope:[mode] from
|
||||
to:mode::@2
|
||||
mode::@4: scope:[mode] from mode::@2 mode::@7
|
||||
to:mode::@1
|
||||
mode::@7: scope:[mode] from mode::@2
|
||||
(byte) a ← *((byte*) B)
|
||||
to:mode::@4
|
||||
mode::@8: scope:[mode] from
|
||||
to:mode::@3
|
||||
mode::@return: scope:[mode] from mode::@3
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @3
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) menu::$0
|
||||
Eliminating unused variable (byte) a and assignment [6] (byte) a ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
Eliminating unused variable a(null) and assignment [12] a(null) ← *((byte*) B)
|
||||
Removing empty block main::@4
|
||||
Removing empty block main::@3
|
||||
Removing empty block main::@5
|
||||
Removing empty block main::@6
|
||||
Removing empty block @1
|
||||
Removing empty block menu::@4
|
||||
Removing empty block menu::@3
|
||||
Removing empty block menu::@5
|
||||
Removing empty block menu::@6
|
||||
Removing empty block menu::@7
|
||||
Removing empty block mode::@5
|
||||
Removing empty block mode::@3
|
||||
Removing empty block mode::@6
|
||||
Removing empty block mode::@7
|
||||
Removing empty block mode::@8
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@2
|
||||
main: scope:[main] from @3
|
||||
@ -335,7 +154,6 @@ Calls in [] to main:2
|
||||
Calls in [main] to menu:6
|
||||
Calls in [menu] to mode:9
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
@ -347,7 +165,6 @@ Adding NOP phi() at start of menu
|
||||
Adding NOP phi() at start of menu::@2
|
||||
Adding NOP phi() at start of mode
|
||||
Adding NOP phi() at start of mode::@4
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,65 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/fibmem.kc
|
||||
byte[15] fibs = $1100;
|
||||
|
||||
void main() {
|
||||
fibs[0] = 0;
|
||||
fibs[1] = 1;
|
||||
byte i = 0;
|
||||
do {
|
||||
fibs[i+2] = fibs[i]+fibs[i+1];
|
||||
} while(++i<15);
|
||||
}
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte[15]) fibs
|
||||
(void()) main()
|
||||
(byte/signed word/word/dword/signed dword~) main::$0
|
||||
(byte/signed word/word/dword/signed dword~) main::$1
|
||||
(byte~) main::$2
|
||||
(bool~) main::$3
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte[15] in fibs ← ((byte*)) 4352
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[15]) fibs ← ((byte*)) (word/signed word/dword/signed dword) 4352
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
*((byte[15]) fibs + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
*((byte[15]) fibs + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte/signed word/word/dword/signed dword~) main::$0 ← (byte) main::i + (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte/signed word/word/dword/signed dword~) main::$1 ← (byte) main::i + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte~) main::$2 ← *((byte[15]) fibs + (byte) main::i) + *((byte[15]) fibs + (byte/signed word/word/dword/signed dword~) main::$1)
|
||||
*((byte[15]) fibs + (byte/signed word/word/dword/signed dword~) main::$0) ← (byte~) main::$2
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(bool~) main::$3 ← (byte) main::i < (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
if((bool~) main::$3) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte[15]) fibs#0 ← ((byte*)) (word/signed word/dword/signed dword) 4352
|
||||
to:@1
|
||||
@ -134,8 +74,6 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [12] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -143,8 +81,6 @@ Culled Empty Block (label) main::@3
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,99 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/fillscreen.kc
|
||||
byte *SCREEN = $0400;
|
||||
|
||||
void main() {
|
||||
byte c = (*SCREEN);
|
||||
fillscreen(c);
|
||||
}
|
||||
|
||||
void fillscreen(byte c) {
|
||||
for(byte j : 0..255) {
|
||||
byte* SCREEN2 = SCREEN+$100;
|
||||
byte* SCREEN3 = SCREEN+$200;
|
||||
byte* SCREEN4 = SCREEN+$3e8;
|
||||
SCREEN[j] = c;
|
||||
SCREEN2[j] = c;
|
||||
SCREEN3[j] = c;
|
||||
SCREEN4[j] = c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(void()) fillscreen((byte) fillscreen::c)
|
||||
(byte*~) fillscreen::$0
|
||||
(byte*~) fillscreen::$1
|
||||
(byte*~) fillscreen::$2
|
||||
(bool~) fillscreen::$3
|
||||
(label) fillscreen::@1
|
||||
(label) fillscreen::@2
|
||||
(label) fillscreen::@return
|
||||
(byte*) fillscreen::SCREEN2
|
||||
(byte*) fillscreen::SCREEN3
|
||||
(byte*) fillscreen::SCREEN4
|
||||
(byte) fillscreen::c
|
||||
(byte) fillscreen::j
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(label) main::@return
|
||||
(byte) main::c
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::c ← *((byte*) SCREEN)
|
||||
(void~) main::$0 ← call fillscreen (byte) main::c
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
fillscreen: scope:[fillscreen] from
|
||||
(byte) fillscreen::j ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:fillscreen::@1
|
||||
fillscreen::@1: scope:[fillscreen] from fillscreen fillscreen::@1
|
||||
(byte*~) fillscreen::$0 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 256
|
||||
(byte*) fillscreen::SCREEN2 ← (byte*~) fillscreen::$0
|
||||
(byte*~) fillscreen::$1 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 512
|
||||
(byte*) fillscreen::SCREEN3 ← (byte*~) fillscreen::$1
|
||||
(byte*~) fillscreen::$2 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 1000
|
||||
(byte*) fillscreen::SCREEN4 ← (byte*~) fillscreen::$2
|
||||
*((byte*) SCREEN + (byte) fillscreen::j) ← (byte) fillscreen::c
|
||||
*((byte*) fillscreen::SCREEN2 + (byte) fillscreen::j) ← (byte) fillscreen::c
|
||||
*((byte*) fillscreen::SCREEN3 + (byte) fillscreen::j) ← (byte) fillscreen::c
|
||||
*((byte*) fillscreen::SCREEN4 + (byte) fillscreen::j) ← (byte) fillscreen::c
|
||||
(byte) fillscreen::j ← (byte) fillscreen::j + rangenext(0,255)
|
||||
(bool~) fillscreen::$3 ← (byte) fillscreen::j != rangelast(0,255)
|
||||
if((bool~) fillscreen::$3) goto fillscreen::@1
|
||||
to:fillscreen::@2
|
||||
fillscreen::@2: scope:[fillscreen] from fillscreen::@1
|
||||
to:fillscreen::@return
|
||||
fillscreen::@return: scope:[fillscreen] from fillscreen::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Removing empty block @1
|
||||
Removing empty block fillscreen::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@2
|
||||
@ -220,11 +126,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to fillscreen:6
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [17] fillscreen::j#3 ← fillscreen::j#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -233,10 +134,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of fillscreen
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,290 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/flipper-rex2.kc
|
||||
byte[16*16] buffer1;
|
||||
byte[16*16] buffer2;
|
||||
byte *RASTER = $d012;
|
||||
byte* SCREEN = $0400;
|
||||
|
||||
void main() {
|
||||
prepare();
|
||||
do {
|
||||
for( byte c : 25..1) {
|
||||
do { } while(*RASTER!=254);
|
||||
do { } while(*RASTER!=255);
|
||||
}
|
||||
flip();
|
||||
plot();
|
||||
} while(true);
|
||||
}
|
||||
|
||||
// Prepare buffer
|
||||
void prepare() {
|
||||
for( byte i : 0..255) {
|
||||
buffer1[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
// Flip buffer
|
||||
void flip() {
|
||||
byte srcIdx = 0;
|
||||
byte dstIdx = 15;
|
||||
for( byte r : 16..1) {
|
||||
for( byte c : 16..1) {
|
||||
buffer2[dstIdx] = buffer1[srcIdx++];
|
||||
dstIdx = dstIdx+16;
|
||||
}
|
||||
dstIdx--;
|
||||
}
|
||||
for(byte i : 0..255) {
|
||||
buffer1[i] = buffer2[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Plot buffer on screen
|
||||
void plot() {
|
||||
byte* line = SCREEN+5*40+12;
|
||||
byte i=0;
|
||||
for(byte y : 16..1) {
|
||||
for(byte x=0; x<16; x++ ) {
|
||||
line[x] = buffer1[i++];
|
||||
}
|
||||
line = line+40;
|
||||
}
|
||||
}
|
||||
Adding pre/post-modifier (byte) flip::srcIdx ← ++ (byte) flip::srcIdx
|
||||
Adding pre/post-modifier (byte) flip::dstIdx ← -- (byte) flip::dstIdx
|
||||
Adding pre/post-modifier (byte) plot::i ← ++ (byte) plot::i
|
||||
Adding pre/post-modifier (byte) plot::x ← ++ (byte) plot::x
|
||||
SYMBOLS
|
||||
(word/signed word/dword/signed dword~) $0
|
||||
(word/signed word/dword/signed dword~) $1
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) RASTER
|
||||
(byte*) SCREEN
|
||||
(byte[$0]) buffer1
|
||||
(byte[$1]) buffer2
|
||||
(void()) flip()
|
||||
(byte/signed word/word/dword/signed dword~) flip::$0
|
||||
(bool~) flip::$1
|
||||
(bool~) flip::$2
|
||||
(bool~) flip::$3
|
||||
(label) flip::@1
|
||||
(label) flip::@2
|
||||
(label) flip::@3
|
||||
(label) flip::@4
|
||||
(label) flip::@5
|
||||
(label) flip::@6
|
||||
(label) flip::@return
|
||||
(byte) flip::c
|
||||
(byte) flip::dstIdx
|
||||
(byte) flip::i
|
||||
(byte) flip::r
|
||||
(byte) flip::srcIdx
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(bool~) main::$1
|
||||
(bool~) main::$2
|
||||
(bool~) main::$3
|
||||
(void~) main::$4
|
||||
(void~) main::$5
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@7
|
||||
(label) main::@8
|
||||
(label) main::@return
|
||||
(byte) main::c
|
||||
(void()) plot()
|
||||
(byte/word/signed word/dword/signed dword~) plot::$0
|
||||
(byte*~) plot::$1
|
||||
(byte*~) plot::$2
|
||||
(bool~) plot::$3
|
||||
(byte*~) plot::$4
|
||||
(bool~) plot::$5
|
||||
(label) plot::@1
|
||||
(label) plot::@2
|
||||
(label) plot::@3
|
||||
(label) plot::@4
|
||||
(label) plot::@return
|
||||
(byte) plot::i
|
||||
(byte*) plot::line
|
||||
(byte) plot::x
|
||||
(byte) plot::y
|
||||
(void()) prepare()
|
||||
(bool~) prepare::$0
|
||||
(label) prepare::@1
|
||||
(label) prepare::@2
|
||||
(label) prepare::@return
|
||||
(byte) prepare::i
|
||||
|
||||
Promoting word/dword/signed dword to byte* in RASTER ← ((byte*)) 53266
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 16 * (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
(byte[$0]) buffer1 ← { fill( $0, 0) }
|
||||
(word/signed word/dword/signed dword~) $1 ← (byte/signed byte/word/signed word/dword/signed dword) 16 * (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
(byte[$1]) buffer2 ← { fill( $1, 0) }
|
||||
(byte*) RASTER ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call prepare
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@7
|
||||
(byte) main::c ← (byte/signed byte/word/signed word/dword/signed dword) 25
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1 main::@6
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2 main::@3
|
||||
(bool~) main::$1 ← *((byte*) RASTER) != (byte/word/signed word/dword/signed dword) 254
|
||||
if((bool~) main::$1) goto main::@3
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@3
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@4 main::@5
|
||||
(bool~) main::$2 ← *((byte*) RASTER) != (byte/word/signed word/dword/signed dword) 255
|
||||
if((bool~) main::$2) goto main::@4
|
||||
to:main::@6
|
||||
main::@6: scope:[main] from main::@4
|
||||
(byte) main::c ← (byte) main::c + rangenext(25,1)
|
||||
(bool~) main::$3 ← (byte) main::c != rangelast(25,1)
|
||||
if((bool~) main::$3) goto main::@2
|
||||
to:main::@7
|
||||
main::@7: scope:[main] from main::@6
|
||||
(void~) main::$4 ← call flip
|
||||
(void~) main::$5 ← call plot
|
||||
if(true) goto main::@1
|
||||
to:main::@8
|
||||
main::@8: scope:[main] from main::@7
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@8
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
prepare: scope:[prepare] from
|
||||
(byte) prepare::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:prepare::@1
|
||||
prepare::@1: scope:[prepare] from prepare prepare::@1
|
||||
*((byte[$0]) buffer1 + (byte) prepare::i) ← (byte) prepare::i
|
||||
(byte) prepare::i ← (byte) prepare::i + rangenext(0,255)
|
||||
(bool~) prepare::$0 ← (byte) prepare::i != rangelast(0,255)
|
||||
if((bool~) prepare::$0) goto prepare::@1
|
||||
to:prepare::@2
|
||||
prepare::@2: scope:[prepare] from prepare::@1
|
||||
to:prepare::@return
|
||||
prepare::@return: scope:[prepare] from prepare::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
flip: scope:[flip] from
|
||||
(byte) flip::srcIdx ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) flip::dstIdx ← (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
(byte) flip::r ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
to:flip::@1
|
||||
flip::@1: scope:[flip] from flip flip::@4
|
||||
(byte) flip::c ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
to:flip::@2
|
||||
flip::@2: scope:[flip] from flip::@1 flip::@2
|
||||
*((byte[$1]) buffer2 + (byte) flip::dstIdx) ← *((byte[$0]) buffer1 + (byte) flip::srcIdx)
|
||||
(byte) flip::srcIdx ← ++ (byte) flip::srcIdx
|
||||
(byte/signed word/word/dword/signed dword~) flip::$0 ← (byte) flip::dstIdx + (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
(byte) flip::dstIdx ← (byte/signed word/word/dword/signed dword~) flip::$0
|
||||
(byte) flip::c ← (byte) flip::c + rangenext(16,1)
|
||||
(bool~) flip::$1 ← (byte) flip::c != rangelast(16,1)
|
||||
if((bool~) flip::$1) goto flip::@2
|
||||
to:flip::@4
|
||||
flip::@4: scope:[flip] from flip::@2
|
||||
(byte) flip::dstIdx ← -- (byte) flip::dstIdx
|
||||
(byte) flip::r ← (byte) flip::r + rangenext(16,1)
|
||||
(bool~) flip::$2 ← (byte) flip::r != rangelast(16,1)
|
||||
if((bool~) flip::$2) goto flip::@1
|
||||
to:flip::@5
|
||||
flip::@5: scope:[flip] from flip::@4
|
||||
(byte) flip::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:flip::@3
|
||||
flip::@3: scope:[flip] from flip::@3 flip::@5
|
||||
*((byte[$0]) buffer1 + (byte) flip::i) ← *((byte[$1]) buffer2 + (byte) flip::i)
|
||||
(byte) flip::i ← (byte) flip::i + rangenext(0,255)
|
||||
(bool~) flip::$3 ← (byte) flip::i != rangelast(0,255)
|
||||
if((bool~) flip::$3) goto flip::@3
|
||||
to:flip::@6
|
||||
flip::@6: scope:[flip] from flip::@3
|
||||
to:flip::@return
|
||||
flip::@return: scope:[flip] from flip::@6
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
plot: scope:[plot] from
|
||||
(byte/word/signed word/dword/signed dword~) plot::$0 ← (byte/signed byte/word/signed word/dword/signed dword) 5 * (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*~) plot::$1 ← (byte*) SCREEN + (byte/word/signed word/dword/signed dword~) plot::$0
|
||||
(byte*~) plot::$2 ← (byte*~) plot::$1 + (byte/signed byte/word/signed word/dword/signed dword) 12
|
||||
(byte*) plot::line ← (byte*~) plot::$2
|
||||
(byte) plot::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) plot::y ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
to:plot::@1
|
||||
plot::@1: scope:[plot] from plot plot::@3
|
||||
(byte) plot::x ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:plot::@2
|
||||
plot::@2: scope:[plot] from plot::@1 plot::@2
|
||||
*((byte*) plot::line + (byte) plot::x) ← *((byte[$0]) buffer1 + (byte) plot::i)
|
||||
(byte) plot::i ← ++ (byte) plot::i
|
||||
(byte) plot::x ← ++ (byte) plot::x
|
||||
(bool~) plot::$3 ← (byte) plot::x < (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
if((bool~) plot::$3) goto plot::@2
|
||||
to:plot::@3
|
||||
plot::@3: scope:[plot] from plot::@2
|
||||
(byte*~) plot::$4 ← (byte*) plot::line + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*) plot::line ← (byte*~) plot::$4
|
||||
(byte) plot::y ← (byte) plot::y + rangenext(16,1)
|
||||
(bool~) plot::$5 ← (byte) plot::y != rangelast(16,1)
|
||||
if((bool~) plot::$5) goto plot::@1
|
||||
to:plot::@4
|
||||
plot::@4: scope:[plot] from plot::@3
|
||||
to:plot::@return
|
||||
plot::@return: scope:[plot] from plot::@4
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @4
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$4
|
||||
Eliminating unused variable - keeping the call (void~) main::$5
|
||||
Removing empty block main::@5
|
||||
Removing empty block main::@8
|
||||
Removing empty block @1
|
||||
Removing empty block prepare::@2
|
||||
Removing empty block @2
|
||||
Removing empty block flip::@6
|
||||
Removing empty block @3
|
||||
Removing empty block plot::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 16 * (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
(byte[$0]) buffer1#0 ← { fill( $0, 0) }
|
||||
@ -695,8 +410,6 @@ Successful SSA optimization Pass2SelfPhiElimination
|
||||
Redundant Phi (byte*) RASTER#1 (byte*) RASTER#3
|
||||
Redundant Phi (byte*) SCREEN#6 (byte*) SCREEN#7
|
||||
Successful SSA optimization Pass2RedundantPhiElimination
|
||||
Not aliassing identity: RASTER#3 RASTER#3
|
||||
Not aliassing identity: SCREEN#7 SCREEN#7
|
||||
Self Phi Eliminated (byte*) RASTER#3
|
||||
Self Phi Eliminated (byte*) SCREEN#7
|
||||
Successful SSA optimization Pass2SelfPhiElimination
|
||||
@ -756,17 +469,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to prepare:5 flip:12 plot:14
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 14 initial phi equivalence classes
|
||||
Coalesced [15] main::c#6 ← main::c#1
|
||||
Coalesced [18] plot::i#6 ← plot::i#3
|
||||
@ -802,15 +504,6 @@ Adding NOP phi() at start of main::@10
|
||||
Adding NOP phi() at start of plot
|
||||
Adding NOP phi() at start of flip
|
||||
Adding NOP phi() at start of prepare
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,62 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/forclassicmin.kc
|
||||
|
||||
// Minimal classic for() loop
|
||||
|
||||
byte* SCREEN = (byte*)$0400;
|
||||
|
||||
void main() {
|
||||
for(byte i=0; i!=100; i++) {
|
||||
SCREEN[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
SYMBOLS
|
||||
(byte*~) $0
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*~) $0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) SCREEN ← (byte*~) $0
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte) main::i
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(bool~) main::$0 ← (byte) main::i != (byte/signed byte/word/signed word/dword/signed dword) 100
|
||||
if((bool~) main::$0) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*~) $0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) SCREEN#0 ← (byte*~) $0
|
||||
@ -129,8 +72,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [10] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -139,8 +80,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,59 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/forincrementassign.kc
|
||||
// Classic for() does not allow assignment as increment, eg. for(byte i=0;i<40;i=i+2) {}
|
||||
// The following should give a program rendering a char on every second char of the first line - but results in a syntax error
|
||||
|
||||
byte* SCREEN = $0400;
|
||||
void main() {
|
||||
for(byte i=0;i<40;i=i+2) {
|
||||
SCREEN[i] = i;
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(void()) main()
|
||||
(byte/signed word/word/dword/signed dword~) main::$0
|
||||
(bool~) main::$1
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte) main::i
|
||||
(byte/signed word/word/dword/signed dword~) main::$0 ← (byte) main::i + (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) main::i ← (byte/signed word/word/dword/signed dword~) main::$0
|
||||
(bool~) main::$1 ← (byte) main::i < (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
if((bool~) main::$1) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
@ -127,8 +73,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [10] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -137,8 +81,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,84 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/forrangedwords.kc
|
||||
|
||||
void main() {
|
||||
byte* SCREEN = $0400;
|
||||
for( word w: 0..$ffff) {
|
||||
SCREEN[0] = <w;
|
||||
SCREEN[1] = >w;
|
||||
}
|
||||
for( signed word sw: -$7fff..$7ffe) {
|
||||
SCREEN[3] = <sw;
|
||||
SCREEN[4] = >sw;
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(byte~) main::$1
|
||||
(bool~) main::$2
|
||||
(signed word/signed dword~) main::$3
|
||||
(byte~) main::$4
|
||||
(byte~) main::$5
|
||||
(bool~) main::$6
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte*) main::SCREEN
|
||||
(signed word) main::sw
|
||||
(word) main::w
|
||||
|
||||
Promoting word/signed word/dword/signed dword 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/dword/signed dword) 1024
|
||||
(word) main::w ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte~) main::$0 ← < (word) main::w
|
||||
*((byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte~) main::$0
|
||||
(byte~) main::$1 ← > (word) main::w
|
||||
*((byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$1
|
||||
(word) main::w ← (word) main::w + rangenext(0,65535)
|
||||
(bool~) main::$2 ← (word) main::w != rangelast(0,65535)
|
||||
if((bool~) main::$2) goto main::@1
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@1
|
||||
(signed word/signed dword~) main::$3 ← - (word/signed word/dword/signed dword) 32767
|
||||
(signed word) main::sw ← (signed word/signed dword~) main::$3
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@2 main::@3
|
||||
(byte~) main::$4 ← < (signed word) main::sw
|
||||
*((byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte~) main::$4
|
||||
(byte~) main::$5 ← > (signed word) main::sw
|
||||
*((byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte~) main::$5
|
||||
(signed word) main::sw ← (signed word) main::sw + rangenext(main::$3,32766)
|
||||
(bool~) main::$6 ← (signed word) main::sw != rangelast(main::$3,32766)
|
||||
if((bool~) main::$6) goto main::@2
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -155,11 +76,9 @@ SYMBOL TABLE SSA
|
||||
|
||||
Culled Empty Block (label) @2
|
||||
Successful SSA optimization Pass2CullEmptyBlocks
|
||||
Not aliassing identity: main::SCREEN#2 main::SCREEN#2
|
||||
Alias (byte*) main::SCREEN#1 = (byte*) main::SCREEN#3
|
||||
Alias (signed word) main::sw#0 = (signed word/signed dword~) main::$3
|
||||
Successful SSA optimization Pass2AliasElimination
|
||||
Not aliassing identity: main::SCREEN#2 main::SCREEN#2
|
||||
Self Phi Eliminated (byte*) main::SCREEN#1
|
||||
Self Phi Eliminated (byte*) main::SCREEN#2
|
||||
Successful SSA optimization Pass2SelfPhiElimination
|
||||
@ -199,9 +118,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 2 initial phi equivalence classes
|
||||
Coalesced [20] main::sw#3 ← main::sw#1
|
||||
Coalesced [21] main::w#3 ← main::w#1
|
||||
@ -212,9 +128,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,82 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/forrangemin.kc
|
||||
|
||||
// Minimal range based for() loop
|
||||
|
||||
byte* SCREEN1 = $0400;
|
||||
byte* SCREEN2 = $0500;
|
||||
|
||||
void main() {
|
||||
for(byte i : 0..255) {
|
||||
SCREEN1[i] = i;
|
||||
}
|
||||
byte j;
|
||||
for(j : 100..0) {
|
||||
SCREEN2[j] = j;
|
||||
}
|
||||
}
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN1
|
||||
(byte*) SCREEN2
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(bool~) main::$1
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(byte) main::j
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN1 ← ((byte*)) 1024
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN2 ← ((byte*)) 1280
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN1 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) SCREEN2 ← ((byte*)) (word/signed word/dword/signed dword) 1280
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) SCREEN1 + (byte) main::i) ← (byte) main::i
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,255)
|
||||
(bool~) main::$0 ← (byte) main::i != rangelast(0,255)
|
||||
if((bool~) main::$0) goto main::@1
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@1
|
||||
(byte) main::j ← (byte/signed byte/word/signed word/dword/signed dword) 100
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@2 main::@3
|
||||
*((byte*) SCREEN2 + (byte) main::j) ← (byte) main::j
|
||||
(byte) main::j ← (byte) main::j + rangenext(100,0)
|
||||
(bool~) main::$1 ← (byte) main::j != rangelast(100,0)
|
||||
if((bool~) main::$1) goto main::@2
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN1#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) SCREEN2#0 ← ((byte*)) (word/signed word/dword/signed dword) 1280
|
||||
@ -154,12 +77,10 @@ SYMBOL TABLE SSA
|
||||
|
||||
Culled Empty Block (label) @2
|
||||
Successful SSA optimization Pass2CullEmptyBlocks
|
||||
Not aliassing identity: SCREEN2#1 SCREEN2#1
|
||||
Alias (byte*) SCREEN2#2 = (byte*) SCREEN2#3
|
||||
Alias (byte*) SCREEN1#0 = (byte*) SCREEN1#3
|
||||
Alias (byte*) SCREEN2#0 = (byte*) SCREEN2#5
|
||||
Successful SSA optimization Pass2AliasElimination
|
||||
Not aliassing identity: SCREEN2#1 SCREEN2#1
|
||||
Self Phi Eliminated (byte*) SCREEN1#1
|
||||
Self Phi Eliminated (byte*) SCREEN2#2
|
||||
Self Phi Eliminated (byte*) SCREEN2#1
|
||||
@ -198,8 +119,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 2 initial phi equivalence classes
|
||||
Coalesced [14] main::j#3 ← main::j#1
|
||||
Coalesced [15] main::i#3 ← main::i#1
|
||||
@ -210,8 +129,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,57 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/forrangesymbolic.kc
|
||||
// Range-based for does not recognize symbolic constants.
|
||||
// The following should work but gives a not-constant exception
|
||||
|
||||
void main() {
|
||||
const byte* BITMAP = $2000;
|
||||
for(byte* b : BITMAP+$1fff..BITMAP) {
|
||||
*b = $5a;
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte*~) main::$0
|
||||
(bool~) main::$1
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte*) main::BITMAP
|
||||
(byte*) main::b
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::BITMAP ← ((byte*)) 8192
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::BITMAP ← ((byte*)) (word/signed word/dword/signed dword) 8192
|
||||
(byte*~) main::$0 ← (byte*) main::BITMAP + (word/signed word/dword/signed dword) 8191
|
||||
(byte*) main::b ← (byte*~) main::$0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) main::b) ← (byte/signed byte/word/signed word/dword/signed dword) 90
|
||||
(byte*) main::b ← (byte*) main::b + rangenext(main::$0,main::BITMAP)
|
||||
(bool~) main::$1 ← (byte*) main::b != rangelast(main::$0,main::BITMAP)
|
||||
if((bool~) main::$1) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -116,8 +64,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [10] main::b#3 ← main::b#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -126,8 +72,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,99 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/fragment-synth.kc
|
||||
// Tests a sub-optimal fragment synthesis
|
||||
// vbuaa=vbuxx_band_pbuz1_derefidx_vbuc1 < vbuaa=pbuz1_derefidx_vbuc1_band_vbuxx < vbuaa=pbuz1_derefidx_vbuaa_band_vbuxx < vbuaa=pbuz1_derefidx_vbuyy_band_vbuxx < vbuaa=pbuz1_derefidx_vbuyy_band_vbuaa < vbuaa=vbuaa_band_pbuz1_derefidx_vbuyy - clobber:A Y cycles:11.5
|
||||
|
||||
|
||||
void main() {
|
||||
byte* screen = $400;
|
||||
byte* z = $450;
|
||||
z[2] = $f0;
|
||||
z[3] = $0f;
|
||||
byte x = $aa;
|
||||
byte a1 = fct(x, z);
|
||||
screen[0] = a1;
|
||||
z++;
|
||||
x = $55;
|
||||
byte a2 = fct(x, z);
|
||||
screen[1] = a2;
|
||||
}
|
||||
|
||||
byte fct(byte register(X) x, byte* z) {
|
||||
byte register(A) a = x & z[2];
|
||||
return a;
|
||||
}
|
||||
|
||||
Adding pre/post-modifier (byte*) main::z ← ++ (byte*) main::z
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte()) fct((byte) fct::x , (byte*) fct::z)
|
||||
(byte~) fct::$0
|
||||
(label) fct::@1
|
||||
(label) fct::@return
|
||||
(byte) fct::a !reg byte a
|
||||
(byte) fct::return
|
||||
(byte) fct::x !reg byte x
|
||||
(byte*) fct::z
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(byte~) main::$1
|
||||
(label) main::@return
|
||||
(byte) main::a1
|
||||
(byte) main::a2
|
||||
(byte*) main::screen
|
||||
(byte) main::x
|
||||
(byte*) main::z
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::screen ← ((byte*)) 1024
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::z ← ((byte*)) 1104
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) main::z ← ((byte*)) (word/signed word/dword/signed dword) 1104
|
||||
*((byte*) main::z + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte/word/signed word/dword/signed dword) 240
|
||||
*((byte*) main::z + (byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
(byte) main::x ← (byte/word/signed word/dword/signed dword) 170
|
||||
(byte~) main::$0 ← call fct (byte) main::x (byte*) main::z
|
||||
(byte) main::a1 ← (byte~) main::$0
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) main::a1
|
||||
(byte*) main::z ← ++ (byte*) main::z
|
||||
(byte) main::x ← (byte/signed byte/word/signed word/dword/signed dword) 85
|
||||
(byte~) main::$1 ← call fct (byte) main::x (byte*) main::z
|
||||
(byte) main::a2 ← (byte~) main::$1
|
||||
*((byte*) main::screen + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::a2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
fct: scope:[fct] from
|
||||
(byte~) fct::$0 ← (byte) fct::x & *((byte*) fct::z + (byte/signed byte/word/signed word/dword/signed dword) 2)
|
||||
(byte) fct::a ← (byte~) fct::$0
|
||||
(byte) fct::return ← (byte) fct::a
|
||||
to:fct::@return
|
||||
fct::@return: scope:[fct] from fct fct::@1
|
||||
(byte) fct::return ← (byte) fct::return
|
||||
return (byte) fct::return
|
||||
to:@return
|
||||
fct::@1: scope:[fct] from
|
||||
to:fct::@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Removing empty block @1
|
||||
Removing empty block fct::@1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@2
|
||||
main: scope:[main] from @2
|
||||
@ -250,17 +156,11 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to fct:6 fct:10
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 2 initial phi equivalence classes
|
||||
Coalesced down to 2 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,260 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/halfscii.kc
|
||||
byte* SCREEN = $0400;
|
||||
byte* CHARSET = $2000;
|
||||
byte* CHARGEN = $D000;
|
||||
byte* PROCPORT = $01;
|
||||
byte* D018 = $d018;
|
||||
byte* CHARSET4 = $2800;
|
||||
|
||||
byte[] bits_count = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
*PROCPORT = $32;
|
||||
byte* chargen = CHARGEN;
|
||||
byte* charset4 = CHARSET4;
|
||||
do {
|
||||
byte bits_gen = 0;
|
||||
byte* chargen1 = chargen+1;
|
||||
byte bits = bits_count[((*chargen & %01100000) | (*chargen1 & %01100000)>>2)>>1>>2];
|
||||
if(bits>=2) { bits_gen = bits_gen + 1; }
|
||||
bits_gen = bits_gen<<1;
|
||||
bits = bits_count[((*chargen & %00011000) | (*chargen1 & %00011000)>>2)>>1];
|
||||
if(bits>=2) { bits_gen = bits_gen + 1; }
|
||||
bits_gen = bits_gen<<1;
|
||||
bits = bits_count[((*chargen & %00000110)<<1 | (*chargen1 & %00000110)>>1)];
|
||||
if(bits>=2) { bits_gen = bits_gen + 1; }
|
||||
bits_gen = bits_gen<<1;
|
||||
bits = bits_count[((*chargen & %00000001)<<2 | (*chargen1 & %00000001))];
|
||||
if(bits>=2) { bits_gen = bits_gen + 1; }
|
||||
bits_gen = bits_gen<<1;
|
||||
*charset4 = bits_gen;
|
||||
charset4++;
|
||||
chargen = chargen+2;
|
||||
} while (chargen<CHARGEN+$800);
|
||||
*PROCPORT = $37;
|
||||
asm { cli }
|
||||
for(byte i : 0..255) {
|
||||
SCREEN[i] = i;
|
||||
}
|
||||
*D018 = $19;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Adding pre/post-modifier (byte*) main::charset4 ← ++ (byte*) main::charset4
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) CHARGEN
|
||||
(byte*) CHARSET
|
||||
(byte*) CHARSET4
|
||||
(byte*) D018
|
||||
(byte*) PROCPORT
|
||||
(byte*) SCREEN
|
||||
(byte[]) bits_count
|
||||
(void()) main()
|
||||
(byte*~) main::$0
|
||||
(byte~) main::$1
|
||||
(byte~) main::$10
|
||||
(byte~) main::$11
|
||||
(byte~) main::$12
|
||||
(byte~) main::$13
|
||||
(byte~) main::$14
|
||||
(byte~) main::$15
|
||||
(bool~) main::$16
|
||||
(bool~) main::$17
|
||||
(byte/signed word/word/dword/signed dword~) main::$18
|
||||
(byte~) main::$19
|
||||
(byte~) main::$2
|
||||
(byte~) main::$20
|
||||
(byte~) main::$21
|
||||
(byte~) main::$22
|
||||
(byte~) main::$23
|
||||
(byte~) main::$24
|
||||
(bool~) main::$25
|
||||
(bool~) main::$26
|
||||
(byte/signed word/word/dword/signed dword~) main::$27
|
||||
(byte~) main::$28
|
||||
(byte~) main::$29
|
||||
(byte~) main::$3
|
||||
(byte~) main::$30
|
||||
(byte~) main::$31
|
||||
(byte~) main::$32
|
||||
(bool~) main::$33
|
||||
(bool~) main::$34
|
||||
(byte/signed word/word/dword/signed dword~) main::$35
|
||||
(byte~) main::$36
|
||||
(byte*~) main::$37
|
||||
(byte*~) main::$38
|
||||
(bool~) main::$39
|
||||
(byte~) main::$4
|
||||
(bool~) main::$40
|
||||
(byte~) main::$5
|
||||
(byte~) main::$6
|
||||
(bool~) main::$7
|
||||
(bool~) main::$8
|
||||
(byte/signed word/word/dword/signed dword~) main::$9
|
||||
(label) main::@1
|
||||
(label) main::@10
|
||||
(label) main::@11
|
||||
(label) main::@12
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@7
|
||||
(label) main::@8
|
||||
(label) main::@9
|
||||
(label) main::@return
|
||||
(byte) main::bits
|
||||
(byte) main::bits_gen
|
||||
(byte*) main::chargen
|
||||
(byte*) main::chargen1
|
||||
(byte*) main::charset4
|
||||
(byte) main::i
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
Promoting word/signed word/dword/signed dword to byte* in CHARSET ← ((byte*)) 8192
|
||||
Promoting word/dword/signed dword to byte* in CHARGEN ← ((byte*)) 53248
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in PROCPORT ← ((byte*)) 1
|
||||
Promoting word/dword/signed dword to byte* in D018 ← ((byte*)) 53272
|
||||
Promoting word/signed word/dword/signed dword to byte* in CHARSET4 ← ((byte*)) 10240
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) CHARSET ← ((byte*)) (word/signed word/dword/signed dword) 8192
|
||||
(byte*) CHARGEN ← ((byte*)) (word/dword/signed dword) 53248
|
||||
(byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte*) D018 ← ((byte*)) (word/dword/signed dword) 53272
|
||||
(byte*) CHARSET4 ← ((byte*)) (word/signed word/dword/signed dword) 10240
|
||||
(byte[]) bits_count ← { (byte/signed byte/word/signed word/dword/signed dword) 0, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 4 }
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
asm { sei }
|
||||
*((byte*) PROCPORT) ← (byte/signed byte/word/signed word/dword/signed dword) 50
|
||||
(byte*) main::chargen ← (byte*) CHARGEN
|
||||
(byte*) main::charset4 ← (byte*) CHARSET4
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@5
|
||||
(byte) main::bits_gen ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte*~) main::$0 ← (byte*) main::chargen + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte*) main::chargen1 ← (byte*~) main::$0
|
||||
(byte~) main::$1 ← *((byte*) main::chargen) & (byte/signed byte/word/signed word/dword/signed dword) 96
|
||||
(byte~) main::$2 ← *((byte*) main::chargen1) & (byte/signed byte/word/signed word/dword/signed dword) 96
|
||||
(byte~) main::$3 ← (byte~) main::$2 >> (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte~) main::$4 ← (byte~) main::$1 | (byte~) main::$3
|
||||
(byte~) main::$5 ← (byte~) main::$4 >> (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte~) main::$6 ← (byte~) main::$5 >> (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) main::bits ← *((byte[]) bits_count + (byte~) main::$6)
|
||||
(bool~) main::$7 ← (byte) main::bits >= (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(bool~) main::$8 ← ! (bool~) main::$7
|
||||
if((bool~) main::$8) goto main::@2
|
||||
to:main::@7
|
||||
main::@2: scope:[main] from main::@1 main::@7
|
||||
(byte~) main::$10 ← (byte) main::bits_gen << (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::bits_gen ← (byte~) main::$10
|
||||
(byte~) main::$11 ← *((byte*) main::chargen) & (byte/signed byte/word/signed word/dword/signed dword) 24
|
||||
(byte~) main::$12 ← *((byte*) main::chargen1) & (byte/signed byte/word/signed word/dword/signed dword) 24
|
||||
(byte~) main::$13 ← (byte~) main::$12 >> (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte~) main::$14 ← (byte~) main::$11 | (byte~) main::$13
|
||||
(byte~) main::$15 ← (byte~) main::$14 >> (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::bits ← *((byte[]) bits_count + (byte~) main::$15)
|
||||
(bool~) main::$16 ← (byte) main::bits >= (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(bool~) main::$17 ← ! (bool~) main::$16
|
||||
if((bool~) main::$17) goto main::@3
|
||||
to:main::@8
|
||||
main::@7: scope:[main] from main::@1
|
||||
(byte/signed word/word/dword/signed dword~) main::$9 ← (byte) main::bits_gen + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::bits_gen ← (byte/signed word/word/dword/signed dword~) main::$9
|
||||
to:main::@2
|
||||
main::@3: scope:[main] from main::@2 main::@8
|
||||
(byte~) main::$19 ← (byte) main::bits_gen << (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::bits_gen ← (byte~) main::$19
|
||||
(byte~) main::$20 ← *((byte*) main::chargen) & (byte/signed byte/word/signed word/dword/signed dword) 6
|
||||
(byte~) main::$21 ← (byte~) main::$20 << (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte~) main::$22 ← *((byte*) main::chargen1) & (byte/signed byte/word/signed word/dword/signed dword) 6
|
||||
(byte~) main::$23 ← (byte~) main::$22 >> (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte~) main::$24 ← (byte~) main::$21 | (byte~) main::$23
|
||||
(byte) main::bits ← *((byte[]) bits_count + (byte~) main::$24)
|
||||
(bool~) main::$25 ← (byte) main::bits >= (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(bool~) main::$26 ← ! (bool~) main::$25
|
||||
if((bool~) main::$26) goto main::@4
|
||||
to:main::@9
|
||||
main::@8: scope:[main] from main::@2
|
||||
(byte/signed word/word/dword/signed dword~) main::$18 ← (byte) main::bits_gen + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::bits_gen ← (byte/signed word/word/dword/signed dword~) main::$18
|
||||
to:main::@3
|
||||
main::@4: scope:[main] from main::@3 main::@9
|
||||
(byte~) main::$28 ← (byte) main::bits_gen << (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::bits_gen ← (byte~) main::$28
|
||||
(byte~) main::$29 ← *((byte*) main::chargen) & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte~) main::$30 ← (byte~) main::$29 << (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte~) main::$31 ← *((byte*) main::chargen1) & (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte~) main::$32 ← (byte~) main::$30 | (byte~) main::$31
|
||||
(byte) main::bits ← *((byte[]) bits_count + (byte~) main::$32)
|
||||
(bool~) main::$33 ← (byte) main::bits >= (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(bool~) main::$34 ← ! (bool~) main::$33
|
||||
if((bool~) main::$34) goto main::@5
|
||||
to:main::@10
|
||||
main::@9: scope:[main] from main::@3
|
||||
(byte/signed word/word/dword/signed dword~) main::$27 ← (byte) main::bits_gen + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::bits_gen ← (byte/signed word/word/dword/signed dword~) main::$27
|
||||
to:main::@4
|
||||
main::@5: scope:[main] from main::@10 main::@4
|
||||
(byte~) main::$36 ← (byte) main::bits_gen << (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::bits_gen ← (byte~) main::$36
|
||||
*((byte*) main::charset4) ← (byte) main::bits_gen
|
||||
(byte*) main::charset4 ← ++ (byte*) main::charset4
|
||||
(byte*~) main::$37 ← (byte*) main::chargen + (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte*) main::chargen ← (byte*~) main::$37
|
||||
(byte*~) main::$38 ← (byte*) CHARGEN + (word/signed word/dword/signed dword) 2048
|
||||
(bool~) main::$39 ← (byte*) main::chargen < (byte*~) main::$38
|
||||
if((bool~) main::$39) goto main::@1
|
||||
to:main::@11
|
||||
main::@10: scope:[main] from main::@4
|
||||
(byte/signed word/word/dword/signed dword~) main::$35 ← (byte) main::bits_gen + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::bits_gen ← (byte/signed word/word/dword/signed dword~) main::$35
|
||||
to:main::@5
|
||||
main::@11: scope:[main] from main::@5
|
||||
*((byte*) PROCPORT) ← (byte/signed byte/word/signed word/dword/signed dword) 55
|
||||
asm { cli }
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@6
|
||||
main::@6: scope:[main] from main::@11 main::@6
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte) main::i
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,255)
|
||||
(bool~) main::$40 ← (byte) main::i != rangelast(0,255)
|
||||
if((bool~) main::$40) goto main::@6
|
||||
to:main::@12
|
||||
main::@12: scope:[main] from main::@6
|
||||
*((byte*) D018) ← (byte/signed byte/word/signed word/dword/signed dword) 25
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@12
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Eliminating unused variable (byte*) CHARSET and assignment [1] (byte*) CHARSET ← ((byte*)) (word/signed word/dword/signed dword) 8192
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) CHARGEN#0 ← ((byte*)) (word/dword/signed dword) 53248
|
||||
@ -771,45 +516,6 @@ Adding NOP phi() at start of main::@7
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 7 initial phi equivalence classes
|
||||
Coalesced [27] main::bits_gen#18 ← main::bits_gen#4
|
||||
Coalesced [38] main::bits_gen#20 ← main::bits_gen#6
|
||||
@ -830,45 +536,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main::@7
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,587 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/helloworld.kc
|
||||
import "print"
|
||||
void main() {
|
||||
print_str("hello world!@");
|
||||
print_ln();
|
||||
}
|
||||
|
||||
Importing print
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/print.kc
|
||||
|
||||
byte* print_screen = $0400;
|
||||
byte* print_line_cursor = print_screen;
|
||||
byte* print_char_cursor = print_line_cursor;
|
||||
|
||||
// Print a number of zero-terminated strings, each followed by a newline.
|
||||
// The sequence of lines is terminated by another zero.
|
||||
void print_str_lines(byte* str) {
|
||||
while(*str!='@') {
|
||||
do {
|
||||
byte ch = *(str++);
|
||||
if(ch!='@') {
|
||||
*(print_char_cursor++) = ch;
|
||||
}
|
||||
} while (ch!='@');
|
||||
print_ln();
|
||||
}
|
||||
}
|
||||
|
||||
// Print a zero-terminated string followed by a newline
|
||||
void print_str_ln(byte* str) {
|
||||
print_str(str);
|
||||
print_ln();
|
||||
}
|
||||
|
||||
// Print a zero-terminated string
|
||||
void print_str(byte* str) {
|
||||
while(*str!='@') {
|
||||
*(print_char_cursor++) = *(str++);
|
||||
}
|
||||
}
|
||||
|
||||
// Print a string at a specific screen position
|
||||
void print_str_at(byte* str, byte* at) {
|
||||
while(*str!='@') {
|
||||
*(at++) = *(str++);
|
||||
}
|
||||
}
|
||||
|
||||
// Print a newline
|
||||
void print_ln() {
|
||||
do {
|
||||
print_line_cursor = print_line_cursor + $28;
|
||||
} while (print_line_cursor<print_char_cursor);
|
||||
print_char_cursor = print_line_cursor;
|
||||
}
|
||||
|
||||
// Print a signed word as HEX
|
||||
void print_sword(signed word w) {
|
||||
if(w<0) {
|
||||
print_char('-');
|
||||
w = -w;
|
||||
}
|
||||
print_word((word)w);
|
||||
}
|
||||
|
||||
// Print a signed byte as HEX
|
||||
void print_sbyte(signed byte b) {
|
||||
if(b<0) {
|
||||
print_char('-');
|
||||
b = -b;
|
||||
}
|
||||
print_byte((byte)b);
|
||||
}
|
||||
|
||||
// Print a word as HEX
|
||||
void print_word(word w) {
|
||||
print_byte(>w);
|
||||
print_byte(<w);
|
||||
}
|
||||
|
||||
// Print a dword as HEX
|
||||
void print_dword(dword dw) {
|
||||
print_word(>dw);
|
||||
print_word(<dw);
|
||||
}
|
||||
|
||||
// Print a signed dword as HEX
|
||||
void print_sdword(signed dword dw) {
|
||||
if(dw<0) {
|
||||
print_char('-');
|
||||
dw = -dw;
|
||||
}
|
||||
print_dword((dword)dw);
|
||||
}
|
||||
|
||||
const byte[] print_hextab = "0123456789abcdef";
|
||||
|
||||
// Print a byte as HEX
|
||||
void print_byte(byte b) {
|
||||
// Table of hexadecimal digits
|
||||
print_char(print_hextab[b>>4]);
|
||||
print_char(print_hextab[b&$f]);
|
||||
}
|
||||
|
||||
// Print a single char
|
||||
void print_char(byte ch) {
|
||||
*(print_char_cursor++) = ch;
|
||||
}
|
||||
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
void print_cls() {
|
||||
for(byte* sc=print_screen; sc!=print_screen+1000; sc++) {
|
||||
*sc = ' ';
|
||||
}
|
||||
print_line_cursor = print_screen;
|
||||
print_char_cursor = print_line_cursor;
|
||||
}
|
||||
|
||||
// Set the screen to print on. Also resets current line/char cursor.
|
||||
void print_set_screen(byte* screen) {
|
||||
print_screen = screen;
|
||||
print_line_cursor = print_screen;
|
||||
print_char_cursor = print_line_cursor;
|
||||
}
|
||||
|
||||
Adding pre/post-modifier (byte*) print_str_lines::str ← ++ (byte*) print_str_lines::str
|
||||
Adding pre/post-modifier (byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
Adding pre/post-modifier (byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
Adding pre/post-modifier (byte*) print_str::str ← ++ (byte*) print_str::str
|
||||
Adding pre/post-modifier (byte*) print_str_at::at ← ++ (byte*) print_str_at::at
|
||||
Adding pre/post-modifier (byte*) print_str_at::str ← ++ (byte*) print_str_at::str
|
||||
Adding pre/post-modifier (byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
Adding pre/post-modifier (byte*) print_cls::sc ← ++ (byte*) print_cls::sc
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @10
|
||||
(label) @11
|
||||
(label) @12
|
||||
(label) @13
|
||||
(label) @14
|
||||
(label) @15
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @5
|
||||
(label) @6
|
||||
(label) @7
|
||||
(label) @8
|
||||
(label) @9
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(label) main::@return
|
||||
(void()) print_byte((byte) print_byte::b)
|
||||
(byte~) print_byte::$0
|
||||
(void~) print_byte::$1
|
||||
(byte~) print_byte::$2
|
||||
(void~) print_byte::$3
|
||||
(label) print_byte::@return
|
||||
(byte) print_byte::b
|
||||
(void()) print_char((byte) print_char::ch)
|
||||
(label) print_char::@return
|
||||
(byte) print_char::ch
|
||||
(byte*) print_char_cursor
|
||||
(void()) print_cls()
|
||||
(byte*~) print_cls::$0
|
||||
(bool~) print_cls::$1
|
||||
(label) print_cls::@1
|
||||
(label) print_cls::@2
|
||||
(label) print_cls::@return
|
||||
(byte*) print_cls::sc
|
||||
(void()) print_dword((dword) print_dword::dw)
|
||||
(word~) print_dword::$0
|
||||
(void~) print_dword::$1
|
||||
(word~) print_dword::$2
|
||||
(void~) print_dword::$3
|
||||
(label) print_dword::@return
|
||||
(dword) print_dword::dw
|
||||
(byte[]) print_hextab
|
||||
(byte*) print_line_cursor
|
||||
(void()) print_ln()
|
||||
(byte*~) print_ln::$0
|
||||
(bool~) print_ln::$1
|
||||
(label) print_ln::@1
|
||||
(label) print_ln::@2
|
||||
(label) print_ln::@return
|
||||
(void()) print_sbyte((signed byte) print_sbyte::b)
|
||||
(bool~) print_sbyte::$0
|
||||
(bool~) print_sbyte::$1
|
||||
(void~) print_sbyte::$2
|
||||
(signed byte~) print_sbyte::$3
|
||||
(byte~) print_sbyte::$4
|
||||
(void~) print_sbyte::$5
|
||||
(label) print_sbyte::@1
|
||||
(label) print_sbyte::@2
|
||||
(label) print_sbyte::@return
|
||||
(signed byte) print_sbyte::b
|
||||
(byte*) print_screen
|
||||
(void()) print_sdword((signed dword) print_sdword::dw)
|
||||
(bool~) print_sdword::$0
|
||||
(bool~) print_sdword::$1
|
||||
(void~) print_sdword::$2
|
||||
(signed dword~) print_sdword::$3
|
||||
(dword~) print_sdword::$4
|
||||
(void~) print_sdword::$5
|
||||
(label) print_sdword::@1
|
||||
(label) print_sdword::@2
|
||||
(label) print_sdword::@return
|
||||
(signed dword) print_sdword::dw
|
||||
(void()) print_set_screen((byte*) print_set_screen::screen)
|
||||
(label) print_set_screen::@return
|
||||
(byte*) print_set_screen::screen
|
||||
(void()) print_str((byte*) print_str::str)
|
||||
(bool~) print_str::$0
|
||||
(label) print_str::@1
|
||||
(label) print_str::@2
|
||||
(label) print_str::@3
|
||||
(label) print_str::@4
|
||||
(label) print_str::@5
|
||||
(label) print_str::@6
|
||||
(label) print_str::@return
|
||||
(byte*) print_str::str
|
||||
(void()) print_str_at((byte*) print_str_at::str , (byte*) print_str_at::at)
|
||||
(bool~) print_str_at::$0
|
||||
(label) print_str_at::@1
|
||||
(label) print_str_at::@2
|
||||
(label) print_str_at::@3
|
||||
(label) print_str_at::@4
|
||||
(label) print_str_at::@5
|
||||
(label) print_str_at::@6
|
||||
(label) print_str_at::@return
|
||||
(byte*) print_str_at::at
|
||||
(byte*) print_str_at::str
|
||||
(void()) print_str_lines((byte*) print_str_lines::str)
|
||||
(bool~) print_str_lines::$0
|
||||
(bool~) print_str_lines::$1
|
||||
(bool~) print_str_lines::$2
|
||||
(bool~) print_str_lines::$3
|
||||
(void~) print_str_lines::$4
|
||||
(label) print_str_lines::@1
|
||||
(label) print_str_lines::@10
|
||||
(label) print_str_lines::@2
|
||||
(label) print_str_lines::@3
|
||||
(label) print_str_lines::@4
|
||||
(label) print_str_lines::@5
|
||||
(label) print_str_lines::@6
|
||||
(label) print_str_lines::@7
|
||||
(label) print_str_lines::@8
|
||||
(label) print_str_lines::@9
|
||||
(label) print_str_lines::@return
|
||||
(byte) print_str_lines::ch
|
||||
(byte*) print_str_lines::str
|
||||
(void()) print_str_ln((byte*) print_str_ln::str)
|
||||
(void~) print_str_ln::$0
|
||||
(void~) print_str_ln::$1
|
||||
(label) print_str_ln::@return
|
||||
(byte*) print_str_ln::str
|
||||
(void()) print_sword((signed word) print_sword::w)
|
||||
(bool~) print_sword::$0
|
||||
(bool~) print_sword::$1
|
||||
(void~) print_sword::$2
|
||||
(signed word~) print_sword::$3
|
||||
(word~) print_sword::$4
|
||||
(void~) print_sword::$5
|
||||
(label) print_sword::@1
|
||||
(label) print_sword::@2
|
||||
(label) print_sword::@return
|
||||
(signed word) print_sword::w
|
||||
(void()) print_word((word) print_word::w)
|
||||
(byte~) print_word::$0
|
||||
(void~) print_word::$1
|
||||
(byte~) print_word::$2
|
||||
(void~) print_word::$3
|
||||
(label) print_word::@return
|
||||
(word) print_word::w
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in print_screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) print_screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) print_line_cursor ← (byte*) print_screen
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:@1
|
||||
print_str_lines: scope:[print_str_lines] from
|
||||
to:print_str_lines::@1
|
||||
print_str_lines::@1: scope:[print_str_lines] from print_str_lines print_str_lines::@9
|
||||
(bool~) print_str_lines::$0 ← *((byte*) print_str_lines::str) != (byte) '@'
|
||||
if((bool~) print_str_lines::$0) goto print_str_lines::@2
|
||||
to:print_str_lines::@6
|
||||
print_str_lines::@2: scope:[print_str_lines] from print_str_lines::@1 print_str_lines::@7
|
||||
to:print_str_lines::@4
|
||||
print_str_lines::@6: scope:[print_str_lines] from print_str_lines::@1
|
||||
to:print_str_lines::@3
|
||||
print_str_lines::@3: scope:[print_str_lines] from print_str_lines::@10 print_str_lines::@6
|
||||
to:print_str_lines::@return
|
||||
print_str_lines::@7: scope:[print_str_lines] from
|
||||
to:print_str_lines::@2
|
||||
print_str_lines::@4: scope:[print_str_lines] from print_str_lines::@2 print_str_lines::@5
|
||||
(byte) print_str_lines::ch ← *((byte*) print_str_lines::str)
|
||||
(byte*) print_str_lines::str ← ++ (byte*) print_str_lines::str
|
||||
(bool~) print_str_lines::$1 ← (byte) print_str_lines::ch != (byte) '@'
|
||||
(bool~) print_str_lines::$2 ← ! (bool~) print_str_lines::$1
|
||||
if((bool~) print_str_lines::$2) goto print_str_lines::@5
|
||||
to:print_str_lines::@8
|
||||
print_str_lines::@5: scope:[print_str_lines] from print_str_lines::@4 print_str_lines::@8
|
||||
(bool~) print_str_lines::$3 ← (byte) print_str_lines::ch != (byte) '@'
|
||||
if((bool~) print_str_lines::$3) goto print_str_lines::@4
|
||||
to:print_str_lines::@9
|
||||
print_str_lines::@8: scope:[print_str_lines] from print_str_lines::@4
|
||||
*((byte*) print_char_cursor) ← (byte) print_str_lines::ch
|
||||
(byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
to:print_str_lines::@5
|
||||
print_str_lines::@9: scope:[print_str_lines] from print_str_lines::@5
|
||||
(void~) print_str_lines::$4 ← call print_ln
|
||||
to:print_str_lines::@1
|
||||
print_str_lines::@10: scope:[print_str_lines] from
|
||||
to:print_str_lines::@3
|
||||
print_str_lines::@return: scope:[print_str_lines] from print_str_lines::@3
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
print_str_ln: scope:[print_str_ln] from
|
||||
(void~) print_str_ln::$0 ← call print_str (byte*) print_str_ln::str
|
||||
(void~) print_str_ln::$1 ← call print_ln
|
||||
to:print_str_ln::@return
|
||||
print_str_ln::@return: scope:[print_str_ln] from print_str_ln
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
print_str: scope:[print_str] from
|
||||
to:print_str::@1
|
||||
print_str::@1: scope:[print_str] from print_str print_str::@2
|
||||
(bool~) print_str::$0 ← *((byte*) print_str::str) != (byte) '@'
|
||||
if((bool~) print_str::$0) goto print_str::@2
|
||||
to:print_str::@4
|
||||
print_str::@2: scope:[print_str] from print_str::@1 print_str::@5
|
||||
*((byte*) print_char_cursor) ← *((byte*) print_str::str)
|
||||
(byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
(byte*) print_str::str ← ++ (byte*) print_str::str
|
||||
to:print_str::@1
|
||||
print_str::@4: scope:[print_str] from print_str::@1
|
||||
to:print_str::@3
|
||||
print_str::@3: scope:[print_str] from print_str::@4 print_str::@6
|
||||
to:print_str::@return
|
||||
print_str::@5: scope:[print_str] from
|
||||
to:print_str::@2
|
||||
print_str::@6: scope:[print_str] from
|
||||
to:print_str::@3
|
||||
print_str::@return: scope:[print_str] from print_str::@3
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
print_str_at: scope:[print_str_at] from
|
||||
to:print_str_at::@1
|
||||
print_str_at::@1: scope:[print_str_at] from print_str_at print_str_at::@2
|
||||
(bool~) print_str_at::$0 ← *((byte*) print_str_at::str) != (byte) '@'
|
||||
if((bool~) print_str_at::$0) goto print_str_at::@2
|
||||
to:print_str_at::@4
|
||||
print_str_at::@2: scope:[print_str_at] from print_str_at::@1 print_str_at::@5
|
||||
*((byte*) print_str_at::at) ← *((byte*) print_str_at::str)
|
||||
(byte*) print_str_at::at ← ++ (byte*) print_str_at::at
|
||||
(byte*) print_str_at::str ← ++ (byte*) print_str_at::str
|
||||
to:print_str_at::@1
|
||||
print_str_at::@4: scope:[print_str_at] from print_str_at::@1
|
||||
to:print_str_at::@3
|
||||
print_str_at::@3: scope:[print_str_at] from print_str_at::@4 print_str_at::@6
|
||||
to:print_str_at::@return
|
||||
print_str_at::@5: scope:[print_str_at] from
|
||||
to:print_str_at::@2
|
||||
print_str_at::@6: scope:[print_str_at] from
|
||||
to:print_str_at::@3
|
||||
print_str_at::@return: scope:[print_str_at] from print_str_at::@3
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
print_ln: scope:[print_ln] from
|
||||
to:print_ln::@1
|
||||
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
|
||||
(byte*~) print_ln::$0 ← (byte*) print_line_cursor + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*) print_line_cursor ← (byte*~) print_ln::$0
|
||||
(bool~) print_ln::$1 ← (byte*) print_line_cursor < (byte*) print_char_cursor
|
||||
if((bool~) print_ln::$1) goto print_ln::@1
|
||||
to:print_ln::@2
|
||||
print_ln::@2: scope:[print_ln] from print_ln::@1
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:print_ln::@return
|
||||
print_ln::@return: scope:[print_ln] from print_ln::@2
|
||||
return
|
||||
to:@return
|
||||
@5: scope:[] from @4
|
||||
to:@6
|
||||
print_sword: scope:[print_sword] from
|
||||
(bool~) print_sword::$0 ← (signed word) print_sword::w < (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) print_sword::$1 ← ! (bool~) print_sword::$0
|
||||
if((bool~) print_sword::$1) goto print_sword::@1
|
||||
to:print_sword::@2
|
||||
print_sword::@1: scope:[print_sword] from print_sword print_sword::@2
|
||||
(word~) print_sword::$4 ← ((word)) (signed word) print_sword::w
|
||||
(void~) print_sword::$5 ← call print_word (word~) print_sword::$4
|
||||
to:print_sword::@return
|
||||
print_sword::@2: scope:[print_sword] from print_sword
|
||||
(void~) print_sword::$2 ← call print_char (byte) '-'
|
||||
(signed word~) print_sword::$3 ← - (signed word) print_sword::w
|
||||
(signed word) print_sword::w ← (signed word~) print_sword::$3
|
||||
to:print_sword::@1
|
||||
print_sword::@return: scope:[print_sword] from print_sword::@1
|
||||
return
|
||||
to:@return
|
||||
@6: scope:[] from @5
|
||||
to:@7
|
||||
print_sbyte: scope:[print_sbyte] from
|
||||
(bool~) print_sbyte::$0 ← (signed byte) print_sbyte::b < (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) print_sbyte::$1 ← ! (bool~) print_sbyte::$0
|
||||
if((bool~) print_sbyte::$1) goto print_sbyte::@1
|
||||
to:print_sbyte::@2
|
||||
print_sbyte::@1: scope:[print_sbyte] from print_sbyte print_sbyte::@2
|
||||
(byte~) print_sbyte::$4 ← ((byte)) (signed byte) print_sbyte::b
|
||||
(void~) print_sbyte::$5 ← call print_byte (byte~) print_sbyte::$4
|
||||
to:print_sbyte::@return
|
||||
print_sbyte::@2: scope:[print_sbyte] from print_sbyte
|
||||
(void~) print_sbyte::$2 ← call print_char (byte) '-'
|
||||
(signed byte~) print_sbyte::$3 ← - (signed byte) print_sbyte::b
|
||||
(signed byte) print_sbyte::b ← (signed byte~) print_sbyte::$3
|
||||
to:print_sbyte::@1
|
||||
print_sbyte::@return: scope:[print_sbyte] from print_sbyte::@1
|
||||
return
|
||||
to:@return
|
||||
@7: scope:[] from @6
|
||||
to:@8
|
||||
print_word: scope:[print_word] from
|
||||
(byte~) print_word::$0 ← > (word) print_word::w
|
||||
(void~) print_word::$1 ← call print_byte (byte~) print_word::$0
|
||||
(byte~) print_word::$2 ← < (word) print_word::w
|
||||
(void~) print_word::$3 ← call print_byte (byte~) print_word::$2
|
||||
to:print_word::@return
|
||||
print_word::@return: scope:[print_word] from print_word
|
||||
return
|
||||
to:@return
|
||||
@8: scope:[] from @7
|
||||
to:@9
|
||||
print_dword: scope:[print_dword] from
|
||||
(word~) print_dword::$0 ← > (dword) print_dword::dw
|
||||
(void~) print_dword::$1 ← call print_word (word~) print_dword::$0
|
||||
(word~) print_dword::$2 ← < (dword) print_dword::dw
|
||||
(void~) print_dword::$3 ← call print_word (word~) print_dword::$2
|
||||
to:print_dword::@return
|
||||
print_dword::@return: scope:[print_dword] from print_dword
|
||||
return
|
||||
to:@return
|
||||
@9: scope:[] from @8
|
||||
to:@10
|
||||
print_sdword: scope:[print_sdword] from
|
||||
(bool~) print_sdword::$0 ← (signed dword) print_sdword::dw < (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) print_sdword::$1 ← ! (bool~) print_sdword::$0
|
||||
if((bool~) print_sdword::$1) goto print_sdword::@1
|
||||
to:print_sdword::@2
|
||||
print_sdword::@1: scope:[print_sdword] from print_sdword print_sdword::@2
|
||||
(dword~) print_sdword::$4 ← ((dword)) (signed dword) print_sdword::dw
|
||||
(void~) print_sdword::$5 ← call print_dword (dword~) print_sdword::$4
|
||||
to:print_sdword::@return
|
||||
print_sdword::@2: scope:[print_sdword] from print_sdword
|
||||
(void~) print_sdword::$2 ← call print_char (byte) '-'
|
||||
(signed dword~) print_sdword::$3 ← - (signed dword) print_sdword::dw
|
||||
(signed dword) print_sdword::dw ← (signed dword~) print_sdword::$3
|
||||
to:print_sdword::@1
|
||||
print_sdword::@return: scope:[print_sdword] from print_sdword::@1
|
||||
return
|
||||
to:@return
|
||||
@10: scope:[] from @9
|
||||
(byte[]) print_hextab ← (string) "0123456789abcdef"
|
||||
to:@11
|
||||
print_byte: scope:[print_byte] from
|
||||
(byte~) print_byte::$0 ← (byte) print_byte::b >> (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(void~) print_byte::$1 ← call print_char *((byte[]) print_hextab + (byte~) print_byte::$0)
|
||||
(byte~) print_byte::$2 ← (byte) print_byte::b & (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
(void~) print_byte::$3 ← call print_char *((byte[]) print_hextab + (byte~) print_byte::$2)
|
||||
to:print_byte::@return
|
||||
print_byte::@return: scope:[print_byte] from print_byte
|
||||
return
|
||||
to:@return
|
||||
@11: scope:[] from @10
|
||||
to:@12
|
||||
print_char: scope:[print_char] from
|
||||
*((byte*) print_char_cursor) ← (byte) print_char::ch
|
||||
(byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
to:print_char::@return
|
||||
print_char::@return: scope:[print_char] from print_char
|
||||
return
|
||||
to:@return
|
||||
@12: scope:[] from @11
|
||||
to:@13
|
||||
print_cls: scope:[print_cls] from
|
||||
(byte*) print_cls::sc ← (byte*) print_screen
|
||||
to:print_cls::@1
|
||||
print_cls::@1: scope:[print_cls] from print_cls print_cls::@1
|
||||
*((byte*) print_cls::sc) ← (byte) ' '
|
||||
(byte*) print_cls::sc ← ++ (byte*) print_cls::sc
|
||||
(byte*~) print_cls::$0 ← (byte*) print_screen + (word/signed word/dword/signed dword) 1000
|
||||
(bool~) print_cls::$1 ← (byte*) print_cls::sc != (byte*~) print_cls::$0
|
||||
if((bool~) print_cls::$1) goto print_cls::@1
|
||||
to:print_cls::@2
|
||||
print_cls::@2: scope:[print_cls] from print_cls::@1
|
||||
(byte*) print_line_cursor ← (byte*) print_screen
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:print_cls::@return
|
||||
print_cls::@return: scope:[print_cls] from print_cls::@2
|
||||
return
|
||||
to:@return
|
||||
@13: scope:[] from @12
|
||||
to:@14
|
||||
print_set_screen: scope:[print_set_screen] from
|
||||
(byte*) print_screen ← (byte*) print_set_screen::screen
|
||||
(byte*) print_line_cursor ← (byte*) print_screen
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:print_set_screen::@return
|
||||
print_set_screen::@return: scope:[print_set_screen] from print_set_screen
|
||||
return
|
||||
to:@return
|
||||
@14: scope:[] from @13
|
||||
to:@15
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call print_str (string) "hello world!@"
|
||||
(void~) main::$1 ← call print_ln
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@15: scope:[] from @14
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @15
|
||||
|
||||
Removing unused procedure print_str_lines
|
||||
Removing unused procedure print_str_ln
|
||||
Removing unused procedure print_str_at
|
||||
Removing unused procedure print_sword
|
||||
Removing unused procedure print_sbyte
|
||||
Removing unused procedure print_sdword
|
||||
Removing unused procedure print_cls
|
||||
Removing unused procedure print_set_screen
|
||||
Removing unused procedure print_dword
|
||||
Removing unused procedure print_word
|
||||
Removing unused procedure print_byte
|
||||
Removing unused procedure print_char
|
||||
Eliminating unused variable (byte[]) print_hextab and assignment [15] (byte[]) print_hextab ← (string) "0123456789abcdef"
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Creating constant string variable for inline (const string) main::str "hello world!@"
|
||||
Removing empty block @1
|
||||
Removing empty block @2
|
||||
Removing empty block print_str::@4
|
||||
Removing empty block print_str::@3
|
||||
Removing empty block print_str::@5
|
||||
Removing empty block print_str::@6
|
||||
Removing empty block @3
|
||||
Removing empty block @4
|
||||
Removing empty block @5
|
||||
Removing empty block @6
|
||||
Removing empty block @7
|
||||
Removing empty block @8
|
||||
Removing empty block @9
|
||||
Removing empty block @10
|
||||
Removing empty block @11
|
||||
Removing empty block @12
|
||||
Removing empty block @13
|
||||
Removing empty block @14
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
print_str modifies print_char_cursor
|
||||
print_ln modifies print_line_cursor
|
||||
print_ln modifies print_char_cursor
|
||||
main modifies print_char_cursor
|
||||
main modifies print_line_cursor
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) print_line_cursor#0 ← (byte*) print_screen#0
|
||||
@ -793,13 +211,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to print_str:5 print_ln:7
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 3 initial phi equivalence classes
|
||||
Coalesced [14] print_line_cursor#16 ← print_line_cursor#1
|
||||
Coalesced [22] print_str::str#5 ← print_str::str#0
|
||||
@ -813,13 +224,6 @@ Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@1
|
||||
Adding NOP phi() at start of print_ln
|
||||
Adding NOP phi() at start of print_str
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,90 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/helloworld2.kc
|
||||
byte* screen = $400;
|
||||
void main() {
|
||||
byte* hello = "hello world!@";
|
||||
print2(screen, hello);
|
||||
print2(screen+80, hello);
|
||||
}
|
||||
|
||||
void print2(byte* at, byte* msg) {
|
||||
byte j=0;
|
||||
for(byte i=0; msg[i]!='@'; i++) {
|
||||
at[j] = msg[i];
|
||||
j += 2;
|
||||
}
|
||||
}
|
||||
|
||||
Adding pre/post-modifier (byte) print2::i ← ++ (byte) print2::i
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(byte*~) main::$1
|
||||
(void~) main::$2
|
||||
(label) main::@return
|
||||
(byte*) main::hello
|
||||
(void()) print2((byte*) print2::at , (byte*) print2::msg)
|
||||
(bool~) print2::$0
|
||||
(label) print2::@1
|
||||
(label) print2::@2
|
||||
(label) print2::@return
|
||||
(byte*) print2::at
|
||||
(byte) print2::i
|
||||
(byte) print2::j
|
||||
(byte*) print2::msg
|
||||
(byte*) screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::hello ← (string) "hello world!@"
|
||||
(void~) main::$0 ← call print2 (byte*) screen (byte*) main::hello
|
||||
(byte*~) main::$1 ← (byte*) screen + (byte/signed byte/word/signed word/dword/signed dword) 80
|
||||
(void~) main::$2 ← call print2 (byte*~) main::$1 (byte*) main::hello
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
print2: scope:[print2] from
|
||||
(byte) print2::j ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) print2::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:print2::@1
|
||||
print2::@1: scope:[print2] from print2 print2::@1
|
||||
*((byte*) print2::at + (byte) print2::j) ← *((byte*) print2::msg + (byte) print2::i)
|
||||
(byte) print2::j ← (byte) print2::j + (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) print2::i ← ++ (byte) print2::i
|
||||
(bool~) print2::$0 ← *((byte*) print2::msg + (byte) print2::i) != (byte) '@'
|
||||
if((bool~) print2::$0) goto print2::@1
|
||||
to:print2::@2
|
||||
print2::@2: scope:[print2] from print2::@1
|
||||
to:print2::@return
|
||||
print2::@return: scope:[print2] from print2::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$2
|
||||
Creating constant string variable for inline (const string) main::$3 "hello world!@"
|
||||
Removing empty block @1
|
||||
Removing empty block print2::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@2
|
||||
@ -231,13 +146,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to print2:5 print2:7
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 3 initial phi equivalence classes
|
||||
Coalesced [16] print2::i#3 ← print2::i#1
|
||||
Coalesced [17] print2::j#3 ← print2::j#1
|
||||
@ -248,11 +156,6 @@ Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@1
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,72 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/ifmin.kc
|
||||
// Minimal if() test
|
||||
byte* SCREEN = $0400;
|
||||
|
||||
void main() {
|
||||
byte i=0;
|
||||
do {
|
||||
if(i<50) {
|
||||
*SCREEN = i;
|
||||
}
|
||||
} while(++i<100);
|
||||
}
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(bool~) main::$1
|
||||
(bool~) main::$2
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
(bool~) main::$0 ← (byte) main::i < (byte/signed byte/word/signed word/dword/signed dword) 50
|
||||
(bool~) main::$1 ← ! (bool~) main::$0
|
||||
if((bool~) main::$1) goto main::@2
|
||||
to:main::@3
|
||||
main::@2: scope:[main] from main::@1 main::@3
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(bool~) main::$2 ← (byte) main::i < (byte/signed byte/word/signed word/dword/signed dword) 100
|
||||
if((bool~) main::$2) goto main::@1
|
||||
to:main::@4
|
||||
main::@3: scope:[main] from main::@1
|
||||
*((byte*) SCREEN) ← (byte) main::i
|
||||
to:main::@2
|
||||
main::@4: scope:[main] from main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
@ -164,8 +97,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [11] main::i#5 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -174,8 +105,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,63 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/immzero.kc
|
||||
// Tests that immediate zero values are reused - even when assigning to words
|
||||
void main() {
|
||||
byte i = 0;
|
||||
word w = (word)0;
|
||||
for ( byte j : 0..10) {
|
||||
i = j;
|
||||
w = w + j;
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) main::$0
|
||||
(word~) main::$1
|
||||
(bool~) main::$2
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(byte) main::j
|
||||
(word) main::w
|
||||
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) main::$0 ← ((word)) (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(word) main::w ← (byte/signed byte/word/signed word/dword/signed dword~) main::$0
|
||||
(byte) main::j ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::i ← (byte) main::j
|
||||
(word~) main::$1 ← (word) main::w + (byte) main::j
|
||||
(word) main::w ← (word~) main::$1
|
||||
(byte) main::j ← (byte) main::j + rangenext(0,10)
|
||||
(bool~) main::$2 ← (byte) main::j != rangelast(0,10)
|
||||
if((bool~) main::$2) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Eliminating unused variable (byte) main::i and assignment [0] (byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
Eliminating unused variable main::i(null) and assignment [4] main::i(null) ← (byte) main::j
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -129,10 +71,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 2 initial phi equivalence classes
|
||||
Coalesced [10] main::w#3 ← main::w#1
|
||||
Coalesced [11] main::j#3 ← main::j#1
|
||||
@ -142,9 +80,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,51 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/importing.kc
|
||||
import "imported.kc"
|
||||
|
||||
void main() {
|
||||
byte* screen = $0400;
|
||||
*screen = 1;
|
||||
*BGCOL = RED;
|
||||
}
|
||||
Importing imported.kc
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/imported.kc
|
||||
const byte *BGCOL = $d021;
|
||||
const byte RED = 2;
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte) RED
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
(byte*) main::screen
|
||||
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53281
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
*((byte*) main::screen) ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
*((byte*) BGCOL) ← (byte) RED
|
||||
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
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte) RED#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
@ -91,13 +45,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,56 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/incd020.kc
|
||||
// Incrementing / decrementing pointer content should result in code modifying the memory location - eg. inc $d020.
|
||||
// Currently it does not but instead leads to just reading the value a few times.
|
||||
|
||||
byte* BGCOL = $d020;
|
||||
void main() {
|
||||
do {
|
||||
++*BGCOL;
|
||||
(*BGCOL)--;
|
||||
} while (true);
|
||||
}
|
||||
Adding pre/post-modifier *((byte*) BGCOL) ← ++ *((byte*) BGCOL)
|
||||
Adding pre/post-modifier *((byte*) BGCOL) ← -- *((byte*) BGCOL)
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(void()) main()
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53280
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53280
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) BGCOL) ← ++ *((byte*) BGCOL)
|
||||
*((byte*) BGCOL) ← -- *((byte*) BGCOL)
|
||||
if(true) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53280
|
||||
to:@1
|
||||
@ -110,14 +59,12 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,615 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/incrementinarray.kc
|
||||
import "print.kc"
|
||||
|
||||
byte[] txt = "camelot@";
|
||||
|
||||
void main() {
|
||||
print_cls();
|
||||
for ( byte i: 0..10) {
|
||||
print_str(txt);
|
||||
print_ln();
|
||||
txt[1]++;
|
||||
}
|
||||
|
||||
}
|
||||
Importing print.kc
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/print.kc
|
||||
|
||||
byte* print_screen = $0400;
|
||||
byte* print_line_cursor = print_screen;
|
||||
byte* print_char_cursor = print_line_cursor;
|
||||
|
||||
// Print a number of zero-terminated strings, each followed by a newline.
|
||||
// The sequence of lines is terminated by another zero.
|
||||
void print_str_lines(byte* str) {
|
||||
while(*str!='@') {
|
||||
do {
|
||||
byte ch = *(str++);
|
||||
if(ch!='@') {
|
||||
*(print_char_cursor++) = ch;
|
||||
}
|
||||
} while (ch!='@');
|
||||
print_ln();
|
||||
}
|
||||
}
|
||||
|
||||
// Print a zero-terminated string followed by a newline
|
||||
void print_str_ln(byte* str) {
|
||||
print_str(str);
|
||||
print_ln();
|
||||
}
|
||||
|
||||
// Print a zero-terminated string
|
||||
void print_str(byte* str) {
|
||||
while(*str!='@') {
|
||||
*(print_char_cursor++) = *(str++);
|
||||
}
|
||||
}
|
||||
|
||||
// Print a string at a specific screen position
|
||||
void print_str_at(byte* str, byte* at) {
|
||||
while(*str!='@') {
|
||||
*(at++) = *(str++);
|
||||
}
|
||||
}
|
||||
|
||||
// Print a newline
|
||||
void print_ln() {
|
||||
do {
|
||||
print_line_cursor = print_line_cursor + $28;
|
||||
} while (print_line_cursor<print_char_cursor);
|
||||
print_char_cursor = print_line_cursor;
|
||||
}
|
||||
|
||||
// Print a signed word as HEX
|
||||
void print_sword(signed word w) {
|
||||
if(w<0) {
|
||||
print_char('-');
|
||||
w = -w;
|
||||
}
|
||||
print_word((word)w);
|
||||
}
|
||||
|
||||
// Print a signed byte as HEX
|
||||
void print_sbyte(signed byte b) {
|
||||
if(b<0) {
|
||||
print_char('-');
|
||||
b = -b;
|
||||
}
|
||||
print_byte((byte)b);
|
||||
}
|
||||
|
||||
// Print a word as HEX
|
||||
void print_word(word w) {
|
||||
print_byte(>w);
|
||||
print_byte(<w);
|
||||
}
|
||||
|
||||
// Print a dword as HEX
|
||||
void print_dword(dword dw) {
|
||||
print_word(>dw);
|
||||
print_word(<dw);
|
||||
}
|
||||
|
||||
// Print a signed dword as HEX
|
||||
void print_sdword(signed dword dw) {
|
||||
if(dw<0) {
|
||||
print_char('-');
|
||||
dw = -dw;
|
||||
}
|
||||
print_dword((dword)dw);
|
||||
}
|
||||
|
||||
const byte[] print_hextab = "0123456789abcdef";
|
||||
|
||||
// Print a byte as HEX
|
||||
void print_byte(byte b) {
|
||||
// Table of hexadecimal digits
|
||||
print_char(print_hextab[b>>4]);
|
||||
print_char(print_hextab[b&$f]);
|
||||
}
|
||||
|
||||
// Print a single char
|
||||
void print_char(byte ch) {
|
||||
*(print_char_cursor++) = ch;
|
||||
}
|
||||
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
void print_cls() {
|
||||
for(byte* sc=print_screen; sc!=print_screen+1000; sc++) {
|
||||
*sc = ' ';
|
||||
}
|
||||
print_line_cursor = print_screen;
|
||||
print_char_cursor = print_line_cursor;
|
||||
}
|
||||
|
||||
// Set the screen to print on. Also resets current line/char cursor.
|
||||
void print_set_screen(byte* screen) {
|
||||
print_screen = screen;
|
||||
print_line_cursor = print_screen;
|
||||
print_char_cursor = print_line_cursor;
|
||||
}
|
||||
|
||||
Adding pre/post-modifier (byte*) print_str_lines::str ← ++ (byte*) print_str_lines::str
|
||||
Adding pre/post-modifier (byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
Adding pre/post-modifier (byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
Adding pre/post-modifier (byte*) print_str::str ← ++ (byte*) print_str::str
|
||||
Adding pre/post-modifier (byte*) print_str_at::at ← ++ (byte*) print_str_at::at
|
||||
Adding pre/post-modifier (byte*) print_str_at::str ← ++ (byte*) print_str_at::str
|
||||
Adding pre/post-modifier (byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
Adding pre/post-modifier (byte*) print_cls::sc ← ++ (byte*) print_cls::sc
|
||||
Adding pre/post-modifier *((byte[]) txt + (byte/signed byte/word/signed word/dword/signed dword) 1) ← ++ *((byte[]) txt + (byte/signed byte/word/signed word/dword/signed dword) 1)
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @10
|
||||
(label) @11
|
||||
(label) @12
|
||||
(label) @13
|
||||
(label) @14
|
||||
(label) @15
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @5
|
||||
(label) @6
|
||||
(label) @7
|
||||
(label) @8
|
||||
(label) @9
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(void~) main::$2
|
||||
(bool~) main::$3
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(void()) print_byte((byte) print_byte::b)
|
||||
(byte~) print_byte::$0
|
||||
(void~) print_byte::$1
|
||||
(byte~) print_byte::$2
|
||||
(void~) print_byte::$3
|
||||
(label) print_byte::@return
|
||||
(byte) print_byte::b
|
||||
(void()) print_char((byte) print_char::ch)
|
||||
(label) print_char::@return
|
||||
(byte) print_char::ch
|
||||
(byte*) print_char_cursor
|
||||
(void()) print_cls()
|
||||
(byte*~) print_cls::$0
|
||||
(bool~) print_cls::$1
|
||||
(label) print_cls::@1
|
||||
(label) print_cls::@2
|
||||
(label) print_cls::@return
|
||||
(byte*) print_cls::sc
|
||||
(void()) print_dword((dword) print_dword::dw)
|
||||
(word~) print_dword::$0
|
||||
(void~) print_dword::$1
|
||||
(word~) print_dword::$2
|
||||
(void~) print_dword::$3
|
||||
(label) print_dword::@return
|
||||
(dword) print_dword::dw
|
||||
(byte[]) print_hextab
|
||||
(byte*) print_line_cursor
|
||||
(void()) print_ln()
|
||||
(byte*~) print_ln::$0
|
||||
(bool~) print_ln::$1
|
||||
(label) print_ln::@1
|
||||
(label) print_ln::@2
|
||||
(label) print_ln::@return
|
||||
(void()) print_sbyte((signed byte) print_sbyte::b)
|
||||
(bool~) print_sbyte::$0
|
||||
(bool~) print_sbyte::$1
|
||||
(void~) print_sbyte::$2
|
||||
(signed byte~) print_sbyte::$3
|
||||
(byte~) print_sbyte::$4
|
||||
(void~) print_sbyte::$5
|
||||
(label) print_sbyte::@1
|
||||
(label) print_sbyte::@2
|
||||
(label) print_sbyte::@return
|
||||
(signed byte) print_sbyte::b
|
||||
(byte*) print_screen
|
||||
(void()) print_sdword((signed dword) print_sdword::dw)
|
||||
(bool~) print_sdword::$0
|
||||
(bool~) print_sdword::$1
|
||||
(void~) print_sdword::$2
|
||||
(signed dword~) print_sdword::$3
|
||||
(dword~) print_sdword::$4
|
||||
(void~) print_sdword::$5
|
||||
(label) print_sdword::@1
|
||||
(label) print_sdword::@2
|
||||
(label) print_sdword::@return
|
||||
(signed dword) print_sdword::dw
|
||||
(void()) print_set_screen((byte*) print_set_screen::screen)
|
||||
(label) print_set_screen::@return
|
||||
(byte*) print_set_screen::screen
|
||||
(void()) print_str((byte*) print_str::str)
|
||||
(bool~) print_str::$0
|
||||
(label) print_str::@1
|
||||
(label) print_str::@2
|
||||
(label) print_str::@3
|
||||
(label) print_str::@4
|
||||
(label) print_str::@5
|
||||
(label) print_str::@6
|
||||
(label) print_str::@return
|
||||
(byte*) print_str::str
|
||||
(void()) print_str_at((byte*) print_str_at::str , (byte*) print_str_at::at)
|
||||
(bool~) print_str_at::$0
|
||||
(label) print_str_at::@1
|
||||
(label) print_str_at::@2
|
||||
(label) print_str_at::@3
|
||||
(label) print_str_at::@4
|
||||
(label) print_str_at::@5
|
||||
(label) print_str_at::@6
|
||||
(label) print_str_at::@return
|
||||
(byte*) print_str_at::at
|
||||
(byte*) print_str_at::str
|
||||
(void()) print_str_lines((byte*) print_str_lines::str)
|
||||
(bool~) print_str_lines::$0
|
||||
(bool~) print_str_lines::$1
|
||||
(bool~) print_str_lines::$2
|
||||
(bool~) print_str_lines::$3
|
||||
(void~) print_str_lines::$4
|
||||
(label) print_str_lines::@1
|
||||
(label) print_str_lines::@10
|
||||
(label) print_str_lines::@2
|
||||
(label) print_str_lines::@3
|
||||
(label) print_str_lines::@4
|
||||
(label) print_str_lines::@5
|
||||
(label) print_str_lines::@6
|
||||
(label) print_str_lines::@7
|
||||
(label) print_str_lines::@8
|
||||
(label) print_str_lines::@9
|
||||
(label) print_str_lines::@return
|
||||
(byte) print_str_lines::ch
|
||||
(byte*) print_str_lines::str
|
||||
(void()) print_str_ln((byte*) print_str_ln::str)
|
||||
(void~) print_str_ln::$0
|
||||
(void~) print_str_ln::$1
|
||||
(label) print_str_ln::@return
|
||||
(byte*) print_str_ln::str
|
||||
(void()) print_sword((signed word) print_sword::w)
|
||||
(bool~) print_sword::$0
|
||||
(bool~) print_sword::$1
|
||||
(void~) print_sword::$2
|
||||
(signed word~) print_sword::$3
|
||||
(word~) print_sword::$4
|
||||
(void~) print_sword::$5
|
||||
(label) print_sword::@1
|
||||
(label) print_sword::@2
|
||||
(label) print_sword::@return
|
||||
(signed word) print_sword::w
|
||||
(void()) print_word((word) print_word::w)
|
||||
(byte~) print_word::$0
|
||||
(void~) print_word::$1
|
||||
(byte~) print_word::$2
|
||||
(void~) print_word::$3
|
||||
(label) print_word::@return
|
||||
(word) print_word::w
|
||||
(byte[]) txt
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in print_screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) print_screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) print_line_cursor ← (byte*) print_screen
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:@1
|
||||
print_str_lines: scope:[print_str_lines] from
|
||||
to:print_str_lines::@1
|
||||
print_str_lines::@1: scope:[print_str_lines] from print_str_lines print_str_lines::@9
|
||||
(bool~) print_str_lines::$0 ← *((byte*) print_str_lines::str) != (byte) '@'
|
||||
if((bool~) print_str_lines::$0) goto print_str_lines::@2
|
||||
to:print_str_lines::@6
|
||||
print_str_lines::@2: scope:[print_str_lines] from print_str_lines::@1 print_str_lines::@7
|
||||
to:print_str_lines::@4
|
||||
print_str_lines::@6: scope:[print_str_lines] from print_str_lines::@1
|
||||
to:print_str_lines::@3
|
||||
print_str_lines::@3: scope:[print_str_lines] from print_str_lines::@10 print_str_lines::@6
|
||||
to:print_str_lines::@return
|
||||
print_str_lines::@7: scope:[print_str_lines] from
|
||||
to:print_str_lines::@2
|
||||
print_str_lines::@4: scope:[print_str_lines] from print_str_lines::@2 print_str_lines::@5
|
||||
(byte) print_str_lines::ch ← *((byte*) print_str_lines::str)
|
||||
(byte*) print_str_lines::str ← ++ (byte*) print_str_lines::str
|
||||
(bool~) print_str_lines::$1 ← (byte) print_str_lines::ch != (byte) '@'
|
||||
(bool~) print_str_lines::$2 ← ! (bool~) print_str_lines::$1
|
||||
if((bool~) print_str_lines::$2) goto print_str_lines::@5
|
||||
to:print_str_lines::@8
|
||||
print_str_lines::@5: scope:[print_str_lines] from print_str_lines::@4 print_str_lines::@8
|
||||
(bool~) print_str_lines::$3 ← (byte) print_str_lines::ch != (byte) '@'
|
||||
if((bool~) print_str_lines::$3) goto print_str_lines::@4
|
||||
to:print_str_lines::@9
|
||||
print_str_lines::@8: scope:[print_str_lines] from print_str_lines::@4
|
||||
*((byte*) print_char_cursor) ← (byte) print_str_lines::ch
|
||||
(byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
to:print_str_lines::@5
|
||||
print_str_lines::@9: scope:[print_str_lines] from print_str_lines::@5
|
||||
(void~) print_str_lines::$4 ← call print_ln
|
||||
to:print_str_lines::@1
|
||||
print_str_lines::@10: scope:[print_str_lines] from
|
||||
to:print_str_lines::@3
|
||||
print_str_lines::@return: scope:[print_str_lines] from print_str_lines::@3
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
print_str_ln: scope:[print_str_ln] from
|
||||
(void~) print_str_ln::$0 ← call print_str (byte*) print_str_ln::str
|
||||
(void~) print_str_ln::$1 ← call print_ln
|
||||
to:print_str_ln::@return
|
||||
print_str_ln::@return: scope:[print_str_ln] from print_str_ln
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
print_str: scope:[print_str] from
|
||||
to:print_str::@1
|
||||
print_str::@1: scope:[print_str] from print_str print_str::@2
|
||||
(bool~) print_str::$0 ← *((byte*) print_str::str) != (byte) '@'
|
||||
if((bool~) print_str::$0) goto print_str::@2
|
||||
to:print_str::@4
|
||||
print_str::@2: scope:[print_str] from print_str::@1 print_str::@5
|
||||
*((byte*) print_char_cursor) ← *((byte*) print_str::str)
|
||||
(byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
(byte*) print_str::str ← ++ (byte*) print_str::str
|
||||
to:print_str::@1
|
||||
print_str::@4: scope:[print_str] from print_str::@1
|
||||
to:print_str::@3
|
||||
print_str::@3: scope:[print_str] from print_str::@4 print_str::@6
|
||||
to:print_str::@return
|
||||
print_str::@5: scope:[print_str] from
|
||||
to:print_str::@2
|
||||
print_str::@6: scope:[print_str] from
|
||||
to:print_str::@3
|
||||
print_str::@return: scope:[print_str] from print_str::@3
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
print_str_at: scope:[print_str_at] from
|
||||
to:print_str_at::@1
|
||||
print_str_at::@1: scope:[print_str_at] from print_str_at print_str_at::@2
|
||||
(bool~) print_str_at::$0 ← *((byte*) print_str_at::str) != (byte) '@'
|
||||
if((bool~) print_str_at::$0) goto print_str_at::@2
|
||||
to:print_str_at::@4
|
||||
print_str_at::@2: scope:[print_str_at] from print_str_at::@1 print_str_at::@5
|
||||
*((byte*) print_str_at::at) ← *((byte*) print_str_at::str)
|
||||
(byte*) print_str_at::at ← ++ (byte*) print_str_at::at
|
||||
(byte*) print_str_at::str ← ++ (byte*) print_str_at::str
|
||||
to:print_str_at::@1
|
||||
print_str_at::@4: scope:[print_str_at] from print_str_at::@1
|
||||
to:print_str_at::@3
|
||||
print_str_at::@3: scope:[print_str_at] from print_str_at::@4 print_str_at::@6
|
||||
to:print_str_at::@return
|
||||
print_str_at::@5: scope:[print_str_at] from
|
||||
to:print_str_at::@2
|
||||
print_str_at::@6: scope:[print_str_at] from
|
||||
to:print_str_at::@3
|
||||
print_str_at::@return: scope:[print_str_at] from print_str_at::@3
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
print_ln: scope:[print_ln] from
|
||||
to:print_ln::@1
|
||||
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
|
||||
(byte*~) print_ln::$0 ← (byte*) print_line_cursor + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*) print_line_cursor ← (byte*~) print_ln::$0
|
||||
(bool~) print_ln::$1 ← (byte*) print_line_cursor < (byte*) print_char_cursor
|
||||
if((bool~) print_ln::$1) goto print_ln::@1
|
||||
to:print_ln::@2
|
||||
print_ln::@2: scope:[print_ln] from print_ln::@1
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:print_ln::@return
|
||||
print_ln::@return: scope:[print_ln] from print_ln::@2
|
||||
return
|
||||
to:@return
|
||||
@5: scope:[] from @4
|
||||
to:@6
|
||||
print_sword: scope:[print_sword] from
|
||||
(bool~) print_sword::$0 ← (signed word) print_sword::w < (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) print_sword::$1 ← ! (bool~) print_sword::$0
|
||||
if((bool~) print_sword::$1) goto print_sword::@1
|
||||
to:print_sword::@2
|
||||
print_sword::@1: scope:[print_sword] from print_sword print_sword::@2
|
||||
(word~) print_sword::$4 ← ((word)) (signed word) print_sword::w
|
||||
(void~) print_sword::$5 ← call print_word (word~) print_sword::$4
|
||||
to:print_sword::@return
|
||||
print_sword::@2: scope:[print_sword] from print_sword
|
||||
(void~) print_sword::$2 ← call print_char (byte) '-'
|
||||
(signed word~) print_sword::$3 ← - (signed word) print_sword::w
|
||||
(signed word) print_sword::w ← (signed word~) print_sword::$3
|
||||
to:print_sword::@1
|
||||
print_sword::@return: scope:[print_sword] from print_sword::@1
|
||||
return
|
||||
to:@return
|
||||
@6: scope:[] from @5
|
||||
to:@7
|
||||
print_sbyte: scope:[print_sbyte] from
|
||||
(bool~) print_sbyte::$0 ← (signed byte) print_sbyte::b < (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) print_sbyte::$1 ← ! (bool~) print_sbyte::$0
|
||||
if((bool~) print_sbyte::$1) goto print_sbyte::@1
|
||||
to:print_sbyte::@2
|
||||
print_sbyte::@1: scope:[print_sbyte] from print_sbyte print_sbyte::@2
|
||||
(byte~) print_sbyte::$4 ← ((byte)) (signed byte) print_sbyte::b
|
||||
(void~) print_sbyte::$5 ← call print_byte (byte~) print_sbyte::$4
|
||||
to:print_sbyte::@return
|
||||
print_sbyte::@2: scope:[print_sbyte] from print_sbyte
|
||||
(void~) print_sbyte::$2 ← call print_char (byte) '-'
|
||||
(signed byte~) print_sbyte::$3 ← - (signed byte) print_sbyte::b
|
||||
(signed byte) print_sbyte::b ← (signed byte~) print_sbyte::$3
|
||||
to:print_sbyte::@1
|
||||
print_sbyte::@return: scope:[print_sbyte] from print_sbyte::@1
|
||||
return
|
||||
to:@return
|
||||
@7: scope:[] from @6
|
||||
to:@8
|
||||
print_word: scope:[print_word] from
|
||||
(byte~) print_word::$0 ← > (word) print_word::w
|
||||
(void~) print_word::$1 ← call print_byte (byte~) print_word::$0
|
||||
(byte~) print_word::$2 ← < (word) print_word::w
|
||||
(void~) print_word::$3 ← call print_byte (byte~) print_word::$2
|
||||
to:print_word::@return
|
||||
print_word::@return: scope:[print_word] from print_word
|
||||
return
|
||||
to:@return
|
||||
@8: scope:[] from @7
|
||||
to:@9
|
||||
print_dword: scope:[print_dword] from
|
||||
(word~) print_dword::$0 ← > (dword) print_dword::dw
|
||||
(void~) print_dword::$1 ← call print_word (word~) print_dword::$0
|
||||
(word~) print_dword::$2 ← < (dword) print_dword::dw
|
||||
(void~) print_dword::$3 ← call print_word (word~) print_dword::$2
|
||||
to:print_dword::@return
|
||||
print_dword::@return: scope:[print_dword] from print_dword
|
||||
return
|
||||
to:@return
|
||||
@9: scope:[] from @8
|
||||
to:@10
|
||||
print_sdword: scope:[print_sdword] from
|
||||
(bool~) print_sdword::$0 ← (signed dword) print_sdword::dw < (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(bool~) print_sdword::$1 ← ! (bool~) print_sdword::$0
|
||||
if((bool~) print_sdword::$1) goto print_sdword::@1
|
||||
to:print_sdword::@2
|
||||
print_sdword::@1: scope:[print_sdword] from print_sdword print_sdword::@2
|
||||
(dword~) print_sdword::$4 ← ((dword)) (signed dword) print_sdword::dw
|
||||
(void~) print_sdword::$5 ← call print_dword (dword~) print_sdword::$4
|
||||
to:print_sdword::@return
|
||||
print_sdword::@2: scope:[print_sdword] from print_sdword
|
||||
(void~) print_sdword::$2 ← call print_char (byte) '-'
|
||||
(signed dword~) print_sdword::$3 ← - (signed dword) print_sdword::dw
|
||||
(signed dword) print_sdword::dw ← (signed dword~) print_sdword::$3
|
||||
to:print_sdword::@1
|
||||
print_sdword::@return: scope:[print_sdword] from print_sdword::@1
|
||||
return
|
||||
to:@return
|
||||
@10: scope:[] from @9
|
||||
(byte[]) print_hextab ← (string) "0123456789abcdef"
|
||||
to:@11
|
||||
print_byte: scope:[print_byte] from
|
||||
(byte~) print_byte::$0 ← (byte) print_byte::b >> (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(void~) print_byte::$1 ← call print_char *((byte[]) print_hextab + (byte~) print_byte::$0)
|
||||
(byte~) print_byte::$2 ← (byte) print_byte::b & (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
(void~) print_byte::$3 ← call print_char *((byte[]) print_hextab + (byte~) print_byte::$2)
|
||||
to:print_byte::@return
|
||||
print_byte::@return: scope:[print_byte] from print_byte
|
||||
return
|
||||
to:@return
|
||||
@11: scope:[] from @10
|
||||
to:@12
|
||||
print_char: scope:[print_char] from
|
||||
*((byte*) print_char_cursor) ← (byte) print_char::ch
|
||||
(byte*) print_char_cursor ← ++ (byte*) print_char_cursor
|
||||
to:print_char::@return
|
||||
print_char::@return: scope:[print_char] from print_char
|
||||
return
|
||||
to:@return
|
||||
@12: scope:[] from @11
|
||||
to:@13
|
||||
print_cls: scope:[print_cls] from
|
||||
(byte*) print_cls::sc ← (byte*) print_screen
|
||||
to:print_cls::@1
|
||||
print_cls::@1: scope:[print_cls] from print_cls print_cls::@1
|
||||
*((byte*) print_cls::sc) ← (byte) ' '
|
||||
(byte*) print_cls::sc ← ++ (byte*) print_cls::sc
|
||||
(byte*~) print_cls::$0 ← (byte*) print_screen + (word/signed word/dword/signed dword) 1000
|
||||
(bool~) print_cls::$1 ← (byte*) print_cls::sc != (byte*~) print_cls::$0
|
||||
if((bool~) print_cls::$1) goto print_cls::@1
|
||||
to:print_cls::@2
|
||||
print_cls::@2: scope:[print_cls] from print_cls::@1
|
||||
(byte*) print_line_cursor ← (byte*) print_screen
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:print_cls::@return
|
||||
print_cls::@return: scope:[print_cls] from print_cls::@2
|
||||
return
|
||||
to:@return
|
||||
@13: scope:[] from @12
|
||||
to:@14
|
||||
print_set_screen: scope:[print_set_screen] from
|
||||
(byte*) print_screen ← (byte*) print_set_screen::screen
|
||||
(byte*) print_line_cursor ← (byte*) print_screen
|
||||
(byte*) print_char_cursor ← (byte*) print_line_cursor
|
||||
to:print_set_screen::@return
|
||||
print_set_screen::@return: scope:[print_set_screen] from print_set_screen
|
||||
return
|
||||
to:@return
|
||||
@14: scope:[] from @13
|
||||
(byte[]) txt ← (string) "camelot@"
|
||||
to:@15
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call print_cls
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(void~) main::$1 ← call print_str (byte[]) txt
|
||||
(void~) main::$2 ← call print_ln
|
||||
*((byte[]) txt + (byte/signed byte/word/signed word/dword/signed dword) 1) ← ++ *((byte[]) txt + (byte/signed byte/word/signed word/dword/signed dword) 1)
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,10)
|
||||
(bool~) main::$3 ← (byte) main::i != rangelast(0,10)
|
||||
if((bool~) main::$3) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@15: scope:[] from @14
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @15
|
||||
|
||||
Removing unused procedure print_str_lines
|
||||
Removing unused procedure print_str_ln
|
||||
Removing unused procedure print_str_at
|
||||
Removing unused procedure print_sword
|
||||
Removing unused procedure print_sbyte
|
||||
Removing unused procedure print_sdword
|
||||
Removing unused procedure print_set_screen
|
||||
Removing unused procedure print_dword
|
||||
Removing unused procedure print_word
|
||||
Removing unused procedure print_byte
|
||||
Removing unused procedure print_char
|
||||
Eliminating unused variable (byte[]) print_hextab and assignment [15] (byte[]) print_hextab ← (string) "0123456789abcdef"
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Eliminating unused variable - keeping the call (void~) main::$2
|
||||
Creating constant string variable for inline (const string) $0 "camelot@"
|
||||
Removing empty block @1
|
||||
Removing empty block @2
|
||||
Removing empty block print_str::@4
|
||||
Removing empty block print_str::@3
|
||||
Removing empty block print_str::@5
|
||||
Removing empty block print_str::@6
|
||||
Removing empty block @3
|
||||
Removing empty block @4
|
||||
Removing empty block @5
|
||||
Removing empty block @6
|
||||
Removing empty block @7
|
||||
Removing empty block @8
|
||||
Removing empty block @9
|
||||
Removing empty block @10
|
||||
Removing empty block @11
|
||||
Removing empty block @12
|
||||
Removing empty block @13
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
print_str modifies print_char_cursor
|
||||
print_ln modifies print_line_cursor
|
||||
print_ln modifies print_char_cursor
|
||||
print_cls modifies print_line_cursor
|
||||
print_cls modifies print_char_cursor
|
||||
main modifies print_line_cursor
|
||||
main modifies print_char_cursor
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) print_line_cursor#0 ← (byte*) print_screen#0
|
||||
@ -946,13 +336,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to print_cls:5 print_str:7 print_ln:9
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 7 initial phi equivalence classes
|
||||
Not coalescing [14] print_char_cursor#29 ← print_line_cursor#1
|
||||
Coalesced [15] print_line_cursor#23 ← print_line_cursor#1
|
||||
@ -974,13 +357,6 @@ Adding NOP phi() at start of main::@4
|
||||
Adding NOP phi() at start of print_ln
|
||||
Adding NOP phi() at start of print_str
|
||||
Adding NOP phi() at start of print_cls
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,45 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-asm.kc
|
||||
|
||||
void main() {
|
||||
asm {
|
||||
lda #'a'
|
||||
ldx #$ff
|
||||
!:
|
||||
sta $0400,x
|
||||
sta $0500,x
|
||||
sta $0600,x
|
||||
sta $0700,x
|
||||
dex
|
||||
bne !-
|
||||
}
|
||||
}
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
asm { lda#'a' ldx#$ff !: sta$0400,x sta$0500,x sta$0600,x sta$0700,x dex bne!- }
|
||||
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
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -71,13 +31,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,60 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-assignment.kc
|
||||
const byte* SCREEN = $400;
|
||||
|
||||
void main() {
|
||||
byte a;
|
||||
for( byte i : 0..39) {
|
||||
SCREEN[i] = a = i;
|
||||
(SCREEN+80)[i] = a;
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(void()) main()
|
||||
(byte*~) main::$0
|
||||
(bool~) main::$1
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::a
|
||||
(byte) main::i
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte) main::a ← (byte) main::i
|
||||
*((byte*) SCREEN + (byte) main::i) ← (byte) main::a
|
||||
(byte*~) main::$0 ← (byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 80
|
||||
*((byte*~) main::$0 + (byte) main::i) ← (byte) main::a
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,39)
|
||||
(bool~) main::$1 ← (byte) main::i != rangelast(0,39)
|
||||
if((bool~) main::$1) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
@ -125,8 +70,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [11] main::a#1 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -135,8 +78,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,97 +1,7 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-function-if.kc
|
||||
// Test inlining a slightly complex print function (containing an if)
|
||||
|
||||
byte* screen = $400;
|
||||
|
||||
void main() {
|
||||
screen[0] = toUpper('c',true);
|
||||
screen[1] = toUpper('m',false);
|
||||
}
|
||||
|
||||
inline byte toUpper(byte ch, bool bo) {
|
||||
byte res = ch;
|
||||
if(bo) {
|
||||
res += $40;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(byte~) main::$1
|
||||
(label) main::@return
|
||||
(byte*) screen
|
||||
inline (byte()) toUpper((byte) toUpper::ch , (bool) toUpper::bo)
|
||||
(bool~) toUpper::$0
|
||||
(label) toUpper::@1
|
||||
(label) toUpper::@2
|
||||
(label) toUpper::@3
|
||||
(label) toUpper::@return
|
||||
(bool) toUpper::bo
|
||||
(byte) toUpper::ch
|
||||
(byte) toUpper::res
|
||||
(byte) toUpper::return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte~) main::$0 ← call toUpper (byte) 'c' true
|
||||
*((byte*) screen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte~) main::$0
|
||||
(byte~) main::$1 ← call toUpper (byte) 'm' false
|
||||
*((byte*) screen + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
toUpper: scope:[toUpper] from
|
||||
(byte) toUpper::res ← (byte) toUpper::ch
|
||||
(bool~) toUpper::$0 ← ! (bool) toUpper::bo
|
||||
if((bool~) toUpper::$0) goto toUpper::@1
|
||||
to:toUpper::@2
|
||||
toUpper::@1: scope:[toUpper] from toUpper toUpper::@2
|
||||
(byte) toUpper::return ← (byte) toUpper::res
|
||||
to:toUpper::@return
|
||||
toUpper::@2: scope:[toUpper] from toUpper
|
||||
(byte) toUpper::res ← (byte) toUpper::res + (byte/signed byte/word/signed word/dword/signed dword) 64
|
||||
to:toUpper::@1
|
||||
toUpper::@return: scope:[toUpper] from toUpper::@1 toUpper::@3
|
||||
(byte) toUpper::return ← (byte) toUpper::return
|
||||
return (byte) toUpper::return
|
||||
to:@return
|
||||
toUpper::@3: scope:[toUpper] from
|
||||
to:toUpper::@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Inlined call (byte~) main::$0 ← call toUpper (byte) 'c' true
|
||||
Inlined call (byte~) main::$1 ← call toUpper (byte) 'm' false
|
||||
Removing unused procedure toUpper
|
||||
Removing empty block main::toUpper1_@3
|
||||
Removing empty block main::toUpper2_@3
|
||||
Removing empty block @1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@2
|
||||
@ -306,7 +216,6 @@ Adding NOP phi() at start of main::toUpper2
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
@ -315,7 +224,6 @@ Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::toUpper1
|
||||
Adding NOP phi() at start of main::toUpper2
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,151 +1,10 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-function-level2.kc
|
||||
// Inline functions in two levels
|
||||
|
||||
void main() {
|
||||
for(byte* sc = $400;sc<$400+1000;sc++) *sc = ' ';
|
||||
line(2, $40, 10, '*');
|
||||
line(4, $80, 15, '.');
|
||||
}
|
||||
|
||||
byte* cur_line = $400;
|
||||
|
||||
inline void line(byte xpos, byte xadd, byte ysize, byte ch) {
|
||||
cur_line = $400;
|
||||
word pos = {xpos, 0};
|
||||
for( byte i=0;i<ysize; i++) {
|
||||
plot(>pos, ch);
|
||||
pos += xadd;
|
||||
cur_line += 40;
|
||||
}
|
||||
}
|
||||
|
||||
inline void plot(byte xpos, byte ch) {
|
||||
*(cur_line+xpos) = ch;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Adding pre/post-modifier (byte*) main::sc ← ++ (byte*) main::sc
|
||||
Adding pre/post-modifier (byte) line::i ← ++ (byte) line::i
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) cur_line
|
||||
inline (void()) line((byte) line::xpos , (byte) line::xadd , (byte) line::ysize , (byte) line::ch)
|
||||
(byte~) line::$0
|
||||
(void~) line::$1
|
||||
(bool~) line::$2
|
||||
(label) line::@1
|
||||
(label) line::@2
|
||||
(label) line::@return
|
||||
(byte) line::ch
|
||||
(byte) line::i
|
||||
(word) line::pos
|
||||
(byte) line::xadd
|
||||
(byte) line::xpos
|
||||
(byte) line::ysize
|
||||
(void()) main()
|
||||
(word/signed word/dword/signed dword~) main::$0
|
||||
(bool~) main::$1
|
||||
(void~) main::$2
|
||||
(void~) main::$3
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte*) main::sc
|
||||
inline (void()) plot((byte) plot::xpos , (byte) plot::ch)
|
||||
(byte*~) plot::$0
|
||||
(label) plot::@return
|
||||
(byte) plot::ch
|
||||
(byte) plot::xpos
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::sc ← ((byte*)) 1024
|
||||
Promoting word/signed word/dword/signed dword to byte* in cur_line ← ((byte*)) 1024
|
||||
Promoting word/signed word/dword/signed dword to byte* in cur_line ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::sc ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) main::sc) ← (byte) ' '
|
||||
(byte*) main::sc ← ++ (byte*) main::sc
|
||||
(word/signed word/dword/signed dword~) main::$0 ← (word/signed word/dword/signed dword) 1024 + (word/signed word/dword/signed dword) 1000
|
||||
(bool~) main::$1 ← (byte*) main::sc < (word/signed word/dword/signed dword~) main::$0
|
||||
if((bool~) main::$1) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
(void~) main::$2 ← call line (byte/signed byte/word/signed word/dword/signed dword) 2 (byte/signed byte/word/signed word/dword/signed dword) 64 (byte/signed byte/word/signed word/dword/signed dword) 10 (byte) '*'
|
||||
(void~) main::$3 ← call line (byte/signed byte/word/signed word/dword/signed dword) 4 (byte/word/signed word/dword/signed dword) 128 (byte/signed byte/word/signed word/dword/signed dword) 15 (byte) '.'
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
(byte*) cur_line ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@2
|
||||
line: scope:[line] from
|
||||
(byte*) cur_line ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(word) line::pos ← { (byte) line::xpos, (byte/signed byte/word/signed word/dword/signed dword) 0 }
|
||||
(byte) line::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:line::@1
|
||||
line::@1: scope:[line] from line line::@1
|
||||
(byte~) line::$0 ← > (word) line::pos
|
||||
(void~) line::$1 ← call plot (byte~) line::$0 (byte) line::ch
|
||||
(word) line::pos ← (word) line::pos + (byte) line::xadd
|
||||
(byte*) cur_line ← (byte*) cur_line + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte) line::i ← ++ (byte) line::i
|
||||
(bool~) line::$2 ← (byte) line::i < (byte) line::ysize
|
||||
if((bool~) line::$2) goto line::@1
|
||||
to:line::@2
|
||||
line::@2: scope:[line] from line::@1
|
||||
to:line::@return
|
||||
line::@return: scope:[line] from line::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
plot: scope:[plot] from
|
||||
(byte*~) plot::$0 ← (byte*) cur_line + (byte) plot::xpos
|
||||
*((byte*~) plot::$0) ← (byte) plot::ch
|
||||
to:plot::@return
|
||||
plot::@return: scope:[plot] from plot
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @3
|
||||
|
||||
Inlined call call line (byte/signed byte/word/signed word/dword/signed dword) 2 (byte/signed byte/word/signed word/dword/signed dword) 64 (byte/signed byte/word/signed word/dword/signed dword) 10 (byte) '*'
|
||||
Inlined call call plot (byte~) main::line1_$0 (byte) main::line1_ch
|
||||
Inlined call call line (byte/signed byte/word/signed word/dword/signed dword) 4 (byte/word/signed word/dword/signed dword) 128 (byte/signed byte/word/signed word/dword/signed dword) 15 (byte) '.'
|
||||
Inlined call call plot (byte~) main::line2_$0 (byte) main::line2_ch
|
||||
Inlined call call plot (byte~) line::$0 (byte) line::ch
|
||||
Removing unused procedure line
|
||||
Removing unused procedure plot
|
||||
Removing empty block main::plot1_@return
|
||||
Removing empty block main::line1_@2
|
||||
Removing empty block main::line1_@return
|
||||
Removing empty block main::plot2_@return
|
||||
Removing empty block main::line2_@2
|
||||
Removing empty block main::line2_@return
|
||||
Removing empty block main::@5
|
||||
Removing empty block @2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
main modifies cur_line
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @3
|
||||
@ -438,12 +297,6 @@ Alias (byte*) cur_line#11 = (byte*) cur_line#3 (byte*) cur_line#4
|
||||
Alias (byte*) cur_line#15 = (byte*) cur_line#5
|
||||
Alias (byte*) cur_line#12 = (byte*) cur_line#6
|
||||
Successful SSA optimization Pass2AliasElimination
|
||||
Not aliassing identity: main::line1_ch#1 main::line1_ch#1
|
||||
Not aliassing identity: main::line1_xadd#1 main::line1_xadd#1
|
||||
Not aliassing identity: main::line1_ysize#1 main::line1_ysize#1
|
||||
Not aliassing identity: main::line2_ch#1 main::line2_ch#1
|
||||
Not aliassing identity: main::line2_xadd#1 main::line2_xadd#1
|
||||
Not aliassing identity: main::line2_ysize#1 main::line2_ysize#1
|
||||
Self Phi Eliminated (byte) main::line1_ch#1
|
||||
Self Phi Eliminated (byte) main::line1_xadd#1
|
||||
Self Phi Eliminated (byte) main::line1_ysize#1
|
||||
@ -527,13 +380,6 @@ Adding NOP phi() at start of main::line2
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 7 initial phi equivalence classes
|
||||
Coalesced [28] main::line2_pos#5 ← main::line2_pos#1
|
||||
Coalesced [29] cur_line#17 ← cur_line#11
|
||||
@ -552,13 +398,6 @@ Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::line1
|
||||
Adding NOP phi() at start of main::line2
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,86 +1,8 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-function-min.kc
|
||||
// Test minimal inline function
|
||||
|
||||
byte* screen = $0400;
|
||||
|
||||
void main() {
|
||||
screen[0] = sum(2, 1);
|
||||
screen[1] = sum(10, 3);
|
||||
screen[2] = sum(4, 8);
|
||||
}
|
||||
|
||||
inline byte sum( byte a, byte b) {
|
||||
return a+b;
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(byte~) main::$1
|
||||
(byte~) main::$2
|
||||
(label) main::@return
|
||||
(byte*) screen
|
||||
inline (byte()) sum((byte) sum::a , (byte) sum::b)
|
||||
(byte~) sum::$0
|
||||
(label) sum::@1
|
||||
(label) sum::@return
|
||||
(byte) sum::a
|
||||
(byte) sum::b
|
||||
(byte) sum::return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte~) main::$0 ← call sum (byte/signed byte/word/signed word/dword/signed dword) 2 (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
*((byte*) screen + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte~) main::$0
|
||||
(byte~) main::$1 ← call sum (byte/signed byte/word/signed word/dword/signed dword) 10 (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
*((byte*) screen + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$1
|
||||
(byte~) main::$2 ← call sum (byte/signed byte/word/signed word/dword/signed dword) 4 (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
*((byte*) screen + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
sum: scope:[sum] from
|
||||
(byte~) sum::$0 ← (byte) sum::a + (byte) sum::b
|
||||
(byte) sum::return ← (byte~) sum::$0
|
||||
to:sum::@return
|
||||
sum::@return: scope:[sum] from sum sum::@1
|
||||
(byte) sum::return ← (byte) sum::return
|
||||
return (byte) sum::return
|
||||
to:@return
|
||||
sum::@1: scope:[sum] from
|
||||
to:sum::@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Inlined call (byte~) main::$0 ← call sum (byte/signed byte/word/signed word/dword/signed dword) 2 (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
Inlined call (byte~) main::$1 ← call sum (byte/signed byte/word/signed word/dword/signed dword) 10 (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
Inlined call (byte~) main::$2 ← call sum (byte/signed byte/word/signed word/dword/signed dword) 4 (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Removing unused procedure sum
|
||||
Removing empty block main::sum1_@1
|
||||
Removing empty block main::sum2_@1
|
||||
Removing empty block main::sum3_@1
|
||||
Removing empty block @1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@2
|
||||
@ -277,7 +199,6 @@ Adding NOP phi() at start of main::sum3
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
@ -287,7 +208,6 @@ Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::sum1
|
||||
Adding NOP phi() at start of main::sum2
|
||||
Adding NOP phi() at start of main::sum3
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,102 +1,7 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-function-print.kc
|
||||
// TEst inlining a slightly complex print function (containing a loop)
|
||||
|
||||
byte* screen = $400;
|
||||
|
||||
void main() {
|
||||
byte* hello = "hello world!@";
|
||||
print(screen, hello);
|
||||
print(screen+2*40, hello);
|
||||
}
|
||||
|
||||
inline void print(byte* at, byte* msg) {
|
||||
byte j=0;
|
||||
for(byte i=0; msg[i]!='@'; i++) {
|
||||
at[j] = msg[i];
|
||||
j += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Adding pre/post-modifier (byte) print::i ← ++ (byte) print::i
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) main::$1
|
||||
(byte*~) main::$2
|
||||
(void~) main::$3
|
||||
(label) main::@return
|
||||
(byte*) main::hello
|
||||
inline (void()) print((byte*) print::at , (byte*) print::msg)
|
||||
(bool~) print::$0
|
||||
(label) print::@1
|
||||
(label) print::@2
|
||||
(label) print::@return
|
||||
(byte*) print::at
|
||||
(byte) print::i
|
||||
(byte) print::j
|
||||
(byte*) print::msg
|
||||
(byte*) screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::hello ← (string) "hello world!@"
|
||||
(void~) main::$0 ← call print (byte*) screen (byte*) main::hello
|
||||
(byte/signed byte/word/signed word/dword/signed dword~) main::$1 ← (byte/signed byte/word/signed word/dword/signed dword) 2 * (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*~) main::$2 ← (byte*) screen + (byte/signed byte/word/signed word/dword/signed dword~) main::$1
|
||||
(void~) main::$3 ← call print (byte*~) main::$2 (byte*) main::hello
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
print: scope:[print] from
|
||||
(byte) print::j ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) print::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:print::@1
|
||||
print::@1: scope:[print] from print print::@1
|
||||
*((byte*) print::at + (byte) print::j) ← *((byte*) print::msg + (byte) print::i)
|
||||
(byte) print::j ← (byte) print::j + (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) print::i ← ++ (byte) print::i
|
||||
(bool~) print::$0 ← *((byte*) print::msg + (byte) print::i) != (byte) '@'
|
||||
if((bool~) print::$0) goto print::@1
|
||||
to:print::@2
|
||||
print::@2: scope:[print] from print::@1
|
||||
to:print::@return
|
||||
print::@return: scope:[print] from print::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Inlined call call print (byte*) screen (byte*) main::hello
|
||||
Inlined call call print (byte*~) main::$2 (byte*) main::hello
|
||||
Removing unused procedure print
|
||||
Creating constant string variable for inline (const string) main::$4 "hello world!@"
|
||||
Removing empty block main::print1_@2
|
||||
Removing empty block main::print1_@return
|
||||
Removing empty block main::print2_@2
|
||||
Removing empty block main::print2_@return
|
||||
Removing empty block main::@2
|
||||
Removing empty block @1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@2
|
||||
@ -291,11 +196,6 @@ Adding NOP phi() at start of main::print2
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 4 initial phi equivalence classes
|
||||
Coalesced [18] main::print2_i#3 ← main::print2_i#1
|
||||
Coalesced [19] main::print2_j#3 ← main::print2_j#1
|
||||
@ -310,9 +210,6 @@ Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::print1
|
||||
Adding NOP phi() at start of main::print2
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,200 +1,7 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-function.kc
|
||||
// Test inline function
|
||||
// Splits screen so upper half is lower case and lower half lower case
|
||||
|
||||
byte* RASTER = $d012;
|
||||
byte* D018 = $d018;
|
||||
byte* BGCOL = $d021;
|
||||
|
||||
byte* screen = $0400;
|
||||
byte* charset1 = $1000;
|
||||
byte* charset2 = $1800;
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
while(true) {
|
||||
while(*RASTER!=$ff) {}
|
||||
*D018 = toD018(screen, charset1);
|
||||
*BGCOL = $6;
|
||||
while(*RASTER!=$62) {}
|
||||
*D018 = toD018(screen, charset2);
|
||||
*BGCOL = $b;
|
||||
}
|
||||
}
|
||||
|
||||
inline byte toD018( byte* screen, byte* charset) {
|
||||
return (byte)(((word)screen/$40)|((word)charset/$400));
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte*) D018
|
||||
(byte*) RASTER
|
||||
(byte*) charset1
|
||||
(byte*) charset2
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(byte~) main::$1
|
||||
(bool~) main::$2
|
||||
(byte~) main::$3
|
||||
(label) main::@1
|
||||
(label) main::@10
|
||||
(label) main::@11
|
||||
(label) main::@12
|
||||
(label) main::@13
|
||||
(label) main::@14
|
||||
(label) main::@15
|
||||
(label) main::@16
|
||||
(label) main::@17
|
||||
(label) main::@18
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@7
|
||||
(label) main::@8
|
||||
(label) main::@9
|
||||
(label) main::@return
|
||||
(byte*) screen
|
||||
inline (byte()) toD018((byte*) toD018::screen , (byte*) toD018::charset)
|
||||
(word~) toD018::$0
|
||||
(word/signed dword/dword~) toD018::$1
|
||||
(word~) toD018::$2
|
||||
(word/signed dword/dword~) toD018::$3
|
||||
(word/dword~) toD018::$4
|
||||
(byte~) toD018::$5
|
||||
(label) toD018::@1
|
||||
(label) toD018::@return
|
||||
(byte*) toD018::charset
|
||||
(byte) toD018::return
|
||||
(byte*) toD018::screen
|
||||
|
||||
Promoting word/dword/signed dword to byte* in RASTER ← ((byte*)) 53266
|
||||
Promoting word/dword/signed dword to byte* in D018 ← ((byte*)) 53272
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53281
|
||||
Promoting word/signed word/dword/signed dword to byte* in screen ← ((byte*)) 1024
|
||||
Promoting word/signed word/dword/signed dword to byte* in charset1 ← ((byte*)) 4096
|
||||
Promoting word/signed word/dword/signed dword to byte* in charset2 ← ((byte*)) 6144
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) RASTER ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) D018 ← ((byte*)) (word/dword/signed dword) 53272
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte*) screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) charset1 ← ((byte*)) (word/signed word/dword/signed dword) 4096
|
||||
(byte*) charset2 ← ((byte*)) (word/signed word/dword/signed dword) 6144
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
asm { sei }
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@9
|
||||
if(true) goto main::@2
|
||||
to:main::@10
|
||||
main::@2: scope:[main] from main::@1 main::@11
|
||||
to:main::@4
|
||||
main::@10: scope:[main] from main::@1
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@10 main::@18
|
||||
to:main::@return
|
||||
main::@11: scope:[main] from
|
||||
to:main::@2
|
||||
main::@4: scope:[main] from main::@2 main::@5
|
||||
(bool~) main::$0 ← *((byte*) RASTER) != (byte/word/signed word/dword/signed dword) 255
|
||||
if((bool~) main::$0) goto main::@5
|
||||
to:main::@12
|
||||
main::@5: scope:[main] from main::@13 main::@4
|
||||
to:main::@4
|
||||
main::@12: scope:[main] from main::@4
|
||||
to:main::@6
|
||||
main::@6: scope:[main] from main::@12 main::@14
|
||||
(byte~) main::$1 ← call toD018 (byte*) screen (byte*) charset1
|
||||
*((byte*) D018) ← (byte~) main::$1
|
||||
*((byte*) BGCOL) ← (byte/signed byte/word/signed word/dword/signed dword) 6
|
||||
to:main::@7
|
||||
main::@13: scope:[main] from
|
||||
to:main::@5
|
||||
main::@14: scope:[main] from
|
||||
to:main::@6
|
||||
main::@7: scope:[main] from main::@6 main::@8
|
||||
(bool~) main::$2 ← *((byte*) RASTER) != (byte/signed byte/word/signed word/dword/signed dword) 98
|
||||
if((bool~) main::$2) goto main::@8
|
||||
to:main::@15
|
||||
main::@8: scope:[main] from main::@16 main::@7
|
||||
to:main::@7
|
||||
main::@15: scope:[main] from main::@7
|
||||
to:main::@9
|
||||
main::@9: scope:[main] from main::@15 main::@17
|
||||
(byte~) main::$3 ← call toD018 (byte*) screen (byte*) charset2
|
||||
*((byte*) D018) ← (byte~) main::$3
|
||||
*((byte*) BGCOL) ← (byte/signed byte/word/signed word/dword/signed dword) 11
|
||||
to:main::@1
|
||||
main::@16: scope:[main] from
|
||||
to:main::@8
|
||||
main::@17: scope:[main] from
|
||||
to:main::@9
|
||||
main::@18: scope:[main] from
|
||||
to:main::@3
|
||||
main::@return: scope:[main] from main::@3
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
toD018: scope:[toD018] from
|
||||
(word~) toD018::$0 ← ((word)) (byte*) toD018::screen
|
||||
(word/signed dword/dword~) toD018::$1 ← (word~) toD018::$0 / (byte/signed byte/word/signed word/dword/signed dword) 64
|
||||
(word~) toD018::$2 ← ((word)) (byte*) toD018::charset
|
||||
(word/signed dword/dword~) toD018::$3 ← (word~) toD018::$2 / (word/signed word/dword/signed dword) 1024
|
||||
(word/dword~) toD018::$4 ← (word/signed dword/dword~) toD018::$1 | (word/signed dword/dword~) toD018::$3
|
||||
(byte~) toD018::$5 ← ((byte)) (word/dword~) toD018::$4
|
||||
(byte) toD018::return ← (byte~) toD018::$5
|
||||
to:toD018::@return
|
||||
toD018::@return: scope:[toD018] from toD018 toD018::@1
|
||||
(byte) toD018::return ← (byte) toD018::return
|
||||
return (byte) toD018::return
|
||||
to:@return
|
||||
toD018::@1: scope:[toD018] from
|
||||
to:toD018::@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Inlined call (byte~) main::$1 ← call toD018 (byte*) screen (byte*) charset1
|
||||
Inlined call (byte~) main::$3 ← call toD018 (byte*) screen (byte*) charset2
|
||||
Removing unused procedure toD018
|
||||
Removing empty block main::@10
|
||||
Removing empty block main::@3
|
||||
Removing empty block main::@11
|
||||
Removing empty block main::@12
|
||||
Removing empty block main::toD0181_@1
|
||||
Removing empty block main::@13
|
||||
Removing empty block main::@14
|
||||
Removing empty block main::@15
|
||||
Removing empty block main::toD0182_@1
|
||||
Removing empty block main::@16
|
||||
Removing empty block main::@17
|
||||
Removing empty block main::@18
|
||||
Removing empty block @1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) D018#0 ← ((byte*)) (word/dword/signed dword) 53272
|
||||
@ -702,7 +509,6 @@ Adding NOP phi() at start of main::toD0182
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
@ -710,7 +516,6 @@ Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main::toD0181
|
||||
Adding NOP phi() at start of main::toD0182
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,145 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-string-2.kc
|
||||
// Inline Strings in assignments
|
||||
|
||||
void main() {
|
||||
print_msg(1);
|
||||
print_msg(2);
|
||||
}
|
||||
|
||||
void print_msg(byte idx) {
|
||||
byte* msg;
|
||||
if(idx==1) {
|
||||
msg = "Hello @";
|
||||
} else {
|
||||
msg = "World!@";
|
||||
}
|
||||
print(msg);
|
||||
}
|
||||
|
||||
byte* screen = $0400;
|
||||
void print(byte* msg) {
|
||||
while(*msg!='@') {
|
||||
*(screen++) = *(msg++);
|
||||
}
|
||||
}
|
||||
|
||||
Adding pre/post-modifier (byte*) screen ← ++ (byte*) screen
|
||||
Adding pre/post-modifier (byte*) print::msg ← ++ (byte*) print::msg
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(label) main::@return
|
||||
(void()) print((byte*) print::msg)
|
||||
(bool~) print::$0
|
||||
(label) print::@1
|
||||
(label) print::@2
|
||||
(label) print::@3
|
||||
(label) print::@4
|
||||
(label) print::@5
|
||||
(label) print::@6
|
||||
(label) print::@return
|
||||
(byte*) print::msg
|
||||
(void()) print_msg((byte) print_msg::idx)
|
||||
(bool~) print_msg::$0
|
||||
(void~) print_msg::$1
|
||||
(label) print_msg::@1
|
||||
(label) print_msg::@2
|
||||
(label) print_msg::@3
|
||||
(label) print_msg::@4
|
||||
(label) print_msg::@return
|
||||
(byte) print_msg::idx
|
||||
(byte*) print_msg::msg
|
||||
(byte*) screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call print_msg (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(void~) main::$1 ← call print_msg (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
print_msg: scope:[print_msg] from
|
||||
(bool~) print_msg::$0 ← (byte) print_msg::idx == (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
if((bool~) print_msg::$0) goto print_msg::@1
|
||||
to:print_msg::@3
|
||||
print_msg::@1: scope:[print_msg] from print_msg print_msg::@4
|
||||
(byte*) print_msg::msg ← (string) "Hello @"
|
||||
to:print_msg::@2
|
||||
print_msg::@3: scope:[print_msg] from print_msg
|
||||
(byte*) print_msg::msg ← (string) "World!@"
|
||||
to:print_msg::@2
|
||||
print_msg::@2: scope:[print_msg] from print_msg::@1 print_msg::@3
|
||||
(void~) print_msg::$1 ← call print (byte*) print_msg::msg
|
||||
to:print_msg::@return
|
||||
print_msg::@4: scope:[print_msg] from
|
||||
to:print_msg::@1
|
||||
print_msg::@return: scope:[print_msg] from print_msg::@2
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
(byte*) screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@3
|
||||
print: scope:[print] from
|
||||
to:print::@1
|
||||
print::@1: scope:[print] from print print::@2
|
||||
(bool~) print::$0 ← *((byte*) print::msg) != (byte) '@'
|
||||
if((bool~) print::$0) goto print::@2
|
||||
to:print::@4
|
||||
print::@2: scope:[print] from print::@1 print::@5
|
||||
*((byte*) screen) ← *((byte*) print::msg)
|
||||
(byte*) screen ← ++ (byte*) screen
|
||||
(byte*) print::msg ← ++ (byte*) print::msg
|
||||
to:print::@1
|
||||
print::@4: scope:[print] from print::@1
|
||||
to:print::@3
|
||||
print::@3: scope:[print] from print::@4 print::@6
|
||||
to:print::@return
|
||||
print::@5: scope:[print] from
|
||||
to:print::@2
|
||||
print::@6: scope:[print] from
|
||||
to:print::@3
|
||||
print::@return: scope:[print] from print::@3
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @3
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Eliminating unused variable - keeping the call (void~) print_msg::$1
|
||||
Creating constant string variable for inline (const string) print_msg::$2 "Hello @"
|
||||
Creating constant string variable for inline (const string) print_msg::$3 "World!@"
|
||||
Removing empty block @1
|
||||
Removing empty block print_msg::@4
|
||||
Removing empty block print::@4
|
||||
Removing empty block print::@3
|
||||
Removing empty block print::@5
|
||||
Removing empty block print::@6
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
main modifies screen
|
||||
print_msg modifies screen
|
||||
print modifies screen
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@2
|
||||
main: scope:[main] from @3
|
||||
@ -350,12 +210,6 @@ Calls in [] to main:2
|
||||
Calls in [main] to print_msg:5 print_msg:7
|
||||
Calls in [print_msg] to print:14
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 5 initial phi equivalence classes
|
||||
Coalesced [6] screen#25 ← screen#14
|
||||
Coalesced [16] print::msg#5 ← print::msg#0
|
||||
@ -370,12 +224,6 @@ Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@1
|
||||
Adding NOP phi() at start of print_msg::@3
|
||||
Adding NOP phi() at start of print
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,65 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-string-3.kc
|
||||
// Test assigning address of inline string to pointer
|
||||
// The result should be an labelled .text in the ASM
|
||||
// Erroneously tries to inline the string completely leading to a CompileError
|
||||
void main() {
|
||||
const byte[] STRING = "camelot";
|
||||
const byte* PTR = $9ffe;
|
||||
*PTR = <STRING;
|
||||
*(PTR+1)= >STRING;
|
||||
byte* ptr = (byte*) { *(PTR+1), *PTR };
|
||||
const byte* SCREEN = $400;
|
||||
*SCREEN = *ptr;
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(byte*~) main::$1
|
||||
(byte~) main::$2
|
||||
(byte*~) main::$3
|
||||
(byte*~) main::$4
|
||||
(label) main::@return
|
||||
(byte*) main::PTR
|
||||
(byte*) main::SCREEN
|
||||
(byte[]) main::STRING
|
||||
(byte*) main::ptr
|
||||
|
||||
Promoting word/dword/signed dword to byte* in main::PTR ← ((byte*)) 40958
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte[]) main::STRING ← (string) "camelot"
|
||||
(byte*) main::PTR ← ((byte*)) (word/dword/signed dword) 40958
|
||||
(byte~) main::$0 ← < (byte[]) main::STRING
|
||||
*((byte*) main::PTR) ← (byte~) main::$0
|
||||
(byte*~) main::$1 ← (byte*) main::PTR + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte~) main::$2 ← > (byte[]) main::STRING
|
||||
*((byte*~) main::$1) ← (byte~) main::$2
|
||||
(byte*~) main::$3 ← (byte*) main::PTR + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte*~) main::$4 ← ((byte*)) { *((byte*~) main::$3), *((byte*) main::PTR) }
|
||||
(byte*) main::ptr ← (byte*~) main::$4
|
||||
(byte*) main::SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
*((byte*) main::SCREEN) ← *((byte*) main::ptr)
|
||||
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) main::$5 "camelot"
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -137,15 +77,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,110 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-string.kc
|
||||
// Inline Strings in method calls are automatically converted to local constant variables byte[] st = "..."; - generating an ASM .text).
|
||||
|
||||
byte[] msg1 = "message 1 @";
|
||||
void main() {
|
||||
byte[] msg2 = "message 2 @";
|
||||
print(msg1);
|
||||
print(msg2);
|
||||
print("message 3 @");
|
||||
}
|
||||
|
||||
byte* screen = $0400;
|
||||
void print(byte* msg) {
|
||||
while(*msg!='@') {
|
||||
*(screen++) = *(msg++);
|
||||
}
|
||||
}
|
||||
|
||||
Adding pre/post-modifier (byte*) screen ← ++ (byte*) screen
|
||||
Adding pre/post-modifier (byte*) print::msg ← ++ (byte*) print::msg
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(void~) main::$2
|
||||
(label) main::@return
|
||||
(byte[]) main::msg2
|
||||
(byte[]) msg1
|
||||
(void()) print((byte*) print::msg)
|
||||
(bool~) print::$0
|
||||
(label) print::@1
|
||||
(label) print::@2
|
||||
(label) print::@3
|
||||
(label) print::@4
|
||||
(label) print::@5
|
||||
(label) print::@6
|
||||
(label) print::@return
|
||||
(byte*) print::msg
|
||||
(byte*) screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in screen ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte[]) msg1 ← (string) "message 1 @"
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte[]) main::msg2 ← (string) "message 2 @"
|
||||
(void~) main::$0 ← call print (byte[]) msg1
|
||||
(void~) main::$1 ← call print (byte[]) main::msg2
|
||||
(void~) main::$2 ← call print (string) "message 3 @"
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
(byte*) screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@2
|
||||
print: scope:[print] from
|
||||
to:print::@1
|
||||
print::@1: scope:[print] from print print::@2
|
||||
(bool~) print::$0 ← *((byte*) print::msg) != (byte) '@'
|
||||
if((bool~) print::$0) goto print::@2
|
||||
to:print::@4
|
||||
print::@2: scope:[print] from print::@1 print::@5
|
||||
*((byte*) screen) ← *((byte*) print::msg)
|
||||
(byte*) screen ← ++ (byte*) screen
|
||||
(byte*) print::msg ← ++ (byte*) print::msg
|
||||
to:print::@1
|
||||
print::@4: scope:[print] from print::@1
|
||||
to:print::@3
|
||||
print::@3: scope:[print] from print::@4 print::@6
|
||||
to:print::@return
|
||||
print::@5: scope:[print] from
|
||||
to:print::@2
|
||||
print::@6: scope:[print] from
|
||||
to:print::@3
|
||||
print::@return: scope:[print] from print::@3
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Eliminating unused variable - keeping the call (void~) main::$2
|
||||
Creating constant string variable for inline (const string) $0 "message 1 @"
|
||||
Creating constant string variable for inline (const string) main::$3 "message 2 @"
|
||||
Creating constant string variable for inline (const string) main::msg "message 3 @"
|
||||
Removing empty block print::@4
|
||||
Removing empty block print::@3
|
||||
Removing empty block print::@5
|
||||
Removing empty block print::@6
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
main modifies screen
|
||||
print modifies screen
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte[]) msg1#0 ← (const string) $0
|
||||
to:@1
|
||||
@ -269,10 +164,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to print:5 print:7 print:9
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 4 initial phi equivalence classes
|
||||
Coalesced [6] screen#19 ← screen#12
|
||||
Coalesced (already) [8] screen#20 ← screen#12
|
||||
@ -287,10 +178,6 @@ Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@1
|
||||
Adding NOP phi() at start of main::@2
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,89 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inline-word.kc
|
||||
const byte* SCREEN = $400;
|
||||
|
||||
void main() {
|
||||
byte[] his = { >SCREEN, >SCREEN+$100, >SCREEN+$200 }; // constant array
|
||||
for( byte h: 0..2) {
|
||||
for (byte l: 4..7) {
|
||||
word w = { his[h], l }; // inline word
|
||||
byte* sc = (byte*)w;
|
||||
*sc = '*';
|
||||
}
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(byte*~) main::$1
|
||||
(byte~) main::$2
|
||||
(byte*~) main::$3
|
||||
(byte~) main::$4
|
||||
(byte*~) main::$5
|
||||
(bool~) main::$6
|
||||
(bool~) main::$7
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte) main::h
|
||||
(byte[]) main::his
|
||||
(byte) main::l
|
||||
(byte*) main::sc
|
||||
(word) main::w
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte~) main::$0 ← > (byte*) SCREEN
|
||||
(byte*~) main::$1 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 256
|
||||
(byte~) main::$2 ← > (byte*~) main::$1
|
||||
(byte*~) main::$3 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 512
|
||||
(byte~) main::$4 ← > (byte*~) main::$3
|
||||
(byte[]) main::his ← { (byte~) main::$0, (byte~) main::$2, (byte~) main::$4 }
|
||||
(byte) main::h ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@3
|
||||
(byte) main::l ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1 main::@2
|
||||
(word) main::w ← { *((byte[]) main::his + (byte) main::h), (byte) main::l }
|
||||
(byte*~) main::$5 ← ((byte*)) (word) main::w
|
||||
(byte*) main::sc ← (byte*~) main::$5
|
||||
*((byte*) main::sc) ← (byte) '*'
|
||||
(byte) main::l ← (byte) main::l + rangenext(4,7)
|
||||
(bool~) main::$6 ← (byte) main::l != rangelast(4,7)
|
||||
if((bool~) main::$6) goto main::@2
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2
|
||||
(byte) main::h ← (byte) main::h + rangenext(0,2)
|
||||
(bool~) main::$7 ← (byte) main::h != rangelast(0,2)
|
||||
if((bool~) main::$7) goto main::@1
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
to:@1
|
||||
@ -218,11 +134,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 2 initial phi equivalence classes
|
||||
Coalesced [14] main::h#5 ← main::h#1
|
||||
Coalesced [15] main::l#3 ← main::l#1
|
||||
@ -233,11 +144,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,72 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inlinearrayproblem.kc
|
||||
// Arrays / strings allocated inline destroy functions (because they are allocated where the call enters.
|
||||
// The following places the text at the start of the main-function - and JSR's straight into the text - not the code.
|
||||
|
||||
byte* SCREEN = $0400;
|
||||
byte* SCREEN2 = $0400+$28;
|
||||
void main() {
|
||||
byte[] txt = "qwe";
|
||||
byte[] data = { 1, 2, 3 };
|
||||
for( byte i : 0..3) {
|
||||
SCREEN[i] = txt[i];
|
||||
SCREEN2[i] = data[i];
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(word/signed word/dword/signed dword~) $0
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(byte*) SCREEN2
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte[]) main::data
|
||||
(byte) main::i
|
||||
(byte[]) main::txt
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN2 ← ((byte*)) $0
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(word/signed word/dword/signed dword~) $0 ← (word/signed word/dword/signed dword) 1024 + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
(byte*) SCREEN2 ← ((byte*)) (word/signed word/dword/signed dword~) $0
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte[]) main::txt ← (string) "qwe"
|
||||
(byte[]) main::data ← { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 3 }
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
*((byte*) SCREEN + (byte) main::i) ← *((byte[]) main::txt + (byte) main::i)
|
||||
*((byte*) SCREEN2 + (byte) main::i) ← *((byte[]) main::data + (byte) main::i)
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,3)
|
||||
(bool~) main::$0 ← (byte) main::i != rangelast(0,3)
|
||||
if((bool~) main::$0) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Creating constant string variable for inline (const string) main::$1 "qwe"
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(word/signed word/dword/signed dword~) $0 ← (word/signed word/dword/signed dword) 1024 + (byte/signed byte/word/signed word/dword/signed dword) 40
|
||||
@ -169,8 +102,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [11] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -179,8 +110,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,94 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inmem-const-array.kc
|
||||
byte WHITE = 1;
|
||||
byte RED = 2;
|
||||
byte GREEN = 5;
|
||||
|
||||
void main() {
|
||||
byte[] colseq = { WHITE, RED, GREEN };
|
||||
byte* screen = $0400;
|
||||
byte* cols = $d800;
|
||||
byte j = 0;
|
||||
for( byte i : 0..39) {
|
||||
screen[i] = '*';
|
||||
cols[i] = colseq[j];
|
||||
if(++j==3) {
|
||||
j=0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Adding pre/post-modifier (byte) main::j ← ++ (byte) main::j
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte) GREEN
|
||||
(byte) RED
|
||||
(byte) WHITE
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(bool~) main::$1
|
||||
(bool~) main::$2
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte*) main::cols
|
||||
(byte[]) main::colseq
|
||||
(byte) main::i
|
||||
(byte) main::j
|
||||
(byte*) main::screen
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::screen ← ((byte*)) 1024
|
||||
Promoting word/dword/signed dword to byte* in main::cols ← ((byte*)) 55296
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte[]) main::colseq ← { (byte) WHITE, (byte) RED, (byte) GREEN }
|
||||
(byte*) main::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte*) main::cols ← ((byte*)) (word/dword/signed dword) 55296
|
||||
(byte) main::j ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
*((byte*) main::screen + (byte) main::i) ← (byte) '*'
|
||||
*((byte*) main::cols + (byte) main::i) ← *((byte[]) main::colseq + (byte) main::j)
|
||||
(byte) main::j ← ++ (byte) main::j
|
||||
(bool~) main::$0 ← (byte) main::j == (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(bool~) main::$1 ← ! (bool~) main::$0
|
||||
if((bool~) main::$1) goto main::@2
|
||||
to:main::@3
|
||||
main::@2: scope:[main] from main::@1 main::@3
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,39)
|
||||
(bool~) main::$2 ← (byte) main::i != rangelast(0,39)
|
||||
if((bool~) main::$2) goto main::@1
|
||||
to:main::@4
|
||||
main::@3: scope:[main] from main::@1
|
||||
(byte) main::j ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@2
|
||||
main::@4: scope:[main] from main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte) WHITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) RED#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
@ -251,11 +162,6 @@ Adding NOP phi() at start of main::@3
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 3 initial phi equivalence classes
|
||||
Coalesced [15] main::i#5 ← main::i#1
|
||||
Coalesced [16] main::j#5 ← main::j#4
|
||||
@ -268,11 +174,6 @@ Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@6
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,79 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inmemarray.kc
|
||||
|
||||
byte* SCREEN = $0400;
|
||||
byte[] TXT = { 3, 1, 13, 5, 12, 15, 20, 32};
|
||||
|
||||
void main() {
|
||||
byte j = 0;
|
||||
for(byte i : 0..100) {
|
||||
SCREEN[i] = TXT[j];
|
||||
if(++j==8) {
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Adding pre/post-modifier (byte) main::j ← ++ (byte) main::j
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(byte[]) TXT
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(bool~) main::$1
|
||||
(bool~) main::$2
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(byte) main::j
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte[]) TXT ← { (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 13, (byte/signed byte/word/signed word/dword/signed dword) 5, (byte/signed byte/word/signed word/dword/signed dword) 12, (byte/signed byte/word/signed word/dword/signed dword) 15, (byte/signed byte/word/signed word/dword/signed dword) 20, (byte/signed byte/word/signed word/dword/signed dword) 32 }
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::j ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
*((byte*) SCREEN + (byte) main::i) ← *((byte[]) TXT + (byte) main::j)
|
||||
(byte) main::j ← ++ (byte) main::j
|
||||
(bool~) main::$0 ← (byte) main::j == (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(bool~) main::$1 ← ! (bool~) main::$0
|
||||
if((bool~) main::$1) goto main::@2
|
||||
to:main::@3
|
||||
main::@2: scope:[main] from main::@1 main::@3
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,100)
|
||||
(bool~) main::$2 ← (byte) main::i != rangelast(0,100)
|
||||
if((bool~) main::$2) goto main::@1
|
||||
to:main::@4
|
||||
main::@3: scope:[main] from main::@1
|
||||
(byte) main::j ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@2
|
||||
main::@4: scope:[main] from main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte[]) TXT#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 13, (byte/signed byte/word/signed word/dword/signed dword) 5, (byte/signed byte/word/signed word/dword/signed dword) 12, (byte/signed byte/word/signed word/dword/signed dword) 15, (byte/signed byte/word/signed word/dword/signed dword) 20, (byte/signed byte/word/signed word/dword/signed dword) 32 }
|
||||
@ -196,11 +122,6 @@ Adding NOP phi() at start of main::@3
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 3 initial phi equivalence classes
|
||||
Coalesced [14] main::j#5 ← main::j#4
|
||||
Coalesced [15] main::i#5 ← main::i#1
|
||||
@ -213,11 +134,6 @@ Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@6
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,83 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/inmemstring.kc
|
||||
|
||||
byte* SCREEN = $0400;
|
||||
byte[] TEXT = "camelot ";
|
||||
|
||||
void main() {
|
||||
byte* cursor = SCREEN;
|
||||
byte i=0;
|
||||
do {
|
||||
*cursor = TEXT[i];
|
||||
if(++i==8) {
|
||||
i = 0;
|
||||
}
|
||||
} while(++cursor<SCREEN+1000);
|
||||
}
|
||||
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
|
||||
Adding pre/post-modifier (byte*) main::cursor ← ++ (byte*) main::cursor
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(byte[]) TEXT
|
||||
(void()) main()
|
||||
(bool~) main::$0
|
||||
(bool~) main::$1
|
||||
(byte*~) main::$2
|
||||
(bool~) main::$3
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@return
|
||||
(byte*) main::cursor
|
||||
(byte) main::i
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte[]) TEXT ← (string) "camelot "
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte*) main::cursor ← (byte*) SCREEN
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
*((byte*) main::cursor) ← *((byte[]) TEXT + (byte) main::i)
|
||||
(byte) main::i ← ++ (byte) main::i
|
||||
(bool~) main::$0 ← (byte) main::i == (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(bool~) main::$1 ← ! (bool~) main::$0
|
||||
if((bool~) main::$1) goto main::@2
|
||||
to:main::@3
|
||||
main::@2: scope:[main] from main::@1 main::@3
|
||||
(byte*) main::cursor ← ++ (byte*) main::cursor
|
||||
(byte*~) main::$2 ← (byte*) SCREEN + (word/signed word/dword/signed dword) 1000
|
||||
(bool~) main::$3 ← (byte*) main::cursor < (byte*~) main::$2
|
||||
if((bool~) main::$3) goto main::@1
|
||||
to:main::@4
|
||||
main::@3: scope:[main] from main::@1
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@2
|
||||
main::@4: scope:[main] from main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Creating constant string variable for inline (const string) $0 "camelot "
|
||||
Removing empty block main::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte[]) TEXT#0 ← (const string) $0
|
||||
@ -205,11 +127,6 @@ Adding NOP phi() at start of main::@3
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 3 initial phi equivalence classes
|
||||
Coalesced [14] main::i#5 ← main::i#4
|
||||
Coalesced [15] main::cursor#5 ← main::cursor#1
|
||||
@ -222,11 +139,6 @@ Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@6
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,598 +1,7 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/irq-hardware-clobber-jsr.kc
|
||||
// A minimal working raster hardware IRQ with clobber-based register savings
|
||||
import "c64"
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
// Disable kernal & basic
|
||||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
// Set raster line to $100
|
||||
*VIC_CONTROL |=$80;
|
||||
*RASTER = $00;
|
||||
// Enable Raster Interrupt
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
// Set the IRQ routine
|
||||
*HARDWARE_IRQ = &irq;
|
||||
asm { cli }
|
||||
while(true) {
|
||||
(*BORDERCOL)++;
|
||||
}
|
||||
}
|
||||
|
||||
// Interrupt Routine
|
||||
interrupt(hardware_clobber) void irq() {
|
||||
do_irq();
|
||||
}
|
||||
|
||||
void do_irq() {
|
||||
*BGCOL = WHITE;
|
||||
*BGCOL = BLACK;
|
||||
// Acknowledge the IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
}
|
||||
Importing c64
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/c64.kc
|
||||
// Commodore 64 Registers and Constants
|
||||
|
||||
// Processor port data direction register
|
||||
const byte* PROCPORT_DDR = $00;
|
||||
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
|
||||
const byte PROCPORT_DDR_MEMORY_MASK = %00000111;
|
||||
|
||||
// Processor Port Register controlling RAM/ROM configuration and the datasette
|
||||
const byte* PROCPORT = $01;
|
||||
// RAM in all three areas $A000, $D000, $E000
|
||||
const byte PROCPORT_RAM_ALL = %00110000;
|
||||
// RAM in $A000, $E000 I/O in $D000
|
||||
const byte PROCPORT_RAM_IO = %00110101;
|
||||
// RAM in $A000, $E000 CHAR ROM in $D000
|
||||
const byte PROCPORT_RAM_CHARROM = %00110001;
|
||||
// RAM in $A000, I/O in $D000, KERNEL in $E000
|
||||
const byte PROCPORT_KERNEL_IO = %00110110;
|
||||
// BASIC in $A000, I/O in $D000, KERNEL in $E000
|
||||
const byte PROCPORT_BASIC_KERNEL_IO = %00110111;
|
||||
|
||||
const byte* CHARGEN = $d000;
|
||||
|
||||
const byte* SPRITES_XPOS = $d000;
|
||||
const byte* SPRITES_YPOS = $d001;
|
||||
const byte* SPRITES_XMSB = $d010;
|
||||
const byte* RASTER = $d012;
|
||||
const byte* SPRITES_ENABLE = $d015;
|
||||
const byte* SPRITES_EXPAND_Y = $d017;
|
||||
const byte* SPRITES_PRIORITY = $d01b;
|
||||
const byte* SPRITES_MC = $d01c;
|
||||
const byte* SPRITES_EXPAND_X = $d01d;
|
||||
const byte* BORDERCOL = $d020;
|
||||
const byte* BGCOL = $d021;
|
||||
const byte* BGCOL1 = $d021;
|
||||
const byte* BGCOL2 = $d022;
|
||||
const byte* BGCOL3 = $d023;
|
||||
const byte* BGCOL4 = $d024;
|
||||
const byte* SPRITES_MC1 = $d025;
|
||||
const byte* SPRITES_MC2 = $d026;
|
||||
const byte* SPRITES_COLS = $d027;
|
||||
|
||||
const byte* VIC_CONTROL = $d011;
|
||||
const byte* D011 = $d011;
|
||||
const byte VIC_RST8 = %10000000;
|
||||
const byte VIC_ECM = %01000000;
|
||||
const byte VIC_BMM = %00100000;
|
||||
const byte VIC_DEN = %00010000;
|
||||
const byte VIC_RSEL = %00001000;
|
||||
|
||||
const byte* VIC_CONTROL2 = $d016;
|
||||
const byte* D016 = $d016;
|
||||
const byte VIC_MCM = %00010000;
|
||||
const byte VIC_CSEL = %00001000;
|
||||
|
||||
const byte* D018 = $d018;
|
||||
const byte* VIC_MEMORY = $d018;
|
||||
|
||||
const byte* IRQ_STATUS = $d019;
|
||||
const byte* IRQ_ENABLE = $d01a;
|
||||
const byte IRQ_RASTER = %00000001;
|
||||
const byte IRQ_COLLISION_BG = %00000010;
|
||||
const byte IRQ_COLLISION_SPRITE = %00000100;
|
||||
const byte IRQ_LIGHTPEN = %00001000;
|
||||
|
||||
const byte* COLS = $d800;
|
||||
|
||||
// CIA#1 Port A: keyboard matrix columns and joystick #2
|
||||
const byte* CIA1_PORT_A = $dc00;
|
||||
// CIA#1 Port B: keyboard matrix rows and joystick #1.
|
||||
const byte* CIA1_PORT_B = $dc01;
|
||||
// CIA #1 Port A data direction register.
|
||||
const byte* CIA1_PORT_A_DDR = $dc02;
|
||||
// CIA #1 Port B data direction register.
|
||||
const byte* CIA1_PORT_B_DDR = $dc03;
|
||||
// CIA#1 Interrupt Status & Control Register
|
||||
const byte* CIA1_INTERRUPT = $dc0d;
|
||||
// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
|
||||
// CIA#2 Port A: Serial bus, RS-232, VIC memory bank
|
||||
const byte* CIA2_PORT_A = $dd00;
|
||||
// CIA#2 Port B: RS-232
|
||||
const byte* CIA2_PORT_B = $dd01;
|
||||
// CIA #2 Port A data direction register.
|
||||
const byte* CIA2_PORT_A_DDR = $dd02;
|
||||
// CIA #2 Port B data direction register.
|
||||
const byte* CIA2_PORT_B_DDR = $dd03;
|
||||
// CIA#2 Interrupt Status & Control Register
|
||||
const byte* CIA2_INTERRUPT = $dd0d;
|
||||
|
||||
// The vector used when the KERNAL serves IRQ interrupts
|
||||
const void()** KERNEL_IRQ = $0314;
|
||||
|
||||
// The vector used when the HARDWARE serves IRQ interrupts
|
||||
const void()** HARDWARE_IRQ = $fffe;
|
||||
|
||||
const byte BLACK = $0;
|
||||
const byte WHITE = $1;
|
||||
const byte RED = $2;
|
||||
const byte CYAN = $3;
|
||||
const byte PURPLE = $4;
|
||||
const byte GREEN = $5;
|
||||
const byte BLUE = $6;
|
||||
const byte YELLOW = $7;
|
||||
const byte ORANGE = $8;
|
||||
const byte BROWN = $9;
|
||||
const byte PINK = $a;
|
||||
const byte DARK_GREY= $b;
|
||||
const byte GREY = $c;
|
||||
const byte LIGHT_GREEN = $d;
|
||||
const byte LIGHT_BLUE = $e;
|
||||
const byte LIGHT_GREY = $f;
|
||||
|
||||
// Get the value to store into D018 to display a specific screen and charset/bitmap
|
||||
// Optimized for ASM from (byte)((((word)screen&$3fff)/$40)|(((word)charset&$3fff)/$400));
|
||||
inline byte toD018(byte* screen, byte* gfx) {
|
||||
return (>((((word)screen&$3fff)<<2)))|(((>((word)gfx))>>2)&$f);
|
||||
}
|
||||
|
||||
// Get the value to store into DD00 (CIA 2 port A) to choose a specific VIC bank
|
||||
// Optimized for ASM from %00000011 ^ (byte)((word)gfx/$4000)
|
||||
inline byte toDd00(byte* gfx) {
|
||||
return %00000011 ^ (>((word)gfx))>>6;
|
||||
}
|
||||
|
||||
// Select a specific VIC graphics bank by setting the CIA 2 port A ($dd00) as needed
|
||||
inline void vicSelectGfxBank(byte* gfx) {
|
||||
*CIA2_PORT_A_DDR = %00000011;
|
||||
*CIA2_PORT_A = toDd00(gfx);
|
||||
}
|
||||
|
||||
Adding pre/post-modifier *((byte*) BORDERCOL) ← ++ *((byte*) BORDERCOL)
|
||||
Resolved forward reference irq to interrupt(HARDWARE_CLOBBER)(void()) irq()
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @5
|
||||
(label) @6
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte*) BGCOL1
|
||||
(byte*) BGCOL2
|
||||
(byte*) BGCOL3
|
||||
(byte*) BGCOL4
|
||||
(byte) BLACK
|
||||
(byte) BLUE
|
||||
(byte*) BORDERCOL
|
||||
(byte) BROWN
|
||||
(byte*) CHARGEN
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(byte*) CIA1_PORT_A
|
||||
(byte*) CIA1_PORT_A_DDR
|
||||
(byte*) CIA1_PORT_B
|
||||
(byte*) CIA1_PORT_B_DDR
|
||||
(byte*) CIA2_INTERRUPT
|
||||
(byte*) CIA2_PORT_A
|
||||
(byte*) CIA2_PORT_A_DDR
|
||||
(byte*) CIA2_PORT_B
|
||||
(byte*) CIA2_PORT_B_DDR
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(byte*) COLS
|
||||
(byte) CYAN
|
||||
(byte*) D011
|
||||
(byte*) D016
|
||||
(byte*) D018
|
||||
(byte) DARK_GREY
|
||||
(byte) GREEN
|
||||
(byte) GREY
|
||||
(void()**) HARDWARE_IRQ
|
||||
(byte) IRQ_COLLISION_BG
|
||||
(byte) IRQ_COLLISION_SPRITE
|
||||
(byte*) IRQ_ENABLE
|
||||
(byte) IRQ_LIGHTPEN
|
||||
(byte) IRQ_RASTER
|
||||
(byte*) IRQ_STATUS
|
||||
(void()**) KERNEL_IRQ
|
||||
(byte) LIGHT_BLUE
|
||||
(byte) LIGHT_GREEN
|
||||
(byte) LIGHT_GREY
|
||||
(byte) ORANGE
|
||||
(byte) PINK
|
||||
(byte*) PROCPORT
|
||||
(byte) PROCPORT_BASIC_KERNEL_IO
|
||||
(byte*) PROCPORT_DDR
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK
|
||||
(byte) PROCPORT_KERNEL_IO
|
||||
(byte) PROCPORT_RAM_ALL
|
||||
(byte) PROCPORT_RAM_CHARROM
|
||||
(byte) PROCPORT_RAM_IO
|
||||
(byte) PURPLE
|
||||
(byte*) RASTER
|
||||
(byte) RED
|
||||
(byte*) SPRITES_COLS
|
||||
(byte*) SPRITES_ENABLE
|
||||
(byte*) SPRITES_EXPAND_X
|
||||
(byte*) SPRITES_EXPAND_Y
|
||||
(byte*) SPRITES_MC
|
||||
(byte*) SPRITES_MC1
|
||||
(byte*) SPRITES_MC2
|
||||
(byte*) SPRITES_PRIORITY
|
||||
(byte*) SPRITES_XMSB
|
||||
(byte*) SPRITES_XPOS
|
||||
(byte*) SPRITES_YPOS
|
||||
(byte) VIC_BMM
|
||||
(byte*) VIC_CONTROL
|
||||
(byte*) VIC_CONTROL2
|
||||
(byte) VIC_CSEL
|
||||
(byte) VIC_DEN
|
||||
(byte) VIC_ECM
|
||||
(byte) VIC_MCM
|
||||
(byte*) VIC_MEMORY
|
||||
(byte) VIC_RSEL
|
||||
(byte) VIC_RST8
|
||||
(byte) WHITE
|
||||
(byte) YELLOW
|
||||
(void()) do_irq()
|
||||
(label) do_irq::@return
|
||||
interrupt(HARDWARE_CLOBBER)(void()) irq()
|
||||
(void~) irq::$0
|
||||
(label) irq::@return
|
||||
(void()) main()
|
||||
(void()*~) main::$0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@return
|
||||
inline (byte()) toD018((byte*) toD018::screen , (byte*) toD018::gfx)
|
||||
(word~) toD018::$0
|
||||
(word~) toD018::$1
|
||||
(word~) toD018::$2
|
||||
(byte~) toD018::$3
|
||||
(word~) toD018::$4
|
||||
(byte~) toD018::$5
|
||||
(byte~) toD018::$6
|
||||
(byte~) toD018::$7
|
||||
(byte~) toD018::$8
|
||||
(label) toD018::@1
|
||||
(label) toD018::@return
|
||||
(byte*) toD018::gfx
|
||||
(byte) toD018::return
|
||||
(byte*) toD018::screen
|
||||
inline (byte()) toDd00((byte*) toDd00::gfx)
|
||||
(word~) toDd00::$0
|
||||
(byte~) toDd00::$1
|
||||
(byte~) toDd00::$2
|
||||
(byte/word/dword~) toDd00::$3
|
||||
(label) toDd00::@1
|
||||
(label) toDd00::@return
|
||||
(byte*) toDd00::gfx
|
||||
(byte) toDd00::return
|
||||
inline (void()) vicSelectGfxBank((byte*) vicSelectGfxBank::gfx)
|
||||
(byte~) vicSelectGfxBank::$0
|
||||
(label) vicSelectGfxBank::@return
|
||||
(byte*) vicSelectGfxBank::gfx
|
||||
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in PROCPORT_DDR ← ((byte*)) 0
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in PROCPORT ← ((byte*)) 1
|
||||
Promoting word/dword/signed dword to byte* in CHARGEN ← ((byte*)) 53248
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_XPOS ← ((byte*)) 53248
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_YPOS ← ((byte*)) 53249
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_XMSB ← ((byte*)) 53264
|
||||
Promoting word/dword/signed dword to byte* in RASTER ← ((byte*)) 53266
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_ENABLE ← ((byte*)) 53269
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_EXPAND_Y ← ((byte*)) 53271
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_PRIORITY ← ((byte*)) 53275
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_MC ← ((byte*)) 53276
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_EXPAND_X ← ((byte*)) 53277
|
||||
Promoting word/dword/signed dword to byte* in BORDERCOL ← ((byte*)) 53280
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53281
|
||||
Promoting word/dword/signed dword to byte* in BGCOL1 ← ((byte*)) 53281
|
||||
Promoting word/dword/signed dword to byte* in BGCOL2 ← ((byte*)) 53282
|
||||
Promoting word/dword/signed dword to byte* in BGCOL3 ← ((byte*)) 53283
|
||||
Promoting word/dword/signed dword to byte* in BGCOL4 ← ((byte*)) 53284
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_MC1 ← ((byte*)) 53285
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_MC2 ← ((byte*)) 53286
|
||||
Promoting word/dword/signed dword to byte* in SPRITES_COLS ← ((byte*)) 53287
|
||||
Promoting word/dword/signed dword to byte* in VIC_CONTROL ← ((byte*)) 53265
|
||||
Promoting word/dword/signed dword to byte* in D011 ← ((byte*)) 53265
|
||||
Promoting word/dword/signed dword to byte* in VIC_CONTROL2 ← ((byte*)) 53270
|
||||
Promoting word/dword/signed dword to byte* in D016 ← ((byte*)) 53270
|
||||
Promoting word/dword/signed dword to byte* in D018 ← ((byte*)) 53272
|
||||
Promoting word/dword/signed dword to byte* in VIC_MEMORY ← ((byte*)) 53272
|
||||
Promoting word/dword/signed dword to byte* in IRQ_STATUS ← ((byte*)) 53273
|
||||
Promoting word/dword/signed dword to byte* in IRQ_ENABLE ← ((byte*)) 53274
|
||||
Promoting word/dword/signed dword to byte* in COLS ← ((byte*)) 55296
|
||||
Promoting word/dword/signed dword to byte* in CIA1_PORT_A ← ((byte*)) 56320
|
||||
Promoting word/dword/signed dword to byte* in CIA1_PORT_B ← ((byte*)) 56321
|
||||
Promoting word/dword/signed dword to byte* in CIA1_PORT_A_DDR ← ((byte*)) 56322
|
||||
Promoting word/dword/signed dword to byte* in CIA1_PORT_B_DDR ← ((byte*)) 56323
|
||||
Promoting word/dword/signed dword to byte* in CIA1_INTERRUPT ← ((byte*)) 56333
|
||||
Promoting word/dword/signed dword to byte* in CIA2_PORT_A ← ((byte*)) 56576
|
||||
Promoting word/dword/signed dword to byte* in CIA2_PORT_B ← ((byte*)) 56577
|
||||
Promoting word/dword/signed dword to byte* in CIA2_PORT_A_DDR ← ((byte*)) 56578
|
||||
Promoting word/dword/signed dword to byte* in CIA2_PORT_B_DDR ← ((byte*)) 56579
|
||||
Promoting word/dword/signed dword to byte* in CIA2_INTERRUPT ← ((byte*)) 56589
|
||||
Promoting word/signed word/dword/signed dword to void()** in KERNEL_IRQ ← ((void()**)) 788
|
||||
Promoting word/dword/signed dword to void()** in HARDWARE_IRQ ← ((void()**)) 65534
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) PROCPORT_DDR ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK ← (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
(byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) PROCPORT_RAM_ALL ← (byte/signed byte/word/signed word/dword/signed dword) 48
|
||||
(byte) PROCPORT_RAM_IO ← (byte/signed byte/word/signed word/dword/signed dword) 53
|
||||
(byte) PROCPORT_RAM_CHARROM ← (byte/signed byte/word/signed word/dword/signed dword) 49
|
||||
(byte) PROCPORT_KERNEL_IO ← (byte/signed byte/word/signed word/dword/signed dword) 54
|
||||
(byte) PROCPORT_BASIC_KERNEL_IO ← (byte/signed byte/word/signed word/dword/signed dword) 55
|
||||
(byte*) CHARGEN ← ((byte*)) (word/dword/signed dword) 53248
|
||||
(byte*) SPRITES_XPOS ← ((byte*)) (word/dword/signed dword) 53248
|
||||
(byte*) SPRITES_YPOS ← ((byte*)) (word/dword/signed dword) 53249
|
||||
(byte*) SPRITES_XMSB ← ((byte*)) (word/dword/signed dword) 53264
|
||||
(byte*) RASTER ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) SPRITES_ENABLE ← ((byte*)) (word/dword/signed dword) 53269
|
||||
(byte*) SPRITES_EXPAND_Y ← ((byte*)) (word/dword/signed dword) 53271
|
||||
(byte*) SPRITES_PRIORITY ← ((byte*)) (word/dword/signed dword) 53275
|
||||
(byte*) SPRITES_MC ← ((byte*)) (word/dword/signed dword) 53276
|
||||
(byte*) SPRITES_EXPAND_X ← ((byte*)) (word/dword/signed dword) 53277
|
||||
(byte*) BORDERCOL ← ((byte*)) (word/dword/signed dword) 53280
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte*) BGCOL1 ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte*) BGCOL2 ← ((byte*)) (word/dword/signed dword) 53282
|
||||
(byte*) BGCOL3 ← ((byte*)) (word/dword/signed dword) 53283
|
||||
(byte*) BGCOL4 ← ((byte*)) (word/dword/signed dword) 53284
|
||||
(byte*) SPRITES_MC1 ← ((byte*)) (word/dword/signed dword) 53285
|
||||
(byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286
|
||||
(byte*) SPRITES_COLS ← ((byte*)) (word/dword/signed dword) 53287
|
||||
(byte*) VIC_CONTROL ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte*) D011 ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte) VIC_RST8 ← (byte/word/signed word/dword/signed dword) 128
|
||||
(byte) VIC_ECM ← (byte/signed byte/word/signed word/dword/signed dword) 64
|
||||
(byte) VIC_BMM ← (byte/signed byte/word/signed word/dword/signed dword) 32
|
||||
(byte) VIC_DEN ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
(byte) VIC_RSEL ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) VIC_CONTROL2 ← ((byte*)) (word/dword/signed dword) 53270
|
||||
(byte*) D016 ← ((byte*)) (word/dword/signed dword) 53270
|
||||
(byte) VIC_MCM ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
(byte) VIC_CSEL ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) D018 ← ((byte*)) (word/dword/signed dword) 53272
|
||||
(byte*) VIC_MEMORY ← ((byte*)) (word/dword/signed dword) 53272
|
||||
(byte*) IRQ_STATUS ← ((byte*)) (word/dword/signed dword) 53273
|
||||
(byte*) IRQ_ENABLE ← ((byte*)) (word/dword/signed dword) 53274
|
||||
(byte) IRQ_RASTER ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296
|
||||
(byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320
|
||||
(byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321
|
||||
(byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322
|
||||
(byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323
|
||||
(byte*) CIA1_INTERRUPT ← ((byte*)) (word/dword/signed dword) 56333
|
||||
(byte) CIA_INTERRUPT_CLEAR ← (byte/signed byte/word/signed word/dword/signed dword) 127
|
||||
(byte*) CIA2_PORT_A ← ((byte*)) (word/dword/signed dword) 56576
|
||||
(byte*) CIA2_PORT_B ← ((byte*)) (word/dword/signed dword) 56577
|
||||
(byte*) CIA2_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56578
|
||||
(byte*) CIA2_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56579
|
||||
(byte*) CIA2_INTERRUPT ← ((byte*)) (word/dword/signed dword) 56589
|
||||
(void()**) KERNEL_IRQ ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
(void()**) HARDWARE_IRQ ← ((void()**)) (word/dword/signed dword) 65534
|
||||
(byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
(byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6
|
||||
(byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
(byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9
|
||||
(byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11
|
||||
(byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12
|
||||
(byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13
|
||||
(byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14
|
||||
(byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
to:@1
|
||||
toD018: scope:[toD018] from
|
||||
(word~) toD018::$0 ← ((word)) (byte*) toD018::screen
|
||||
(word~) toD018::$1 ← (word~) toD018::$0 & (word/signed word/dword/signed dword) 16383
|
||||
(word~) toD018::$2 ← (word~) toD018::$1 << (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte~) toD018::$3 ← > (word~) toD018::$2
|
||||
(word~) toD018::$4 ← ((word)) (byte*) toD018::gfx
|
||||
(byte~) toD018::$5 ← > (word~) toD018::$4
|
||||
(byte~) toD018::$6 ← (byte~) toD018::$5 >> (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte~) toD018::$7 ← (byte~) toD018::$6 & (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
(byte~) toD018::$8 ← (byte~) toD018::$3 | (byte~) toD018::$7
|
||||
(byte) toD018::return ← (byte~) toD018::$8
|
||||
to:toD018::@return
|
||||
toD018::@return: scope:[toD018] from toD018 toD018::@1
|
||||
(byte) toD018::return ← (byte) toD018::return
|
||||
return (byte) toD018::return
|
||||
to:@return
|
||||
toD018::@1: scope:[toD018] from
|
||||
to:toD018::@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
toDd00: scope:[toDd00] from
|
||||
(word~) toDd00::$0 ← ((word)) (byte*) toDd00::gfx
|
||||
(byte~) toDd00::$1 ← > (word~) toDd00::$0
|
||||
(byte~) toDd00::$2 ← (byte~) toDd00::$1 >> (byte/signed byte/word/signed word/dword/signed dword) 6
|
||||
(byte/word/dword~) toDd00::$3 ← (byte/signed byte/word/signed word/dword/signed dword) 3 ^ (byte~) toDd00::$2
|
||||
(byte) toDd00::return ← (byte/word/dword~) toDd00::$3
|
||||
to:toDd00::@return
|
||||
toDd00::@return: scope:[toDd00] from toDd00 toDd00::@1
|
||||
(byte) toDd00::return ← (byte) toDd00::return
|
||||
return (byte) toDd00::return
|
||||
to:@return
|
||||
toDd00::@1: scope:[toDd00] from
|
||||
to:toDd00::@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
vicSelectGfxBank: scope:[vicSelectGfxBank] from
|
||||
*((byte*) CIA2_PORT_A_DDR) ← (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx
|
||||
*((byte*) CIA2_PORT_A) ← (byte~) vicSelectGfxBank::$0
|
||||
to:vicSelectGfxBank::@return
|
||||
vicSelectGfxBank::@return: scope:[vicSelectGfxBank] from vicSelectGfxBank
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
main: scope:[main] from
|
||||
asm { sei }
|
||||
*((byte*) PROCPORT_DDR) ← (byte) PROCPORT_DDR_MEMORY_MASK
|
||||
*((byte*) PROCPORT) ← (byte) PROCPORT_RAM_IO
|
||||
*((byte*) CIA1_INTERRUPT) ← (byte) CIA_INTERRUPT_CLEAR
|
||||
*((byte*) VIC_CONTROL) ← *((byte*) VIC_CONTROL) | (byte/word/signed word/dword/signed dword) 128
|
||||
*((byte*) RASTER) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
*((byte*) IRQ_ENABLE) ← (byte) IRQ_RASTER
|
||||
(void()*~) main::$0 ← & interrupt(HARDWARE_CLOBBER)(void()) irq()
|
||||
*((void()**) HARDWARE_IRQ) ← (void()*~) main::$0
|
||||
asm { cli }
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
if(true) goto main::@2
|
||||
to:main::@4
|
||||
main::@2: scope:[main] from main::@1 main::@5
|
||||
*((byte*) BORDERCOL) ← ++ *((byte*) BORDERCOL)
|
||||
to:main::@1
|
||||
main::@4: scope:[main] from main::@1
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@4 main::@6
|
||||
to:main::@return
|
||||
main::@5: scope:[main] from
|
||||
to:main::@2
|
||||
main::@6: scope:[main] from
|
||||
to:main::@3
|
||||
main::@return: scope:[main] from main::@3
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
irq: scope:[irq] from
|
||||
(void~) irq::$0 ← call do_irq
|
||||
to:irq::@return
|
||||
irq::@return: scope:[irq] from irq
|
||||
return
|
||||
to:@return
|
||||
@5: scope:[] from @4
|
||||
to:@6
|
||||
do_irq: scope:[do_irq] from
|
||||
*((byte*) BGCOL) ← (byte) WHITE
|
||||
*((byte*) BGCOL) ← (byte) BLACK
|
||||
*((byte*) IRQ_STATUS) ← (byte) IRQ_RASTER
|
||||
to:do_irq::@return
|
||||
do_irq::@return: scope:[do_irq] from do_irq
|
||||
return
|
||||
to:@return
|
||||
@6: scope:[] from @5
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @6
|
||||
|
||||
Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx
|
||||
Removing unused procedure toD018
|
||||
Removing unused procedure toDd00
|
||||
Removing unused procedure vicSelectGfxBank
|
||||
Eliminating unused variable (byte) PROCPORT_RAM_ALL and assignment [3] (byte) PROCPORT_RAM_ALL ← (byte/signed byte/word/signed word/dword/signed dword) 48
|
||||
Eliminating unused variable (byte) PROCPORT_RAM_CHARROM and assignment [5] (byte) PROCPORT_RAM_CHARROM ← (byte/signed byte/word/signed word/dword/signed dword) 49
|
||||
Eliminating unused variable (byte) PROCPORT_KERNEL_IO and assignment [6] (byte) PROCPORT_KERNEL_IO ← (byte/signed byte/word/signed word/dword/signed dword) 54
|
||||
Eliminating unused variable (byte) PROCPORT_BASIC_KERNEL_IO and assignment [7] (byte) PROCPORT_BASIC_KERNEL_IO ← (byte/signed byte/word/signed word/dword/signed dword) 55
|
||||
Eliminating unused variable (byte*) CHARGEN and assignment [8] (byte*) CHARGEN ← ((byte*)) (word/dword/signed dword) 53248
|
||||
Eliminating unused variable (byte*) SPRITES_XPOS and assignment [9] (byte*) SPRITES_XPOS ← ((byte*)) (word/dword/signed dword) 53248
|
||||
Eliminating unused variable (byte*) SPRITES_YPOS and assignment [10] (byte*) SPRITES_YPOS ← ((byte*)) (word/dword/signed dword) 53249
|
||||
Eliminating unused variable (byte*) SPRITES_XMSB and assignment [11] (byte*) SPRITES_XMSB ← ((byte*)) (word/dword/signed dword) 53264
|
||||
Eliminating unused variable (byte*) SPRITES_ENABLE and assignment [13] (byte*) SPRITES_ENABLE ← ((byte*)) (word/dword/signed dword) 53269
|
||||
Eliminating unused variable (byte*) SPRITES_EXPAND_Y and assignment [14] (byte*) SPRITES_EXPAND_Y ← ((byte*)) (word/dword/signed dword) 53271
|
||||
Eliminating unused variable (byte*) SPRITES_PRIORITY and assignment [15] (byte*) SPRITES_PRIORITY ← ((byte*)) (word/dword/signed dword) 53275
|
||||
Eliminating unused variable (byte*) SPRITES_MC and assignment [16] (byte*) SPRITES_MC ← ((byte*)) (word/dword/signed dword) 53276
|
||||
Eliminating unused variable (byte*) SPRITES_EXPAND_X and assignment [17] (byte*) SPRITES_EXPAND_X ← ((byte*)) (word/dword/signed dword) 53277
|
||||
Eliminating unused variable (byte*) BGCOL1 and assignment [20] (byte*) BGCOL1 ← ((byte*)) (word/dword/signed dword) 53281
|
||||
Eliminating unused variable (byte*) BGCOL2 and assignment [21] (byte*) BGCOL2 ← ((byte*)) (word/dword/signed dword) 53282
|
||||
Eliminating unused variable (byte*) BGCOL3 and assignment [22] (byte*) BGCOL3 ← ((byte*)) (word/dword/signed dword) 53283
|
||||
Eliminating unused variable (byte*) BGCOL4 and assignment [23] (byte*) BGCOL4 ← ((byte*)) (word/dword/signed dword) 53284
|
||||
Eliminating unused variable (byte*) SPRITES_MC1 and assignment [24] (byte*) SPRITES_MC1 ← ((byte*)) (word/dword/signed dword) 53285
|
||||
Eliminating unused variable (byte*) SPRITES_MC2 and assignment [25] (byte*) SPRITES_MC2 ← ((byte*)) (word/dword/signed dword) 53286
|
||||
Eliminating unused variable (byte*) SPRITES_COLS and assignment [26] (byte*) SPRITES_COLS ← ((byte*)) (word/dword/signed dword) 53287
|
||||
Eliminating unused variable (byte*) D011 and assignment [28] (byte*) D011 ← ((byte*)) (word/dword/signed dword) 53265
|
||||
Eliminating unused variable (byte) VIC_RST8 and assignment [29] (byte) VIC_RST8 ← (byte/word/signed word/dword/signed dword) 128
|
||||
Eliminating unused variable (byte) VIC_ECM and assignment [30] (byte) VIC_ECM ← (byte/signed byte/word/signed word/dword/signed dword) 64
|
||||
Eliminating unused variable (byte) VIC_BMM and assignment [31] (byte) VIC_BMM ← (byte/signed byte/word/signed word/dword/signed dword) 32
|
||||
Eliminating unused variable (byte) VIC_DEN and assignment [32] (byte) VIC_DEN ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
Eliminating unused variable (byte) VIC_RSEL and assignment [33] (byte) VIC_RSEL ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Eliminating unused variable (byte*) VIC_CONTROL2 and assignment [34] (byte*) VIC_CONTROL2 ← ((byte*)) (word/dword/signed dword) 53270
|
||||
Eliminating unused variable (byte*) D016 and assignment [35] (byte*) D016 ← ((byte*)) (word/dword/signed dword) 53270
|
||||
Eliminating unused variable (byte) VIC_MCM and assignment [36] (byte) VIC_MCM ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
Eliminating unused variable (byte) VIC_CSEL and assignment [37] (byte) VIC_CSEL ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Eliminating unused variable (byte*) D018 and assignment [38] (byte*) D018 ← ((byte*)) (word/dword/signed dword) 53272
|
||||
Eliminating unused variable (byte*) VIC_MEMORY and assignment [39] (byte*) VIC_MEMORY ← ((byte*)) (word/dword/signed dword) 53272
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_BG and assignment [43] (byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_SPRITE and assignment [44] (byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
Eliminating unused variable (byte) IRQ_LIGHTPEN and assignment [45] (byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Eliminating unused variable (byte*) COLS and assignment [46] (byte*) COLS ← ((byte*)) (word/dword/signed dword) 55296
|
||||
Eliminating unused variable (byte*) CIA1_PORT_A and assignment [47] (byte*) CIA1_PORT_A ← ((byte*)) (word/dword/signed dword) 56320
|
||||
Eliminating unused variable (byte*) CIA1_PORT_B and assignment [48] (byte*) CIA1_PORT_B ← ((byte*)) (word/dword/signed dword) 56321
|
||||
Eliminating unused variable (byte*) CIA1_PORT_A_DDR and assignment [49] (byte*) CIA1_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56322
|
||||
Eliminating unused variable (byte*) CIA1_PORT_B_DDR and assignment [50] (byte*) CIA1_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56323
|
||||
Eliminating unused variable (byte*) CIA2_PORT_A and assignment [53] (byte*) CIA2_PORT_A ← ((byte*)) (word/dword/signed dword) 56576
|
||||
Eliminating unused variable (byte*) CIA2_PORT_B and assignment [54] (byte*) CIA2_PORT_B ← ((byte*)) (word/dword/signed dword) 56577
|
||||
Eliminating unused variable (byte*) CIA2_PORT_A_DDR and assignment [55] (byte*) CIA2_PORT_A_DDR ← ((byte*)) (word/dword/signed dword) 56578
|
||||
Eliminating unused variable (byte*) CIA2_PORT_B_DDR and assignment [56] (byte*) CIA2_PORT_B_DDR ← ((byte*)) (word/dword/signed dword) 56579
|
||||
Eliminating unused variable (byte*) CIA2_INTERRUPT and assignment [57] (byte*) CIA2_INTERRUPT ← ((byte*)) (word/dword/signed dword) 56589
|
||||
Eliminating unused variable (void()**) KERNEL_IRQ and assignment [58] (void()**) KERNEL_IRQ ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
Eliminating unused variable (byte) RED and assignment [62] (byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
Eliminating unused variable (byte) CYAN and assignment [63] (byte) CYAN ← (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
Eliminating unused variable (byte) PURPLE and assignment [64] (byte) PURPLE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
Eliminating unused variable (byte) GREEN and assignment [65] (byte) GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
Eliminating unused variable (byte) BLUE and assignment [66] (byte) BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 6
|
||||
Eliminating unused variable (byte) YELLOW and assignment [67] (byte) YELLOW ← (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
Eliminating unused variable (byte) ORANGE and assignment [68] (byte) ORANGE ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Eliminating unused variable (byte) BROWN and assignment [69] (byte) BROWN ← (byte/signed byte/word/signed word/dword/signed dword) 9
|
||||
Eliminating unused variable (byte) PINK and assignment [70] (byte) PINK ← (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
Eliminating unused variable (byte) DARK_GREY and assignment [71] (byte) DARK_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 11
|
||||
Eliminating unused variable (byte) GREY and assignment [72] (byte) GREY ← (byte/signed byte/word/signed word/dword/signed dword) 12
|
||||
Eliminating unused variable (byte) LIGHT_GREEN and assignment [73] (byte) LIGHT_GREEN ← (byte/signed byte/word/signed word/dword/signed dword) 13
|
||||
Eliminating unused variable (byte) LIGHT_BLUE and assignment [74] (byte) LIGHT_BLUE ← (byte/signed byte/word/signed word/dword/signed dword) 14
|
||||
Eliminating unused variable (byte) LIGHT_GREY and assignment [75] (byte) LIGHT_GREY ← (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
Eliminating unused variable - keeping the call (void~) irq::$0
|
||||
Removing empty block @1
|
||||
Removing empty block @2
|
||||
Removing empty block @3
|
||||
Removing empty block main::@4
|
||||
Removing empty block main::@3
|
||||
Removing empty block main::@5
|
||||
Removing empty block main::@6
|
||||
Removing empty block @4
|
||||
Removing empty block @5
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) PROCPORT_DDR#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
@ -740,14 +149,12 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [irq] to do_irq:15
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @6
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of irq
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,193 +1,6 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/irq-hardware-clobber.kc
|
||||
// A minimal working raster hardware IRQ with clobber-based register savings
|
||||
|
||||
const void()** KERNEL_IRQ = $0314;
|
||||
const void()** HARDWARE_IRQ = $fffe;
|
||||
const byte* RASTER = $d012;
|
||||
const byte* VIC_CONTROL = $d011;
|
||||
const byte* IRQ_STATUS = $d019;
|
||||
const byte* IRQ_ENABLE = $d01a;
|
||||
const byte IRQ_RASTER = %00000001;
|
||||
const byte IRQ_COLLISION_BG = %00000010;
|
||||
const byte IRQ_COLLISION_SPRITE = %00000100;
|
||||
const byte IRQ_LIGHTPEN = %00001000;
|
||||
const byte* BGCOL = $d020;
|
||||
const byte* FGCOL = $d021;
|
||||
const byte WHITE = 1;
|
||||
const byte BLACK = 0;
|
||||
|
||||
const byte* CIA1_INTERRUPT = $dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
|
||||
// Processor port data direction register
|
||||
const byte* PROCPORT_DDR = $00;
|
||||
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
|
||||
const byte PROCPORT_DDR_MEMORY_MASK = %00000111;
|
||||
|
||||
// Processor Port Register controlling RAM/ROM configuration and the datasette
|
||||
const byte* PROCPORT = $01;
|
||||
// RAM in $A000, $E000 I/O in $D000
|
||||
const byte PROCPORT_RAM_IO = %00110101;
|
||||
// RAM in $A000, $E000 CHAR ROM in $D000
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
// Disable kernal & basic
|
||||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
// Set raster line to $100
|
||||
*VIC_CONTROL |=$80;
|
||||
*RASTER = $00;
|
||||
// Enable Raster Interrupt
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
// Set the IRQ routine
|
||||
*HARDWARE_IRQ = &irq;
|
||||
asm { cli }
|
||||
while(true) {
|
||||
(*FGCOL)++;
|
||||
}
|
||||
}
|
||||
|
||||
// Interrupt Routine
|
||||
interrupt(hardware_clobber) void irq() {
|
||||
*BGCOL = WHITE;
|
||||
*BGCOL = BLACK;
|
||||
// Acknowledge the IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
}
|
||||
Adding pre/post-modifier *((byte*) FGCOL) ← ++ *((byte*) FGCOL)
|
||||
Resolved forward reference irq to interrupt(HARDWARE_CLOBBER)(void()) irq()
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte) BLACK
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(byte*) FGCOL
|
||||
(void()**) HARDWARE_IRQ
|
||||
(byte) IRQ_COLLISION_BG
|
||||
(byte) IRQ_COLLISION_SPRITE
|
||||
(byte*) IRQ_ENABLE
|
||||
(byte) IRQ_LIGHTPEN
|
||||
(byte) IRQ_RASTER
|
||||
(byte*) IRQ_STATUS
|
||||
(void()**) KERNEL_IRQ
|
||||
(byte*) PROCPORT
|
||||
(byte*) PROCPORT_DDR
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK
|
||||
(byte) PROCPORT_RAM_IO
|
||||
(byte*) RASTER
|
||||
(byte*) VIC_CONTROL
|
||||
(byte) WHITE
|
||||
interrupt(HARDWARE_CLOBBER)(void()) irq()
|
||||
(label) irq::@return
|
||||
(void()) main()
|
||||
(void()*~) main::$0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to void()** in KERNEL_IRQ ← ((void()**)) 788
|
||||
Promoting word/dword/signed dword to void()** in HARDWARE_IRQ ← ((void()**)) 65534
|
||||
Promoting word/dword/signed dword to byte* in RASTER ← ((byte*)) 53266
|
||||
Promoting word/dword/signed dword to byte* in VIC_CONTROL ← ((byte*)) 53265
|
||||
Promoting word/dword/signed dword to byte* in IRQ_STATUS ← ((byte*)) 53273
|
||||
Promoting word/dword/signed dword to byte* in IRQ_ENABLE ← ((byte*)) 53274
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53280
|
||||
Promoting word/dword/signed dword to byte* in FGCOL ← ((byte*)) 53281
|
||||
Promoting word/dword/signed dword to byte* in CIA1_INTERRUPT ← ((byte*)) 56333
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in PROCPORT_DDR ← ((byte*)) 0
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in PROCPORT ← ((byte*)) 1
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(void()**) KERNEL_IRQ ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
(void()**) HARDWARE_IRQ ← ((void()**)) (word/dword/signed dword) 65534
|
||||
(byte*) RASTER ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) VIC_CONTROL ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte*) IRQ_STATUS ← ((byte*)) (word/dword/signed dword) 53273
|
||||
(byte*) IRQ_ENABLE ← ((byte*)) (word/dword/signed dword) 53274
|
||||
(byte) IRQ_RASTER ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53280
|
||||
(byte*) FGCOL ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte*) CIA1_INTERRUPT ← ((byte*)) (word/dword/signed dword) 56333
|
||||
(byte) CIA_INTERRUPT_CLEAR ← (byte/signed byte/word/signed word/dword/signed dword) 127
|
||||
(byte*) PROCPORT_DDR ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK ← (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
(byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) PROCPORT_RAM_IO ← (byte/signed byte/word/signed word/dword/signed dword) 53
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
asm { sei }
|
||||
*((byte*) PROCPORT_DDR) ← (byte) PROCPORT_DDR_MEMORY_MASK
|
||||
*((byte*) PROCPORT) ← (byte) PROCPORT_RAM_IO
|
||||
*((byte*) CIA1_INTERRUPT) ← (byte) CIA_INTERRUPT_CLEAR
|
||||
*((byte*) VIC_CONTROL) ← *((byte*) VIC_CONTROL) | (byte/word/signed word/dword/signed dword) 128
|
||||
*((byte*) RASTER) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
*((byte*) IRQ_ENABLE) ← (byte) IRQ_RASTER
|
||||
(void()*~) main::$0 ← & interrupt(HARDWARE_CLOBBER)(void()) irq()
|
||||
*((void()**) HARDWARE_IRQ) ← (void()*~) main::$0
|
||||
asm { cli }
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
if(true) goto main::@2
|
||||
to:main::@4
|
||||
main::@2: scope:[main] from main::@1 main::@5
|
||||
*((byte*) FGCOL) ← ++ *((byte*) FGCOL)
|
||||
to:main::@1
|
||||
main::@4: scope:[main] from main::@1
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@4 main::@6
|
||||
to:main::@return
|
||||
main::@5: scope:[main] from
|
||||
to:main::@2
|
||||
main::@6: scope:[main] from
|
||||
to:main::@3
|
||||
main::@return: scope:[main] from main::@3
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
irq: scope:[irq] from
|
||||
*((byte*) BGCOL) ← (byte) WHITE
|
||||
*((byte*) BGCOL) ← (byte) BLACK
|
||||
*((byte*) IRQ_STATUS) ← (byte) IRQ_RASTER
|
||||
to:irq::@return
|
||||
irq::@return: scope:[irq] from irq
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Eliminating unused variable (void()**) KERNEL_IRQ and assignment [0] (void()**) KERNEL_IRQ ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_BG and assignment [7] (byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_SPRITE and assignment [8] (byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
Eliminating unused variable (byte) IRQ_LIGHTPEN and assignment [9] (byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Removing empty block main::@4
|
||||
Removing empty block main::@3
|
||||
Removing empty block main::@5
|
||||
Removing empty block main::@6
|
||||
Removing empty block @1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(void()**) HARDWARE_IRQ#0 ← ((void()**)) (word/dword/signed dword) 65534
|
||||
(byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266
|
||||
@ -321,13 +134,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,193 +1,6 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/irq-hardware.kc
|
||||
// A minimal working raster IRQ
|
||||
|
||||
const void()** KERNEL_IRQ = $0314;
|
||||
const void()** HARDWARE_IRQ = $fffe;
|
||||
const byte* RASTER = $d012;
|
||||
const byte* VIC_CONTROL = $d011;
|
||||
const byte* IRQ_STATUS = $d019;
|
||||
const byte* IRQ_ENABLE = $d01a;
|
||||
const byte IRQ_RASTER = %00000001;
|
||||
const byte IRQ_COLLISION_BG = %00000010;
|
||||
const byte IRQ_COLLISION_SPRITE = %00000100;
|
||||
const byte IRQ_LIGHTPEN = %00001000;
|
||||
const byte* BGCOL = $d020;
|
||||
const byte* FGCOL = $d021;
|
||||
const byte WHITE = 1;
|
||||
const byte BLACK = 0;
|
||||
|
||||
const byte* CIA1_INTERRUPT = $dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
|
||||
// Processor port data direction register
|
||||
const byte* PROCPORT_DDR = $00;
|
||||
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
|
||||
const byte PROCPORT_DDR_MEMORY_MASK = %00000111;
|
||||
|
||||
// Processor Port Register controlling RAM/ROM configuration and the datasette
|
||||
const byte* PROCPORT = $01;
|
||||
// RAM in $A000, $E000 I/O in $D000
|
||||
const byte PROCPORT_RAM_IO = %00110101;
|
||||
// RAM in $A000, $E000 CHAR ROM in $D000
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
// Disable kernal & basic
|
||||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
// Set raster line to $100
|
||||
*VIC_CONTROL |=$80;
|
||||
*RASTER = $00;
|
||||
// Enable Raster Interrupt
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
// Set the IRQ routine
|
||||
*HARDWARE_IRQ = &irq;
|
||||
asm { cli }
|
||||
while(true) {
|
||||
(*FGCOL)++;
|
||||
}
|
||||
}
|
||||
|
||||
// Interrupt Routine
|
||||
interrupt(hardware_all) void irq() {
|
||||
*BGCOL = WHITE;
|
||||
*BGCOL = BLACK;
|
||||
// Acknowledge the IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
}
|
||||
Adding pre/post-modifier *((byte*) FGCOL) ← ++ *((byte*) FGCOL)
|
||||
Resolved forward reference irq to interrupt(HARDWARE_ALL)(void()) irq()
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte) BLACK
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(byte*) FGCOL
|
||||
(void()**) HARDWARE_IRQ
|
||||
(byte) IRQ_COLLISION_BG
|
||||
(byte) IRQ_COLLISION_SPRITE
|
||||
(byte*) IRQ_ENABLE
|
||||
(byte) IRQ_LIGHTPEN
|
||||
(byte) IRQ_RASTER
|
||||
(byte*) IRQ_STATUS
|
||||
(void()**) KERNEL_IRQ
|
||||
(byte*) PROCPORT
|
||||
(byte*) PROCPORT_DDR
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK
|
||||
(byte) PROCPORT_RAM_IO
|
||||
(byte*) RASTER
|
||||
(byte*) VIC_CONTROL
|
||||
(byte) WHITE
|
||||
interrupt(HARDWARE_ALL)(void()) irq()
|
||||
(label) irq::@return
|
||||
(void()) main()
|
||||
(void()*~) main::$0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to void()** in KERNEL_IRQ ← ((void()**)) 788
|
||||
Promoting word/dword/signed dword to void()** in HARDWARE_IRQ ← ((void()**)) 65534
|
||||
Promoting word/dword/signed dword to byte* in RASTER ← ((byte*)) 53266
|
||||
Promoting word/dword/signed dword to byte* in VIC_CONTROL ← ((byte*)) 53265
|
||||
Promoting word/dword/signed dword to byte* in IRQ_STATUS ← ((byte*)) 53273
|
||||
Promoting word/dword/signed dword to byte* in IRQ_ENABLE ← ((byte*)) 53274
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53280
|
||||
Promoting word/dword/signed dword to byte* in FGCOL ← ((byte*)) 53281
|
||||
Promoting word/dword/signed dword to byte* in CIA1_INTERRUPT ← ((byte*)) 56333
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in PROCPORT_DDR ← ((byte*)) 0
|
||||
Promoting byte/signed byte/word/signed word/dword/signed dword to byte* in PROCPORT ← ((byte*)) 1
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(void()**) KERNEL_IRQ ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
(void()**) HARDWARE_IRQ ← ((void()**)) (word/dword/signed dword) 65534
|
||||
(byte*) RASTER ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) VIC_CONTROL ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte*) IRQ_STATUS ← ((byte*)) (word/dword/signed dword) 53273
|
||||
(byte*) IRQ_ENABLE ← ((byte*)) (word/dword/signed dword) 53274
|
||||
(byte) IRQ_RASTER ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53280
|
||||
(byte*) FGCOL ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte*) CIA1_INTERRUPT ← ((byte*)) (word/dword/signed dword) 56333
|
||||
(byte) CIA_INTERRUPT_CLEAR ← (byte/signed byte/word/signed word/dword/signed dword) 127
|
||||
(byte*) PROCPORT_DDR ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK ← (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
(byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) PROCPORT_RAM_IO ← (byte/signed byte/word/signed word/dword/signed dword) 53
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
asm { sei }
|
||||
*((byte*) PROCPORT_DDR) ← (byte) PROCPORT_DDR_MEMORY_MASK
|
||||
*((byte*) PROCPORT) ← (byte) PROCPORT_RAM_IO
|
||||
*((byte*) CIA1_INTERRUPT) ← (byte) CIA_INTERRUPT_CLEAR
|
||||
*((byte*) VIC_CONTROL) ← *((byte*) VIC_CONTROL) | (byte/word/signed word/dword/signed dword) 128
|
||||
*((byte*) RASTER) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
*((byte*) IRQ_ENABLE) ← (byte) IRQ_RASTER
|
||||
(void()*~) main::$0 ← & interrupt(HARDWARE_ALL)(void()) irq()
|
||||
*((void()**) HARDWARE_IRQ) ← (void()*~) main::$0
|
||||
asm { cli }
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@2
|
||||
if(true) goto main::@2
|
||||
to:main::@4
|
||||
main::@2: scope:[main] from main::@1 main::@5
|
||||
*((byte*) FGCOL) ← ++ *((byte*) FGCOL)
|
||||
to:main::@1
|
||||
main::@4: scope:[main] from main::@1
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@4 main::@6
|
||||
to:main::@return
|
||||
main::@5: scope:[main] from
|
||||
to:main::@2
|
||||
main::@6: scope:[main] from
|
||||
to:main::@3
|
||||
main::@return: scope:[main] from main::@3
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
irq: scope:[irq] from
|
||||
*((byte*) BGCOL) ← (byte) WHITE
|
||||
*((byte*) BGCOL) ← (byte) BLACK
|
||||
*((byte*) IRQ_STATUS) ← (byte) IRQ_RASTER
|
||||
to:irq::@return
|
||||
irq::@return: scope:[irq] from irq
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Eliminating unused variable (void()**) KERNEL_IRQ and assignment [0] (void()**) KERNEL_IRQ ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_BG and assignment [7] (byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_SPRITE and assignment [8] (byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
Eliminating unused variable (byte) IRQ_LIGHTPEN and assignment [9] (byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Removing empty block main::@4
|
||||
Removing empty block main::@3
|
||||
Removing empty block main::@5
|
||||
Removing empty block main::@6
|
||||
Removing empty block @1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(void()**) HARDWARE_IRQ#0 ← ((void()**)) (word/dword/signed dword) 65534
|
||||
(byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266
|
||||
@ -321,13 +134,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,190 +1,7 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/irq-hyperscreen.kc
|
||||
// A raster IRQ that opens the top/bottom border.
|
||||
|
||||
const void()** KERNEL_IRQ = $0314;
|
||||
const byte* RASTER = $d012;
|
||||
const byte* VIC_CONTROL = $d011;
|
||||
const byte VIC_RSEL = $8;
|
||||
const byte* IRQ_STATUS = $d019;
|
||||
const byte* IRQ_ENABLE = $d01a;
|
||||
const byte IRQ_RASTER = %00000001;
|
||||
const byte IRQ_COLLISION_BG = %00000010;
|
||||
const byte IRQ_COLLISION_SPRITE = %00000100;
|
||||
const byte IRQ_LIGHTPEN = %00001000;
|
||||
const byte* BGCOL = $d020;
|
||||
const byte* FGCOL = $d021;
|
||||
const byte WHITE = 1;
|
||||
const byte RED = 2;
|
||||
|
||||
const byte* CIA1_INTERRUPT = $dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
|
||||
const byte* GHOST_BYTE = $3fff;
|
||||
|
||||
void main() {
|
||||
*GHOST_BYTE = 0;
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
// Set raster line to $fa
|
||||
*VIC_CONTROL &=$7f;
|
||||
*RASTER = $fa;
|
||||
// Enable Raster Interrupt
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
// Set the IRQ routine
|
||||
*KERNEL_IRQ = &irq_bottom_1;
|
||||
asm { cli }
|
||||
}
|
||||
|
||||
// Interrupt Routine 1
|
||||
interrupt(kernel_min) void irq_bottom_1() {
|
||||
*FGCOL = WHITE;
|
||||
// Set screen height to 24 lines - this is done after the border should have started drawing - so it wont start
|
||||
*VIC_CONTROL &= ($ff^VIC_RSEL);
|
||||
// Acknowledge the IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
// Trigger IRQ 2 at line $fd
|
||||
*RASTER = $fd;
|
||||
*KERNEL_IRQ = &irq_bottom_2;
|
||||
*FGCOL = RED;
|
||||
}
|
||||
|
||||
// Interrupt Routine 2
|
||||
interrupt(kernel_keyboard) void irq_bottom_2() {
|
||||
*FGCOL = WHITE;
|
||||
// Set screen height back to 25 lines (preparing for the next screen)
|
||||
*VIC_CONTROL |= VIC_RSEL;
|
||||
// Acknowledge the IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
// Trigger IRQ 1 at line $fa
|
||||
*RASTER = $fa;
|
||||
*KERNEL_IRQ = &irq_bottom_1;
|
||||
*FGCOL = RED;
|
||||
}
|
||||
Resolved forward reference irq_bottom_1 to interrupt(KERNEL_MIN)(void()) irq_bottom_1()
|
||||
Resolved forward reference irq_bottom_2 to interrupt(KERNEL_KEYBOARD)(void()) irq_bottom_2()
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(byte*) FGCOL
|
||||
(byte*) GHOST_BYTE
|
||||
(byte) IRQ_COLLISION_BG
|
||||
(byte) IRQ_COLLISION_SPRITE
|
||||
(byte*) IRQ_ENABLE
|
||||
(byte) IRQ_LIGHTPEN
|
||||
(byte) IRQ_RASTER
|
||||
(byte*) IRQ_STATUS
|
||||
(void()**) KERNEL_IRQ
|
||||
(byte*) RASTER
|
||||
(byte) RED
|
||||
(byte*) VIC_CONTROL
|
||||
(byte) VIC_RSEL
|
||||
(byte) WHITE
|
||||
interrupt(KERNEL_MIN)(void()) irq_bottom_1()
|
||||
(byte/word/dword~) irq_bottom_1::$0
|
||||
(void()*~) irq_bottom_1::$1
|
||||
(label) irq_bottom_1::@return
|
||||
interrupt(KERNEL_KEYBOARD)(void()) irq_bottom_2()
|
||||
(void()*~) irq_bottom_2::$0
|
||||
(label) irq_bottom_2::@return
|
||||
(void()) main()
|
||||
(void()*~) main::$0
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to void()** in KERNEL_IRQ ← ((void()**)) 788
|
||||
Promoting word/dword/signed dword to byte* in RASTER ← ((byte*)) 53266
|
||||
Promoting word/dword/signed dword to byte* in VIC_CONTROL ← ((byte*)) 53265
|
||||
Promoting word/dword/signed dword to byte* in IRQ_STATUS ← ((byte*)) 53273
|
||||
Promoting word/dword/signed dword to byte* in IRQ_ENABLE ← ((byte*)) 53274
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53280
|
||||
Promoting word/dword/signed dword to byte* in FGCOL ← ((byte*)) 53281
|
||||
Promoting word/dword/signed dword to byte* in CIA1_INTERRUPT ← ((byte*)) 56333
|
||||
Promoting word/signed word/dword/signed dword to byte* in GHOST_BYTE ← ((byte*)) 16383
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(void()**) KERNEL_IRQ ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
(byte*) RASTER ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) VIC_CONTROL ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte) VIC_RSEL ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) IRQ_STATUS ← ((byte*)) (word/dword/signed dword) 53273
|
||||
(byte*) IRQ_ENABLE ← ((byte*)) (word/dword/signed dword) 53274
|
||||
(byte) IRQ_RASTER ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53280
|
||||
(byte*) FGCOL ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) RED ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte*) CIA1_INTERRUPT ← ((byte*)) (word/dword/signed dword) 56333
|
||||
(byte) CIA_INTERRUPT_CLEAR ← (byte/signed byte/word/signed word/dword/signed dword) 127
|
||||
(byte*) GHOST_BYTE ← ((byte*)) (word/signed word/dword/signed dword) 16383
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
*((byte*) GHOST_BYTE) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
asm { sei }
|
||||
*((byte*) CIA1_INTERRUPT) ← (byte) CIA_INTERRUPT_CLEAR
|
||||
*((byte*) VIC_CONTROL) ← *((byte*) VIC_CONTROL) & (byte/signed byte/word/signed word/dword/signed dword) 127
|
||||
*((byte*) RASTER) ← (byte/word/signed word/dword/signed dword) 250
|
||||
*((byte*) IRQ_ENABLE) ← (byte) IRQ_RASTER
|
||||
(void()*~) main::$0 ← & interrupt(KERNEL_MIN)(void()) irq_bottom_1()
|
||||
*((void()**) KERNEL_IRQ) ← (void()*~) main::$0
|
||||
asm { cli }
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
irq_bottom_1: scope:[irq_bottom_1] from
|
||||
*((byte*) FGCOL) ← (byte) WHITE
|
||||
(byte/word/dword~) irq_bottom_1::$0 ← (byte/word/signed word/dword/signed dword) 255 ^ (byte) VIC_RSEL
|
||||
*((byte*) VIC_CONTROL) ← *((byte*) VIC_CONTROL) & (byte/word/dword~) irq_bottom_1::$0
|
||||
*((byte*) IRQ_STATUS) ← (byte) IRQ_RASTER
|
||||
*((byte*) RASTER) ← (byte/word/signed word/dword/signed dword) 253
|
||||
(void()*~) irq_bottom_1::$1 ← & interrupt(KERNEL_KEYBOARD)(void()) irq_bottom_2()
|
||||
*((void()**) KERNEL_IRQ) ← (void()*~) irq_bottom_1::$1
|
||||
*((byte*) FGCOL) ← (byte) RED
|
||||
to:irq_bottom_1::@return
|
||||
irq_bottom_1::@return: scope:[irq_bottom_1] from irq_bottom_1
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
irq_bottom_2: scope:[irq_bottom_2] from
|
||||
*((byte*) FGCOL) ← (byte) WHITE
|
||||
*((byte*) VIC_CONTROL) ← *((byte*) VIC_CONTROL) | (byte) VIC_RSEL
|
||||
*((byte*) IRQ_STATUS) ← (byte) IRQ_RASTER
|
||||
*((byte*) RASTER) ← (byte/word/signed word/dword/signed dword) 250
|
||||
(void()*~) irq_bottom_2::$0 ← & interrupt(KERNEL_MIN)(void()) irq_bottom_1()
|
||||
*((void()**) KERNEL_IRQ) ← (void()*~) irq_bottom_2::$0
|
||||
*((byte*) FGCOL) ← (byte) RED
|
||||
to:irq_bottom_2::@return
|
||||
irq_bottom_2::@return: scope:[irq_bottom_2] from irq_bottom_2
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @3
|
||||
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_BG and assignment [7] (byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_SPRITE and assignment [8] (byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
Eliminating unused variable (byte) IRQ_LIGHTPEN and assignment [9] (byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Eliminating unused variable (byte*) BGCOL and assignment [10] (byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53280
|
||||
Removing empty block @1
|
||||
Removing empty block @2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(void()**) KERNEL_IRQ#0 ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
(byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266
|
||||
@ -320,13 +137,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @3
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,130 +1,6 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/irq-kernel.kc
|
||||
// A minimal working raster IRQ
|
||||
|
||||
const void()** KERNEL_IRQ = $0314;
|
||||
const byte* RASTER = $d012;
|
||||
const byte* VIC_CONTROL = $d011;
|
||||
const byte* IRQ_STATUS = $d019;
|
||||
const byte* IRQ_ENABLE = $d01a;
|
||||
const byte IRQ_RASTER = %00000001;
|
||||
const byte IRQ_COLLISION_BG = %00000010;
|
||||
const byte IRQ_COLLISION_SPRITE = %00000100;
|
||||
const byte IRQ_LIGHTPEN = %00001000;
|
||||
const byte* BGCOL = $d020;
|
||||
const byte WHITE = 1;
|
||||
const byte BLACK = 0;
|
||||
|
||||
const byte* CIA1_INTERRUPT = $dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
// Set raster line to $100
|
||||
*VIC_CONTROL |=$80;
|
||||
*RASTER = $00;
|
||||
// Enable Raster Interrupt
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
// Set the IRQ routine
|
||||
*KERNEL_IRQ = &irq;
|
||||
asm { cli }
|
||||
}
|
||||
|
||||
// Interrupt Routine
|
||||
interrupt(kernel_keyboard) void irq() {
|
||||
*BGCOL = WHITE;
|
||||
*BGCOL = BLACK;
|
||||
// Acknowledge the IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
}
|
||||
Resolved forward reference irq to interrupt(KERNEL_KEYBOARD)(void()) irq()
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte) BLACK
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(byte) IRQ_COLLISION_BG
|
||||
(byte) IRQ_COLLISION_SPRITE
|
||||
(byte*) IRQ_ENABLE
|
||||
(byte) IRQ_LIGHTPEN
|
||||
(byte) IRQ_RASTER
|
||||
(byte*) IRQ_STATUS
|
||||
(void()**) KERNEL_IRQ
|
||||
(byte*) RASTER
|
||||
(byte*) VIC_CONTROL
|
||||
(byte) WHITE
|
||||
interrupt(KERNEL_KEYBOARD)(void()) irq()
|
||||
(label) irq::@return
|
||||
(void()) main()
|
||||
(void()*~) main::$0
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to void()** in KERNEL_IRQ ← ((void()**)) 788
|
||||
Promoting word/dword/signed dword to byte* in RASTER ← ((byte*)) 53266
|
||||
Promoting word/dword/signed dword to byte* in VIC_CONTROL ← ((byte*)) 53265
|
||||
Promoting word/dword/signed dword to byte* in IRQ_STATUS ← ((byte*)) 53273
|
||||
Promoting word/dword/signed dword to byte* in IRQ_ENABLE ← ((byte*)) 53274
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53280
|
||||
Promoting word/dword/signed dword to byte* in CIA1_INTERRUPT ← ((byte*)) 56333
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(void()**) KERNEL_IRQ ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
(byte*) RASTER ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) VIC_CONTROL ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte*) IRQ_STATUS ← ((byte*)) (word/dword/signed dword) 53273
|
||||
(byte*) IRQ_ENABLE ← ((byte*)) (word/dword/signed dword) 53274
|
||||
(byte) IRQ_RASTER ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53280
|
||||
(byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte*) CIA1_INTERRUPT ← ((byte*)) (word/dword/signed dword) 56333
|
||||
(byte) CIA_INTERRUPT_CLEAR ← (byte/signed byte/word/signed word/dword/signed dword) 127
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
asm { sei }
|
||||
*((byte*) CIA1_INTERRUPT) ← (byte) CIA_INTERRUPT_CLEAR
|
||||
*((byte*) VIC_CONTROL) ← *((byte*) VIC_CONTROL) | (byte/word/signed word/dword/signed dword) 128
|
||||
*((byte*) RASTER) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
*((byte*) IRQ_ENABLE) ← (byte) IRQ_RASTER
|
||||
(void()*~) main::$0 ← & interrupt(KERNEL_KEYBOARD)(void()) irq()
|
||||
*((void()**) KERNEL_IRQ) ← (void()*~) main::$0
|
||||
asm { cli }
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
irq: scope:[irq] from
|
||||
*((byte*) BGCOL) ← (byte) WHITE
|
||||
*((byte*) BGCOL) ← (byte) BLACK
|
||||
*((byte*) IRQ_STATUS) ← (byte) IRQ_RASTER
|
||||
to:irq::@return
|
||||
irq::@return: scope:[irq] from irq
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_BG and assignment [6] (byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_SPRITE and assignment [7] (byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
Eliminating unused variable (byte) IRQ_LIGHTPEN and assignment [8] (byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Removing empty block @1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(void()**) KERNEL_IRQ#0 ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
(byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266
|
||||
@ -222,13 +98,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,130 +1,6 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/irq-raster.kc
|
||||
// A minimal working raster IRQ
|
||||
|
||||
const void()** KERNEL_IRQ = $0314;
|
||||
const byte* RASTER = $d012;
|
||||
const byte* VIC_CONTROL = $d011;
|
||||
const byte* IRQ_STATUS = $d019;
|
||||
const byte* IRQ_ENABLE = $d01a;
|
||||
const byte IRQ_RASTER = %00000001;
|
||||
const byte IRQ_COLLISION_BG = %00000010;
|
||||
const byte IRQ_COLLISION_SPRITE = %00000100;
|
||||
const byte IRQ_LIGHTPEN = %00001000;
|
||||
const byte* BGCOL = $d020;
|
||||
const byte WHITE = 1;
|
||||
const byte BLACK = 0;
|
||||
|
||||
const byte* CIA1_INTERRUPT = $dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
// Set raster line to $100
|
||||
*VIC_CONTROL |=$80;
|
||||
*RASTER = $00;
|
||||
// Enable Raster Interrupt
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
// Set the IRQ routine
|
||||
*KERNEL_IRQ = &irq;
|
||||
asm { cli }
|
||||
}
|
||||
|
||||
// Interrupt Routine
|
||||
interrupt void irq() {
|
||||
*BGCOL = WHITE;
|
||||
*BGCOL = BLACK;
|
||||
// Acknowledge the IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
}
|
||||
Resolved forward reference irq to interrupt(KERNEL_MIN)(void()) irq()
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte) BLACK
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(byte) IRQ_COLLISION_BG
|
||||
(byte) IRQ_COLLISION_SPRITE
|
||||
(byte*) IRQ_ENABLE
|
||||
(byte) IRQ_LIGHTPEN
|
||||
(byte) IRQ_RASTER
|
||||
(byte*) IRQ_STATUS
|
||||
(void()**) KERNEL_IRQ
|
||||
(byte*) RASTER
|
||||
(byte*) VIC_CONTROL
|
||||
(byte) WHITE
|
||||
interrupt(KERNEL_MIN)(void()) irq()
|
||||
(label) irq::@return
|
||||
(void()) main()
|
||||
(void()*~) main::$0
|
||||
(label) main::@return
|
||||
|
||||
Promoting word/signed word/dword/signed dword to void()** in KERNEL_IRQ ← ((void()**)) 788
|
||||
Promoting word/dword/signed dword to byte* in RASTER ← ((byte*)) 53266
|
||||
Promoting word/dword/signed dword to byte* in VIC_CONTROL ← ((byte*)) 53265
|
||||
Promoting word/dword/signed dword to byte* in IRQ_STATUS ← ((byte*)) 53273
|
||||
Promoting word/dword/signed dword to byte* in IRQ_ENABLE ← ((byte*)) 53274
|
||||
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53280
|
||||
Promoting word/dword/signed dword to byte* in CIA1_INTERRUPT ← ((byte*)) 56333
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(void()**) KERNEL_IRQ ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
(byte*) RASTER ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) VIC_CONTROL ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte*) IRQ_STATUS ← ((byte*)) (word/dword/signed dword) 53273
|
||||
(byte*) IRQ_ENABLE ← ((byte*)) (word/dword/signed dword) 53274
|
||||
(byte) IRQ_RASTER ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53280
|
||||
(byte) WHITE ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) BLACK ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte*) CIA1_INTERRUPT ← ((byte*)) (word/dword/signed dword) 56333
|
||||
(byte) CIA_INTERRUPT_CLEAR ← (byte/signed byte/word/signed word/dword/signed dword) 127
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
asm { sei }
|
||||
*((byte*) CIA1_INTERRUPT) ← (byte) CIA_INTERRUPT_CLEAR
|
||||
*((byte*) VIC_CONTROL) ← *((byte*) VIC_CONTROL) | (byte/word/signed word/dword/signed dword) 128
|
||||
*((byte*) RASTER) ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
*((byte*) IRQ_ENABLE) ← (byte) IRQ_RASTER
|
||||
(void()*~) main::$0 ← & interrupt(KERNEL_MIN)(void()) irq()
|
||||
*((void()**) KERNEL_IRQ) ← (void()*~) main::$0
|
||||
asm { cli }
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
irq: scope:[irq] from
|
||||
*((byte*) BGCOL) ← (byte) WHITE
|
||||
*((byte*) BGCOL) ← (byte) BLACK
|
||||
*((byte*) IRQ_STATUS) ← (byte) IRQ_RASTER
|
||||
to:irq::@return
|
||||
irq::@return: scope:[irq] from irq
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_BG and assignment [6] (byte) IRQ_COLLISION_BG ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
Eliminating unused variable (byte) IRQ_COLLISION_SPRITE and assignment [7] (byte) IRQ_COLLISION_SPRITE ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
Eliminating unused variable (byte) IRQ_LIGHTPEN and assignment [8] (byte) IRQ_LIGHTPEN ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
Removing empty block @1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(void()**) KERNEL_IRQ#0 ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
(byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266
|
||||
@ -222,13 +98,11 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,60 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/iterarray.kc
|
||||
void main() {
|
||||
byte[16] buf = $1100;
|
||||
byte i = 5;
|
||||
do {
|
||||
buf[i] = 2+i+2;
|
||||
i = i+1;
|
||||
} while(i<10);
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(byte/signed word/word/dword/signed dword~) main::$0
|
||||
(byte/signed word/word/dword/signed dword~) main::$1
|
||||
(byte/signed word/word/dword/signed dword~) main::$2
|
||||
(bool~) main::$3
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte[16]) main::buf
|
||||
(byte) main::i
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte[16] in main::buf ← ((byte*)) 4352
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte[16]) main::buf ← ((byte*)) (word/signed word/dword/signed dword) 4352
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte/signed word/word/dword/signed dword~) main::$0 ← (byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) main::i
|
||||
(byte/signed word/word/dword/signed dword~) main::$1 ← (byte/signed word/word/dword/signed dword~) main::$0 + (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
*((byte[16]) main::buf + (byte) main::i) ← (byte/signed word/word/dword/signed dword~) main::$1
|
||||
(byte/signed word/word/dword/signed dword~) main::$2 ← (byte) main::i + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) main::i ← (byte/signed word/word/dword/signed dword~) main::$2
|
||||
(bool~) main::$3 ← (byte) main::i < (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
if((bool~) main::$3) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@1
|
||||
main: scope:[main] from @1
|
||||
@ -125,8 +70,6 @@ Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [11] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -135,8 +78,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,83 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/literals.kc
|
||||
byte* SCREEN = $0400;
|
||||
|
||||
byte char = 'a';
|
||||
byte num = 1;
|
||||
byte[] str = "bc"+"d"+'e';
|
||||
byte[] nums = { 2, 3, 4, 5};
|
||||
|
||||
void main() {
|
||||
SCREEN[0] = char;
|
||||
SCREEN[2] = num;
|
||||
for(byte i : 0..3) {
|
||||
SCREEN[4+i] = str[i];
|
||||
SCREEN[9+i] = nums[i];
|
||||
}
|
||||
}
|
||||
SYMBOLS
|
||||
(string~) $0
|
||||
(string~) $1
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) SCREEN
|
||||
(byte) char
|
||||
(void()) main()
|
||||
(byte/signed word/word/dword/signed dword~) main::$0
|
||||
(byte/signed word/word/dword/signed dword~) main::$1
|
||||
(bool~) main::$2
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(byte) num
|
||||
(byte[]) nums
|
||||
(byte[]) str
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte) char ← (byte) 'a'
|
||||
(byte) num ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(string~) $0 ← (string) "bc" + (string) "d"
|
||||
(string~) $1 ← (string~) $0 + (byte) 'e'
|
||||
(byte[]) str ← (string~) $1
|
||||
(byte[]) nums ← { (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 3, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 5 }
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
*((byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) char
|
||||
*((byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) num
|
||||
(byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
(byte/signed word/word/dword/signed dword~) main::$0 ← (byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) main::i
|
||||
*((byte*) SCREEN + (byte/signed word/word/dword/signed dword~) main::$0) ← *((byte[]) str + (byte) main::i)
|
||||
(byte/signed word/word/dword/signed dword~) main::$1 ← (byte/signed byte/word/signed word/dword/signed dword) 9 + (byte) main::i
|
||||
*((byte*) SCREEN + (byte/signed word/word/dword/signed dword~) main::$1) ← *((byte[]) nums + (byte) main::i)
|
||||
(byte) main::i ← (byte) main::i + rangenext(0,3)
|
||||
(bool~) main::$2 ← (byte) main::i != rangelast(0,3)
|
||||
if((bool~) main::$2) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
|
||||
Creating constant string variable for inline (const string) $2 "bc"
|
||||
Creating constant string variable for inline (const string) $3 "d"
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
(byte) char#0 ← (byte) 'a'
|
||||
@ -207,8 +129,6 @@ Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [12] main::i#3 ← main::i#1
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -216,8 +136,6 @@ Culled Empty Block (label) main::@3
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,96 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/liverange-call-problem.kc
|
||||
// Live ranges were not functioning properly, when multiple method calls were chained - each modifying different vars.
|
||||
// w1 and w2 ended up having the same zero-page register as their live range was not propagated properly
|
||||
|
||||
word w1 = 0;
|
||||
word w2 = 0;
|
||||
|
||||
void main() {
|
||||
incw1();
|
||||
incw2();
|
||||
incw1();
|
||||
incw2();
|
||||
}
|
||||
|
||||
void incw1() {
|
||||
w1++;
|
||||
}
|
||||
|
||||
void incw2() {
|
||||
w2++;
|
||||
}
|
||||
|
||||
Adding pre/post-modifier (word) w1 ← ++ (word) w1
|
||||
Adding pre/post-modifier (word) w2 ← ++ (word) w2
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) incw1()
|
||||
(label) incw1::@return
|
||||
(void()) incw2()
|
||||
(label) incw2::@return
|
||||
(void()) main()
|
||||
(void~) main::$0
|
||||
(void~) main::$1
|
||||
(void~) main::$2
|
||||
(void~) main::$3
|
||||
(label) main::@return
|
||||
(word) w1
|
||||
(word) w2
|
||||
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(word) w1 ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(word) w2 ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call incw1
|
||||
(void~) main::$1 ← call incw2
|
||||
(void~) main::$2 ← call incw1
|
||||
(void~) main::$3 ← call incw2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
incw1: scope:[incw1] from
|
||||
(word) w1 ← ++ (word) w1
|
||||
to:incw1::@return
|
||||
incw1::@return: scope:[incw1] from incw1
|
||||
return
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
incw2: scope:[incw2] from
|
||||
(word) w2 ← ++ (word) w2
|
||||
to:incw2::@return
|
||||
incw2::@return: scope:[incw2] from incw2
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @3
|
||||
|
||||
Eliminating unused variable (word) w1 and assignment [0] (word) w1 ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
Eliminating unused variable (word) w2 and assignment [1] (word) w2 ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
Eliminating unused variable - keeping the call (void~) main::$0
|
||||
Eliminating unused variable - keeping the call (void~) main::$1
|
||||
Eliminating unused variable - keeping the call (void~) main::$2
|
||||
Eliminating unused variable - keeping the call (void~) main::$3
|
||||
Eliminating unused variable w1(null) and assignment [7] w1(null) ← ++ w1(null)
|
||||
Eliminating unused variable w2(null) and assignment [9] w2(null) ← ++ w2(null)
|
||||
Removing empty block @1
|
||||
Removing empty block @2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
to:@3
|
||||
main: scope:[main] from @3
|
||||
@ -159,7 +68,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to incw1:5 incw2:7 incw1:9 incw2:11
|
||||
|
||||
Propagating live ranges...
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
@ -171,7 +79,6 @@ Adding NOP phi() at start of main::@2
|
||||
Adding NOP phi() at start of main::@3
|
||||
Adding NOP phi() at start of incw2
|
||||
Adding NOP phi() at start of incw1
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
@ -1,89 +1,5 @@
|
||||
PARSING src/test/java/dk/camelot64/kickc/test/kc/liverange.kc
|
||||
byte i=0;
|
||||
|
||||
void main() {
|
||||
byte a=4;
|
||||
a=a+inci();
|
||||
a=a+inci();
|
||||
byte* SCREEN = $400;
|
||||
*SCREEN = i;
|
||||
*(SCREEN+1) = a;
|
||||
}
|
||||
|
||||
byte inci() {
|
||||
i = i+7;
|
||||
return i;
|
||||
}
|
||||
SYMBOLS
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte) i
|
||||
(byte()) inci()
|
||||
(byte/signed word/word/dword/signed dword~) inci::$0
|
||||
(label) inci::@1
|
||||
(label) inci::@return
|
||||
(byte) inci::return
|
||||
(void()) main()
|
||||
(byte~) main::$0
|
||||
(byte~) main::$1
|
||||
(byte~) main::$2
|
||||
(byte~) main::$3
|
||||
(byte*~) main::$4
|
||||
(label) main::@return
|
||||
(byte*) main::SCREEN
|
||||
(byte) main::a
|
||||
|
||||
Promoting word/signed word/dword/signed dword to byte* in main::SCREEN ← ((byte*)) 1024
|
||||
INITIAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
(byte) i ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:@1
|
||||
main: scope:[main] from
|
||||
(byte) main::a ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte~) main::$0 ← call inci
|
||||
(byte~) main::$1 ← (byte) main::a + (byte~) main::$0
|
||||
(byte) main::a ← (byte~) main::$1
|
||||
(byte~) main::$2 ← call inci
|
||||
(byte~) main::$3 ← (byte) main::a + (byte~) main::$2
|
||||
(byte) main::a ← (byte~) main::$3
|
||||
(byte*) main::SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
|
||||
*((byte*) main::SCREEN) ← (byte) i
|
||||
(byte*~) main::$4 ← (byte*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
*((byte*~) main::$4) ← (byte) main::a
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
to:@2
|
||||
inci: scope:[inci] from
|
||||
(byte/signed word/word/dword/signed dword~) inci::$0 ← (byte) i + (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
(byte) i ← (byte/signed word/word/dword/signed dword~) inci::$0
|
||||
(byte) inci::return ← (byte) i
|
||||
to:inci::@return
|
||||
inci::@return: scope:[inci] from inci inci::@1
|
||||
(byte) inci::return ← (byte) inci::return
|
||||
return (byte) inci::return
|
||||
to:@return
|
||||
inci::@1: scope:[inci] from
|
||||
to:inci::@return
|
||||
@2: scope:[] from @1
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @2
|
||||
|
||||
Removing empty block @1
|
||||
Removing empty block inci::@1
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
main modifies i
|
||||
inci modifies i
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
|
||||
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte) i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
to:@2
|
||||
@ -234,12 +150,6 @@ CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
Calls in [main] to inci:5 inci:10
|
||||
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Created 1 initial phi equivalence classes
|
||||
Coalesced [9] i#15 ← i#11
|
||||
Coalesced down to 1 phi equivalence classes
|
||||
@ -247,12 +157,6 @@ Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @2
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
Propagating live ranges...
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user