Beispiel #1
0
 def run_pass(self, state):
     """
     Extract with-contexts
     """
     main, withs = transforms.with_lifting(
         func_ir=state.func_ir,
         typingctx=state.typingctx,
         targetctx=state.targetctx,
         flags=state.flags,
         locals=state.locals,
     )
     if withs:
         from numba.compiler import compile_ir, _EarlyPipelineCompletion
         cres = compile_ir(state.typingctx,
                           state.targetctx,
                           main,
                           state.args,
                           state.return_type,
                           state.flags,
                           state.locals,
                           lifted=tuple(withs),
                           lifted_from=None,
                           pipeline_class=type(state.pipeline))
         raise _EarlyPipelineCompletion(cres)
     return True
Beispiel #2
0
    def run_pass(self, state):
        from numba.compiler import _EarlyPipelineCompletion
        # NOTE: That so much stuff, including going back into the compiler, is
        # captured in a single pass is not ideal.
        if state.flags.enable_looplift:
            assert not state.lifted
            cres = self._frontend_looplift(state)
            if cres is not None:
                raise _EarlyPipelineCompletion(cres)

        # Fallback typing: everything is a python object
        state.typemap = defaultdict(lambda: types.pyobject)
        state.calltypes = defaultdict(lambda: types.pyobject)
        state.return_type = types.pyobject
        return True