This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: New function attribute "pure"
- To: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Subject: Re: New function attribute "pure"
- From: Richard Henderson <rth at cygnus dot com>
- Date: Wed, 12 Apr 2000 01:13:01 -0700
- Cc: egcs-patches at egcs dot cygnus dot com
- References: <20000410004918.A4382@atrey.karlin.mff.cuni.cz>
On Mon, Apr 10, 2000 at 12:49:18AM +0200, Jan Hubicka wrote:
> * tree.h (DECL_IS_PURE): New macro.
> (struct tree_decl): Add pure_flag.
> * c-common.c (enum attrs): Add attribute "pure".
> (init_attributes): Initialize attribute "pure"
> (decl_attributes): Handle attribute "pure".
> * extend.texi (Attribute "pure"): Document.
> * calls.c (expand_call): Add (mem:BLK (scratch)) to "equal from"
> in pure function.
> (flags_from_decl_or_type): Support attribute "pure".
Ok.
> unsigned malloc_flag : 1;
> unsigned no_limit_stack : 1;
> + unsigned pure_flag : 1;
Just musing for future cleanup:
Backends recognize attributes via lookup_attribute. I wonder if
we shouldn't do the same with some of these, so that we do not
keep bloating the DECL.
In this case it probably makes things nastier when it comes to
collecting information about functions we've compiled. But we
will never intuit anything about malloc or stack limits or ...
> + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
> + break;
> +
>
> case A_T_UNION:
Careful with extra newlines.
> + The attribute @code{const} is not implemented in GNU C versions earlier
> + than 2.96.
That should be `pure' not `const'.
r~