mirror of
https://github.com/KarolS/millfork.git
synced 2024-12-23 23:30:22 +00:00
Don't deduplicate non-elidable code
This commit is contained in:
parent
ed38b00031
commit
6b43f73f57
@ -51,7 +51,7 @@ class MosDeduplicate(env: Environment, options: CompilationOptions) extends Dedu
|
||||
private val badAddressingModes = Set(Stack, IndexedSY, AbsoluteIndexedX, Indirect, LongIndirect)
|
||||
|
||||
override def isExtractable(line: AssemblyLine): Boolean =
|
||||
goodOpcodes(line.opcode) && !badAddressingModes(line.addrMode)
|
||||
line.elidable && goodOpcodes(line.opcode) && !badAddressingModes(line.addrMode)
|
||||
|
||||
override def isBadExtractedCodeHead(head: AssemblyLine): Boolean = false
|
||||
|
||||
|
@ -49,13 +49,13 @@ class Z80Deduplicate(env: Environment, options: CompilationOptions) extends Dedu
|
||||
)
|
||||
|
||||
override def isExtractable(line: ZLine): Boolean = {
|
||||
alwaysGoodOpcodes(line.opcode) ||
|
||||
line.elidable && (alwaysGoodOpcodes(line.opcode) ||
|
||||
conditionallyGoodOpcodes(line.opcode) && (line.registers match {
|
||||
case OneRegister(SP) => false
|
||||
case TwoRegisters(_, SP) => false
|
||||
case TwoRegisters(SP, _) => false
|
||||
case _ => true
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
override def isBadExtractedCodeHead(head: ZLine): Boolean = false
|
||||
|
@ -178,28 +178,28 @@ class AssemblySuite extends FunSuite with Matchers with AppendedClues {
|
||||
| e()
|
||||
| f()
|
||||
| }
|
||||
| noinline void a() {
|
||||
| void a() {
|
||||
| port = 1
|
||||
| }
|
||||
| noinline void b() {
|
||||
| void b() {
|
||||
| port_alt = 2
|
||||
| }
|
||||
| noinline asm void c() {
|
||||
| asm void c() {
|
||||
| lda #3
|
||||
| sta 1
|
||||
| rts
|
||||
| }
|
||||
| noinline asm void d() {
|
||||
| asm void d() {
|
||||
| lda #4
|
||||
| sta port
|
||||
| rts
|
||||
| }
|
||||
| noinline asm void e() {
|
||||
| asm void e() {
|
||||
| lda #5
|
||||
| sta port_addr
|
||||
| rts
|
||||
| }
|
||||
| noinline asm void f() {
|
||||
| asm void f() {
|
||||
| lda #6
|
||||
| sta port_alt
|
||||
| rts
|
||||
|
Loading…
Reference in New Issue
Block a user