Skip to content

Commit 9ca2f96

Browse files
committed
Ensure opt patterns are applied sorted
The OFLAG is used to determine the order the patterns are applied. However this should not be critical.
1 parent 0cddab1 commit 9ca2f96

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

arch/zx48k/backend/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,7 @@ def convertToBool():
21792179
return result
21802180

21812181

2182-
def emit_end(MEMORY=None):
2182+
def emit_end():
21832183
""" This special ending autoinitializes required inits
21842184
(mainly alloc.asm) and changes the MEMORY initial address if it is
21852185
ORG XXXX to ORG XXXX + heap size

arch/zx48k/peephole/engine.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ def read_opts(folder_path, result=None):
8484

8585
result.append(pattern_)
8686

87-
return sorted(result, key=lambda x: x.flag)
87+
result[:] = sorted(result, key=lambda x: x.flag)
88+
return result
8889

8990

9091
def apply_match(asm_list, patterns_list, index=0):

zxb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def main(args=None):
328328
tmp = [x for x in backend.emit(backend.MEMORY, optimize=False) if x.strip()[0] != '#']
329329
asm_output += tmp
330330
asm_output = backend.emit_start() + asm_output
331-
asm_output += backend.emit_end(asm_output)
331+
asm_output += backend.emit_end()
332332

333333
if options.asm: # Only output assembler file
334334
with open_file(OPTIONS.outputFileName.value, 'wt', 'utf-8') as output_file:

0 commit comments

Comments
 (0)