mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-11-22 01:32:13 +00:00
Make test as intended. It fails atm. Simplify driver code.
This commit is contained in:
parent
3d88226058
commit
ea788264f7
@ -61,18 +61,11 @@ def process_input_files(filenames, options):
|
||||
if options.optimize_fallthru:
|
||||
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.analyze_program(program)
|
||||
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):
|
||||
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.
|
||||
|
||||
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
|
||||
| {
|
||||
| ld a, 0
|
||||
@ -411,11 +406,10 @@ in the "true" branch is a `goto`.
|
||||
| }
|
||||
= $080D RTS
|
||||
= $080E LDA #$00
|
||||
= $0810 BNE $081A
|
||||
= $0810 BNE $0817
|
||||
= $0812 LDA #$01
|
||||
= $0814 JMP $081F
|
||||
= $0817 JMP $081F
|
||||
= $081A LDA #$02
|
||||
= $081C JMP $080D
|
||||
= $081F LDA #$FF
|
||||
= $0821 RTS
|
||||
= $0814 JMP $081C
|
||||
= $0817 LDA #$02
|
||||
= $0819 JMP $080D
|
||||
= $081C LDA #$FF
|
||||
= $081E RTS
|
||||
|
Loading…
Reference in New Issue
Block a user