summaryrefslogtreecommitdiff
path: root/gcc/rtl.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-12 06:24:07 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-12 06:24:07 +0000
commit0927921895195ab7d00555b03ff415c03490e151 (patch)
tree4255e8245018661107838a186d047ddb5e1f3550 /gcc/rtl.c
parentcb0b036fe12b34e424e396a110f8852b322309b9 (diff)
downloadgcc-0927921895195ab7d00555b03ff415c03490e151.tar.gz
* rtl.h: Include hashtab.h.
(iterative_hash_rtx): New prototype. * rtl.c (iterative_hash_rtx): New function. * dwarf2out.c (dw_loc_list_node): Add hash and emitted fields. (output_loc_list): Return immediately if emitted is set, set it. (hash_loc_operands, hash_locs, hash_loc_list, compare_loc_operands, compare_locs, loc_list_hash, loc_list_eq, optimize_location_lists_1, optimize_location_lists): New function. (dwarf2out_finish): Call optimize_location_lists. * Makefile.in (RTL_BASE_H): Depend on $(HASHTAB_H). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165351 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r--gcc/rtl.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 3a6affc594f..6f349798c75 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -601,6 +601,79 @@ rtx_equal_p (const_rtx x, const_rtx y)
return 1;
}
+/* Iteratively hash rtx X. */
+
+hashval_t
+iterative_hash_rtx (const_rtx x, hashval_t hash)
+{
+ enum rtx_code code;
+ enum machine_mode mode;
+ int i, j;
+ const char *fmt;
+
+ if (x == NULL_RTX)
+ return hash;
+ code = GET_CODE (x);
+ hash = iterative_hash_object (code, hash);
+ mode = GET_MODE (x);
+ hash = iterative_hash_object (mode, hash);
+ switch (code)
+ {
+ case REG:
+ i = REGNO (x);
+ return iterative_hash_object (i, hash);
+ case CONST_INT:
+ return iterative_hash_object (INTVAL (x), hash);
+ case SYMBOL_REF:
+ if (XSTR (x, 0))
+ return iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1,
+ hash);
+ return hash;
+ case LABEL_REF:
+ case DEBUG_EXPR:
+ case VALUE:
+ case SCRATCH:
+ case CONST_DOUBLE:
+ case CONST_FIXED:
+ case DEBUG_IMPLICIT_PTR:
+ return hash;
+ default:
+ break;
+ }
+
+ fmt = GET_RTX_FORMAT (code);
+ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+ switch (fmt[i])
+ {
+ case 'w':
+ hash = iterative_hash_object (XWINT (x, i), hash);
+ break;
+ case 'n':
+ case 'i':
+ hash = iterative_hash_object (XINT (x, i), hash);
+ break;
+ case 'V':
+ case 'E':
+ j = XVECLEN (x, i);
+ hash = iterative_hash_object (j, hash);
+ for (j = 0; j < XVECLEN (x, i); j++)
+ hash = iterative_hash_rtx (XVECEXP (x, i, j), hash);
+ break;
+ case 'e':
+ hash = iterative_hash_rtx (XEXP (x, i), hash);
+ break;
+ case 'S':
+ case 's':
+ if (XSTR (x, i))
+ hash = iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1,
+ hash);
+ break;
+ default:
+ break;
+ }
+ return hash;
+}
+
void
dump_rtx_statistics (void)
{