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
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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits