Skip to content

Commit 15445ef

Browse files
committed
Refactorize update_goes_and_comes
Compute this result in get_basic_blocks() as part of the DRY (specially for testing).
1 parent 2d99dd9 commit 15445ef

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

arch/zx48k/optimizer/__init__.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,6 @@ def optimize(initial_memory):
190190

191191
BLOCKS = basic_blocks = basicblock.get_basic_blocks(bb) # 1st partition the Basic Blocks
192192

193-
for x in basic_blocks:
194-
x.clean_up_comes_from()
195-
x.clean_up_goes_to()
196-
197-
for b in basic_blocks:
198-
b.update_goes_and_comes()
199-
200193
for b in basic_blocks:
201194
__DEBUG__('--- BASIC BLOCK: {} ---'.format(b.id), 1)
202195
__DEBUG__('Code:\n' + '\n'.join(' {}'.format(x) for x in b.code), 1)

arch/zx48k/optimizer/basicblock.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,4 +693,11 @@ def get_basic_blocks(block):
693693
result.insert(j, block_)
694694
result.insert(j + 1, new_block_)
695695

696+
for b in result:
697+
b.clean_up_comes_from()
698+
b.clean_up_goes_to()
699+
700+
for b in result:
701+
b.update_goes_and_comes()
702+
696703
return result

0 commit comments

Comments
 (0)