public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* where are caller-save addresses legitimized?
@ 2010-05-05 23:45 Greg McGary
  2010-05-06  3:21 ` Jeff Law
  0 siblings, 1 reply; 6+ messages in thread
From: Greg McGary @ 2010-05-05 23:45 UTC (permalink / raw)
  To: gcc

reload() > setup_save_areas() > assign_stack_local_1() creates a mem 
address whose offset too large to fit into the machine insn's offset 
operand.  Later, reload() > save_call_clobbered_regs() > insert_save() > 
adjust_address_1() > change_address_1() asserts because the address is 
not legitimate.

My port defines all the address legitimizing target hooks, but none are 
called with the address in question.  Where/how is the address supposed 
to be fixed-up in this case?  Or, where/how does gcc avoid producing an 
illegitimate address in the first place?

G

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: where are caller-save addresses legitimized?
  2010-05-05 23:45 where are caller-save addresses legitimized? Greg McGary
@ 2010-05-06  3:21 ` Jeff Law
  2010-05-06  3:35   ` Greg McGary
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Law @ 2010-05-06  3:21 UTC (permalink / raw)
  To: Greg McGary; +Cc: gcc

On 05/05/10 17:45, Greg McGary wrote:
> reload() > setup_save_areas() > assign_stack_local_1() creates a mem 
> address whose offset too large to fit into the machine insn's offset 
> operand.  Later, reload() > save_call_clobbered_regs() > insert_save() 
> > adjust_address_1() > change_address_1() asserts because the address 
> is not legitimate.
>
> My port defines all the address legitimizing target hooks, but none 
> are called with the address in question.  Where/how is the address 
> supposed to be fixed-up in this case?  Or, where/how does gcc avoid 
> producing an illegitimate address in the first place?
I'm not sure they are ever legitimized -- IIRC caller-save tries to only 
generate addressing modes which are safe for precisely this reason.

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: where are caller-save addresses legitimized?
  2010-05-06  3:21 ` Jeff Law
@ 2010-05-06  3:35   ` Greg McGary
  2010-05-06  4:27     ` Jeff Law
  0 siblings, 1 reply; 6+ messages in thread
From: Greg McGary @ 2010-05-06  3:35 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc

On 05/05/10 20:21, Jeff Law wrote:
> On 05/05/10 17:45, Greg McGary wrote:
>    
>> reload()>  setup_save_areas()>  assign_stack_local_1() creates a mem
>> address whose offset too large to fit into the machine insn's offset
>> operand.  Later, reload()>  save_call_clobbered_regs()>  insert_save()
>>      
>>> adjust_address_1()>  change_address_1() asserts because the address
>>>        
>> is not legitimate.
>>
>> My port defines all the address legitimizing target hooks, but none
>> are called with the address in question.  Where/how is the address
>> supposed to be fixed-up in this case?  Or, where/how does gcc avoid
>> producing an illegitimate address in the first place?
>>      
> I'm not sure they are ever legitimized -- IIRC caller-save tries to only
> generate addressing modes which are safe for precisely this reason.
>    

Apparently not so: caller save is quite capable of producing invalid 
offsets.
Perhaps my port needs some hook to help GCC produce good addresses?
I've been looking, but haven't found it yet...

G

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: where are caller-save addresses legitimized?
  2010-05-06  3:35   ` Greg McGary
@ 2010-05-06  4:27     ` Jeff Law
  2010-05-07 20:54       ` Greg McGary
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Law @ 2010-05-06  4:27 UTC (permalink / raw)
  To: Greg McGary; +Cc: gcc

On 05/05/10 21:34, Greg McGary wrote:
> On 05/05/10 20:21, Jeff Law wrote:
>> I'm not sure they are ever legitimized -- IIRC caller-save tries to only
>> generate addressing modes which are safe for precisely this reason.
>
> Apparently not so: caller save is quite capable of producing invalid 
> offsets.
> Perhaps my port needs some hook to help GCC produce good addresses?
> I've been looking, but haven't found it yet...

Try != successful :(

You might want to look at his code in init_caller_save:


   /* The following code tries to approximate the conditions under which
      we can easily save and restore a register without scratch registers or
      other complexities.  It will usually work, except under conditions 
where
      the validity of an insn operand is dependent on the address offset.
      No such cases are currently known.

      We first find a typical offset from some BASE_REG_CLASS register.
      This address is chosen by finding the first register in the class
      and by finding the smallest power of two that is a valid offset from
      that register in every mode we will use to save registers.  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: where are caller-save addresses legitimized?
  2010-05-06  4:27     ` Jeff Law
@ 2010-05-07 20:54       ` Greg McGary
  2010-05-07 21:16         ` Jeff Law
  0 siblings, 1 reply; 6+ messages in thread
From: Greg McGary @ 2010-05-07 20:54 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc

On 05/05/10 21:27, Jeff Law wrote:
> On 05/05/10 21:34, Greg McGary wrote:
>    
>> On 05/05/10 20:21, Jeff Law wrote:
>>      
>>> I'm not sure they are ever legitimized -- IIRC caller-save tries to only
>>> generate addressing modes which are safe for precisely this reason.
>>>        
>> Apparently not so: caller save is quite capable of producing invalid
>> offsets.
>> Perhaps my port needs some hook to help GCC produce good addresses?
>> I've been looking, but haven't found it yet...
>>      
> Try != successful :(
>
> You might want to look at his code in init_caller_save:
>    

Unfortunately, that didn't yield any clues.  I'll proceed by building 
some well-established RISCy target and see what it does in similar 
circumstances.

G

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: where are caller-save addresses legitimized?
  2010-05-07 20:54       ` Greg McGary
@ 2010-05-07 21:16         ` Jeff Law
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Law @ 2010-05-07 21:16 UTC (permalink / raw)
  To: Greg McGary; +Cc: gcc

On 05/07/10 14:54, Greg McGary wrote:
>
> Unfortunately, that didn't yield any clues.  I'll proceed by building 
> some well-established RISCy target and see what it does in similar 
> circumstances.
The canonical testcase for caller-save on risc targets was sparc FP code 
-- the older sparcs didn't have any call-saved FP regs.

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-05-07 21:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-05 23:45 where are caller-save addresses legitimized? Greg McGary
2010-05-06  3:21 ` Jeff Law
2010-05-06  3:35   ` Greg McGary
2010-05-06  4:27     ` Jeff Law
2010-05-07 20:54       ` Greg McGary
2010-05-07 21:16         ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).