From: Akira Hatanaka Date: Wed, 29 Jul 2015 14:25:58 +0000 (+0000) Subject: [AArch64] Pass subtarget feature "+strict-align". X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7f4cbb43f9361bf2b7fab95260eb3d4194dc246;p=clang [AArch64] Pass subtarget feature "+strict-align". This commit changes the driver to save subtarget feature "+strict-align" to the IR instead of using backend option "aarch64-strict-align". This is needed for LTO. rdar://problem/21529937 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243518 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index f554cae8c1..bd8f25f603 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -983,15 +983,6 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args, CmdArgs.push_back("-target-abi"); CmdArgs.push_back(ABIName); - if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access, - options::OPT_munaligned_access)) { - CmdArgs.push_back("-backend-option"); - if (A->getOption().matches(options::OPT_mno_unaligned_access)) - CmdArgs.push_back("-aarch64-strict-align"); - else - CmdArgs.push_back("-aarch64-no-strict-align"); - } - if (Arg *A = Args.getLastArg(options::OPT_mfix_cortex_a53_835769, options::OPT_mno_fix_cortex_a53_835769)) { CmdArgs.push_back("-backend-option"); @@ -2068,6 +2059,11 @@ static void getAArch64TargetFeatures(const Driver &D, Features.push_back("-crc"); } + if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access, + options::OPT_munaligned_access)) + if (A->getOption().matches(options::OPT_mno_unaligned_access)) + Features.push_back("+strict-align"); + if (Args.hasArg(options::OPT_ffixed_x18) || Triple.isOSDarwin()) Features.push_back("+reserve-x18"); } diff --git a/test/Driver/arm-alignment.c b/test/Driver/arm-alignment.c index 21caf83edb..21a29192a5 100644 --- a/test/Driver/arm-alignment.c +++ b/test/Driver/arm-alignment.c @@ -29,7 +29,7 @@ // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s // CHECK-UNALIGNED-ARM-NOT: "-target-feature" "+strict-align" -// CHECK-UNALIGNED-AARCH64: "-backend-option" "-aarch64-no-strict-align" +// CHECK-UNALIGNED-AARCH64-NOT: "-target-feature" "+strict-align" // RUN: %clang -target arm-none-gnueabi -mno-unaligned-access -### %s 2> %t @@ -75,7 +75,7 @@ // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s // CHECK-ALIGNED-ARM: "-target-feature" "+strict-align" -// CHECK-ALIGNED-AARCH64: "-backend-option" "-aarch64-strict-align" +// CHECK-ALIGNED-AARCH64: "-target-feature" "+strict-align" // Make sure that v6M cores always trigger the unsupported aligned accesses error // for all supported architecture triples.