[LLVMdev] [LLVMDev] Register Allocation and copy instructions

Jeff Kunkel jdkunk3 at gmail.com
Tue Nov 9 05:28:29 PST 2010


>
>
> > BB#0: derived from LLVM BB %entry
> >         %reg16390<def> = MOVZX32rm16 <fi#-2>, 1, %reg0, 0, %reg0;
> mem:LD2[FixedStack-2] GR32:%reg16390
> >         %reg16385<def> = COPY %reg16390:sub_16bit<kill>; GR16:%reg16385
> GR32:%reg16390
> >         %reg16391<def> = MOVZX32rm16 <fi#-1>, 1, %reg0, 0, %reg0;
> mem:LD2[FixedStack-1] GR32:%reg16391
> >         %reg16384<def> = COPY %reg16391:sub_16bit<kill>; GR16:%reg16384
> GR32:%reg16391
> >     Successors according to CFG: BB#1
>
> MachineOperands can refer to sub-registers of virtual registers. That is
> what is happening here. It is not specific to COPY instructions, but it
> happens a lot for them.
>
> You should look at how the other register allocators are rewriting virtual
> registers to physicals.
>
> /jakob
>
>
Thanks, it looks like all I have to do is check the 'sub_16bit' flag from
the operand. This flag makes it possible for the target register class of a
virtual register to change.

- Jeff Kunkel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101109/a22570f6/attachment.html>


More information about the llvm-dev mailing list