[LLVMdev] request for help writing a register allocator
Susan Horwitz
horwitz at cs.wisc.edu
Thu Oct 22 06:46:56 PDT 2009
I found the problem! My generated code is spilling correctly but is not
reloading at all. For example, if the original code has the equivalent of
this (where %1024 is a virtual reg):
%1024 = xxx
...
yyy = %1024
and I find no physical register for %1024, then I assign it to physical
register %edi and to a stackslot. That creates code like this:
%edi = xxx
store from %edi to the stack
...
yyy = %edi
The last instruction is wrong. There needs to be a load from the
stackslot into %edi before copying from there into yyy.
The documentation says:
If the indirect strategy is used, after all the virtual registers
have been mapped to physical registers or stack slots, it is
necessary to use a spiller object to place load and store
instructions in the code. Every virtual that has been mapped to a
stack slot will be stored to memory after been defined and will be
loaded before being used.
But this doesn't seem to be happening; the stores to memory are there but
the loads are not.
Any ideas what's going wrong?
If not, any advice on how to generate the loads myself??
Susan
More information about the llvm-dev
mailing list