libc++: First cut at <dynarray>

Chandler Carruth chandlerc at
Thu Sep 12 20:31:09 PDT 2013

On Thu, Sep 12, 2013 at 8:29 PM, Chandler Carruth <chandlerc at>wrote:

> Furthermore, I don't why this would not be trivial to implement:
>>  1. We add an intrinsic, like alloca, called alloca_in_caller. This is
>> only allowed in functions marked always_inline.
>>  2. To the analysis passes, alloca_in_caller looks like malloc
>>  3. When the inliner inlines a alloca_in_caller call, it transforms it
>> into an alloca call
>> (and that's it I think). Perhaps I'm way off base, but it seems fairly
>> simple. Is there anything else that's needed?
> You don't need any of the inline stuff. You just need some builtin which
> directly produces a dynamically sized alloca instruction and the
> stacksave/stackrestore pair to manage its lifetime.

Ugh, that's a lie. You need to be able to use this builtin and generate the
stack save and stack restore bits in constructors and destructors. Yuck.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the cfe-commits mailing list