From 7792fde854b5d2bb9d2dc18b4a1de09397307220 Mon Sep 17 00:00:00 2001 From: Weiming Zhao Date: Wed, 13 Nov 2013 18:31:23 +0000 Subject: [PATCH] Adds ARM backend options: -mrestrict-it and -mno-restrict-it To support the generation of IT block in Thumbv7 way or Thumbv8 way git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194593 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/Options.td | 4 ++++ lib/Driver/Tools.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index e03bc11f65..614c1dfc5b 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -1029,6 +1029,10 @@ def mno_unaligned_access : Flag<["-"], "mno-unaligned-access">, Group, Alias, Flags<[CC1Option,HelpHidden]>, HelpText<"Force all memory accesses to be aligned (ARM only, same as mno-unaligned-access)">; def mno_thumb : Flag<["-"], "mno-thumb">, Group; +def mrestrict_it: Flag<["-"], "mrestrict-it">, Group, + HelpText<"Disallow generation of deprecated IT blocks for ARMv8. It is on by default for ARMv8 Thumb mode.">; +def mno_restrict_it: Flag<["-"], "mno-restrict-it">, Group, + HelpText<"Allow generation of deprecated IT blocks for ARMv8. It is off by default for ARMv8 Thumb mode">; def marm : Flag<["-"], "marm">, Alias; def ffixed_r9 : Flag<["-"], "ffixed-r9">, Group, HelpText<"Reserve the r9 register (ARM only)">; diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index a4e4672ab9..eed0689049 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -3072,6 +3072,17 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } } + if (Arg *A = Args.getLastArg(options::OPT_mrestrict_it, + options::OPT_mno_restrict_it)) { + if (A->getOption().matches(options::OPT_mrestrict_it)) { + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-arm-restrict-it"); + } else { + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-arm-no-restrict-it"); + } + } + // Forward -f options with positive and negative forms; we translate // these by hand. if (Arg *A = Args.getLastArg(options::OPT_fprofile_sample_use_EQ)) { -- 2.40.0