git @ Cat's Eye Technologies SixtyPical / d883816
--optimize-fallthru and --dump-fallthru-info options. Chris Pressey 4 years ago
3 changed file(s) with 16 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
99 * Accessing zero-page with `ld` and `st` generates zero-page opcodes.
1010 * A `byte` or `word` table can be initialized with a list of constants.
1111 * 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.
1415 * Specifying multiple SixtyPical source files will produce a single
1516 compiled result from their combination.
1617 * Rudimentary support for Atari 2600 prelude in a 4K cartridge image,
5757 analyzer = Analyzer(debug=options.debug)
5858 analyzer.analyze_program(program)
5959
60 if options.dump_fallthru_map:
61 import json
60 if options.optimize_fallthru:
6261 from sixtypical.fallthru import FallthruAnalyzer
6362
6463 fa = FallthruAnalyzer(debug=options.debug)
6564 fa.analyze_program(program)
6665
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")
6970
7071 if options.analyze_only:
7172 return
155156 help="Only parse and analyze the program; do not compile it."
156157 )
157158 argparser.add_argument(
158 "--dump-fallthru-map",
159 "--optimize-fallthru",
159160 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."
161163 )
162164 argparser.add_argument(
163 "--dump-fallthru-ordering",
165 "--dump-fallthru-info",
164166 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."
166168 )
167169 argparser.add_argument(
168170 "--parse-only",
5050
5151 [Falderal]: http://catseye.tc/node/Falderal
5252
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)"
5555
56 -> Tests for functionality "Dump fallthru map of SixtyPical program"
56 -> Tests for functionality "Dump fallthru info for SixtyPical program"
5757
5858 A single routine, obviously, falls through to nothing and has nothing fall
5959 through to it.