This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Make is_global_var inlined
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 28 Mar 2007 14:48:26 +0200 (CEST)
- Subject: [PATCH] Make is_global_var inlined
This patch moves is_global_var from tree.c to tree-flow-inline.h as we
have for example for tramp3d 14917163 calls to this function, most from
needs_to_live_in_memory and remove_unused_locals (which in turn uses
up a lot of time in tramp3d) and it's at position 54 in a profiled
cc1plus. (is_gimple_reg is another candidate with 31739151 calls,
position 28, expr_locus with 49650432 calls as well - of course
is_gimple_reg is a little bit big).
I'll commit this after a bootstrap and regtest.
Thanks,
Richard.
2007-03-28 Richard Guenther <rguenther@suse.de>
* tree.c (is_global_var): Move ...
* tree-flow-inline.h (is_global_var): ... here.
* tree.h (is_global_var): Remove declaration.
Index: tree.c
===================================================================
*** tree.c (revision 123218)
--- tree.c (working copy)
*************** range_in_array_bounds_p (tree ref)
*** 7602,7618 ****
return true;
}
- /* Return true if T (assumed to be a DECL) is a global variable. */
-
- bool
- is_global_var (tree t)
- {
- if (MTAG_P (t))
- return (TREE_STATIC (t) || MTAG_GLOBAL (t));
- else
- return (TREE_STATIC (t) || DECL_EXTERNAL (t));
- }
-
/* Return true if T (assumed to be a DECL) must be assigned a memory
location. */
--- 7602,7607 ----
Index: tree.h
===================================================================
*** tree.h (revision 123218)
--- tree.h (working copy)
*************** extern void expand_function_start (tree)
*** 4540,4546 ****
extern void stack_protect_prologue (void);
extern void stack_protect_epilogue (void);
extern void recompute_tree_invariant_for_addr_expr (tree);
- extern bool is_global_var (tree t);
extern bool needs_to_live_in_memory (tree);
extern tree reconstruct_complex_type (tree, tree);
--- 4540,4545 ----
Index: tree-flow-inline.h
===================================================================
*** tree-flow-inline.h (revision 123218)
--- tree-flow-inline.h (working copy)
*************** is_label_stmt (tree t)
*** 718,723 ****
--- 718,734 ----
return false;
}
+ /* Return true if T (assumed to be a DECL) is a global variable. */
+
+ static inline bool
+ is_global_var (tree t)
+ {
+ if (MTAG_P (t))
+ return (TREE_STATIC (t) || MTAG_GLOBAL (t));
+ else
+ return (TREE_STATIC (t) || DECL_EXTERNAL (t));
+ }
+
/* PHI nodes should contain only ssa_names and invariants. A test
for ssa_name is definitely simpler; don't let invalid contents
slip in in the meantime. */