mirror of
https://github.com/catseye/SixtyPical.git
synced 2026-04-27 02:18:14 +00:00
Make test as intended. It fails atm. Simplify driver code.
This commit is contained in:
1 parent
3d88226058
commit
ea788264f7
2 files changed
+8
-21
No files matched your search
+2
-9
@@ -61,18 +61,11 @@ def process_input_files(filenames, options):
|
|||||||
if options.optimize_fallthru:
|
if options.optimize_fallthru:
|
||||||
from sixtypical.fallthru import FallthruAnalyzer
|
from sixtypical.fallthru import FallthruAnalyzer
|
||||||
|
|
||||||
def dump(data, label=None):
|
|
||||||
if not options.dump_fallthru_info:
|
|
||||||
return
|
|
||||||
if label:
|
|
||||||
sys.stdout.write("*** {}:\n".format(label))
|
|
||||||
sys.stdout.write(json.dumps(data, indent=4, sort_keys=True, separators=(',', ': ')))
|
|
||||||
sys.stdout.write("\n")
|
|
||||||
|
|
||||||
fa = FallthruAnalyzer(symtab, debug=options.debug)
|
fa = FallthruAnalyzer(symtab, debug=options.debug)
|
||||||
fa.analyze_program(program)
|
fa.analyze_program(program)
|
||||||
compilation_roster = fa.serialize()
|
compilation_roster = fa.serialize()
|
||||||
dump(compilation_roster)
|
if options.dump_fallthru_info:
|
||||||
|
sys.stdout.write(json.dumps(compilation_roster, indent=4, sort_keys=True, separators=(',', ': ')))
|
||||||
|
|
||||||
if options.analyze_only or (options.output is None and not options.run_on):
|
if options.analyze_only or (options.output is None and not options.run_on):
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -384,11 +384,6 @@ It can optimize out one of the `goto`s if they are the same.
|
|||||||
|
|
||||||
It cannot optimize out the `goto`s if they are different.
|
It cannot optimize out the `goto`s if they are different.
|
||||||
|
|
||||||
Note, this currently produces unfortunately unoptimized code,
|
|
||||||
because generating code for the "true" branch of an `if` always
|
|
||||||
generates a jump out of the `if`, even if the last instruction
|
|
||||||
in the "true" branch is a `goto`.
|
|
||||||
|
|
||||||
| define foo routine trashes a, z, n
|
| define foo routine trashes a, z, n
|
||||||
| {
|
| {
|
||||||
| ld a, 0
|
| ld a, 0
|
||||||
@@ -411,11 +406,10 @@ in the "true" branch is a `goto`.
|
|||||||
| }
|
| }
|
||||||
= $080D RTS
|
= $080D RTS
|
||||||
= $080E LDA #$00
|
= $080E LDA #$00
|
||||||
= $0810 BNE $081A
|
= $0810 BNE $0817
|
||||||
= $0812 LDA #$01
|
= $0812 LDA #$01
|
||||||
= $0814 JMP $081F
|
= $0814 JMP $081C
|
||||||
= $0817 JMP $081F
|
= $0817 LDA #$02
|
||||||
= $081A LDA #$02
|
= $0819 JMP $080D
|
||||||
= $081C JMP $080D
|
= $081C LDA #$FF
|
||||||
= $081F LDA #$FF
|
= $081E RTS
|
||||||
= $0821 RTS
|
|
||||||
Reference in new issue
Block a user