[PATCH] D31813: [ARM] Add hardware build attributes in assembler

Oliver Stannard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 06:50:10 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL300550: [ARM] Add hardware build attributes in assembler (authored by olista01).

Changed prior to commit:
  https://reviews.llvm.org/D31813?vs=94533&id=95560#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31813

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/test/Driver/arm-default-build-attributes.s


Index: cfe/trunk/test/Driver/arm-default-build-attributes.s
===================================================================
--- cfe/trunk/test/Driver/arm-default-build-attributes.s
+++ cfe/trunk/test/Driver/arm-default-build-attributes.s
@@ -0,0 +1,20 @@
+// Enabled by default for assembly
+// RUN: %clang -target armv7--none-eabi -### %s 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-ENABLED
+
+// Can be forced on or off for assembly.
+// RUN: %clang -target armv7--none-eabi -### %s 2>&1 -mno-default-build-attributes \
+// RUN:    | FileCheck %s -check-prefix CHECK-DISABLED
+// RUN: %clang -target armv7--none-eabi -### %s 2>&1 -mdefault-build-attributes \
+// RUN:    | FileCheck %s -check-prefix CHECK-ENABLED
+
+// Option ignored C/C++ (since we always emit hardware and ABI build attributes
+// during codegen).
+// RUN: %clang -target armv7--none-eabi -### -x c %s -mdefault-build-attributes -verify 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-DISABLED
+// RUN: %clang -target armv7--none-eabi -### -x c++ %s -mdefault-build-attributes -verify 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-DISABLED
+
+// CHECK-DISABLED-NOT: "-arm-add-build-attributes"
+// CHECK-ENABLED: "-arm-add-build-attributes"
+// expected-warning {{argument unused during compilation: '-mno-default-build-attributes'}}
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -4996,6 +4996,19 @@
   case llvm::Triple::x86_64:
     AddX86TargetArgs(Args, CmdArgs);
     break;
+
+  case llvm::Triple::arm:
+  case llvm::Triple::armeb:
+  case llvm::Triple::thumb:
+  case llvm::Triple::thumbeb:
+    // This isn't in AddARMTargetArgs because we want to do this for assembly
+    // only, not C/C++.
+    if (Args.hasFlag(options::OPT_mdefault_build_attributes,
+                     options::OPT_mno_default_build_attributes, true)) {
+        CmdArgs.push_back("-mllvm");
+        CmdArgs.push_back("-arm-add-build-attributes");
+    }
+    break;
   }
 
   // Consume all the warning flags. Usually this would be handled more
Index: cfe/trunk/include/clang/Driver/Options.td
===================================================================
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1646,6 +1646,8 @@
 def masm_EQ : Joined<["-"], "masm=">, Group<m_Group>, Flags<[DriverOption]>;
 def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>;
 def mimplicit_it_EQ : Joined<["-"], "mimplicit-it=">, Group<m_Group>;
+def mdefault_build_attributes : Joined<["-"], "mdefault-build-attributes">, Group<m_Group>;
+def mno_default_build_attributes : Joined<["-"], "mno-default-build-attributes">, Group<m_Group>;
 def mconstant_cfstrings : Flag<["-"], "mconstant-cfstrings">, Group<clang_ignored_m_Group>;
 def mconsole : Joined<["-"], "mconsole">, Group<m_Group>, Flags<[DriverOption]>;
 def mwindows : Joined<["-"], "mwindows">, Group<m_Group>, Flags<[DriverOption]>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31813.95560.patch
Type: text/x-patch
Size: 3087 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170418/9e889573/attachment.bin>


More information about the llvm-commits mailing list