Commit f768061c by Andi Kleen Committed by Andi Kleen

RTL & dwarf2out changes

Convert dwarf2out and rtl.c to the new inchash interface.

gcc/:

2014-07-31  Andi Kleen  <ak@linux.intel.com>

	* Makefile.in (OBJS): Add rtlhash.o
	* dwarf2out.c (addr_table_entry_do_hash): Convert to inchash.
	(loc_checksum): Dito.
	(loc_checksum_ordered): Dito.
	(hash_loc_operands): Dito.
	(hash_locs): Dito.
	(hash_loc_list): Dito.
	* rtl.c (iterative_hash_rtx): Moved to rtlhash.c
	* rtl.h (iterative_hash_rtx): Moved to rtlhash.h
	* rtlhash.c: New file.
	* rtlhash.h: New file.

From-SVN: r213395
parent 50de5793
2014-07-31 Andi Kleen <ak@linux.intel.com>
* Makefile.in (OBJS): Add rtlhash.o
* dwarf2out.c (addr_table_entry_do_hash): Convert to inchash.
(loc_checksum): Dito.
(loc_checksum_ordered): Dito.
(hash_loc_operands): Dito.
(hash_locs): Dito.
(hash_loc_list): Dito.
* rtl.c (iterative_hash_rtx): Moved to rtlhash.c
* rtl.h (iterative_hash_rtx): Moved to rtlhash.h
* rtlhash.c: New file.
* rtlhash.h: New file.
2014-07-31 Andi Kleen <ak@linux.intel.com>
* inchash.h (inchash): Change inchash class to namespace.
(class hash): ... Rename from inchash.
(add_object): Move from macro to class template.
......
......@@ -1350,6 +1350,7 @@ OBJS = \
resource.o \
rtl-error.o \
rtl.o \
rtlhash.o \
rtlanal.o \
rtlhooks.o \
sbitmap.o \
......
......@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#ifdef GENERATOR_FILE
# include "errors.h"
#else
# include "rtlhash.h"
# include "diagnostic-core.h"
#endif
......@@ -654,84 +655,6 @@ 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 CONST_WIDE_INT:
for (i = 0; i < CONST_WIDE_INT_NUNITS (x); i++)
hash = iterative_hash_object (CONST_WIDE_INT_ELT (x, i), hash);
return 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:
case DEBUG_PARAMETER_REF:
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)
{
......
......@@ -1983,7 +1983,6 @@ 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 *);
......
/* RTL hash functions.
Copyright (C) 1987-2014 Free Software Foundation, Inc.
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 3, 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 COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "ggc.h"
#include "rtl.h"
#include "rtlhash.h"
namespace inchash
{
/* Iteratively hash rtx X into HSTATE. */
void
add_rtx (const_rtx x, hash &hstate)
{
enum rtx_code code;
enum machine_mode mode;
int i, j;
const char *fmt;
if (x == NULL_RTX)
return;
code = GET_CODE (x);
hstate.add_object (code);
mode = GET_MODE (x);
hstate.add_object (mode);
switch (code)
{
case REG:
hstate.add_int (REGNO (x));
return;
case CONST_INT:
hstate.add_object (INTVAL (x));
return;
case CONST_WIDE_INT:
for (i = 0; i < CONST_WIDE_INT_NUNITS (x); i++)
hstate.add_object (CONST_WIDE_INT_ELT (x, i));
return;
case SYMBOL_REF:
if (XSTR (x, 0))
hstate.add (XSTR (x, 0), strlen (XSTR (x, 0)) + 1);
return;
case LABEL_REF:
case DEBUG_EXPR:
case VALUE:
case SCRATCH:
case CONST_DOUBLE:
case CONST_FIXED:
case DEBUG_IMPLICIT_PTR:
case DEBUG_PARAMETER_REF:
return;
default:
break;
}
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
switch (fmt[i])
{
case 'w':
hstate.add_object (XWINT (x, i));
break;
case 'n':
case 'i':
hstate.add_object (XINT (x, i));
break;
case 'V':
case 'E':
j = XVECLEN (x, i);
hstate.add_int (j);
for (j = 0; j < XVECLEN (x, i); j++)
inchash::add_rtx (XVECEXP (x, i, j), hstate);
break;
case 'e':
inchash::add_rtx (XEXP (x, i), hstate);
break;
case 'S':
case 's':
if (XSTR (x, i))
hstate.add (XSTR (x, 0), strlen (XSTR (x, 0)) + 1);
break;
default:
break;
}
}
}
/* Register Transfer Language (RTL) hash functions.
Copyright (C) 1987-2014 Free Software Foundation, Inc.
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 3, 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 COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef RTL_HASH_H
#define RTL_HASH_H 1
#include "inchash.h"
namespace inchash
{
extern void add_rtx (const_rtx, hash &);
}
#endif
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