mirror of
https://github.com/KarolS/millfork.git
synced 2024-08-28 05:29:06 +00:00
Fixed invalid BNE optimization
This commit is contained in:
parent
1dd8c3d855
commit
115f040fe2
@ -265,6 +265,8 @@ object AlwaysGoodOptimizations {
|
|||||||
(OverwritesV & Elidable) ~ (LinearOrLabel & Not(ReadsV) & Not(DiscardsV)).* ~ DiscardsV ~~> (_.tail)
|
(OverwritesV & Elidable) ~ (LinearOrLabel & Not(ReadsV) & Not(DiscardsV)).* ~ DiscardsV ~~> (_.tail)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Optimizing Bxx to JMP is generally bad, but it may allow for better optimizations later
|
||||||
|
// It's okay to undo it at a later stage, but it's not done yet
|
||||||
val FlagFlowAnalysis = new RuleBasedAssemblyOptimization("Flag flow analysis",
|
val FlagFlowAnalysis = new RuleBasedAssemblyOptimization("Flag flow analysis",
|
||||||
needsFlowInfo = FlowInfoRequirement.ForwardFlow,
|
needsFlowInfo = FlowInfoRequirement.ForwardFlow,
|
||||||
(HasSet(State.C) & HasOpcode(SEC) & Elidable) ~~> (_ => Nil),
|
(HasSet(State.C) & HasOpcode(SEC) & Elidable) ~~> (_ => Nil),
|
||||||
@ -279,7 +281,7 @@ object AlwaysGoodOptimizations {
|
|||||||
(HasClear(State.V) & HasOpcode(BVC) & Elidable) ~~> (c => c.map(_.copy(opcode = JMP, addrMode = Absolute))),
|
(HasClear(State.V) & HasOpcode(BVC) & Elidable) ~~> (c => c.map(_.copy(opcode = JMP, addrMode = Absolute))),
|
||||||
(HasSet(State.V) & HasOpcode(BVS) & Elidable) ~~> (c => c.map(_.copy(opcode = JMP, addrMode = Absolute))),
|
(HasSet(State.V) & HasOpcode(BVS) & Elidable) ~~> (c => c.map(_.copy(opcode = JMP, addrMode = Absolute))),
|
||||||
(HasSet(State.Z) & HasOpcode(BEQ) & Elidable) ~~> (c => c.map(_.copy(opcode = JMP, addrMode = Absolute))),
|
(HasSet(State.Z) & HasOpcode(BEQ) & Elidable) ~~> (c => c.map(_.copy(opcode = JMP, addrMode = Absolute))),
|
||||||
(HasClear(State.Z) & HasOpcode(BNE) & Elidable) ~~> (_ => Nil),
|
(HasClear(State.Z) & HasOpcode(BNE) & Elidable) ~~> (c => c.map(_.copy(opcode = JMP, addrMode = Absolute))),
|
||||||
)
|
)
|
||||||
|
|
||||||
val ReverseFlowAnalysis = new RuleBasedAssemblyOptimization("Reverse flow analysis",
|
val ReverseFlowAnalysis = new RuleBasedAssemblyOptimization("Reverse flow analysis",
|
||||||
|
Loading…
Reference in New Issue
Block a user