Hi,

when looking for user defined "mnemonic" attribute definitions the
code so far only handles (set_attr ...).

Fixed with the attached patch.

Tested on s390x.

Ok?

Bye,

-Andreas-

2013-05-23  Andreas Krebbel  <andreas.kreb...@de.ibm.com>

        PR target/57377
        * gensupport.c (gen_mnemonic_attr): Handle (set (attr x) y) and
        (set_attr_alternative x ...) when searching for user defined
        mnemonic attribute.

---
 gcc/gensupport.c |   27 !!!!!!!!!!!!!!!!!!!!!!!!!!!
 1 file changed, 27 modifications(!)

Index: gcc/gensupport.c
===================================================================
*** gcc/gensupport.c.orig
--- gcc/gensupport.c
*************** gen_mnemonic_attr (void)
*** 2430,2443 ****
        bool found = false;
  
        /* Check if the insn definition already has
!        (set_attr "mnemonic" ...).  */
        if (XVEC (insn, 4))
        for (i = 0; i < XVECLEN (insn, 4); i++)
!         if (strcmp (XSTR (XVECEXP (insn, 4, i), 0), MNEMONIC_ATTR_NAME) == 0)
!           {
!             found = true;
!             break;
!           }
  
        if (!found)
        gen_mnemonic_setattr (mnemonic_htab, insn);
--- 2430,2458 ----
        bool found = false;
  
        /* Check if the insn definition already has
!        (set_attr "mnemonic" ...) or (set (attr "mnemonic") ...).  */
        if (XVEC (insn, 4))
        for (i = 0; i < XVECLEN (insn, 4); i++)
!         {
!           rtx set_attr = XVECEXP (insn, 4, i);
! 
!           switch (GET_CODE (set_attr))
!             {
!             case SET_ATTR:
!             case SET_ATTR_ALTERNATIVE:
!               if (strcmp (XSTR (set_attr, 0), MNEMONIC_ATTR_NAME) == 0)
!                 found = true;
!               break;
!             case SET:
!               if (GET_CODE (SET_DEST (set_attr)) == ATTR
!                   && strcmp (XSTR (SET_DEST (set_attr), 0),
!                              MNEMONIC_ATTR_NAME) == 0)
!                 found = true;
!               break;
!             default:
!               break;
!             }
!         }
  
        if (!found)
        gen_mnemonic_setattr (mnemonic_htab, insn);

Reply via email to