[llvm-branch-commits] [llvm-branch] r114944 - in /llvm/branches/Apple/Pertwee: ./ lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMSubtarget.cpp lib/Target/ARM/ARMSubtarget.h

Bob Wilson bob.wilson at apple.com
Mon Sep 27 21:48:16 PDT 2010


Author: bwilson
Date: Mon Sep 27 23:48:16 2010
New Revision: 114944

URL: http://llvm.org/viewvc/llvm-project?rev=114944&view=rev
Log:
Merging -arm-strict-align option (without
test/CodeGen/ARM/unaligned_load_store.ll because it gets a failure on Pertwee
due to differing register allocation).
--- Merging r114941 into '.':
U    lib/Target/ARM/ARMSubtarget.cpp
U    lib/Target/ARM/ARMISelLowering.cpp
U    lib/Target/ARM/ARMSubtarget.h

Modified:
    llvm/branches/Apple/Pertwee/   (props changed)
    llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMISelLowering.cpp
    llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMSubtarget.cpp
    llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMSubtarget.h

Propchange: llvm/branches/Apple/Pertwee/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 27 23:48:16 2010
@@ -1 +1 @@
-/llvm/trunk:109842,109879,110152,110170,110233,110248-110249,110254,110269,110279,110366,110589,110614,110687,111149
+/llvm/trunk:109842,109879,110152,110170,110233,110248-110249,110254,110269,110279,110366,110589,110614,110687,111149,114941

Modified: llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMISelLowering.cpp?rev=114944&r1=114943&r2=114944&view=diff
==============================================================================
--- llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMISelLowering.cpp Mon Sep 27 23:48:16 2010
@@ -4893,15 +4893,7 @@
 }
 
 bool ARMTargetLowering::allowsUnalignedMemoryAccesses(EVT VT) const {
-  if (!Subtarget->hasV6Ops())
-    // Pre-v6 does not support unaligned mem access.
-    return false;
-
-  // v6+ may or may not support unaligned mem access depending on the system
-  // configuration.
-  // FIXME: This is pretty conservative. Should we provide cmdline option to
-  // control the behaviour?
-  if (!Subtarget->isTargetDarwin())
+  if (!Subtarget->allowsUnalignedMem())
     return false;
 
   switch (VT.getSimpleVT().SimpleTy) {

Modified: llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMSubtarget.cpp?rev=114944&r1=114943&r2=114944&view=diff
==============================================================================
--- llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMSubtarget.cpp (original)
+++ llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMSubtarget.cpp Mon Sep 27 23:48:16 2010
@@ -27,6 +27,10 @@
 UseMOVT("arm-use-movt",
         cl::init(true), cl::Hidden);
 
+static cl::opt<bool>
+StrictAlign("arm-strict-align", cl::Hidden,
+            cl::desc("Disallow all unaligned memory accesses"));
+
 ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &FS,
                            bool isT)
   : ARMArchVersion(V4)
@@ -41,6 +45,7 @@
   , HasFP16(false)
   , HasHardwareDivide(false)
   , HasT2ExtractPack(false)
+  , AllowsUnalignedMem(false)
   , stackAlignment(4)
   , CPUString("generic")
   , TargetType(isELF) // Default to ELF unless otherwise specified.
@@ -116,6 +121,11 @@
 
   if (!isThumb() || hasThumb2())
     PostRAScheduler = true;
+
+  // v6+ may or may not support unaligned mem access depending on the system
+  // configuration.
+  if (!StrictAlign && hasV6Ops() && isTargetDarwin())
+    AllowsUnalignedMem = true;
 }
 
 /// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol.

Modified: llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMSubtarget.h?rev=114944&r1=114943&r2=114944&view=diff
==============================================================================
--- llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMSubtarget.h (original)
+++ llvm/branches/Apple/Pertwee/lib/Target/ARM/ARMSubtarget.h Mon Sep 27 23:48:16 2010
@@ -84,6 +84,11 @@
   /// instructions.
   bool HasT2ExtractPack;
 
+  /// AllowsUnalignedMem - If true, the subtarget allows unaligned memory
+  /// accesses for some types.  For details, see
+  /// ARMTargetLowering::allowsUnalignedMemoryAccesses().
+  bool AllowsUnalignedMem;
+
   /// stackAlignment - The minimum alignment known to hold of the stack frame on
   /// entry to the function and which must be maintained by every function.
   unsigned stackAlignment;
@@ -155,6 +160,8 @@
 
   bool useMovt() const { return UseMovt && hasV6T2Ops(); }
 
+  bool allowsUnalignedMem() const { return AllowsUnalignedMem; }
+
   const std::string & getCPUString() const { return CPUString; }
 
   /// enablePostRAScheduler - True at 'More' optimization.





More information about the llvm-branch-commits mailing list