1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-22 16:33:48 +00:00

- Inline code can never be banked.

(cherry picked from commit 249b7600a9262ea673e63d133db75690af43ca05)
This commit is contained in:
Flight_Control 2023-03-26 18:30:53 +02:00
parent f81c5ce040
commit 2513e59266

View File

@ -894,20 +894,27 @@ public class Pass4CodeGeneration {
} else if (statement instanceof StatementCallExecute) {
// TODO: This part seems never to be executed! Old code?
StatementCallExecute call = (StatementCallExecute) statement;
Procedure procedure = getScope().getProcedure(call.getProcedure());
Procedure procedureFrom = block.getProcedure(this.program); // We obtain from where the procedure is called, to validate the bank equality.
RValue procedureRVal = call.getProcedureRVal();
// Same as PHI
if(procedure.isDeclaredBanked() && procedureFrom.getBank() != procedure.getBank()) {
AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.bankCallPrepare(procedure.getBankArea(), procedure.getBank(), call.getProcedure().getFullName(), program), program);
AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.bankCallExecute(procedure.getBankArea(), procedure.getBank(), call.getProcedure().getFullName(), program), program);
AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.bankCallFinalize(procedure.getBankArea(), procedure.getBank(), call.getProcedure().getFullName(), program), program);
} else {
AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.call(call, indirectCallCount++, program), program);
}
// Generate ASM for a call
AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.call(call, indirectCallCount++, program), program);
if (!(procedureRVal instanceof ProcedureRef)) {
asm.getCurrentChunk().setClobberOverwrite(CpuClobber.CLOBBER_ALL);
}
// StatementCallExecute call = (StatementCallExecute) statement;
// Procedure procedure = getScope().getProcedure(call.getProcedure());
// Procedure procedureFrom = block.getProcedure(this.program); // We obtain from where the procedure is called, to validate the bank equality.
// RValue procedureRVal = call.getProcedureRVal();
// // Same as PHI
// if(procedure.isDeclaredBanked() && procedureFrom.getBank() != procedure.getBank()) {
// AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.bankCallPrepare(procedure.getBankArea(), procedure.getBank(), call.getProcedure().getFullName(), program), program);
// AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.bankCallExecute(procedure.getBankArea(), procedure.getBank(), call.getProcedure().getFullName(), program), program);
// AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.bankCallFinalize(procedure.getBankArea(), procedure.getBank(), call.getProcedure().getFullName(), program), program);
// } else {
// AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.call(call, indirectCallCount++, program), program);
// }
// if (!(procedureRVal instanceof ProcedureRef)) {
// asm.getCurrentChunk().setClobberOverwrite(CpuClobber.CLOBBER_ALL);
// }
} else if (statement instanceof StatementExprSideEffect) {
AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.exprSideEffect((StatementExprSideEffect) statement, program), program);
} else if (statement instanceof StatementReturn) {