(blocks, func_ir, typemap, accesses=None)
return accesses
returns a set of arrays accessed and their indices.
returns a set of arrays accessed and their indices.
returns a set of arrays accessed and their indices .
def _get_array_accesses(blocks, func_ir, typemap, accesses=None):
    """returns a set of arrays accessed and their indices.
    """
    if accesses is None:
        accesses = set()

    for block in blocks.values():
        for inst in block.body:
            if isinstance(inst, ir.SetItem):
                accesses.add((inst.target.name, inst.index.name))
            if isinstance(inst, ir.StaticSetItem):
                accesses.add((inst.target.name, inst.index_var.name))
            if isinstance(inst, ir.Assign):
                lhs = inst.target.name
                rhs = inst.value
                if isinstance(rhs, ir.Expr) and rhs.op == 'getitem':
                    accesses.add((rhs.value.name, rhs.index.name))
                if isinstance(rhs, ir.Expr) and rhs.op == 'static_getitem':
                    index = rhs.index
                    # slice is unhashable, so just keep the variable
                    if index is None or ir_utils.is_slice_index(index):
                        index = rhs.index_var.name
                    accesses.add((rhs.value.name, index))
                if isinstance(rhs, ir.Expr) and rhs.op == 'call':
                    fdef = guard(find_callname, func_ir, rhs, typemap)
                    if fdef is not None:
                        if fdef == ('get_split_view_index', 'sdc.hiframes.split_impl'):
                            accesses.add((rhs.args[0].name, rhs.args[1].name))
                        if fdef == ('setitem_str_arr_ptr', 'sdc.str_arr_ext'):
                            accesses.add((rhs.args[0].name, rhs.args[1].name))
                        if fdef == ('str_arr_item_to_numeric', 'sdc.str_arr_ext'):
                            accesses.add((rhs.args[0].name, rhs.args[1].name))
                            accesses.add((rhs.args[2].name, rhs.args[3].name))
            for T, f in array_accesses_extensions.items():
                if isinstance(inst, T):
                    f(inst, func_ir, typemap, accesses)
    return accesses
def _get_array_accesses ( blocks , func_ir , typemap , accesses = None ) : if accesses is None : accesses = set ( ) for block in blocks . values ( ) : for inst in block . body : if isinstance ( inst , ir . SetItem ) : accesses . add ( ( inst . target . name , inst . index . name ) ) if isinstance ( inst , ir . StaticSetItem ) : accesses . add ( ( inst . target . name , inst . index_var . name ) ) if isinstance ( inst , ir . Assign ) : lhs = inst . target . name rhs = inst . value if isinstance ( rhs , ir . Expr ) and rhs . op == 'getitem' : accesses . add ( ( rhs . value . name , rhs . index . name ) ) if isinstance ( rhs , ir . Expr ) and rhs . op == 'static_getitem' : index = rhs . index # slice is unhashable, so just keep the variable if index is None or ir_utils . is_slice_index ( index ) : index = rhs . index_var . name accesses . add ( ( rhs . value . name , index ) ) if isinstance ( rhs , ir . Expr ) and rhs . op == 'call' : fdef = guard ( find_callname , func_ir , rhs , typemap ) if fdef is not None : if fdef == ( 'get_split_view_index' , 'sdc.hiframes.split_impl' ) : accesses . add ( ( rhs . args [ 0 ] . name , rhs . args [ 1 ] . name ) ) if fdef == ( 'setitem_str_arr_ptr' , 'sdc.str_arr_ext' ) : accesses . add ( ( rhs . args [ 0 ] . name , rhs . args [ 1 ] . name ) ) if fdef == ( 'str_arr_item_to_numeric' , 'sdc.str_arr_ext' ) : accesses . add ( ( rhs . args [ 0 ] . name , rhs . args [ 1 ] . name ) ) accesses . add ( ( rhs . args [ 2 ] . name , rhs . args [ 3 ] . name ) ) for T , f in array_accesses_extensions . items ( ) : if isinstance ( inst , T ) : f ( inst , func_ir , typemap , accesses ) return accesses