[dragonegg] r187144 - Fix the build harder after Bill's recent frame-pointer codegen changes.

Duncan Sands baldrick at free.fr
Thu Jul 25 11:52:34 PDT 2013


Author: baldrick
Date: Thu Jul 25 13:52:34 2013
New Revision: 187144

URL: http://llvm.org/viewvc/llvm-project?rev=187144&view=rev
Log:
Fix the build harder after Bill's recent frame-pointer codegen changes.
Patch by Bill.  Bill, we salute you!  While there, move the stack protector
buffer size logic into the same more logical place.

Modified:
    dragonegg/trunk/include/x86/dragonegg/Target.h
    dragonegg/trunk/src/Convert.cpp
    dragonegg/trunk/src/TypeConversion.cpp

Modified: dragonegg/trunk/include/x86/dragonegg/Target.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/x86/dragonegg/Target.h?rev=187144&r1=187143&r2=187144&view=diff
==============================================================================
--- dragonegg/trunk/include/x86/dragonegg/Target.h (original)
+++ dragonegg/trunk/include/x86/dragonegg/Target.h Thu Jul 25 13:52:34 2013
@@ -340,10 +340,14 @@ extern const char *llvm_x86_override_tar
 
 #define LLVM_SET_TARGET_MACHINE_OPTIONS(O)                                     \
   do {                                                                         \
-    if (TARGET_OMIT_LEAF_FRAME_POINTER) {                                      \
+    if (TARGET_OMIT_LEAF_FRAME_POINTER)                                        \
       O.NoFramePointerElim = false;                                            \
-      O.NoFramePointerElimNonLeaf = true;                                      \
-    }                                                                          \
+  } while (0)
+
+#define LLVM_SET_TARGET_MACHINE_ATTRIBUTES(F)                                  \
+  do {                                                                         \
+    if (TARGET_OMIT_LEAF_FRAME_POINTER)                                        \
+      F->addFnAttr("no-frame-pointer-elim-non-leaf", "true");                  \
   } while (0)
 
 #endif /* DRAGONEGG_TARGET_H */

Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=187144&r1=187143&r2=187144&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Thu Jul 25 13:52:34 2013
@@ -61,6 +61,7 @@ extern "C" {
 #endif
 #include "langhooks.h"
 #include "output.h"
+#include "params.h"
 #include "rtl.h"
 #include "target.h" // For targetm.
 #include "tm_p.h"
@@ -1029,11 +1030,15 @@ void TreeToLLVM::StartFunctionBody() {
     Fn->addFnAttr(Attribute::StackProtect);
   else if (flag_stack_protect == 2)
     Fn->addFnAttr(Attribute::StackProtectReq);
+  if (flag_stack_protect)
+    Fn->addFnAttr("stack-protector-buffer-size",
+                  utostr(PARAM_VALUE(PARAM_SSP_BUFFER_SIZE)));
 
   // Handle naked attribute
   if (lookup_attribute("naked", DECL_ATTRIBUTES(FnDecl)))
     Fn->addFnAttr(Attribute::Naked);
 
+  // Handle frame pointers.
   if (flag_omit_frame_pointer) {
     // Eliminate frame pointers everywhere.
     Fn->addFnAttr("no-frame-pointer-elim-non-leaf", "false");
@@ -1042,6 +1047,10 @@ void TreeToLLVM::StartFunctionBody() {
     Fn->addFnAttr("no-frame-pointer-elim-non-leaf", "true");
   }
 
+#ifdef LLVM_SET_TARGET_MACHINE_ATTRIBUTES
+  LLVM_SET_TARGET_MACHINE_ATTRIBUTES(Fn);
+#endif
+
   // Handle annotate attributes
   if (DECL_ATTRIBUTES(FnDecl))
     AddAnnotateAttrsToGlobal(Fn, FnDecl);

Modified: dragonegg/trunk/src/TypeConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/TypeConversion.cpp?rev=187144&r1=187143&r2=187144&view=diff
==============================================================================
--- dragonegg/trunk/src/TypeConversion.cpp (original)
+++ dragonegg/trunk/src/TypeConversion.cpp Thu Jul 25 13:52:34 2013
@@ -50,7 +50,6 @@ extern "C" {
 #include "tree.h"
 
 #include "flags.h"
-#include "params.h"
 #ifndef ENABLE_BUILD_WITH_CXX
 } // extern "C"
 #endif
@@ -901,11 +900,6 @@ ConvertFunctionType(tree type, tree decl
 
   assert(RetTy && "Return type not specified!");
 
-  // Add codegen attributes.
-  if (flag_stack_protect)
-    FnAttrBuilder.addAttribute("stack-protector-buffer-size",
-                               utostr(PARAM_VALUE(PARAM_SSP_BUFFER_SIZE)));
-
   if (FnAttrBuilder.hasAttributes())
     Attrs.push_back(
         AttributeSet::get(Context, AttributeSet::FunctionIndex, FnAttrBuilder));





More information about the llvm-commits mailing list