This is the mail archive of the gcc@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: Saga of m68k PIC continues


>> >GCC will happily put in the subreg when your machine description accept
>> >it.
>> 
>> I don't see how subregs take care of -fPIC and (unspec ...).  Could
>> you explain?
>Oops, I meant symbol_ref, of course...

Ok, that makes more sense.

>> Do you mean that GO_IF_LEGITIMATE_ADDRESS needs to reject a raw
>> (symbol_ref:SI ("foo")) if in pic mode,  which would then force the
>> addr to be pushed through LEGITIMIZE_ADDRESS(I think) where it would
>> spot the raw symbol_ref in pic mode and by wrap it in a (const
>> (uspec:SI [...] 3))? 
>Yes, and additionally you need LEGITIMATE_PIC_OPERAND_P to reject
>symbol_ref as immediate operands.

I've got:

int
legitimate_pic_operand_p (op)
     rtx op;
{
  if (!SYMBOLIC_CONST (op))
    return 1;
  return legitimate_pic_address_disp_p (op);
}

int
legitimate_pic_address_disp_p (disp)
     register rtx disp;
{
  if (GET_CODE (disp) != CONST)
    return 0;
  disp = XEXP (disp, 0);

  if (GET_CODE (disp) == PLUS)
    {
      if (GET_CODE (XEXP (disp, 1)) != CONST_INT)
	return 0;
      disp = XEXP (disp, 0);
    }

  if (GET_CODE (disp) != UNSPEC
      || XVECLEN (disp, 0) != 1)
    return 0;

  /* Must be @GOT or @GOTOFF.  */
  switch (XINT (disp, 1))
    {
    case 6: /* @GOT */
      return GET_CODE (XVECEXP (disp, 0, 0)) == SYMBOL_REF;

    case 7: /* @GOTOFF */
      return local_symbolic_operand (XVECEXP (disp, 0, 0), Pmode);
    }
    
  return 0;
}

And it doesn't stop on a breakpoint at legitimate_pic_operand_p()
while compiling the really simple program so that's not what's
stripping off the (const ... ).

-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)


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