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: extended asm (Was: Re: decl_conflicts_with_clobbers_p problem)


On Mon, Mar 17, 2003 at 05:39:09PM +0100, Hans-Peter Nilsson wrote:
> > Date: Mon, 17 Mar 2003 14:17:57 +0100
> > From: Gunther Nikl <gni at gecko dot de>
> >
> > #define LP1NR(offs, name, t1, v1, r1, bt, bn)			\
> ...
> 
> At a cursory reading, that seems like it would work, yes.

  Thats what I had hoped to hear. Thank you for taking a look!

> >   Having pondered about the input/clobber constraint I think its not allowed
> >   because GCC might be instructed to _choose_ the input register(s), right?
> >   Since I am not an expert with GCC, the following is purely theoretical
> >   and based upon the previous assumption: If GCC shall choose input (and
> >   output) register(s) then the asm statement would contain placeholders
> >   like %0, etc. Would it be viable to allow overlaps for clobbers with
> >   inputs if the asm statement doesn't have any placeholder?
> 
> I don't understand what you mean by placeholders.

  If GCC shall insert the actual register or a value in the asm then the
  asm statement has "placeholders" like %<N> with N=0,1,etc. which GCC
  will replace with the value or register.

> I insist that the current behavior is best; that it is an error
> for an overlap of an asm clobber list with an asm-declared
> register operand to the asm.  If there are no asm-declared
> register declared operands to the asm, then GCC will not use
> registers mentioned in the clobber list for the asm operands.

  Yes, thats what the clobber list is intended for and what I initially
  got wrong. I had a different understanding for "clobbers": I viewed
  them like scratch registers in an ABI which are dead after a function
  call.

> So, what should happen when you force an input (or output) to be
> an asm-declared register mentioned in the clobber list?

  I was only concerned with _inputs_.  Overlaps with outputs can never
  be allowed since they tell the compiler the register value is dead.

> have it an error, what should GCC do?  Override the
> asm-declaration or the clobber or try to merge them?  If a merge
> is possible, how can we make sure the overlap was really
> intentional?  When should GCC warn?

  As I said, if there are any %<N> in the asm statement, then GCC should
  flag the input/clobber overlap. It should do that always for output
  overlaps.

> it really did sound like you want a change in behavior, and *that* burden
> falls on the one who wants the change.

  Oh, I see what you mean. I did only try to find out if my idea does
  make any sense and nobody had thought about it before.

  Gunther


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