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

2017-07-18 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang added a comment.

I pushed a new patch D35531 . This implements 
the logic in llvm AArch64SubTarget which seems to be the proper place to do 
this.
Once that patch is reviewed/accepted, I will abandon this one.


https://reviews.llvm.org/D35529



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-07-18 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang added a comment.

In https://reviews.llvm.org/D35529#812427, @mstorsjo wrote:

> Wouldn't it make more sense to set this by default within LLVM, where it's 
> already enabled by default for darwin?
>
> Currently there's this code there:
>
>   AArch64Subtarget::AArch64Subtarget(const Triple , const std::string ,
>  const std::string ,
>  const TargetMachine , bool 
> LittleEndian)
>   : AArch64GenSubtargetInfo(TT, CPU, FS), ReserveX18(TT.isOSDarwin()),
>


Thanks for pointing this out. This certainly seems a cleaner way/place to do 
this. Lemme give it a shot.


https://reviews.llvm.org/D35529



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-07-18 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

Wouldn't it make more sense to set this by default within LLVM, where it's 
already enabled by default for darwin?

Currently there's this code there:

  AArch64Subtarget::AArch64Subtarget(const Triple , const std::string ,
 const std::string ,
 const TargetMachine , bool LittleEndian)
  : AArch64GenSubtargetInfo(TT, CPU, FS), ReserveX18(TT.isOSDarwin()),


https://reviews.llvm.org/D35529



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-07-17 Thread Mandeep Singh Grang via Phabricator via cfe-commits
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 ,
+DiagnosticsEngine ) override {
+// Register x18 is reserved for AArch64. We make this the default for
+// AArch64 Windows target.
+WindowsTargetInfo::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
 


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 ,
+DiagnosticsEngine ) override {
+// Register x18 is reserved for AArch64. We make this the default for
+// AArch64 Windows target.
+WindowsTargetInfo::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
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits