mirror of
https://github.com/KarolS/millfork.git
synced 2024-11-17 16:05:31 +00:00
Fix TCO
This commit is contained in:
parent
dfda9f9283
commit
1a87929ad3
@ -42,6 +42,8 @@ This matches both the CC65 behaviour and the return values from `readkey()`.
|
|||||||
|
|
||||||
* incorrect removal of unused local variables;
|
* incorrect removal of unused local variables;
|
||||||
|
|
||||||
|
* broken parameter passing to tail calls;
|
||||||
|
|
||||||
* 6502: miscompilation when using the zeropage pseudoregister;
|
* 6502: miscompilation when using the zeropage pseudoregister;
|
||||||
|
|
||||||
* 6502: stack overflow when inlining local variables into registers;
|
* 6502: stack overflow when inlining local variables into registers;
|
||||||
|
@ -825,7 +825,7 @@ object AlwaysGoodOptimizations {
|
|||||||
(Elidable & HasOpcode(JSR)) ~
|
(Elidable & HasOpcode(JSR)) ~
|
||||||
HasOpcode(LABEL).* ~
|
HasOpcode(LABEL).* ~
|
||||||
NoopDiscardsFlags.*.capture(0) ~
|
NoopDiscardsFlags.*.capture(0) ~
|
||||||
HasOpcode(RTS) ~~> ((code, ctx) => ctx.get[List[AssemblyLine]](0) ++ (code.head.copy(opcode = JMP) :: code.tail)),
|
HasOpcode(RTS) ~~> ((code, ctx) => code.head.copy(opcode = JMP) :: code.tail),
|
||||||
)
|
)
|
||||||
|
|
||||||
val UnusedCodeRemoval = new RuleBasedAssemblyOptimization("Unreachable code removal",
|
val UnusedCodeRemoval = new RuleBasedAssemblyOptimization("Unreachable code removal",
|
||||||
|
@ -138,7 +138,7 @@ object LaterI80Optimizations {
|
|||||||
HasOpcode(LABEL).* ~
|
HasOpcode(LABEL).* ~
|
||||||
(Elidable & HasOpcodeIn(ZOpcodeClasses.NoopDiscards)).*.capture(0) ~
|
(Elidable & HasOpcodeIn(ZOpcodeClasses.NoopDiscards)).*.capture(0) ~
|
||||||
(Elidable & HasOpcode(RET) & HasRegisters(NoRegisters)) ~~> { (code, ctx) =>
|
(Elidable & HasOpcode(RET) & HasRegisters(NoRegisters)) ~~> { (code, ctx) =>
|
||||||
ctx.get[List[ZLine]](0) ++ (code.head.copy(opcode = JP) :: code.tail)
|
code.head.copy(opcode = JP) :: code.tail
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user