1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-08-09 04:25:12 +00:00

Working on memory model ma_mem. Added some support for local static variables.

This commit is contained in:
jespergravgaard
2020-02-13 11:36:27 +01:00
parent 600a80dbcc
commit f106f953a8
55 changed files with 3998 additions and 4265 deletions

View File

@@ -62,6 +62,9 @@ public class Variable implements Symbol {
/** Specifies that the variable is not allowed to be modified (const keyword) */ /** Specifies that the variable is not allowed to be modified (const keyword) */
private boolean noModify; private boolean noModify;
/** Specifies that the variable is a local permanent variable (local variable static keyword) */
private boolean permanent;
/** Specifies that the variable must always live in memory to be available for any multi-threaded accees (eg. in interrupts). (volatile keyword) [Only Variables] */ /** Specifies that the variable must always live in memory to be available for any multi-threaded accees (eg. in interrupts). (volatile keyword) [Only Variables] */
private boolean isVolatile; private boolean isVolatile;
@@ -185,6 +188,7 @@ public class Variable implements Symbol {
version.setNoModify(phiMaster.isNoModify()); version.setNoModify(phiMaster.isNoModify());
version.setRegister(phiMaster.getRegister()); version.setRegister(phiMaster.getRegister());
version.setVolatile(phiMaster.isVolatile()); version.setVolatile(phiMaster.isVolatile());
version.setPermanent(phiMaster.isPermanent());
version.setExport(phiMaster.isExport()); version.setExport(phiMaster.isExport());
version.setComments(phiMaster.getComments()); version.setComments(phiMaster.getComments());
return version; return version;
@@ -228,6 +232,7 @@ public class Variable implements Symbol {
constVar.setNoModify(variable.isNoModify()); constVar.setNoModify(variable.isNoModify());
constVar.setRegister(variable.getRegister()); constVar.setRegister(variable.getRegister());
constVar.setVolatile(variable.isVolatile()); constVar.setVolatile(variable.isVolatile());
constVar.setPermanent(variable.isPermanent());
constVar.setExport(variable.isExport()); constVar.setExport(variable.isExport());
constVar.setComments(variable.getComments()); constVar.setComments(variable.getComments());
return constVar; return constVar;
@@ -245,6 +250,7 @@ public class Variable implements Symbol {
copy.setMemoryAlignment(original.getMemoryAlignment()); copy.setMemoryAlignment(original.getMemoryAlignment());
copy.setOptimize(original.isOptimize()); copy.setOptimize(original.isOptimize());
copy.setNoModify(original.isNoModify()); copy.setNoModify(original.isNoModify());
copy.setPermanent(original.isPermanent());
copy.setVolatile(original.isVolatile()); copy.setVolatile(original.isVolatile());
copy.setExport(original.isExport()); copy.setExport(original.isExport());
copy.setRegister(original.getRegister()); copy.setRegister(original.getRegister());
@@ -277,6 +283,7 @@ public class Variable implements Symbol {
memberVariable.setVolatile(structVar.isVolatile()); memberVariable.setVolatile(structVar.isVolatile());
memberVariable.setNoModify(structVar.isNoModify()); memberVariable.setNoModify(structVar.isNoModify());
memberVariable.setExport(structVar.isExport()); memberVariable.setExport(structVar.isExport());
memberVariable.setPermanent(structVar.isPermanent());
return memberVariable; return memberVariable;
} }
@@ -468,6 +475,14 @@ public class Variable implements Symbol {
this.noModify = noModify; this.noModify = noModify;
} }
public boolean isPermanent() {
return permanent;
}
public void setPermanent(boolean permanent) {
this.permanent = permanent;
}
public boolean isVolatile() { public boolean isVolatile() {
return isVolatile; return isVolatile;
} }

View File

@@ -79,6 +79,7 @@ EXPORT: 'export' ;
ALIGN: 'align' ; ALIGN: 'align' ;
INLINE: 'inline' ; INLINE: 'inline' ;
VOLATILE: 'volatile' ; VOLATILE: 'volatile' ;
STATIC: 'static' ;
INTERRUPT: 'interrupt' ; INTERRUPT: 'interrupt' ;
REGISTER: 'register' ; REGISTER: 'register' ;
ADDRESS: '__address' ; ADDRESS: '__address' ;

View File

@@ -52,94 +52,95 @@ EXPORT=51
ALIGN=52 ALIGN=52
INLINE=53 INLINE=53
VOLATILE=54 VOLATILE=54
INTERRUPT=55 STATIC=55
REGISTER=56 INTERRUPT=56
ADDRESS=57 REGISTER=57
ADDRESS_ZEROPAGE=58 ADDRESS=58
ADDRESS_MAINMEM=59 ADDRESS_ZEROPAGE=59
FORM_SSA=60 ADDRESS_MAINMEM=60
FORM_MA=61 FORM_SSA=61
CALLING=62 FORM_MA=62
CALLINGCONVENTION=63 CALLING=63
VARMODEL=64 CALLINGCONVENTION=64
IF=65 VARMODEL=65
ELSE=66 IF=66
WHILE=67 ELSE=67
DO=68 WHILE=68
FOR=69 DO=69
SWITCH=70 FOR=70
RETURN=71 SWITCH=71
BREAK=72 RETURN=72
CONTINUE=73 BREAK=73
ASM=74 CONTINUE=74
DEFAULT=75 ASM=75
CASE=76 DEFAULT=76
STRUCT=77 CASE=77
ENUM=78 STRUCT=78
SIZEOF=79 ENUM=79
TYPEID=80 SIZEOF=80
KICKASM=81 TYPEID=81
RESOURCE=82 KICKASM=82
USES=83 RESOURCE=83
CLOBBERS=84 USES=84
BYTES=85 CLOBBERS=85
CYCLES=86 BYTES=86
LOGIC_NOT=87 CYCLES=87
SIGNEDNESS=88 LOGIC_NOT=88
SIMPLETYPE=89 SIGNEDNESS=89
BOOLEAN=90 SIMPLETYPE=90
KICKASM_BODY=91 BOOLEAN=91
STRING=92 KICKASM_BODY=92
CHAR=93 STRING=93
NUMBER=94 CHAR=94
NUMFLOAT=95 NUMBER=95
BINFLOAT=96 NUMFLOAT=96
DECFLOAT=97 BINFLOAT=97
HEXFLOAT=98 DECFLOAT=98
NUMINT=99 HEXFLOAT=99
BININTEGER=100 NUMINT=100
DECINTEGER=101 BININTEGER=101
HEXINTEGER=102 DECINTEGER=102
NAME=103 HEXINTEGER=103
WS=104 NAME=104
COMMENT_LINE=105 WS=105
COMMENT_BLOCK=106 COMMENT_LINE=106
ASM_BYTE=107 COMMENT_BLOCK=107
ASM_MNEMONIC=108 ASM_BYTE=108
ASM_IMM=109 ASM_MNEMONIC=109
ASM_COLON=110 ASM_IMM=110
ASM_COMMA=111 ASM_COLON=111
ASM_PAR_BEGIN=112 ASM_COMMA=112
ASM_PAR_END=113 ASM_PAR_BEGIN=113
ASM_BRACKET_BEGIN=114 ASM_PAR_END=114
ASM_BRACKET_END=115 ASM_BRACKET_BEGIN=115
ASM_DOT=116 ASM_BRACKET_END=116
ASM_SHIFT_LEFT=117 ASM_DOT=117
ASM_SHIFT_RIGHT=118 ASM_SHIFT_LEFT=118
ASM_PLUS=119 ASM_SHIFT_RIGHT=119
ASM_MINUS=120 ASM_PLUS=120
ASM_LESS_THAN=121 ASM_MINUS=121
ASM_GREATER_THAN=122 ASM_LESS_THAN=122
ASM_MULTIPLY=123 ASM_GREATER_THAN=123
ASM_DIVIDE=124 ASM_MULTIPLY=124
ASM_CURLY_BEGIN=125 ASM_DIVIDE=125
ASM_CURLY_END=126 ASM_CURLY_BEGIN=126
ASM_NUMBER=127 ASM_CURLY_END=127
ASM_NUMFLOAT=128 ASM_NUMBER=128
ASM_BINFLOAT=129 ASM_NUMFLOAT=129
ASM_DECFLOAT=130 ASM_BINFLOAT=130
ASM_HEXFLOAT=131 ASM_DECFLOAT=131
ASM_NUMINT=132 ASM_HEXFLOAT=132
ASM_BININTEGER=133 ASM_NUMINT=133
ASM_DECINTEGER=134 ASM_BININTEGER=134
ASM_HEXINTEGER=135 ASM_DECINTEGER=135
ASM_CHAR=136 ASM_HEXINTEGER=136
ASM_MULTI_REL=137 ASM_CHAR=137
ASM_MULTI_NAME=138 ASM_MULTI_REL=138
ASM_NAME=139 ASM_MULTI_NAME=139
ASM_WS=140 ASM_NAME=140
ASM_COMMENT_LINE=141 ASM_WS=141
ASM_COMMENT_BLOCK=142 ASM_COMMENT_LINE=142
ASM_COMMENT_BLOCK=143
';'=8 ';'=8
'..'=11 '..'=11
'?'=12 '?'=12
@@ -175,37 +176,38 @@ ASM_COMMENT_BLOCK=142
'align'=52 'align'=52
'inline'=53 'inline'=53
'volatile'=54 'volatile'=54
'interrupt'=55 'static'=55
'register'=56 'interrupt'=56
'__address'=57 'register'=57
'__zp'=58 '__address'=58
'__mem'=59 '__zp'=59
'__ssa'=60 '__mem'=60
'__ma'=61 '__ssa'=61
'calling'=62 '__ma'=62
'var_model'=64 'calling'=63
'if'=65 'var_model'=65
'else'=66 'if'=66
'while'=67 'else'=67
'do'=68 'while'=68
'for'=69 'do'=69
'switch'=70 'for'=70
'return'=71 'switch'=71
'break'=72 'return'=72
'continue'=73 'break'=73
'asm'=74 'continue'=74
'default'=75 'asm'=75
'case'=76 'default'=76
'struct'=77 'case'=77
'enum'=78 'struct'=78
'sizeof'=79 'enum'=79
'typeid'=80 'sizeof'=80
'kickasm'=81 'typeid'=81
'resource'=82 'kickasm'=82
'uses'=83 'resource'=83
'clobbers'=84 'uses'=84
'bytes'=85 'clobbers'=85
'cycles'=86 'bytes'=86
'!'=87 'cycles'=87
'.byte'=107 '!'=88
'#'=109 '.byte'=108
'#'=110

View File

@@ -103,6 +103,7 @@ directive
| ADDRESS_MAINMEM #directiveMemoryAreaMain | ADDRESS_MAINMEM #directiveMemoryAreaMain
| ADDRESS PAR_BEGIN ( NUMBER ) PAR_END #directiveMemoryAreaAddress | ADDRESS PAR_BEGIN ( NUMBER ) PAR_END #directiveMemoryAreaAddress
| VOLATILE #directiveVolatile | VOLATILE #directiveVolatile
| STATIC #directiveStatic
| FORM_SSA #directiveFormSsa | FORM_SSA #directiveFormSsa
| FORM_MA #directiveFormMa | FORM_MA #directiveFormMa
| EXTERN #directiveExtern | EXTERN #directiveExtern

File diff suppressed because it is too large Load Diff

View File

@@ -140,6 +140,7 @@ ASM_NAME=139
ASM_WS=140 ASM_WS=140
ASM_COMMENT_LINE=141 ASM_COMMENT_LINE=141
ASM_COMMENT_BLOCK=142 ASM_COMMENT_BLOCK=142
STATIC=143
';'=8 ';'=8
'..'=11 '..'=11
'?'=12 '?'=12

View File

@@ -409,6 +409,18 @@ public class KickCParserBaseListener implements KickCParserListener {
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void exitDirectiveVolatile(KickCParser.DirectiveVolatileContext ctx) { } @Override public void exitDirectiveVolatile(KickCParser.DirectiveVolatileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDirectiveStatic(KickCParser.DirectiveStaticContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDirectiveStatic(KickCParser.DirectiveStaticContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *

View File

@@ -244,6 +244,13 @@ public class KickCParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> imple
* {@link #visitChildren} on {@code ctx}.</p> * {@link #visitChildren} on {@code ctx}.</p>
*/ */
@Override public T visitDirectiveVolatile(KickCParser.DirectiveVolatileContext ctx) { return visitChildren(ctx); } @Override public T visitDirectiveVolatile(KickCParser.DirectiveVolatileContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDirectiveStatic(KickCParser.DirectiveStaticContext ctx) { return visitChildren(ctx); }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *

View File

@@ -381,6 +381,18 @@ public interface KickCParserListener extends ParseTreeListener {
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void exitDirectiveVolatile(KickCParser.DirectiveVolatileContext ctx); void exitDirectiveVolatile(KickCParser.DirectiveVolatileContext ctx);
/**
* Enter a parse tree produced by the {@code directiveStatic}
* labeled alternative in {@link KickCParser#directive}.
* @param ctx the parse tree
*/
void enterDirectiveStatic(KickCParser.DirectiveStaticContext ctx);
/**
* Exit a parse tree produced by the {@code directiveStatic}
* labeled alternative in {@link KickCParser#directive}.
* @param ctx the parse tree
*/
void exitDirectiveStatic(KickCParser.DirectiveStaticContext ctx);
/** /**
* Enter a parse tree produced by the {@code directiveFormSsa} * Enter a parse tree produced by the {@code directiveFormSsa}
* labeled alternative in {@link KickCParser#directive}. * labeled alternative in {@link KickCParser#directive}.

View File

@@ -231,6 +231,13 @@ public interface KickCParserVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result * @return the visitor result
*/ */
T visitDirectiveVolatile(KickCParser.DirectiveVolatileContext ctx); T visitDirectiveVolatile(KickCParser.DirectiveVolatileContext ctx);
/**
* Visit a parse tree produced by the {@code directiveStatic}
* labeled alternative in {@link KickCParser#directive}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDirectiveStatic(KickCParser.DirectiveStaticContext ctx);
/** /**
* Visit a parse tree produced by the {@code directiveFormSsa} * Visit a parse tree produced by the {@code directiveFormSsa}
* labeled alternative in {@link KickCParser#directive}. * labeled alternative in {@link KickCParser#directive}.

View File

@@ -582,8 +582,9 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
initValue = Initializers.constantify(initValue, new Initializers.ValueTypeSpec(declVarType, declArraySpec), program, statementSource); initValue = Initializers.constantify(initValue, new Initializers.ValueTypeSpec(declVarType, declArraySpec), program, statementSource);
VariableBuilder varBuilder = new VariableBuilder(varName, getCurrentScope(), false, declVarType, declArraySpec, declVarDirectives, currentDataSegment, variableBuilderConfig); VariableBuilder varBuilder = new VariableBuilder(varName, getCurrentScope(), false, declVarType, declArraySpec, declVarDirectives, currentDataSegment, variableBuilderConfig);
Variable variable = varBuilder.build(); Variable variable = varBuilder.build();
if(variable.isKindConstant() || (variable.isKindLoadStore() && Variable.MemoryArea.MAIN_MEMORY.equals(variable.getMemoryArea()) && initValue instanceof ConstantValue && !declVarStructMember && variable.getRegister()==null)) { boolean isPermanent = ScopeRef.ROOT.equals(variable.getScope().getRef()) || variable.isPermanent();
// Set constant value if(variable.isKindConstant() || (isPermanent && variable.isKindLoadStore() && Variable.MemoryArea.MAIN_MEMORY.equals(variable.getMemoryArea()) && initValue instanceof ConstantValue && !declVarStructMember && variable.getRegister()==null)) {
// Set initial value
ConstantValue constInitValue = getConstInitValue(initValue, initializer, statementSource); ConstantValue constInitValue = getConstInitValue(initValue, initializer, statementSource);
variable.setInitValue(constInitValue); variable.setInitValue(constInitValue);
// Add comments to constant // Add comments to constant
@@ -793,6 +794,11 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
return new Directive.Volatile(); return new Directive.Volatile();
} }
@Override
public Object visitDirectiveStatic(KickCParser.DirectiveStaticContext ctx) {
return new Directive.Static();
}
@Override @Override
public Directive visitDirectiveExport(KickCParser.DirectiveExportContext ctx) { public Directive visitDirectiveExport(KickCParser.DirectiveExportContext ctx) {
return new Directive.Export(); return new Directive.Export();

View File

@@ -5,9 +5,12 @@ import dk.camelot64.kickc.model.CompileError;
import dk.camelot64.kickc.model.ControlFlowBlock; import dk.camelot64.kickc.model.ControlFlowBlock;
import dk.camelot64.kickc.model.Program; import dk.camelot64.kickc.model.Program;
import dk.camelot64.kickc.model.statements.Statement; import dk.camelot64.kickc.model.statements.Statement;
import dk.camelot64.kickc.model.statements.StatementAssignment; import dk.camelot64.kickc.model.statements.StatementLValue;
import dk.camelot64.kickc.model.statements.StatementPhiBlock; import dk.camelot64.kickc.model.statements.StatementPhiBlock;
import dk.camelot64.kickc.model.symbols.*; import dk.camelot64.kickc.model.symbols.Label;
import dk.camelot64.kickc.model.symbols.Procedure;
import dk.camelot64.kickc.model.symbols.Symbol;
import dk.camelot64.kickc.model.symbols.Variable;
import dk.camelot64.kickc.model.values.*; import dk.camelot64.kickc.model.values.*;
import java.util.*; import java.util.*;
@@ -27,13 +30,15 @@ public class Pass2EliminateUnusedBlocks extends Pass2SsaOptimization {
if(!referencedBlocks.contains(block.getLabel())) { if(!referencedBlocks.contains(block.getLabel())) {
unusedBlocks.add(block.getLabel()); unusedBlocks.add(block.getLabel());
for(Statement stmt : block.getStatements()) { for(Statement stmt : block.getStatements()) {
if(stmt instanceof StatementAssignment) { if(stmt instanceof StatementLValue) {
StatementAssignment assignment = (StatementAssignment) stmt; StatementLValue assignment = (StatementLValue) stmt;
LValue lValue = assignment.getlValue(); LValue lValue = assignment.getlValue();
if(lValue instanceof VariableRef) { if(lValue instanceof VariableRef) {
getLog().append("Eliminating variable " + lValue.toString(getProgram()) + " from unused block " + block.getLabel());
Variable variable = getScope().getVariable((VariableRef) lValue); Variable variable = getScope().getVariable((VariableRef) lValue);
variable.getScope().remove(variable); if(variable.isKindPhiVersion() || variable.isKindIntermediate()) {
getLog().append("Eliminating variable " + lValue.toString(getProgram()) + " from unused block " + block.getLabel());
variable.getScope().remove(variable);
}
} }
} else if(stmt instanceof StatementPhiBlock) { } else if(stmt instanceof StatementPhiBlock) {
for(StatementPhiBlock.PhiVariable phiVariable : ((StatementPhiBlock) stmt).getPhiVariables()) { for(StatementPhiBlock.PhiVariable phiVariable : ((StatementPhiBlock) stmt).getPhiVariables()) {

View File

@@ -16,7 +16,7 @@ import dk.camelot64.kickc.model.values.VariableRef;
import java.util.*; import java.util.*;
/** /**
* Compiler Pass inlineng cast assignments that has no effect (byte to/from signed byte, word to/from signed word) * Compiler Pass inlining cast assignments that has no effect (byte to/from signed byte, word to/from signed word)
*/ */
public class Pass2NopCastInlining extends Pass2SsaOptimization { public class Pass2NopCastInlining extends Pass2SsaOptimization {

View File

@@ -139,6 +139,15 @@ public class PassNEliminateUnusedVars extends Pass2SsaOptimization {
} }
} }
for(Variable variable : getScope().getAllVariables(true)) {
if(referenceInfos.isUnused(variable.getRef())) {
if(!variable.isExport() && !variable.isKindPhiMaster()) {
getLog().append("Eliminating unused variable with no statement " + variable.getRef().toString(getProgram()));
variable.getScope().remove(variable);
}
}
}
Collection<Variable> allConstants = getScope().getAllConstants(true); Collection<Variable> allConstants = getScope().getAllConstants(true);
for(Variable constant : allConstants) { for(Variable constant : allConstants) {
if(!(constant.getScope() instanceof EnumDefinition) && !(constant.getScope() instanceof StructDefinition)) { if(!(constant.getScope() instanceof EnumDefinition) && !(constant.getScope() instanceof StructDefinition)) {

View File

@@ -3,7 +3,7 @@
const byte* SCREEN = $400; const byte* SCREEN = $400;
void main() { void main() {
for( byte i: 0..10) { for( __ssa byte i: 0..10) {
asm { asm {
lda #'a' lda #'a'
ldx i ldx i

View File

@@ -118,6 +118,7 @@ Warning! Adding boolean cast to non-boolean condition (byte~) processChars::$9
Warning! Adding boolean cast to non-boolean sub-expression (byte) atan2_16::shift Warning! Adding boolean cast to non-boolean sub-expression (byte) atan2_16::shift
Identified constant variable (byte*) HEAP_TOP Identified constant variable (byte*) HEAP_TOP
Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx
Eliminating unused variable with no statement (struct ProcessingChar~) main::$5
Culled Empty Block (label) @1 Culled Empty Block (label) @1
Culled Empty Block (label) @2 Culled Empty Block (label) @2
Culled Empty Block (label) @3 Culled Empty Block (label) @3
@@ -1803,7 +1804,6 @@ interrupt(HARDWARE_ALL)(void()) irqTop()
(byte~) main::$10 (byte~) main::$10
(bool~) main::$3 (bool~) main::$3
(bool~) main::$4 (bool~) main::$4
(struct ProcessingChar~) main::$5
(byte~) main::$5_dist (byte~) main::$5_dist
(byte~) main::$5_x (byte~) main::$5_x
(byte~) main::$5_y (byte~) main::$5_y
@@ -4051,7 +4051,6 @@ interrupt(HARDWARE_ALL)(void()) irqTop()
(byte~) main::$12 22.0 (byte~) main::$12 22.0
(byte~) main::$13 22.0 (byte~) main::$13 22.0
(byte~) main::$14 22.0 (byte~) main::$14 22.0
(struct ProcessingChar~) main::$5
(byte) main::center_dist (byte) main::center_dist
(byte) main::center_dist#0 22.0 (byte) main::center_dist#0 22.0
(byte) main::center_x (byte) main::center_x
@@ -10134,7 +10133,6 @@ interrupt(HARDWARE_ALL)(void()) irqTop()
(byte~) main::$12 reg byte a 22.0 (byte~) main::$12 reg byte a 22.0
(byte~) main::$13 reg byte a 22.0 (byte~) main::$13 reg byte a 22.0
(byte~) main::$14 reg byte a 22.0 (byte~) main::$14 reg byte a 22.0
(struct ProcessingChar~) main::$5
(label) main::@1 (label) main::@1
(label) main::@10 (label) main::@10
(label) main::@11 (label) main::@11

View File

@@ -299,7 +299,6 @@ interrupt(HARDWARE_ALL)(void()) irqTop()
(byte~) main::$12 reg byte a 22.0 (byte~) main::$12 reg byte a 22.0
(byte~) main::$13 reg byte a 22.0 (byte~) main::$13 reg byte a 22.0
(byte~) main::$14 reg byte a 22.0 (byte~) main::$14 reg byte a 22.0
(struct ProcessingChar~) main::$5
(label) main::@1 (label) main::@1
(label) main::@10 (label) main::@10
(label) main::@11 (label) main::@11

View File

@@ -418,6 +418,8 @@ Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBa
Inlined call call mulf8s_prepare (signed byte) mulf8s::a Inlined call call mulf8s_prepare (signed byte) mulf8s::a
Inlined call call vicSelectGfxBank (const byte*) BITMAP_SCREEN Inlined call call vicSelectGfxBank (const byte*) BITMAP_SCREEN
Inlined call (byte~) main::$4 ← call toD018 (const byte*) BITMAP_SCREEN (const byte*) BITMAP_GRAPHICS Inlined call (byte~) main::$4 ← call toD018 (const byte*) BITMAP_SCREEN (const byte*) BITMAP_GRAPHICS
Eliminating unused variable with no statement (struct SplineVector16~) show_letter::$2
Eliminating unused variable with no statement (struct SplineVector16~) show_letter::$7
Culled Empty Block (label) @1 Culled Empty Block (label) @1
Culled Empty Block (label) @2 Culled Empty Block (label) @2
Culled Empty Block (label) @3 Culled Empty Block (label) @3
@@ -2620,7 +2622,6 @@ SYMBOL TABLE SSA
(word~) show_letter::$14 (word~) show_letter::$14
(word~) show_letter::$15 (word~) show_letter::$15
(bool~) show_letter::$19 (bool~) show_letter::$19
(struct SplineVector16~) show_letter::$2
(byte~) show_letter::$20 (byte~) show_letter::$20
(byte~) show_letter::$21 (byte~) show_letter::$21
(byte~) show_letter::$22 (byte~) show_letter::$22
@@ -2630,7 +2631,6 @@ SYMBOL TABLE SSA
(number~) show_letter::$4 (number~) show_letter::$4
(number~) show_letter::$5 (number~) show_letter::$5
(number~) show_letter::$6 (number~) show_letter::$6
(struct SplineVector16~) show_letter::$7
(signed word~) show_letter::$7_x (signed word~) show_letter::$7_x
(signed word~) show_letter::$7_y (signed word~) show_letter::$7_y
(number~) show_letter::$8 (number~) show_letter::$8
@@ -5060,14 +5060,12 @@ VARIABLE REGISTER WEIGHTS
(word) sgn_u16::w#1 4.0 (word) sgn_u16::w#1 4.0
(word) sgn_u16::w#2 6.0 (word) sgn_u16::w#2 6.0
(void()) show_letter((byte) show_letter::angle) (void()) show_letter((byte) show_letter::angle)
(struct SplineVector16~) show_letter::$2
(byte~) show_letter::$20 151.5 (byte~) show_letter::$20 151.5
(byte~) show_letter::$21 151.5 (byte~) show_letter::$21 151.5
(byte~) show_letter::$22 202.0 (byte~) show_letter::$22 202.0
(byte~) show_letter::$23 202.0 (byte~) show_letter::$23 202.0
(byte~) show_letter::$25 202.0 (byte~) show_letter::$25 202.0
(byte~) show_letter::$27 202.0 (byte~) show_letter::$27 202.0
(struct SplineVector16~) show_letter::$7
(byte) show_letter::angle (byte) show_letter::angle
(byte) show_letter::angle#0 3.6724137931034484 (byte) show_letter::angle#0 3.6724137931034484
(signed word) show_letter::current_x (signed word) show_letter::current_x
@@ -12097,14 +12095,12 @@ FINAL SYMBOL TABLE
(word) sgn_u16::w#1 w zp[2]:16 4.0 (word) sgn_u16::w#1 w zp[2]:16 4.0
(word) sgn_u16::w#2 w zp[2]:16 6.0 (word) sgn_u16::w#2 w zp[2]:16 6.0
(void()) show_letter((byte) show_letter::angle) (void()) show_letter((byte) show_letter::angle)
(struct SplineVector16~) show_letter::$2
(byte~) show_letter::$20 reg byte x 151.5 (byte~) show_letter::$20 reg byte x 151.5
(byte~) show_letter::$21 reg byte x 151.5 (byte~) show_letter::$21 reg byte x 151.5
(byte~) show_letter::$22 reg byte a 202.0 (byte~) show_letter::$22 reg byte a 202.0
(byte~) show_letter::$23 reg byte a 202.0 (byte~) show_letter::$23 reg byte a 202.0
(byte~) show_letter::$25 reg byte a 202.0 (byte~) show_letter::$25 reg byte a 202.0
(byte~) show_letter::$27 reg byte a 202.0 (byte~) show_letter::$27 reg byte a 202.0
(struct SplineVector16~) show_letter::$7
(label) show_letter::@1 (label) show_letter::@1
(label) show_letter::@2 (label) show_letter::@2
(label) show_letter::@3 (label) show_letter::@3

View File

@@ -407,14 +407,12 @@
(word) sgn_u16::w#1 w zp[2]:16 4.0 (word) sgn_u16::w#1 w zp[2]:16 4.0
(word) sgn_u16::w#2 w zp[2]:16 6.0 (word) sgn_u16::w#2 w zp[2]:16 6.0
(void()) show_letter((byte) show_letter::angle) (void()) show_letter((byte) show_letter::angle)
(struct SplineVector16~) show_letter::$2
(byte~) show_letter::$20 reg byte x 151.5 (byte~) show_letter::$20 reg byte x 151.5
(byte~) show_letter::$21 reg byte x 151.5 (byte~) show_letter::$21 reg byte x 151.5
(byte~) show_letter::$22 reg byte a 202.0 (byte~) show_letter::$22 reg byte a 202.0
(byte~) show_letter::$23 reg byte a 202.0 (byte~) show_letter::$23 reg byte a 202.0
(byte~) show_letter::$25 reg byte a 202.0 (byte~) show_letter::$25 reg byte a 202.0
(byte~) show_letter::$27 reg byte a 202.0 (byte~) show_letter::$27 reg byte a 202.0
(struct SplineVector16~) show_letter::$7
(label) show_letter::@1 (label) show_letter::@1
(label) show_letter::@2 (label) show_letter::@2
(label) show_letter::@3 (label) show_letter::@3

View File

@@ -1,7 +1,7 @@
// Illustrates a problem where a volatile bool modified at the end of an IRQ is not stored properly // Illustrates a problem where a volatile bool modified at the end of an IRQ is not stored properly
// because it is assigned to the A register // because it is assigned to the A register
.pc = $801 "Basic" .pc = $801 "Basic"
:BasicUpstart(__b1) :BasicUpstart(main)
.pc = $80d "Program" .pc = $80d "Program"
.label KERNEL_IRQ = $314 .label KERNEL_IRQ = $314
.label RASTER = $d012 .label RASTER = $d012
@@ -12,12 +12,6 @@
.label BGCOL = $d020 .label BGCOL = $d020
.label CIA1_INTERRUPT = $dc0d .label CIA1_INTERRUPT = $dc0d
.const CIA_INTERRUPT_CLEAR = $7f .const CIA_INTERRUPT_CLEAR = $7f
.label framedone = 2
__b1:
lda #0
sta.z framedone
jsr main
rts
main: { main: {
sei sei
// Disable CIA 1 Timer IRQ // Disable CIA 1 Timer IRQ
@@ -42,8 +36,6 @@ main: {
lda RASTER lda RASTER
cmp #$14 cmp #$14
bcs __b1 bcs __b1
lda #1
sta.z framedone
jmp __b1 jmp __b1
} }
irq: { irq: {
@@ -52,10 +44,6 @@ irq: {
sta IRQ_STATUS sta IRQ_STATUS
lda RASTER lda RASTER
cmp #$32+1 cmp #$32+1
bcc __b1
lda #0
sta.z framedone
__b1:
dec BGCOL dec BGCOL
jmp $ea81 jmp $ea81
} }

View File

@@ -2,44 +2,41 @@
[0] phi() [0] phi()
to:@1 to:@1
@1: scope:[] from @begin @1: scope:[] from @begin
[1] (bool) framedone ← false [1] phi()
to:@2 [2] call main
@2: scope:[] from @1
[2] phi()
[3] call main
to:@end to:@end
@end: scope:[] from @2 @end: scope:[] from @1
[4] phi() [3] phi()
(void()) main() (void()) main()
main: scope:[main] from @2 main: scope:[main] from @1
asm { sei } asm { sei }
[6] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [5] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR
[7] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f [6] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f
[8] *((const byte*) RASTER) ← (byte) $fd [7] *((const byte*) RASTER) ← (byte) $fd
[9] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [8] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER
[10] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [9] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
asm { cli } asm { cli }
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@1 main::@2 main::@1: scope:[main] from main main::@1 main::@2
[12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 [11] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1
to:main::@2 to:main::@2
main::@2: scope:[main] from main::@1 main::@2: scope:[main] from main::@1
[13] (bool) framedone ← true [12] phi()
to:main::@1 to:main::@1
interrupt(KERNEL_MIN)(void()) irq() interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from irq: scope:[irq] from
[14] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) [13] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
[15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [14] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 [15] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1
to:irq::@2 to:irq::@2
irq::@2: scope:[irq] from irq irq::@2: scope:[irq] from irq
[17] (bool) framedone ← false [16] phi()
to:irq::@1 to:irq::@1
irq::@1: scope:[irq] from irq irq::@2 irq::@1: scope:[irq] from irq irq::@2
[18] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) [17] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL)
to:irq::@return to:irq::@return
irq::@return: scope:[irq] from irq::@1 irq::@return: scope:[irq] from irq::@1
[19] return [18] return
to:@return to:@return

View File

@@ -1,14 +1,16 @@
Resolved forward reference irq to interrupt(KERNEL_MIN)(void()) irq() Resolved forward reference irq to interrupt(KERNEL_MIN)(void()) irq()
Resolved forward reference framedone to (bool) framedone Resolved forward reference framedone to (bool) framedone
Eliminating unused variable with no statement (bool) framedone
Culled Empty Block (label) main::@5 Culled Empty Block (label) main::@5
Culled Empty Block (label) main::@3 Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@6 Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@4 Culled Empty Block (label) main::@4
Culled Empty Block (label) main::@8 Culled Empty Block (label) main::@8
Culled Empty Block (label) @1
CONTROL FLOW GRAPH SSA CONTROL FLOW GRAPH SSA
@begin: scope:[] from @begin: scope:[] from
to:@1 to:@2
(void()) main() (void()) main()
main: scope:[main] from @2 main: scope:[main] from @2
@@ -29,14 +31,10 @@ main::@2: scope:[main] from main::@1
if((bool~) main::$1) goto main::@1 if((bool~) main::$1) goto main::@1
to:main::@7 to:main::@7
main::@7: scope:[main] from main::@2 main::@7: scope:[main] from main::@2
(bool) framedone ← true
to:main::@1 to:main::@1
main::@return: scope:[main] from main::@1 main::@return: scope:[main] from main::@1
return return
to:@return to:@return
@1: scope:[] from @begin
(bool) framedone ← false
to:@2
interrupt(KERNEL_MIN)(void()) irq() interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from irq: scope:[irq] from
@@ -50,12 +48,11 @@ irq::@1: scope:[irq] from irq irq::@2
*((const byte*) BGCOL) ← -- *((const byte*) BGCOL) *((const byte*) BGCOL) ← -- *((const byte*) BGCOL)
to:irq::@return to:irq::@return
irq::@2: scope:[irq] from irq irq::@2: scope:[irq] from irq
(bool) framedone ← false
to:irq::@1 to:irq::@1
irq::@return: scope:[irq] from irq::@1 irq::@return: scope:[irq] from irq::@1
return return
to:@return to:@return
@2: scope:[] from @1 @2: scope:[] from @begin
call main call main
to:@3 to:@3
@3: scope:[] from @2 @3: scope:[] from @2
@@ -63,7 +60,6 @@ irq::@return: scope:[irq] from irq::@1
@end: scope:[] from @3 @end: scope:[] from @3
SYMBOL TABLE SSA SYMBOL TABLE SSA
(label) @1
(label) @2 (label) @2
(label) @3 (label) @3
(label) @begin (label) @begin
@@ -77,7 +73,6 @@ SYMBOL TABLE SSA
(const void()**) KERNEL_IRQ = (void()**)(number) $314 (const void()**) KERNEL_IRQ = (void()**)(number) $314
(const byte*) RASTER = (byte*)(number) $d012 (const byte*) RASTER = (byte*)(number) $d012
(const byte*) VIC_CONTROL = (byte*)(number) $d011 (const byte*) VIC_CONTROL = (byte*)(number) $d011
(bool) framedone loadstore
interrupt(KERNEL_MIN)(void()) irq() interrupt(KERNEL_MIN)(void()) irq()
(bool~) irq::$1 (bool~) irq::$1
(bool~) irq::$2 (bool~) irq::$2
@@ -117,14 +112,14 @@ Finalized unsigned number type (byte) $14
Finalized unsigned number type (byte) $32 Finalized unsigned number type (byte) $32
Successful SSA optimization PassNFinalizeNumberTypeConversions Successful SSA optimization PassNFinalizeNumberTypeConversions
Inversing boolean not [9] (bool~) main::$1 ← *((const byte*) RASTER) >= (byte) $14 from [8] (bool~) main::$0 ← *((const byte*) RASTER) < (byte) $14 Inversing boolean not [9] (bool~) main::$1 ← *((const byte*) RASTER) >= (byte) $14 from [8] (bool~) main::$0 ← *((const byte*) RASTER) < (byte) $14
Inversing boolean not [17] (bool~) irq::$2 ← *((const byte*) RASTER) <= (byte) $32 from [16] (bool~) irq::$1 ← *((const byte*) RASTER) > (byte) $32 Inversing boolean not [15] (bool~) irq::$2 ← *((const byte*) RASTER) <= (byte) $32 from [14] (bool~) irq::$1 ← *((const byte*) RASTER) > (byte) $32
Successful SSA optimization Pass2UnaryNotSimplification Successful SSA optimization Pass2UnaryNotSimplification
Simple Condition (bool~) main::$1 [10] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 Simple Condition (bool~) main::$1 [10] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1
Simple Condition (bool~) irq::$2 [18] if(*((const byte*) RASTER)<=(byte) $32) goto irq::@1 Simple Condition (bool~) irq::$2 [16] if(*((const byte*) RASTER)<=(byte) $32) goto irq::@1
Successful SSA optimization Pass2ConditionalJumpSimplification Successful SSA optimization Pass2ConditionalJumpSimplification
if() condition always true - replacing block destination [7] if(true) goto main::@2 if() condition always true - replacing block destination [7] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs Successful SSA optimization Pass2ConstantIfs
Rewriting conditional comparison [18] if(*((const byte*) RASTER)<=(byte) $32) goto irq::@1 Rewriting conditional comparison [16] if(*((const byte*) RASTER)<=(byte) $32) goto irq::@1
Removing unused block main::@return Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks Successful SSA optimization Pass2EliminateUnusedBlocks
Adding number conversion cast (unumber) $32+1 in if(*((const byte*) RASTER)<(byte) $32+(number) 1) goto irq::@1 Adding number conversion cast (unumber) $32+1 in if(*((const byte*) RASTER)<(byte) $32+(number) 1) goto irq::@1
@@ -140,77 +135,75 @@ Adding NOP phi() at start of @2
Adding NOP phi() at start of @3 Adding NOP phi() at start of @3
Adding NOP phi() at start of @end Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1 Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@7
Adding NOP phi() at start of irq::@2
CALL GRAPH CALL GRAPH
Calls in [] to main:3 Calls in [] to main:2
Created 0 initial phi equivalence classes Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @3 Culled Empty Block (label) @3
Culled Empty Block (label) main::@1 Culled Empty Block (label) main::@1
Renumbering block @2 to @1
Renumbering block main::@2 to main::@1 Renumbering block main::@2 to main::@1
Renumbering block main::@7 to main::@2 Renumbering block main::@7 to main::@2
Adding NOP phi() at start of @begin Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2 Adding NOP phi() at start of @1
Adding NOP phi() at start of @end Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of irq::@2
FINAL CONTROL FLOW GRAPH FINAL CONTROL FLOW GRAPH
@begin: scope:[] from @begin: scope:[] from
[0] phi() [0] phi()
to:@1 to:@1
@1: scope:[] from @begin @1: scope:[] from @begin
[1] (bool) framedone ← false [1] phi()
to:@2 [2] call main
@2: scope:[] from @1
[2] phi()
[3] call main
to:@end to:@end
@end: scope:[] from @2 @end: scope:[] from @1
[4] phi() [3] phi()
(void()) main() (void()) main()
main: scope:[main] from @2 main: scope:[main] from @1
asm { sei } asm { sei }
[6] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [5] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR
[7] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f [6] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f
[8] *((const byte*) RASTER) ← (byte) $fd [7] *((const byte*) RASTER) ← (byte) $fd
[9] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [8] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER
[10] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [9] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
asm { cli } asm { cli }
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@1 main::@2 main::@1: scope:[main] from main main::@1 main::@2
[12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 [11] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1
to:main::@2 to:main::@2
main::@2: scope:[main] from main::@1 main::@2: scope:[main] from main::@1
[13] (bool) framedone ← true [12] phi()
to:main::@1 to:main::@1
interrupt(KERNEL_MIN)(void()) irq() interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from irq: scope:[irq] from
[14] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) [13] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
[15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [14] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 [15] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1
to:irq::@2 to:irq::@2
irq::@2: scope:[irq] from irq irq::@2: scope:[irq] from irq
[17] (bool) framedone ← false [16] phi()
to:irq::@1 to:irq::@1
irq::@1: scope:[irq] from irq irq::@2 irq::@1: scope:[irq] from irq irq::@2
[18] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) [17] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL)
to:irq::@return to:irq::@return
irq::@return: scope:[irq] from irq::@1 irq::@return: scope:[irq] from irq::@1
[19] return [18] return
to:@return to:@return
VARIABLE REGISTER WEIGHTS VARIABLE REGISTER WEIGHTS
(bool) framedone loadstore 150.0
interrupt(KERNEL_MIN)(void()) irq() interrupt(KERNEL_MIN)(void()) irq()
(void()) main() (void()) main()
Initial phi equivalence classes Initial phi equivalence classes
Added variable framedone to live range equivalence class [ framedone ]
Complete equivalence classes Complete equivalence classes
[ framedone ]
Allocated zp[1]:2 [ framedone ]
INITIAL ASM INITIAL ASM
Target platform is c64basic / MOS6502X Target platform is c64basic / MOS6502X
@@ -231,24 +224,17 @@ Target platform is c64basic / MOS6502X
.label BGCOL = $d020 .label BGCOL = $d020
.label CIA1_INTERRUPT = $dc0d .label CIA1_INTERRUPT = $dc0d
.const CIA_INTERRUPT_CLEAR = $7f .const CIA_INTERRUPT_CLEAR = $7f
.label framedone = 2
// @begin // @begin
__bbegin: __bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1 jmp __b1
// @1 // @1
__b1: __b1:
// [1] (bool) framedone ← false -- vboz1=vboc1 // [2] call main
lda #0
sta.z framedone
// [2] phi from @1 to @2 [phi:@1->@2]
__b2_from___b1:
jmp __b2
// @2
__b2:
// [3] call main
jsr main jsr main
// [4] phi from @2 to @end [phi:@2->@end] // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b2: __bend_from___b1:
jmp __bend jmp __bend
// @end // @end
__bend: __bend:
@@ -256,23 +242,23 @@ __bend:
main: { main: {
// asm { sei } // asm { sei }
sei sei
// [6] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2 // [5] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
// Disable CIA 1 Timer IRQ // Disable CIA 1 Timer IRQ
lda #CIA_INTERRUPT_CLEAR lda #CIA_INTERRUPT_CLEAR
sta CIA1_INTERRUPT sta CIA1_INTERRUPT
// [7] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 // [6] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2
// Set raster line to $0fd // Set raster line to $0fd
lda #$7f lda #$7f
and VIC_CONTROL and VIC_CONTROL
sta VIC_CONTROL sta VIC_CONTROL
// [8] *((const byte*) RASTER) ← (byte) $fd -- _deref_pbuc1=vbuc2 // [7] *((const byte*) RASTER) ← (byte) $fd -- _deref_pbuc1=vbuc2
lda #$fd lda #$fd
sta RASTER sta RASTER
// [9] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2 // [8] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// Enable Raster Interrupt // Enable Raster Interrupt
lda #IRQ_RASTER lda #IRQ_RASTER
sta IRQ_ENABLE sta IRQ_ENABLE
// [10] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 // [9] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2
// Set the IRQ routine // Set the IRQ routine
lda #<irq lda #<irq
sta KERNEL_IRQ sta KERNEL_IRQ
@@ -283,73 +269,65 @@ main: {
jmp __b1 jmp __b1
// main::@1 // main::@1
__b1: __b1:
// [12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1 // [11] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1
lda RASTER lda RASTER
cmp #$14 cmp #$14
bcs __b1 bcs __b1
// [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
__b2_from___b1:
jmp __b2 jmp __b2
// main::@2 // main::@2
__b2: __b2:
// [13] (bool) framedone ← true -- vboz1=vboc1
lda #1
sta.z framedone
jmp __b1 jmp __b1
} }
// irq // irq
irq: { irq: {
// entry interrupt(KERNEL_MIN) // entry interrupt(KERNEL_MIN)
// [14] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1 // [13] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL inc BGCOL
// [15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2 // [14] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
lda #IRQ_RASTER lda #IRQ_RASTER
sta IRQ_STATUS sta IRQ_STATUS
// [16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1 // [15] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1
lda RASTER lda RASTER
cmp #$32+1 cmp #$32+1
bcc __b1 bcc __b1
// [16] phi from irq to irq::@2 [phi:irq->irq::@2]
__b2_from_irq:
jmp __b2 jmp __b2
// irq::@2 // irq::@2
__b2: __b2:
// [17] (bool) framedone ← false -- vboz1=vboc1
lda #0
sta.z framedone
jmp __b1 jmp __b1
// irq::@1 // irq::@1
__b1: __b1:
// [18] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1 // [17] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BGCOL dec BGCOL
jmp __breturn jmp __breturn
// irq::@return // irq::@return
__breturn: __breturn:
// [19] return - exit interrupt(KERNEL_MIN) // [18] return - exit interrupt(KERNEL_MIN)
jmp $ea81 jmp $ea81
} }
// File Data // File Data
REGISTER UPLIFT POTENTIAL REGISTERS REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (bool) framedone ← false [ ] ( [ ] ) always clobbers reg byte a Statement [5] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [6] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [7] *((const byte*) RASTER) (byte) $fd [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [8] *((const byte*) RASTER) ← (byte) $fd [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [8] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [9] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [9] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [10] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [11] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [14] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ ] ( [ ] ) always clobbers reg byte a
Statement [13] (bool) framedone ← true [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [15] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 [ ] ( [ ] ) always clobbers reg byte a
Statement [15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ ] ( [ ] ) always clobbers reg byte a
Statement [16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 [ ] ( [ ] ) always clobbers reg byte a
Statement [17] (bool) framedone ← false [ ] ( [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ framedone ] : zp[1]:2 ,
REGISTER UPLIFT SCOPES REGISTER UPLIFT SCOPES
Uplift Scope [] 150: zp[1]:2 [ framedone ]
Uplift Scope [main] Uplift Scope [main]
Uplift Scope [irq] Uplift Scope [irq]
Uplift Scope []
Uplifting [] best 1367 combination zp[1]:2 [ framedone ] Uplifting [main] best 1034 combination
Uplifting [main] best 1367 combination Uplifting [irq] best 1034 combination
Uplifting [irq] best 1367 combination Uplifting [] best 1034 combination
Attempting to uplift remaining variables inzp[1]:2 [ framedone ]
Uplifting [] best 1367 combination zp[1]:2 [ framedone ]
ASSEMBLER BEFORE OPTIMIZATION ASSEMBLER BEFORE OPTIMIZATION
// File Comments // File Comments
@@ -369,24 +347,17 @@ ASSEMBLER BEFORE OPTIMIZATION
.label BGCOL = $d020 .label BGCOL = $d020
.label CIA1_INTERRUPT = $dc0d .label CIA1_INTERRUPT = $dc0d
.const CIA_INTERRUPT_CLEAR = $7f .const CIA_INTERRUPT_CLEAR = $7f
.label framedone = 2
// @begin // @begin
__bbegin: __bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1 jmp __b1
// @1 // @1
__b1: __b1:
// [1] (bool) framedone ← false -- vboz1=vboc1 // [2] call main
lda #0
sta.z framedone
// [2] phi from @1 to @2 [phi:@1->@2]
__b2_from___b1:
jmp __b2
// @2
__b2:
// [3] call main
jsr main jsr main
// [4] phi from @2 to @end [phi:@2->@end] // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b2: __bend_from___b1:
jmp __bend jmp __bend
// @end // @end
__bend: __bend:
@@ -394,23 +365,23 @@ __bend:
main: { main: {
// asm { sei } // asm { sei }
sei sei
// [6] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2 // [5] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
// Disable CIA 1 Timer IRQ // Disable CIA 1 Timer IRQ
lda #CIA_INTERRUPT_CLEAR lda #CIA_INTERRUPT_CLEAR
sta CIA1_INTERRUPT sta CIA1_INTERRUPT
// [7] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 // [6] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2
// Set raster line to $0fd // Set raster line to $0fd
lda #$7f lda #$7f
and VIC_CONTROL and VIC_CONTROL
sta VIC_CONTROL sta VIC_CONTROL
// [8] *((const byte*) RASTER) ← (byte) $fd -- _deref_pbuc1=vbuc2 // [7] *((const byte*) RASTER) ← (byte) $fd -- _deref_pbuc1=vbuc2
lda #$fd lda #$fd
sta RASTER sta RASTER
// [9] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2 // [8] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// Enable Raster Interrupt // Enable Raster Interrupt
lda #IRQ_RASTER lda #IRQ_RASTER
sta IRQ_ENABLE sta IRQ_ENABLE
// [10] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 // [9] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2
// Set the IRQ routine // Set the IRQ routine
lda #<irq lda #<irq
sta KERNEL_IRQ sta KERNEL_IRQ
@@ -421,52 +392,49 @@ main: {
jmp __b1 jmp __b1
// main::@1 // main::@1
__b1: __b1:
// [12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1 // [11] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1
lda RASTER lda RASTER
cmp #$14 cmp #$14
bcs __b1 bcs __b1
// [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
__b2_from___b1:
jmp __b2 jmp __b2
// main::@2 // main::@2
__b2: __b2:
// [13] (bool) framedone ← true -- vboz1=vboc1
lda #1
sta.z framedone
jmp __b1 jmp __b1
} }
// irq // irq
irq: { irq: {
// entry interrupt(KERNEL_MIN) // entry interrupt(KERNEL_MIN)
// [14] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1 // [13] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL inc BGCOL
// [15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2 // [14] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
lda #IRQ_RASTER lda #IRQ_RASTER
sta IRQ_STATUS sta IRQ_STATUS
// [16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1 // [15] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1
lda RASTER lda RASTER
cmp #$32+1 cmp #$32+1
bcc __b1 bcc __b1
// [16] phi from irq to irq::@2 [phi:irq->irq::@2]
__b2_from_irq:
jmp __b2 jmp __b2
// irq::@2 // irq::@2
__b2: __b2:
// [17] (bool) framedone ← false -- vboz1=vboc1
lda #0
sta.z framedone
jmp __b1 jmp __b1
// irq::@1 // irq::@1
__b1: __b1:
// [18] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1 // [17] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BGCOL dec BGCOL
jmp __breturn jmp __breturn
// irq::@return // irq::@return
__breturn: __breturn:
// [19] return - exit interrupt(KERNEL_MIN) // [18] return - exit interrupt(KERNEL_MIN)
jmp $ea81 jmp $ea81
} }
// File Data // File Data
ASSEMBLER OPTIMIZATIONS ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1 Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __bend Removing instruction jmp __bend
Removing instruction jmp __b1 Removing instruction jmp __b1
Removing instruction jmp __b2 Removing instruction jmp __b2
@@ -476,21 +444,27 @@ Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1 Replacing label __bbegin with __b1
Removing instruction __bbegin: Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Removing instruction __b2_from___b1: Removing instruction __b2_from___b1:
Removing instruction __bend_from___b2: Removing instruction __b2_from_irq:
Removing instruction __b2:
Succesful ASM optimization Pass5RedundantLabelElimination Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b2:
Removing instruction __bend: Removing instruction __bend:
Removing instruction __b2: Removing instruction __b2:
Removing instruction __b2:
Removing instruction __breturn: Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination Succesful ASM optimization Pass5UnusedLabelElimination
Adding RTS to root block Updating BasicUpstart to call main directly
Succesful ASM optimization Pass5AddMainRts Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction bcc __b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1:
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE FINAL SYMBOL TABLE
(label) @1 (label) @1
(label) @2
(label) @begin (label) @begin
(label) @end (label) @end
(const byte*) BGCOL = (byte*) 53280 (const byte*) BGCOL = (byte*) 53280
@@ -502,7 +476,6 @@ FINAL SYMBOL TABLE
(const void()**) KERNEL_IRQ = (void()**) 788 (const void()**) KERNEL_IRQ = (void()**) 788
(const byte*) RASTER = (byte*) 53266 (const byte*) RASTER = (byte*) 53266
(const byte*) VIC_CONTROL = (byte*) 53265 (const byte*) VIC_CONTROL = (byte*) 53265
(bool) framedone loadstore zp[1]:2 150.0
interrupt(KERNEL_MIN)(void()) irq() interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@1 (label) irq::@1
(label) irq::@2 (label) irq::@2
@@ -511,18 +484,17 @@ interrupt(KERNEL_MIN)(void()) irq()
(label) main::@1 (label) main::@1
(label) main::@2 (label) main::@2
zp[1]:2 [ framedone ]
FINAL ASSEMBLER FINAL ASSEMBLER
Score: 1025 Score: 951
// File Comments // File Comments
// Illustrates a problem where a volatile bool modified at the end of an IRQ is not stored properly // Illustrates a problem where a volatile bool modified at the end of an IRQ is not stored properly
// because it is assigned to the A register // because it is assigned to the A register
// Upstart // Upstart
.pc = $801 "Basic" .pc = $801 "Basic"
:BasicUpstart(__b1) :BasicUpstart(main)
.pc = $80d "Program" .pc = $80d "Program"
// Global Constants & labels // Global Constants & labels
.label KERNEL_IRQ = $314 .label KERNEL_IRQ = $314
@@ -534,20 +506,11 @@ Score: 1025
.label BGCOL = $d020 .label BGCOL = $d020
.label CIA1_INTERRUPT = $dc0d .label CIA1_INTERRUPT = $dc0d
.const CIA_INTERRUPT_CLEAR = $7f .const CIA_INTERRUPT_CLEAR = $7f
.label framedone = 2
// @begin // @begin
// [1] phi from @begin to @1 [phi:@begin->@1]
// @1 // @1
__b1: // [2] call main
// framedone = false // [3] phi from @1 to @end [phi:@1->@end]
// [1] (bool) framedone ← false -- vboz1=vboc1
lda #0
sta.z framedone
// [2] phi from @1 to @2 [phi:@1->@2]
// @2
// [3] call main
jsr main
rts
// [4] phi from @2 to @end [phi:@2->@end]
// @end // @end
// main // main
main: { main: {
@@ -555,27 +518,27 @@ main: {
// asm { sei } // asm { sei }
sei sei
// *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR // *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR
// [6] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2 // [5] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
// Disable CIA 1 Timer IRQ // Disable CIA 1 Timer IRQ
lda #CIA_INTERRUPT_CLEAR lda #CIA_INTERRUPT_CLEAR
sta CIA1_INTERRUPT sta CIA1_INTERRUPT
// *VIC_CONTROL &=$7f // *VIC_CONTROL &=$7f
// [7] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 // [6] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2
// Set raster line to $0fd // Set raster line to $0fd
lda #$7f lda #$7f
and VIC_CONTROL and VIC_CONTROL
sta VIC_CONTROL sta VIC_CONTROL
// *RASTER = $fd // *RASTER = $fd
// [8] *((const byte*) RASTER) ← (byte) $fd -- _deref_pbuc1=vbuc2 // [7] *((const byte*) RASTER) ← (byte) $fd -- _deref_pbuc1=vbuc2
lda #$fd lda #$fd
sta RASTER sta RASTER
// *IRQ_ENABLE = IRQ_RASTER // *IRQ_ENABLE = IRQ_RASTER
// [9] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2 // [8] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// Enable Raster Interrupt // Enable Raster Interrupt
lda #IRQ_RASTER lda #IRQ_RASTER
sta IRQ_ENABLE sta IRQ_ENABLE
// *KERNEL_IRQ = &irq // *KERNEL_IRQ = &irq
// [10] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 // [9] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2
// Set the IRQ routine // Set the IRQ routine
lda #<irq lda #<irq
sta KERNEL_IRQ sta KERNEL_IRQ
@@ -587,45 +550,37 @@ main: {
// main::@1 // main::@1
__b1: __b1:
// if(*RASTER<20) // if(*RASTER<20)
// [12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1 // [11] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1
lda RASTER lda RASTER
cmp #$14 cmp #$14
bcs __b1 bcs __b1
// [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// main::@2 // main::@2
// framedone = true
// [13] (bool) framedone ← true -- vboz1=vboc1
lda #1
sta.z framedone
jmp __b1 jmp __b1
} }
// irq // irq
irq: { irq: {
// entry interrupt(KERNEL_MIN) // entry interrupt(KERNEL_MIN)
// (*BGCOL)++; // (*BGCOL)++;
// [14] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1 // [13] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL inc BGCOL
// *IRQ_STATUS = IRQ_RASTER // *IRQ_STATUS = IRQ_RASTER
// [15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2 // [14] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
lda #IRQ_RASTER lda #IRQ_RASTER
sta IRQ_STATUS sta IRQ_STATUS
// if (*RASTER>50) // if (*RASTER>50)
// [16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1 // [15] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1
lda RASTER lda RASTER
cmp #$32+1 cmp #$32+1
bcc __b1 // [16] phi from irq to irq::@2 [phi:irq->irq::@2]
// irq::@2 // irq::@2
// framedone = false
// [17] (bool) framedone ← false -- vboz1=vboc1
lda #0
sta.z framedone
// irq::@1 // irq::@1
__b1:
// (*BGCOL)--; // (*BGCOL)--;
// [18] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1 // [17] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BGCOL dec BGCOL
// irq::@return // irq::@return
// } // }
// [19] return - exit interrupt(KERNEL_MIN) // [18] return - exit interrupt(KERNEL_MIN)
jmp $ea81 jmp $ea81
} }
// File Data // File Data

View File

@@ -1,5 +1,4 @@
(label) @1 (label) @1
(label) @2
(label) @begin (label) @begin
(label) @end (label) @end
(const byte*) BGCOL = (byte*) 53280 (const byte*) BGCOL = (byte*) 53280
@@ -11,7 +10,6 @@
(const void()**) KERNEL_IRQ = (void()**) 788 (const void()**) KERNEL_IRQ = (void()**) 788
(const byte*) RASTER = (byte*) 53266 (const byte*) RASTER = (byte*) 53266
(const byte*) VIC_CONTROL = (byte*) 53265 (const byte*) VIC_CONTROL = (byte*) 53265
(bool) framedone loadstore zp[1]:2 150.0
interrupt(KERNEL_MIN)(void()) irq() interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@1 (label) irq::@1
(label) irq::@2 (label) irq::@2
@@ -20,4 +18,3 @@ interrupt(KERNEL_MIN)(void()) irq()
(label) main::@1 (label) main::@1
(label) main::@2 (label) main::@2
zp[1]:2 [ framedone ]

View File

@@ -3,19 +3,16 @@
.pc = $80d "Program" .pc = $80d "Program"
.const OFFSET_STRUCT_NODE_VALUE = 2 .const OFFSET_STRUCT_NODE_VALUE = 2
.label last_time = $a .label last_time = $a
.label rand_seed = $c
.label print_line_cursor = 4 .label print_line_cursor = 4
.label print_char_cursor = 6 .label print_char_cursor = 6
.label Ticks = $10 .label Ticks = $e
.label free_ = 8 .label free_ = 8
.label root = 2 .label root = 2
.label Ticks_1 = $e .label Ticks_1 = $c
__b1: __b1:
lda #<0 lda #<0
sta.z last_time sta.z last_time
sta.z last_time+1 sta.z last_time+1
sta.z rand_seed
sta.z rand_seed+1
jsr main jsr main
rts rts
main: { main: {
@@ -103,9 +100,9 @@ print_ln: {
rts rts
} }
// Print a word as HEX // Print a word as HEX
// print_word(word zp($e) w) // print_word(word zp($c) w)
print_word: { print_word: {
.label w = $e .label w = $c
lda.z w+1 lda.z w+1
tax tax
jsr print_byte jsr print_byte
@@ -147,10 +144,6 @@ start: {
jsr $ffde jsr $ffde
sta LAST_TIME sta LAST_TIME
stx LAST_TIME+1 stx LAST_TIME+1
lda #<$194a
sta.z rand_seed
lda #>$194a
sta.z rand_seed+1
rts rts
} }
sum: { sum: {
@@ -190,7 +183,7 @@ sum: {
} }
// prepend(word zp(4) x) // prepend(word zp(4) x)
prepend: { prepend: {
.label new = $10 .label new = $e
.label x = 4 .label x = 4
jsr alloc jsr alloc
ldy #0 ldy #0
@@ -212,8 +205,8 @@ prepend: {
rts rts
} }
alloc: { alloc: {
.label __1 = $10 .label __1 = $e
.label return = $10 .label return = $e
lda.z free_ lda.z free_
asl asl
sta.z __1 sta.z __1

View File

@@ -5,186 +5,182 @@
[1] (word) last_time ← (word) 0 [1] (word) last_time ← (word) 0
to:@2 to:@2
@2: scope:[] from @1 @2: scope:[] from @1
[2] (word) rand_seed ← (word) 0 [2] phi()
to:@3 [3] call main
@3: scope:[] from @2
[3] phi()
[4] call main
to:@end to:@end
@end: scope:[] from @3 @end: scope:[] from @2
[5] phi() [4] phi()
(void()) main() (void()) main()
main: scope:[main] from @3 main: scope:[main] from @2
[6] phi() [5] phi()
[7] call start [6] call start
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@7 main::@1: scope:[main] from main main::@7
[8] (byte) main::c#8 ← phi( main/(byte) 0 main::@7/(byte) main::c#2 ) [7] (byte) main::c#8 ← phi( main/(byte) 0 main::@7/(byte) main::c#2 )
[8] (byte*) print_char_cursor#49 ← phi( main/(byte*) 1024 main::@7/(byte*) print_char_cursor#10 ) [7] (byte*) print_char_cursor#48 ← phi( main/(byte*) 1024 main::@7/(byte*) print_char_cursor#10 )
[9] call init [8] call init
to:main::@2 to:main::@2
main::@2: scope:[main] from main::@1 main::@5 main::@2: scope:[main] from main::@1 main::@5
[10] (struct node*) root#20 ← phi( main::@1/(struct node*) 0 main::@5/(struct node*) root#11 ) [9] (struct node*) root#20 ← phi( main::@1/(struct node*) 0 main::@5/(struct node*) root#11 )
[10] (word) free_#22 ← phi( main::@1/(byte) 0 main::@5/(word) free_#13 ) [9] (word) free_#22 ← phi( main::@1/(byte) 0 main::@5/(word) free_#13 )
[10] (word) main::i#3 ← phi( main::@1/(byte) 0 main::@5/(word) main::i#2 ) [9] (word) main::i#3 ← phi( main::@1/(byte) 0 main::@5/(word) main::i#2 )
[11] (word) prepend::x#0 ← (word) main::i#3 [10] (word) prepend::x#0 ← (word) main::i#3
[12] call prepend [11] call prepend
to:main::@5 to:main::@5
main::@5: scope:[main] from main::@2 main::@5: scope:[main] from main::@2
[13] (word) main::i#2 ← ++ (word) main::i#3 [12] (word) main::i#2 ← ++ (word) main::i#3
[14] if((word) main::i#2!=(word) $bb8) goto main::@2 [13] if((word) main::i#2!=(word) $bb8) goto main::@2
to:main::@3 to:main::@3
main::@3: scope:[main] from main::@5 main::@3: scope:[main] from main::@5
[15] phi() [14] phi()
[16] call sum [15] call sum
[17] (word) sum::return#2 ← (word) sum::s#3 [16] (word) sum::return#2 ← (word) sum::s#3
to:main::@6 to:main::@6
main::@6: scope:[main] from main::@3 main::@6: scope:[main] from main::@3
[18] (word~) main::$5 ← (word) sum::return#2 [17] (word~) main::$5 ← (word) sum::return#2
[19] (byte) print_char::ch#2 ← (byte)(word~) main::$5 [18] (byte) print_char::ch#2 ← (byte)(word~) main::$5
[20] call print_char [19] call print_char
to:main::@7 to:main::@7
main::@7: scope:[main] from main::@6 main::@7: scope:[main] from main::@6
[21] (byte) main::c#2 ← ++ (byte) main::c#8 [20] (byte) main::c#2 ← ++ (byte) main::c#8
[22] if((byte) main::c#2!=(byte) 5) goto main::@1 [21] if((byte) main::c#2!=(byte) 5) goto main::@1
to:main::@4 to:main::@4
main::@4: scope:[main] from main::@7 main::@4: scope:[main] from main::@7
[23] phi() [22] phi()
[24] call end [23] call end
to:main::@return to:main::@return
main::@return: scope:[main] from main::@4 main::@return: scope:[main] from main::@4
[25] return [24] return
to:@return to:@return
(void()) end() (void()) end()
end: scope:[end] from main::@4 end: scope:[end] from main::@4
[26] (word) Ticks#1 ← (word) last_time [25] (word) Ticks#1 ← (word) last_time
[27] call start [26] call start
to:end::@1 to:end::@1
end::@1: scope:[end] from end end::@1: scope:[end] from end
[28] (word) last_time ← (word) last_time - (word) Ticks#1 [27] (word) last_time ← (word) last_time - (word) Ticks#1
[29] (word) Ticks#12 ← (word) last_time [28] (word) Ticks#12 ← (word) last_time
[30] (word) print_word::w#0 ← (word) Ticks#12 [29] (word) print_word::w#0 ← (word) Ticks#12
[31] call print_word [30] call print_word
to:end::@2 to:end::@2
end::@2: scope:[end] from end::@1 end::@2: scope:[end] from end::@1
[32] phi() [31] phi()
[33] call print_ln [32] call print_ln
to:end::@return to:end::@return
end::@return: scope:[end] from end::@2 end::@return: scope:[end] from end::@2
[34] return [33] return
to:@return to:@return
(void()) print_ln() (void()) print_ln()
print_ln: scope:[print_ln] from end::@2 print_ln: scope:[print_ln] from end::@2
[35] phi() [34] phi()
to:print_ln::@1 to:print_ln::@1
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
[36] (byte*) print_line_cursor#8 ← phi( print_ln/(byte*) 1024 print_ln::@1/(byte*) print_line_cursor#1 ) [35] (byte*) print_line_cursor#8 ← phi( print_ln/(byte*) 1024 print_ln::@1/(byte*) print_line_cursor#1 )
[37] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 [36] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28
[38] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 [37] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1
to:print_ln::@return to:print_ln::@return
print_ln::@return: scope:[print_ln] from print_ln::@1 print_ln::@return: scope:[print_ln] from print_ln::@1
[39] return [38] return
to:@return to:@return
(void()) print_word((word) print_word::w) (void()) print_word((word) print_word::w)
print_word: scope:[print_word] from end::@1 print_word: scope:[print_word] from end::@1
[40] (byte) print_byte::b#0 ← > (word) print_word::w#0 [39] (byte) print_byte::b#0 ← > (word) print_word::w#0
[41] call print_byte [40] call print_byte
to:print_word::@1 to:print_word::@1
print_word::@1: scope:[print_word] from print_word print_word::@1: scope:[print_word] from print_word
[42] (byte) print_byte::b#1 ← < (word) print_word::w#0 [41] (byte) print_byte::b#1 ← < (word) print_word::w#0
[43] call print_byte [42] call print_byte
to:print_word::@return to:print_word::@return
print_word::@return: scope:[print_word] from print_word::@1 print_word::@return: scope:[print_word] from print_word::@1
[44] return [43] return
to:@return to:@return
(void()) print_byte((byte) print_byte::b) (void()) print_byte((byte) print_byte::b)
print_byte: scope:[print_byte] from print_word print_word::@1 print_byte: scope:[print_byte] from print_word print_word::@1
[45] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) [44] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 )
[46] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [45] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4
[47] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) [46] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0)
[48] call print_char [47] call print_char
to:print_byte::@1 to:print_byte::@1
print_byte::@1: scope:[print_byte] from print_byte print_byte::@1: scope:[print_byte] from print_byte
[49] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [48] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f
[50] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) [49] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2)
[51] call print_char [50] call print_char
to:print_byte::@return to:print_byte::@return
print_byte::@return: scope:[print_byte] from print_byte::@1 print_byte::@return: scope:[print_byte] from print_byte::@1
[52] return [51] return
to:@return to:@return
(void()) print_char((byte) print_char::ch) (void()) print_char((byte) print_char::ch)
print_char: scope:[print_char] from main::@6 print_byte print_byte::@1 print_char: scope:[print_char] from main::@6 print_byte print_byte::@1
[53] (byte*) print_char_cursor#26 ← phi( main::@6/(byte*) print_char_cursor#49 print_byte/(byte*) print_char_cursor#10 print_byte::@1/(byte*) print_char_cursor#10 ) [52] (byte*) print_char_cursor#26 ← phi( main::@6/(byte*) print_char_cursor#48 print_byte/(byte*) print_char_cursor#10 print_byte::@1/(byte*) print_char_cursor#10 )
[53] (byte) print_char::ch#3 ← phi( main::@6/(byte) print_char::ch#2 print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) [52] (byte) print_char::ch#3 ← phi( main::@6/(byte) print_char::ch#2 print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 )
[54] *((byte*) print_char_cursor#26) ← (byte) print_char::ch#3 [53] *((byte*) print_char_cursor#26) ← (byte) print_char::ch#3
[55] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#26 [54] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#26
to:print_char::@return to:print_char::@return
print_char::@return: scope:[print_char] from print_char print_char::@return: scope:[print_char] from print_char
[56] return [55] return
to:@return to:@return
(void()) start() (void()) start()
start: scope:[start] from end main start: scope:[start] from end main
asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 }
[58] (word) rand_seed ← (word) $194a
to:start::@return to:start::@return
start::@return: scope:[start] from start start::@return: scope:[start] from start
[59] return [57] return
to:@return to:@return
(word()) sum() (word()) sum()
sum: scope:[sum] from main::@3 sum: scope:[sum] from main::@3
[60] (struct node*) sum::current#1 ← (struct node*) root#11 [58] (struct node*) sum::current#1 ← (struct node*) root#11
to:sum::@1 to:sum::@1
sum::@1: scope:[sum] from sum sum::@2 sum::@1: scope:[sum] from sum sum::@2
[61] (word) sum::s#3 ← phi( sum/(byte) 0 sum::@2/(word) sum::s#2 ) [59] (word) sum::s#3 ← phi( sum/(byte) 0 sum::@2/(word) sum::s#2 )
[61] (struct node*) sum::current#3 ← phi( sum/(struct node*) sum::current#1 sum::@2/(struct node*) sum::current#2 ) [59] (struct node*) sum::current#3 ← phi( sum/(struct node*) sum::current#1 sum::@2/(struct node*) sum::current#2 )
[62] if((struct node*)(word) 0!=(struct node*) sum::current#3) goto sum::@2 [60] if((struct node*)(word) 0!=(struct node*) sum::current#3) goto sum::@2
to:sum::@return to:sum::@return
sum::@return: scope:[sum] from sum::@1 sum::@return: scope:[sum] from sum::@1
[63] return [61] return
to:@return to:@return
sum::@2: scope:[sum] from sum::@1 sum::@2: scope:[sum] from sum::@1
[64] (word) sum::s#2 ← (word) sum::s#3 + *((word*)(struct node*) sum::current#3 + (const byte) OFFSET_STRUCT_NODE_VALUE) [62] (word) sum::s#2 ← (word) sum::s#3 + *((word*)(struct node*) sum::current#3 + (const byte) OFFSET_STRUCT_NODE_VALUE)
[65] (struct node*) sum::current#2 ← *((struct node**)(struct node*) sum::current#3) [63] (struct node*) sum::current#2 ← *((struct node**)(struct node*) sum::current#3)
to:sum::@1 to:sum::@1
(void()) prepend((word) prepend::x) (void()) prepend((word) prepend::x)
prepend: scope:[prepend] from main::@2 prepend: scope:[prepend] from main::@2
[66] phi() [64] phi()
[67] call alloc [65] call alloc
[68] (struct node*) alloc::return#2 ← (struct node*) alloc::return#0 [66] (struct node*) alloc::return#2 ← (struct node*) alloc::return#0
to:prepend::@1 to:prepend::@1
prepend::@1: scope:[prepend] from prepend prepend::@1: scope:[prepend] from prepend
[69] (struct node*) prepend::new#1 ← (struct node*) alloc::return#2 [67] (struct node*) prepend::new#1 ← (struct node*) alloc::return#2
[70] *((struct node**)(struct node*) prepend::new#1) ← (struct node*) root#20 [68] *((struct node**)(struct node*) prepend::new#1) ← (struct node*) root#20
[71] *((word*)(struct node*) prepend::new#1 + (const byte) OFFSET_STRUCT_NODE_VALUE) ← (word) prepend::x#0 [69] *((word*)(struct node*) prepend::new#1 + (const byte) OFFSET_STRUCT_NODE_VALUE) ← (word) prepend::x#0
[72] (struct node*) root#11 ← (struct node*) prepend::new#1 [70] (struct node*) root#11 ← (struct node*) prepend::new#1
to:prepend::@return to:prepend::@return
prepend::@return: scope:[prepend] from prepend::@1 prepend::@return: scope:[prepend] from prepend::@1
[73] return [71] return
to:@return to:@return
(struct node*()) alloc() (struct node*()) alloc()
alloc: scope:[alloc] from prepend alloc: scope:[alloc] from prepend
[74] (word~) alloc::$1 ← (word) free_#22 << (byte) 2 [72] (word~) alloc::$1 ← (word) free_#22 << (byte) 2
[75] (struct node*) alloc::return#0 ← (const struct node*) heap + (word~) alloc::$1 [73] (struct node*) alloc::return#0 ← (const struct node*) heap + (word~) alloc::$1
[76] (word) free_#13 ← ++ (word) free_#22 [74] (word) free_#13 ← ++ (word) free_#22
to:alloc::@return to:alloc::@return
alloc::@return: scope:[alloc] from alloc alloc::@return: scope:[alloc] from alloc
[77] return [75] return
to:@return to:@return
(void()) init() (void()) init()
init: scope:[init] from main::@1 init: scope:[init] from main::@1
[78] phi() [76] phi()
to:init::@return to:init::@return
init::@return: scope:[init] from init init::@return: scope:[init] from init
[79] return [77] return
to:@return to:@return

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,5 @@
(label) @1 (label) @1
(label) @2 (label) @2
(label) @3
(label) @begin (label) @begin
(label) @end (label) @end
(const byte) OFFSET_STRUCT_NODE_VALUE = (byte) 2 (const byte) OFFSET_STRUCT_NODE_VALUE = (byte) 2
@@ -9,15 +8,15 @@
(const byte) RADIX::HEXADECIMAL = (number) $10 (const byte) RADIX::HEXADECIMAL = (number) $10
(const byte) RADIX::OCTAL = (number) 8 (const byte) RADIX::OCTAL = (number) 8
(word) Ticks (word) Ticks
(word) Ticks#1 Ticks zp[2]:16 2.0 (word) Ticks#1 Ticks zp[2]:14 2.0
(word) Ticks#12 Ticks_1 zp[2]:14 4.0 (word) Ticks#12 Ticks_1 zp[2]:12 4.0
(struct node*()) alloc() (struct node*()) alloc()
(word~) alloc::$1 zp[2]:16 4.0 (word~) alloc::$1 zp[2]:14 4.0
(label) alloc::@return (label) alloc::@return
(struct node*) alloc::result (struct node*) alloc::result
(struct node*) alloc::return (struct node*) alloc::return
(struct node*) alloc::return#0 return zp[2]:16 1.0 (struct node*) alloc::return#0 return zp[2]:14 1.0
(struct node*) alloc::return#2 return zp[2]:16 4.0 (struct node*) alloc::return#2 return zp[2]:14 4.0
(void()) end() (void()) end()
(label) end::@1 (label) end::@1
(label) end::@2 (label) end::@2
@@ -28,7 +27,7 @@
(const struct node*) heap[(number) $fa0] = { fill( $fa0, 0) } (const struct node*) heap[(number) $fa0] = { fill( $fa0, 0) }
(void()) init() (void()) init()
(label) init::@return (label) init::@return
(word) last_time loadstore zp[2]:10 0.4545454545454546 (word) last_time loadstore zp[2]:10 0.47619047619047616
(void()) main() (void()) main()
(word~) main::$5 zp[2]:8 11.0 (word~) main::$5 zp[2]:8 11.0
(label) main::@1 (label) main::@1
@@ -51,7 +50,7 @@
(label) prepend::@1 (label) prepend::@1
(label) prepend::@return (label) prepend::@return
(struct node*) prepend::new (struct node*) prepend::new
(struct node*) prepend::new#1 new zp[2]:16 1.3333333333333333 (struct node*) prepend::new#1 new zp[2]:14 1.3333333333333333
(word) prepend::x (word) prepend::x
(word) prepend::x#0 x zp[2]:4 17.166666666666664 (word) prepend::x#0 x zp[2]:4 17.166666666666664
(void()) print_byte((byte) print_byte::b) (void()) print_byte((byte) print_byte::b)
@@ -73,7 +72,7 @@
(byte*) print_char_cursor (byte*) print_char_cursor
(byte*) print_char_cursor#10 print_char_cursor zp[2]:6 0.9333333333333332 (byte*) print_char_cursor#10 print_char_cursor zp[2]:6 0.9333333333333332
(byte*) print_char_cursor#26 print_char_cursor zp[2]:6 9.5 (byte*) print_char_cursor#26 print_char_cursor zp[2]:6 9.5
(byte*) print_char_cursor#49 print_char_cursor zp[2]:6 1.8333333333333333 (byte*) print_char_cursor#48 print_char_cursor zp[2]:6 1.8333333333333333
(const byte*) print_hextab[] = (byte*) "0123456789abcdef"z (const byte*) print_hextab[] = (byte*) "0123456789abcdef"z
(byte*) print_line_cursor (byte*) print_line_cursor
(byte*) print_line_cursor#1 print_line_cursor zp[2]:4 16.5 (byte*) print_line_cursor#1 print_line_cursor zp[2]:4 16.5
@@ -86,8 +85,7 @@
(label) print_word::@1 (label) print_word::@1
(label) print_word::@return (label) print_word::@return
(word) print_word::w (word) print_word::w
(word) print_word::w#0 w zp[2]:14 2.0 (word) print_word::w#0 w zp[2]:12 2.0
(word) rand_seed loadstore zp[2]:12 40.0
(struct node*) root (struct node*) root
(struct node*) root#11 root zp[2]:2 17.499999999999996 (struct node*) root#11 root zp[2]:2 17.499999999999996
(struct node*) root#20 root zp[2]:2 17.166666666666664 (struct node*) root#20 root zp[2]:2 17.166666666666664
@@ -113,11 +111,10 @@ zp[2]:2 [ root#20 root#11 sum::current#3 sum::current#1 sum::current#2 ]
zp[2]:4 [ print_line_cursor#8 print_line_cursor#1 main::i#3 main::i#2 prepend::x#0 ] zp[2]:4 [ print_line_cursor#8 print_line_cursor#1 main::i#3 main::i#2 prepend::x#0 ]
reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
reg byte a [ print_char::ch#3 print_char::ch#2 print_char::ch#0 print_char::ch#1 ] reg byte a [ print_char::ch#3 print_char::ch#2 print_char::ch#0 print_char::ch#1 ]
zp[2]:6 [ print_char_cursor#26 print_char_cursor#49 print_char_cursor#10 ] zp[2]:6 [ print_char_cursor#26 print_char_cursor#48 print_char_cursor#10 ]
zp[2]:8 [ sum::s#3 sum::s#2 sum::return#2 main::$5 free_#22 free_#13 ] zp[2]:8 [ sum::s#3 sum::s#2 sum::return#2 main::$5 free_#22 free_#13 ]
zp[2]:10 [ last_time ] zp[2]:10 [ last_time ]
zp[2]:12 [ rand_seed ] zp[2]:12 [ Ticks#12 print_word::w#0 ]
zp[2]:14 [ Ticks#12 print_word::w#0 ]
reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$0 ]
reg byte x [ print_byte::$2 ] reg byte x [ print_byte::$2 ]
zp[2]:16 [ alloc::return#2 prepend::new#1 alloc::return#0 alloc::$1 Ticks#1 ] zp[2]:14 [ alloc::return#2 prepend::new#1 alloc::return#0 alloc::$1 Ticks#1 ]

View File

@@ -3,21 +3,18 @@
.pc = $80d "Program" .pc = $80d "Program"
.label rom = $e000 .label rom = $e000
.label last_time = $b .label last_time = $b
.label rand_seed = $d
.label print_char_cursor = 9 .label print_char_cursor = 9
.label print_line_cursor = 2 .label print_line_cursor = 2
.label Ticks = $f .label Ticks = $d
.label Ticks_1 = $11 .label Ticks_1 = $f
__b1: __b1:
lda #<0 lda #<0
sta.z last_time sta.z last_time
sta.z last_time+1 sta.z last_time+1
sta.z rand_seed
sta.z rand_seed+1
jsr main jsr main
rts rts
main: { main: {
.label i = $f .label i = $d
jsr start jsr start
lda #<$400 lda #<$400
sta.z print_line_cursor sta.z print_line_cursor
@@ -119,7 +116,7 @@ print_str: {
// utoa(word zp(5) value, byte* zp(7) buffer) // utoa(word zp(5) value, byte* zp(7) buffer)
utoa: { utoa: {
.const max_digits = 5 .const max_digits = 5
.label digit_value = $11 .label digit_value = $f
.label buffer = 7 .label buffer = 7
.label digit = 4 .label digit = 4
.label value = 5 .label value = 5
@@ -184,11 +181,11 @@ utoa: {
// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased. // - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased.
// (For decimal the subs used are 10000, 1000, 100, 10, 1) // (For decimal the subs used are 10000, 1000, 100, 10, 1)
// returns : the value reduced by sub * digit so that it is less than sub. // returns : the value reduced by sub * digit so that it is less than sub.
// utoa_append(byte* zp(7) buffer, word zp(5) value, word zp($11) sub) // utoa_append(byte* zp(7) buffer, word zp(5) value, word zp($f) sub)
utoa_append: { utoa_append: {
.label buffer = 7 .label buffer = 7
.label value = 5 .label value = 5
.label sub = $11 .label sub = $f
.label return = 5 .label return = 5
ldx #0 ldx #0
__b1: __b1:
@@ -277,9 +274,9 @@ end: {
rts rts
} }
// Print a word as HEX // Print a word as HEX
// print_word(word zp($11) w) // print_word(word zp($f) w)
print_word: { print_word: {
.label w = $11 .label w = $f
lda.z w+1 lda.z w+1
tax tax
jsr print_byte jsr print_byte
@@ -321,10 +318,6 @@ start: {
jsr $ffde jsr $ffde
sta LAST_TIME sta LAST_TIME
stx LAST_TIME+1 stx LAST_TIME+1
lda #<$194a
sta.z rand_seed
lda #>$194a
sta.z rand_seed+1
rts rts
} }
// The digits used for numbers // The digits used for numbers

View File

@@ -5,252 +5,248 @@
[1] (word) last_time ← (word) 0 [1] (word) last_time ← (word) 0
to:@2 to:@2
@2: scope:[] from @1 @2: scope:[] from @1
[2] (word) rand_seed ← (word) 0 [2] phi()
to:@3 [3] call main
@3: scope:[] from @2
[3] phi()
[4] call main
to:@end to:@end
@end: scope:[] from @3 @end: scope:[] from @2
[5] phi() [4] phi()
(signed word()) main() (signed word()) main()
main: scope:[main] from @3 main: scope:[main] from @2
[6] phi() [5] phi()
[7] call start [6] call start
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@6 main::@1: scope:[main] from main main::@6
[8] (byte*) print_line_cursor#20 ← phi( main::@6/(byte*) print_line_cursor#1 main/(byte*) 1024 ) [7] (byte*) print_line_cursor#20 ← phi( main::@6/(byte*) print_line_cursor#1 main/(byte*) 1024 )
[8] (byte*) print_char_cursor#51 ← phi( main::@6/(byte*) print_char_cursor#71 main/(byte*) 1024 ) [7] (byte*) print_char_cursor#51 ← phi( main::@6/(byte*) print_char_cursor#70 main/(byte*) 1024 )
[8] (word) main::i#3 ← phi( main::@6/(word) main::i#2 main/(byte) 0 ) [7] (word) main::i#3 ← phi( main::@6/(word) main::i#2 main/(byte) 0 )
[9] if((word) main::i#3<(byte) 6) goto main::@2 [8] if((word) main::i#3<(byte) 6) goto main::@2
to:main::@3 to:main::@3
main::@3: scope:[main] from main::@1 main::@3: scope:[main] from main::@1
[10] phi() [9] phi()
[11] call end [10] call end
to:main::@return to:main::@return
main::@return: scope:[main] from main::@3 main::@return: scope:[main] from main::@3
[12] return [11] return
to:@return to:@return
main::@2: scope:[main] from main::@1 main::@2: scope:[main] from main::@1
[13] phi() [12] phi()
[14] call sum [13] call sum
[15] (word) sum::return#2 ← (word) sum::s#3 [14] (word) sum::return#2 ← (word) sum::s#3
to:main::@4 to:main::@4
main::@4: scope:[main] from main::@2 main::@4: scope:[main] from main::@2
[16] (word) print_word_decimal::w#0 ← (word) sum::return#2 [15] (word) print_word_decimal::w#0 ← (word) sum::return#2
[17] call print_word_decimal [16] call print_word_decimal
to:main::@5 to:main::@5
main::@5: scope:[main] from main::@4 main::@5: scope:[main] from main::@4
[18] phi() [17] phi()
[19] call print_ln [18] call print_ln
to:main::@6 to:main::@6
main::@6: scope:[main] from main::@5 main::@6: scope:[main] from main::@5
[20] (word) main::i#2 ← ++ (word) main::i#3 [19] (word) main::i#2 ← ++ (word) main::i#3
[21] (byte*) print_char_cursor#71 ← (byte*) print_line_cursor#1 [20] (byte*) print_char_cursor#70 ← (byte*) print_line_cursor#1
to:main::@1 to:main::@1
(void()) print_ln() (void()) print_ln()
print_ln: scope:[print_ln] from end::@2 main::@5 print_ln: scope:[print_ln] from end::@2 main::@5
[22] (byte*) print_char_cursor#46 ← phi( end::@2/(byte*) print_char_cursor#13 main::@5/(byte*) print_char_cursor#2 ) [21] (byte*) print_char_cursor#46 ← phi( end::@2/(byte*) print_char_cursor#13 main::@5/(byte*) print_char_cursor#2 )
to:print_ln::@1 to:print_ln::@1
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
[23] (byte*) print_line_cursor#9 ← phi( print_ln/(byte*) print_line_cursor#20 print_ln::@1/(byte*) print_line_cursor#1 ) [22] (byte*) print_line_cursor#9 ← phi( print_ln/(byte*) print_line_cursor#20 print_ln::@1/(byte*) print_line_cursor#1 )
[24] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 [23] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28
[25] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#46) goto print_ln::@1 [24] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#46) goto print_ln::@1
to:print_ln::@return to:print_ln::@return
print_ln::@return: scope:[print_ln] from print_ln::@1 print_ln::@return: scope:[print_ln] from print_ln::@1
[26] return [25] return
to:@return to:@return
(void()) print_word_decimal((word) print_word_decimal::w) (void()) print_word_decimal((word) print_word_decimal::w)
print_word_decimal: scope:[print_word_decimal] from main::@4 print_word_decimal: scope:[print_word_decimal] from main::@4
[27] (word) utoa::value#1 ← (word) print_word_decimal::w#0 [26] (word) utoa::value#1 ← (word) print_word_decimal::w#0
[28] call utoa [27] call utoa
to:print_word_decimal::@1 to:print_word_decimal::@1
print_word_decimal::@1: scope:[print_word_decimal] from print_word_decimal print_word_decimal::@1: scope:[print_word_decimal] from print_word_decimal
[29] phi() [28] phi()
[30] call print_str [29] call print_str
to:print_word_decimal::@return to:print_word_decimal::@return
print_word_decimal::@return: scope:[print_word_decimal] from print_word_decimal::@1 print_word_decimal::@return: scope:[print_word_decimal] from print_word_decimal::@1
[31] return [30] return
to:@return to:@return
(void()) print_str((byte*) print_str::str) (void()) print_str((byte*) print_str::str)
print_str: scope:[print_str] from print_word_decimal::@1 print_str: scope:[print_str] from print_word_decimal::@1
[32] phi() [31] phi()
to:print_str::@1 to:print_str::@1
print_str::@1: scope:[print_str] from print_str print_str::@2 print_str::@1: scope:[print_str] from print_str print_str::@2
[33] (byte*) print_char_cursor#2 ← phi( print_str/(byte*) print_char_cursor#51 print_str::@2/(byte*) print_char_cursor#1 ) [32] (byte*) print_char_cursor#2 ← phi( print_str/(byte*) print_char_cursor#51 print_str::@2/(byte*) print_char_cursor#1 )
[33] (byte*) print_str::str#2 ← phi( print_str/(const byte*) decimal_digits print_str::@2/(byte*) print_str::str#0 ) [32] (byte*) print_str::str#2 ← phi( print_str/(const byte*) decimal_digits print_str::@2/(byte*) print_str::str#0 )
[34] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 [33] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2
to:print_str::@return to:print_str::@return
print_str::@return: scope:[print_str] from print_str::@1 print_str::@return: scope:[print_str] from print_str::@1
[35] return [34] return
to:@return to:@return
print_str::@2: scope:[print_str] from print_str::@1 print_str::@2: scope:[print_str] from print_str::@1
[36] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#2) [35] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#2)
[37] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#2 [36] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#2
[38] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 [37] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2
to:print_str::@1 to:print_str::@1
(void()) utoa((word) utoa::value , (byte*) utoa::buffer , (byte) utoa::radix) (void()) utoa((word) utoa::value , (byte*) utoa::buffer , (byte) utoa::radix)
utoa: scope:[utoa] from print_word_decimal utoa: scope:[utoa] from print_word_decimal
[39] phi() [38] phi()
to:utoa::@1 to:utoa::@1
utoa::@1: scope:[utoa] from utoa utoa::@4 utoa::@1: scope:[utoa] from utoa utoa::@4
[40] (byte*) utoa::buffer#11 ← phi( utoa::@4/(byte*) utoa::buffer#14 utoa/(const byte*) decimal_digits ) [39] (byte*) utoa::buffer#11 ← phi( utoa::@4/(byte*) utoa::buffer#14 utoa/(const byte*) decimal_digits )
[40] (byte) utoa::started#2 ← phi( utoa::@4/(byte) utoa::started#4 utoa/(byte) 0 ) [39] (byte) utoa::started#2 ← phi( utoa::@4/(byte) utoa::started#4 utoa/(byte) 0 )
[40] (word) utoa::value#2 ← phi( utoa::@4/(word) utoa::value#6 utoa/(word) utoa::value#1 ) [39] (word) utoa::value#2 ← phi( utoa::@4/(word) utoa::value#6 utoa/(word) utoa::value#1 )
[40] (byte) utoa::digit#2 ← phi( utoa::@4/(byte) utoa::digit#1 utoa/(byte) 0 ) [39] (byte) utoa::digit#2 ← phi( utoa::@4/(byte) utoa::digit#1 utoa/(byte) 0 )
[41] if((byte) utoa::digit#2<(const byte) utoa::max_digits#1-(byte) 1) goto utoa::@2 [40] if((byte) utoa::digit#2<(const byte) utoa::max_digits#1-(byte) 1) goto utoa::@2
to:utoa::@3 to:utoa::@3
utoa::@3: scope:[utoa] from utoa::@1 utoa::@3: scope:[utoa] from utoa::@1
[42] (byte~) utoa::$4 ← (byte)(word) utoa::value#2 [41] (byte~) utoa::$4 ← (byte)(word) utoa::value#2
[43] *((byte*) utoa::buffer#11) ← *((const byte*) DIGITS + (byte~) utoa::$4) [42] *((byte*) utoa::buffer#11) ← *((const byte*) DIGITS + (byte~) utoa::$4)
[44] (byte*) utoa::buffer#3 ← ++ (byte*) utoa::buffer#11 [43] (byte*) utoa::buffer#3 ← ++ (byte*) utoa::buffer#11
[45] *((byte*) utoa::buffer#3) ← (byte) 0 [44] *((byte*) utoa::buffer#3) ← (byte) 0
to:utoa::@return to:utoa::@return
utoa::@return: scope:[utoa] from utoa::@3 utoa::@return: scope:[utoa] from utoa::@3
[46] return [45] return
to:@return to:@return
utoa::@2: scope:[utoa] from utoa::@1 utoa::@2: scope:[utoa] from utoa::@1
[47] (byte~) utoa::$11 ← (byte) utoa::digit#2 << (byte) 1 [46] (byte~) utoa::$11 ← (byte) utoa::digit#2 << (byte) 1
[48] (word) utoa::digit_value#0 ← *((const word*) RADIX_DECIMAL_VALUES + (byte~) utoa::$11) [47] (word) utoa::digit_value#0 ← *((const word*) RADIX_DECIMAL_VALUES + (byte~) utoa::$11)
[49] if((byte) 0!=(byte) utoa::started#2) goto utoa::@5 [48] if((byte) 0!=(byte) utoa::started#2) goto utoa::@5
to:utoa::@7 to:utoa::@7
utoa::@7: scope:[utoa] from utoa::@2 utoa::@7: scope:[utoa] from utoa::@2
[50] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@5 [49] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@5
to:utoa::@4 to:utoa::@4
utoa::@4: scope:[utoa] from utoa::@6 utoa::@7 utoa::@4: scope:[utoa] from utoa::@6 utoa::@7
[51] (byte*) utoa::buffer#14 ← phi( utoa::@7/(byte*) utoa::buffer#11 utoa::@6/(byte*) utoa::buffer#4 ) [50] (byte*) utoa::buffer#14 ← phi( utoa::@7/(byte*) utoa::buffer#11 utoa::@6/(byte*) utoa::buffer#4 )
[51] (byte) utoa::started#4 ← phi( utoa::@7/(byte) utoa::started#2 utoa::@6/(byte) 1 ) [50] (byte) utoa::started#4 ← phi( utoa::@7/(byte) utoa::started#2 utoa::@6/(byte) 1 )
[51] (word) utoa::value#6 ← phi( utoa::@7/(word) utoa::value#2 utoa::@6/(word) utoa::value#0 ) [50] (word) utoa::value#6 ← phi( utoa::@7/(word) utoa::value#2 utoa::@6/(word) utoa::value#0 )
[52] (byte) utoa::digit#1 ← ++ (byte) utoa::digit#2 [51] (byte) utoa::digit#1 ← ++ (byte) utoa::digit#2
to:utoa::@1 to:utoa::@1
utoa::@5: scope:[utoa] from utoa::@2 utoa::@7 utoa::@5: scope:[utoa] from utoa::@2 utoa::@7
[53] (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#11 [52] (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#11
[54] (word) utoa_append::value#0 ← (word) utoa::value#2 [53] (word) utoa_append::value#0 ← (word) utoa::value#2
[55] (word) utoa_append::sub#0 ← (word) utoa::digit_value#0 [54] (word) utoa_append::sub#0 ← (word) utoa::digit_value#0
[56] call utoa_append [55] call utoa_append
[57] (word) utoa_append::return#0 ← (word) utoa_append::value#2 [56] (word) utoa_append::return#0 ← (word) utoa_append::value#2
to:utoa::@6 to:utoa::@6
utoa::@6: scope:[utoa] from utoa::@5 utoa::@6: scope:[utoa] from utoa::@5
[58] (word) utoa::value#0 ← (word) utoa_append::return#0 [57] (word) utoa::value#0 ← (word) utoa_append::return#0
[59] (byte*) utoa::buffer#4 ← ++ (byte*) utoa::buffer#11 [58] (byte*) utoa::buffer#4 ← ++ (byte*) utoa::buffer#11
to:utoa::@4 to:utoa::@4
(word()) utoa_append((byte*) utoa_append::buffer , (word) utoa_append::value , (word) utoa_append::sub) (word()) utoa_append((byte*) utoa_append::buffer , (word) utoa_append::value , (word) utoa_append::sub)
utoa_append: scope:[utoa_append] from utoa::@5 utoa_append: scope:[utoa_append] from utoa::@5
[60] phi() [59] phi()
to:utoa_append::@1 to:utoa_append::@1
utoa_append::@1: scope:[utoa_append] from utoa_append utoa_append::@2 utoa_append::@1: scope:[utoa_append] from utoa_append utoa_append::@2
[61] (byte) utoa_append::digit#2 ← phi( utoa_append/(byte) 0 utoa_append::@2/(byte) utoa_append::digit#1 ) [60] (byte) utoa_append::digit#2 ← phi( utoa_append/(byte) 0 utoa_append::@2/(byte) utoa_append::digit#1 )
[61] (word) utoa_append::value#2 ← phi( utoa_append/(word) utoa_append::value#0 utoa_append::@2/(word) utoa_append::value#1 ) [60] (word) utoa_append::value#2 ← phi( utoa_append/(word) utoa_append::value#0 utoa_append::@2/(word) utoa_append::value#1 )
[62] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2 [61] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2
to:utoa_append::@3 to:utoa_append::@3
utoa_append::@3: scope:[utoa_append] from utoa_append::@1 utoa_append::@3: scope:[utoa_append] from utoa_append::@1
[63] *((byte*) utoa_append::buffer#0) ← *((const byte*) DIGITS + (byte) utoa_append::digit#2) [62] *((byte*) utoa_append::buffer#0) ← *((const byte*) DIGITS + (byte) utoa_append::digit#2)
to:utoa_append::@return to:utoa_append::@return
utoa_append::@return: scope:[utoa_append] from utoa_append::@3 utoa_append::@return: scope:[utoa_append] from utoa_append::@3
[64] return [63] return
to:@return to:@return
utoa_append::@2: scope:[utoa_append] from utoa_append::@1 utoa_append::@2: scope:[utoa_append] from utoa_append::@1
[65] (byte) utoa_append::digit#1 ← ++ (byte) utoa_append::digit#2 [64] (byte) utoa_append::digit#1 ← ++ (byte) utoa_append::digit#2
[66] (word) utoa_append::value#1 ← (word) utoa_append::value#2 - (word) utoa_append::sub#0 [65] (word) utoa_append::value#1 ← (word) utoa_append::value#2 - (word) utoa_append::sub#0
to:utoa_append::@1 to:utoa_append::@1
(word()) sum() (word()) sum()
sum: scope:[sum] from main::@2 sum: scope:[sum] from main::@2
[67] phi() [66] phi()
to:sum::@1 to:sum::@1
sum::@1: scope:[sum] from sum sum::@3 sum::@1: scope:[sum] from sum sum::@3
[68] (byte*) sum::p#5 ← phi( sum/(const byte*) rom sum::@3/(byte*) sum::p#2 ) [67] (byte*) sum::p#5 ← phi( sum/(const byte*) rom sum::@3/(byte*) sum::p#2 )
[68] (word) sum::s#3 ← phi( sum/(byte) 0 sum::@3/(word) sum::s#2 ) [67] (word) sum::s#3 ← phi( sum/(byte) 0 sum::@3/(word) sum::s#2 )
[68] (byte) sum::page#3 ← phi( sum/(byte) 0 sum::@3/(byte) sum::page#2 ) [67] (byte) sum::page#3 ← phi( sum/(byte) 0 sum::@3/(byte) sum::page#2 )
[69] if((byte) sum::page#3<(byte) $20) goto sum::@2 [68] if((byte) sum::page#3<(byte) $20) goto sum::@2
to:sum::@return to:sum::@return
sum::@return: scope:[sum] from sum::@1 sum::@return: scope:[sum] from sum::@1
[70] return [69] return
to:@return to:@return
sum::@2: scope:[sum] from sum::@1 sum::@2 sum::@2: scope:[sum] from sum::@1 sum::@2
[71] (word) sum::s#4 ← phi( sum::@1/(word) sum::s#3 sum::@2/(word) sum::s#2 ) [70] (word) sum::s#4 ← phi( sum::@1/(word) sum::s#3 sum::@2/(word) sum::s#2 )
[71] (byte) sum::i#3 ← phi( sum::@1/(byte) 0 sum::@2/(byte) sum::i#2 ) [70] (byte) sum::i#3 ← phi( sum::@1/(byte) 0 sum::@2/(byte) sum::i#2 )
[72] (byte) sum::tmp#1 ← *((byte*) sum::p#5 + (byte) sum::i#3) [71] (byte) sum::tmp#1 ← *((byte*) sum::p#5 + (byte) sum::i#3)
[73] (word) sum::s#2 ← (word) sum::s#4 + (byte) sum::tmp#1 [72] (word) sum::s#2 ← (word) sum::s#4 + (byte) sum::tmp#1
[74] (byte) sum::i#2 ← ++ (byte) sum::i#3 [73] (byte) sum::i#2 ← ++ (byte) sum::i#3
[75] if((byte) 0!=(byte) sum::i#2) goto sum::@2 [74] if((byte) 0!=(byte) sum::i#2) goto sum::@2
to:sum::@3 to:sum::@3
sum::@3: scope:[sum] from sum::@2 sum::@3: scope:[sum] from sum::@2
[76] (byte*) sum::p#2 ← (byte*) sum::p#5 + (word) $100 [75] (byte*) sum::p#2 ← (byte*) sum::p#5 + (word) $100
[77] (byte) sum::page#2 ← ++ (byte) sum::page#3 [76] (byte) sum::page#2 ← ++ (byte) sum::page#3
to:sum::@1 to:sum::@1
(void()) end() (void()) end()
end: scope:[end] from main::@3 end: scope:[end] from main::@3
[78] (word) Ticks#1 ← (word) last_time [77] (word) Ticks#1 ← (word) last_time
[79] call start [78] call start
to:end::@1 to:end::@1
end::@1: scope:[end] from end end::@1: scope:[end] from end
[80] (word) last_time ← (word) last_time - (word) Ticks#1 [79] (word) last_time ← (word) last_time - (word) Ticks#1
[81] (word) Ticks#12 ← (word) last_time [80] (word) Ticks#12 ← (word) last_time
[82] (word) print_word::w#0 ← (word) Ticks#12 [81] (word) print_word::w#0 ← (word) Ticks#12
[83] call print_word [82] call print_word
to:end::@2 to:end::@2
end::@2: scope:[end] from end::@1 end::@2: scope:[end] from end::@1
[84] phi() [83] phi()
[85] call print_ln [84] call print_ln
to:end::@return to:end::@return
end::@return: scope:[end] from end::@2 end::@return: scope:[end] from end::@2
[86] return [85] return
to:@return to:@return
(void()) print_word((word) print_word::w) (void()) print_word((word) print_word::w)
print_word: scope:[print_word] from end::@1 print_word: scope:[print_word] from end::@1
[87] (byte) print_byte::b#0 ← > (word) print_word::w#0 [86] (byte) print_byte::b#0 ← > (word) print_word::w#0
[88] call print_byte [87] call print_byte
to:print_word::@1 to:print_word::@1
print_word::@1: scope:[print_word] from print_word print_word::@1: scope:[print_word] from print_word
[89] (byte) print_byte::b#1 ← < (word) print_word::w#0 [88] (byte) print_byte::b#1 ← < (word) print_word::w#0
[90] call print_byte [89] call print_byte
to:print_word::@return to:print_word::@return
print_word::@return: scope:[print_word] from print_word::@1 print_word::@return: scope:[print_word] from print_word::@1
[91] return [90] return
to:@return to:@return
(void()) print_byte((byte) print_byte::b) (void()) print_byte((byte) print_byte::b)
print_byte: scope:[print_byte] from print_word print_word::@1 print_byte: scope:[print_byte] from print_word print_word::@1
[92] (byte*) print_char_cursor#49 ← phi( print_word/(byte*) print_char_cursor#51 print_word::@1/(byte*) print_char_cursor#13 ) [91] (byte*) print_char_cursor#49 ← phi( print_word/(byte*) print_char_cursor#51 print_word::@1/(byte*) print_char_cursor#13 )
[92] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) [91] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 )
[93] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [92] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4
[94] (byte) print_char::ch#0 ← *((const byte*) DIGITS + (byte~) print_byte::$0) [93] (byte) print_char::ch#0 ← *((const byte*) DIGITS + (byte~) print_byte::$0)
[95] call print_char [94] call print_char
to:print_byte::@1 to:print_byte::@1
print_byte::@1: scope:[print_byte] from print_byte print_byte::@1: scope:[print_byte] from print_byte
[96] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [95] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f
[97] (byte) print_char::ch#1 ← *((const byte*) DIGITS + (byte~) print_byte::$2) [96] (byte) print_char::ch#1 ← *((const byte*) DIGITS + (byte~) print_byte::$2)
[98] call print_char [97] call print_char
to:print_byte::@return to:print_byte::@return
print_byte::@return: scope:[print_byte] from print_byte::@1 print_byte::@return: scope:[print_byte] from print_byte::@1
[99] return [98] return
to:@return to:@return
(void()) print_char((byte) print_char::ch) (void()) print_char((byte) print_char::ch)
print_char: scope:[print_char] from print_byte print_byte::@1 print_char: scope:[print_char] from print_byte print_byte::@1
[100] (byte*) print_char_cursor#35 ← phi( print_byte/(byte*) print_char_cursor#49 print_byte::@1/(byte*) print_char_cursor#13 ) [99] (byte*) print_char_cursor#35 ← phi( print_byte/(byte*) print_char_cursor#49 print_byte::@1/(byte*) print_char_cursor#13 )
[100] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) [99] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 )
[101] *((byte*) print_char_cursor#35) ← (byte) print_char::ch#2 [100] *((byte*) print_char_cursor#35) ← (byte) print_char::ch#2
[102] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#35 [101] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#35
to:print_char::@return to:print_char::@return
print_char::@return: scope:[print_char] from print_char print_char::@return: scope:[print_char] from print_char
[103] return [102] return
to:@return to:@return
(void()) start() (void()) start()
start: scope:[start] from end main start: scope:[start] from end main
asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 }
[105] (word) rand_seed ← (word) $194a
to:start::@return to:start::@return
start::@return: scope:[start] from start start::@return: scope:[start] from start
[106] return [104] return
to:@return to:@return

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,5 @@
(label) @1 (label) @1
(label) @2 (label) @2
(label) @3
(label) @begin (label) @begin
(label) @end (label) @end
(const byte*) DIGITS[] = (byte*) "0123456789abcdef"z (const byte*) DIGITS[] = (byte*) "0123456789abcdef"z
@@ -10,14 +9,14 @@
(const byte) RADIX::OCTAL = (number) 8 (const byte) RADIX::OCTAL = (number) 8
(const word*) RADIX_DECIMAL_VALUES[] = { (word) $2710, (word) $3e8, (word) $64, (word) $a } (const word*) RADIX_DECIMAL_VALUES[] = { (word) $2710, (word) $3e8, (word) $64, (word) $a }
(word) Ticks (word) Ticks
(word) Ticks#1 Ticks zp[2]:15 2.0 (word) Ticks#1 Ticks zp[2]:13 2.0
(word) Ticks#12 Ticks_1 zp[2]:17 4.0 (word) Ticks#12 Ticks_1 zp[2]:15 4.0
(const byte*) decimal_digits[(number) 6] = { fill( 6, 0) } (const byte*) decimal_digits[(number) 6] = { fill( 6, 0) }
(void()) end() (void()) end()
(label) end::@1 (label) end::@1
(label) end::@2 (label) end::@2
(label) end::@return (label) end::@return
(word) last_time loadstore zp[2]:11 0.5555555555555556 (word) last_time loadstore zp[2]:11 0.5882352941176471
(signed word()) main() (signed word()) main()
(label) main::@1 (label) main::@1
(label) main::@2 (label) main::@2
@@ -27,8 +26,8 @@
(label) main::@6 (label) main::@6
(label) main::@return (label) main::@return
(word) main::i (word) main::i
(word) main::i#2 i zp[2]:15 11.0 (word) main::i#2 i zp[2]:13 11.0
(word) main::i#3 i zp[2]:15 3.666666666666667 (word) main::i#3 i zp[2]:13 3.666666666666667
(signed word) main::return (signed word) main::return
(void()) print_byte((byte) print_byte::b) (void()) print_byte((byte) print_byte::b)
(byte~) print_byte::$0 reg byte a 4.0 (byte~) print_byte::$0 reg byte a 4.0
@@ -53,7 +52,7 @@
(byte*) print_char_cursor#46 print_char_cursor zp[2]:9 28.5 (byte*) print_char_cursor#46 print_char_cursor zp[2]:9 28.5
(byte*) print_char_cursor#49 print_char_cursor zp[2]:9 2.0 (byte*) print_char_cursor#49 print_char_cursor zp[2]:9 2.0
(byte*) print_char_cursor#51 print_char_cursor zp[2]:9 0.8823529411764707 (byte*) print_char_cursor#51 print_char_cursor zp[2]:9 0.8823529411764707
(byte*) print_char_cursor#71 print_char_cursor zp[2]:9 22.0 (byte*) print_char_cursor#70 print_char_cursor zp[2]:9 22.0
(byte*) print_line_cursor (byte*) print_line_cursor
(byte*) print_line_cursor#1 print_line_cursor zp[2]:2 54.16666666666666 (byte*) print_line_cursor#1 print_line_cursor zp[2]:2 54.16666666666666
(byte*) print_line_cursor#20 print_line_cursor zp[2]:2 0.7647058823529412 (byte*) print_line_cursor#20 print_line_cursor zp[2]:2 0.7647058823529412
@@ -73,13 +72,12 @@
(label) print_word::@1 (label) print_word::@1
(label) print_word::@return (label) print_word::@return
(word) print_word::w (word) print_word::w
(word) print_word::w#0 w zp[2]:17 2.0 (word) print_word::w#0 w zp[2]:15 2.0
(void()) print_word_decimal((word) print_word_decimal::w) (void()) print_word_decimal((word) print_word_decimal::w)
(label) print_word_decimal::@1 (label) print_word_decimal::@1
(label) print_word_decimal::@return (label) print_word_decimal::@return
(word) print_word_decimal::w (word) print_word_decimal::w
(word) print_word_decimal::w#0 w zp[2]:5 13.0 (word) print_word_decimal::w#0 w zp[2]:5 13.0
(word) rand_seed loadstore zp[2]:13 40.0
(const byte*) rom = (byte*) 57344 (const byte*) rom = (byte*) 57344
(void()) start() (void()) start()
(label) start::@return (label) start::@return
@@ -126,7 +124,7 @@
(byte) utoa::digit#1 digit zp[1]:4 202.0 (byte) utoa::digit#1 digit zp[1]:4 202.0
(byte) utoa::digit#2 digit zp[1]:4 28.857142857142858 (byte) utoa::digit#2 digit zp[1]:4 28.857142857142858
(word) utoa::digit_value (word) utoa::digit_value
(word) utoa::digit_value#0 digit_value zp[2]:17 60.599999999999994 (word) utoa::digit_value#0 digit_value zp[2]:15 60.599999999999994
(word*) utoa::digit_values (word*) utoa::digit_values
(byte) utoa::max_digits (byte) utoa::max_digits
(const byte) utoa::max_digits#1 max_digits = (byte) 5 (const byte) utoa::max_digits#1 max_digits = (byte) 5
@@ -152,7 +150,7 @@
(word) utoa_append::return (word) utoa_append::return
(word) utoa_append::return#0 return zp[2]:5 202.0 (word) utoa_append::return#0 return zp[2]:5 202.0
(word) utoa_append::sub (word) utoa_append::sub
(word) utoa_append::sub#0 sub zp[2]:17 350.5 (word) utoa_append::sub#0 sub zp[2]:15 350.5
(word) utoa_append::value (word) utoa_append::value
(word) utoa_append::value#0 value zp[2]:5 34.33333333333333 (word) utoa_append::value#0 value zp[2]:5 34.33333333333333
(word) utoa_append::value#1 value zp[2]:5 2002.0 (word) utoa_append::value#1 value zp[2]:5 2002.0
@@ -168,13 +166,12 @@ zp[2]:7 [ sum::p#5 sum::p#2 utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 utoa:
reg byte y [ sum::i#3 sum::i#2 ] reg byte y [ sum::i#3 sum::i#2 ]
reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ]
zp[2]:9 [ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#71 print_char_cursor#1 ] zp[2]:9 [ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#70 print_char_cursor#1 ]
zp[2]:11 [ last_time ] zp[2]:11 [ last_time ]
zp[2]:13 [ rand_seed ]
reg byte a [ utoa::$4 ] reg byte a [ utoa::$4 ]
reg byte a [ utoa::$11 ] reg byte a [ utoa::$11 ]
reg byte a [ sum::tmp#1 ] reg byte a [ sum::tmp#1 ]
zp[2]:15 [ Ticks#1 main::i#3 main::i#2 ] zp[2]:13 [ Ticks#1 main::i#3 main::i#2 ]
zp[2]:17 [ Ticks#12 print_word::w#0 utoa::digit_value#0 utoa_append::sub#0 ] zp[2]:15 [ Ticks#12 print_word::w#0 utoa::digit_value#0 utoa_append::sub#0 ]
reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$0 ]
reg byte x [ print_byte::$2 ] reg byte x [ print_byte::$2 ]

View File

@@ -4,17 +4,14 @@
.const COUNT = $4000 .const COUNT = $4000
.const SQRT_COUNT = $80 .const SQRT_COUNT = $80
.label last_time = 6 .label last_time = 6
.label rand_seed = 8
.label print_line_cursor = 2 .label print_line_cursor = 2
.label print_char_cursor = 4 .label print_char_cursor = 4
.label Ticks = $a .label Ticks = 8
.label Ticks_1 = $c .label Ticks_1 = $a
__b1: __b1:
lda #<0 lda #<0
sta.z last_time sta.z last_time
sta.z last_time+1 sta.z last_time+1
sta.z rand_seed
sta.z rand_seed+1
jsr main jsr main
rts rts
main: { main: {
@@ -78,9 +75,9 @@ print_ln: {
rts rts
} }
// Print a word as HEX // Print a word as HEX
// print_word(word zp($c) w) // print_word(word zp($a) w)
print_word: { print_word: {
.label w = $c .label w = $a
lda.z w+1 lda.z w+1
tax tax
lda #<$400 lda #<$400
@@ -126,10 +123,6 @@ start: {
jsr $ffde jsr $ffde
sta LAST_TIME sta LAST_TIME
stx LAST_TIME+1 stx LAST_TIME+1
lda #<$194a
sta.z rand_seed
lda #>$194a
sta.z rand_seed+1
rts rts
} }
round: { round: {

View File

@@ -5,184 +5,180 @@
[1] (word) last_time ← (word) 0 [1] (word) last_time ← (word) 0
to:@2 to:@2
@2: scope:[] from @1 @2: scope:[] from @1
[2] (word) rand_seed ← (word) 0 [2] phi()
to:@3 [3] call main
@3: scope:[] from @2
[3] phi()
[4] call main
to:@end to:@end
@end: scope:[] from @3 @end: scope:[] from @2
[5] phi() [4] phi()
(signed word()) main() (signed word()) main()
main: scope:[main] from @3 main: scope:[main] from @2
[6] phi() [5] phi()
[7] call start [6] call start
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@1: scope:[main] from main
[8] phi() [7] phi()
[9] call round [8] call round
to:main::@2 to:main::@2
main::@2: scope:[main] from main::@1 main::@2: scope:[main] from main::@1
[10] phi() [9] phi()
[11] call round [10] call round
to:main::@3 to:main::@3
main::@3: scope:[main] from main::@2 main::@3: scope:[main] from main::@2
[12] phi() [11] phi()
[13] call round [12] call round
to:main::@4 to:main::@4
main::@4: scope:[main] from main::@3 main::@4: scope:[main] from main::@3
[14] phi() [13] phi()
[15] call round [14] call round
to:main::@5 to:main::@5
main::@5: scope:[main] from main::@4 main::@5: scope:[main] from main::@4
[16] phi() [15] phi()
[17] call round [16] call round
to:main::@6 to:main::@6
main::@6: scope:[main] from main::@5 main::@6: scope:[main] from main::@5
[18] phi() [17] phi()
[19] call round [18] call round
to:main::@7 to:main::@7
main::@7: scope:[main] from main::@6 main::@7: scope:[main] from main::@6
[20] phi() [19] phi()
[21] call round [20] call round
to:main::@8 to:main::@8
main::@8: scope:[main] from main::@7 main::@8: scope:[main] from main::@7
[22] phi() [21] phi()
[23] call round [22] call round
to:main::@9 to:main::@9
main::@9: scope:[main] from main::@8 main::@9: scope:[main] from main::@8
[24] phi() [23] phi()
[25] call round [24] call round
to:main::@10 to:main::@10
main::@10: scope:[main] from main::@9 main::@10: scope:[main] from main::@9
[26] phi() [25] phi()
[27] call round [26] call round
to:main::@11 to:main::@11
main::@11: scope:[main] from main::@10 main::@11: scope:[main] from main::@10
[28] phi() [27] phi()
[29] call end [28] call end
to:main::@return to:main::@return
main::@return: scope:[main] from main::@11 main::@return: scope:[main] from main::@11
[30] return [29] return
to:@return to:@return
(void()) end() (void()) end()
end: scope:[end] from main::@11 end: scope:[end] from main::@11
[31] (word) Ticks#1 ← (word) last_time [30] (word) Ticks#1 ← (word) last_time
[32] call start [31] call start
to:end::@1 to:end::@1
end::@1: scope:[end] from end end::@1: scope:[end] from end
[33] (word) last_time ← (word) last_time - (word) Ticks#1 [32] (word) last_time ← (word) last_time - (word) Ticks#1
[34] (word) Ticks#12 ← (word) last_time [33] (word) Ticks#12 ← (word) last_time
[35] (word) print_word::w#0 ← (word) Ticks#12 [34] (word) print_word::w#0 ← (word) Ticks#12
[36] call print_word [35] call print_word
to:end::@2 to:end::@2
end::@2: scope:[end] from end::@1 end::@2: scope:[end] from end::@1
[37] phi() [36] phi()
[38] call print_ln [37] call print_ln
to:end::@return to:end::@return
end::@return: scope:[end] from end::@2 end::@return: scope:[end] from end::@2
[39] return [38] return
to:@return to:@return
(void()) print_ln() (void()) print_ln()
print_ln: scope:[print_ln] from end::@2 print_ln: scope:[print_ln] from end::@2
[40] phi() [39] phi()
to:print_ln::@1 to:print_ln::@1
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
[41] (byte*) print_line_cursor#8 ← phi( print_ln/(byte*) 1024 print_ln::@1/(byte*) print_line_cursor#1 ) [40] (byte*) print_line_cursor#8 ← phi( print_ln/(byte*) 1024 print_ln::@1/(byte*) print_line_cursor#1 )
[42] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 [41] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28
[43] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 [42] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1
to:print_ln::@return to:print_ln::@return
print_ln::@return: scope:[print_ln] from print_ln::@1 print_ln::@return: scope:[print_ln] from print_ln::@1
[44] return [43] return
to:@return to:@return
(void()) print_word((word) print_word::w) (void()) print_word((word) print_word::w)
print_word: scope:[print_word] from end::@1 print_word: scope:[print_word] from end::@1
[45] (byte) print_byte::b#0 ← > (word) print_word::w#0 [44] (byte) print_byte::b#0 ← > (word) print_word::w#0
[46] call print_byte [45] call print_byte
to:print_word::@1 to:print_word::@1
print_word::@1: scope:[print_word] from print_word print_word::@1: scope:[print_word] from print_word
[47] (byte) print_byte::b#1 ← < (word) print_word::w#0 [46] (byte) print_byte::b#1 ← < (word) print_word::w#0
[48] call print_byte [47] call print_byte
to:print_word::@return to:print_word::@return
print_word::@return: scope:[print_word] from print_word::@1 print_word::@return: scope:[print_word] from print_word::@1
[49] return [48] return
to:@return to:@return
(void()) print_byte((byte) print_byte::b) (void()) print_byte((byte) print_byte::b)
print_byte: scope:[print_byte] from print_word print_word::@1 print_byte: scope:[print_byte] from print_word print_word::@1
[50] (byte*) print_char_cursor#35 ← phi( print_word/(byte*) 1024 print_word::@1/(byte*) print_char_cursor#10 ) [49] (byte*) print_char_cursor#35 ← phi( print_word/(byte*) 1024 print_word::@1/(byte*) print_char_cursor#10 )
[50] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) [49] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 )
[51] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [50] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4
[52] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) [51] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0)
[53] call print_char [52] call print_char
to:print_byte::@1 to:print_byte::@1
print_byte::@1: scope:[print_byte] from print_byte print_byte::@1: scope:[print_byte] from print_byte
[54] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [53] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f
[55] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) [54] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2)
[56] call print_char [55] call print_char
to:print_byte::@return to:print_byte::@return
print_byte::@return: scope:[print_byte] from print_byte::@1 print_byte::@return: scope:[print_byte] from print_byte::@1
[57] return [56] return
to:@return to:@return
(void()) print_char((byte) print_char::ch) (void()) print_char((byte) print_char::ch)
print_char: scope:[print_char] from print_byte print_byte::@1 print_char: scope:[print_char] from print_byte print_byte::@1
[58] (byte*) print_char_cursor#25 ← phi( print_byte/(byte*) print_char_cursor#35 print_byte::@1/(byte*) print_char_cursor#10 ) [57] (byte*) print_char_cursor#25 ← phi( print_byte/(byte*) print_char_cursor#35 print_byte::@1/(byte*) print_char_cursor#10 )
[58] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) [57] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 )
[59] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 [58] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2
[60] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 [59] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25
to:print_char::@return to:print_char::@return
print_char::@return: scope:[print_char] from print_char print_char::@return: scope:[print_char] from print_char
[61] return [60] return
to:@return to:@return
(void()) start() (void()) start()
start: scope:[start] from end main start: scope:[start] from end main
asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 }
[63] (word) rand_seed ← (word) $194a
to:start::@return to:start::@return
start::@return: scope:[start] from start start::@return: scope:[start] from start
[64] return [62] return
to:@return to:@return
(void()) round() (void()) round()
round: scope:[round] from main::@1 main::@10 main::@2 main::@3 main::@4 main::@5 main::@6 main::@7 main::@8 main::@9 round: scope:[round] from main::@1 main::@10 main::@2 main::@3 main::@4 main::@5 main::@6 main::@7 main::@8 main::@9
[65] phi() [63] phi()
to:round::@1 to:round::@1
round::@1: scope:[round] from round round::@2 round::@1: scope:[round] from round round::@2
[66] (byte*) round::p#2 ← phi( round/(const byte*) Sieve round::@2/(byte*) round::p#1 ) [64] (byte*) round::p#2 ← phi( round/(const byte*) Sieve round::@2/(byte*) round::p#1 )
[67] if((byte*) round::p#2<(const byte*) Sieve+(const word) COUNT) goto round::@2 [65] if((byte*) round::p#2<(const byte*) Sieve+(const word) COUNT) goto round::@2
to:round::@3 to:round::@3
round::@3: scope:[round] from round::@1 round::@5 round::@3: scope:[round] from round::@1 round::@5
[68] (byte) round::I#3 ← phi( round::@5/(byte) round::I#2 round::@1/(byte) 2 ) [66] (byte) round::I#3 ← phi( round::@5/(byte) round::I#2 round::@1/(byte) 2 )
[69] if((byte) round::I#3<(const byte) SQRT_COUNT) goto round::@4 [67] if((byte) round::I#3<(const byte) SQRT_COUNT) goto round::@4
to:round::@return to:round::@return
round::@return: scope:[round] from round::@3 round::@return: scope:[round] from round::@3
[70] return [68] return
to:@return to:@return
round::@4: scope:[round] from round::@3 round::@4: scope:[round] from round::@3
[71] if(*((const byte*) Sieve + (byte) round::I#3)!=(byte) 0) goto round::@5 [69] if(*((const byte*) Sieve + (byte) round::I#3)!=(byte) 0) goto round::@5
to:round::@8 to:round::@8
round::@8: scope:[round] from round::@4 round::@8: scope:[round] from round::@4
[72] (byte~) round::$4 ← (byte) round::I#3 << (byte) 1 [70] (byte~) round::$4 ← (byte) round::I#3 << (byte) 1
[73] (byte*) round::S#1 ← (const byte*) Sieve + (byte~) round::$4 [71] (byte*) round::S#1 ← (const byte*) Sieve + (byte~) round::$4
to:round::@6 to:round::@6
round::@6: scope:[round] from round::@7 round::@8 round::@6: scope:[round] from round::@7 round::@8
[74] (byte*) round::S#3 ← phi( round::@7/(byte*) round::S#2 round::@8/(byte*) round::S#1 ) [72] (byte*) round::S#3 ← phi( round::@7/(byte*) round::S#2 round::@8/(byte*) round::S#1 )
[75] if((byte*) round::S#3<(const byte*) Sieve+(const word) COUNT) goto round::@7 [73] if((byte*) round::S#3<(const byte*) Sieve+(const word) COUNT) goto round::@7
to:round::@5 to:round::@5
round::@5: scope:[round] from round::@4 round::@6 round::@5: scope:[round] from round::@4 round::@6
[76] (byte) round::I#2 ← ++ (byte) round::I#3 [74] (byte) round::I#2 ← ++ (byte) round::I#3
to:round::@3 to:round::@3
round::@7: scope:[round] from round::@6 round::@7: scope:[round] from round::@6
[77] *((byte*) round::S#3) ← (byte) 1 [75] *((byte*) round::S#3) ← (byte) 1
[78] (byte*) round::S#2 ← (byte*) round::S#3 + (byte) round::I#3 [76] (byte*) round::S#2 ← (byte*) round::S#3 + (byte) round::I#3
to:round::@6 to:round::@6
round::@2: scope:[round] from round::@1 round::@2: scope:[round] from round::@1
[79] *((byte*) round::p#2) ← (byte) 0 [77] *((byte*) round::p#2) ← (byte) 0
[80] (byte*) round::p#1 ← ++ (byte*) round::p#2 [78] (byte*) round::p#1 ← ++ (byte*) round::p#2
to:round::@1 to:round::@1

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,5 @@
(label) @1 (label) @1
(label) @2 (label) @2
(label) @3
(label) @begin (label) @begin
(label) @end (label) @end
(const word) COUNT = (word) $4000 (const word) COUNT = (word) $4000
@@ -11,13 +10,13 @@
(const byte) SQRT_COUNT = (byte) $80 (const byte) SQRT_COUNT = (byte) $80
(const byte*) Sieve[(const word) COUNT] = { fill( COUNT, 0) } (const byte*) Sieve[(const word) COUNT] = { fill( COUNT, 0) }
(word) Ticks (word) Ticks
(word) Ticks#1 Ticks zp[2]:10 2.0 (word) Ticks#1 Ticks zp[2]:8 2.0
(word) Ticks#12 Ticks_1 zp[2]:12 4.0 (word) Ticks#12 Ticks_1 zp[2]:10 4.0
(void()) end() (void()) end()
(label) end::@1 (label) end::@1
(label) end::@2 (label) end::@2
(label) end::@return (label) end::@return
(word) last_time loadstore zp[2]:6 0.37037037037037035 (word) last_time loadstore zp[2]:6 0.38461538461538464
(signed word()) main() (signed word()) main()
(label) main::@1 (label) main::@1
(label) main::@10 (label) main::@10
@@ -63,8 +62,7 @@
(label) print_word::@1 (label) print_word::@1
(label) print_word::@return (label) print_word::@return
(word) print_word::w (word) print_word::w
(word) print_word::w#0 w zp[2]:12 2.0 (word) print_word::w#0 w zp[2]:10 2.0
(word) rand_seed loadstore zp[2]:8 40.0
(void()) round() (void()) round()
(byte~) round::$4 reg byte a 22.0 (byte~) round::$4 reg byte a 22.0
(label) round::@1 (label) round::@1
@@ -96,9 +94,8 @@ zp[2]:2 [ round::p#2 round::p#1 print_line_cursor#8 print_line_cursor#1 ]
reg byte x [ round::I#3 round::I#2 ] reg byte x [ round::I#3 round::I#2 ]
zp[2]:4 [ round::S#3 round::S#2 round::S#1 print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] zp[2]:4 [ round::S#3 round::S#2 round::S#1 print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ]
zp[2]:6 [ last_time ] zp[2]:6 [ last_time ]
zp[2]:8 [ rand_seed ] zp[2]:8 [ Ticks#1 ]
zp[2]:10 [ Ticks#1 ] zp[2]:10 [ Ticks#12 print_word::w#0 ]
zp[2]:12 [ Ticks#12 print_word::w#0 ]
reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$0 ]
reg byte x [ print_byte::$2 ] reg byte x [ print_byte::$2 ]
reg byte a [ round::$4 ] reg byte a [ round::$4 ]

View File

@@ -32,6 +32,8 @@ Replacing struct member reference (struct Point) main::point1.x with member unwi
Replacing struct member reference (struct Point) main::point1.y with member unwinding reference *((byte*)&(struct Point) main::point1+(const byte) OFFSET_STRUCT_POINT_Y) Replacing struct member reference (struct Point) main::point1.y with member unwinding reference *((byte*)&(struct Point) main::point1+(const byte) OFFSET_STRUCT_POINT_Y)
Replacing struct member reference (struct Point) main::point2.x with member unwinding reference *((byte*)&(struct Point) main::point2+(const byte) OFFSET_STRUCT_POINT_X) Replacing struct member reference (struct Point) main::point2.x with member unwinding reference *((byte*)&(struct Point) main::point2+(const byte) OFFSET_STRUCT_POINT_X)
Replacing struct member reference (struct Point) main::point2.y with member unwinding reference *((byte*)&(struct Point) main::point2+(const byte) OFFSET_STRUCT_POINT_Y) Replacing struct member reference (struct Point) main::point2.y with member unwinding reference *((byte*)&(struct Point) main::point2+(const byte) OFFSET_STRUCT_POINT_Y)
Eliminating unused variable with no statement (struct Point~) main::$0
Eliminating unused variable with no statement (struct Point~) main::$1
Culled Empty Block (label) @1 Culled Empty Block (label) @1
Culled Empty Block (label) getPoint::@1 Culled Empty Block (label) getPoint::@1
Unwinding list assignment { (byte~) main::$0_x, (byte~) main::$0_y } ← { (byte) getPoint::return_x, (byte) getPoint::return_y } Unwinding list assignment { (byte~) main::$0_x, (byte~) main::$0_y } ← { (byte) getPoint::return_x, (byte) getPoint::return_y }
@@ -151,10 +153,8 @@ SYMBOL TABLE SSA
(byte) getPoint::y#1 (byte) getPoint::y#1
(byte) getPoint::y#2 (byte) getPoint::y#2
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x (byte~) main::$0_x
(byte~) main::$0_y (byte~) main::$0_y
(struct Point~) main::$1
(byte~) main::$1_x (byte~) main::$1_x
(byte~) main::$1_y (byte~) main::$1_y
(label) main::@1 (label) main::@1
@@ -320,10 +320,8 @@ VARIABLE REGISTER WEIGHTS
(byte) getPoint::x (byte) getPoint::x
(byte) getPoint::y (byte) getPoint::y
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x 2.0 (byte~) main::$0_x 2.0
(byte~) main::$0_y 2.0 (byte~) main::$0_y 2.0
(struct Point~) main::$1
(byte~) main::$1_x 2.0 (byte~) main::$1_x 2.0
(byte~) main::$1_y 2.0 (byte~) main::$1_y 2.0
(struct Point) main::point1 loadstore (struct Point) main::point1 loadstore
@@ -690,10 +688,8 @@ FINAL SYMBOL TABLE
(byte) getPoint::x (byte) getPoint::x
(byte) getPoint::y (byte) getPoint::y
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x reg byte x 2.0 (byte~) main::$0_x reg byte x 2.0
(byte~) main::$0_y reg byte a 2.0 (byte~) main::$0_y reg byte a 2.0
(struct Point~) main::$1
(byte~) main::$1_x reg byte x 2.0 (byte~) main::$1_x reg byte x 2.0
(byte~) main::$1_y reg byte a 2.0 (byte~) main::$1_y reg byte a 2.0
(label) main::@1 (label) main::@1

View File

@@ -21,10 +21,8 @@
(byte) getPoint::x (byte) getPoint::x
(byte) getPoint::y (byte) getPoint::y
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x reg byte x 2.0 (byte~) main::$0_x reg byte x 2.0
(byte~) main::$0_y reg byte a 2.0 (byte~) main::$0_y reg byte a 2.0
(struct Point~) main::$1
(byte~) main::$1_x reg byte x 2.0 (byte~) main::$1_x reg byte x 2.0
(byte~) main::$1_y reg byte a 2.0 (byte~) main::$1_y reg byte a 2.0
(label) main::@1 (label) main::@1

View File

@@ -31,6 +31,7 @@ Replacing struct member reference (struct Point) main::q.x with member unwinding
Replacing struct member reference (struct Point) main::q.y with member unwinding reference (byte) main::q_y Replacing struct member reference (struct Point) main::q.y with member unwinding reference (byte) main::q_y
Identified constant variable (byte) point::p_x Identified constant variable (byte) point::p_x
Identified constant variable (byte) point::p_y Identified constant variable (byte) point::p_y
Eliminating unused variable with no statement (struct Point~) main::$0
Culled Empty Block (label) @1 Culled Empty Block (label) @1
Culled Empty Block (label) point::@1 Culled Empty Block (label) point::@1
Unwinding list assignment { (byte~) main::$0_x, (byte~) main::$0_y } ← { (byte) point::return_x, (byte) point::return_y } Unwinding list assignment { (byte~) main::$0_x, (byte~) main::$0_y } ← { (byte) point::return_x, (byte) point::return_y }
@@ -91,7 +92,6 @@ SYMBOL TABLE SSA
(byte) Point::x (byte) Point::x
(byte) Point::y (byte) Point::y
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x (byte~) main::$0_x
(byte~) main::$0_y (byte~) main::$0_y
(label) main::@1 (label) main::@1
@@ -224,7 +224,6 @@ VARIABLE REGISTER WEIGHTS
(byte) Point::x (byte) Point::x
(byte) Point::y (byte) Point::y
(void()) main() (void()) main()
(struct Point~) main::$0
(byte) main::q_x (byte) main::q_x
(byte) main::q_y (byte) main::q_y
(struct Point()) point() (struct Point()) point()
@@ -399,7 +398,6 @@ FINAL SYMBOL TABLE
(byte) Point::x (byte) Point::x
(byte) Point::y (byte) Point::y
(void()) main() (void()) main()
(struct Point~) main::$0
(label) main::@1 (label) main::@1
(label) main::@return (label) main::@return
(const byte*) main::SCREEN = (byte*) 1024 (const byte*) main::SCREEN = (byte*) 1024

View File

@@ -4,7 +4,6 @@
(byte) Point::x (byte) Point::x
(byte) Point::y (byte) Point::y
(void()) main() (void()) main()
(struct Point~) main::$0
(label) main::@1 (label) main::@1
(label) main::@return (label) main::@return
(const byte*) main::SCREEN = (byte*) 1024 (const byte*) main::SCREEN = (byte*) 1024

View File

@@ -33,6 +33,8 @@ Identified constant variable (byte) idx
Identified constant variable (struct Point*) p0 Identified constant variable (struct Point*) p0
Identified constant variable (struct Point*) p1 Identified constant variable (struct Point*) p1
Identified constant variable (struct Point*) p2 Identified constant variable (struct Point*) p2
Eliminating unused variable with no statement (struct Point~) main::$0
Eliminating unused variable with no statement (struct Point~) main::$1
Culled Empty Block (label) main::@2 Culled Empty Block (label) main::@2
Culled Empty Block (label) @1 Culled Empty Block (label) @1
Culled Empty Block (label) get::@7 Culled Empty Block (label) get::@7
@@ -194,10 +196,8 @@ SYMBOL TABLE SSA
(byte) get::return_y#7 (byte) get::return_y#7
(byte) get::return_y#8 (byte) get::return_y#8
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x (byte~) main::$0_x
(byte~) main::$0_y (byte~) main::$0_y
(struct Point~) main::$1
(byte~) main::$1_x (byte~) main::$1_x
(byte~) main::$1_y (byte~) main::$1_y
(bool~) main::$2 (bool~) main::$2
@@ -423,10 +423,8 @@ VARIABLE REGISTER WEIGHTS
(byte) get::return_y#4 4.0 (byte) get::return_y#4 4.0
(byte) get::return_y#5 3.166666666666667 (byte) get::return_y#5 3.166666666666667
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x 2.0 (byte~) main::$0_x 2.0
(byte~) main::$0_y 2.0 (byte~) main::$0_y 2.0
(struct Point~) main::$1
(byte~) main::$1_x 7.333333333333333 (byte~) main::$1_x 7.333333333333333
(byte~) main::$1_y 7.333333333333333 (byte~) main::$1_y 7.333333333333333
(byte~) main::$3 16.5 (byte~) main::$3 16.5
@@ -950,10 +948,8 @@ FINAL SYMBOL TABLE
(byte) get::return_y#4 return_y zp[1]:2 4.0 (byte) get::return_y#4 return_y zp[1]:2 4.0
(byte) get::return_y#5 return_y zp[1]:2 3.166666666666667 (byte) get::return_y#5 return_y zp[1]:2 3.166666666666667
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x reg byte x 2.0 (byte~) main::$0_x reg byte x 2.0
(byte~) main::$0_y reg byte a 2.0 (byte~) main::$0_y reg byte a 2.0
(struct Point~) main::$1
(byte~) main::$1_x zp[1]:2 7.333333333333333 (byte~) main::$1_x zp[1]:2 7.333333333333333
(byte~) main::$1_y zp[1]:3 7.333333333333333 (byte~) main::$1_y zp[1]:3 7.333333333333333
(byte~) main::$3 reg byte x 16.5 (byte~) main::$3 reg byte x 16.5

View File

@@ -30,10 +30,8 @@
(byte) get::return_y#4 return_y zp[1]:2 4.0 (byte) get::return_y#4 return_y zp[1]:2 4.0
(byte) get::return_y#5 return_y zp[1]:2 3.166666666666667 (byte) get::return_y#5 return_y zp[1]:2 3.166666666666667
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x reg byte x 2.0 (byte~) main::$0_x reg byte x 2.0
(byte~) main::$0_y reg byte a 2.0 (byte~) main::$0_y reg byte a 2.0
(struct Point~) main::$1
(byte~) main::$1_x zp[1]:2 7.333333333333333 (byte~) main::$1_x zp[1]:2 7.333333333333333
(byte~) main::$1_y zp[1]:3 7.333333333333333 (byte~) main::$1_y zp[1]:3 7.333333333333333
(byte~) main::$3 reg byte x 16.5 (byte~) main::$3 reg byte x 16.5

View File

@@ -31,6 +31,8 @@ Adding value simple copy (byte) get::return_y ← (byte) get::return_y
Converted procedure struct return value to member unwinding return { (byte) get::return_x, (byte) get::return_y } Converted procedure struct return value to member unwinding return { (byte) get::return_x, (byte) get::return_y }
Identified constant variable (byte) idx Identified constant variable (byte) idx
Identified constant variable (byte) get::p_y Identified constant variable (byte) get::p_y
Eliminating unused variable with no statement (struct Point~) main::$0
Eliminating unused variable with no statement (struct Point~) main::$1
Culled Empty Block (label) main::@2 Culled Empty Block (label) main::@2
Culled Empty Block (label) @1 Culled Empty Block (label) @1
Culled Empty Block (label) get::@1 Culled Empty Block (label) get::@1
@@ -146,10 +148,8 @@ SYMBOL TABLE SSA
(byte) get::return_y#5 (byte) get::return_y#5
(byte) get::return_y#6 (byte) get::return_y#6
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x (byte~) main::$0_x
(byte~) main::$0_y (byte~) main::$0_y
(struct Point~) main::$1
(byte~) main::$1_x (byte~) main::$1_x
(byte~) main::$1_y (byte~) main::$1_y
(bool~) main::$2 (bool~) main::$2
@@ -309,9 +309,7 @@ VARIABLE REGISTER WEIGHTS
(byte) get::return_x#2 6.0 (byte) get::return_x#2 6.0
(byte) get::return_y (byte) get::return_y
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x 4.0 (byte~) main::$0_x 4.0
(struct Point~) main::$1
(byte~) main::$1_x 11.0 (byte~) main::$1_x 11.0
(byte~) main::$3 16.5 (byte~) main::$3 16.5
(byte) main::i (byte) main::i
@@ -658,9 +656,7 @@ FINAL SYMBOL TABLE
(byte) get::return_x#2 reg byte a 6.0 (byte) get::return_x#2 reg byte a 6.0
(byte) get::return_y (byte) get::return_y
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x reg byte a 4.0 (byte~) main::$0_x reg byte a 4.0
(struct Point~) main::$1
(byte~) main::$1_x zp[1]:2 11.0 (byte~) main::$1_x zp[1]:2 11.0
(byte~) main::$3 reg byte x 16.5 (byte~) main::$3 reg byte x 16.5
(label) main::@1 (label) main::@1

View File

@@ -18,9 +18,7 @@
(byte) get::return_x#2 reg byte a 6.0 (byte) get::return_x#2 reg byte a 6.0
(byte) get::return_y (byte) get::return_y
(void()) main() (void()) main()
(struct Point~) main::$0
(byte~) main::$0_x reg byte a 4.0 (byte~) main::$0_x reg byte a 4.0
(struct Point~) main::$1
(byte~) main::$1_x zp[1]:2 11.0 (byte~) main::$1_x zp[1]:2 11.0
(byte~) main::$3 reg byte x 16.5 (byte~) main::$3 reg byte x 16.5
(label) main::@1 (label) main::@1

View File

@@ -51,9 +51,6 @@ testSignedVals: {
rts rts
} }
testSigned: { testSigned: {
.label sbv1 = 3
lda #-$78
sta.z sbv1
lda #0 lda #0
sta SCREEN+$28*2 sta SCREEN+$28*2
lda #TYPEID_SIGNED_BYTE lda #TYPEID_SIGNED_BYTE
@@ -73,7 +70,7 @@ testSigned: {
} }
testUnsignedVals: { testUnsignedVals: {
.const ubc1 = $fa .const ubc1 = $fa
.label ubv1 = 4 .label ubv1 = 3
lda #$fa lda #$fa
sta.z ubv1 sta.z ubv1
sta SCREEN+$28 sta SCREEN+$28
@@ -107,9 +104,6 @@ testUnsignedVals: {
rts rts
} }
testUnsigned: { testUnsigned: {
.label ubv1 = 5
lda #$fa
sta.z ubv1
lda #0 lda #0
sta SCREEN sta SCREEN
lda #TYPEID_BYTE lda #TYPEID_BYTE

View File

@@ -55,62 +55,60 @@ testSignedVals::@return: scope:[testSignedVals] from testSignedVals
(void()) testSigned() (void()) testSigned()
testSigned: scope:[testSigned] from main::@2 testSigned: scope:[testSigned] from main::@2
[31] (signed byte) testSigned::sbv1 ← (signed byte) -$78 [31] *((const byte*) SCREEN+(byte)(number) $28*(number) 2) ← (byte) 0
[32] *((const byte*) SCREEN+(byte)(number) $28*(number) 2) ← (byte) 0 [32] *((const byte*) SCREEN+++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE
[33] *((const byte*) SCREEN+++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE [33] *((const byte*) SCREEN+++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE
[34] *((const byte*) SCREEN+++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE [34] *((const byte*) SCREEN+++++++(byte)(number) $28*(number) 2) ← (byte) 0
[35] *((const byte*) SCREEN+++++++(byte)(number) $28*(number) 2) ← (byte) 0 [35] *((const byte*) SCREEN+++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE
[36] *((const byte*) SCREEN+++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE [36] *((const byte*) SCREEN+++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE
[37] *((const byte*) SCREEN+++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE [37] *((const byte*) SCREEN+++++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE
[38] *((const byte*) SCREEN+++++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE [38] *((const byte*) SCREEN+++++++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE
[39] *((const byte*) SCREEN+++++++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE [39] *((const byte*) SCREEN+++++++++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE
[40] *((const byte*) SCREEN+++++++++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE [40] *((const byte*) SCREEN+++++++++++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE
[41] *((const byte*) SCREEN+++++++++++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE [41] *((const byte*) SCREEN+++++++++++++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE
[42] *((const byte*) SCREEN+++++++++++++++++++++(byte)(number) $28*(number) 2) ← (const byte) TYPEID_SIGNED_BYTE
to:testSigned::@return to:testSigned::@return
testSigned::@return: scope:[testSigned] from testSigned testSigned::@return: scope:[testSigned] from testSigned
[43] return [42] return
to:@return to:@return
(void()) testUnsignedVals() (void()) testUnsignedVals()
testUnsignedVals: scope:[testUnsignedVals] from main::@1 testUnsignedVals: scope:[testUnsignedVals] from main::@1
[44] (byte) testUnsignedVals::ubv1 ← (byte) $fa [43] (byte) testUnsignedVals::ubv1 ← (byte) $fa
[45] *((const byte*) SCREEN+(byte) $28) ← (byte) $fa [44] *((const byte*) SCREEN+(byte) $28) ← (byte) $fa
[46] *((const byte*) SCREEN+(byte) $29) ← (const byte) testUnsignedVals::ubc1 [45] *((const byte*) SCREEN+(byte) $29) ← (const byte) testUnsignedVals::ubc1
[47] *((const byte*) SCREEN+(byte) $2a) ← (byte) testUnsignedVals::ubv1 [46] *((const byte*) SCREEN+(byte) $2a) ← (byte) testUnsignedVals::ubv1
[48] *((const byte*) SCREEN+(byte) $2b) ← (byte)(number) $78+(number) $82 [47] *((const byte*) SCREEN+(byte) $2b) ← (byte)(number) $78+(number) $82
[49] *((const byte*) SCREEN+(byte) $2c) ← (const byte) testUnsignedVals::ubc1+(byte) $fa [48] *((const byte*) SCREEN+(byte) $2c) ← (const byte) testUnsignedVals::ubc1+(byte) $fa
[50] *((const byte*) SCREEN+(byte) $2d) ← (byte) $fa+(const byte) testUnsignedVals::ubc1 [49] *((const byte*) SCREEN+(byte) $2d) ← (byte) $fa+(const byte) testUnsignedVals::ubc1
[51] (byte~) testUnsignedVals::$2 ← (byte) testUnsignedVals::ubv1 + (byte) $fa [50] (byte~) testUnsignedVals::$2 ← (byte) testUnsignedVals::ubv1 + (byte) $fa
[52] *((const byte*) SCREEN+(byte) $2e) ← (byte~) testUnsignedVals::$2 [51] *((const byte*) SCREEN+(byte) $2e) ← (byte~) testUnsignedVals::$2
[53] (byte~) testUnsignedVals::$3 ← (byte) $fa + (byte) testUnsignedVals::ubv1 [52] (byte~) testUnsignedVals::$3 ← (byte) $fa + (byte) testUnsignedVals::ubv1
[54] *((const byte*) SCREEN+(byte) $2f) ← (byte~) testUnsignedVals::$3 [53] *((const byte*) SCREEN+(byte) $2f) ← (byte~) testUnsignedVals::$3
[55] (byte~) testUnsignedVals::$4 ← (byte) testUnsignedVals::ubv1 + (const byte) testUnsignedVals::ubc1 [54] (byte~) testUnsignedVals::$4 ← (byte) testUnsignedVals::ubv1 + (const byte) testUnsignedVals::ubc1
[56] *((const byte*) SCREEN+(byte) $30) ← (byte~) testUnsignedVals::$4 [55] *((const byte*) SCREEN+(byte) $30) ← (byte~) testUnsignedVals::$4
[57] (byte~) testUnsignedVals::$5 ← (const byte) testUnsignedVals::ubc1 + (byte) testUnsignedVals::ubv1 [56] (byte~) testUnsignedVals::$5 ← (const byte) testUnsignedVals::ubc1 + (byte) testUnsignedVals::ubv1
[58] *((const byte*) SCREEN+(byte) $31) ← (byte~) testUnsignedVals::$5 [57] *((const byte*) SCREEN+(byte) $31) ← (byte~) testUnsignedVals::$5
[59] (byte~) testUnsignedVals::$6 ← (byte) testUnsignedVals::ubv1 + (byte) testUnsignedVals::ubv1 [58] (byte~) testUnsignedVals::$6 ← (byte) testUnsignedVals::ubv1 + (byte) testUnsignedVals::ubv1
[60] *((const byte*) SCREEN+(byte) $32) ← (byte~) testUnsignedVals::$6 [59] *((const byte*) SCREEN+(byte) $32) ← (byte~) testUnsignedVals::$6
to:testUnsignedVals::@return to:testUnsignedVals::@return
testUnsignedVals::@return: scope:[testUnsignedVals] from testUnsignedVals testUnsignedVals::@return: scope:[testUnsignedVals] from testUnsignedVals
[61] return [60] return
to:@return to:@return
(void()) testUnsigned() (void()) testUnsigned()
testUnsigned: scope:[testUnsigned] from main testUnsigned: scope:[testUnsigned] from main
[62] (byte) testUnsigned::ubv1 ← (byte) $fa [61] *((const byte*) SCREEN) ← (byte) 0
[63] *((const byte*) SCREEN) ← (byte) 0 [62] *((const byte*) SCREEN+(byte) 1) ← (const byte) TYPEID_BYTE
[64] *((const byte*) SCREEN+(byte) 1) ← (const byte) TYPEID_BYTE [63] *((const byte*) SCREEN+(byte) 2) ← (const byte) TYPEID_BYTE
[65] *((const byte*) SCREEN+(byte) 2) ← (const byte) TYPEID_BYTE [64] *((const byte*) SCREEN+(byte) 3) ← (byte) 0
[66] *((const byte*) SCREEN+(byte) 3) ← (byte) 0 [65] *((const byte*) SCREEN+(byte) 4) ← (const byte) TYPEID_BYTE
[67] *((const byte*) SCREEN+(byte) 4) ← (const byte) TYPEID_BYTE [66] *((const byte*) SCREEN+(byte) 5) ← (const byte) TYPEID_BYTE
[68] *((const byte*) SCREEN+(byte) 5) ← (const byte) TYPEID_BYTE [67] *((const byte*) SCREEN+(byte) 6) ← (const byte) TYPEID_BYTE
[69] *((const byte*) SCREEN+(byte) 6) ← (const byte) TYPEID_BYTE [68] *((const byte*) SCREEN+(byte) 7) ← (const byte) TYPEID_BYTE
[70] *((const byte*) SCREEN+(byte) 7) ← (const byte) TYPEID_BYTE [69] *((const byte*) SCREEN+(byte) 8) ← (const byte) TYPEID_BYTE
[71] *((const byte*) SCREEN+(byte) 8) ← (const byte) TYPEID_BYTE [70] *((const byte*) SCREEN+(byte) 9) ← (const byte) TYPEID_BYTE
[72] *((const byte*) SCREEN+(byte) 9) ← (const byte) TYPEID_BYTE [71] *((const byte*) SCREEN+(byte) $a) ← (const byte) TYPEID_BYTE
[73] *((const byte*) SCREEN+(byte) $a) ← (const byte) TYPEID_BYTE
to:testUnsigned::@return to:testUnsigned::@return
testUnsigned::@return: scope:[testUnsigned] from testUnsigned testUnsigned::@return: scope:[testUnsigned] from testUnsigned
[74] return [72] return
to:@return to:@return

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,6 @@
(label) main::@return (label) main::@return
(void()) testSigned() (void()) testSigned()
(label) testSigned::@return (label) testSigned::@return
(signed byte) testSigned::sbv1 loadstore zp[1]:3 20.0
(void()) testSignedVals() (void()) testSignedVals()
(signed byte~) testSignedVals::$2 reg byte a 4.0 (signed byte~) testSignedVals::$2 reg byte a 4.0
(signed byte~) testSignedVals::$3 reg byte a 4.0 (signed byte~) testSignedVals::$3 reg byte a 4.0
@@ -25,7 +24,6 @@
(signed byte) testSignedVals::sbv1 loadstore zp[1]:2 1.0666666666666667 (signed byte) testSignedVals::sbv1 loadstore zp[1]:2 1.0666666666666667
(void()) testUnsigned() (void()) testUnsigned()
(label) testUnsigned::@return (label) testUnsigned::@return
(byte) testUnsigned::ubv1 loadstore zp[1]:5 20.0
(void()) testUnsignedVals() (void()) testUnsignedVals()
(byte~) testUnsignedVals::$2 reg byte x 4.0 (byte~) testUnsignedVals::$2 reg byte x 4.0
(byte~) testUnsignedVals::$3 reg byte x 4.0 (byte~) testUnsignedVals::$3 reg byte x 4.0
@@ -34,7 +32,7 @@
(byte~) testUnsignedVals::$6 reg byte a 4.0 (byte~) testUnsignedVals::$6 reg byte a 4.0
(label) testUnsignedVals::@return (label) testUnsignedVals::@return
(const byte) testUnsignedVals::ubc1 = (byte) $fa (const byte) testUnsignedVals::ubc1 = (byte) $fa
(byte) testUnsignedVals::ubv1 loadstore zp[1]:4 1.0666666666666667 (byte) testUnsignedVals::ubv1 loadstore zp[1]:3 1.0666666666666667
zp[1]:2 [ testSignedVals::sbv1 ] zp[1]:2 [ testSignedVals::sbv1 ]
reg byte a [ testSignedVals::$2 ] reg byte a [ testSignedVals::$2 ]
@@ -42,11 +40,9 @@ reg byte a [ testSignedVals::$3 ]
reg byte a [ testSignedVals::$4 ] reg byte a [ testSignedVals::$4 ]
reg byte a [ testSignedVals::$5 ] reg byte a [ testSignedVals::$5 ]
reg byte a [ testSignedVals::$6 ] reg byte a [ testSignedVals::$6 ]
zp[1]:3 [ testSigned::sbv1 ] zp[1]:3 [ testUnsignedVals::ubv1 ]
zp[1]:4 [ testUnsignedVals::ubv1 ]
reg byte x [ testUnsignedVals::$2 ] reg byte x [ testUnsignedVals::$2 ]
reg byte x [ testUnsignedVals::$3 ] reg byte x [ testUnsignedVals::$3 ]
reg byte a [ testUnsignedVals::$4 ] reg byte a [ testUnsignedVals::$4 ]
reg byte a [ testUnsignedVals::$5 ] reg byte a [ testUnsignedVals::$5 ]
reg byte a [ testUnsignedVals::$6 ] reg byte a [ testUnsignedVals::$6 ]
zp[1]:5 [ testUnsigned::ubv1 ]

View File

@@ -30,6 +30,11 @@ model_ssa_zp: {
rts rts
} }
model_ma_mem: { model_ma_mem: {
// A local pointer
lda #<$400
sta screen
lda #>$400
sta screen+1
lda #0 lda #0
sta i sta i
// A local counter // A local counter
@@ -50,7 +55,6 @@ model_ma_mem: {
cmp i cmp i
bne __b1 bne __b1
rts rts
// A local pointer screen: .word 0
screen: .word $400
i: .byte 0 i: .byte 0
} }

View File

@@ -39,14 +39,15 @@ model_ssa_zp::@return: scope:[model_ssa_zp] from model_ssa_zp::@1
(void()) model_ma_mem() (void()) model_ma_mem()
model_ma_mem: scope:[model_ma_mem] from main model_ma_mem: scope:[model_ma_mem] from main
[16] (byte) model_ma_mem::i ← (byte) 0 [16] (byte*) model_ma_mem::screen ← (byte*) 1024
[17] (byte) model_ma_mem::i ← (byte) 0
to:model_ma_mem::@1 to:model_ma_mem::@1
model_ma_mem::@1: scope:[model_ma_mem] from model_ma_mem model_ma_mem::@1 model_ma_mem::@1: scope:[model_ma_mem] from model_ma_mem model_ma_mem::@1
[17] *((byte*) model_ma_mem::screen) ← (byte) 'a' [18] *((byte*) model_ma_mem::screen) ← (byte) 'a'
[18] (byte*) model_ma_mem::screen ← ++ (byte*) model_ma_mem::screen [19] (byte*) model_ma_mem::screen ← ++ (byte*) model_ma_mem::screen
[19] (byte) model_ma_mem::i ← ++ (byte) model_ma_mem::i [20] (byte) model_ma_mem::i ← ++ (byte) model_ma_mem::i
[20] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 [21] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1
to:model_ma_mem::@return to:model_ma_mem::@return
model_ma_mem::@return: scope:[model_ma_mem] from model_ma_mem::@1 model_ma_mem::@return: scope:[model_ma_mem] from model_ma_mem::@1
[21] return [22] return
to:@return to:@return

View File

@@ -22,6 +22,7 @@ main::@return: scope:[main] from main::@2
(void()) model_ma_mem() (void()) model_ma_mem()
model_ma_mem: scope:[model_ma_mem] from main model_ma_mem: scope:[model_ma_mem] from main
(byte*) model_ma_mem::screen ← (byte*)(number) $400
(byte) model_ma_mem::i ← (byte) 0 (byte) model_ma_mem::i ← (byte) 0
to:model_ma_mem::@1 to:model_ma_mem::@1
model_ma_mem::@1: scope:[model_ma_mem] from model_ma_mem model_ma_mem::@1 model_ma_mem::@1: scope:[model_ma_mem] from model_ma_mem model_ma_mem::@1
@@ -73,7 +74,7 @@ SYMBOL TABLE SSA
(label) model_ma_mem::@1 (label) model_ma_mem::@1
(label) model_ma_mem::@return (label) model_ma_mem::@return
(byte) model_ma_mem::i loadstore (byte) model_ma_mem::i loadstore
(byte*) model_ma_mem::screen loadstore = (byte*)(number) $400 (byte*) model_ma_mem::screen loadstore
(void()) model_ssa_zp() (void()) model_ssa_zp()
(bool~) model_ssa_zp::$0 (bool~) model_ssa_zp::$0
(label) model_ssa_zp::@1 (label) model_ssa_zp::@1
@@ -90,16 +91,16 @@ SYMBOL TABLE SSA
Simplifying constant pointer cast (byte*) 1024 Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (byte*) 1064 Simplifying constant pointer cast (byte*) 1064
Successful SSA optimization PassNCastSimplification Successful SSA optimization PassNCastSimplification
Simple Condition (bool~) model_ma_mem::$0 [8] if((byte) model_ma_mem::i!=rangelast(0,5)) goto model_ma_mem::@1 Simple Condition (bool~) model_ma_mem::$0 [9] if((byte) model_ma_mem::i!=rangelast(0,5)) goto model_ma_mem::@1
Simple Condition (bool~) model_ssa_zp::$0 [17] if((byte) model_ssa_zp::i#1!=rangelast(0,5)) goto model_ssa_zp::@1 Simple Condition (bool~) model_ssa_zp::$0 [18] if((byte) model_ssa_zp::i#1!=rangelast(0,5)) goto model_ssa_zp::@1
Successful SSA optimization Pass2ConditionalJumpSimplification Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) model_ssa_zp::screen#0 = (byte*) 1064 Constant (const byte*) model_ssa_zp::screen#0 = (byte*) 1064
Constant (const byte) model_ssa_zp::i#0 = 0 Constant (const byte) model_ssa_zp::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [6] model_ma_mem::i ← ++ model_ma_mem::i to ++ Resolved ranged next value [7] model_ma_mem::i ← ++ model_ma_mem::i to ++
Resolved ranged comparison value [8] if(model_ma_mem::i!=rangelast(0,5)) goto model_ma_mem::@1 to (number) 6 Resolved ranged comparison value [9] if(model_ma_mem::i!=rangelast(0,5)) goto model_ma_mem::@1 to (number) 6
Resolved ranged next value [15] model_ssa_zp::i#1 ← ++ model_ssa_zp::i#2 to ++ Resolved ranged next value [16] model_ssa_zp::i#1 ← ++ model_ssa_zp::i#2 to ++
Resolved ranged comparison value [17] if(model_ssa_zp::i#1!=rangelast(0,5)) goto model_ssa_zp::@1 to (number) 6 Resolved ranged comparison value [18] if(model_ssa_zp::i#1!=rangelast(0,5)) goto model_ssa_zp::@1 to (number) 6
Adding number conversion cast (unumber) 6 in if((byte) model_ma_mem::i!=(number) 6) goto model_ma_mem::@1 Adding number conversion cast (unumber) 6 in if((byte) model_ma_mem::i!=(number) 6) goto model_ma_mem::@1
Adding number conversion cast (unumber) 6 in if((byte) model_ssa_zp::i#1!=(number) 6) goto model_ssa_zp::@1 Adding number conversion cast (unumber) 6 in if((byte) model_ssa_zp::i#1!=(number) 6) goto model_ssa_zp::@1
Successful SSA optimization PassNAddNumberTypeConversions Successful SSA optimization PassNAddNumberTypeConversions
@@ -184,16 +185,17 @@ model_ssa_zp::@return: scope:[model_ssa_zp] from model_ssa_zp::@1
(void()) model_ma_mem() (void()) model_ma_mem()
model_ma_mem: scope:[model_ma_mem] from main model_ma_mem: scope:[model_ma_mem] from main
[16] (byte) model_ma_mem::i ← (byte) 0 [16] (byte*) model_ma_mem::screen ← (byte*) 1024
[17] (byte) model_ma_mem::i ← (byte) 0
to:model_ma_mem::@1 to:model_ma_mem::@1
model_ma_mem::@1: scope:[model_ma_mem] from model_ma_mem model_ma_mem::@1 model_ma_mem::@1: scope:[model_ma_mem] from model_ma_mem model_ma_mem::@1
[17] *((byte*) model_ma_mem::screen) ← (byte) 'a' [18] *((byte*) model_ma_mem::screen) ← (byte) 'a'
[18] (byte*) model_ma_mem::screen ← ++ (byte*) model_ma_mem::screen [19] (byte*) model_ma_mem::screen ← ++ (byte*) model_ma_mem::screen
[19] (byte) model_ma_mem::i ← ++ (byte) model_ma_mem::i [20] (byte) model_ma_mem::i ← ++ (byte) model_ma_mem::i
[20] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 [21] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1
to:model_ma_mem::@return to:model_ma_mem::@return
model_ma_mem::@return: scope:[model_ma_mem] from model_ma_mem::@1 model_ma_mem::@return: scope:[model_ma_mem] from model_ma_mem::@1
[21] return [22] return
to:@return to:@return
@@ -201,7 +203,7 @@ VARIABLE REGISTER WEIGHTS
(void()) main() (void()) main()
(void()) model_ma_mem() (void()) model_ma_mem()
(byte) model_ma_mem::i loadstore 35.0 (byte) model_ma_mem::i loadstore 35.0
(byte*) model_ma_mem::screen loadstore 4.714285714285714 = (byte*) 1024 (byte*) model_ma_mem::screen loadstore 7.000000000000001
(void()) model_ssa_zp() (void()) model_ssa_zp()
(byte) model_ssa_zp::i (byte) model_ssa_zp::i
(byte) model_ssa_zp::i#1 16.5 (byte) model_ssa_zp::i#1 16.5
@@ -213,17 +215,17 @@ VARIABLE REGISTER WEIGHTS
Initial phi equivalence classes Initial phi equivalence classes
[ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ]
[ model_ssa_zp::i#2 model_ssa_zp::i#1 ] [ model_ssa_zp::i#2 model_ssa_zp::i#1 ]
Added variable model_ma_mem::i to live range equivalence class [ model_ma_mem::i ]
Added variable model_ma_mem::screen to live range equivalence class [ model_ma_mem::screen ] Added variable model_ma_mem::screen to live range equivalence class [ model_ma_mem::screen ]
Added variable model_ma_mem::i to live range equivalence class [ model_ma_mem::i ]
Complete equivalence classes Complete equivalence classes
[ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ]
[ model_ssa_zp::i#2 model_ssa_zp::i#1 ] [ model_ssa_zp::i#2 model_ssa_zp::i#1 ]
[ model_ma_mem::i ]
[ model_ma_mem::screen ] [ model_ma_mem::screen ]
[ model_ma_mem::i ]
Allocated zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] Allocated zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ]
Allocated zp[1]:4 [ model_ssa_zp::i#2 model_ssa_zp::i#1 ] Allocated zp[1]:4 [ model_ssa_zp::i#2 model_ssa_zp::i#1 ]
Allocated mem[1] [ model_ma_mem::i ]
Allocated mem[2] [ model_ma_mem::screen ] Allocated mem[2] [ model_ma_mem::screen ]
Allocated mem[1] [ model_ma_mem::i ]
INITIAL ASM INITIAL ASM
Target platform is c64basic / MOS6502X Target platform is c64basic / MOS6502X
@@ -316,14 +318,20 @@ model_ssa_zp: {
} }
// model_ma_mem // model_ma_mem
model_ma_mem: { model_ma_mem: {
// [16] (byte) model_ma_mem::i ← (byte) 0 -- vbum1=vbuc1 // [16] (byte*) model_ma_mem::screen ← (byte*) 1024 -- pbum1=pbuc1
// A local pointer
lda #<$400
sta screen
lda #>$400
sta screen+1
// [17] (byte) model_ma_mem::i ← (byte) 0 -- vbum1=vbuc1
lda #0 lda #0
sta i sta i
jmp __b1 jmp __b1
// A local counter // A local counter
// model_ma_mem::@1 // model_ma_mem::@1
__b1: __b1:
// [17] *((byte*) model_ma_mem::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1 // [18] *((byte*) model_ma_mem::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1
lda #'a' lda #'a'
ldy screen ldy screen
sty.z $fe sty.z $fe
@@ -331,24 +339,23 @@ model_ma_mem: {
sty.z $ff sty.z $ff
ldy #0 ldy #0
sta ($fe),y sta ($fe),y
// [18] (byte*) model_ma_mem::screen ← ++ (byte*) model_ma_mem::screen -- pbum1=_inc_pbum1 // [19] (byte*) model_ma_mem::screen ← ++ (byte*) model_ma_mem::screen -- pbum1=_inc_pbum1
inc screen inc screen
bne !+ bne !+
inc screen+1 inc screen+1
!: !:
// [19] (byte) model_ma_mem::i ← ++ (byte) model_ma_mem::i -- vbum1=_inc_vbum1 // [20] (byte) model_ma_mem::i ← ++ (byte) model_ma_mem::i -- vbum1=_inc_vbum1
inc i inc i
// [20] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 -- vbum1_neq_vbuc1_then_la1 // [21] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 -- vbum1_neq_vbuc1_then_la1
lda #6 lda #6
cmp i cmp i
bne __b1 bne __b1
jmp __breturn jmp __breturn
// model_ma_mem::@return // model_ma_mem::@return
__breturn: __breturn:
// [21] return // [22] return
rts rts
// A local pointer screen: .word 0
screen: .word $400
i: .byte 0 i: .byte 0
} }
// File Data // File Data
@@ -357,30 +364,32 @@ REGISTER UPLIFT POTENTIAL REGISTERS
Statement [11] *((byte*) model_ssa_zp::screen#2) ← (byte) 'b' [ model_ssa_zp::screen#2 model_ssa_zp::i#2 ] ( main:2::model_ssa_zp:7 [ model_ssa_zp::screen#2 model_ssa_zp::i#2 ] ) always clobbers reg byte a reg byte y Statement [11] *((byte*) model_ssa_zp::screen#2) ← (byte) 'b' [ model_ssa_zp::screen#2 model_ssa_zp::i#2 ] ( main:2::model_ssa_zp:7 [ model_ssa_zp::screen#2 model_ssa_zp::i#2 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp[1]:4 [ model_ssa_zp::i#2 model_ssa_zp::i#1 ] Removing always clobbered register reg byte a as potential for zp[1]:4 [ model_ssa_zp::i#2 model_ssa_zp::i#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:4 [ model_ssa_zp::i#2 model_ssa_zp::i#1 ] Removing always clobbered register reg byte y as potential for zp[1]:4 [ model_ssa_zp::i#2 model_ssa_zp::i#1 ]
Statement [16] (byte) model_ma_mem::i ← (byte) 0 [ model_ma_mem::screen ] ( main:2::model_ma_mem:5 [ model_ma_mem::screen ] ) always clobbers reg byte a Statement [16] (byte*) model_ma_mem::screen ← (byte*) 1024 [ model_ma_mem::screen ] ( main:2::model_ma_mem:5 [ model_ma_mem::screen ] ) always clobbers reg byte a
Statement [17] *((byte*) model_ma_mem::screen) ← (byte) 'a' [ ] ( main:2::model_ma_mem:5 [ ] ) always clobbers reg byte a reg byte y Statement [17] (byte) model_ma_mem::i ← (byte) 0 [ model_ma_mem::screen ] ( main:2::model_ma_mem:5 [ model_ma_mem::screen ] ) always clobbers reg byte a
Statement [20] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 [ model_ma_mem::screen ] ( main:2::model_ma_mem:5 [ model_ma_mem::screen ] ) always clobbers reg byte a Statement [18] *((byte*) model_ma_mem::screen) ← (byte) 'a' [ ] ( main:2::model_ma_mem:5 [ ] ) always clobbers reg byte a reg byte y
Statement [21] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 [ model_ma_mem::screen ] ( main:2::model_ma_mem:5 [ model_ma_mem::screen ] ) always clobbers reg byte a
Statement [11] *((byte*) model_ssa_zp::screen#2) ← (byte) 'b' [ model_ssa_zp::screen#2 model_ssa_zp::i#2 ] ( main:2::model_ssa_zp:7 [ model_ssa_zp::screen#2 model_ssa_zp::i#2 ] ) always clobbers reg byte a reg byte y Statement [11] *((byte*) model_ssa_zp::screen#2) ← (byte) 'b' [ model_ssa_zp::screen#2 model_ssa_zp::i#2 ] ( main:2::model_ssa_zp:7 [ model_ssa_zp::screen#2 model_ssa_zp::i#2 ] ) always clobbers reg byte a reg byte y
Statement [16] (byte) model_ma_mem::i ← (byte) 0 [ model_ma_mem::screen ] ( main:2::model_ma_mem:5 [ model_ma_mem::screen ] ) always clobbers reg byte a Statement [16] (byte*) model_ma_mem::screen ← (byte*) 1024 [ model_ma_mem::screen ] ( main:2::model_ma_mem:5 [ model_ma_mem::screen ] ) always clobbers reg byte a
Statement [17] *((byte*) model_ma_mem::screen) ← (byte) 'a' [ ] ( main:2::model_ma_mem:5 [ ] ) always clobbers reg byte a reg byte y Statement [17] (byte) model_ma_mem::i ← (byte) 0 [ model_ma_mem::screen ] ( main:2::model_ma_mem:5 [ model_ma_mem::screen ] ) always clobbers reg byte a
Statement [20] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 [ model_ma_mem::screen ] ( main:2::model_ma_mem:5 [ model_ma_mem::screen ] ) always clobbers reg byte a Statement [18] *((byte*) model_ma_mem::screen) ← (byte) 'a' [ ] ( main:2::model_ma_mem:5 [ ] ) always clobbers reg byte a reg byte y
Statement [21] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 [ model_ma_mem::screen ] ( main:2::model_ma_mem:5 [ model_ma_mem::screen ] ) always clobbers reg byte a
Potential registers zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] : zp[2]:2 , Potential registers zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] : zp[2]:2 ,
Potential registers zp[1]:4 [ model_ssa_zp::i#2 model_ssa_zp::i#1 ] : zp[1]:4 , reg byte x , Potential registers zp[1]:4 [ model_ssa_zp::i#2 model_ssa_zp::i#1 ] : zp[1]:4 , reg byte x ,
Potential registers mem[1] [ model_ma_mem::i ] : mem[1] ,
Potential registers mem[2] [ model_ma_mem::screen ] : mem[2] , Potential registers mem[2] [ model_ma_mem::screen ] : mem[2] ,
Potential registers mem[1] [ model_ma_mem::i ] : mem[1] ,
REGISTER UPLIFT SCOPES REGISTER UPLIFT SCOPES
Uplift Scope [model_ssa_zp] 23.83: zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] 23.83: zp[1]:4 [ model_ssa_zp::i#2 model_ssa_zp::i#1 ] Uplift Scope [model_ssa_zp] 23.83: zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] 23.83: zp[1]:4 [ model_ssa_zp::i#2 model_ssa_zp::i#1 ]
Uplift Scope [model_ma_mem] 35: mem[1] [ model_ma_mem::i ] 4.71: mem[2] [ model_ma_mem::screen ] Uplift Scope [model_ma_mem] 35: mem[1] [ model_ma_mem::i ] 7: mem[2] [ model_ma_mem::screen ]
Uplift Scope [main] Uplift Scope [main]
Uplift Scope [] Uplift Scope []
Uplifting [model_ssa_zp] best 1117 combination zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] reg byte x [ model_ssa_zp::i#2 model_ssa_zp::i#1 ] Uplifting [model_ssa_zp] best 1129 combination zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] reg byte x [ model_ssa_zp::i#2 model_ssa_zp::i#1 ]
Uplifting [model_ma_mem] best 1117 combination mem[1] [ model_ma_mem::i ] mem[2] [ model_ma_mem::screen ] Uplifting [model_ma_mem] best 1129 combination mem[1] [ model_ma_mem::i ] mem[2] [ model_ma_mem::screen ]
Uplifting [main] best 1117 combination Uplifting [main] best 1129 combination
Uplifting [] best 1117 combination Uplifting [] best 1129 combination
Attempting to uplift remaining variables inmem[1] [ model_ma_mem::i ] Attempting to uplift remaining variables inmem[1] [ model_ma_mem::i ]
Uplifting [model_ma_mem] best 1117 combination mem[1] [ model_ma_mem::i ] Uplifting [model_ma_mem] best 1129 combination mem[1] [ model_ma_mem::i ]
ASSEMBLER BEFORE OPTIMIZATION ASSEMBLER BEFORE OPTIMIZATION
// File Comments // File Comments
@@ -469,14 +478,20 @@ model_ssa_zp: {
} }
// model_ma_mem // model_ma_mem
model_ma_mem: { model_ma_mem: {
// [16] (byte) model_ma_mem::i ← (byte) 0 -- vbum1=vbuc1 // [16] (byte*) model_ma_mem::screen ← (byte*) 1024 -- pbum1=pbuc1
// A local pointer
lda #<$400
sta screen
lda #>$400
sta screen+1
// [17] (byte) model_ma_mem::i ← (byte) 0 -- vbum1=vbuc1
lda #0 lda #0
sta i sta i
jmp __b1 jmp __b1
// A local counter // A local counter
// model_ma_mem::@1 // model_ma_mem::@1
__b1: __b1:
// [17] *((byte*) model_ma_mem::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1 // [18] *((byte*) model_ma_mem::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1
lda #'a' lda #'a'
ldy screen ldy screen
sty.z $fe sty.z $fe
@@ -484,24 +499,23 @@ model_ma_mem: {
sty.z $ff sty.z $ff
ldy #0 ldy #0
sta ($fe),y sta ($fe),y
// [18] (byte*) model_ma_mem::screen ← ++ (byte*) model_ma_mem::screen -- pbum1=_inc_pbum1 // [19] (byte*) model_ma_mem::screen ← ++ (byte*) model_ma_mem::screen -- pbum1=_inc_pbum1
inc screen inc screen
bne !+ bne !+
inc screen+1 inc screen+1
!: !:
// [19] (byte) model_ma_mem::i ← ++ (byte) model_ma_mem::i -- vbum1=_inc_vbum1 // [20] (byte) model_ma_mem::i ← ++ (byte) model_ma_mem::i -- vbum1=_inc_vbum1
inc i inc i
// [20] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 -- vbum1_neq_vbuc1_then_la1 // [21] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 -- vbum1_neq_vbuc1_then_la1
lda #6 lda #6
cmp i cmp i
bne __b1 bne __b1
jmp __breturn jmp __breturn
// model_ma_mem::@return // model_ma_mem::@return
__breturn: __breturn:
// [21] return // [22] return
rts rts
// A local pointer screen: .word 0
screen: .word $400
i: .byte 0 i: .byte 0
} }
// File Data // File Data
@@ -552,7 +566,7 @@ FINAL SYMBOL TABLE
(label) model_ma_mem::@1 (label) model_ma_mem::@1
(label) model_ma_mem::@return (label) model_ma_mem::@return
(byte) model_ma_mem::i loadstore mem[1] 35.0 (byte) model_ma_mem::i loadstore mem[1] 35.0
(byte*) model_ma_mem::screen loadstore mem[2] 4.714285714285714 = (byte*) 1024 (byte*) model_ma_mem::screen loadstore mem[2] 7.000000000000001
(void()) model_ssa_zp() (void()) model_ssa_zp()
(label) model_ssa_zp::@1 (label) model_ssa_zp::@1
(label) model_ssa_zp::@return (label) model_ssa_zp::@return
@@ -565,12 +579,12 @@ FINAL SYMBOL TABLE
zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ]
reg byte x [ model_ssa_zp::i#2 model_ssa_zp::i#1 ] reg byte x [ model_ssa_zp::i#2 model_ssa_zp::i#1 ]
mem[1] [ model_ma_mem::i ]
mem[2] [ model_ma_mem::screen ] mem[2] [ model_ma_mem::screen ]
mem[1] [ model_ma_mem::i ]
FINAL ASSEMBLER FINAL ASSEMBLER
Score: 976 Score: 988
// File Comments // File Comments
// Test two different memory models // Test two different memory models
@@ -644,15 +658,22 @@ model_ssa_zp: {
} }
// model_ma_mem // model_ma_mem
model_ma_mem: { model_ma_mem: {
// screen = 0x0400
// [16] (byte*) model_ma_mem::screen ← (byte*) 1024 -- pbum1=pbuc1
// A local pointer
lda #<$400
sta screen
lda #>$400
sta screen+1
// for( char i: 0..5 ) // for( char i: 0..5 )
// [16] (byte) model_ma_mem::i ← (byte) 0 -- vbum1=vbuc1 // [17] (byte) model_ma_mem::i ← (byte) 0 -- vbum1=vbuc1
lda #0 lda #0
sta i sta i
// A local counter // A local counter
// model_ma_mem::@1 // model_ma_mem::@1
__b1: __b1:
// *(screen++) = 'a' // *(screen++) = 'a'
// [17] *((byte*) model_ma_mem::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1 // [18] *((byte*) model_ma_mem::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1
lda #'a' lda #'a'
ldy screen ldy screen
sty.z $fe sty.z $fe
@@ -661,24 +682,23 @@ model_ma_mem: {
ldy #0 ldy #0
sta ($fe),y sta ($fe),y
// *(screen++) = 'a'; // *(screen++) = 'a';
// [18] (byte*) model_ma_mem::screen ← ++ (byte*) model_ma_mem::screen -- pbum1=_inc_pbum1 // [19] (byte*) model_ma_mem::screen ← ++ (byte*) model_ma_mem::screen -- pbum1=_inc_pbum1
inc screen inc screen
bne !+ bne !+
inc screen+1 inc screen+1
!: !:
// for( char i: 0..5 ) // for( char i: 0..5 )
// [19] (byte) model_ma_mem::i ← ++ (byte) model_ma_mem::i -- vbum1=_inc_vbum1 // [20] (byte) model_ma_mem::i ← ++ (byte) model_ma_mem::i -- vbum1=_inc_vbum1
inc i inc i
// [20] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 -- vbum1_neq_vbuc1_then_la1 // [21] if((byte) model_ma_mem::i!=(byte) 6) goto model_ma_mem::@1 -- vbum1_neq_vbuc1_then_la1
lda #6 lda #6
cmp i cmp i
bne __b1 bne __b1
// model_ma_mem::@return // model_ma_mem::@return
// } // }
// [21] return // [22] return
rts rts
// A local pointer screen: .word 0
screen: .word $400
i: .byte 0 i: .byte 0
} }
// File Data // File Data

View File

@@ -8,7 +8,7 @@
(label) model_ma_mem::@1 (label) model_ma_mem::@1
(label) model_ma_mem::@return (label) model_ma_mem::@return
(byte) model_ma_mem::i loadstore mem[1] 35.0 (byte) model_ma_mem::i loadstore mem[1] 35.0
(byte*) model_ma_mem::screen loadstore mem[2] 4.714285714285714 = (byte*) 1024 (byte*) model_ma_mem::screen loadstore mem[2] 7.000000000000001
(void()) model_ssa_zp() (void()) model_ssa_zp()
(label) model_ssa_zp::@1 (label) model_ssa_zp::@1
(label) model_ssa_zp::@return (label) model_ssa_zp::@return
@@ -21,5 +21,5 @@
zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ] zp[2]:2 [ model_ssa_zp::screen#2 model_ssa_zp::screen#1 ]
reg byte x [ model_ssa_zp::i#2 model_ssa_zp::i#1 ] reg byte x [ model_ssa_zp::i#2 model_ssa_zp::i#1 ]
mem[1] [ model_ma_mem::i ]
mem[2] [ model_ma_mem::screen ] mem[2] [ model_ma_mem::screen ]
mem[1] [ model_ma_mem::i ]

View File

@@ -3,6 +3,11 @@
:BasicUpstart(main) :BasicUpstart(main)
.pc = $80d "Program" .pc = $80d "Program"
main: { main: {
// A local pointer
lda #<$400
sta screen
lda #>$400
sta screen+1
lda #0 lda #0
sta i sta i
// A local counter // A local counter
@@ -23,7 +28,6 @@ main: {
cmp i cmp i
bne __b1 bne __b1
rts rts
// A local pointer screen: .word 0
screen: .word $400
i: .byte 0 i: .byte 0
} }

View File

@@ -10,14 +10,15 @@
(void()) main() (void()) main()
main: scope:[main] from @1 main: scope:[main] from @1
[4] (byte) main::i ← (byte) 0 [4] (byte*) main::screen ← (byte*) 1024
[5] (byte) main::i ← (byte) 0
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@1 main::@1: scope:[main] from main main::@1
[5] *((byte*) main::screen) ← (byte) 'a' [6] *((byte*) main::screen) ← (byte) 'a'
[6] (byte*) main::screen ← ++ (byte*) main::screen [7] (byte*) main::screen ← ++ (byte*) main::screen
[7] (byte) main::i ← ++ (byte) main::i [8] (byte) main::i ← ++ (byte) main::i
[8] if((byte) main::i!=(byte) 6) goto main::@1 [9] if((byte) main::i!=(byte) 6) goto main::@1
to:main::@return to:main::@return
main::@return: scope:[main] from main::@1 main::@return: scope:[main] from main::@1
[9] return [10] return
to:@return to:@return

View File

@@ -6,6 +6,7 @@ CONTROL FLOW GRAPH SSA
(void()) main() (void()) main()
main: scope:[main] from @1 main: scope:[main] from @1
(byte*) main::screen ← (byte*)(number) $400
(byte) main::i ← (byte) 0 (byte) main::i ← (byte) 0
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@1 main::@1: scope:[main] from main main::@1
@@ -35,14 +36,14 @@ SYMBOL TABLE SSA
(label) main::@1 (label) main::@1
(label) main::@return (label) main::@return
(byte) main::i loadstore (byte) main::i loadstore
(byte*) main::screen loadstore = (byte*)(number) $400 (byte*) main::screen loadstore
Simplifying constant pointer cast (byte*) 1024 Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification Successful SSA optimization PassNCastSimplification
Simple Condition (bool~) main::$0 [5] if((byte) main::i!=rangelast(0,5)) goto main::@1 Simple Condition (bool~) main::$0 [6] if((byte) main::i!=rangelast(0,5)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification Successful SSA optimization Pass2ConditionalJumpSimplification
Resolved ranged next value [3] main::i ← ++ main::i to ++ Resolved ranged next value [4] main::i ← ++ main::i to ++
Resolved ranged comparison value [5] if(main::i!=rangelast(0,5)) goto main::@1 to (number) 6 Resolved ranged comparison value [6] if(main::i!=rangelast(0,5)) goto main::@1 to (number) 6
Adding number conversion cast (unumber) 6 in if((byte) main::i!=(number) 6) goto main::@1 Adding number conversion cast (unumber) 6 in if((byte) main::i!=(number) 6) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 6 Simplifying constant integer cast 6
@@ -76,32 +77,33 @@ FINAL CONTROL FLOW GRAPH
(void()) main() (void()) main()
main: scope:[main] from @1 main: scope:[main] from @1
[4] (byte) main::i ← (byte) 0 [4] (byte*) main::screen ← (byte*) 1024
[5] (byte) main::i ← (byte) 0
to:main::@1 to:main::@1
main::@1: scope:[main] from main main::@1 main::@1: scope:[main] from main main::@1
[5] *((byte*) main::screen) ← (byte) 'a' [6] *((byte*) main::screen) ← (byte) 'a'
[6] (byte*) main::screen ← ++ (byte*) main::screen [7] (byte*) main::screen ← ++ (byte*) main::screen
[7] (byte) main::i ← ++ (byte) main::i [8] (byte) main::i ← ++ (byte) main::i
[8] if((byte) main::i!=(byte) 6) goto main::@1 [9] if((byte) main::i!=(byte) 6) goto main::@1
to:main::@return to:main::@return
main::@return: scope:[main] from main::@1 main::@return: scope:[main] from main::@1
[9] return [10] return
to:@return to:@return
VARIABLE REGISTER WEIGHTS VARIABLE REGISTER WEIGHTS
(void()) main() (void()) main()
(byte) main::i loadstore 35.0 (byte) main::i loadstore 35.0
(byte*) main::screen loadstore 5.5 = (byte*) 1024 (byte*) main::screen loadstore 7.000000000000001
Initial phi equivalence classes Initial phi equivalence classes
Added variable main::i to live range equivalence class [ main::i ]
Added variable main::screen to live range equivalence class [ main::screen ] Added variable main::screen to live range equivalence class [ main::screen ]
Added variable main::i to live range equivalence class [ main::i ]
Complete equivalence classes Complete equivalence classes
[ main::i ]
[ main::screen ] [ main::screen ]
Allocated mem[1] [ main::i ] [ main::i ]
Allocated mem[2] [ main::screen ] Allocated mem[2] [ main::screen ]
Allocated mem[1] [ main::i ]
INITIAL ASM INITIAL ASM
Target platform is c64basic / MOS6502X Target platform is c64basic / MOS6502X
@@ -128,14 +130,20 @@ __bend_from___b1:
__bend: __bend:
// main // main
main: { main: {
// [4] (byte) main::i ← (byte) 0 -- vbum1=vbuc1 // [4] (byte*) main::screen ← (byte*) 1024 -- pbum1=pbuc1
// A local pointer
lda #<$400
sta screen
lda #>$400
sta screen+1
// [5] (byte) main::i ← (byte) 0 -- vbum1=vbuc1
lda #0 lda #0
sta i sta i
jmp __b1 jmp __b1
// A local counter // A local counter
// main::@1 // main::@1
__b1: __b1:
// [5] *((byte*) main::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1 // [6] *((byte*) main::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1
lda #'a' lda #'a'
ldy screen ldy screen
sty.z $fe sty.z $fe
@@ -143,43 +151,43 @@ main: {
sty.z $ff sty.z $ff
ldy #0 ldy #0
sta ($fe),y sta ($fe),y
// [6] (byte*) main::screen ← ++ (byte*) main::screen -- pbum1=_inc_pbum1 // [7] (byte*) main::screen ← ++ (byte*) main::screen -- pbum1=_inc_pbum1
inc screen inc screen
bne !+ bne !+
inc screen+1 inc screen+1
!: !:
// [7] (byte) main::i ← ++ (byte) main::i -- vbum1=_inc_vbum1 // [8] (byte) main::i ← ++ (byte) main::i -- vbum1=_inc_vbum1
inc i inc i
// [8] if((byte) main::i!=(byte) 6) goto main::@1 -- vbum1_neq_vbuc1_then_la1 // [9] if((byte) main::i!=(byte) 6) goto main::@1 -- vbum1_neq_vbuc1_then_la1
lda #6 lda #6
cmp i cmp i
bne __b1 bne __b1
jmp __breturn jmp __breturn
// main::@return // main::@return
__breturn: __breturn:
// [9] return // [10] return
rts rts
// A local pointer screen: .word 0
screen: .word $400
i: .byte 0 i: .byte 0
} }
// File Data // File Data
REGISTER UPLIFT POTENTIAL REGISTERS REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::i ← (byte) 0 [ main::screen ] ( main:2 [ main::screen ] ) always clobbers reg byte a Statement [4] (byte*) main::screen ← (byte*) 1024 [ main::screen ] ( main:2 [ main::screen ] ) always clobbers reg byte a
Statement [5] *((byte*) main::screen) ← (byte) 'a' [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y Statement [5] (byte) main::i ← (byte) 0 [ main::screen ] ( main:2 [ main::screen ] ) always clobbers reg byte a
Statement [8] if((byte) main::i!=(byte) 6) goto main::@1 [ main::screen ] ( main:2 [ main::screen ] ) always clobbers reg byte a Statement [6] *((byte*) main::screen) ← (byte) 'a' [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y
Potential registers mem[1] [ main::i ] : mem[1] , Statement [9] if((byte) main::i!=(byte) 6) goto main::@1 [ main::screen ] ( main:2 [ main::screen ] ) always clobbers reg byte a
Potential registers mem[2] [ main::screen ] : mem[2] , Potential registers mem[2] [ main::screen ] : mem[2] ,
Potential registers mem[1] [ main::i ] : mem[1] ,
REGISTER UPLIFT SCOPES REGISTER UPLIFT SCOPES
Uplift Scope [main] 35: mem[1] [ main::i ] 5.5: mem[2] [ main::screen ] Uplift Scope [main] 35: mem[1] [ main::i ] 7: mem[2] [ main::screen ]
Uplift Scope [] Uplift Scope []
Uplifting [main] best 587 combination mem[1] [ main::i ] mem[2] [ main::screen ] Uplifting [main] best 599 combination mem[1] [ main::i ] mem[2] [ main::screen ]
Uplifting [] best 587 combination Uplifting [] best 599 combination
Attempting to uplift remaining variables inmem[1] [ main::i ] Attempting to uplift remaining variables inmem[1] [ main::i ]
Uplifting [main] best 587 combination mem[1] [ main::i ] Uplifting [main] best 599 combination mem[1] [ main::i ]
ASSEMBLER BEFORE OPTIMIZATION ASSEMBLER BEFORE OPTIMIZATION
// File Comments // File Comments
@@ -205,14 +213,20 @@ __bend_from___b1:
__bend: __bend:
// main // main
main: { main: {
// [4] (byte) main::i ← (byte) 0 -- vbum1=vbuc1 // [4] (byte*) main::screen ← (byte*) 1024 -- pbum1=pbuc1
// A local pointer
lda #<$400
sta screen
lda #>$400
sta screen+1
// [5] (byte) main::i ← (byte) 0 -- vbum1=vbuc1
lda #0 lda #0
sta i sta i
jmp __b1 jmp __b1
// A local counter // A local counter
// main::@1 // main::@1
__b1: __b1:
// [5] *((byte*) main::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1 // [6] *((byte*) main::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1
lda #'a' lda #'a'
ldy screen ldy screen
sty.z $fe sty.z $fe
@@ -220,24 +234,23 @@ main: {
sty.z $ff sty.z $ff
ldy #0 ldy #0
sta ($fe),y sta ($fe),y
// [6] (byte*) main::screen ← ++ (byte*) main::screen -- pbum1=_inc_pbum1 // [7] (byte*) main::screen ← ++ (byte*) main::screen -- pbum1=_inc_pbum1
inc screen inc screen
bne !+ bne !+
inc screen+1 inc screen+1
!: !:
// [7] (byte) main::i ← ++ (byte) main::i -- vbum1=_inc_vbum1 // [8] (byte) main::i ← ++ (byte) main::i -- vbum1=_inc_vbum1
inc i inc i
// [8] if((byte) main::i!=(byte) 6) goto main::@1 -- vbum1_neq_vbuc1_then_la1 // [9] if((byte) main::i!=(byte) 6) goto main::@1 -- vbum1_neq_vbuc1_then_la1
lda #6 lda #6
cmp i cmp i
bne __b1 bne __b1
jmp __breturn jmp __breturn
// main::@return // main::@return
__breturn: __breturn:
// [9] return // [10] return
rts rts
// A local pointer screen: .word 0
screen: .word $400
i: .byte 0 i: .byte 0
} }
// File Data // File Data
@@ -270,14 +283,14 @@ FINAL SYMBOL TABLE
(label) main::@1 (label) main::@1
(label) main::@return (label) main::@return
(byte) main::i loadstore mem[1] 35.0 (byte) main::i loadstore mem[1] 35.0
(byte*) main::screen loadstore mem[2] 5.5 = (byte*) 1024 (byte*) main::screen loadstore mem[2] 7.000000000000001
mem[1] [ main::i ]
mem[2] [ main::screen ] mem[2] [ main::screen ]
mem[1] [ main::i ]
FINAL ASSEMBLER FINAL ASSEMBLER
Score: 542 Score: 554
// File Comments // File Comments
// Test memory model multiple-assignment/main memory for all variables (here local variables) // Test memory model multiple-assignment/main memory for all variables (here local variables)
@@ -294,15 +307,22 @@ Score: 542
// @end // @end
// main // main
main: { main: {
// screen = 0x0400
// [4] (byte*) main::screen ← (byte*) 1024 -- pbum1=pbuc1
// A local pointer
lda #<$400
sta screen
lda #>$400
sta screen+1
// for( char i: 0..5 ) // for( char i: 0..5 )
// [4] (byte) main::i ← (byte) 0 -- vbum1=vbuc1 // [5] (byte) main::i ← (byte) 0 -- vbum1=vbuc1
lda #0 lda #0
sta i sta i
// A local counter // A local counter
// main::@1 // main::@1
__b1: __b1:
// *(screen++) = 'a' // *(screen++) = 'a'
// [5] *((byte*) main::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1 // [6] *((byte*) main::screen) ← (byte) 'a' -- _deref_pbum1=vbuc1
lda #'a' lda #'a'
ldy screen ldy screen
sty.z $fe sty.z $fe
@@ -311,24 +331,23 @@ main: {
ldy #0 ldy #0
sta ($fe),y sta ($fe),y
// *(screen++) = 'a'; // *(screen++) = 'a';
// [6] (byte*) main::screen ← ++ (byte*) main::screen -- pbum1=_inc_pbum1 // [7] (byte*) main::screen ← ++ (byte*) main::screen -- pbum1=_inc_pbum1
inc screen inc screen
bne !+ bne !+
inc screen+1 inc screen+1
!: !:
// for( char i: 0..5 ) // for( char i: 0..5 )
// [7] (byte) main::i ← ++ (byte) main::i -- vbum1=_inc_vbum1 // [8] (byte) main::i ← ++ (byte) main::i -- vbum1=_inc_vbum1
inc i inc i
// [8] if((byte) main::i!=(byte) 6) goto main::@1 -- vbum1_neq_vbuc1_then_la1 // [9] if((byte) main::i!=(byte) 6) goto main::@1 -- vbum1_neq_vbuc1_then_la1
lda #6 lda #6
cmp i cmp i
bne __b1 bne __b1
// main::@return // main::@return
// } // }
// [9] return // [10] return
rts rts
// A local pointer screen: .word 0
screen: .word $400
i: .byte 0 i: .byte 0
} }
// File Data // File Data

View File

@@ -5,7 +5,7 @@
(label) main::@1 (label) main::@1
(label) main::@return (label) main::@return
(byte) main::i loadstore mem[1] 35.0 (byte) main::i loadstore mem[1] 35.0
(byte*) main::screen loadstore mem[2] 5.5 = (byte*) 1024 (byte*) main::screen loadstore mem[2] 7.000000000000001
mem[1] [ main::i ]
mem[2] [ main::screen ] mem[2] [ main::screen ]
mem[1] [ main::i ]