diff options
author | Andi Kleen <ak@linux.intel.com> | 2014-08-01 02:51:57 +0000 |
---|---|---|
committer | Andi Kleen <ak@gcc.gnu.org> | 2014-08-01 02:51:57 +0000 |
commit | f768061c4c0d179bb44984e1c20a3bee15faeb1a (patch) | |
tree | e3029eaf9c62844fda4c9e4772c56a84c9882344 /gcc/rtlhash.c | |
parent | 50de5793fc6004bb8bf6f00e0f02e318f242ca2d (diff) | |
download | gcc-f768061c4c0d179bb44984e1c20a3bee15faeb1a.zip gcc-f768061c4c0d179bb44984e1c20a3bee15faeb1a.tar.gz gcc-f768061c4c0d179bb44984e1c20a3bee15faeb1a.tar.bz2 |
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
Diffstat (limited to 'gcc/rtlhash.c')
-rw-r--r-- | gcc/rtlhash.c | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/gcc/rtlhash.c b/gcc/rtlhash.c new file mode 100644 index 0000000..ed4ee7a --- /dev/null +++ b/gcc/rtlhash.c @@ -0,0 +1,107 @@ +/* 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; + } +} + +} |