mirror of
https://github.com/michaelcmartin/Ophis.git
synced 2024-12-21 12:29:46 +00:00
Pass control command line options.
It turns out that --enable-collapse is fundamentally misguided. We'll need a better solution for that. --no-branch-extension looks pretty good.
This commit is contained in:
parent
7e503df96f
commit
4891849e4a
@ -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
|
||||
|
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user