This is the mail archive of the gcc-patches@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: [patch] [struct-reorg] port to ssa - 47% on art on ppc


 > On 8/16/06, Olga Golovanevsky <OLGA@il.ibm.com> wrote: 
 > Dan,
 > 
 > Thank you for comments. Preparing fixes.
 > 
 > Daniel Berlin <dberlin@dberlin.org> wrote on 15/08/2006 15:54:46:
 > 
 > 
 > >
 > > Please instead use call_expr_flags (<CALL_EXPR>) & ECF_MALLOC
 > 
 > 
 > thank you for tip. I only wonder whether ECF_MALLOC stands for all
 > allocation functions, i.e. malloc, calloc, realloc, xmalloc, or only
 > for
 > malloc?
 > 
 > It only says the function has malloc behavior in that it returns a
 > pointer that
 > does not alias with any other memory.  So
 > 
 > 
 > /* Nonzero if this is a call to malloc or a related function.  */
 > #define ECF_MALLOC              4
 > 
 > 
 > is not really useful documentation ;)  flags_from_decl_or_type has the
 > slightly
 > more informative
 > 
 > 
 >      /* The function exp may have the `malloc' attribute.  */
 >      if (DECL_IS_MALLOC (exp))
 >        flags |= ECF_MALLOC;
 > 
 > Richard.

Olga,

The malloc attribute (I.e. ECF_MALLOC) does not appear on the same
list of functions as the original code you wrote.  E.g. GCC does not
set attribute malloc on the realloc function, (I think that decision
was wrong, but oh well).  However GCC does set the attribute on
calloc, alloca and str[n]dup.  Look at builtins.def for ATTR_MALLOC_*.
Libiberty sets the attribute on xmalloc because it provides an
implementation.  I think it's a mistake for you to hardcode xmalloc
inside GCC since it's a user-space identifier.

So just FYI, be aware if you use ECF_MALLOC there will be a subtle
difference in the code from what you originally wrote.

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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