[LLVMdev] Spilling multi-word virtual registers
Ken Dyck
Ken.Dyck at onsemi.com
Wed Jul 21 07:44:37 PDT 2010
On Tuesday, July 20, 2010 4:04 PM, Jakob Stoklund Olesen
>
> On Jul 20, 2010, at 10:57 AM, Ken Dyck wrote:
>
> > Does anybody have any tips for generating spills/reloads for large
> > non-vector registers?
> > [snip]
>
>
> This is quite simple to handle. A register
> MachineOperand has a subreg field for this
> purpose. It is used to pick out subregisters
> of a virtual register.
Thanks, Jakob. That indeed was a simple fix.
> The register allocator (rewriter to be exact)
> will clear the subreg field when substituting
> the allocated physical register.
Speaking of the rewriter, I've had some problems recently where the
rewriter replaces the last of the three load instructions with a COPY
instruction because isLoadFromStackSlot() returns the same frame index
for all three load. For example,
load a.l, <fi#n>, 0 load a.l, <fi#n>, 0
load a.h <fi#n>, 1 ===> load a.h, <fi#n>, 1
load a.e <fi#n>, 3 move a.e, a.l
I quickly hacked around the problem by returning a frame index only for
the loads of the low sub-register (returning 0 for the rest), but I'm
sure this isn't the best solution. Is there a simple way to avoid the
replacement while still reporting the actual frame index for all of the
load instructions?
-Ken
More information about the llvm-dev
mailing list