<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 12, 2013 at 8:29 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank" class="cremed">chandlerc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Furthermore, I don't why this would not be trivial to implement:<br>

<br>
 1. We add an intrinsic, like alloca, called alloca_in_caller. This is only allowed in functions marked always_inline.<br>
 2. To the analysis passes, alloca_in_caller looks like malloc<br>
 3. When the inliner inlines a alloca_in_caller call, it transforms it into an alloca call<br>
<br>
(and that's it I think). Perhaps I'm way off base, but it seems fairly simple. Is there anything else that's needed?<br></blockquote><div><br></div></div><div>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.</div>
</blockquote></div><br>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.</div></div>