[PATCH] D31972: Do not force the frame pointer by default for ARM EABI

Christian Bruel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 7 02:23:35 PDT 2017


chrib updated this revision to Diff 101675.
chrib added a comment.

- do not omit the frame pointer for netbsd-eabi and darwin-eabi


https://reviews.llvm.org/D31972

Files:
  lib/Driver/ToolChains/Clang.cpp
  test/Driver/frame-pointer.c


Index: test/Driver/frame-pointer.c
===================================================================
--- test/Driver/frame-pointer.c
+++ test/Driver/frame-pointer.c
@@ -33,6 +33,9 @@
 // RUN: %clang -target mips64el-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-32 %s
 // RUN: %clang -target mips64el-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-32 %s
 
+// RUN: %clang -target arm-none-eabi -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-32 %s
+// RUN: %clang -target arm-none-eabi -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-32 %s
+
 // CHECK0-32: -mdisable-fp-elim
 // CHECK1-32-NOT: -mdisable-fp-elim
 // CHECK2-32-NOT: -mdisable-fp-elim
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -566,6 +566,19 @@
     }
   }
 
+  if (!Triple.isOSDarwin() && !Triple.isOSNetBSD() &&
+      (Triple.getEnvironment() == llvm::Triple::EABI ||
+       Triple.getEnvironment() == llvm::Triple::EABIHF)) {
+    // Don't use a frame pointer on AAPCS when optimizing.
+    switch (Triple.getArch()) {
+    case llvm::Triple::arm:
+    case llvm::Triple::thumb:
+      return !areOptimizationsEnabled(Args);
+    default:
+      return true;
+    }
+  }
+
   return true;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31972.101675.patch
Type: text/x-patch
Size: 1380 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170607/41ab1b3a/attachment.bin>


More information about the cfe-commits mailing list