コード例 #1
0
        void VectorizerVisitorExpression::visit(const Nodecl::Mul& n)
        {
            walk(n.get_lhs());
            walk(n.get_rhs());

            const Nodecl::VectorMul vector_mul =
                Nodecl::VectorMul::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_mul);
        }
コード例 #2
0
    bool ArrayAccessInfoVisitor::visit( const Nodecl::Mul& n )
    {
        // Gather LHS info
        Nodecl::NodeclBase lhs = n.get_lhs( );
        bool lhs_is_const = walk( lhs );
//         bool lhs_is_zero = false;
        bool lhs_is_one = false;
        if( lhs_is_const )
        {
//             lhs_is_zero = nodecl_is_zero( lhs );
            lhs_is_one = nodecl_is_one( 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_zero = false;
        bool rhs_is_one = false;
        if( rhs_is_const )
        {
//             rhs_is_zero = nodecl_is_zero( rhs );
            rhs_is_one = nodecl_is_one( rhs );
        }
        bool rhs_is_adjacent_access = _is_adjacent_access;
        
        // Compute adjacency info
        _is_adjacent_access = ( lhs_is_adjacent_access && rhs_is_one ) 
                           || ( rhs_is_adjacent_access && lhs_is_one );
//         _is_adjacent_access = (lhs_is_const && rhs_is_const) 
//                            || (lhs_is_adjacent_access && (rhs_is_zero || rhs_is_one) ) 
//                            || (rhs_is_adjacent_access && (lhs_is_zero || lhs_is_one) );
        
        return ( lhs_is_const && rhs_is_const );
    }
コード例 #3
0
    int SuitableAlignmentVisitor::visit( const Nodecl::Mul& n ) 
    {
        if (is_suitable_expression(n))
        {
            return 0;
        }

        int lhs_mod = walk( n.get_lhs( ) );
        int rhs_mod = walk( n.get_rhs( ) );

       // Something suitable multiplied by anything is suitable
        if( (is_suitable_constant(lhs_mod)) || (is_suitable_constant(rhs_mod) )) 
            return 0;
        else if( ( lhs_mod > 0 ) && ( rhs_mod > 0 ) )
            return lhs_mod * rhs_mod;

        return -1;
    }