[LLVMdev] Virtual Register allocation across functions
Villmow, Micah
Micah.Villmow at amd.com
Tue Oct 21 08:57:39 PDT 2008
There is no notion of recursion in the language that I am compiling from
but the target language does handle recursion. Since these are virtual
registers, as long as the virtual registers do not clobber each others
data, the lower level compiler handles the recursion and final register
allocation for me. The main issue is that all registers are global in
scope, so I can't have duplicate register uses in different functions.
My current solution is just to renumber sequentially every def register
in the program using a separate pass and allocate extra virtual
registers whenever I use up all the ones I currently have. Not the
cleanest solution, but it is working for now while I continue
understanding LLVM more.
-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
On Behalf Of Eli Friedman
Sent: Monday, October 20, 2008 5:27 PM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Virtual Register allocation across functions
On Mon, Oct 20, 2008 at 2:14 PM, Villmow, Micah <Micah.Villmow at amd.com>
wrote:
> The mov to r1024 in function 1 clobbers the data from function 0. The
only
> ways I can think to get around this, is to push every virtual register
used
> in a function to a stack or some internal data structure and then pull
them
> back out for each function call.
Just to double-check, are you planning on compiling code which uses
recursion? If you are, you have to have some way of saving registers.
-Eli
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list