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

2017-05-31 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added reviewers: t.p.northover, efriedma.
efriedma added inline comments.



Comment at: lib/Driver/ToolChains/Clang.cpp:569
 
+  if (Triple.getEnvironment() == llvm::Triple::EABI) {
+switch (Triple.getArch()) {

Specifically checking for "llvm::Triple::EABI" is suspicious... what are you 
trying to distinguish?


https://reviews.llvm.org/D31972



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-06-01 Thread Christian Bruel via Phabricator via cfe-commits
chrib added inline comments.



Comment at: lib/Driver/ToolChains/Clang.cpp:569
 
+  if (Triple.getEnvironment() == llvm::Triple::EABI) {
+switch (Triple.getArch()) {

efriedma wrote:
> Specifically checking for "llvm::Triple::EABI" is suspicious... what are you 
> trying to distinguish?
I'm targeting the AAPCS for bare toolsets, (we could also test EABIHF by the 
way)

I'm not sure about the other ABIs (such as llvm::Triple::OpenBSD) so it is 
probably conservative and stick to what I can test. Do you think this pertains 
to more, for instance to AAPCS-LINUX, without breaking anything ?



https://reviews.llvm.org/D31972



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-06-01 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: lib/Driver/ToolChains/Clang.cpp:569
 
+  if (Triple.getEnvironment() == llvm::Triple::EABI) {
+switch (Triple.getArch()) {

chrib wrote:
> efriedma wrote:
> > Specifically checking for "llvm::Triple::EABI" is suspicious... what are 
> > you trying to distinguish?
> I'm targeting the AAPCS for bare toolsets, (we could also test EABIHF by the 
> way)
> 
> I'm not sure about the other ABIs (such as llvm::Triple::OpenBSD) so it is 
> probably conservative and stick to what I can test. Do you think this 
> pertains to more, for instance to AAPCS-LINUX, without breaking anything ?
> 
So... something like isTargetAEABI() in ARMSubtarget.h?

Please clarify the comment, and add a check for EABIHF.


https://reviews.llvm.org/D31972



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-06-06 Thread Christian Bruel via Phabricator via cfe-commits
chrib updated this revision to Diff 101543.
chrib added a comment.
Herald added a subscriber: kristof.beyls.

- Merge branch 'master' of ssh://codex.cro.st.com/llvm-arm/clang
- Don't need a frame pointer for EABIHF also (AAPCS)


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,18 @@
 }
   }
 
+  if (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;
 }
 


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,18 @@
 }
   }
 
+  if (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;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-06-06 Thread Christian Bruel via Phabricator via cfe-commits
chrib added inline comments.



Comment at: lib/Driver/ToolChains/Clang.cpp:569
 
+  if (Triple.getEnvironment() == llvm::Triple::EABI) {
+switch (Triple.getArch()) {

efriedma wrote:
> chrib wrote:
> > efriedma wrote:
> > > Specifically checking for "llvm::Triple::EABI" is suspicious... what are 
> > > you trying to distinguish?
> > I'm targeting the AAPCS for bare toolsets, (we could also test EABIHF by 
> > the way)
> > 
> > I'm not sure about the other ABIs (such as llvm::Triple::OpenBSD) so it is 
> > probably conservative and stick to what I can test. Do you think this 
> > pertains to more, for instance to AAPCS-LINUX, without breaking anything ?
> > 
> So... something like isTargetAEABI() in ARMSubtarget.h?
> 
> Please clarify the comment, and add a check for EABIHF.
yes, (although I'm not sure for Darwin). The closest check for AAPCS I've found 
is Clang::AddARMTargetArgs. 

I've updated the patch to check EABIHF as well.


https://reviews.llvm.org/D31972



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-06-06 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

Please start a thread on cfe-dev about this; most developers don't read 
cfe-commits, and thinking about it a bit more, I'm not confident omitting frame 
pointers is really a good default.  I would guess there's existing code which 
depends on frame pointers to come up with a stack trace, since table-based 
unwinding is complicated and takes up a lot of space.

Grepping over the in-tree tests, it looks like the "eabi" triples used in 
practice are "arm-non-eabi", "arm-netbsd-eabi" and variants of 
"thumbv7m-apple-darwin-eabi" (and variants of those).  Please make sure you 
aren't changing the behavior of netbsd and "Darwin" targets.


https://reviews.llvm.org/D31972



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-06-07 Thread Christian Bruel via Phabricator via cfe-commits
chrib added a comment.

OK, I have created a RFE tracker (BZ #32501). I will forward to cfe-dev.

Regarding the need to avoid table-based unwinding, the way to handle those 
request for an explicit frame pointer when not required by the ABI is to use 
-fno-omit-frame-pointer flag, catching up with the GCC behavior.

Also I'm not sure that the unwind table space is such an issue (for debugging) 
since they are not loadable. Other uses such as profiling is not be impacted by 
the change, and exceptions unwinder likelibgcc or libunwind should work without 
the frame pointer

I'll amend the patch to check for Darwin and Netbsd.


https://reviews.llvm.org/D31972



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-06-07 Thread Christian Bruel via Phabricator via cfe-commits
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;
 }
 


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;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-06-07 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

Actually, for NetBSD we want to use -fomit-frame-pointer by default whenever 
the implicit -funwind-tables is also present. In general, that should be the 
justification for the default behavior: "Can I reliably unwind a binary with 
the available information?" Performance of stack unwinding is IMO secondary and 
users of sanitizers can disable it where necessary.


https://reviews.llvm.org/D31972



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-04-12 Thread Christian Bruel via Phabricator via cfe-commits
chrib created this revision.
Herald added a subscriber: aemerson.

Do not force the frame pointer by default for ARM EABI

(bugzilla #32501)


https://reviews.llvm.org/D31972

Files:
  lib/Driver/ToolChains/Clang.cpp


Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -566,6 +566,18 @@
 }
   }
 
+
+  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;
 }
 


Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -566,6 +566,18 @@
 }
   }
 
+
+  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;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-04-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

Can you add a test case?


https://reviews.llvm.org/D31972



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-04-20 Thread Christian Bruel via Phabricator via cfe-commits
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;
 }
 


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;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-04-20 Thread Christian Bruel via Phabricator via cfe-commits
chrib updated this revision to Diff 95958.
chrib added a comment.

- Fix thinko in test


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: not grep '.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;
 }
 


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: not grep '.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;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-04-20 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments.



Comment at: test/CodeGen/arm-fp-eabi.c:1
+// RUN: %clang %s -target arm-none-eabi -O2 -S -o nofp.s
+// RUN: not grep '.setfp' nofp.s

Instead of generating a .s file and looking for ".setfp", you can pass -### and 
check the presence or absence of -mdisable-fp-elim (see other tests in 
test/Driver).


https://reviews.llvm.org/D31972



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-04-21 Thread Christian Bruel via Phabricator via cfe-commits
chrib updated this revision to Diff 96109.
chrib added a comment.

- Check not mdisable-fp-elim for arm eabi when optimizing


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,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;
 }
 


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,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;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-04-21 Thread Christian Bruel via Phabricator via cfe-commits
chrib added inline comments.



Comment at: test/CodeGen/arm-fp-eabi.c:1
+// RUN: %clang %s -target arm-none-eabi -O2 -S -o nofp.s
+// RUN: not grep '.setfp' nofp.s

ahatanak wrote:
> Instead of generating a .s file and looking for ".setfp", you can pass -### 
> and check the presence or absence of -mdisable-fp-elim (see other tests in 
> test/Driver).
yes sure, I extended the existing frame-pointer.c with the test similar to 
other archs. Thanks


https://reviews.llvm.org/D31972



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits