mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-20 17:40:46 +08:00
patch to remove the analysis of module level static variables.
From-SVN: r89559
This commit is contained in:
parent
218d153705
commit
85c33455ea
@ -1,3 +1,26 @@
|
||||
2004-10-25 Kenneth Zadeck <zadeck@naturalbridge.com>
|
||||
* gcc/Makefile.in: removed ggc for cgraphunit.
|
||||
* gcc/cgraph.c.dump_cgraph_node: removed static var analysis.
|
||||
* gcc/cgraph.h: removed static var analysis data structures and calls.
|
||||
* gcc/cgraphunit.c:
|
||||
cgraph_mark_local_and_external_functions:changed name to
|
||||
cgraph_mark_local_functions
|
||||
(print_order,convert_UIDs_in_bitmap,new_static_vars_info,
|
||||
cgraph_reset_static_var_maps,get_global_static_vars_info,
|
||||
get_global_statics_not_read,get_global_statics_not_written,searchc,
|
||||
cgraph_reduced_inorder,has_proper_scope_for_analysis,check_rhs_var,
|
||||
check_lhs_var,get_asm_expr_operands,process_call_for_static_vars,
|
||||
scan_for_static_refs,cgraph_characterize_statics_local,
|
||||
clear_static_vars_maps,cgraph_propagate_bits,cgraph_characterize_statics):
|
||||
removed.
|
||||
(cgraph_optimize,init_cgraph): removed calls to static vars analysis
|
||||
* gcc/tree-dfa.c find_referenced_vars: removed call to static vars
|
||||
analysis
|
||||
* gcc/tree-flow.h static_vars_info: removed
|
||||
* gcc/tree-ssa-operands.c (add_call_clobber_ops,add_call_read_ops):
|
||||
removed calls to static vars analysis.
|
||||
get_call_expr_operands: removed callee variable.
|
||||
|
||||
2004-10-25 Kazu Hirata <kazu@cs.umass.edu>
|
||||
|
||||
* cfg.c (unchecked_make_edge, redirect_edge_succ,
|
||||
|
@ -703,7 +703,7 @@ SCHED_INT_H = sched-int.h $(INSN_ATTR_H) $(BASIC_BLOCK_H) $(RTL_H)
|
||||
INTEGRATE_H = integrate.h varray.h
|
||||
CFGLAYOUT_H = cfglayout.h $(BASIC_BLOCK_H)
|
||||
CFGLOOP_H = cfgloop.h $(BASIC_BLOCK_H) $(RTL_H)
|
||||
CGRAPH_H = cgraph.h bitmap.h tree.h $(HASHTAB_H)
|
||||
CGRAPH_H = cgraph.h tree.h
|
||||
DF_H = df.h bitmap.h sbitmap.h $(BASIC_BLOCK_H)
|
||||
DDG_H = ddg.h sbitmap.h $(DF_H)
|
||||
GCC_H = gcc.h version.h
|
||||
@ -2406,7 +2406,6 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
|
||||
$(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/cgraph.h \
|
||||
$(srcdir)/c-common.h $(srcdir)/c-tree.h $(srcdir)/reload.h \
|
||||
$(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
|
||||
$(srcdir)/cgraphunit.c \
|
||||
$(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \
|
||||
$(srcdir)/dojump.c \
|
||||
$(srcdir)/emit-rtl.c $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \
|
||||
|
@ -471,15 +471,8 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
|
||||
fprintf (f, " tree");
|
||||
if (node->output)
|
||||
fprintf (f, " output");
|
||||
|
||||
if (node->local.local)
|
||||
fprintf (f, " local");
|
||||
if (node->local.external)
|
||||
fprintf (f, " external");
|
||||
if (node->local.calls_read_all)
|
||||
fprintf (f, " calls_read_all");
|
||||
if (node->local.calls_write_all)
|
||||
fprintf (f, " calls_write_all");
|
||||
if (node->local.disregard_inline_limits)
|
||||
fprintf (f, " always_inline");
|
||||
else if (node->local.inlinable)
|
||||
|
84
gcc/cgraph.h
84
gcc/cgraph.h
@ -21,8 +21,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
|
||||
#ifndef GCC_CGRAPH_H
|
||||
#define GCC_CGRAPH_H
|
||||
#include "hashtab.h"
|
||||
#include "bitmap.h"
|
||||
#include "tree.h"
|
||||
|
||||
/* Information about the function collected locally.
|
||||
@ -37,16 +35,6 @@ struct cgraph_local_info GTY(())
|
||||
and it's address is never taken. */
|
||||
bool local;
|
||||
|
||||
/* Set when function is defined in another compilation unit. */
|
||||
bool external;
|
||||
|
||||
/* Set when this function calls a function external of the
|
||||
compilation unit. In general, such calls are modeled as reading
|
||||
and writing all variables (both bits on) but sometime there are
|
||||
attributes on the called function so we can do better. */
|
||||
bool calls_read_all;
|
||||
bool calls_write_all;
|
||||
|
||||
/* Set once it has been finalized so we consider it to be output. */
|
||||
bool finalized;
|
||||
|
||||
@ -90,70 +78,6 @@ struct cgraph_rtl_info GTY(())
|
||||
bool pure_function;
|
||||
};
|
||||
|
||||
/* FIXME -- PROFILE-RESTRUCTURE: When the next round of the profiling
|
||||
code gets merged in, it will contain a restructing where ssa form
|
||||
is built for every function within the compilation unit before the
|
||||
rest of the compilation continues. When this reorgination is done,
|
||||
it will no longer be necessary to have the _decl_uid versions of
|
||||
local_static_vars_info and global_static_vars_info structures.
|
||||
Having both structures is now required because the _ann_uid values
|
||||
for static variables are reset as each function is compiled.
|
||||
Currently, the analysis is done using the _decl_uid versions and
|
||||
converted to the _var_ann versions on demand.
|
||||
|
||||
Also, the var_anns_valid fields within these structures can also go
|
||||
away.
|
||||
*/
|
||||
|
||||
/* The static variables defined within the compilation unit that are
|
||||
loaded or stored directly by function that owns this structure. */
|
||||
|
||||
struct local_static_vars_info_d GTY(())
|
||||
{
|
||||
bitmap statics_read_by_decl_uid;
|
||||
bitmap statics_written_by_decl_uid;
|
||||
};
|
||||
|
||||
struct global_static_vars_info_d GTY(())
|
||||
{
|
||||
bitmap statics_read_by_decl_uid;
|
||||
bitmap statics_written_by_decl_uid;
|
||||
bitmap statics_read_by_ann_uid;
|
||||
bitmap statics_written_by_ann_uid;
|
||||
bitmap statics_not_read_by_decl_uid;
|
||||
bitmap statics_not_written_by_decl_uid;
|
||||
bitmap statics_not_read_by_ann_uid;
|
||||
bitmap statics_not_written_by_ann_uid;
|
||||
|
||||
/* var_anns_valid is reset at the start of compilation for each
|
||||
function because the indexing that the "_var_anns" is based
|
||||
on is invalidated between function compilations. This allows for
|
||||
lazy creation of the "_var_ann" variables. */
|
||||
bool var_anns_valid;
|
||||
};
|
||||
|
||||
/* Statics that are read and written by some set of functions. The
|
||||
local ones are based on the loads and stores local to the function.
|
||||
The global ones are based on the local info as well as the
|
||||
transitive closure of the functions that are called. The
|
||||
structures are separated to allow the global structures to be
|
||||
shared between several functions since every function within a
|
||||
strongly connected component will have the same information. This
|
||||
sharing saves both time and space in the computation of the vectors
|
||||
as well as their translation from decl_uid form to ann_uid
|
||||
form. */
|
||||
|
||||
typedef struct local_static_vars_info_d *local_static_vars_info_t;
|
||||
typedef struct global_static_vars_info_d *global_static_vars_info_t;
|
||||
|
||||
struct static_vars_info_d GTY(())
|
||||
{
|
||||
local_static_vars_info_t local;
|
||||
global_static_vars_info_t global;
|
||||
};
|
||||
|
||||
typedef struct static_vars_info_d *static_vars_info_t;
|
||||
|
||||
/* The cgraph data structure.
|
||||
Each function decl has assigned cgraph_node listing callees and callers. */
|
||||
|
||||
@ -174,18 +98,12 @@ struct cgraph_node GTY((chain_next ("%h.next"), chain_prev ("%h.previous")))
|
||||
struct cgraph_node *next_needed;
|
||||
/* Pointer to the next clone. */
|
||||
struct cgraph_node *next_clone;
|
||||
/* Pointer to next node in a recursive call graph cycle; */
|
||||
struct cgraph_node *next_cycle;
|
||||
PTR GTY ((skip)) aux;
|
||||
|
||||
struct cgraph_local_info local;
|
||||
struct cgraph_global_info global;
|
||||
struct cgraph_rtl_info rtl;
|
||||
|
||||
/* Pointer to the structure that contains the sets of global
|
||||
variables modified by function calls. */
|
||||
static_vars_info_t static_vars_info;
|
||||
|
||||
/* Unique id of the node. */
|
||||
int uid;
|
||||
/* Set when function must be output - it is externally visible
|
||||
@ -284,8 +202,6 @@ void cgraph_mark_inline_edge (struct cgraph_edge *e);
|
||||
void cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate);
|
||||
void cgraph_build_static_cdtor (char which, tree body, int priority);
|
||||
void cgraph_reset_static_var_maps (void);
|
||||
bitmap get_global_statics_not_read (tree fn);
|
||||
bitmap get_global_statics_not_written(tree fn);
|
||||
void init_cgraph (void);
|
||||
|
||||
#endif /* GCC_CGRAPH_H */
|
||||
|
1068
gcc/cgraphunit.c
1068
gcc/cgraphunit.c
File diff suppressed because it is too large
Load Diff
@ -109,7 +109,6 @@ find_referenced_vars (void)
|
||||
block_stmt_iterator si;
|
||||
struct walk_state walk_state;
|
||||
|
||||
cgraph_reset_static_var_maps ();
|
||||
vars_found = htab_create (50, htab_hash_pointer, htab_eq_pointer, NULL);
|
||||
memset (&walk_state, 0, sizeof (walk_state));
|
||||
walk_state.vars_found = vars_found;
|
||||
|
@ -200,11 +200,6 @@ struct var_ann_d GTY(())
|
||||
live at the same time and this can happen for each call to the
|
||||
dominator optimizer. */
|
||||
tree current_def;
|
||||
|
||||
/* Pointer to the structure that contains the sets of global
|
||||
variables modified by function calls. This field is only used
|
||||
for FUNCTION_DECLs. */
|
||||
static_vars_info_t static_vars_info;
|
||||
};
|
||||
|
||||
|
||||
|
@ -32,7 +32,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "tree-pass.h"
|
||||
#include "ggc.h"
|
||||
#include "timevar.h"
|
||||
#include "cgraph.h"
|
||||
|
||||
#include "langhooks.h"
|
||||
|
||||
@ -135,8 +134,8 @@ static inline void append_def (tree *);
|
||||
static inline void append_use (tree *);
|
||||
static void append_v_may_def (tree);
|
||||
static void append_v_must_def (tree);
|
||||
static void add_call_clobber_ops (tree, tree);
|
||||
static void add_call_read_ops (tree, tree);
|
||||
static void add_call_clobber_ops (tree);
|
||||
static void add_call_read_ops (tree);
|
||||
static void add_stmt_operand (tree *, tree, int);
|
||||
|
||||
/* Return a vector of contiguous memory for NUM def operands. */
|
||||
@ -1399,7 +1398,6 @@ get_call_expr_operands (tree stmt, tree expr)
|
||||
{
|
||||
tree op;
|
||||
int call_flags = call_expr_flags (expr);
|
||||
tree callee = get_callee_fndecl (expr);
|
||||
|
||||
/* Find uses in the called function. */
|
||||
get_expr_operands (stmt, &TREE_OPERAND (expr, 0), opf_none);
|
||||
@ -1416,9 +1414,9 @@ get_call_expr_operands (tree stmt, tree expr)
|
||||
there is no point in recording that. */
|
||||
if (TREE_SIDE_EFFECTS (expr)
|
||||
&& !(call_flags & (ECF_PURE | ECF_CONST | ECF_NORETURN)))
|
||||
add_call_clobber_ops (stmt, callee);
|
||||
add_call_clobber_ops (stmt);
|
||||
else if (!(call_flags & ECF_CONST))
|
||||
add_call_read_ops (stmt, callee);
|
||||
add_call_read_ops (stmt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1582,7 +1580,7 @@ note_addressable (tree var, stmt_ann_t s_ann)
|
||||
clobbered variables in the function. */
|
||||
|
||||
static void
|
||||
add_call_clobber_ops (tree stmt, tree callee)
|
||||
add_call_clobber_ops (tree stmt)
|
||||
{
|
||||
/* Functions that are not const, pure or never return may clobber
|
||||
call-clobbered variables. */
|
||||
@ -1598,59 +1596,16 @@ add_call_clobber_ops (tree stmt, tree callee)
|
||||
else
|
||||
{
|
||||
size_t i;
|
||||
bitmap not_read_b = NULL, not_written_b = NULL;
|
||||
bitmap_iterator bi;
|
||||
|
||||
/* Get info for module level statics. There is a bit set for
|
||||
each static if the call being processed does not read or
|
||||
write that variable. */
|
||||
|
||||
/* ??? Turn off the optimization until it gets fixed. */
|
||||
if (0 && callee)
|
||||
{
|
||||
not_read_b = get_global_statics_not_read (callee);
|
||||
not_written_b = get_global_statics_not_written (callee);
|
||||
}
|
||||
|
||||
EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
|
||||
{
|
||||
tree var = referenced_var (i);
|
||||
|
||||
bool not_read
|
||||
= not_read_b ? bitmap_bit_p (not_read_b, i) : false;
|
||||
bool not_written
|
||||
= not_written_b ? bitmap_bit_p (not_written_b, i) : false;
|
||||
|
||||
if (not_read)
|
||||
{
|
||||
/* The var is not read during the call. */
|
||||
if (!not_written)
|
||||
add_stmt_operand (&var, stmt, opf_is_def);
|
||||
}
|
||||
if (TREE_READONLY (var)
|
||||
&& (TREE_STATIC (var) || DECL_EXTERNAL (var)))
|
||||
add_stmt_operand (&var, stmt, opf_none);
|
||||
else
|
||||
{
|
||||
/* The var is read during the call. */
|
||||
if (not_written)
|
||||
add_stmt_operand (&var, stmt, opf_none);
|
||||
|
||||
/* The not_read and not_written bits are only set for module
|
||||
static variables. Neither is set here, so we may be dealing
|
||||
with a module static or we may not. So we still must look
|
||||
anywhere else we can (such as the TREE_READONLY) to get
|
||||
better info. */
|
||||
|
||||
/* If VAR is read-only, don't add a V_MAY_DEF, just a
|
||||
VUSE operand. FIXME, this is quirky. TREE_READONLY
|
||||
by itself is not enough here. We can only decide
|
||||
that the call will not affect VAR if all these
|
||||
conditions are met. One would think that
|
||||
TREE_READONLY should be sufficient. */
|
||||
else if (TREE_READONLY (var)
|
||||
&& (TREE_STATIC (var) || DECL_EXTERNAL (var)))
|
||||
add_stmt_operand (&var, stmt, opf_none);
|
||||
else
|
||||
add_stmt_operand (&var, stmt, opf_is_def);
|
||||
}
|
||||
add_stmt_operand (&var, stmt, opf_is_def);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1660,7 +1615,7 @@ add_call_clobber_ops (tree stmt, tree callee)
|
||||
function. */
|
||||
|
||||
static void
|
||||
add_call_read_ops (tree stmt, tree callee)
|
||||
add_call_read_ops (tree stmt)
|
||||
{
|
||||
bitmap_iterator bi;
|
||||
|
||||
@ -1673,15 +1628,10 @@ add_call_read_ops (tree stmt, tree callee)
|
||||
else
|
||||
{
|
||||
size_t i;
|
||||
bitmap not_read_b = callee
|
||||
? get_global_statics_not_read (callee) : NULL;
|
||||
|
||||
|
||||
EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
|
||||
{
|
||||
tree var = referenced_var (i);
|
||||
bool not_read = not_read_b
|
||||
? bitmap_bit_p(not_read_b, i) : false;
|
||||
if (!not_read)
|
||||
add_stmt_operand (&var, stmt, opf_none);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user