tree.h (union tree_ann_d): Don't declare.

* tree.h (union tree_ann_d): Don't declare.
	(tree_base): Remove ann field.
	(struct var_ann_d): Declare forward.
	(tree_result_decl, tree_parm_decl, tree_var_decl): Add ann field.
	(DECL_VAR_ANN_PTR): New macro.
	* tree-dfa.c (create_var_ann): Rewrite in terms of above macro,
	accept only VAR, PARM or RESULT decls.
	(create_tree_common_ann): Remove.
	(remove_referenced_var): Use DECL_VAR_ANN_PTR.
	* tree-eh.c (lookup_expr_eh_lp): Remove.
	* tree-flow-inline.h (var_ann, get_var_ann): Rewrite in terms of
	DECL_VAR_ANN_PTR.
	(ann_type, tree_common_ann, get_tree_common_ann): Remove.
	* tree-flow.h (enum tree_ann_type): Remove.
	(struct tree_ann_common_d): Remove.
	(struct var_ann_d): Remove common field.
	(union tree_ann_d): Remove.
	(tree_ann_t, tree_ann_common_t): Remove typedefs.
	(tree_common_ann, get_tree_common_ann, ann_type,
	create_tree_common_ann, lookup_expr_eh_lp): Don't declare.
	* tree-ssa.c (delete_tree_ssa): Use DECL_VAR_ANN_PTR.
	* tree.c (copy_node_stat): Use DECL_VAR_ANN_PTR.
	* builtins.c (expand_builtin_memcpy): Use
	currently_expanding_gimple_stmt instead of tree annotation.
	(expand_builtin_memset_args): Ditto.
	* cfgexpand.c (currently_expanding_gimple_stmt): Add global variable.
	(expand_call_stmt): Don't set tree annotation.
	(expand_gimple_basic_block): Set currently_expanding_gimple_stmt.
	* expr.c (expand_expr_real): Don't call lookup_expr_eh_lp.
	* gimple.h (currently_expanding_gimple_stmt): Declare.

From-SVN: r154502
This commit is contained in:
Michael Matz 2009-11-24 15:37:32 +00:00
parent 6e0b03f585
commit a5883ba0de
12 changed files with 86 additions and 169 deletions

View File

@ -1,3 +1,36 @@
2009-11-24 Michael Matz <matz@suse.de>
* tree.h (union tree_ann_d): Don't declare.
(tree_base): Remove ann field.
(struct var_ann_d): Declare forward.
(tree_result_decl, tree_parm_decl, tree_var_decl): Add ann field.
(DECL_VAR_ANN_PTR): New macro.
* tree-dfa.c (create_var_ann): Rewrite in terms of above macro,
accept only VAR, PARM or RESULT decls.
(create_tree_common_ann): Remove.
(remove_referenced_var): Use DECL_VAR_ANN_PTR.
* tree-eh.c (lookup_expr_eh_lp): Remove.
* tree-flow-inline.h (var_ann, get_var_ann): Rewrite in terms of
DECL_VAR_ANN_PTR.
(ann_type, tree_common_ann, get_tree_common_ann): Remove.
* tree-flow.h (enum tree_ann_type): Remove.
(struct tree_ann_common_d): Remove.
(struct var_ann_d): Remove common field.
(union tree_ann_d): Remove.
(tree_ann_t, tree_ann_common_t): Remove typedefs.
(tree_common_ann, get_tree_common_ann, ann_type,
create_tree_common_ann, lookup_expr_eh_lp): Don't declare.
* tree-ssa.c (delete_tree_ssa): Use DECL_VAR_ANN_PTR.
* tree.c (copy_node_stat): Use DECL_VAR_ANN_PTR.
* builtins.c (expand_builtin_memcpy): Use
currently_expanding_gimple_stmt instead of tree annotation.
(expand_builtin_memset_args): Ditto.
* cfgexpand.c (currently_expanding_gimple_stmt): Add global variable.
(expand_call_stmt): Don't set tree annotation.
(expand_gimple_basic_block): Set currently_expanding_gimple_stmt.
* expr.c (expand_expr_real): Don't call lookup_expr_eh_lp.
* gimple.h (currently_expanding_gimple_stmt): Declare.
2009-11-24 Paolo Carlini <paolo.carlini@oracle.com>
* dwarf2out.c (add_location_or_const_value_attribute): Remove
@ -11,7 +44,7 @@
2009-11-24 Basile Starynkevitch <basile@starynkevitch.net>
* Makefile.in (PLUGIN_HEADERS): Added files: cppdefault.h flags.h
* Makefile.in (PLUGIN_HEADERS): Added files: cppdefault.h flags.h
$(MD5_H) params.def params.h prefix.h tree-inline.h.
2009-11-24 Paul Brook <paul@codesourcery.com>
@ -30,14 +63,14 @@
* cfgrtl.c (commit_one_edge_insertion): Remove set but not used
local variable bb_note.
* dominance.c (get_dominated_by): Likewise local var n.
(output_file_names): Likewise local var idx.
(add_location_or_const_value_attribute): Likewise local var status.
* dwarf2out.c (gen_variable_die): Likewise local var field.
* emit-rtl.c (no_line_numbers): Remove.
* dominance.c (get_dominated_by): Likewise local var n.
(output_file_names): Likewise local var idx.
(add_location_or_const_value_attribute): Likewise local var status.
* dwarf2out.c (gen_variable_die): Likewise local var field.
* emit-rtl.c (no_line_numbers): Remove.
(init_emit_once): Remove line_numbers parameter.
* rtl.h (init_emit_once): Adjust prototype.
* toplev.c (backend_init): Adjust init_emit_once call.
* rtl.h (init_emit_once): Adjust prototype.
* toplev.c (backend_init): Adjust init_emit_once call.
2009-11-24 Richard Guenther <rguenther@suse.de>

View File

@ -3259,7 +3259,6 @@ expand_builtin_memcpy (tree exp, rtx target)
rtx dest_mem, src_mem, dest_addr, len_rtx;
HOST_WIDE_INT expected_size = -1;
unsigned int expected_align = 0;
tree_ann_common_t ann;
/* If DEST is not a pointer type, call the normal function. */
if (dest_align == 0)
@ -3270,9 +3269,9 @@ expand_builtin_memcpy (tree exp, rtx target)
if (src_align == 0)
return NULL_RTX;
ann = tree_common_ann (exp);
if (ann)
stringop_block_profile (ann->stmt, &expected_align, &expected_size);
if (currently_expanding_gimple_stmt)
stringop_block_profile (currently_expanding_gimple_stmt,
&expected_align, &expected_size);
if (expected_align < dest_align)
expected_align = dest_align;
@ -3737,7 +3736,6 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
rtx dest_mem, dest_addr, len_rtx;
HOST_WIDE_INT expected_size = -1;
unsigned int expected_align = 0;
tree_ann_common_t ann;
dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
@ -3745,9 +3743,9 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
if (dest_align == 0)
return NULL_RTX;
ann = tree_common_ann (orig_exp);
if (ann)
stringop_block_profile (ann->stmt, &expected_align, &expected_size);
if (currently_expanding_gimple_stmt)
stringop_block_profile (currently_expanding_gimple_stmt,
&expected_align, &expected_size);
if (expected_align < dest_align)
expected_align = dest_align;

View File

@ -49,6 +49,10 @@ along with GCC; see the file COPYING3. If not see
into RTL. */
struct ssaexpand SA;
/* This variable holds the currently expanded gimple statement for purposes
of comminucating the profile info to the builtin expanders. */
gimple currently_expanding_gimple_stmt;
/* Return an expression tree corresponding to the RHS of GIMPLE
statement STMT. */
@ -1756,7 +1760,6 @@ expand_call_stmt (gimple stmt)
{
tree exp;
tree lhs = gimple_call_lhs (stmt);
tree fndecl = gimple_call_fndecl (stmt);
size_t i;
exp = build_vl_exp (CALL_EXPR, gimple_call_num_args (stmt) + 3);
@ -1782,15 +1785,6 @@ expand_call_stmt (gimple stmt)
SET_EXPR_LOCATION (exp, gimple_location (stmt));
TREE_BLOCK (exp) = gimple_block (stmt);
/* Record the original call statement, as it may be used
to retrieve profile information during expansion. */
if (fndecl && DECL_BUILT_IN (fndecl))
{
tree_ann_common_t ann = get_tree_common_ann (exp);
ann->stmt = stmt;
}
if (lhs)
expand_assignment (lhs, exp, false);
else
@ -3106,6 +3100,7 @@ expand_gimple_basic_block (basic_block bb)
basic_block new_bb;
stmt = gsi_stmt (gsi);
currently_expanding_gimple_stmt = stmt;
/* Expand this statement, then evaluate the resulting RTL and
fixup the CFG accordingly. */
@ -3203,6 +3198,8 @@ expand_gimple_basic_block (basic_block bb)
}
}
currently_expanding_gimple_stmt = NULL;
/* Expand implicit goto and convert goto_locus. */
FOR_EACH_EDGE (e, ei, bb->succs)
{

View File

@ -7157,8 +7157,7 @@ rtx
expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
enum expand_modifier modifier, rtx *alt_rtl)
{
int lp_nr = 0;
rtx ret, last = NULL;
rtx ret;
/* Handle ERROR_MARK before anybody tries to access its type. */
if (TREE_CODE (exp) == ERROR_MARK
@ -7168,13 +7167,6 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
return ret ? ret : const0_rtx;
}
if (flag_non_call_exceptions)
{
lp_nr = lookup_expr_eh_lp (exp);
if (lp_nr)
last = get_last_insn ();
}
/* If this is an expression of some kind and it has an associated line
number, then emit the line number before expanding the expression.
@ -7201,25 +7193,6 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
ret = expand_expr_real_1 (exp, target, tmode, modifier, alt_rtl);
}
/* If using non-call exceptions, mark all insns that may trap.
expand_call() will mark CALL_INSNs before we get to this code,
but it doesn't handle libcalls, and these may trap. */
if (lp_nr)
{
rtx insn;
for (insn = next_real_insn (last); insn;
insn = next_real_insn (insn))
{
if (! find_reg_note (insn, REG_EH_REGION, NULL_RTX)
/* If we want exceptions for non-call insns, any
may_trap_p instruction may throw. */
&& GET_CODE (PATTERN (insn)) != CLOBBER
&& GET_CODE (PATTERN (insn)) != USE
&& insn_could_throw_p (insn))
make_reg_eh_region_note (insn, 0, lp_nr);
}
}
return ret;
}

View File

@ -769,6 +769,10 @@ extern size_t const gimple_ops_offset_[];
/* Map GIMPLE codes to GSS codes. */
extern enum gimple_statement_structure_enum const gss_for_code_[];
/* This variable holds the currently expanded gimple statement for purposes
of comminucating the profile info to the builtin expanders. */
extern gimple currently_expanding_gimple_stmt;
gimple gimple_build_return (tree);
gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);

View File

@ -133,12 +133,12 @@ create_var_ann (tree t)
var_ann_t ann;
gcc_assert (t);
gcc_assert (DECL_P (t));
gcc_assert (!t->base.ann || t->base.ann->common.type == VAR_ANN);
gcc_assert (TREE_CODE (t) == VAR_DECL
|| TREE_CODE (t) == PARM_DECL
|| TREE_CODE (t) == RESULT_DECL);
ann = GGC_CNEW (struct var_ann_d);
ann->common.type = VAR_ANN;
t->base.ann = (tree_ann_t) ann;
*DECL_VAR_ANN_PTR (t) = ann;
return ann;
}
@ -188,24 +188,6 @@ renumber_gimple_stmt_uids_in_blocks (basic_block *blocks, int n_blocks)
}
}
/* Create a new annotation for a tree T. */
tree_ann_common_t
create_tree_common_ann (tree t)
{
tree_ann_common_t ann;
gcc_assert (t);
gcc_assert (!t->base.ann || t->base.ann->common.type == TREE_ANN_COMMON);
ann = GGC_CNEW (struct tree_ann_common_d);
ann->type = TREE_ANN_COMMON;
t->base.ann = (tree_ann_t) ann;
return ann;
}
/* Build a temporary. Make sure and register it to be renamed. */
tree
@ -654,7 +636,7 @@ remove_referenced_var (tree var)
&& (v_ann = var_ann (var)))
{
ggc_free (v_ann);
var->base.ann = NULL;
*DECL_VAR_ANN_PTR (var) = NULL;
}
gcc_assert (DECL_P (var));
in.uid = uid;

View File

@ -203,21 +203,6 @@ lookup_stmt_eh_lp (gimple t)
return lookup_stmt_eh_lp_fn (cfun, t);
}
/* Likewise, but reference a tree expression instead. */
int
lookup_expr_eh_lp (tree t)
{
if (cfun && cfun->eh->throw_stmt_table && t && EXPR_P (t))
{
tree_ann_common_t ann = tree_common_ann (t);
if (ann)
return ann->lp_nr;
}
return 0;
}
/* First pass of EH node decomposition. Build up a tree of GIMPLE_TRY_FINALLY
nodes and LABEL_DECL nodes. We will use this during the second phase to
determine if a goto leaves the body of a TRY_FINALLY_EXPR node. */

View File

@ -152,15 +152,8 @@ fill_referenced_var_vec (VEC (tree, heap) **vec)
static inline var_ann_t
var_ann (const_tree t)
{
var_ann_t ann;
if (!t->base.ann)
return NULL;
ann = (var_ann_t) t->base.ann;
gcc_assert (ann->common.type == VAR_ANN);
return ann;
const var_ann_t *p = DECL_VAR_ANN_PTR (t);
return p ? *p : NULL;
}
/* Return the variable annotation for T, which must be a _DECL node.
@ -168,8 +161,9 @@ var_ann (const_tree t)
static inline var_ann_t
get_var_ann (tree var)
{
var_ann_t ann = var_ann (var);
return (ann) ? ann : create_var_ann (var);
var_ann_t *p = DECL_VAR_ANN_PTR (var);
gcc_assert (p);
return *p ? *p : create_var_ann (var);
}
/* Get the number of the next statement uid to be allocated. */
@ -193,13 +187,6 @@ inc_gimple_stmt_max_uid (struct function *fn)
return fn->last_stmt_uid++;
}
/* Return the annotation type for annotation ANN. */
static inline enum tree_ann_type
ann_type (tree_ann_t ann)
{
return ann->common.type;
}
/* Return the line number for EXPR, or return -1 if we have no line
number information for it. */
static inline int
@ -678,26 +665,6 @@ is_call_used (const_tree var)
&& pt_solution_includes (&cfun->gimple_df->callused, var)));
}
/* Return the common annotation for T. Return NULL if the annotation
doesn't already exist. */
static inline tree_ann_common_t
tree_common_ann (const_tree t)
{
/* Watch out static variables with unshared annotations. */
if (DECL_P (t) && TREE_CODE (t) == VAR_DECL)
return &var_ann (t)->common;
return &t->base.ann->common;
}
/* Return a common annotation for T. Create the constant annotation if it
doesn't exist. */
static inline tree_ann_common_t
get_tree_common_ann (tree t)
{
tree_ann_common_t ann = tree_common_ann (t);
return (ann) ? ann : create_tree_common_ann (t);
}
/* ----------------------------------------------------------------------- */
/* The following set of routines are used to iterator over various type of

View File

@ -125,24 +125,6 @@ struct GTY(()) ptr_info_def
};
/*---------------------------------------------------------------------------
Tree annotations stored in tree_base.ann
---------------------------------------------------------------------------*/
enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, FUNCTION_ANN };
struct GTY(()) tree_ann_common_d {
/* Annotation type. */
enum tree_ann_type type;
/* Record EH landing pad number into a statement tree created
during RTL expansion (see gimple_to_tree). */
int lp_nr;
/* Pointer to original GIMPLE statement. Used during RTL expansion
(see gimple_to_tree). */
gimple stmt;
};
/* It is advantageous to avoid things like life analysis for variables which
do not need PHI nodes. This enum describes whether or not a particular
variable may need a PHI node. */
@ -192,8 +174,6 @@ enum noalias_state {
struct GTY(()) var_ann_d {
struct tree_ann_common_d common;
/* Used when building base variable structures in a var_map. */
unsigned base_var_processed : 1;
@ -318,20 +298,10 @@ typedef struct immediate_use_iterator_d
union GTY((desc ("ann_type ((tree_ann_t)&%h)"))) tree_ann_d {
struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
struct var_ann_d GTY((tag ("VAR_ANN"))) vdecl;
};
typedef union tree_ann_d *tree_ann_t;
typedef struct var_ann_d *var_ann_t;
typedef struct tree_ann_common_d *tree_ann_common_t;
static inline tree_ann_common_t tree_common_ann (const_tree);
static inline tree_ann_common_t get_tree_common_ann (tree);
static inline var_ann_t var_ann (const_tree);
static inline var_ann_t get_var_ann (tree);
static inline enum tree_ann_type ann_type (tree_ann_t);
static inline void update_stmt (gimple);
static inline int get_lineno (const_gimple);
@ -556,7 +526,6 @@ extern const char *op_symbol_code (enum tree_code);
extern var_ann_t create_var_ann (tree);
extern void renumber_gimple_stmt_uids (void);
extern void renumber_gimple_stmt_uids_in_blocks (basic_block *, int);
extern tree_ann_common_t create_tree_common_ann (tree);
extern void dump_dfa_stats (FILE *);
extern void debug_dfa_stats (void);
extern void debug_referenced_vars (void);
@ -856,7 +825,6 @@ extern void add_stmt_to_eh_lp (gimple, int);
extern bool remove_stmt_from_eh_lp (gimple);
extern bool remove_stmt_from_eh_lp_fn (struct function *, gimple);
extern int lookup_stmt_eh_lp_fn (struct function *, gimple);
extern int lookup_expr_eh_lp (tree);
extern int lookup_stmt_eh_lp (gimple);
extern bool maybe_clean_eh_stmt_fn (struct function *, gimple);
extern bool maybe_clean_eh_stmt (gimple);

View File

@ -1138,9 +1138,11 @@ delete_tree_ssa (void)
{
if (is_global_var (var))
continue;
if (var->base.ann)
ggc_free (var->base.ann);
var->base.ann = NULL;
if (var_ann (var))
{
ggc_free (var_ann (var));
*DECL_VAR_ANN_PTR (var) = NULL;
}
}
htab_delete (gimple_referenced_vars (cfun));
cfun->gimple_df->referenced_vars = NULL;

View File

@ -955,7 +955,8 @@ copy_node_stat (tree node MEM_STAT_DECL)
TREE_CHAIN (t) = 0;
TREE_ASM_WRITTEN (t) = 0;
TREE_VISITED (t) = 0;
t->base.ann = 0;
if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
*DECL_VAR_ANN_PTR (t) = 0;
if (TREE_CODE_CLASS (code) == tcc_declaration)
{

View File

@ -356,7 +356,6 @@ enum omp_clause_code
See the accessor macros, defined below, for documentation of the
fields. */
union tree_ann_d;
struct GTY(()) tree_base {
ENUM_BITFIELD(tree_code) code : 16;
@ -398,8 +397,6 @@ struct GTY(()) tree_base {
in tree_base instead of tree_type is to save space. The size of the
field must be large enough to hold addr_space_t values. */
unsigned address_space : 8;
union tree_ann_d *ann;
};
struct GTY(()) tree_common {
@ -2854,8 +2851,10 @@ struct GTY(()) tree_label_decl {
int eh_landing_pad_nr;
};
struct var_ann_d;
struct GTY(()) tree_result_decl {
struct tree_decl_with_rtl common;
struct var_ann_d *ann;
};
struct GTY(()) tree_const_decl {
@ -2873,6 +2872,7 @@ struct GTY(()) tree_const_decl {
struct GTY(()) tree_parm_decl {
struct tree_decl_with_rtl common;
rtx incoming_rtl;
struct var_ann_d *ann;
};
@ -3082,8 +3082,15 @@ extern void decl_fini_priority_insert (tree, priority_type);
#define DECL_THREAD_LOCAL_P(NODE) \
(VAR_DECL_CHECK (NODE)->decl_with_vis.tls_model >= TLS_MODEL_REAL)
#define DECL_VAR_ANN_PTR(NODE) \
(TREE_CODE (NODE) == VAR_DECL ? &(NODE)->var_decl.ann \
: TREE_CODE (NODE) == PARM_DECL ? &(NODE)->parm_decl.ann \
: TREE_CODE (NODE) == RESULT_DECL ? &(NODE)->result_decl.ann \
: NULL)
struct GTY(()) tree_var_decl {
struct tree_decl_with_vis common;
struct var_ann_d *ann;
};