[LLVMdev] Req-sequence, partial defs

Jonas Paulsson jonas.paulsson at ericsson.com
Tue Jan 24 07:44:20 PST 2012


Hi,

I'm having an issue with subregisters on my target.

With a pseudo that writes to a 32 bit reg:

        %vreg20<def> = toHi16_low0_pseudo %vreg2; reg32:%vreg20 hi16:%vreg2

expands to

        %vreg2<def> = COPY %a2h; hi16:%vreg2
        %vreg43<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>; lo16:%vreg43
        %vreg20<def> = REG_SEQUENCE %vreg2, hi16, %vreg43, lo16; reg32:%vreg20 hi16:%vreg2 lo16:%vreg43

Becomes

16L             %vreg20:hi16<def,undef> = COPY %a2h<kill>, %vreg20<imp-def>; reg32:%vreg20
368L            %vreg20:lo16<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>; reg32:%vreg20

Becomes

 Live Ins: %a0h %a1_32 %a2h %a3_32
        ... (COPY coalesced as a2h is live in)
        %a2l<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>, %a2_32<imp-use>

results in:

** Bad machine code: Using an undefined physical register ***
- function:    lfixedconv8
- basic block:  0x91a1940 (BB#0)
- instruction: %a2l<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>, %a2_32<imp-use>
- operand 6:   %a2_32<imp-use>


I cannot quite figure what's wrong here - the a2_32<imp-use> operand was added by the VirtualRegRewriter, because the partial def was not marked undef. The reason for this was that the LiveIntervalsAnalysis pass cleaned up after REG_SEQUENCE lowering by making the first occurence - when the interval for the reg was empty and thus created - an <def,undef>, but then it does not do the same for the other subreg, as at that time the interval for the reg is not empty.

Can anyone say what went wrong?

Thanks,

Jonas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120124/31044d1b/attachment.html>


More information about the llvm-dev mailing list