def rewrite_return(func): """Rewrite ret ops to assign to a variable instead, which is returned""" ret_normalization.run(func) [ret] = findallops(func, 'ret') [value] = ret.args ret.delete() return value
def test_normalize(self): mod = from_c(testfunc) func = mod.get_function("func") ret.run(func, fresh_env()) ops = opcodes(func) self.assertEqual(ops.count("ret"), 1, ops)