Skip to content
Snippets Groups Projects
Commit 6af97203 authored by Taddeus Kroes's avatar Taddeus Kroes
Browse files

Removed unused function.

parent 3d68c8fc
No related branches found
No related tags found
No related merge requests found
from utils import find_basic_blocks
def optimize_branch_jump_label(statements):
"""Optimize jumps after branches."""
out_statements = []
for i in xrange(len(statements)):
if i + 3 > len(statements):
out_statements.append(statements[i])
continue
stype, name, args = statements[i]
stype2, name2, args2 = statements[i + 1]
stype3, name3, args3 = statements[i + 2]
if stype == 'command' and name == 'beq' and \
stype2 == 'command' and name2 in ['j', 'jal'] and \
stype3 == 'label' and name3 == args['args'][2]:
out_statements.append(('command', 'bne', \
{'args': [args['args'][0], args['args'][1], args2['args'][0]]}))
out_statements.append(statements[1 + 2])
i += 3
else:
out_statements.append(statements[i])
return out_statements
def optimize_global(statements):
"""Optimize one-line statements in entire code."""
"""Optimize statement sequences in on a global level."""
old_len = -1
while old_len != len(statements):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment