(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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154502
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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>
* 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>
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)
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;
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);
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;
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. */
{
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);
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
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. */
}
}
+ currently_expanding_gimple_stmt = NULL;
+
/* Expand implicit goto and convert goto_locus. */
FOR_EACH_EDGE (e, ei, bb->succs)
{
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
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.
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;
}
/* 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);
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;
}
}
}
-/* 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
&& (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;
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. */
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.
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. */
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
&& 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
};
-/*---------------------------------------------------------------------------
- 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. */
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;
-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);
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);
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);
{
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;
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)
{
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;
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 {
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 {
struct GTY(()) tree_parm_decl {
struct tree_decl_with_rtl common;
rtx incoming_rtl;
+ struct var_ann_d *ann;
};
#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;
};