[LLVMdev] How to Store variable allocation in Registers

Bruce Hoult bruce at hoult.org
Thu May 7 21:39:23 PDT 2015


What language are you compiling?

If it is anything remotely like C then you absolutely need a stack (or a
heap), because of the possibility of recursion. If the hardware doesn't
provide one then you have to create your own using a normal pointer
register (or, worst case, a global pointer variable).

It is possible to compile languages such as traditional FORTRAN and COBOL
without a stack, but you still need a frame for each function to hold the
return address and any local variables that don't fit into registers. It's
just that the frames can be allocated as global variables instead of on a
stack. You still need to calculate a frame layout. You probably even still
want a frame pointer, to avoid having possibly large absolute addresses
when referencing slots in the frame.


On Thu, May 7, 2015 at 10:06 AM, Avinash Bole <boleavinash at gmail.com> wrote:

> Hello,
>
> Im trying to build a Backend using LLVM. My Architecture doesnt have a
> stack. So,I need to store all the variables in Registers.
>
> I found in xxxFrameLowering.cpp (where xxx is any target name) references
> to stack and frame pointer. I tried to remove all those references by
> placing Register class in place of stack but of no use.
>
> Can anyone please suggest the way to do this...,would be very helpful if
> you can share some code or reference links too..
>
> Thank you,
> Avinash
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150508/d40dbed7/attachment.html>


More information about the llvm-dev mailing list