[llvm-dev] Open Project : Inter-procedural Register Allocation [GSoC 2016]

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 24 14:01:55 PDT 2016


> On Mar 24, 2016, at 1:59 PM, Pete Cooper <peter_cooper at apple.com> wrote:
> 
> 
>> On Mar 24, 2016, at 1:55 PM, Mehdi Amini <mehdi.amini at apple.com <mailto:mehdi.amini at apple.com>> wrote:
>> 
>>> One more, just for fun: Inter-procedural stack allocation.  That is of calls bar, bar needs 4 bytes of stack space.  Instead of bar allocating 4 bytes, it adds an attribute to itself, then foo allocates 4 bytes of space at the bottom of the stack for bar to use.
>> 
>> This is something that can be performed with a module pass at the IR level right? The codegen would just have to be teached to recognize the attribute.
> I thought you would need to run codegen to get a specific number of bytes to allocate.  You would compile bar, note down how many bytes of stack it would have required, then add that as an attribute.  The IR level could only make a good guess as to how many bytes we need.

OK make sense. Thanks.

-- 
Mehdi



> Saying that, this is basically like having a compiler controlled redzone.  Thats what made me think of it in the first place.  If bar needed only 4 bytes, and the system supports a redzone, then its likely bar wouldn’t have allocated anything on the stack.  I just extended that so that the number of bytes is able to be larger that the number rezone’s typically provide.
> 
> Cheers,
> Pete
>> 
>> -- 
>> Mehdi
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160324/35568997/attachment.html>


More information about the llvm-dev mailing list