[ARM64] Enable alignment control option in front-end for ARM64.
authorKevin Qin <Kevin.Qin@arm.com>
Tue, 6 May 2014 09:48:52 +0000 (09:48 +0000)
committerKevin Qin <Kevin.Qin@arm.com>
Tue, 6 May 2014 09:48:52 +0000 (09:48 +0000)
This is the modification in llvm part.

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

lib/Target/ARM64/ARM64ISelLowering.cpp
test/CodeGen/ARM64/strict-align.ll

index f95308b5c47525eccf1be15ffcf8b78148c09b45..7de9d079ed2193cd006aa7512e7f1c122aec76d6 100644 (file)
@@ -45,9 +45,20 @@ EnableARM64TailCalls("arm64-tail-calls", cl::Hidden,
                      cl::desc("Generate ARM64 tail calls (TEMPORARY OPTION)."),
                      cl::init(true));
 
-static cl::opt<bool>
-StrictAlign("arm64-strict-align", cl::Hidden,
-            cl::desc("Disallow all unaligned memory accesses"));
+enum AlignMode {
+  StrictAlign,
+  NoStrictAlign
+};
+
+static cl::opt<AlignMode>
+Align(cl::desc("Load/store alignment support"),
+      cl::Hidden, cl::init(NoStrictAlign),
+      cl::values(
+          clEnumValN(StrictAlign,   "arm64-strict-align",
+                     "Disallow all unaligned memory accesses"),
+          clEnumValN(NoStrictAlign, "arm64-no-strict-align",
+                     "Allow unaligned memory accesses"),
+          clEnumValEnd));
 
 // Place holder until extr generation is tested fully.
 static cl::opt<bool>
@@ -370,7 +381,7 @@ ARM64TargetLowering::ARM64TargetLowering(ARM64TargetMachine &TM)
 
   setMinFunctionAlignment(2);
 
-  RequireStrictAlign = StrictAlign;
+  RequireStrictAlign = (Align == StrictAlign);
 
   setHasExtractBitsInsn(true);
 
index 2fbe47ce5686037e3b3fa08db9406f3df821ee9e..48a1528b5cd168b6b23ffe656d04524964d5036b 100644 (file)
@@ -1,4 +1,5 @@
 ; RUN: llc < %s -mtriple=arm64-apple-darwin | FileCheck %s
+; RUN: llc < %s -mtriple=arm64-apple-darwin -arm64-no-strict-align | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-apple-darwin -arm64-strict-align | FileCheck %s --check-prefix=CHECK-STRICT
 
 define i32 @f0(i32* nocapture %p) nounwind {