Merge branch 'master' into remove_evalstack

This commit is contained in:
Irmen de Jong 2023-07-30 14:53:40 +02:00
commit 0cba736446
4 changed files with 4 additions and 8 deletions

View File

@ -31,8 +31,8 @@ internal class FunctionCallAsmGen(private val program: PtProgram, private val as
if(sub is PtAsmSub) {
argumentsViaRegisters(sub, call)
if (sub.inline && asmgen.options.optimize) {
// inline the subroutine.
if (sub.inline) {
// inline the subroutine. (regardless of optimization settings!)
// we do this by copying the subroutine's statements at the call site.
// NOTE: *if* there is a return statement, it will be the only one, and the very last statement of the subroutine
// (this condition has been enforced by an ast check earlier)

View File

@ -269,9 +269,7 @@ internal class ProgramAndVarsGen(
internal fun translateAsmSubroutine(sub: PtAsmSub) {
if(sub.inline) {
if(options.optimize) {
return
}
return // subroutine gets inlined at call site.
}
asmgen.out("")

View File

@ -143,7 +143,7 @@ internal class BeforeAsmAstChanger(val program: Program, private val options: Co
}
}
if (!subroutine.inline || !options.optimize) {
if (!subroutine.inline) {
if (subroutine.isAsmSubroutine && subroutine.asmAddress==null && !subroutine.hasRtsInAsm()) {
// make sure the NOT INLINED asm subroutine actually has a rts at the end
// (non-asm routines get a Return statement as needed, above)

View File

@ -1,8 +1,6 @@
TODO
====
- compiling Rockrunner with -noopt crashes the program soon after startup
- IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction
- IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? etc), but only after setting the status bits is verified!