public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Wolfgang Kuehn" <wolfgang.kuehn@kristensen.de>
To: <gcc@gcc.gnu.org>
Subject: Re: register variable is clobbered by passing parameter to a function
Date: Tue, 16 Mar 2004 14:18:00 -0000	[thread overview]
Message-ID: <002d01c40b61$85d30970$406510ac@B1WS064> (raw)

> > Wolfgang, your best bet is probably to just add -fixed-r16 to your
> >compile-time flags.  And don't call any library functions that were
compiled
> >without it.

-ffixed-r16 has no effect at passing.

>> This is AVR, and he is trying to use r16.  According to
>> function_arg_regno_p() in avr.c, that register can be used to
> >pass parameters to functions.  gcc can't handle declaring a
>> register used for parameter passing as fixed.

>Ah.  Then my advice should have been "Change r16 to some safer register."
>Hopefully that should then suffice to make his global-register-var work
>correctly and there isn't actually a bug in gcc.

  Some safer register are r4,r5 and r6. And there is no effect by passing
parameters. But the register r16 (and all other above this) are more
efficient, because you can load only these immediately (ldi r16,0x10) ,
set/reset bits (sbr r17,1) and other very effective instructions.
Its a pity not to exhaust the complete power of this little processor.

In moment the best workaround for my application is not to pass more than
four (char) parameters to a function, so I am free to use the powerful
r16-register.

>The best bet might be to add a bit more
>documentation to the register-vars pages, indicating that registers chosen
>should not be call-used or fixed-for-other-purposes-by-the-abi.

Thats very welcome.

Last question: what means ABI ?

best regards
wolfgang

             reply	other threads:[~2004-03-16 14:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-16 14:18 Wolfgang Kuehn [this message]
2004-03-16 14:47 ` Ian Lance Taylor
  -- strict thread matches above, loose matches on Subject: below --
2004-03-15 10:54 Wolfgang Kuehn
2004-03-15 22:51 ` Richard Henderson
2004-03-16 11:50   ` Wolfgang Kuehn
2004-03-16 12:30     ` Michael Matz
2004-03-16 12:39       ` Michael Matz
2004-03-16 12:43       ` Dave Korn
2004-03-16 13:00         ` Ian Lance Taylor
2004-03-16 13:21           ` Dave Korn
2004-03-16 10:20 ` Dave Korn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002d01c40b61$85d30970$406510ac@B1WS064' \
    --to=wolfgang.kuehn@kristensen.de \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).