def _do_if_to_phi(func, *phi_args): for dec in ( begin_rewrite(), if_to_phi(*phi_args), end_rewrite()): func = dec(func) return func
def _do_inline(func, **kwargs): for dec in ( begin_rewrite(), debug(**kwargs), if_inline(), debug(**kwargs), end_rewrite()): func = dec(func) return func
def deco(cls): if not self._passes: return cls # only rewrite if necesarry call = cls.__call__ call = begin_rewrite(env=env)(call) for dec in self._passes: call = dec(call) call = end_rewrite()(call) cls.__call__ = call return cls
def _do_ssa(func, strict, **kwargs): for dec in (begin_rewrite(), debug(**kwargs), ssa(strict), debug(**kwargs), end_rewrite()): func = dec(func) return func