[llvm-commits] [126125] Make llvm honor -fno-builtin.

johannes at apple.com johannes at apple.com
Sat Apr 14 17:14:14 PDT 2007


Revision: 126125
Author:   johannes
Date:     2007-04-14 17:14:13 -0700 (Sat, 14 Apr 2007)

Log Message:
-----------
Make llvm honor -fno-builtin.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/c-common.c
    apple-local/branches/llvm/gcc/c-common.h
    apple-local/branches/llvm/gcc/c-objc-common.h
    apple-local/branches/llvm/gcc/cp/cp-objcp-common.h
    apple-local/branches/llvm/gcc/langhooks-def.h
    apple-local/branches/llvm/gcc/langhooks.h
    apple-local/branches/llvm/gcc/llvm-backend.cpp

Modified: apple-local/branches/llvm/gcc/c-common.c
===================================================================
--- apple-local/branches/llvm/gcc/c-common.c	2007-04-14 19:42:51 UTC (rev 126124)
+++ apple-local/branches/llvm/gcc/c-common.c	2007-04-15 00:14:13 UTC (rev 126125)
@@ -8008,4 +8008,10 @@
 }
 /* APPLE LOCAL end CW asm blocks */
 
+/* APPLE LOCAL begin define this sensibly in all languages */
+bool c_flag_no_builtin(void) {
+  return flag_no_builtin;
+}
+/* APPLE LOCAL end define this sensibly in all languages */
+
 #include "gt-c-common.h"

Modified: apple-local/branches/llvm/gcc/c-common.h
===================================================================
--- apple-local/branches/llvm/gcc/c-common.h	2007-04-14 19:42:51 UTC (rev 126124)
+++ apple-local/branches/llvm/gcc/c-common.h	2007-04-15 00:14:13 UTC (rev 126125)
@@ -798,6 +798,8 @@
 /* APPLE LOCAL begin IMA built-in decl merging fix (radar 3645899) */
 extern bool builtin_function_disabled_p (const char *);
 /* APPLE LOCAL end */
+/* APPLE LOCAL define this sensibly in all languages */
+extern bool c_flag_no_builtin (void);
 
 /* This is the basic parsing function.  */
 extern void c_parse_file (void);

Modified: apple-local/branches/llvm/gcc/c-objc-common.h
===================================================================
--- apple-local/branches/llvm/gcc/c-objc-common.h	2007-04-14 19:42:51 UTC (rev 126124)
+++ apple-local/branches/llvm/gcc/c-objc-common.h	2007-04-15 00:14:13 UTC (rev 126125)
@@ -117,6 +117,10 @@
 #define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to
 #undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
 #define LANG_HOOKS_REGISTER_BUILTIN_TYPE c_register_builtin_type
+/* APPLE LOCAL begin define this sensibly in all languages */
+#undef LANG_HOOKS_FLAG_NO_BUILTIN
+#define LANG_HOOKS_FLAG_NO_BUILTIN c_flag_no_builtin
+/* APPLE LOCAL end define this sensibly in all languages */
 #undef LANG_HOOKS_TO_TARGET_CHARSET
 #define LANG_HOOKS_TO_TARGET_CHARSET c_common_to_target_charset
 

Modified: apple-local/branches/llvm/gcc/cp/cp-objcp-common.h
===================================================================
--- apple-local/branches/llvm/gcc/cp/cp-objcp-common.h	2007-04-14 19:42:51 UTC (rev 126124)
+++ apple-local/branches/llvm/gcc/cp/cp-objcp-common.h	2007-04-15 00:14:13 UTC (rev 126125)
@@ -152,6 +152,10 @@
 #define LANG_HOOKS_TYPE_PROMOTES_TO cxx_type_promotes_to
 #undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
 #define LANG_HOOKS_REGISTER_BUILTIN_TYPE c_register_builtin_type
+/* APPLE LOCAL begin define this sensibly in all languages */
+#undef LANG_HOOKS_FLAG_NO_BUILTIN
+#define LANG_HOOKS_FLAG_NO_BUILTIN c_flag_no_builtin
+/* APPLE LOCAL end define this sensibly in all languages */
 #undef LANG_HOOKS_TO_TARGET_CHARSET
 #define LANG_HOOKS_TO_TARGET_CHARSET c_common_to_target_charset
 #undef LANG_HOOKS_GIMPLIFY_EXPR

Modified: apple-local/branches/llvm/gcc/langhooks-def.h
===================================================================
--- apple-local/branches/llvm/gcc/langhooks-def.h	2007-04-14 19:42:51 UTC (rev 126124)
+++ apple-local/branches/llvm/gcc/langhooks-def.h	2007-04-15 00:14:13 UTC (rev 126125)
@@ -129,6 +129,8 @@
 #define LANG_HOOKS_TREE_SIZE		lhd_tree_size
 #define LANG_HOOKS_TYPES_COMPATIBLE_P	lhd_types_compatible_p
 #define LANG_HOOKS_BUILTIN_FUNCTION	builtin_function
+/* APPLE LOCAL define this sensibly for all languages */
+#define LANG_HOOKS_FLAG_NO_BUILTIN      hook_bool_void_false
 #define LANG_HOOKS_TO_TARGET_CHARSET	lhd_to_target_charset
 
 #define LANG_HOOKS_FUNCTION_INIT	lhd_do_nothing_f
@@ -310,6 +312,8 @@
   LANG_HOOKS_GIMPLIFY_EXPR, \
   LANG_HOOKS_FOLD_OBJ_TYPE_REF, \
   LANG_HOOKS_BUILTIN_FUNCTION, \
+/* APPLE LOCAL define this sensibly for all languages */ \
+  LANG_HOOKS_FLAG_NO_BUILTIN, \
 }
 
 #endif /* GCC_LANG_HOOKS_DEF_H */

Modified: apple-local/branches/llvm/gcc/langhooks.h
===================================================================
--- apple-local/branches/llvm/gcc/langhooks.h	2007-04-14 19:42:51 UTC (rev 126124)
+++ apple-local/branches/llvm/gcc/langhooks.h	2007-04-15 00:14:13 UTC (rev 126125)
@@ -434,6 +434,9 @@
 			    enum built_in_class bt_class,
 			    const char *library_name, tree attrs);
 
+  /* APPLE LOCAL define this sensibly for all languages */
+  bool (*flag_no_builtin)(void);
+
   /* Whenever you add entries here, make sure you adjust langhooks-def.h
      and langhooks.c accordingly.  */
 };

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-backend.cpp	2007-04-14 19:42:51 UTC (rev 126124)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp	2007-04-15 00:14:13 UTC (rev 126125)
@@ -64,6 +64,7 @@
 #include "tm.h"
 #include "function.h"
 #include "tree-inline.h"
+#include "langhooks.h"
 }
 
 // Non-zero if bytecode from PCH is successfully read.
@@ -298,7 +299,7 @@
     if (optimize > 1) {
       if (flag_inline_trees > 1)                // respect -fno-inline-functions
         PM->add(createFunctionInliningPass());  // Inline small functions
-      if (flag_unit_at_a_time)
+      if (flag_unit_at_a_time && !lang_hooks.flag_no_builtin())
         PM->add(createSimplifyLibCallsPass());  // Library Call Optimizations
 
       if (optimize > 2)





More information about the llvm-commits mailing list