Commit d95828db by Jakub Jelinek Committed by Jakub Jelinek

rtl.h: Include hashtab.h.

	* 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).

From-SVN: r165351
parent 8207e1fb
2010-10-12 Jakub Jelinek <jakub@redhat.com>
* 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).
2010-10-12 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR testsuite/45974
......@@ -874,7 +874,8 @@ HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H)
LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
TARGET_DEF_H = target-def.h target-hooks-def.h $(HOOKS_H) targhooks.h
RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \
$(INPUT_H) $(REAL_H) statistics.h $(VEC_H) $(FIXED_VALUE_H) alias.h
$(INPUT_H) $(REAL_H) statistics.h $(VEC_H) $(FIXED_VALUE_H) alias.h \
$(HASHTAB_H)
FIXED_VALUE_H = fixed-value.h $(MACHMODE_H) double-int.h
RTL_H = $(RTL_BASE_H) genrtl.h vecir.h
RTL_ERROR_H = $(RTL_H) $(DIAGNOSTIC_CORE_H)
......
......@@ -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)
{
......
......@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "vecir.h"
#include "fixed-value.h"
#include "alias.h"
#include "hashtab.h"
#undef FFS /* Some systems predefine this symbol; don't let it interfere. */
#undef FLOAT /* Likewise. */
......@@ -1622,6 +1623,7 @@ extern unsigned int rtx_size (const_rtx);
extern rtx shallow_copy_rtx_stat (const_rtx MEM_STAT_DECL);
#define shallow_copy_rtx(a) shallow_copy_rtx_stat (a MEM_STAT_INFO)
extern int rtx_equal_p (const_rtx, const_rtx);
extern hashval_t iterative_hash_rtx (const_rtx, hashval_t);
/* In emit-rtl.c */
extern rtvec gen_rtvec_v (int, rtx *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment