[llvm-commits] Fixing Bug 13662: paired register for inline asm with 64-bit data on ARM

Weiming Zhao weimingz at codeaurora.org
Wed Dec 12 10:55:47 PST 2012


Hi Jakob,

 

The difference between dealing with linlineasm and ldrexd/strexd intrisics
is that: for intrinsics, we lower them to MachineNode, thus the framework
can get the corresponding register class via td file. For example, for
ldrexd, we only need to put a ValueType of MVT::Untyped and the framework
will allocate GPRPairRegClass.

However, for inlineasm, it doesn’t check the instructions inside of it. So
we have to manually create VRs for it and copy results back.

So I think my original patch makes sense:

 

+      unsigned GPVR = MRI.createVirtualRegister(&ARM::GPRPairRegClass);  è
create a VR here

+      PairedReg = CurDAG->getRegister(GPVR, MVT::Untyped);  è VR node

+      SDValue Chain = SDValue(N,0);

+

+      SDNode *GU = N->getGluedUser();

+      SDValue E0 =
SDValue(CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG, è extract Lo
from the VR

+                           dl, MVT::i32, MVT::Glue, PairedReg,

+                           CurDAG->getTargetConstant(ARM::gsub_0,
MVT::i32),

+                           Chain.getValue(1)), 0);

+      SDValue E1 =
SDValue(CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG, è extract Lo
from the VR

+                           dl, MVT::i32, MVT::Glue, PairedReg,

+                           CurDAG->getTargetConstant(ARM::gsub_1,
MVT::i32),

+                           E0.getValue(1)), 0);

+

+      ReplaceUses(V0, E0);

+      ReplaceUses(V1, E1);

 







 

+     // Add the new register node and skip the original two GPRs.

+      AsmNodeOperands.push_back(PairedReg); è Use this VR to replace the
two original GPR-typed VRs (The original two VRs are also created the same
way as I did in SelectionDAGBuilder.cpp: GetRegistersForValue() via
createVirtualRegister.)

 

I’m attaching my original patch.

 

Thanks,

Weiming

 

Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
The Linux Foundation

 

From: Jakob Stoklund Olesen [mailto:stoklund at 2pi.dk] 
Sent: Wednesday, December 05, 2012 4:18 PM
To: weimingz at codeaurora.org
Cc: 'Commit Messages and Patches for LLVM'; 'James Grosbach'
Subject: Re: [llvm-commits] Fixing Bug 13662: paired register for inline asm
with 64-bit data on ARM

 

 

On Dec 5, 2012, at 4:02 PM, "Weiming Zhao" <weimingz at codeaurora.org> wrote:





Now, semantically, both the REG_SEQ and Inlineasm are both defining the
result although only inlineasm is the only actual definer.

 

I am sorry, but this doesn't make sense. You just can't have multiple
defines of the same thing.

 

I think you need to start over by taking a close look at how inputs and
outputs to INLINEASM nodes work in the DAG. It's a lot like function calls.
Then figure out what the DAG should look like with GPRPair inputs and
outputs. It shouldn't be very different.

 

/jakob

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121212/aeeecf0d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-inline-asm-support-for-ldrexd-strexd.patch
Type: application/octet-stream
Size: 14817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121212/aeeecf0d/attachment.obj>


More information about the llvm-commits mailing list