This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] speedup C++ a little
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Wed, 19 May 2004 23:00:23 -0400
- Subject: [PATCH] speedup C++ a little
Since the middle-end now checks for setjmp when inlining there
is no reason why the C++ front-end to check for it too.
This patch just removes the check for setjmp in the C++ front-end.
OK? Bootstrapped on powerpc-apple-darwin with no regressions.
Thanks,
Andrew Pinski
ChangeLog:
* optimize.c (calls_setjmp_r): Remove.
(calls_setjmp_p): Remove.
* cp-tree.c (calls_setjmp_p): Remove.
* decl.c (finish_function): Do not call calls_setjmp_p.
Index: cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.967
diff -u -d -b -w -u -p -r1.967 cp-tree.h
--- cp-tree.h 13 May 2004 06:40:16 -0000 1.967
+++ cp-tree.h 20 May 2004 02:52:09 -0000
@@ -3851,7 +3851,6 @@ extern tree implicitly_declare_fn (speci
extern tree skip_artificial_parms_for (tree, tree);
/* In optimize.c */
-extern bool calls_setjmp_p (tree);
extern bool maybe_clone_body (tree);
/* in pt.c */
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1207
diff -u -d -b -w -u -p -r1.1207 decl.c
--- decl.c 19 May 2004 01:28:55 -0000 1.1207
+++ decl.c 20 May 2004 02:52:09 -0000
@@ -10756,18 +10756,6 @@ finish_function (int flags)
if (!processing_template_decl)
save_function_data (fndecl);
- /* If this function calls `setjmp' it cannot be inlined. When
- `longjmp' is called it is not guaranteed to restore the value of
- local variables that have been modified since the call to
- `setjmp'. So, if were to inline this function into some caller
- `c', then when we `longjmp', we might not restore all variables
- in `c'. (It might seem, at first blush, that there's no way for
- this function to modify local variables in `c', but their
- addresses may have been stored somewhere accessible to this
- function.) */
- if (!processing_template_decl && calls_setjmp_p (fndecl))
- DECL_UNINLINABLE (fndecl) = 1;
-
/* Complain if there's just no return statement. */
if (warn_return_type
&& TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE
Index: optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/optimize.c,v
retrieving revision 1.108
diff -u -d -b -w -u -p -r1.108 optimize.c
--- optimize.c 14 May 2004 02:29:26 -0000 1.108
+++ optimize.c 20 May 2004 02:52:09 -0000
@@ -44,34 +44,7 @@ Software Foundation, 59 Temple Place - S
/* Prototypes. */
-static tree calls_setjmp_r (tree *, int *, void *);
static void update_cloned_parm (tree, tree);
-
-/* Called from calls_setjmp_p via walk_tree. */
-
-static tree
-calls_setjmp_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED)
-{
- /* We're only interested in FUNCTION_DECLS. */
- if (TREE_CODE (*tp) != FUNCTION_DECL)
- return NULL_TREE;
-
- return setjmp_call_p (*tp) ? *tp : NULL_TREE;
-}
-
-/* Returns nonzero if FN calls `setjmp' or some other function that
- can return more than once. This function is conservative; it may
- occasionally return a nonzero value even when FN does not actually
- call `setjmp'. */
-
-bool
-calls_setjmp_p (tree fn)
-{
- return walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
- calls_setjmp_r,
- NULL) != NULL_TREE;
-}
/* CLONED_PARM is a copy of CLONE, generated for a cloned constructor
or destructor. Update it to ensure that the source-position for