mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-16 00:31:30 +00:00
All things mentioned in segment layouts should be considered used.
This commit is contained in:
parent
c7008f4414
commit
889a4f94be
@ -65,8 +65,9 @@ object UnusedFunctions extends NodeOptimization {
|
||||
case _ => None
|
||||
}.toMap
|
||||
val panicRequired = options.flags(CompilationFlag.CheckIndexOutOfBounds)
|
||||
val entrypointNames = options.platform.bankLayouts.values.flatten.toSet + "main"
|
||||
val allNormalFunctions = nodes.flatMap {
|
||||
case v: FunctionDeclarationStatement => if (v.address.isDefined && v.statements.isDefined || v.interrupt || v.name == "main" || panicRequired && v.name == "_panic") Nil else List(v.name)
|
||||
case v: FunctionDeclarationStatement => if (v.address.isDefined && v.statements.isDefined || v.interrupt || entrypointNames(v.name) || panicRequired && v.name == "_panic") Nil else List(v.name)
|
||||
case _ => Nil
|
||||
}.toSet
|
||||
var allCalledFunctions = resolveAliases(aliases, getAllCalledFunctions(nodes).toSet)
|
||||
|
@ -15,8 +15,9 @@ object UnusedGlobalVariables extends NodeOptimization {
|
||||
case AliasDefinitionStatement(source, target, _) => Some(source -> target)
|
||||
case _ => None
|
||||
}.toMap
|
||||
val entrypointNames = options.platform.bankLayouts.values.flatten.toSet
|
||||
val allNonvolatileGlobalVariables = nodes.flatMap {
|
||||
case v: VariableDeclarationStatement => if (v.address.isDefined || v.volatile || v.constant) Nil else List(v.name)
|
||||
case v: VariableDeclarationStatement => if (v.address.isDefined || v.volatile || v.constant || entrypointNames(v.name)) Nil else List(v.name)
|
||||
case v: ArrayDeclarationStatement => if (v.address.isDefined) Nil else List(v.name)
|
||||
case _ => Nil
|
||||
}.toSet
|
||||
|
Loading…
x
Reference in New Issue
Block a user