summaryrefslogtreecommitdiff
path: root/gcc/var-tracking.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-03 15:00:33 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-03 15:00:33 +0000
commit01df1184161c4861e2b58bcf7d47c740d40a6aa8 (patch)
treed1d02dd20ec7ed6126855d129131396ddfb171df /gcc/var-tracking.c
parent4ef43bbdd80b43a9843092db88a86bb5d4e9cc19 (diff)
downloadgcc-01df1184161c4861e2b58bcf7d47c740d40a6aa8.tar.gz
2010-02-03 Alexandre Oliva <aoliva@redhat.com>
PR debug/42896 * cselib.h (struct cselib_val_struct): Add uid. Rename value to hash. (cselib_reset_table): Renamed from... (cselib_reset_table_with_next_value): ... this. (cselib_get_next_uid): Renamed from... (cselib_get_next_unknown_value): ... this. * cselib.c (next_uid): Renamed from... (next_unknown_value): ... this. (cselib_clear_table): Adjust. (cselib_reset_table): Adjust. Renamed from... (cselib_reset_table_with_next_value): ... this. (cselib_get_next_uid): Adjust. Renamed from... (cselib_get_next_unknown_value): ... this. (get_value_hash): Use hash. (cselib_hash_rtx): Likewise. (new_cselib_val): Adjust. Set and dump uid. (cselib_lookup_mem): Pass next_uid as hash. (cselib_subst_to_values): Likewise. (cselib_log_lookup): Dump uid. (cselib_lookup): Pass next_uid as hash. Adjust. (cselib_process_insn): Adjust. (cselib_init): Initialize next_uid. (cselib_finish): Adjust. (dump_cselib_table): Likewise. * dse.c (canon_address): Dump value uid. * print-rtl.c (print_rtx): Print value uid. * var-tracking.c (VARIABLE_HASH_VAL): Dropped. (dvuid): New type. (dv_uid): New function, sort of renamed from... (dv_htab_hash): ... this, reimplemented in terms of it and... (dv_uid2hash): ... this. New. (variable_htab_eq): Drop excess assertions. (tie_break_pointers): Removed. (canon_value_cmp): Compare uids. (variable_post_merge_New_vals): Print uids. (vt_add_function_parameters): Adjust. (vt_initialize): Reset table. Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156468 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/var-tracking.c')
-rw-r--r--gcc/var-tracking.c98
1 files changed, 37 insertions, 61 deletions
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 58a11c1031b..7fa75748a54 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -345,9 +345,6 @@ typedef struct value_chain_def
} *value_chain;
typedef const struct value_chain_def *const_value_chain;
-/* Hash function for DECL for VARIABLE_HTAB. */
-#define VARIABLE_HASH_VAL(decl) (DECL_UID (decl))
-
/* Pointer to the BB's information specific to variable tracking pass. */
#define VTI(BB) ((variable_tracking_info) (BB)->aux)
@@ -820,13 +817,33 @@ dv_from_value (rtx value)
return dv;
}
-static inline hashval_t
-dv_htab_hash (decl_or_value dv)
+typedef unsigned int dvuid;
+
+/* Return the uid of DV. */
+
+static inline dvuid
+dv_uid (decl_or_value dv)
{
if (dv_is_value_p (dv))
- return -(hashval_t)(CSELIB_VAL_PTR (dv_as_value (dv))->value);
+ return CSELIB_VAL_PTR (dv_as_value (dv))->uid;
else
- return (VARIABLE_HASH_VAL (dv_as_decl (dv)));
+ return DECL_UID (dv_as_decl (dv));
+}
+
+/* Compute the hash from the uid. */
+
+static inline hashval_t
+dv_uid2hash (dvuid uid)
+{
+ return uid;
+}
+
+/* The hash function for a mask table in a shared_htab chain. */
+
+static inline hashval_t
+dv_htab_hash (decl_or_value dv)
+{
+ return dv_uid2hash (dv_uid (dv));
}
/* The hash function for variable_htab, computes the hash value
@@ -848,29 +865,7 @@ variable_htab_eq (const void *x, const void *y)
const_variable const v = (const_variable) x;
decl_or_value dv = CONST_CAST2 (decl_or_value, const void *, y);
- if (dv_as_opaque (v->dv) == dv_as_opaque (dv))
- return true;
-
-#if ENABLE_CHECKING
- {
- bool visv, dvisv;
-
- visv = dv_is_value_p (v->dv);
- dvisv = dv_is_value_p (dv);
-
- if (visv != dvisv)
- return false;
-
- if (visv)
- gcc_assert (CSELIB_VAL_PTR (dv_as_value (v->dv))
- != CSELIB_VAL_PTR (dv_as_value (dv)));
- else
- gcc_assert (VARIABLE_HASH_VAL (dv_as_decl (v->dv))
- != VARIABLE_HASH_VAL (dv_as_decl (dv)));
- }
-#endif
-
- return false;
+ return (dv_as_opaque (v->dv) == dv_as_opaque (dv));
}
/* Free the element of VARIABLE_HTAB (its type is struct variable_def). */
@@ -1151,23 +1146,6 @@ shared_hash_find (shared_hash vars, decl_or_value dv)
return shared_hash_find_1 (vars, dv, dv_htab_hash (dv));
}
-/* Determine a total order between two distinct pointers. Compare the
- pointers as integral types if size_t is wide enough, otherwise
- resort to bitwise memory compare. The actual order does not
- matter, we just need to be consistent, so endianness is
- irrelevant. */
-
-static int
-tie_break_pointers (const void *p1, const void *p2)
-{
- gcc_assert (p1 != p2);
-
- if (sizeof (size_t) >= sizeof (void*))
- return (size_t)p1 < (size_t)p2 ? -1 : 1;
- else
- return memcmp (&p1, &p2, sizeof (p1));
-}
-
/* Return true if TVAL is better than CVAL as a canonival value. We
choose lowest-numbered VALUEs, using the RTX address as a
tie-breaker. The idea is to arrange them into a star topology,
@@ -1181,9 +1159,7 @@ static inline bool
canon_value_cmp (rtx tval, rtx cval)
{
return !cval
- || CSELIB_VAL_PTR (tval)->value < CSELIB_VAL_PTR (cval)->value
- || (CSELIB_VAL_PTR (tval)->value == CSELIB_VAL_PTR (cval)->value
- && tie_break_pointers (tval, cval) < 0);
+ || CSELIB_VAL_PTR (tval)->uid < CSELIB_VAL_PTR (cval)->uid;
}
static bool dst_can_be_shared;
@@ -3563,8 +3539,8 @@ variable_post_merge_new_vals (void **slot, void *info)
cdv = dv_from_value (cval);
if (dump_file)
fprintf (dump_file,
- "Created new value %i for reg %i\n",
- v->value, REGNO (node->loc));
+ "Created new value %u:%u for reg %i\n",
+ v->uid, v->hash, REGNO (node->loc));
}
var_reg_decl_set (*dfpm->permp, node->loc,
@@ -7336,7 +7312,7 @@ vt_add_function_parameters (void)
if (MAY_HAVE_DEBUG_INSNS)
{
cselib_preserve_only_values (true);
- cselib_reset_table_with_next_value (cselib_get_next_unknown_value ());
+ cselib_reset_table (cselib_get_next_uid ());
}
}
@@ -7369,15 +7345,15 @@ vt_initialize (void)
rtx insn;
HOST_WIDE_INT pre, post = 0;
int count;
- unsigned int next_value_before = cselib_get_next_unknown_value ();
- unsigned int next_value_after = next_value_before;
+ unsigned int next_uid_before = cselib_get_next_uid ();
+ unsigned int next_uid_after = next_uid_before;
if (MAY_HAVE_DEBUG_INSNS)
{
cselib_record_sets_hook = count_with_sets;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "first value: %i\n",
- cselib_get_next_unknown_value ());
+ cselib_get_next_uid ());
}
/* Count the number of micro operations. */
@@ -7432,12 +7408,12 @@ vt_initialize (void)
if (MAY_HAVE_DEBUG_INSNS)
{
cselib_preserve_only_values (false);
- next_value_after = cselib_get_next_unknown_value ();
- cselib_reset_table_with_next_value (next_value_before);
+ next_uid_after = cselib_get_next_uid ();
+ cselib_reset_table (next_uid_before);
cselib_record_sets_hook = add_with_sets;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "first value: %i\n",
- cselib_get_next_unknown_value ());
+ cselib_get_next_uid ());
}
/* Add the micro-operations to the array. */
@@ -7496,8 +7472,8 @@ vt_initialize (void)
if (MAY_HAVE_DEBUG_INSNS)
{
cselib_preserve_only_values (true);
- gcc_assert (next_value_after == cselib_get_next_unknown_value ());
- cselib_reset_table_with_next_value (next_value_after);
+ gcc_assert (next_uid_after == cselib_get_next_uid ());
+ cselib_reset_table (next_uid_after);
cselib_record_sets_hook = NULL;
}
}