Refactor isThumb1Only() && isMClass() into a predicate called isV6M()
authorRenato Golin <renato.golin@linaro.org>
Wed, 8 Oct 2014 12:26:16 +0000 (12:26 +0000)
committerRenato Golin <renato.golin@linaro.org>
Wed, 8 Oct 2014 12:26:16 +0000 (12:26 +0000)
This must be enforced for all v6M cores, not just the cortex-m0,
irregardless of the user-specified alignment.

Patch by Charlie Turner.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219300 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMSubtarget.cpp
lib/Target/ARM/ARMSubtarget.h

index 5d052c087dce143063edfdd1732f86ab37a70e8b..a26fba1d50d536c848abec4757fac0e1fee6c7ab 100644 (file)
@@ -310,15 +310,14 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
       (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;
index c6e756c53b7dbf4ca6abf2e425e48419e2350bef..8c85ad73ac7465743fda7d8c16078ce227cf44ab 100644 (file)
@@ -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;