[PATCH] D31197: [ARM] Add a driver option for +no-neg-immediates
Sanne Wouda via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 21 11:08:36 PDT 2017
sanwou01 created this revision.
Herald added a subscriber: aemerson.
https://reviews.llvm.org/D31197
Files:
include/clang/Driver/Options.td
lib/Driver/ToolChains/Arch/ARM.cpp
test/Driver/arm-no-neg-immediates.c
Index: test/Driver/arm-no-neg-immediates.c
===================================================================
--- /dev/null
+++ test/Driver/arm-no-neg-immediates.c
@@ -0,0 +1,5 @@
+// RUN: %clang -target arm-none-gnueabi -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT
+// RUN: %clang -target arm-none-gnueabi -mno-neg-immediates -### %s 2>&1 | FileCheck %s
+
+// CHECK: "-target-feature" "+no-neg-immediates"
+// CHECK-DEFAULT-NOT: "+no-no-neg-immediates"
Index: lib/Driver/ToolChains/Arch/ARM.cpp
===================================================================
--- lib/Driver/ToolChains/Arch/ARM.cpp
+++ lib/Driver/ToolChains/Arch/ARM.cpp
@@ -449,6 +449,9 @@
// The kext linker doesn't know how to deal with movw/movt.
if (KernelOrKext || Args.hasArg(options::OPT_mno_movt))
Features.push_back("+no-movt");
+
+ if (Args.hasArg(options::OPT_mno_neg_immediates))
+ Features.push_back("+no-neg-immediates");
}
const std::string arm::getARMArch(StringRef Arch, const llvm::Triple &Triple) {
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1752,6 +1752,8 @@
HelpText<"Allow use of CRC instructions (ARM only)">;
def mnocrc : Flag<["-"], "mnocrc">, Group<m_arm_Features_Group>,
HelpText<"Disallow use of CRC instructions (ARM only)">;
+def mno_neg_immediates: Flag<["-"], "mno-neg-immediates">, Group<m_arm_Features_Group>,
+ HelpText<"Disallow converting instructions with negative immediates to their negation or inversion.">;
def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group<m_aarch64_Features_Group>,
HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31197.92515.patch
Type: text/x-patch
Size: 1788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170321/bfb14088/attachment.bin>
More information about the llvm-commits
mailing list