--optimize-fallthru and --dump-fallthru-info options.
Chris Pressey
4 years ago
9 | 9 |
* Accessing zero-page with `ld` and `st` generates zero-page opcodes.
|
10 | 10 |
* A `byte` or `word` table can be initialized with a list of constants.
|
11 | 11 |
* Branching and repeating on the `n` flag is now supported.
|
12 | |
* The `--dump-fallthru-map` option outputs a map, in JSON format, of
|
13 | |
which routines can be "fallen through" to by other routines.
|
|
12 |
* The `--optimize-fallthru` option causes the program to be analyzed
|
|
13 |
for fallthru optimizations; `--dump-fallthru-info` option outputs the
|
|
14 |
information from this analysis phase, in JSON format, to stdout.
|
14 | 15 |
* Specifying multiple SixtyPical source files will produce a single
|
15 | 16 |
compiled result from their combination.
|
16 | 17 |
* Rudimentary support for Atari 2600 prelude in a 4K cartridge image,
|
57 | 57 |
analyzer = Analyzer(debug=options.debug)
|
58 | 58 |
analyzer.analyze_program(program)
|
59 | 59 |
|
60 | |
if options.dump_fallthru_map:
|
61 | |
import json
|
|
60 |
if options.optimize_fallthru:
|
62 | 61 |
from sixtypical.fallthru import FallthruAnalyzer
|
63 | 62 |
|
64 | 63 |
fa = FallthruAnalyzer(debug=options.debug)
|
65 | 64 |
fa.analyze_program(program)
|
66 | 65 |
|
67 | |
sys.stdout.write(json.dumps(fa.fallthru_map, indent=4, sort_keys=True))
|
68 | |
sys.stdout.write("\n")
|
|
66 |
if options.dump_fallthru_info:
|
|
67 |
import json
|
|
68 |
sys.stdout.write(json.dumps(fa.fallthru_map, indent=4, sort_keys=True))
|
|
69 |
sys.stdout.write("\n")
|
69 | 70 |
|
70 | 71 |
if options.analyze_only:
|
71 | 72 |
return
|
|
155 | 156 |
help="Only parse and analyze the program; do not compile it."
|
156 | 157 |
)
|
157 | 158 |
argparser.add_argument(
|
158 | |
"--dump-fallthru-map",
|
|
159 |
"--optimize-fallthru",
|
159 | 160 |
action="store_true",
|
160 | |
help="Dump the fallthru map to stdout after analyzing the program."
|
|
161 |
help="Reorder the routines in the program to maximize the number of tail calls "
|
|
162 |
"that can be removed by having execution 'fall through' to the next routine."
|
161 | 163 |
)
|
162 | 164 |
argparser.add_argument(
|
163 | |
"--dump-fallthru-ordering",
|
|
165 |
"--dump-fallthru-info",
|
164 | 166 |
action="store_true",
|
165 | |
help="Dump the fallthru ordering to stdout after analyzing the program."
|
|
167 |
help="Dump the fallthru map and ordering to stdout after analyzing the program."
|
166 | 168 |
)
|
167 | 169 |
argparser.add_argument(
|
168 | 170 |
"--parse-only",
|
50 | 50 |
|
51 | 51 |
[Falderal]: http://catseye.tc/node/Falderal
|
52 | 52 |
|
53 | |
-> Functionality "Dump fallthru map of SixtyPical program" is implemented by
|
54 | |
-> shell command "bin/sixtypical --analyze-only --dump-fallthru-map --traceback %(test-body-file)"
|
|
53 |
-> Functionality "Dump fallthru info for SixtyPical program" is implemented by
|
|
54 |
-> shell command "bin/sixtypical --optimize-fallthru --dump-fallthru-info --analyze-only --traceback %(test-body-file)"
|
55 | 55 |
|
56 | |
-> Tests for functionality "Dump fallthru map of SixtyPical program"
|
|
56 |
-> Tests for functionality "Dump fallthru info for SixtyPical program"
|
57 | 57 |
|
58 | 58 |
A single routine, obviously, falls through to nothing and has nothing fall
|
59 | 59 |
through to it.
|