diff --git a/src/Ophis/CmdLine.py b/src/Ophis/CmdLine.py index 5cf80b3..fc55148 100644 --- a/src/Ophis/CmdLine.py +++ b/src/Ophis/CmdLine.py @@ -6,7 +6,6 @@ import optparse # You may use, modify, and distribute this file under the MIT # license: See README for details. -enable_collapse = True enable_branch_extend = True enable_undoc_ops = False enable_65c02_exts = False @@ -56,9 +55,6 @@ def parse_args(raw_args): default=True, help="Do not print warnings") bingrp = optparse.OptionGroup(parser, "Compilation options") - bingrp.add_option("--no-collapse", action="store_false", - dest="enable_collapse", default="True", - help="Disable zero-page collapse pass") bingrp.add_option("--no-branch-extend", action="store_false", dest="enable_branch_extend", default="True", help="Disable branch-extension pass") @@ -76,7 +72,6 @@ def parse_args(raw_args): infiles = args outfile = options.outfile - enable_collapse = options.enable_collapse enable_branch_extend = options.enable_branch_extend enable_undoc_ops = options.undoc enable_65c02_exts = options.c02 diff --git a/src/Ophis/Main.py b/src/Ophis/Main.py index 20d401b..0806a0e 100644 --- a/src/Ophis/Main.py +++ b/src/Ophis/Main.py @@ -29,10 +29,20 @@ def run_all(): l_basic = Ophis.Passes.UpdateLabels() l = Ophis.Passes.FixPoint("label update", [l_basic], lambda: not l_basic.changed) + + # The instruction selector is a bunch of fixpoints, and which + # passes run depends on the command line options a bit. c_basic = Ophis.Passes.Collapse() c = Ophis.Passes.FixPoint("instruction selection 1", [l, c_basic], lambda: not c_basic.changed) - b = Ophis.Passes.ExtendBranches() + + if Ophis.CmdLine.enable_branch_extend: + b = Ophis.Passes.ExtendBranches() + instruction_select = Ophis.Passes.FixPoint("instruction selection 2", + [c, b], + lambda: not b.changed) + else: + instruction_select = c a = Ophis.Passes.Assembler() passes = [] @@ -44,8 +54,7 @@ def run_all(): passes.extend([Ophis.Passes.CircularityCheck(), Ophis.Passes.CheckExprs(), Ophis.Passes.EasyModes()]) - passes.append(Ophis.Passes.FixPoint("instruction selection 2", [c, b], - lambda: not b.changed)) + passes.append(instruction_select) passes.extend([Ophis.Passes.NormalizeModes(), Ophis.Passes.UpdateLabels(), a])