Yes, I should have thought about it too. The error message threw me a
bit off, thanks for clearing that. Thanks for that !

Final question about this all:

I have a cost adjustment to make if the register operand 0 is used
later on. Basically, if that one is used, I have a +6 cost otherwise
if it's simply the 66 register, it's +1 cost.

I added this to the adjust_cost function :

    /* Otherwise, if one is our instruction, we must check the dependencies */
    if (isMyInst (dep_insn))
    {
        // Get statement
        rtx stmt = PATTERN (dep_insn);
        // Get target of the set, it's our instruction, we know where
it is exactly
        int regno = REGNO (SET_DEST (XVECEXP (stmt, 0, 0)));

        /* Depending on if the def of dep_insn is used in insn, we
adjust the cost */
        bitmap tmp_uses = BITMAP_ALLOC (&reg_obstack);

        /* Get the uses */
        df_simulate_uses (insn, tmp_uses);

        /* If ever one of the uses is our Set, add 6 */
        if (bitmap_bit_p (tmp_uses, regno))
        {
            cost += 6;
        }

        /* Free bitmap */
        BITMAP_FREE (tmp_uses), tmp_uses = NULL;
    }

Basically, my question is: I'm using the df_simulate_uses because
that's the simplest I know how to get all the uses. Is this safe
without doing a df_analyse at the beginning of the adjust_cost
function ?

It works but I'd like to get some input on it.

Thanks again,
Jc

On Thu, Mar 4, 2010 at 6:42 PM, Andrew Pinski <pins...@gmail.com> wrote:
> On Thu, Mar 4, 2010 at 3:38 PM, Jean Christophe Beyler
> <jean.christophe.bey...@gmail.com> wrote:
>> Yeah that's what I had tried first but I get :
>>
>> genextract: Internal error: abort in VEC_safe_set_locstr
>>
>> And I can't seem to get rid of that error.
>>
>> Any idea why this happens?
>
> Oh because the second time for the match_operand, you should be using
> match_dup (and yes the error message should be better).  I had forgot
> about that :).
> So try this:
> (define_insn "myInst"
>  [
>  (set (match_operand:DI 0 "register_operand" "=r")
>  (unspec:DI [(match_operand:DI 1 "register_operand" "r")
>  (match_operand:DI 2 "register_operand" "r")
>  (reg:DI 66)] 5))
> (set (reg:DI 66)
>  (unspec:DI [(match_dup 1)
>  (match_dup 2)
>  (reg:DI 66)] 6))
>  ]
>  ""
>  "myInst\\t%0,%1,%2"
>  [(set_attr "type"     "arith")
>  (set_attr "mode"     "DI")
>  (set_attr "length"   "1")])
>
>
> Thanks,
> Andrew Pinski
>

Reply via email to