Esempio n. 1
0
 bool ArrayAccessInfoVisitor::visit( const Nodecl::Minus& 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_adjacent_access = _is_adjacent_access;
     
     // Compute adjacency info
     _is_adjacent_access = ( lhs_is_adjacent_access && rhs_is_const )
                        || ( lhs_is_const && rhs_is_adjacent_access );
     
     return ( rhs_is_const && lhs_is_const );
 }
Esempio n. 2
0
    int SuitableAlignmentVisitor::visit( const Nodecl::Minus& n ) 
    {
        if (is_suitable_expression(n))
        {
            return 0;
        }

        int lhs_mod = walk( n.get_lhs( ) );
        int rhs_mod = walk( n.get_rhs( ) );
        
        if( ( lhs_mod >= 0 ) && ( rhs_mod >= 0 ) )
        {
            int result = lhs_mod - rhs_mod;
            if (result < 0)
                result = _alignment + result;

            return result;
        }
        
        return -1;
    }
        void VectorizerVisitorExpression::visit(const Nodecl::Minus& n)
        {
            walk(n.get_lhs());
            walk(n.get_rhs());

            const Nodecl::VectorMinus vector_minus =
                Nodecl::VectorMinus::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_minus);
        }