From 372d3417634a62bac0985b96c2f90f2768700553 Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Sat, 20 Jan 2018 01:32:06 +0100 Subject: [PATCH] Replacing Ml* with Mf* everywhere --- .../millfork/assembly/AssemblyLine.scala | 4 +- .../scala/millfork/compiler/BuiltIns.scala | 88 +++++++++---------- .../millfork/compiler/DecimalBuiltIns.scala | 8 +- .../scala/millfork/compiler/MfCompiler.scala | 6 +- src/main/scala/millfork/env/Thing.scala | 8 +- .../scala/millfork/output/Assembler.scala | 4 +- src/test/scala/millfork/test/emu/EmuRun.scala | 4 +- 7 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/main/scala/millfork/assembly/AssemblyLine.scala b/src/main/scala/millfork/assembly/AssemblyLine.scala index 8569de22..72b14d56 100644 --- a/src/main/scala/millfork/assembly/AssemblyLine.scala +++ b/src/main/scala/millfork/assembly/AssemblyLine.scala @@ -4,7 +4,7 @@ import java.lang.management.MemoryType import millfork.assembly.Opcode._ import millfork.assembly.opt.ReadsA -import millfork.compiler.{CompilationContext, MlCompiler} +import millfork.compiler.{CompilationContext, MfCompiler} import millfork.env._ //noinspection TypeAnnotation @@ -197,7 +197,7 @@ object AssemblyLine { List(AssemblyLine.immediate(opcode, 0)) } else if (opcodesForZeroedOrSignExtendedVariableOperation(opcode)) { if (variable.typ.isSigned) { - val label = MlCompiler.nextLabel("sx") + val label = MfCompiler.nextLabel("sx") AssemblyLine.variable(ctx, opcode, variable, variable.typ.size - 1) ++ List( AssemblyLine.immediate(ORA, 0x7f), AssemblyLine.relative(BMI, label), diff --git a/src/main/scala/millfork/compiler/BuiltIns.scala b/src/main/scala/millfork/compiler/BuiltIns.scala index fb99542a..200e5a2a 100644 --- a/src/main/scala/millfork/compiler/BuiltIns.scala +++ b/src/main/scala/millfork/compiler/BuiltIns.scala @@ -83,24 +83,24 @@ object BuiltIns { indexChoice match { case IndexChoice.RequireX | IndexChoice.PreferX => val array = env.getArrayOrPointer(arrayName) - val calculateIndex = MlCompiler.compile(ctx, index, Some(b -> RegisterVariable(Register.X, b)), NoBranching) + val calculateIndex = MfCompiler.compile(ctx, index, Some(b -> RegisterVariable(Register.X, b)), NoBranching) val baseAddress = array match { case c: ConstantThing => c.value - case a: MlArray => a.toAddress + case a: MfArray => a.toAddress } calculateIndex -> List(AssemblyLine.absoluteX(opcode, baseAddress)) case IndexChoice.PreferY => val array = env.getArrayOrPointer(arrayName) - val calculateIndex = MlCompiler.compile(ctx, index, Some(b -> RegisterVariable(Register.Y, b)), NoBranching) + val calculateIndex = MfCompiler.compile(ctx, index, Some(b -> RegisterVariable(Register.Y, b)), NoBranching) val baseAddress = array match { case c: ConstantThing => c.value - case a: MlArray => a.toAddress + case a: MfArray => a.toAddress } calculateIndex -> List(AssemblyLine.absoluteY(opcode, baseAddress)) } case _: FunctionCallExpression | _:SumExpression if commutative => // TODO: is it ok? - return List(AssemblyLine.implied(PHA)) ++ MlCompiler.compile(ctx.addStack(1), source, Some(b -> RegisterVariable(Register.A, b)), NoBranching) ++ wrapInSedCldIfNeeded(decimal, List( + return List(AssemblyLine.implied(PHA)) ++ MfCompiler.compile(ctx.addStack(1), source, Some(b -> RegisterVariable(Register.A, b)), NoBranching) ++ wrapInSedCldIfNeeded(decimal, List( AssemblyLine.implied(TSX), AssemblyLine.absoluteX(opcode, 0x101), AssemblyLine.implied(INX), @@ -149,7 +149,7 @@ object BuiltIns { val normalizedParams = sortedParams val h = normalizedParams.head - val firstParamCompiled = MlCompiler.compile(ctx, h._2, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val firstParamCompiled = MfCompiler.compile(ctx, h._2, Some(b -> RegisterVariable(Register.A, b)), NoBranching) val firstParamSignCompiled = if (h._1) { // TODO: check if decimal subtraction works correctly here List(AssemblyLine.immediate(EOR, 0xff), AssemblyLine.implied(SEC), AssemblyLine.immediate(ADC, 0)) @@ -200,7 +200,7 @@ object BuiltIns { } val h = sortedParams.head - val firstParamCompiled = MlCompiler.compile(ctx, h, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val firstParamCompiled = MfCompiler.compile(ctx, h, Some(b -> RegisterVariable(Register.A, b)), NoBranching) val remainingParamsCompiled = sortedParams.tail.flatMap { p => simpleOperation(opcode, ctx, p, IndexChoice.PreferY, preserveA = true, commutative = true) @@ -211,7 +211,7 @@ object BuiltIns { def compileShiftOps(opcode: Opcode.Value, ctx: CompilationContext, l: Expression, r: Expression): List[AssemblyLine] = { val b = ctx.env.get[Type]("byte") - val firstParamCompiled = MlCompiler.compile(ctx, l, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val firstParamCompiled = MfCompiler.compile(ctx, l, Some(b -> RegisterVariable(Register.A, b)), NoBranching) ctx.env.eval(r) match { case Some(NumericConstant(0, _)) => Nil @@ -251,7 +251,7 @@ object BuiltIns { def compileInPlaceByteShiftOps(opcode: Opcode.Value, ctx: CompilationContext, lhs: LhsExpression, rhs: Expression): List[AssemblyLine] = { val env = ctx.env val b = env.get[Type]("byte") - val firstParamCompiled = MlCompiler.compile(ctx, lhs, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val firstParamCompiled = MfCompiler.compile(ctx, lhs, Some(b -> RegisterVariable(Register.A, b)), NoBranching) env.eval(rhs) match { case Some(NumericConstant(0, _)) => Nil @@ -293,7 +293,7 @@ object BuiltIns { if (simplicity(env, lhs) >= 'J' && simplicity(env, rhs) < 'J') { return compileByteComparison(ctx, ComparisonType.flip(compType), rhs, lhs, branches) } - val firstParamCompiled = MlCompiler.compile(ctx, lhs, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val firstParamCompiled = MfCompiler.compile(ctx, lhs, Some(b -> RegisterVariable(Register.A, b)), NoBranching) val maybeConstant = env.eval(rhs) maybeConstant match { case Some(NumericConstant(0, _)) => @@ -365,7 +365,7 @@ object BuiltIns { case ComparisonType.LessOrEqualUnsigned => List(AssemblyLine.relative(BCC, Label(label)), AssemblyLine.relative(BEQ, Label(label))) case ComparisonType.GreaterUnsigned => - val x = MlCompiler.nextLabel("co") + val x = MfCompiler.nextLabel("co") List( AssemblyLine.relative(BEQ, x), AssemblyLine.relative(BCS, Label(label)), @@ -378,7 +378,7 @@ object BuiltIns { case ComparisonType.LessOrEqualSigned => List(AssemblyLine.relative(BMI, Label(label)), AssemblyLine.relative(BEQ, Label(label))) case ComparisonType.GreaterSigned => - val x = MlCompiler.nextLabel("co") + val x = MfCompiler.nextLabel("co") List( AssemblyLine.relative(BEQ, x), AssemblyLine.relative(BPL, Label(label)), @@ -447,7 +447,7 @@ object BuiltIns { } effectiveComparisonType match { case ComparisonType.Equal => - val innerLabel = MlCompiler.nextLabel("cp") + val innerLabel = MfCompiler.nextLabel("cp") staTo(LDA, ll) ++ staTo(CMP, rl) ++ List(AssemblyLine.relative(BNE, innerLabel)) ++ @@ -466,7 +466,7 @@ object BuiltIns { List(AssemblyLine.relative(BNE, Label(x))) case ComparisonType.LessUnsigned => - val innerLabel = MlCompiler.nextLabel("cp") + val innerLabel = MfCompiler.nextLabel("cp") staTo(LDA, lh) ++ staTo(CMP, rh) ++ List( @@ -479,7 +479,7 @@ object BuiltIns { AssemblyLine.label(innerLabel)) case ComparisonType.LessOrEqualUnsigned => - val innerLabel = MlCompiler.nextLabel("cp") + val innerLabel = MfCompiler.nextLabel("cp") staTo(LDA, rh) ++ staTo(CMP, lh) ++ List(AssemblyLine.relative(BCC, innerLabel), @@ -490,7 +490,7 @@ object BuiltIns { AssemblyLine.label(innerLabel)) case ComparisonType.GreaterUnsigned => - val innerLabel = MlCompiler.nextLabel("cp") + val innerLabel = MfCompiler.nextLabel("cp") staTo(LDA, rh) ++ staTo(CMP, lh) ++ List(AssemblyLine.relative(BCC, Label(x)), @@ -501,7 +501,7 @@ object BuiltIns { AssemblyLine.label(innerLabel)) case ComparisonType.GreaterOrEqualUnsigned => - val innerLabel = MlCompiler.nextLabel("cp") + val innerLabel = MfCompiler.nextLabel("cp") staTo(LDA, lh) ++ staTo(CMP, rh) ++ List(AssemblyLine.relative(BCC, innerLabel), @@ -520,11 +520,11 @@ object BuiltIns { val b = ctx.env.get[Type]("byte") ctx.env.eval(addend) match { case Some(NumericConstant(0, _)) => - AssemblyLine.immediate(LDA, 0) :: MlCompiler.compileByteStorage(ctx, Register.A, v) + AssemblyLine.immediate(LDA, 0) :: MfCompiler.compileByteStorage(ctx, Register.A, v) case Some(NumericConstant(1, _)) => Nil case Some(NumericConstant(x, _)) => - compileByteMultiplication(ctx, v, x.toInt) ++ MlCompiler.compileByteStorage(ctx, Register.A, v) + compileByteMultiplication(ctx, v, x.toInt) ++ MfCompiler.compileByteStorage(ctx, Register.A, v) case _ => ErrorReporting.error("Multiplying by not a constant not supported", v.position) Nil @@ -589,18 +589,18 @@ object BuiltIns { } case _ => if (!subtract && simplicity(env, v) > simplicity(env, addend)) { - val loadRhs = MlCompiler.compile(ctx, addend, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val loadRhs = MfCompiler.compile(ctx, addend, Some(b -> RegisterVariable(Register.A, b)), NoBranching) val modifyAcc = insertBeforeLast(AssemblyLine.implied(CLC), simpleOperation(ADC, ctx, v, IndexChoice.PreferY, preserveA = true, commutative = true, decimal = decimal)) - val storeLhs = MlCompiler.compileByteStorage(ctx, Register.A, v) + val storeLhs = MfCompiler.compileByteStorage(ctx, Register.A, v) loadRhs ++ modifyAcc ++ storeLhs } else { - val loadLhs = MlCompiler.compile(ctx, v, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val loadLhs = MfCompiler.compile(ctx, v, Some(b -> RegisterVariable(Register.A, b)), NoBranching) val modifyLhs = if (subtract) { insertBeforeLast(AssemblyLine.implied(SEC), simpleOperation(SBC, ctx, addend, IndexChoice.PreferY, preserveA = true, commutative = false, decimal = decimal)) } else { insertBeforeLast(AssemblyLine.implied(CLC), simpleOperation(ADC, ctx, addend, IndexChoice.PreferY, preserveA = true, commutative = true, decimal = decimal)) } - val storeLhs = MlCompiler.compileByteStorage(ctx, Register.A, v) + val storeLhs = MfCompiler.compileByteStorage(ctx, Register.A, v) loadLhs ++ modifyLhs ++ storeLhs } } @@ -616,7 +616,7 @@ object BuiltIns { val targetBytes: List[List[AssemblyLine]] = getStorageForEachByte(ctx, lhs) val lhsIsStack = targetBytes.head.head.opcode == TSX val targetSize = targetBytes.size - val addendType = MlCompiler.getExpressionType(ctx, addend) + val addendType = MfCompiler.getExpressionType(ctx, addend) var addendSize = addendType.size def isRhsComplex(xs: List[AssemblyLine]): Boolean = xs match { @@ -639,7 +639,7 @@ object BuiltIns { case Nil => Nil case x :: Nil => staTo(DEC, x) case x :: xs => - val label = MlCompiler.nextLabel("de") + val label = MfCompiler.nextLabel("de") staTo(LDA, x) ++ List(AssemblyLine.relative(BNE, label)) ++ doDec(xs) ++ @@ -651,16 +651,16 @@ object BuiltIns { case Some(NumericConstant(0, _)) => return Nil case Some(NumericConstant(1, _)) if canUseIncDec && !subtract => - val label = MlCompiler.nextLabel("in") + val label = MfCompiler.nextLabel("in") return staTo(INC, targetBytes.head) ++ targetBytes.tail.flatMap(l => AssemblyLine.relative(BNE, label)::staTo(INC, l)) :+ AssemblyLine.label(label) case Some(NumericConstant(-1, _)) if canUseIncDec && subtract => - val label = MlCompiler.nextLabel("in") + val label = MfCompiler.nextLabel("in") return staTo(INC, targetBytes.head) ++ targetBytes.tail.flatMap(l => AssemblyLine.relative(BNE, label)::staTo(INC, l)) :+ AssemblyLine.label(label) case Some(NumericConstant(1, _)) if canUseIncDec && subtract => - val label = MlCompiler.nextLabel("de") + val label = MfCompiler.nextLabel("de") return doDec(targetBytes) case Some(NumericConstant(-1, _)) if canUseIncDec && !subtract => - val label = MlCompiler.nextLabel("de") + val label = MfCompiler.nextLabel("de") return doDec(targetBytes) case Some(constant) => addendSize = targetSize @@ -668,7 +668,7 @@ object BuiltIns { case None => addendSize match { case 1 => - val base = MlCompiler.compile(ctx, addend, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val base = MfCompiler.compile(ctx, addend, Some(b -> RegisterVariable(Register.A, b)), NoBranching) if (subtract) { if (isRhsComplex(base)) { if (isRhsStack(base)) { @@ -683,9 +683,9 @@ object BuiltIns { base -> List(Nil) } case 2 => - val base = MlCompiler.compile(ctx, addend, Some(w -> RegisterVariable(Register.AX, w)), NoBranching) + val base = MfCompiler.compile(ctx, addend, Some(w -> RegisterVariable(Register.AX, w)), NoBranching) if (isRhsStack(base)) { - val fixedBase = MlCompiler.compile(ctx, addend, Some(w -> RegisterVariable(Register.AY, w)), NoBranching) + val fixedBase = MfCompiler.compile(ctx, addend, Some(w -> RegisterVariable(Register.AY, w)), NoBranching) if (subtract) { ErrorReporting.warn("Subtracting a stack-based value", ctx.options) if (isRhsComplex(base)) { @@ -712,7 +712,7 @@ object BuiltIns { } } else { if (lhsIsStack) { - val fixedBase = MlCompiler.compile(ctx, addend, Some(w -> RegisterVariable(Register.AY, w)), NoBranching) + val fixedBase = MfCompiler.compile(ctx, addend, Some(w -> RegisterVariable(Register.AY, w)), NoBranching) fixedBase -> List(Nil, List(AssemblyLine.implied(TYA))) } else { base -> List(Nil, List(AssemblyLine.implied(TXA))) @@ -744,7 +744,7 @@ object BuiltIns { } else { if (i >= addendSize) { if (addendType.isSigned) { - val label = MlCompiler.nextLabel("sx") + val label = MfCompiler.nextLabel("sx") buffer += AssemblyLine.implied(TXA) if (i == addendSize) { buffer += AssemblyLine.immediate(ORA, 0x7f) @@ -783,14 +783,14 @@ object BuiltIns { Nil case _ => if (simplicity(env, v) > simplicity(env, param)) { - val loadRhs = MlCompiler.compile(ctx, param, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val loadRhs = MfCompiler.compile(ctx, param, Some(b -> RegisterVariable(Register.A, b)), NoBranching) val modifyAcc = simpleOperation(operation, ctx, v, IndexChoice.PreferY, preserveA = true, commutative = true) - val storeLhs = MlCompiler.compileByteStorage(ctx, Register.A, v) + val storeLhs = MfCompiler.compileByteStorage(ctx, Register.A, v) loadRhs ++ modifyAcc ++ storeLhs } else { - val loadLhs = MlCompiler.compile(ctx, v, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val loadLhs = MfCompiler.compile(ctx, v, Some(b -> RegisterVariable(Register.A, b)), NoBranching) val modifyLhs = simpleOperation(operation, ctx, param, IndexChoice.PreferY, preserveA = true, commutative = true) - val storeLhs = MlCompiler.compileByteStorage(ctx, Register.A, v) + val storeLhs = MfCompiler.compileByteStorage(ctx, Register.A, v) loadLhs ++ modifyLhs ++ storeLhs } } @@ -804,7 +804,7 @@ object BuiltIns { val targetBytes: List[List[AssemblyLine]] = getStorageForEachByte(ctx, lhs) val lo = targetBytes.head val targetSize = targetBytes.size - val paramType = MlCompiler.getExpressionType(ctx, param) + val paramType = MfCompiler.getExpressionType(ctx, param) var paramSize = paramType.size val extendMultipleBytes = targetSize > paramSize + 1 val extendAtLeastOneByte = targetSize > paramSize @@ -815,10 +815,10 @@ object BuiltIns { case None => paramSize match { case 1 => - val base = MlCompiler.compile(ctx, param, Some(b -> RegisterVariable(Register.A, b)), NoBranching) + val base = MfCompiler.compile(ctx, param, Some(b -> RegisterVariable(Register.A, b)), NoBranching) base -> List(Nil) case 2 => - val base = MlCompiler.compile(ctx, param, Some(w -> RegisterVariable(Register.AX, w)), NoBranching) + val base = MfCompiler.compile(ctx, param, Some(w -> RegisterVariable(Register.AX, w)), NoBranching) base -> List(Nil, List(AssemblyLine.implied(TXA))) case _ => Nil -> (param match { case vv: VariableExpression => @@ -844,7 +844,7 @@ object BuiltIns { } } else { if (paramType.isSigned) { - val label = MlCompiler.nextLabel("sx") + val label = MfCompiler.nextLabel("sx") buffer += AssemblyLine.implied(TXA) if (i == paramSize) { buffer += AssemblyLine.immediate(ORA, 0x7f) @@ -875,7 +875,7 @@ object BuiltIns { val variable = env.get[Variable](v.name) List.tabulate(variable.typ.size) { i => AssemblyLine.variable(ctx, STA, variable, i) } case IndexedExpression(variable, index) => - List(MlCompiler.compileByteStorage(ctx, Register.A, lhs)) + List(MfCompiler.compileByteStorage(ctx, Register.A, lhs)) case SeparateBytesExpression(h: LhsExpression, l: LhsExpression) => if (simplicity(ctx.env, h) < 'J' || simplicity(ctx.env, l) < 'J') { // a[b]:c[d] is the most complex expression that doesn't cause the following warning @@ -883,7 +883,7 @@ object BuiltIns { } List( getStorageForEachByte(ctx, l).head, - MlCompiler.preserveRegisterIfNeeded(ctx, Register.A, getStorageForEachByte(ctx, h).head)) + MfCompiler.preserveRegisterIfNeeded(ctx, Register.A, getStorageForEachByte(ctx, h).head)) case _ => ??? } diff --git a/src/main/scala/millfork/compiler/DecimalBuiltIns.scala b/src/main/scala/millfork/compiler/DecimalBuiltIns.scala index 977f00ab..8c288b9b 100644 --- a/src/main/scala/millfork/compiler/DecimalBuiltIns.scala +++ b/src/main/scala/millfork/compiler/DecimalBuiltIns.scala @@ -35,7 +35,7 @@ object DecimalBuiltIns { def compileByteShiftRight(ctx: CompilationContext, l: Expression, r: Expression, rotate: Boolean): List[AssemblyLine] = { val b = ctx.env.get[Type]("byte") - MlCompiler.compile(ctx, l, Some((b, RegisterVariable(Register.A, b))), BranchSpec.None) ++ (ctx.env.eval(r) match { + MfCompiler.compile(ctx, l, Some((b, RegisterVariable(Register.A, b))), BranchSpec.None) ++ (ctx.env.eval(r) match { case Some(NumericConstant(0, _)) => Nil case Some(NumericConstant(v, _)) => @@ -49,9 +49,9 @@ object DecimalBuiltIns { } private def shiftOrRotateAccumulatorRight(ctx: CompilationContext, rotate: Boolean) = { - val constantLabel = MlCompiler.nextLabel("c8") - val skipHiDigit = MlCompiler.nextLabel("ds") - val skipLoDigit = MlCompiler.nextLabel("ds") + val constantLabel = MfCompiler.nextLabel("c8") + val skipHiDigit = MfCompiler.nextLabel("ds") + val skipLoDigit = MfCompiler.nextLabel("ds") val cmos = ctx.options.flags(CompilationFlag.EmitCmosOpcodes) val bit = if (cmos) { AssemblyLine.immediate(BIT, 8) diff --git a/src/main/scala/millfork/compiler/MfCompiler.scala b/src/main/scala/millfork/compiler/MfCompiler.scala index fa930bd4..a03ea581 100644 --- a/src/main/scala/millfork/compiler/MfCompiler.scala +++ b/src/main/scala/millfork/compiler/MfCompiler.scala @@ -37,7 +37,7 @@ object BranchSpec { } //noinspection NotImplementedCode,ScalaUnusedSymbol -object MlCompiler { +object MfCompiler { private val labelCounter = new AtomicLong @@ -748,9 +748,9 @@ object MlCompiler { case (a: ConstantThing, Some(v)) => loadFromArrayAtUnknownIndex(v, a.value) - case (a: MlArray, None) => + case (a: MfArray, None) => List(AssemblyLine.absolute(load, env.genRelativeVariable(a.toAddress + constantIndex, b, zeropage = false))) - case (a: MlArray, Some(v)) => + case (a: MfArray, Some(v)) => loadFromArrayAtUnknownIndex(v, a.toAddress) // TODO: see above diff --git a/src/main/scala/millfork/env/Thing.scala b/src/main/scala/millfork/env/Thing.scala index 4ab982c1..b3ca587f 100644 --- a/src/main/scala/millfork/env/Thing.scala +++ b/src/main/scala/millfork/env/Thing.scala @@ -144,19 +144,19 @@ case class InitializedMemoryVariable(name: String, address: Option[Constant], ty override def alloc: VariableAllocationMethod.Value = VariableAllocationMethod.Static } -trait MlArray extends ThingInMemory +trait MfArray extends ThingInMemory -case class UninitializedArray(name: String, sizeInBytes: Int) extends MlArray with UninitializedMemory { +case class UninitializedArray(name: String, sizeInBytes: Int) extends MfArray with UninitializedMemory { override def toAddress: MemoryAddressConstant = MemoryAddressConstant(this) override def alloc = VariableAllocationMethod.Static } -case class RelativeArray(name: String, address: Constant, sizeInBytes: Int) extends MlArray { +case class RelativeArray(name: String, address: Constant, sizeInBytes: Int) extends MfArray { override def toAddress: Constant = address } -case class InitializedArray(name: String, address: Option[Constant], contents: List[Constant]) extends MlArray with PreallocableThing { +case class InitializedArray(name: String, address: Option[Constant], contents: List[Constant]) extends MfArray with PreallocableThing { override def shouldGenerate = true } diff --git a/src/main/scala/millfork/output/Assembler.scala b/src/main/scala/millfork/output/Assembler.scala index feb1995a..a1dc37ba 100644 --- a/src/main/scala/millfork/output/Assembler.scala +++ b/src/main/scala/millfork/output/Assembler.scala @@ -2,7 +2,7 @@ package millfork.output import millfork.assembly.opt.AssemblyOptimization import millfork.assembly.{AddrMode, AssemblyLine, Opcode} -import millfork.compiler.{CompilationContext, MlCompiler} +import millfork.compiler.{CompilationContext, MfCompiler} import millfork.env._ import millfork.error.ErrorReporting import millfork.node.{CallGraph, Program} @@ -294,7 +294,7 @@ class Assembler(private val program: Program, private val rootEnv: Environment) private def compileFunction(f: NormalFunction, optimizations: Seq[AssemblyOptimization], options: CompilationOptions, inlinedFunctions: Map[String, List[AssemblyLine]]): List[AssemblyLine] = { ErrorReporting.debug("Compiling: " + f.name, f.position) val unoptimized = - MlCompiler.compile(CompilationContext(env = f.environment, function = f, extraStackOffset = 0, options = options)).linearize.flatMap { + MfCompiler.compile(CompilationContext(env = f.environment, function = f, extraStackOffset = 0, options = options)).linearize.flatMap { case AssemblyLine(Opcode.JSR, _, p, true) if inlinedFunctions.contains(p.toString) => inlinedFunctions(p.toString) case AssemblyLine(Opcode.JMP, AddrMode.Absolute, p, true) if inlinedFunctions.contains(p.toString) => diff --git a/src/test/scala/millfork/test/emu/EmuRun.scala b/src/test/scala/millfork/test/emu/EmuRun.scala index d9d33120..e6a7ad12 100644 --- a/src/test/scala/millfork/test/emu/EmuRun.scala +++ b/src/test/scala/millfork/test/emu/EmuRun.scala @@ -5,7 +5,7 @@ import com.loomcom.symon.InstructionTable.CpuBehavior import com.loomcom.symon.{Bus, Cpu, CpuState} import fastparse.core.Parsed.{Failure, Success} import millfork.assembly.opt.AssemblyOptimization -import millfork.compiler.{CompilationContext, MlCompiler} +import millfork.compiler.{CompilationContext, MfCompiler} import millfork.env.{Environment, InitializedArray, InitializedMemoryVariable, NormalFunction} import millfork.error.ErrorReporting import millfork.node.StandardCallGraph @@ -115,7 +115,7 @@ class EmuRun(cpu: millfork.Cpu.Value, nodeOptimizations: List[NodeOptimization], // print asm env.allPreallocatables.foreach { case f: NormalFunction => - val result = MlCompiler.compile(CompilationContext(f.environment, f, 0, options)) + val result = MfCompiler.compile(CompilationContext(f.environment, f, 0, options)) val unoptimized = result.linearize unoptimizedSize += unoptimized.map(_.sizeInBytes).sum case d: InitializedArray =>