[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
Thu Apr 20 06:31:43 PDT 2017


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



1. Updating https://reviews.llvm.org/D31972: Do not force the frame pointer by default for ARM EABI #

Add test case


https://reviews.llvm.org/D31972

Files:
  lib/Driver/ToolChains/Clang.cpp
  test/CodeGen/arm-fp-eabi.c


Index: test/CodeGen/arm-fp-eabi.c
===================================================================
--- /dev/null
+++ test/CodeGen/arm-fp-eabi.c
@@ -0,0 +1,13 @@
+// RUN: %clang %s -target arm-none-eabi -O2 -S -o nofp.s
+// RUN: grep -v '.setfp' nofp.s
+// RUN: %clang %s -target arm-none-eabi -fno-omit-frame-pointer -O2 -S -o fp.s
+// RUN: grep '.setfp' fp.s
+
+void
+foo(void);
+
+int main()
+{
+  foo();
+  return 0;
+}
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -566,6 +566,17 @@
     }
   }
 
+  if (Triple.getEnvironment() == llvm::Triple::EABI) {
+    switch (Triple.getArch()) {
+    case llvm::Triple::arm:
+    case llvm::Triple::thumb:
+      // ARM EABI doesn't require a frame pointer
+      return !areOptimizationsEnabled(Args);
+    default:
+      return true;
+    }
+  }
+
   return true;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31972.95945.patch
Type: text/x-patch
Size: 955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170420/dfaf0b68/attachment-0001.bin>


More information about the cfe-commits mailing list