aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Zadeck <zadeck@naturalbridge.com>2008-01-28 22:36:46 +0000
committerKenneth Zadeck <zadeck@naturalbridge.com>2008-01-28 22:36:46 +0000
commit8c87bf47da20e1c7f16ff707bb40c16971abaaf4 (patch)
tree0ad05f3947a9c3981ff4c90c62bf427146695b3c
parentc58dfa580829567578071139c4f70b49331b186f (diff)
2008-01-28 Kenneth Zadeck <zadeck@naturalbridge.com>
* lto-function-in.c (input_globals.c): Changed input type to lto_function_header. (input_bb): Removed code to deserialize the stmt number. (input_function): Renumber all stmts after they are input. (lto_read_body, lto_read_function_body, lto_read_var_init): Changed to used new header format and enum section_type. *lto-lang.c (success): Removed. 2008-01-28 Kenneth Zadeck <zadeck@naturalbridge.com> * cgraph.h (cgraph_edge.lto_stmt_uid): New field. * lto-function-out.c (output_constructor, output_expr_operand, output_phi, output_bb, output_function): Removal of code to thread the stmt_number thru the code. (produce_asm): Moved code to create dwarf_sections to lto_section_out.c. Encapsulated section type independent code into separate header structure. Changed to use enum section_type. (output_function, output_constructor_or_init): Added call to renumber_gimple_stmt_uids and to pass section type to produce_asm. (lto_output): Pass cgraph node rather than decl to output_function. * tree-ssa-dse (max_stmt_uid): Removed. (get_stmt_uid, dse_possible_dead_store_p, dse_optimize_stmt, tree_ssa_dse): Encapsulate all uses of stmt_ann->uid. * tree-ssa-sccvn.c (compare_ops, init_scc_vn): Ditto. * lto-header.h: New * function.h (cfun.last_stmt_uid): New field. * lto-tags.h (lto_header): Renamed to lto_function_header and moved shared fields to lto_header in lto-header.h. (LTO_SECTION_NAME_PREFIX): Moved to lto-header.h. * tree-flow-inline.h (set_gimple_stmt_uid, gimple_stmt_uid, gimple_stmt_max_uid, set_gimple_stmt_max_uid, inc_gimple_stmt_max_uid): New functions. * tree-dfa.c (renumber_gimple_stmt_uids): New function. (create_stmt_ann): Initialize the ann->uid field. * tree-ssa-pre.c (compute_avail): Encapsulate the stmt_ann->uid with new calls. * tree-flow.h (renumber_gimple_stmt_uids): New function. * lto-section-out.c (lto_get_section): New function. * lto-section-out.h (lto_get_section): New function. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/lto@131922 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.lto32
-rw-r--r--gcc/cgraph.h3
-rw-r--r--gcc/function.h3
-rw-r--r--gcc/lto-function-out.c162
-rw-r--r--gcc/lto-header.h49
-rw-r--r--gcc/lto-section-out.c27
-rw-r--r--gcc/lto-section-out.h1
-rw-r--r--gcc/lto-tags.h19
-rw-r--r--gcc/lto/ChangeLog10
-rw-r--r--gcc/lto/lto-function-in.c53
-rw-r--r--gcc/lto/lto-lang.c1
-rw-r--r--gcc/tree-dfa.c26
-rw-r--r--gcc/tree-flow-inline.h35
-rw-r--r--gcc/tree-flow.h9
-rw-r--r--gcc/tree-ssa-dse.c27
-rw-r--r--gcc/tree-ssa-pre.c2
-rw-r--r--gcc/tree-ssa-sccvn.c13
17 files changed, 310 insertions, 162 deletions
diff --git a/gcc/ChangeLog.lto b/gcc/ChangeLog.lto
index ac4d520350f..0c02a23d57d 100644
--- a/gcc/ChangeLog.lto
+++ b/gcc/ChangeLog.lto
@@ -1,3 +1,35 @@
+2008-01-28 Kenneth Zadeck <zadeck@naturalbridge.com>
+ * cgraph.h (cgraph_edge.lto_stmt_uid): New field.
+ * lto-function-out.c (output_constructor, output_expr_operand,
+ output_phi, output_bb, output_function): Removal of code to thread
+ the stmt_number thru the code.
+ (produce_asm): Moved code to create dwarf_sections to
+ lto_section_out.c. Encapsulated section type independent code
+ into separate header structure. Changed to use enum section_type.
+ (output_function, output_constructor_or_init): Added call to
+ renumber_gimple_stmt_uids and to pass section type to produce_asm.
+ (lto_output): Pass cgraph node rather than decl to
+ output_function.
+ * tree-ssa-dse (max_stmt_uid): Removed.
+ (get_stmt_uid, dse_possible_dead_store_p, dse_optimize_stmt,
+ tree_ssa_dse): Encapsulate all uses of stmt_ann->uid.
+ * tree-ssa-sccvn.c (compare_ops, init_scc_vn): Ditto.
+ * lto-header.h: New
+ * function.h (cfun.last_stmt_uid): New field.
+ * lto-tags.h (lto_header): Renamed to lto_function_header and
+ moved shared fields to lto_header in lto-header.h.
+ (LTO_SECTION_NAME_PREFIX): Moved to lto-header.h.
+ * tree-flow-inline.h (set_gimple_stmt_uid, gimple_stmt_uid,
+ gimple_stmt_max_uid, set_gimple_stmt_max_uid,
+ inc_gimple_stmt_max_uid): New functions.
+ * tree-dfa.c (renumber_gimple_stmt_uids): New function.
+ (create_stmt_ann): Initialize the ann->uid field.
+ * tree-ssa-pre.c (compute_avail): Encapsulate the stmt_ann->uid
+ with new calls.
+ * tree-flow.h (renumber_gimple_stmt_uids): New function.
+ * lto-section-out.c (lto_get_section): New function.
+ * lto-section-out.h (lto_get_section): New function.
+
2008-01-14 Kenneth Zadeck <zadeck@naturalbridge.com>
* lto-function-out (lto_debug_context, output_stream,
LTO_SET_DEBUGGING_STREAM): Moved to lto_section_out.h.
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 8647d837e2d..63de65a1fe9 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -194,6 +194,9 @@ struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_call
struct cgraph_edge *prev_callee;
struct cgraph_edge *next_callee;
tree call_stmt;
+ /* The stmt_uid of this call stmt. This is used by LTO to recover
+ the call_stmt when the function is serialized in. */
+ unsigned int lto_stmt_uid;
PTR GTY ((skip (""))) aux;
/* When NULL, inline this call. When non-NULL, points to the explanation
why function was not inlined. */
diff --git a/gcc/function.h b/gcc/function.h
index 27bde1c3bd0..fefd8da2c97 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -316,6 +316,9 @@ struct function GTY(())
/* UIDs for LABEL_DECLs. */
int last_label_uid;
+ /* Last statement uid. */
+ int last_stmt_uid;
+
/* Line number of the end of the function. */
location_t function_end_locus;
diff --git a/gcc/lto-function-out.c b/gcc/lto-function-out.c
index b99c1990eb7..32cd9a4459b 100644
--- a/gcc/lto-function-out.c
+++ b/gcc/lto-function-out.c
@@ -291,7 +291,7 @@ struct output_block
/* The output stream that contains the abbrev table for all of the
functions in this compilation unit. */
-static void output_expr_operand (struct output_block *, tree, unsigned int);
+static void output_expr_operand (struct output_block *, tree);
/* Clear the line info stored in DATA_IN. */
@@ -1019,7 +1019,7 @@ output_constructor (struct output_block *ob, tree ctor)
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), idx, purpose, value)
{
if (purpose)
- output_expr_operand (ob, purpose, 0);
+ output_expr_operand (ob, purpose);
else
output_zero (ob);
@@ -1029,14 +1029,14 @@ output_constructor (struct output_block *ob, tree ctor)
LTO_DEBUG_UNDENT ();
}
else
- output_expr_operand (ob, value, 0);
+ output_expr_operand (ob, value);
}
}
/* Output EXPR to the main stream in OB. */
static void
-output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
+output_expr_operand (struct output_block *ob, tree expr)
{
enum tree_code code;
enum tree_code_class class;
@@ -1144,9 +1144,9 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
LTO_case_label_expr0 + variant);
if (CASE_LOW (expr) != NULL_TREE)
- output_expr_operand (ob, CASE_LOW (expr), stmt_num);
+ output_expr_operand (ob, CASE_LOW (expr));
if (CASE_HIGH (expr) != NULL_TREE)
- output_expr_operand (ob, CASE_HIGH (expr), stmt_num);
+ output_expr_operand (ob, CASE_HIGH (expr));
output_label_ref (ob, CASE_LABEL (expr));
}
break;
@@ -1244,14 +1244,14 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
if (TREE_OPERAND (expr, 1))
{
output_record_start (ob, expr, expr, LTO_cond_expr0);
- output_expr_operand (ob, TREE_OPERAND (expr, 0), stmt_num);
- output_expr_operand (ob, TREE_OPERAND (expr, 1), stmt_num);
- output_expr_operand (ob, TREE_OPERAND (expr, 2), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, 0));
+ output_expr_operand (ob, TREE_OPERAND (expr, 1));
+ output_expr_operand (ob, TREE_OPERAND (expr, 2));
}
else
{
output_record_start (ob, expr, expr, LTO_cond_expr1);
- output_expr_operand (ob, TREE_OPERAND (expr, 0), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, 0));
}
break;
@@ -1261,8 +1261,8 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
case COMPONENT_REF:
output_record_start (ob, expr, expr, tag);
- output_expr_operand (ob, TREE_OPERAND (expr, 0), stmt_num);
- output_expr_operand (ob, TREE_OPERAND (expr, 1), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, 0));
+ output_expr_operand (ob, TREE_OPERAND (expr, 1));
/* Ignore 3 because it can be recomputed. */
break;
@@ -1276,16 +1276,16 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
{
output_record_start (ob, expr, expr, LTO_call_expr1);
output_uleb128 (ob, count);
- output_expr_operand (ob, TREE_OPERAND (expr, 2), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, 2));
}
else
{
output_record_start (ob, expr, expr, LTO_call_expr0);
output_uleb128 (ob, count);
}
- output_expr_operand (ob, TREE_OPERAND (expr, 1), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, 1));
for (i = 3; i < count; i++)
- output_expr_operand (ob, TREE_OPERAND (expr, i), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, i));
}
break;
@@ -1300,15 +1300,15 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
LTO_bit_field_ref1);
output_uleb128 (ob, TREE_INT_CST_LOW (op1));
output_uleb128 (ob, TREE_INT_CST_LOW (op2));
- output_expr_operand (ob, TREE_OPERAND (expr, 0), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, 0));
}
else
{
output_record_start (ob, expr, expr,
LTO_bit_field_ref0);
- output_expr_operand (ob, TREE_OPERAND (expr, 0), stmt_num);
- output_expr_operand (ob, op1, stmt_num);
- output_expr_operand (ob, op2, stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, 0));
+ output_expr_operand (ob, op1);
+ output_expr_operand (ob, op2);
}
}
break;
@@ -1318,8 +1318,8 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
/* Ignore operands 2 and 3 for ARRAY_REF and ARRAY_RANGE REF
because they can be recomputed. */
output_record_start (ob, expr, expr, tag);
- output_expr_operand (ob, TREE_OPERAND (expr, 0), stmt_num);
- output_expr_operand (ob, TREE_OPERAND (expr, 1), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, 0));
+ output_expr_operand (ob, TREE_OPERAND (expr, 1));
break;
@@ -1331,17 +1331,17 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
TREE_STRING_POINTER (string_cst),
TREE_STRING_LENGTH (string_cst));
if (ASM_INPUTS (expr))
- output_expr_operand (ob, ASM_INPUTS (expr), stmt_num);
+ output_expr_operand (ob, ASM_INPUTS (expr));
else
output_zero (ob);
if (ASM_OUTPUTS (expr))
- output_expr_operand (ob, ASM_OUTPUTS (expr), stmt_num);
+ output_expr_operand (ob, ASM_OUTPUTS (expr));
else
output_zero (ob);
if (ASM_CLOBBERS (expr))
- output_expr_operand (ob, ASM_CLOBBERS (expr), stmt_num);
+ output_expr_operand (ob, ASM_CLOBBERS (expr));
else
output_zero (ob);
}
@@ -1377,8 +1377,8 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
/* Form return a = b; */
output_record_start (ob, expr, expr,
LTO_return_expr2);
- output_expr_operand (ob, TREE_OPERAND (t, 0), stmt_num);
- output_expr_operand (ob, TREE_OPERAND (t, 1), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (t, 0));
+ output_expr_operand (ob, TREE_OPERAND (t, 1));
}
else
{
@@ -1393,15 +1393,15 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
if (t == DECL_RESULT (current_function_decl))
output_zero (ob);
else
- output_expr_operand (ob, t, stmt_num);
+ output_expr_operand (ob, t);
}
}
break;
case GIMPLE_MODIFY_STMT:
output_record_start (ob, expr, NULL, tag);
- output_expr_operand (ob, GIMPLE_STMT_OPERAND (expr, 0), stmt_num);
- output_expr_operand (ob, GIMPLE_STMT_OPERAND (expr, 1), stmt_num);
+ output_expr_operand (ob, GIMPLE_STMT_OPERAND (expr, 0));
+ output_expr_operand (ob, GIMPLE_STMT_OPERAND (expr, 1));
break;
case SWITCH_EXPR:
@@ -1411,11 +1411,11 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
size_t i;
output_record_start (ob, expr, expr, tag);
output_uleb128 (ob, len);
- output_expr_operand (ob, TREE_OPERAND (expr, 0), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, 0));
gcc_assert (TREE_OPERAND (expr, 1) == NULL);
for (i = 0; i < len; ++i)
- output_expr_operand (ob, TREE_VEC_ELT (label_vec, i), stmt_num);
+ output_expr_operand (ob, TREE_VEC_ELT (label_vec, i));
}
break;
@@ -1433,12 +1433,12 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
for (tl = expr; tl; tl = TREE_CHAIN (tl))
{
if (TREE_VALUE (tl) != NULL_TREE)
- output_expr_operand (ob, TREE_VALUE (tl), stmt_num);
+ output_expr_operand (ob, TREE_VALUE (tl));
else
output_zero (ob);
if (TREE_PURPOSE (tl))
- output_expr_operand (ob, TREE_PURPOSE (tl), stmt_num);
+ output_expr_operand (ob, TREE_PURPOSE (tl));
else
output_zero (ob);
}
@@ -1459,7 +1459,7 @@ output_expr_operand (struct output_block *ob, tree expr, unsigned int stmt_num)
#undef SET_NAME
output_record_start (ob, expr, expr, tag);
for (i = 0; i < TREE_CODE_LENGTH (TREE_CODE (expr)); i++)
- output_expr_operand (ob, TREE_OPERAND (expr, i), stmt_num);
+ output_expr_operand (ob, TREE_OPERAND (expr, i));
break;
}
@@ -1543,7 +1543,7 @@ output_local_var (struct output_block *ob, int index)
{
LTO_DEBUG_INDENT_TOKEN ("init");
if (DECL_INITIAL (decl))
- output_expr_operand (ob, DECL_INITIAL (decl), 0);
+ output_expr_operand (ob, DECL_INITIAL (decl));
else
output_zero (ob);
/* Index in unexpanded_vars_list. */
@@ -1556,7 +1556,7 @@ output_local_var (struct output_block *ob, int index)
/* The chain is only necessary for parm_decls. */
LTO_DEBUG_TOKEN ("chain");
if (TREE_CHAIN (decl))
- output_expr_operand (ob, TREE_CHAIN (decl), 0);
+ output_expr_operand (ob, TREE_CHAIN (decl));
else
output_zero (ob);
}
@@ -1566,7 +1566,7 @@ output_local_var (struct output_block *ob, int index)
LTO_DEBUG_TOKEN ("context");
if (DECL_CONTEXT (decl))
- output_expr_operand (ob, DECL_CONTEXT (decl), 0);
+ output_expr_operand (ob, DECL_CONTEXT (decl));
else
output_zero (ob);
@@ -1575,18 +1575,18 @@ output_local_var (struct output_block *ob, int index)
/* Put out the subtrees. */
LTO_DEBUG_TOKEN ("size");
- output_expr_operand (ob, DECL_SIZE (decl), 0);
+ output_expr_operand (ob, DECL_SIZE (decl));
if (DECL_ATTRIBUTES (decl)!= NULL_TREE)
{
LTO_DEBUG_TOKEN ("attributes");
- output_expr_operand (ob, DECL_ATTRIBUTES (decl), 0);
+ output_expr_operand (ob, DECL_ATTRIBUTES (decl));
}
if (DECL_SIZE_UNIT (decl) != NULL_TREE)
- output_expr_operand (ob, DECL_SIZE_UNIT (decl), 0);
+ output_expr_operand (ob, DECL_SIZE_UNIT (decl));
if (needs_backing_var)
- output_expr_operand (ob, DECL_DEBUG_EXPR (decl), 0);
+ output_expr_operand (ob, DECL_DEBUG_EXPR (decl));
if (DECL_ABSTRACT_ORIGIN (decl) != NULL_TREE)
- output_expr_operand (ob, DECL_ABSTRACT_ORIGIN (decl), 0);
+ output_expr_operand (ob, DECL_ABSTRACT_ORIGIN (decl));
LTO_DEBUG_UNDENT();
}
@@ -1624,7 +1624,7 @@ output_local_vars (struct output_block *ob, struct function *fn)
if (!bitmap_bit_p (local_statics, DECL_UID (lv)))
{
bitmap_set_bit (local_statics, DECL_UID (lv));
- output_expr_operand (ob, lv, 0);
+ output_expr_operand (ob, lv);
if (DECL_CONTEXT (lv) == fn->decl)
{
output_uleb128 (ob, 1); /* Restore context. */
@@ -1634,7 +1634,7 @@ output_local_vars (struct output_block *ob, struct function *fn)
output_zero (ob); /* Restore context. */
}
if (DECL_INITIAL (lv))
- output_expr_operand (ob, DECL_INITIAL (lv), 0);
+ output_expr_operand (ob, DECL_INITIAL (lv));
else
output_zero (ob); /* DECL_INITIAL. */
}
@@ -1732,7 +1732,7 @@ output_ssa_names (struct output_block *ob, struct function *fn)
continue;
output_uleb128 (ob, i);
- output_expr_operand (ob, SSA_NAME_VAR (ptr), 0);
+ output_expr_operand (ob, SSA_NAME_VAR (ptr));
/* Use code 0 to force flags to be output. */
output_tree_flags (ob, 0, ptr, false);
}
@@ -1796,7 +1796,7 @@ output_cfg (struct output_block *ob, struct function *fn)
/* Output a phi function to the main stream in OB. */
static void
-output_phi (struct output_block *ob, tree expr, unsigned int stmt_num)
+output_phi (struct output_block *ob, tree expr)
{
int len = PHI_NUM_ARGS (expr);
int i;
@@ -1806,7 +1806,7 @@ output_phi (struct output_block *ob, tree expr, unsigned int stmt_num)
for (i = 0; i < len; i++)
{
- output_expr_operand (ob, PHI_ARG_DEF (expr, i), stmt_num);
+ output_expr_operand (ob, PHI_ARG_DEF (expr, i));
output_uleb128 (ob, PHI_ARG_EDGE (expr, i)->src->index);
}
LTO_DEBUG_UNDENT ();
@@ -1815,9 +1815,8 @@ output_phi (struct output_block *ob, tree expr, unsigned int stmt_num)
/* Output a basic block BB to the main stream in OB for this FN. */
-static int
-output_bb (struct output_block *ob, basic_block bb,
- struct function *fn, int stmt_num)
+static void
+output_bb (struct output_block *ob, basic_block bb, struct function *fn)
{
block_stmt_iterator bsi = bsi_start (bb);
@@ -1840,9 +1839,7 @@ output_bb (struct output_block *ob, basic_block bb,
tree stmt = bsi_stmt (bsi);
LTO_DEBUG_INDENT_TOKEN ("stmt");
- output_uleb128 (ob, stmt_num);
-
- output_expr_operand (ob, stmt, stmt_num);
+ output_expr_operand (ob, stmt);
/* We only need to set the region number of the tree that
could throw if the region number is different from the
@@ -1860,7 +1857,6 @@ output_bb (struct output_block *ob, basic_block bb,
last_eh_region_seen = region;
}
}
- stmt_num++;
}
LTO_DEBUG_INDENT_TOKEN ("stmt");
@@ -1869,9 +1865,7 @@ output_bb (struct output_block *ob, basic_block bb,
for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
{
LTO_DEBUG_INDENT_TOKEN ("phi");
- output_uleb128 (ob, stmt_num);
- output_phi (ob, phi, stmt_num);
- stmt_num++;
+ output_phi (ob, phi);
}
LTO_DEBUG_INDENT_TOKEN ("phi");
@@ -1883,7 +1877,6 @@ output_bb (struct output_block *ob, basic_block bb,
#ifdef LTO_STREAM_DEBUGGING
gcc_assert (lto_debug_context.indent == 1);
#endif
- return stmt_num;
}
/* Write the references for the objects in V to section SEC in the
@@ -1912,29 +1905,29 @@ write_references (VEC(tree,heap) *v, section *sec,
/* Create the header in the file using OB for t. */
static void
-produce_asm (struct output_block *ob, tree t, bool is_function)
+produce_asm (struct output_block *ob, tree t, enum lto_section_type section_type)
{
const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (t));
- const char *section_name = concat (LTO_SECTION_NAME_PREFIX, name, NULL);
- section *section = get_section (section_name, SECTION_DEBUG, t);
- struct lto_header header;
+ struct lto_function_header header;
+ section *section = lto_get_section (section_type, name);
- memset (&header, 0, sizeof (struct lto_header));
+ memset (&header, 0, sizeof (struct lto_function_header));
/* The entire header is stream computed here. */
switch_to_section (section);
/* Write the header which says how to decode the pieces of the
t. */
- header.major_version = LTO_major_version;
- header.minor_version = LTO_minor_version;
+ header.lto_header.major_version = LTO_major_version;
+ header.lto_header.minor_version = LTO_minor_version;
+ header.lto_header.section_type = section_type;
header.num_field_decls = VEC_length (tree, ob->field_decls);
header.num_fn_decls = VEC_length (tree, ob->fn_decls);
header.num_var_decls = VEC_length (tree, ob->var_decls);
header.num_type_decls = VEC_length (tree, ob->type_decls);
header.num_types = VEC_length (tree, ob->types);
- if (is_function)
+ if (section_type == lto_function_body)
{
header.num_local_decls = VEC_length (tree, ob->local_decls);
header.num_named_labels = ob->next_named_label_index;
@@ -1942,7 +1935,7 @@ produce_asm (struct output_block *ob, tree t, bool is_function)
}
header.compressed_size = 0;
- if (is_function)
+ if (section_type == lto_function_body)
{
header.named_label_size = ob->named_label_stream->total_size;
header.ssa_names_size = ob->ssa_names_stream->total_size;
@@ -1953,7 +1946,7 @@ produce_asm (struct output_block *ob, tree t, bool is_function)
header.main_size = ob->main_stream->total_size;
header.string_size = ob->string_stream->total_size;
#ifdef LTO_STREAM_DEBUGGING
- if (is_function)
+ if (section_type == lto_function_body)
{
header.debug_decl_index_size = ob->debug_decl_index_stream->total_size;
header.debug_decl_size = ob->debug_decl_stream->total_size;
@@ -1972,7 +1965,7 @@ produce_asm (struct output_block *ob, tree t, bool is_function)
#endif
assemble_string ((const char *)&header,
- sizeof (struct lto_header));
+ sizeof (struct lto_function_header));
/* Write the global field references. */
write_references (ob->field_decls, section, lto_field_ref);
@@ -1991,7 +1984,7 @@ produce_asm (struct output_block *ob, tree t, bool is_function)
/* Put all of the gimple and the string table out the asm file as a
block of text. */
- if (is_function)
+ if (section_type == lto_function_body)
{
lto_write_stream (ob->named_label_stream);
lto_write_stream (ob->ssa_names_stream);
@@ -2002,7 +1995,7 @@ produce_asm (struct output_block *ob, tree t, bool is_function)
lto_write_stream (ob->main_stream);
lto_write_stream (ob->string_stream);
#ifdef LTO_STREAM_DEBUGGING
- if (is_function)
+ if (section_type == lto_function_body)
{
lto_write_stream (ob->debug_decl_index_stream);
lto_write_stream (ob->debug_decl_stream);
@@ -2129,12 +2122,12 @@ generate_early_dwarf_information (tree function)
/* Output FN. */
static void
-output_function (tree function)
+output_function (struct cgraph_node* node)
{
+ tree function = node->decl;
struct function *fn = DECL_STRUCT_FUNCTION (function);
basic_block bb;
struct output_block *ob = create_output_block (true);
- unsigned int stmt_num = 1;
LTO_SET_DEBUGGING_STREAM (debug_main_stream, main_data);
clear_line_info (ob);
@@ -2161,19 +2154,25 @@ output_function (tree function)
/* Output the head of the arguments list. */
LTO_DEBUG_INDENT_TOKEN ("decl_arguments");
if (DECL_ARGUMENTS (function))
- output_expr_operand (ob, DECL_ARGUMENTS (function), 0);
+ output_expr_operand (ob, DECL_ARGUMENTS (function));
else
output_zero (ob);
LTO_DEBUG_INDENT_TOKEN ("decl_context");
if (DECL_CONTEXT (function))
- output_expr_operand (ob, DECL_CONTEXT (function), 0);
+ output_expr_operand (ob, DECL_CONTEXT (function));
else
output_zero (ob);
+ /* We will renumber the statements. The code that does this uses
+ the same ordering that we use for serializing them so we can use
+ the same code on the other end and not have to write out the
+ statement numbers. */
+ renumber_gimple_stmt_uids ();
+
/* Output the code for the function. */
FOR_ALL_BB_FN (bb, fn)
- stmt_num = output_bb (ob, bb, fn, stmt_num);
+ output_bb (ob, bb, fn);
/* The terminator for this function. */
output_zero (ob);
@@ -2196,7 +2195,7 @@ output_function (tree function)
/* Create a file to hold the pickled output of this function. This
is a temp standin until we start writing sections. */
- produce_asm (ob, function, true);
+ produce_asm (ob, function, lto_function_body);
destroy_output_block (ob, true);
@@ -2220,15 +2219,12 @@ output_constructor_or_init (tree var)
lto_output_1_stream (ob->string_stream, 0);
LTO_DEBUG_INDENT_TOKEN ("init");
- output_expr_operand (ob, DECL_INITIAL (var), 0);
+ output_expr_operand (ob, DECL_INITIAL (var));
/* The terminator for the constructor. */
output_zero (ob);
- /* Create a file to hold the pickled output of this function. This
- is a temp standin until we start writing sections. */
- produce_asm (ob, var, false);
-
+ produce_asm (ob, var, lto_static_initializer);
destroy_output_block (ob, false);
}
@@ -2252,7 +2248,7 @@ lto_output (void)
ones of them. */
for (node = cgraph_nodes; node; node = node->next)
if (node->analyzed && cgraph_is_master_clone (node, false))
- output_function (node->decl);
+ output_function (node);
/* Process the global static vars that have initializers or
constructors. */
diff --git a/gcc/lto-header.h b/gcc/lto-header.h
new file mode 100644
index 00000000000..a61c8bf2446
--- /dev/null
+++ b/gcc/lto-header.h
@@ -0,0 +1,49 @@
+/* Declarations of the section header.
+
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING. If not, write to the Free
+ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+#ifndef GCC_LTO_HEADER_H
+#define GCC_LTO_HEADER_H
+
+/* The string that is the prefix on the section names we make for lto.
+ For decls the DECL_ASSEMBLER_NAME is appended to make the section
+ name for the functions and static_initializers. For other types of
+ sections a '.' and the section type are appended. */
+#define LTO_SECTION_NAME_PREFIX ".gnu.lto_"
+
+#define LTO_major_version 1
+#define LTO_minor_version 0
+
+enum lto_section_type
+{
+ lto_function_body,
+ lto_static_initializer,
+ lto_cgraph
+};
+
+struct lto_header
+{
+ int16_t major_version; /* LTO_major_version. */
+ int16_t minor_version; /* LTO_minor_version. */
+ enum lto_section_type section_type;
+};
+
+#endif /* lto-header.h */
diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c
index 33d9e2372bd..989e56b3f86 100644
--- a/gcc/lto-section-out.c
+++ b/gcc/lto-section-out.c
@@ -51,6 +51,33 @@ along with GCC; see the file COPYING3. If not see
#include "lto-section-out.h"
#include <ctype.h>
+/* Get a section for writing of a particular type or name. The NAME
+ field is only used if SECTION_TYPE is lto_function_body or
+ lto_static_initializer. */
+section *
+lto_get_section (enum lto_section_type section_type, const char * name)
+{
+ char *section_name;
+ section *section;
+
+ switch (section_type)
+ {
+ case lto_function_body:
+ case lto_static_initializer:
+ section_name = concat (LTO_SECTION_NAME_PREFIX, name, NULL);
+ break;
+
+ case lto_cgraph:
+ section_name = concat (LTO_SECTION_NAME_PREFIX, ".cgraph", NULL);
+ break;
+ }
+
+ section = get_section (section_name, SECTION_DEBUG, NULL);
+ free (section_name);
+ return section;
+}
+
+
/* Write all of the chars in OBS to the assembler. Recycle the blocks
in obs as this is being done. */
diff --git a/gcc/lto-section-out.h b/gcc/lto-section-out.h
index 4bc4d814c4d..949a5e4906a 100644
--- a/gcc/lto-section-out.h
+++ b/gcc/lto-section-out.h
@@ -67,6 +67,7 @@ do { \
#endif
+section *lto_get_section (enum lto_section_type, const char *);
void lto_write_stream (struct lto_output_stream *);
void lto_output_1_stream (struct lto_output_stream *, char);
void lto_output_uleb128_stream (struct lto_output_stream *, unsigned HOST_WIDE_INT);
diff --git a/gcc/lto-tags.h b/gcc/lto-tags.h
index 52f6c1b2a0e..35d78cc4b67 100644
--- a/gcc/lto-tags.h
+++ b/gcc/lto-tags.h
@@ -1,7 +1,7 @@
/* Declarations and definitions of codes relating to the
encoding of gimple into the object files.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
This file is part of GCC.
@@ -26,9 +26,7 @@
#include "tree.h"
#include "sbitmap.h"
-
-#define LTO_major_version 0
-#define LTO_minor_version 3
+#include "lto-header.h"
/* This file is one header in a collection of files that write the
gimple intermediate code for a function into the assembly stream
@@ -64,10 +62,9 @@
/* The is the first part of the record for a function or constructor
in the .o file. */
-struct lto_header
+struct lto_function_header
{
- int16_t major_version; /* LTO_major_version. */
- int16_t minor_version; /* LTO_minor_version. */
+ struct lto_header lto_header; /* The header for all types of sections. */
int32_t num_field_decls; /* Number of FIELD_DECLS. */
int32_t num_fn_decls; /* Number of FUNCTION_DECLS. */
int32_t num_var_decls; /* Number of non local VAR_DECLS. */
@@ -466,18 +463,12 @@ enum LTO_tags {
variant |= needs_backing_var ? 0x04 : 0;
variant |= ABSTRACT_ORIGIN (decl) != NULL_TREE ? 0x08 : 0;
- These next two tags must have their last hex digit be 0.
-*/
-
+ These next two tags must have their last hex digit be 0. */
LTO_local_var_decl_body0 = 0x0C0,
LTO_parm_decl_body0 = 0x0D0,
LTO_last_tag = 0x0E0
};
-/* The string that is prepended on the DECL_ASSEMBLER_NAME to make the
- section name for the function. */
-#define LTO_SECTION_NAME_PREFIX ".gnu.lto_"
-
/* This bitmap is indexed by gimple type codes and contains a 1 if the
tree type needs to have the type written. */
extern sbitmap lto_types_needed_for;
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 4299cde0856..67c76fc263f 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,13 @@
+2008-01-28 Kenneth Zadeck <zadeck@naturalbridge.com>
+
+ * lto-function-in.c (input_globals.c): Changed input type to
+ lto_function_header.
+ (input_bb): Removed code to deserialize the stmt number.
+ (input_function): Renumber all stmts after they are input.
+ (lto_read_body, lto_read_function_body, lto_read_var_init):
+ Changed to used new header format and enum section_type.
+ *lto-lang.c (success): Removed.
+
2008-01-28 Nathan Froyd <froydnj@codesourcery.com>
* lto-elf.c (lto_elf_lookup_sym): Remove unused function.
diff --git a/gcc/lto/lto-function-in.c b/gcc/lto/lto-function-in.c
index e7f00ded12d..b2e1fcc73a1 100644
--- a/gcc/lto/lto-function-in.c
+++ b/gcc/lto/lto-function-in.c
@@ -1042,7 +1042,7 @@ input_expr_operand (struct lto_input_block *ib, struct data_in *data_in,
table. */
static void
-input_globals (struct lto_header * header,
+input_globals (struct lto_function_header * header,
lto_info_fd *fd,
lto_context *context,
struct data_in *data_in,
@@ -1504,7 +1504,6 @@ input_bb (struct lto_input_block *ib, enum LTO_tags tag,
unsigned int index;
basic_block bb;
block_stmt_iterator bsi;
- unsigned int stmt_num;
LTO_DEBUG_TOKEN ("bbindex");
index = lto_input_uleb128 (ib);
@@ -1519,27 +1518,23 @@ input_bb (struct lto_input_block *ib, enum LTO_tags tag,
bsi = bsi_start (bb);
LTO_DEBUG_INDENT_TOKEN ("stmt");
- stmt_num = lto_input_uleb128 (ib);
- while (stmt_num)
+ tag = input_record_start (ib);
+ while (tag)
{
- tree stmt;
-
- tag = input_record_start (ib);
- stmt = input_expr_operand (ib, data_in, fn, tag);
+ tree stmt = input_expr_operand (ib, data_in, fn, tag);
bsi_insert_after (&bsi, stmt, BSI_NEW_STMT);
LTO_DEBUG_INDENT_TOKEN ("stmt");
- stmt_num = lto_input_uleb128 (ib);
- /* FIXME, add code to handle the exception. */
+ tag = input_record_start (ib);
+ /* FIXME, add code to handle the exception. */
}
LTO_DEBUG_INDENT_TOKEN ("phi");
- stmt_num = lto_input_uleb128 (ib);
- while (stmt_num)
+ tag = input_record_start (ib);
+ while (tag)
{
- tag = input_record_start (ib);
input_phi (ib, bb, data_in, fn);
LTO_DEBUG_INDENT_TOKEN ("phi");
- stmt_num = lto_input_uleb128 (ib);
+ tag = input_record_start (ib);
}
LTO_DEBUG_UNDENT();
@@ -1581,6 +1576,8 @@ input_function (tree fn_decl, struct data_in *data_in,
tag = input_record_start (ib);
}
+ renumber_gimple_stmt_uids ();
+
LTO_DEBUG_UNDENT();
}
@@ -1709,22 +1706,22 @@ lto_static_init_local (void)
}
-/* Read the body form DATA for tree T and fill it in.
- FD and CONTEXT are magic cookies used to resolve global decls and
- types. IN_FUNCTION should be true if DATA describes the
- body of a function, or false otherwise. */
+/* Read the body form DATA for tree T and fill it in. FD and CONTEXT
+ are magic cookies used to resolve global decls and types.
+ SECTION_TYPE is either lto_function_body or
+ lto_static_initializer. */
static void
lto_read_body (lto_info_fd *fd,
lto_context *context,
tree t,
const void *data,
- bool in_function)
+ enum lto_section_type section_type)
{
- struct lto_header * header
- = (struct lto_header *) data;
+ struct lto_function_header * header
+ = (struct lto_function_header *) data;
struct data_in data_in;
- int32_t fields_offset = sizeof (struct lto_header);
+ int32_t fields_offset = sizeof (struct lto_function_header);
int32_t fns_offset
= fields_offset + (header->num_field_decls * sizeof (lto_ref));
int32_t vars_offset
@@ -1795,14 +1792,14 @@ lto_read_body (lto_info_fd *fd,
lto_static_init_local ();
/* No upward compatibility here. */
- gcc_assert (header->major_version == LTO_major_version);
- gcc_assert (header->minor_version == LTO_minor_version);
+ gcc_assert (header->lto_header.major_version == LTO_major_version);
+ gcc_assert (header->lto_header.minor_version == LTO_minor_version);
input_globals (header, fd, context, &data_in,
in_field_decls, in_fn_decls,
in_var_decls, in_type_decls, in_types);
- if (in_function)
+ if (section_type == lto_function_body)
{
struct function *fn = DECL_STRUCT_FUNCTION (t);
push_cfun (fn);
@@ -1873,7 +1870,7 @@ lto_read_body (lto_info_fd *fd,
free (data_in.var_decls);
free (data_in.type_decls);
free (data_in.types);
- if (in_function)
+ if (section_type == lto_function_body)
{
free (data_in.labels);
free (data_in.local_decls_index);
@@ -1891,7 +1888,7 @@ lto_read_function_body (lto_info_fd *fd,
const void *data)
{
current_function_decl = fn_decl;
- lto_read_body (fd, context, fn_decl, data, true);
+ lto_read_body (fd, context, fn_decl, data, lto_function_body);
}
@@ -1903,6 +1900,6 @@ lto_read_var_init (lto_info_fd *fd,
tree var_decl,
const void *data)
{
- lto_read_body (fd, context, var_decl, data, false);
+ lto_read_body (fd, context, var_decl, data, lto_static_initializer);
}
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index 4747416dab0..590f3ed15f5 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -462,7 +462,6 @@ lto_types_compatible_p (tree type1, tree type2)
{
/* Check structural equality. */
tree f1, f2;
- int success = 1;
for (f1 = TYPE_FIELDS (type1), f2 = TYPE_FIELDS (type2);
f1 && f2;
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index d612157af47..3e8853df7ef 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -209,11 +209,37 @@ create_stmt_ann (tree t)
/* Since we just created the annotation, mark the statement modified. */
ann->modified = true;
+ ann->uid = inc_gimple_stmt_max_uid (cfun);
t->base.ann = (tree_ann_t) ann;
return ann;
}
+/* Renumber all of the gimple stmt uids. */
+
+void
+renumber_gimple_stmt_uids (void)
+{
+ basic_block bb;
+
+ set_gimple_stmt_max_uid (cfun, 0);
+ FOR_ALL_BB (bb)
+ {
+ block_stmt_iterator bsi;
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ tree stmt = bsi_stmt (bsi);
+ /* If the stmt has an annotation, then overwrite it, if not,
+ the process of getting it will set the number
+ properly. */
+ if (has_stmt_ann (stmt))
+ set_gimple_stmt_uid (stmt, inc_gimple_stmt_max_uid (cfun));
+ else
+ get_stmt_ann (stmt);
+ }
+ }
+}
+
/* Create a new annotation for a tree T. */
tree_ann_common_t
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index 4669588558e..910eedf2359 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -273,6 +273,41 @@ get_stmt_ann (tree stmt)
return (ann) ? ann : create_stmt_ann (stmt);
}
+/* Set the uid of all non phi function statements. */
+static inline void
+set_gimple_stmt_uid (tree stmt, unsigned int uid)
+{
+ get_stmt_ann (stmt)->uid = uid;
+}
+
+/* Get the uid of all non phi function statements. */
+static inline unsigned int
+gimple_stmt_uid (tree stmt)
+{
+ return get_stmt_ann (stmt)->uid;
+}
+
+/* Get the number of the next statement uid to be allocated. */
+static inline unsigned int
+gimple_stmt_max_uid (struct function *fn)
+{
+ return fn->last_stmt_uid;
+}
+
+/* Set the number of the next statement uid to be allocated. */
+static inline void
+set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
+{
+ fn->last_stmt_uid = maxid;
+}
+
+/* Set the number of the next statement uid to be allocated. */
+static inline unsigned int
+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)
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 3bf4bb599b0..b45db6eb08f 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -491,9 +491,11 @@ struct stmt_ann_d GTY(())
/* Set of variables that have had their address taken in the statement. */
bitmap addresses_taken;
- /* Unique identifier for this statement. These ID's are to be created
- by each pass on an as-needed basis in any order convenient for the
- pass which needs statement UIDs. */
+ /* Unique identifier for this statement. These ID's are to be
+ created by each pass on an as-needed basis in any order
+ convenient for the pass which needs statement UIDs. This field
+ should only be accessed thru set_gimple_stmt_uid and
+ gimple_stmt_uid functions. */
unsigned int uid;
/* Nonzero if the statement references memory (at least one of its
@@ -802,6 +804,7 @@ extern const char *op_symbol_code (enum tree_code);
extern var_ann_t create_var_ann (tree);
extern function_ann_t create_function_ann (tree);
extern stmt_ann_t create_stmt_ann (tree);
+extern void renumber_gimple_stmt_uids (void);
extern tree_ann_common_t create_tree_common_ann (tree);
extern void dump_dfa_stats (FILE *);
extern void debug_dfa_stats (void);
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 3435fa30382..b24025286d6 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -101,19 +101,15 @@ static void dse_record_phis (struct dom_walk_data *, basic_block);
static void dse_finalize_block (struct dom_walk_data *, basic_block);
static void record_voperand_set (bitmap, bitmap *, unsigned int);
-static unsigned max_stmt_uid; /* Maximal uid of a statement. Uids to phi
- nodes are assigned using the versions of
- ssa names they define. */
-
/* Returns uid of statement STMT. */
static unsigned
get_stmt_uid (tree stmt)
{
if (TREE_CODE (stmt) == PHI_NODE)
- return SSA_NAME_VERSION (PHI_RESULT (stmt)) + max_stmt_uid;
+ return SSA_NAME_VERSION (PHI_RESULT (stmt)) + gimple_stmt_max_uid (cfun);
- return stmt_ann (stmt)->uid;
+ return gimple_stmt_uid (stmt);
}
/* Set bit UID in bitmaps GLOBAL and *LOCAL, creating *LOCAL as needed. */
@@ -288,7 +284,6 @@ dse_possible_dead_store_p (tree stmt,
vuse_vec_p vv;
tree defvar = NULL_TREE, temp;
tree prev_defvar = NULL_TREE;
- stmt_ann_t ann = stmt_ann (stmt);
/* We want to verify that each virtual definition in STMT has
precisely one use and that all the virtual definitions are
@@ -356,7 +351,7 @@ dse_possible_dead_store_p (tree stmt,
if (fail)
{
- record_voperand_set (dse_gd->stores, &bd->stores, ann->uid);
+ record_voperand_set (dse_gd->stores, &bd->stores, gimple_stmt_uid (stmt));
return false;
}
@@ -450,7 +445,7 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
memory location. */
if (!get_kill_of_stmt_lhs (stmt, &first_use_p, &use_p, &use_stmt))
{
- record_voperand_set (dse_gd->stores, &bd->stores, ann->uid);
+ record_voperand_set (dse_gd->stores, &bd->stores, gimple_stmt_uid (stmt));
return;
}
}
@@ -501,7 +496,7 @@ dse_optimize_stmt (struct dom_walk_data *walk_data,
release_defs (stmt);
}
- record_voperand_set (dse_gd->stores, &bd->stores, ann->uid);
+ record_voperand_set (dse_gd->stores, &bd->stores, gimple_stmt_uid (stmt));
}
}
@@ -552,18 +547,8 @@ tree_ssa_dse (void)
{
struct dom_walk_data walk_data;
struct dse_global_data dse_gd;
- basic_block bb;
- /* Create a UID for each statement in the function. Ordering of the
- UIDs is not important for this pass. */
- max_stmt_uid = 0;
- FOR_EACH_BB (bb)
- {
- block_stmt_iterator bsi;
-
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- stmt_ann (bsi_stmt (bsi))->uid = max_stmt_uid++;
- }
+ renumber_gimple_stmt_uids ();
/* We might consider making this a property of each pass so that it
can be [re]computed on an as-needed basis. Particularly since
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 8591dd87fcc..fa1a4cf2b17 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3521,7 +3521,7 @@ compute_avail (void)
stmt = bsi_stmt (bsi);
ann = stmt_ann (stmt);
- ann->uid = stmt_uid++;
+ set_gimple_stmt_uid (stmt, stmt_uid++);
/* For regular value numbering, we are only interested in
assignments of the form X_i = EXPR, where EXPR represents
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index b4fb014b76d..6644cd9e44f 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1753,7 +1753,7 @@ compare_ops (const void *pa, const void *pb)
return -1;
else if (TREE_CODE (opstmtb) == PHI_NODE)
return 1;
- return stmt_ann (opstmta)->uid - stmt_ann (opstmtb)->uid;
+ return gimple_stmt_uid (opstmta) - gimple_stmt_uid (opstmtb);
}
return rpo_numbers[bba->index] - rpo_numbers[bbb->index];
}
@@ -1955,7 +1955,6 @@ init_scc_vn (void)
int j;
int *rpo_numbers_temp;
basic_block bb;
- size_t id = 0;
calculate_dominance_info (CDI_DOMINATORS);
sccstack = NULL;
@@ -1994,15 +1993,7 @@ init_scc_vn (void)
}
}
- FOR_ALL_BB (bb)
- {
- block_stmt_iterator bsi;
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- {
- tree stmt = bsi_stmt (bsi);
- stmt_ann (stmt)->uid = id++;
- }
- }
+ renumber_gimple_stmt_uids ();
/* Create the valid and optimistic value numbering tables. */
valid_info = XCNEW (struct vn_tables_s);