[PATCH] D35529: [COFF, ARM64] Make +reserve-x18 the default

Mandeep Singh Grang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 17 18:57:46 PDT 2017


mgrang created this revision.
Herald added subscribers: kristof.beyls, javed.absar, aemerson.

https://reviews.llvm.org/D35529

Files:
  docs/ClangCommandLineReference.rst
  lib/Basic/Targets.cpp
  test/Driver/coff-aarch64-fixed-x18.c


Index: test/Driver/coff-aarch64-fixed-x18.c
===================================================================
--- /dev/null
+++ test/Driver/coff-aarch64-fixed-x18.c
@@ -0,0 +1,5 @@
+// RUN: %clang -target aarch64-windows -emit-llvm -S %s -o - | FileCheck %s
+
+// CHECK: "target-features"{{.*}}+reserve-x18
+
+void foo() {}
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6694,6 +6694,16 @@
   BuiltinVaListKind getBuiltinVaListKind() const override {
     return TargetInfo::CharPtrBuiltinVaList;
   }
+
+  bool handleTargetFeatures(std::vector<std::string> &Features,
+                            DiagnosticsEngine &Diags) override {
+    // Register x18 is reserved for AArch64. We make this the default for
+    // AArch64 Windows target.
+    WindowsTargetInfo<AArch64leTargetInfo>::handleTargetFeatures(Features,
+                                                                 Diags);
+    Features.push_back("+reserve-x18");
+    return true;
+  }
 };
 
 class AArch64beTargetInfo : public AArch64TargetInfo {
Index: docs/ClangCommandLineReference.rst
===================================================================
--- docs/ClangCommandLineReference.rst
+++ docs/ClangCommandLineReference.rst
@@ -2073,7 +2073,7 @@
 -------
 .. option:: -ffixed-x18
 
-Reserve the x18 register (AArch64 only)
+Reserve the x18 register (AArch64 only). It is on by default for AArch64 Windows target.
 
 .. option:: -mfix-cortex-a53-835769, -mno-fix-cortex-a53-835769
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35529.107010.patch
Type: text/x-patch
Size: 1572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170718/c7913b04/attachment.bin>


More information about the cfe-commits mailing list