public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Mike Stump <mikestump@comcast.net>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	       Uros Bizjak <ubizjak@gmail.com>
Subject: Re: [PATCH] Add __builtin_stack_top
Date: Wed, 19 Aug 2015 17:08:00 -0000	[thread overview]
Message-ID: <20150819165854.GB32473@gate.crashing.org> (raw)
In-Reply-To: <CAMe9rOqLxX3h_Pn2Rn1Ph-FH41e1DfEG1qPheDLBNdycPa=sNw@mail.gmail.com>

On Wed, Aug 19, 2015 at 08:25:49AM -0700, H.J. Lu wrote:
> Here is a patch to add __builtin_argument_pointer.  I only have

Sorry to be a pain but...  all the other builtins use _address
instead of _pointer, it's probably best to follow that.

>  -- Built-in Function: void * __builtin_argument_pointer (void)
>      This function returns the argument pointer.
> 
> as documentation.  Can you suggest a better description so that it can
> be implemented also by other compilers?

Maybe something like (heavily cut'n'pasted):


@deftypefn {Built-in Function} {void *} __builtin_argument_address (void)
This function is similar to @code{__builtin_frame_address} with an
argument of 0, but it returns the address of the incoming arguments to
the current function rather than the address of its frame.

The exact definition of this address depends upon the processor and the
calling convention.  Usually some arguments are passed in registers and
the rest on the stack, and this builtin returns the address of the first
argument that is on the stack.


> +      /* Can't use DRAP if the stack address has been taken.  */
> +      if (cfun->argument_pointer_taken)
> +	sorry ("%<__builtin_argument_pointer%> not supported with stack"
> +	       " realignment.  This may be worked around by adding"
> +	       " -maccumulate-outgoing-args.");

This doesn't work with DRAP?  Pity :-(

The patch looks plausible, but I of course can not approve it.

Thanks,


Segher

  reply	other threads:[~2015-08-19 16:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 12:31 H.J. Lu
2015-08-04 15:42 ` Mike Stump
2015-08-04 15:44   ` H.J. Lu
2015-08-04 17:18     ` Mike Stump
2015-08-04 17:28       ` H.J. Lu
2015-08-04 17:43         ` Segher Boessenkool
2015-08-04 18:50           ` H.J. Lu
2015-08-04 18:51             ` H.J. Lu
2015-08-04 19:29             ` Segher Boessenkool
2015-08-04 20:00               ` H.J. Lu
2015-08-04 20:45                 ` Segher Boessenkool
2015-08-04 20:50                   ` H.J. Lu
2015-08-19 12:29                     ` H.J. Lu
2015-08-19 12:57                       ` Segher Boessenkool
2015-08-19 13:03                         ` H.J. Lu
2015-08-19 15:31                           ` H.J. Lu
2015-08-19 17:08                             ` Segher Boessenkool [this message]
2015-08-19 17:11                               ` H.J. Lu
2015-08-19 17:53                                 ` Segher Boessenkool
2015-08-19 19:13                                   ` H.J. Lu
2015-08-19 22:06                                     ` H.J. Lu
2015-08-19 22:18                                       ` Segher Boessenkool
2015-08-19 22:35                                         ` H.J. Lu
2015-08-19 22:55                                           ` Segher Boessenkool

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=20150819165854.GB32473@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=mikestump@comcast.net \
    --cc=ubizjak@gmail.com \
    /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).