This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, rtl]: Remove invalid assert from caller-save.c


> However, value of 0 is perfectly valid return value for recog_memoized.
> I learned this the hard way, as shown from generated insn-recog.c:
>
> static int
> recog_1 (rtx x0 ATTRIBUTE_UNUSED,
>      rtx insn ATTRIBUTE_UNUSED,
>      int *pnum_clobbers ATTRIBUTE_UNUSED)
> {
>    ...
>      {
>        return 0;  /* *movqi */
>      }
>    x1 = XEXP (x0, 0);
>    goto L237;
>    ...
>   ret0:
>    return -1;
> }
>
> Attached one-liner fixes this oversight.

Well, all the logic would need to be rewritten then:

static int
reg_save_code (int reg, enum machine_mode mode)
{
  bool ok;
  if (cached_reg_save_code[reg][mode])
     return cached_reg_save_code[reg][mode];

static int
reg_restore_code (int reg, enum machine_mode mode)
{
  if (cached_reg_restore_code[reg][mode])
     return cached_reg_restore_code[reg][mode];

Can't you just avoid having "movqi" associated with 0?

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]