1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-07-05 09:28:54 +00:00

Take into account that the sole byte parameter is passed via the accumulator in more locations

This commit is contained in:
Karol Stasiak 2018-06-23 23:47:18 +02:00
parent 456c674a0c
commit 86ce4c75ad
3 changed files with 7 additions and 1 deletions

View File

@ -29,7 +29,9 @@ class Platform(
val bankNumbers: Map[String, Int],
val defaultCodeBank: String,
val outputStyle: OutputStyle.Value
)
) {
def cpuFamily: CpuFamily.Value = CpuFamily.forType(this.cpu)
}
object Platform {

View File

@ -20,6 +20,8 @@ object EmptyMemoryStoreRemoval extends AssemblyOptimization[AssemblyLine] {
override def optimize(f: NormalFunction, code: List[AssemblyLine], options: CompilationOptions): List[AssemblyLine] = {
val paramVariables = f.params match {
case NormalParamSignature(List(MemoryVariable(_, typ, _))) if typ.size == 1 =>
Set[String]()
case NormalParamSignature(ps) =>
ps.map(_.name).toSet
case _ =>

View File

@ -101,6 +101,8 @@ class Environment(val parent: Option[Environment], val prefix: String) {
val p = get[Type]("pointer")
val params = nf.fold(List[String]()) { f =>
f.params match {
case NormalParamSignature(List(MemoryVariable(_, typ, _))) if typ.size == 1 && options.platform.cpuFamily == CpuFamily.M6502 =>
Nil
case NormalParamSignature(ps) =>
ps.map(p => p.name)
case _ =>