mirror of
https://github.com/KarolS/millfork.git
synced 2024-09-27 12:57:41 +00:00
Don't compile the same functions twice
This commit is contained in:
parent
4d8de94c8a
commit
e0f9544733
@ -143,6 +143,13 @@ class Assembler(private val rootEnv: Environment) {
|
||||
|
||||
val assembly = mutable.ArrayBuffer[String]()
|
||||
|
||||
val compiledFunctions = mutable.Map[String, List[AssemblyLine]]()
|
||||
callGraph.recommendedCompilationOrder.foreach{ f =>
|
||||
env.maybeGet[NormalFunction](f).foreach( function =>
|
||||
compiledFunctions(f) = compileFunction(function, optimizations, options)
|
||||
)
|
||||
}
|
||||
|
||||
env.allPreallocatables.foreach {
|
||||
case InitializedArray(name, Some(NumericConstant(address, _)), items) =>
|
||||
var index = address.toInt
|
||||
@ -159,17 +166,10 @@ class Assembler(private val rootEnv: Environment) {
|
||||
case f: NormalFunction if f.address.isDefined =>
|
||||
var index = f.address.get.asInstanceOf[NumericConstant].value.toInt
|
||||
labelMap(f.name) = index
|
||||
val code = compileFunction(f, optimizations, options)
|
||||
index = outputFunction(code, index, assembly, options)
|
||||
index = outputFunction(compiledFunctions(f.name), index, assembly, options)
|
||||
case _ =>
|
||||
}
|
||||
|
||||
val compiledFunctions = mutable.Map[String, List[AssemblyLine]]()
|
||||
callGraph.recommendedCompilationOrder.foreach{ f =>
|
||||
env.maybeGet[NormalFunction](f).foreach( function =>
|
||||
compiledFunctions(f) = compileFunction(function, optimizations, options)
|
||||
)
|
||||
}
|
||||
var index = platform.org
|
||||
env.allPreallocatables.foreach {
|
||||
case f: NormalFunction if f.address.isEmpty && f.name == "main" =>
|
||||
|
Loading…
Reference in New Issue
Block a user