[PATCH] Implement malloc/free hoisting from loops (PR21046 and friends)

Xinliang David Li davidxl@google.com
Thu May 13 22:09:00 GMT 2010


On Thu, May 13, 2010 at 2:50 PM, Mark Mitchell <mark@codesourcery.com> wrote:
> Xinliang David Li wrote:
>
>> Even user does not provide his own definition, how does he know that
>> the underlying implementation (e.g, from glibc, or from system library
>> of the target OS) matches the 'expec ction' of the builtin? The
>> problem here is that unlike builtin intrinsics, built-in functions are
>> not tied to any actual implementation -- the standard conforming
>> assumption by gcc of the 'builtin' can easily break.
>
> This isn't an issue that's in any way specific to malloc.

Right.

> In general,
> when you call a standard function, GCC may either (a) generate inline
> code, (b) call that function, or (c) call some other function.

Or combination of those transformation, or making assumption in
aliasing/moduse analysis etc on those.

>  (An
> example of (c) is replacing a call to "printf" with a constant string
> with a call to "puts".)
>

These are the ones like stringops which are 'immune' to implementation
details. Again it would be helpful if things like pragma builtin or
attribute(builtin) are thrown in the header.

David

> --
> Mark Mitchell
> CodeSourcery
> mark@codesourcery.com
> (650) 331-3385 x713
>



More information about the Gcc-patches mailing list