Refactor handling of Ret.

This commit is contained in:
cfreksen 2017-10-29 18:42:56 +01:00
parent a4885103c0
commit 138eb3fc72
No known key found for this signature in database
GPG Key ID: EAC13EE101008978

View File

@ -63,12 +63,16 @@ def terminate(terminator, blocks, stack_frames, ssa_env, global_env, memory):
else:
oper_v = eval_oper(oper, ssa_env, global_env)
if len(stack_frames) == 0:
return [], None, [], [], ssa_env, memory, oper_v
new_insns = []
new_terminator = None
new_blocks = {}
new_ssa_env = ssa_env
new_stack_frames = []
else:
new_insns, new_terminator, new_blocks, new_ssa_env = stack_frames[0]
new_stack_frames = stack_frames[1:]
return (new_insns, new_terminator, new_blocks, new_stack_frames,
new_ssa_env, memory, oper_v)
return (new_insns, new_terminator, new_blocks, new_stack_frames,
new_ssa_env, memory, oper_v)
elif isinstance(terminator, ll.Br):
label = terminator.label
next_block = blocks[label]