'Compile the function *impl* for the given *sig* (in nopython mode).
Return a placeholder object that\'s callable from another Numba
function.'

def compile_subroutine(self, builder, impl, sig, locals={}):

    cache_key = (impl.__code__, sig, type(self.error_model))
    if impl.__closure__:
        cache_key += tuple((c.cell_contents for c in impl.__closure__))
    ty = self.cached_internal_func.get(cache_key)
    if (ty is None):
        cres = self.compile_subroutine_no_cache(builder, impl, sig, locals=locals)
        ty = types.NumbaFunction(cres.fndesc, sig)
        self.cached_internal_func[cache_key] = ty
    return ty
