Example #1
0
    bool ArrayAccessInfoVisitor::visit( const Nodecl::Div& n )
    {
        // Gather LHS info
        Nodecl::NodeclBase lhs = n.get_lhs( );
        bool lhs_is_const = walk( lhs );
        bool lhs_is_adjacent_access = _is_adjacent_access;
        
        // Gather RHS info
        Nodecl::NodeclBase rhs = n.get_rhs( );
        bool rhs_is_const = walk( rhs );
        bool rhs_is_one = false;
        if( rhs_is_const )
            rhs_is_one = nodecl_is_one( rhs );
        
        // Compute adjacency info
        _is_adjacent_access = lhs_is_adjacent_access && rhs_is_one;
//         _is_adjacent_access = ( lhs_is_const && rhs_is_const )
//                            || ( lhs_is_adjacent_access && rhs_is_one );
 
        return ( lhs_is_const && rhs_is_const );
    }
        void VectorizerVisitorExpression::visit(const Nodecl::Div& n)
        {
            walk(n.get_lhs());
            walk(n.get_rhs());

            const Nodecl::VectorDiv vector_div =
                Nodecl::VectorDiv::make(
                        n.get_lhs().shallow_copy(),
                        n.get_rhs().shallow_copy(),
                        get_qualified_vector_to(n.get_type(), _vector_length),
                        n.get_locus());

            n.replace(vector_div);
        }