r278393 - Pass in frame pointer omitting compiler flags for CloudABI as well.

Ed Schouten via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 12:23:30 PDT 2016


Author: ed
Date: Thu Aug 11 14:23:30 2016
New Revision: 278393

URL: http://llvm.org/viewvc/llvm-project?rev=278393&view=rev
Log:
Pass in frame pointer omitting compiler flags for CloudABI as well.

On Linux we pass in -fomit-frame-pointer flags (and similar)
automatically if optimization is enabled. Let's do the same thing on
CloudABI. Without this, Clang seems to run out of registers quite
quickly while trying to build code with inline assembly.


Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/frame-pointer-elim.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=278393&r1=278392&r2=278393&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 11 14:23:30 2016
@@ -3242,7 +3242,7 @@ static bool shouldUseFramePointerForTarg
     break;
   }
 
-  if (Triple.isOSLinux()) {
+  if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI) {
     switch (Triple.getArch()) {
     // Don't use a frame pointer on linux if optimizing for certain targets.
     case llvm::Triple::mips64:

Modified: cfe/trunk/test/Driver/frame-pointer-elim.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/frame-pointer-elim.c?rev=278393&r1=278392&r2=278393&view=diff
==============================================================================
--- cfe/trunk/test/Driver/frame-pointer-elim.c (original)
+++ cfe/trunk/test/Driver/frame-pointer-elim.c Thu Aug 11 14:23:30 2016
@@ -8,6 +8,15 @@
 // RUN:   FileCheck --check-prefix=LINUX %s
 // LINUX-NOT: "-momit-leaf-frame-pointer"
 
+// CloudABI follows the same rules as Linux.
+// RUN: %clang -### -target x86_64-unknown-cloudabi -S -O1 %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CLOUDABI-OPT %s
+// CLOUDABI-OPT: "-momit-leaf-frame-pointer"
+
+// RUN: %clang -### -target x86_64-unknown-cloudabi -S %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CLOUDABI %s
+// CLOUDABI-NOT: "-momit-leaf-frame-pointer"
+
 // Darwin disables omitting the leaf frame pointer even under optimization
 // unless the command lines are given.
 // RUN: %clang -### -target i386-apple-darwin -S %s 2>&1 | \




More information about the cfe-commits mailing list