[PATCH] D11815: Pass subtarget feature "force-align-stack"

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 12:06:06 PDT 2015


ahatanak created this revision.
ahatanak added reviewers: echristo, dexonsmith.
ahatanak added a subscriber: cfe-commits.

This patch makes changes to pass subtarget feature "force-align-stack" instead of passing a backend-option when users provide "-mstackrealign" on the command line.

The llvm-side change is here: http://reviews.llvm.org/D11814

http://reviews.llvm.org/D11815

Files:
  lib/Driver/Tools.cpp
  test/Driver/stackrealign.c

Index: test/Driver/stackrealign.c
===================================================================
--- test/Driver/stackrealign.c
+++ test/Driver/stackrealign.c
@@ -1,12 +1,12 @@
 // RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=NORMAL
-// NORMAL-NOT: -force-align-stack
+// NORMAL-NOT: "-target-feature" "+force-align-stack"
 // NORMAL: -mstackrealign
 
 // RUN: %clang -### -mstackrealign %s 2>&1 | FileCheck %s -check-prefix=MREALIGN
-// MREALIGN: -force-align-stack
+// MREALIGN: "-target-feature" "+force-align-stack"
 // MREALIGN: -mstackrealign
 
 // RUN: %clang -### -mno-stackrealign %s 2>&1 | \
 // RUN: FileCheck %s -check-prefix=MNOREALIGN
-// MNOREALIGN-NOT: -force-align-stack
+// MNOREALIGN-NOT: "-target-feature" "+force-align-stack"
 // MNOREALIGN-NOT: -mstackrealign
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2116,6 +2116,11 @@
     break;
   }
 
+  // Add generic features.
+  if (Args.hasFlag(options::OPT_mstackrealign, options::OPT_mno_stackrealign,
+                   false))
+    Features.push_back("+force-align-stack");
+
   // Find the last of each feature.
   llvm::StringMap<unsigned> LastOpt;
   for (unsigned I = 0, N = Features.size(); I < N; ++I) {
@@ -4225,11 +4230,6 @@
   }
 
   // Translate -mstackrealign
-  if (Args.hasFlag(options::OPT_mstackrealign, options::OPT_mno_stackrealign,
-                   false)) {
-    CmdArgs.push_back("-backend-option");
-    CmdArgs.push_back("-force-align-stack");
-  }
   if (!Args.hasFlag(options::OPT_mno_stackrealign, options::OPT_mstackrealign,
                     false)) {
     CmdArgs.push_back(Args.MakeArgString("-mstackrealign"));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11815.31466.patch
Type: text/x-patch
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150806/735f64d6/attachment.bin>


More information about the cfe-commits mailing list