I fixed some of the clear issues you mentioned, I think I was messing with the code and when I sent the email it was in a state that didn't quite make sense for the reasons you mentioned.  I think you're approach of using physical register operands would work, if I can implement a multiple destination DMC1 instruction, or get the superRegister that I created which spans my calculated argument registers.  <br>
<br>I don't see any examples of multiple destination instructions, and I don't know how to implement them in the DAG, so the second option seems pretty viable.  If I have two registers (like a0 and a1), how do I get the register that spans them?<br>
<br><div class="gmail_quote">On Mon, Oct 8, 2012 at 8:52 PM, Akira Hatanaka <span dir="ltr"><<a href="mailto:ahatanak@gmail.com" target="_blank">ahatanak@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Ryan,<br><br>I don't think I fully understand the problem you described, but please see the comments below.<br>Hope this helps you solve the problem.<div class="im"><br><br>On Sat, Oct 6, 2012 at 3:18 PM, ryan baird <span dir="ltr"><<a href="mailto:ryanrbaird@gmail.com" target="_blank">ryanrbaird@gmail.com</a>></span> wrote:<br>

</div><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'm working on a target based on the MIPS target, and when I copy f64 values into 32 bit registers for calling functions, I need the operation to work on a of 32 bit registers (because the language I'm translating to isn't actually mips).  I've been looking at how to do this, but I haven't been able to figure it out.  Since the Mips target code is still really close to mine, I'll use it's code to explain relavent details.  Any help would be highly appreciated.<br>


<br>The idea I tried to implement to accomplish this is to create a 64 bit register class that is set up to span two 32 bit registers in the same way as the 64 bit floats span two 32 bit floating point registers in mips.  Creating the register class is easy enough to implement in the RegisterInfo.td file.   <br>


<br>The next thing I wanted to do is create a Pseudo-Element similar to the ExtractElementF64 in mips. I added the following Code to InstrFPU.td (and added the CopyF64 ISD to another file):<br><br>    def SDT_MipsCopyF64 : SDTypeProfile<1, 1, [SDTCisVT<0, i64>,<br>


                                          SDTCisVT<1, f64>]>;<br><br>    def MipsCopyF64 : SDNode<"MIPSISD::CopyF64",<br>                                   SDT_MIPSCopyF64>;<br><br>I also changed CPU64Regs to CPU64PRegs ( My 64 bit paired register class) in the DMFC1 rule for testing.<br>


<br>Next, I added the code in ExpandPseudo to use the following pseudo instruction expansion:<br><br>    void MipsExpandPseudo::ExpandCopyF64(MachineBasicBlock& MBB,<br>                                               MachineBasicBlock::iterator I) {<br>


      unsigned DstReg = I->getOperand(0).getReg();<br>      unsigned SrcReg = I->getOperand(1).getReg();<br>      const MCInstrDesc& Dmfc1Tdd = TII->get(MIPS::DMFC1);<br><br>      DebugLoc dl = I->getDebugLoc();<br>


      const uint16_t* SubReg = TM.getRegisterInfo()->getSubRegisters(SrcReg);<br><br>      BuildMI(MBB, I, dl, Dmfc1Tdd, DstReg).addReg(*SubReg);<br>    }<br><br></blockquote></div><div><br>If I understand correctly what you are trying to do, DMFC1 is supposed to read a f64 register and copy it to a pair of i32 registers. This code doesn't seem to be doing that. Why do you need a sub-register of SrcReg, if it is a f64 register? <br>

<br> </div><div class="im"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Finally, I want to add the rule to ISelLowering to actually use these rules.  Under the CCValAssign::Full case in the LowerCall function, here is the old code:<br>


          SDValue Lo = DAG.getNode(MIPSISD::ExtractElementF64, dl, MVT::i32,<br>                                   Arg, DAG.getConstant(0, MVT::i32));<br>          SDValue Hi = DAG.getNode(MIPSISD::ExtractElementF64, dl, MVT::i32,<br>


                                   Arg, DAG.getConstant(1, MVT::i32));<br><br>          if (!Subtarget->isLittle())<br>            std::swap(Lo, Hi);<br><br>          unsigned LocRegLo = VA.getLocReg();<br>          unsigned LocRegHigh = getNextIntArgReg(LocRegLo);<br>


<br>          RegsToPass.push_back(std::make_pair(LocRegLo, Lo));<br>          RegsToPass.push_back(std::make_pair(LocRegHigh, Hi));<br><br>I added this SDValue: <br>    SDValue Num = DAG.getNode(MIPSISD::CopyF64,dl,MVT::i32, Arg);<br>


<br></blockquote></div><div><br>Doesn't this code violate SDT_MipsCopyF64's constraint? CopyF64's value type should be i64, but the value type of the node created is i32.<br> <br></div><div class="im"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

But I need to create a Hi and a Lo SDValue to add to the RegsToPass pairs seen in the code above.  If someone would help me figure out what goes here, I would be very thankful:<br>    SDValue Hi = ?<br>    SDValue Lo = ?<br>


<br><br><br></blockquote></div><div><br>
Is it possible to just emit a DMFC1 instruction with physical register operands?<br>
Something like this:<br>
<br>
(A0, A1) = DMFC1 vreg0<br>
JALR T9, A0, A1<br>
<br><br>
I think it's easier than trying to force or guide register allocator to assign successive even-odd i32 registers to DMFC1's destination registers.<br>
<br></div><div class="im"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div></div><br>
</blockquote></div><br>