1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-26 12:49:21 +00:00

Added proper clobber check to call prepare sub-statements. Fixed stack clean-up after stack call return.

This commit is contained in:
jespergravgaard 2020-03-01 16:00:42 +01:00
parent 4346790c43
commit 648d08a13d
10 changed files with 101 additions and 127 deletions

View File

@ -0,0 +1,16 @@
lda {m1}+3
cmp {m2}+3
bcc {la1}
bne !+
lda {m1}+2
cmp {m2}+2
bcc {la1}
bne !+
lda {m1}+1
cmp {m2}+1
bcc {la1}
bne !+
lda {m1}
cmp {m2}
bcc {la1}
!:

View File

@ -42,11 +42,13 @@ public class AsmChunk {
*/
private String fragment;
/** If the chunk represents a PHI transition (See. {@link PhiTransitions}) this contains the transition ID. */
private String phiTransitionId;
/** If the chunk is part of a complex statement this is the sub-ID used for identifying the part of the statement represented.
* For PHI transitions (See. {@link PhiTransitions}) this contains the transition ID. For call prepare this holds the parameter. */
private String subStatementId;
/** If the chunk is an assignment in a PHI transition this contains the index of the assignment within the transition. */
private Integer phiTransitionAssignmentIdx;
/** If the chunk is part of a complex statement this is the sub index used for identifying the part of the statement represented.
* For PHI transitions this contains the index of the assignment within the transition. For call prepares this is the index of the parameter. */
private Integer subStatementIdx;
/** The full name of the containing scope (procedure). */
private String scopeLabel;
@ -112,20 +114,20 @@ public class AsmChunk {
this.fragment = fragment;
}
public String getPhiTransitionId() {
return phiTransitionId;
public String getSubStatementId() {
return subStatementId;
}
public void setPhiTransitionId(String phiTransitionId) {
this.phiTransitionId = phiTransitionId;
public void setSubStatementId(String subStatementId) {
this.subStatementId = subStatementId;
}
public Integer getPhiTransitionAssignmentIdx() {
return phiTransitionAssignmentIdx;
public Integer getSubStatementIdx() {
return subStatementIdx;
}
public void setPhiTransitionAssignmentIdx(Integer phiTransitionAssignmentIdx) {
this.phiTransitionAssignmentIdx = phiTransitionAssignmentIdx;
public void setSubStatementIdx(Integer subStatementIdx) {
this.subStatementIdx = subStatementIdx;
}
public String getScopeLabel() {
@ -252,10 +254,10 @@ public class AsmChunk {
if(source != null) {
out.append(" ").append(source.replace('\r', ' ').replace('\n', ' '));
}
if(phiTransitionId != null) {
out.append(" [").append(phiTransitionId);
if(phiTransitionAssignmentIdx != null) {
out.append("#").append(phiTransitionAssignmentIdx);
if(subStatementId != null) {
out.append(" [").append(subStatementId);
if(subStatementIdx != null) {
out.append("#").append(subStatementIdx);
}
out.append("]");
}

View File

@ -5,6 +5,8 @@ import dk.camelot64.kickc.asm.AsmClobber;
import dk.camelot64.kickc.asm.AsmProgram;
import dk.camelot64.kickc.model.*;
import dk.camelot64.kickc.model.statements.Statement;
import dk.camelot64.kickc.model.statements.StatementCallPrepare;
import dk.camelot64.kickc.model.statements.StatementPhiBlock;
import dk.camelot64.kickc.model.symbols.Variable;
import dk.camelot64.kickc.model.values.LabelRef;
import dk.camelot64.kickc.model.values.RValue;
@ -73,10 +75,11 @@ public class Pass4AssertNoCpuClobber extends Pass2Base {
// Find alive variables
List<VariableRef> aliveVars = new ArrayList<>(getProgram().getLiveRangeVariablesEffective().getAliveEffective(statement));
// If the chunk is an assignment in a phi transition, examine the later phi transition assignments and update alive variables alive and variables assigned
if(asmChunk.getPhiTransitionId() != null && asmChunk.getPhiTransitionAssignmentIdx() != null) {
String phiTransitionId = asmChunk.getPhiTransitionId();
int transitionAssignmentIdx = asmChunk.getPhiTransitionAssignmentIdx();
if(statement instanceof StatementPhiBlock && asmChunk.getSubStatementId() != null && asmChunk.getSubStatementIdx() != null) {
String phiTransitionId = asmChunk.getSubStatementId();
int transitionAssignmentIdx = asmChunk.getSubStatementIdx();
ControlFlowBlock statementBlock = getProgram().getStatementInfos().getBlock(statementIdx);
Map<LabelRef, PhiTransitions> programPhiTransitions = getProgram().getPhiTransitions();
PhiTransitions phiTransitions = programPhiTransitions.get(statementBlock.getLabel());
@ -98,6 +101,21 @@ public class Pass4AssertNoCpuClobber extends Pass2Base {
}
}
// If the chunk is an call parameter prepare, examine the later call parameter prepares and update alive variables
if(statement instanceof StatementCallPrepare && asmChunk.getSubStatementId() != null && asmChunk.getSubStatementIdx() != null) {
int transitionAssignmentIdx = asmChunk.getSubStatementIdx();
final StatementCallPrepare callPrepare = (StatementCallPrepare) statement;
final int numParameters = callPrepare.getNumParameters();
for(int idx = 0; idx < numParameters; idx++) {
final RValue parameter = callPrepare.getParameter(idx);
if(idx > transitionAssignmentIdx) {
// If the parameter prepare is later than the current one
Collection<VariableRef> alive = VariableReferenceInfos.getReferencedVars(parameter);
aliveVars.addAll(alive);
}
}
}
// Non-assigned alive variables must not be clobbered
for(VariableRef aliveVar : aliveVars) {
Variable variable = getProgram().getSymbolInfos().getVariable(aliveVar);
@ -115,7 +133,7 @@ public class Pass4AssertNoCpuClobber extends Pass2Base {
if(verbose) {
throw new CompileError(
"Error! Generated ASM has register clobber problem. " +
"Alive variable "+aliveVar + " register " + aliveVarRegister + " clobbered by the ASM generated by statement "+statement.toString(getProgram(), true),
"Alive variable " + aliveVar + " register " + aliveVarRegister + " clobbered by the ASM generated by statement " + statement.toString(getProgram(), true),
statement.getSource()
);
}

View File

@ -280,7 +280,7 @@ public class Pass4CodeGeneration {
signature.append("zp(").append(AsmFormat.getAsmNumber(registerZp.getZp())).append(")");
} else if(allocation instanceof Registers.RegisterMainMem) {
Registers.RegisterMainMem registerMainMem = (Registers.RegisterMainMem) allocation;
signature.append("mem(").append(registerMainMem.getAddress()==null?"":AsmFormat.getAsmNumber(registerMainMem.getAddress())).append(")");
signature.append("mem(").append(registerMainMem.getAddress() == null ? "" : AsmFormat.getAsmNumber(registerMainMem.getAddress())).append(")");
} else if(allocation instanceof Registers.RegisterAByte) {
signature.append("register(A)");
} else if(allocation instanceof Registers.RegisterXByte) {
@ -850,26 +850,29 @@ public class Pass4CodeGeneration {
List<RValue> callParameters = call.getParameters();
List<Variable> procParameters = procedure.getParameters();
for(int i = 0; i < procParameters.size(); i++) {
if(i > 0)
asm.startChunk(block.getScope(), statement.getIndex(), statement.toString(program, verboseAliveInfo));
Variable procParameter = procParameters.get(i);
RValue callParameter = callParameters.get(i);
SymbolType parameterType = procParameter.getType();
AsmFragmentInstanceSpecFactory asmFragmentInstanceSpecFactory = new AsmFragmentInstanceSpecFactory(new StackPushValue(parameterType), callParameter, program, block.getScope());
asm.startChunk(block.getScope(), statement.getIndex(), statement.toString(program, verboseAliveInfo));
ensureEncoding(asm, asmFragmentInstanceSpecFactory);
generateAsm(asm, asmFragmentInstanceSpecFactory.getAsmFragmentInstanceSpec());
asm.getCurrentChunk().setSubStatementIdx(i);
asm.getCurrentChunk().setSubStatementId(procParameter.toString(program));
}
// Push additional bytes if needed
long stackFrameByteSize = CallingConventionStack.getStackFrameByteSize(procedure);
long parametersByteSize = CallingConventionStack.getParametersByteSize(procedure);
if(stackFrameByteSize > parametersByteSize) {
if(procParameters.size() > 0)
asm.startChunk(block.getScope(), statement.getIndex(), statement.toString(program, verboseAliveInfo));
// Add padding to the stack to make room for the return value
String pushSignature = "_stackpushbyte_" + (stackFrameByteSize - parametersByteSize);
AsmFragmentInstanceSpec pushFragmentInstanceSpec = new AsmFragmentInstanceSpec(program, pushSignature, new LinkedHashMap<>(), block.getScope());
asm.startChunk(block.getScope(), statement.getIndex(), statement.toString(program, verboseAliveInfo));
generateAsm(asm, pushFragmentInstanceSpec);
}
asm.startChunk(block.getScope(), statement.getIndex(), statement.toString(program, verboseAliveInfo));
}
} else if(statement instanceof StatementCallExecute) {
StatementCallExecute call = (StatementCallExecute) statement;
@ -882,26 +885,24 @@ public class Pass4CodeGeneration {
StatementCallFinalize call = (StatementCallFinalize) statement;
Procedure procedure = getScope().getProcedure(call.getProcedure());
if(Procedure.CallingConvention.STACK_CALL.equals(procedure.getCallingConvention())) {
long stackFrameByteSize = CallingConventionStack.getStackFrameByteSize(procedure);
long returnByteSize = procedure.getReturnType() == null ? 0 : procedure.getReturnType().getSizeBytes();
if(stackFrameByteSize > returnByteSize) {
long stackCleanBytes = (call.getlValue() == null) ? stackFrameByteSize : (stackFrameByteSize - returnByteSize);
if(stackCleanBytes > 0) {
// Clean up the stack
String pullSignature = "_stackpullbyte_" + (stackFrameByteSize - returnByteSize);
String pullSignature = "_stackpullbyte_" + stackCleanBytes;
AsmFragmentInstanceSpec pullFragmentInstanceSpec = new AsmFragmentInstanceSpec(program, pullSignature, new LinkedHashMap<>(), block.getScope());
asm.startChunk(block.getScope(), statement.getIndex(), statement.toString(program, verboseAliveInfo));
generateAsm(asm, pullFragmentInstanceSpec);
}
// Pull result from the stack
if(call.getlValue() != null) {
if(stackCleanBytes>0)
asm.startChunk(block.getScope(), statement.getIndex(), statement.toString(program, verboseAliveInfo));
SymbolType returnType = procedure.getReturnType();
AsmFragmentInstanceSpecFactory asmFragmentInstanceSpecFactory = new AsmFragmentInstanceSpecFactory(call.getlValue(), new StackPullValue(returnType), program, block.getScope());
asm.startChunk(block.getScope(), statement.getIndex(), statement.toString(program, verboseAliveInfo));
ensureEncoding(asm, asmFragmentInstanceSpecFactory);
generateAsm(asm, asmFragmentInstanceSpecFactory.getAsmFragmentInstanceSpec());
}
}
} else if(statement instanceof StatementReturn) {
Procedure procedure = null;
@ -1173,7 +1174,7 @@ public class Pass4CodeGeneration {
}
chunkSrc += "to " + toBlock.getLabel().getFullName();
asm.startChunk(scope, toFirstStatement.getIndex(), chunkSrc);
asm.getCurrentChunk().setPhiTransitionId(transition.getTransitionId());
asm.getCurrentChunk().setSubStatementId(transition.getTransitionId());
for(ControlFlowBlock fBlock : transition.getFromBlocks()) {
asm.addLabel(AsmFormat.asmFix(toBlock.getLabel().getLocalName() + "_from_" + fBlock.getLabel().getLocalName()));
}
@ -1184,8 +1185,8 @@ public class Pass4CodeGeneration {
Statement statement = assignment.getPhiBlock();
// Generate an ASM move fragment
asm.startChunk(scope, statement.getIndex(), "[" + statement.getIndex() + "] phi " + lValue.toString(program) + " = " + rValue.toString(program));
asm.getCurrentChunk().setPhiTransitionId(transition.getTransitionId());
asm.getCurrentChunk().setPhiTransitionAssignmentIdx(assignment.getAssignmentIdx());
asm.getCurrentChunk().setSubStatementId(transition.getTransitionId());
asm.getCurrentChunk().setSubStatementIdx(assignment.getAssignmentIdx());
if(isRegisterCopy(lValue, rValue)) {
asm.getCurrentChunk().setFragment("register_copy");
} else {

View File

@ -177,17 +177,14 @@ __bend:
// main
main: {
.label __0 = 2
// [5] callprepare plus (byte) '0' (byte) 7
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::a#0] -- _stackpushbyte_=vbuc1
lda #'0'
pha
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::b#1] -- _stackpushbyte_=vbuc1
lda #7
pha
// [5] callprepare plus (byte) '0' (byte) 7
// [6] callexecute plus -- jsr
jsr plus
// [7] (byte~) main::$0 ← callfinalize plus
// [7] (byte~) main::$0 ← callfinalize plus -- _stackpullbyte_1
pla
// [7] (byte~) main::$0 ← callfinalize plus -- vbuz1=_stackpullbyte_
@ -296,17 +293,14 @@ __bend_from___b1:
__bend:
// main
main: {
// [5] callprepare plus (byte) '0' (byte) 7
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::a#0] -- _stackpushbyte_=vbuc1
lda #'0'
pha
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::b#1] -- _stackpushbyte_=vbuc1
lda #7
pha
// [5] callprepare plus (byte) '0' (byte) 7
// [6] callexecute plus -- jsr
jsr plus
// [7] (byte~) main::$0 ← callfinalize plus
// [7] (byte~) main::$0 ← callfinalize plus -- _stackpullbyte_1
pla
// [7] (byte~) main::$0 ← callfinalize plus -- vbuaa=_stackpullbyte_
@ -418,17 +412,14 @@ Score: 67
// main
main: {
// plus('0', 7)
// [5] callprepare plus (byte) '0' (byte) 7
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::a#0] -- _stackpushbyte_=vbuc1
lda #'0'
pha
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::b#1] -- _stackpushbyte_=vbuc1
lda #7
pha
// [5] callprepare plus (byte) '0' (byte) 7
// [6] callexecute plus -- jsr
jsr plus
// [7] (byte~) main::$0 ← callfinalize plus
// [7] (byte~) main::$0 ← callfinalize plus -- _stackpullbyte_1
pla
// [7] (byte~) main::$0 ← callfinalize plus -- vbuaa=_stackpullbyte_

View File

@ -177,17 +177,14 @@ __bend:
// main
main: {
.label __0 = 2
// [5] callprepare plus (byte) '0' (byte) 7
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::a#0] -- _stackpushbyte_=vbuc1
lda #'0'
pha
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::b#1] -- _stackpushbyte_=vbuc1
lda #7
pha
// [5] callprepare plus (byte) '0' (byte) 7
// [6] callexecute plus -- jsr
jsr plus
// [7] (byte~) main::$0 ← callfinalize plus
// [7] (byte~) main::$0 ← callfinalize plus -- _stackpullbyte_1
pla
// [7] (byte~) main::$0 ← callfinalize plus -- vbuz1=_stackpullbyte_
@ -296,17 +293,14 @@ __bend_from___b1:
__bend:
// main
main: {
// [5] callprepare plus (byte) '0' (byte) 7
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::a#0] -- _stackpushbyte_=vbuc1
lda #'0'
pha
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::b#1] -- _stackpushbyte_=vbuc1
lda #7
pha
// [5] callprepare plus (byte) '0' (byte) 7
// [6] callexecute plus -- jsr
jsr plus
// [7] (byte~) main::$0 ← callfinalize plus
// [7] (byte~) main::$0 ← callfinalize plus -- _stackpullbyte_1
pla
// [7] (byte~) main::$0 ← callfinalize plus -- vbuaa=_stackpullbyte_
@ -418,17 +412,14 @@ Score: 67
// main
main: {
// plus('0', 7)
// [5] callprepare plus (byte) '0' (byte) 7
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::a#0] -- _stackpushbyte_=vbuc1
lda #'0'
pha
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushbyte_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(byte) plus::b#1] -- _stackpushbyte_=vbuc1
lda #7
pha
// [5] callprepare plus (byte) '0' (byte) 7
// [6] callexecute plus -- jsr
jsr plus
// [7] (byte~) main::$0 ← callfinalize plus
// [7] (byte~) main::$0 ← callfinalize plus -- _stackpullbyte_1
pla
// [7] (byte~) main::$0 ← callfinalize plus -- vbuaa=_stackpullbyte_

View File

@ -195,21 +195,18 @@ __bend:
// main
main: {
.label __0 = 2
// [5] callprepare plus (word) $1234 (word) $2345
// [5] callprepare plus (word) $1234 (word) $2345 -- _stackpushword_=vwuc1
// [5] callprepare plus (word) $1234 (word) $2345 [(word) plus::a#0] -- _stackpushword_=vwuc1
lda #>$1234
pha
lda #<$1234
pha
// [5] callprepare plus (word) $1234 (word) $2345 -- _stackpushword_=vwuc1
// [5] callprepare plus (word) $1234 (word) $2345 [(word) plus::b#1] -- _stackpushword_=vwuc1
lda #>$2345
pha
lda #<$2345
pha
// [5] callprepare plus (word) $1234 (word) $2345
// [6] callexecute plus -- jsr
jsr plus
// [7] (word~) main::$0 ← callfinalize plus
// [7] (word~) main::$0 ← callfinalize plus -- _stackpullbyte_2
pla
pla
@ -327,21 +324,18 @@ __bend:
// main
main: {
.label __0 = 2
// [5] callprepare plus (word) $1234 (word) $2345
// [5] callprepare plus (word) $1234 (word) $2345 -- _stackpushword_=vwuc1
// [5] callprepare plus (word) $1234 (word) $2345 [(word) plus::a#0] -- _stackpushword_=vwuc1
lda #>$1234
pha
lda #<$1234
pha
// [5] callprepare plus (word) $1234 (word) $2345 -- _stackpushword_=vwuc1
// [5] callprepare plus (word) $1234 (word) $2345 [(word) plus::b#1] -- _stackpushword_=vwuc1
lda #>$2345
pha
lda #<$2345
pha
// [5] callprepare plus (word) $1234 (word) $2345
// [6] callexecute plus -- jsr
jsr plus
// [7] (word~) main::$0 ← callfinalize plus
// [7] (word~) main::$0 ← callfinalize plus -- _stackpullbyte_2
pla
pla
@ -474,21 +468,18 @@ Score: 146
main: {
.label __0 = 2
// plus(0x1234, 0x2345)
// [5] callprepare plus (word) $1234 (word) $2345
// [5] callprepare plus (word) $1234 (word) $2345 -- _stackpushword_=vwuc1
// [5] callprepare plus (word) $1234 (word) $2345 [(word) plus::a#0] -- _stackpushword_=vwuc1
lda #>$1234
pha
lda #<$1234
pha
// [5] callprepare plus (word) $1234 (word) $2345 -- _stackpushword_=vwuc1
// [5] callprepare plus (word) $1234 (word) $2345 [(word) plus::b#1] -- _stackpushword_=vwuc1
lda #>$2345
pha
lda #<$2345
pha
// [5] callprepare plus (word) $1234 (word) $2345
// [6] callexecute plus -- jsr
jsr plus
// [7] (word~) main::$0 ← callfinalize plus
// [7] (word~) main::$0 ← callfinalize plus -- _stackpullbyte_2
pla
pla

View File

@ -195,21 +195,18 @@ __bend:
// main
main: {
.label __0 = 2
// [5] callprepare plus (byte) '0' (byte) 7
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushword_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(word) plus::a#0] -- _stackpushword_=vbuc1
lda #0
pha
lda #<'0'
pha
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushword_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(word) plus::b#1] -- _stackpushword_=vbuc1
lda #0
pha
lda #<7
pha
// [5] callprepare plus (byte) '0' (byte) 7
// [6] callexecute plus -- jsr
jsr plus
// [7] (word~) main::$0 ← callfinalize plus
// [7] (word~) main::$0 ← callfinalize plus -- _stackpullbyte_2
pla
pla
@ -330,21 +327,18 @@ __bend:
// main
main: {
.label __0 = 2
// [5] callprepare plus (byte) '0' (byte) 7
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushword_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(word) plus::a#0] -- _stackpushword_=vbuc1
lda #0
pha
lda #<'0'
pha
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushword_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(word) plus::b#1] -- _stackpushword_=vbuc1
lda #0
pha
lda #<7
pha
// [5] callprepare plus (byte) '0' (byte) 7
// [6] callexecute plus -- jsr
jsr plus
// [7] (word~) main::$0 ← callfinalize plus
// [7] (word~) main::$0 ← callfinalize plus -- _stackpullbyte_2
pla
pla
@ -480,21 +474,18 @@ Score: 146
main: {
.label __0 = 2
// plus('0', 7)
// [5] callprepare plus (byte) '0' (byte) 7
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushword_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(word) plus::a#0] -- _stackpushword_=vbuc1
lda #0
pha
lda #<'0'
pha
// [5] callprepare plus (byte) '0' (byte) 7 -- _stackpushword_=vbuc1
// [5] callprepare plus (byte) '0' (byte) 7 [(word) plus::b#1] -- _stackpushword_=vbuc1
lda #0
pha
lda #<7
pha
// [5] callprepare plus (byte) '0' (byte) 7
// [6] callexecute plus -- jsr
jsr plus
// [7] (word~) main::$0 ← callfinalize plus
// [7] (word~) main::$0 ← callfinalize plus -- _stackpullbyte_2
pla
pla

View File

@ -298,17 +298,14 @@ main: {
ldy.z a
iny
sty.z v
// [7] callprepare plus (byte) '0' (byte) main::v#0
// [7] callprepare plus (byte) '0' (byte) main::v#0 -- _stackpushbyte_=vbuc1
// [7] callprepare plus (byte) '0' (byte) main::v#0 [(byte) plus::a#0] -- _stackpushbyte_=vbuc1
lda #'0'
pha
// [7] callprepare plus (byte) '0' (byte) main::v#0 -- _stackpushbyte_=vbuz1
// [7] callprepare plus (byte) '0' (byte) main::v#0 [(byte) plus::b#1] -- _stackpushbyte_=vbuz1
lda.z v
pha
// [7] callprepare plus (byte) '0' (byte) main::v#0
// [8] callexecute plus -- jsr
jsr plus
// [9] (byte) main::w#0 ← callfinalize plus
// [9] (byte) main::w#0 ← callfinalize plus -- _stackpullbyte_1
pla
// [9] (byte) main::w#0 ← callfinalize plus -- vbuz1=_stackpullbyte_
@ -452,17 +449,14 @@ main: {
tya
tax
inx
// [7] callprepare plus (byte) '0' (byte) main::v#0
// [7] callprepare plus (byte) '0' (byte) main::v#0 -- _stackpushbyte_=vbuc1
// [7] callprepare plus (byte) '0' (byte) main::v#0 [(byte) plus::a#0] -- _stackpushbyte_=vbuc1
lda #'0'
pha
// [7] callprepare plus (byte) '0' (byte) main::v#0 -- _stackpushbyte_=vbuxx
// [7] callprepare plus (byte) '0' (byte) main::v#0 [(byte) plus::b#1] -- _stackpushbyte_=vbuxx
txa
pha
// [7] callprepare plus (byte) '0' (byte) main::v#0
// [8] callexecute plus -- jsr
jsr plus
// [9] (byte) main::w#0 ← callfinalize plus
// [9] (byte) main::w#0 ← callfinalize plus -- _stackpullbyte_1
pla
// [9] (byte) main::w#0 ← callfinalize plus -- vbuaa=_stackpullbyte_
@ -614,17 +608,14 @@ main: {
tax
inx
// w = plus('0', v)
// [7] callprepare plus (byte) '0' (byte) main::v#0
// [7] callprepare plus (byte) '0' (byte) main::v#0 -- _stackpushbyte_=vbuc1
// [7] callprepare plus (byte) '0' (byte) main::v#0 [(byte) plus::a#0] -- _stackpushbyte_=vbuc1
lda #'0'
pha
// [7] callprepare plus (byte) '0' (byte) main::v#0 -- _stackpushbyte_=vbuxx
// [7] callprepare plus (byte) '0' (byte) main::v#0 [(byte) plus::b#1] -- _stackpushbyte_=vbuxx
txa
pha
// [7] callprepare plus (byte) '0' (byte) main::v#0
// [8] callexecute plus -- jsr
jsr plus
// [9] (byte) main::w#0 ← callfinalize plus
// [9] (byte) main::w#0 ← callfinalize plus -- _stackpullbyte_1
pla
// [9] (byte) main::w#0 ← callfinalize plus -- vbuaa=_stackpullbyte_

View File

@ -234,14 +234,11 @@ __bend:
main: {
.label __0 = 4
.label __1 = 6
// [5] callprepare next
// [5] callprepare next -- _stackpushbyte_2
pha
pha
// [5] callprepare next
// [6] callexecute next -- jsr
jsr next
// [7] (signed word~) main::$0 ← callfinalize next
// [7] (signed word~) main::$0 ← callfinalize next -- vwsz1=_stackpullsword_
pla
sta.z __0
@ -252,14 +249,11 @@ main: {
sta SCREEN
lda.z __0+1
sta SCREEN+1
// [9] callprepare next
// [9] callprepare next -- _stackpushbyte_2
pha
pha
// [9] callprepare next
// [10] callexecute next -- jsr
jsr next
// [11] (signed word~) main::$1 ← callfinalize next
// [11] (signed word~) main::$1 ← callfinalize next -- vwsz1=_stackpullsword_
pla
sta.z __1
@ -357,14 +351,11 @@ __bend:
main: {
.label __0 = 2
.label __1 = 4
// [5] callprepare next
// [5] callprepare next -- _stackpushbyte_2
pha
pha
// [5] callprepare next
// [6] callexecute next -- jsr
jsr next
// [7] (signed word~) main::$0 ← callfinalize next
// [7] (signed word~) main::$0 ← callfinalize next -- vwsz1=_stackpullsword_
pla
sta.z __0
@ -375,14 +366,11 @@ main: {
sta SCREEN
lda.z __0+1
sta SCREEN+1
// [9] callprepare next
// [9] callprepare next -- _stackpushbyte_2
pha
pha
// [9] callprepare next
// [10] callexecute next -- jsr
jsr next
// [11] (signed word~) main::$1 ← callfinalize next
// [11] (signed word~) main::$1 ← callfinalize next -- vwsz1=_stackpullsword_
pla
sta.z __1
@ -490,14 +478,11 @@ main: {
.label __0 = 2
.label __1 = 4
// next()
// [5] callprepare next
// [5] callprepare next -- _stackpushbyte_2
pha
pha
// [5] callprepare next
// [6] callexecute next -- jsr
jsr next
// [7] (signed word~) main::$0 ← callfinalize next
// [7] (signed word~) main::$0 ← callfinalize next -- vwsz1=_stackpullsword_
pla
sta.z __0
@ -510,14 +495,11 @@ main: {
lda.z __0+1
sta SCREEN+1
// next()
// [9] callprepare next
// [9] callprepare next -- _stackpushbyte_2
pha
pha
// [9] callprepare next
// [10] callexecute next -- jsr
jsr next
// [11] (signed word~) main::$1 ← callfinalize next
// [11] (signed word~) main::$1 ← callfinalize next -- vwsz1=_stackpullsword_
pla
sta.z __1