mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-16 16:31:04 +00:00
65816 native mode optimization improvements
This commit is contained in:
parent
50ddd52786
commit
839c52204f
@ -95,16 +95,20 @@ object Main {
|
||||
case 1 => OptimizationPresets.QuickPreset
|
||||
case i if i >= 9 => List(SuperOptimizer)
|
||||
case _ =>
|
||||
val goodExtras = List(
|
||||
if (options.flag(CompilationFlag.EmitEmulation65816Opcodes)) SixteenOptimizations.AllForEmulation else Nil,
|
||||
if (options.flag(CompilationFlag.EmitNative65816Opcodes)) SixteenOptimizations.AllForNative else Nil,
|
||||
).flatten
|
||||
val extras = List(
|
||||
if (options.flag(CompilationFlag.EmitIllegals)) UndocumentedOptimizations.All else Nil,
|
||||
if (options.flag(CompilationFlag.Emit65CE02Opcodes)) CE02Optimizations.All else Nil,
|
||||
if (options.flag(CompilationFlag.EmitCmosOpcodes)) CmosOptimizations.All else LaterOptimizations.Nmos,
|
||||
if (options.flag(CompilationFlag.EmitHudsonOpcodes)) HudsonOptimizations.All else Nil,
|
||||
if (options.flag(CompilationFlag.EmitEmulation65816Opcodes)) SixteenOptimizations.AllForEmulation else Nil,
|
||||
if (options.flag(CompilationFlag.EmitEmulation65816Opcodes)) SixteenOptimizations.AllForNative else Nil,
|
||||
if (options.flag(CompilationFlag.EmitNative65816Opcodes)) SixteenOptimizations.AllForNative else Nil,
|
||||
if (options.flag(CompilationFlag.DangerousOptimizations)) DangerousOptimizations.All else Nil,
|
||||
).flatten
|
||||
val goodCycle = List.fill(optLevel - 2)(OptimizationPresets.Good).flatten
|
||||
val goodCycle = List.fill(optLevel - 2)(OptimizationPresets.Good ++ goodExtras).flatten
|
||||
goodCycle ++ OptimizationPresets.AssOpt ++ extras ++ goodCycle
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,22 @@ object SixteenOptimizations {
|
||||
|
||||
val RepSepWeakening = new RuleBasedAssemblyOptimization("REP/SEP weakening",
|
||||
needsFlowInfo = FlowInfoRequirement.BothFlows,
|
||||
|
||||
(Elidable & HasOpcodeIn(Set(SEP, REP)) & HasImmediate(0)) ~~> (_ => Nil),
|
||||
|
||||
(HasOpcode(SEP) & HasImmediate(0x20)) ~
|
||||
(Linear & Not(HasOpcodeIn(Set(SEP, REP, PLP)))).* ~
|
||||
(Elidable & HasOpcode(SEP) & HasImmediate(0x20)) ~~> (_.init),
|
||||
(HasOpcode(REP) & HasImmediate(0x20)) ~
|
||||
(Linear & Not(HasOpcodeIn(Set(SEP, REP, PLP)))).* ~
|
||||
(Elidable & HasOpcode(REP) & HasImmediate(0x20)) ~~> (_.init),
|
||||
(HasOpcode(SEP) & HasImmediate(0x10)) ~
|
||||
(Linear & Not(HasOpcodeIn(Set(SEP, REP, PLP)))).* ~
|
||||
(Elidable & HasOpcode(SEP) & HasImmediate(0x10)) ~~> (_.init),
|
||||
(HasOpcode(REP) & HasImmediate(0x10)) ~
|
||||
(Linear & Not(HasOpcodeIn(Set(SEP, REP, PLP)))).* ~
|
||||
(Elidable & HasOpcode(REP) & HasImmediate(0x10)) ~~> (_.init),
|
||||
|
||||
(Elidable & HasOpcodeIn(Set(SEP, REP)) & MatchNumericImmediate(0) & DoesntMatterWhatItDoesWith(State.C)) ~
|
||||
Where(c => c.get[Int](0).&(0x1).!=(0)) ~~> { (code, ctx) =>
|
||||
val i = ctx.get[Int](0) & 0xFE
|
||||
|
Loading…
x
Reference in New Issue
Block a user