[llvm] r219300 - Refactor isThumb1Only() && isMClass() into a predicate called isV6M()

Renato Golin renato.golin at linaro.org
Wed Oct 8 05:26:16 PDT 2014


Author: rengolin
Date: Wed Oct  8 07:26:16 2014
New Revision: 219300

URL: http://llvm.org/viewvc/llvm-project?rev=219300&view=rev
Log:
Refactor isThumb1Only() && isMClass() into a predicate called isV6M()

This must be enforced for all v6M cores, not just the cortex-m0,
irregardless of the user-specified alignment.

Patch by Charlie Turner.

Modified:
    llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp
    llvm/trunk/lib/Target/ARM/ARMSubtarget.h

Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=219300&r1=219299&r2=219300&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Wed Oct  8 07:26:16 2014
@@ -310,15 +310,14 @@ void ARMSubtarget::initSubtargetFeatures
       (hasV7Ops() && (isTargetLinux() || isTargetNaCl() ||
                       isTargetNetBSD())) ||
       (hasV6Ops() && (isTargetMachO() || isTargetNetBSD()));
-    // The one exception is cortex-m0, which despite being v6, does not
-    // support unaligned accesses. Rather than make the above boolean
-    // expression even more obtuse, just override the value here.
-    if (isThumb1Only() && isMClass())
-      AllowsUnalignedMem = false;
   } else {
     AllowsUnalignedMem = !(Align == StrictAlign);
   }
 
+  // No v6M core supports unaligned memory access (v6M ARM ARM A3.2)
+  if (isV6M())
+    AllowsUnalignedMem = false;
+
   switch (IT) {
   case DefaultIT:
     RestrictIT = hasV8Ops() ? true : false;

Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=219300&r1=219299&r2=219300&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Wed Oct  8 07:26:16 2014
@@ -405,6 +405,10 @@ public:
   bool isRClass() const { return ARMProcClass == RClass; }
   bool isAClass() const { return ARMProcClass == AClass; }
 
+  bool isV6M() const {
+    return isThumb1Only() && isMClass();
+  }
+
   bool isR9Reserved() const { return IsR9Reserved; }
 
   bool useMovt(const MachineFunction &MF) const;





More information about the llvm-commits mailing list