[llvm-commits] [llvm] r118888 - /llvm/trunk/lib/Target/ARM/ARMFastISel.cpp

Eric Christopher echristo at apple.com
Fri Nov 12 01:48:30 PST 2010


Author: echristo
Date: Fri Nov 12 03:48:30 2010
New Revision: 118888

URL: http://llvm.org/viewvc/llvm-project?rev=118888&view=rev
Log:
Fix up a few more spots of addrmode2 (or not) changes that were
missed. Update some comments accordingly.

Fixes rdar://8652289

Modified:
    llvm/trunk/lib/Target/ARM/ARMFastISel.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=118888&r1=118887&r2=118888&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Fri Nov 12 03:48:30 2010
@@ -460,7 +460,7 @@
                             TII.get(ARM::t2LDRpci), DestReg)
                     .addConstantPoolIndex(Idx));
   else
-    // The extra reg and immediate are for addrmode2.
+    // The extra immediate is for addrmode2.
     AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
                             TII.get(ARM::LDRcp), DestReg)
                     .addConstantPoolIndex(Idx)
@@ -505,11 +505,11 @@
     if (RelocM == Reloc::PIC_)
       MIB.addImm(Id);
   } else {
-    // The extra reg and immediate are for addrmode2.
+    // The extra immediate is for addrmode2.
     MIB = BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(ARM::LDRcp),
                   DestReg)
           .addConstantPoolIndex(Idx)
-          .addReg(0).addImm(0);
+          .addImm(0);
   }
   AddOptionalDefs(MIB);
   return DestReg;
@@ -790,9 +790,15 @@
   if (isFloat)
     Offset /= 4;
 
-  AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
-                          TII.get(Opc), ResultReg)
-                  .addReg(Base).addImm(Offset));
+  // LDRH needs an additional operand.
+  if (!isThumb && VT.getSimpleVT().SimpleTy == MVT::i16)
+    AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
+                            TII.get(Opc), ResultReg)
+                    .addReg(Base).addReg(0).addImm(Offset));
+  else
+    AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
+                            TII.get(Opc), ResultReg)
+                    .addReg(Base).addImm(Offset));
   return true;
 }
 





More information about the llvm-commits mailing list