mirror of
https://github.com/KarolS/millfork.git
synced 2024-12-25 21:29:25 +00:00
Added -Of and -Os command line options
This commit is contained in:
parent
42818df340
commit
6f9ee33514
@ -75,7 +75,7 @@ object CompilationFlag extends Enumeration {
|
||||
// compilation options:
|
||||
EmitIllegals, EmitCmosOpcodes, DecimalMode, ReadOnlyArrays, PreventJmpIndirectBug,
|
||||
// optimization options:
|
||||
DetailedFlowAnalysis, DangerousOptimizations, InlineFunctions,
|
||||
DetailedFlowAnalysis, DangerousOptimizations, InlineFunctions, OptimizeForSize, OptimizeForSpeed,
|
||||
// memory allocation options
|
||||
VariableOverlap, CompactReturnDispatchParams,
|
||||
// runtime check options
|
||||
|
@ -225,7 +225,15 @@ object Main {
|
||||
}
|
||||
flag("--inline").action { c =>
|
||||
c.changeFlag(CompilationFlag.InlineFunctions, true)
|
||||
}.description("Inline functions automatically (experimental).")
|
||||
}.description("Inline functions automatically.")
|
||||
flag("-Of", "--fast").action { c =>
|
||||
c.changeFlag(CompilationFlag.OptimizeForSize, false)
|
||||
c.changeFlag(CompilationFlag.OptimizeForSpeed, true)
|
||||
}.description("Optimize for speed (experimental).")
|
||||
flag("-Os", "--size").action { c =>
|
||||
c.changeFlag(CompilationFlag.OptimizeForSize, true)
|
||||
c.changeFlag(CompilationFlag.OptimizeForSpeed, false)
|
||||
}.description("Optimize for size (experimental).")
|
||||
flag("--detailed-flow").action { c =>
|
||||
c.changeFlag(CompilationFlag.DetailedFlowAnalysis, true)
|
||||
}.description("Use detailed flow analysis (experimental).")
|
||||
|
@ -145,7 +145,11 @@ class Assembler(private val program: Program, private val rootEnv: Environment)
|
||||
val assembly = mutable.ArrayBuffer[String]()
|
||||
|
||||
val potentiallyInlineable: Map[String, Int] =
|
||||
InliningCalculator.getPotentiallyInlineableFunctions(program, options.flags(CompilationFlag.InlineFunctions))
|
||||
InliningCalculator.getPotentiallyInlineableFunctions(
|
||||
program,
|
||||
options.flags(CompilationFlag.InlineFunctions),
|
||||
if (options.flags(CompilationFlag.OptimizeForSpeed)) 1.3 else 1.0,
|
||||
if (options.flags(CompilationFlag.OptimizeForSpeed)) 8.0 else 1.2)
|
||||
|
||||
var inlinedFunctions = Map[String, List[AssemblyLine]]()
|
||||
val compiledFunctions = mutable.Map[String, List[AssemblyLine]]()
|
||||
|
@ -16,8 +16,8 @@ object InliningCalculator {
|
||||
|
||||
def getPotentiallyInlineableFunctions(program: Program,
|
||||
inlineByDefault: Boolean,
|
||||
aggressivenessForNormal: Double = 1.0,
|
||||
aggressivenessForRecommended: Double = 1.2): Map[String, Int] = {
|
||||
aggressivenessForNormal: Double,
|
||||
aggressivenessForRecommended: Double): Map[String, Int] = {
|
||||
val callCount = mutable.Map[String, Int]().withDefaultValue(0)
|
||||
val allFunctions = mutable.Set[String]()
|
||||
val badFunctions = mutable.Set[String]()
|
||||
|
Loading…
Reference in New Issue
Block a user