annotate gcc/rtlhash.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* RTL hash functions.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 1987-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #include "config.h"
kono
parents:
diff changeset
21 #include "system.h"
kono
parents:
diff changeset
22 #include "coretypes.h"
kono
parents:
diff changeset
23 #include "tm.h"
kono
parents:
diff changeset
24 #include "rtl.h"
kono
parents:
diff changeset
25 #include "rtlhash.h"
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 namespace inchash
kono
parents:
diff changeset
28 {
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 /* Iteratively hash rtx X into HSTATE. */
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 void
kono
parents:
diff changeset
33 add_rtx (const_rtx x, hash &hstate)
kono
parents:
diff changeset
34 {
kono
parents:
diff changeset
35 enum rtx_code code;
kono
parents:
diff changeset
36 machine_mode mode;
kono
parents:
diff changeset
37 int i, j;
kono
parents:
diff changeset
38 const char *fmt;
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 if (x == NULL_RTX)
kono
parents:
diff changeset
41 return;
kono
parents:
diff changeset
42 code = GET_CODE (x);
kono
parents:
diff changeset
43 hstate.add_object (code);
kono
parents:
diff changeset
44 mode = GET_MODE (x);
kono
parents:
diff changeset
45 hstate.add_object (mode);
kono
parents:
diff changeset
46 switch (code)
kono
parents:
diff changeset
47 {
kono
parents:
diff changeset
48 case REG:
kono
parents:
diff changeset
49 hstate.add_int (REGNO (x));
kono
parents:
diff changeset
50 return;
kono
parents:
diff changeset
51 case CONST_INT:
kono
parents:
diff changeset
52 hstate.add_object (INTVAL (x));
kono
parents:
diff changeset
53 return;
kono
parents:
diff changeset
54 case CONST_WIDE_INT:
kono
parents:
diff changeset
55 for (i = 0; i < CONST_WIDE_INT_NUNITS (x); i++)
kono
parents:
diff changeset
56 hstate.add_object (CONST_WIDE_INT_ELT (x, i));
kono
parents:
diff changeset
57 return;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
58 case CONST_POLY_INT:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
59 for (i = 0; i < NUM_POLY_INT_COEFFS; ++i)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
60 hstate.add_wide_int (CONST_POLY_INT_COEFFS (x)[i]);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
61 break;
111
kono
parents:
diff changeset
62 case SYMBOL_REF:
kono
parents:
diff changeset
63 if (XSTR (x, 0))
kono
parents:
diff changeset
64 hstate.add (XSTR (x, 0), strlen (XSTR (x, 0)) + 1);
kono
parents:
diff changeset
65 return;
kono
parents:
diff changeset
66 case LABEL_REF:
kono
parents:
diff changeset
67 case DEBUG_EXPR:
kono
parents:
diff changeset
68 case VALUE:
kono
parents:
diff changeset
69 case SCRATCH:
kono
parents:
diff changeset
70 case CONST_DOUBLE:
kono
parents:
diff changeset
71 case CONST_FIXED:
kono
parents:
diff changeset
72 case DEBUG_IMPLICIT_PTR:
kono
parents:
diff changeset
73 case DEBUG_PARAMETER_REF:
kono
parents:
diff changeset
74 return;
kono
parents:
diff changeset
75 default:
kono
parents:
diff changeset
76 break;
kono
parents:
diff changeset
77 }
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 fmt = GET_RTX_FORMAT (code);
kono
parents:
diff changeset
80 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
kono
parents:
diff changeset
81 switch (fmt[i])
kono
parents:
diff changeset
82 {
kono
parents:
diff changeset
83 case 'w':
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
84 hstate.add_hwi (XWINT (x, i));
111
kono
parents:
diff changeset
85 break;
kono
parents:
diff changeset
86 case 'n':
kono
parents:
diff changeset
87 case 'i':
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
88 hstate.add_int (XINT (x, i));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
89 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
90 case 'p':
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
91 hstate.add_poly_int (SUBREG_BYTE (x));
111
kono
parents:
diff changeset
92 break;
kono
parents:
diff changeset
93 case 'V':
kono
parents:
diff changeset
94 case 'E':
kono
parents:
diff changeset
95 j = XVECLEN (x, i);
kono
parents:
diff changeset
96 hstate.add_int (j);
kono
parents:
diff changeset
97 for (j = 0; j < XVECLEN (x, i); j++)
kono
parents:
diff changeset
98 inchash::add_rtx (XVECEXP (x, i, j), hstate);
kono
parents:
diff changeset
99 break;
kono
parents:
diff changeset
100 case 'e':
kono
parents:
diff changeset
101 inchash::add_rtx (XEXP (x, i), hstate);
kono
parents:
diff changeset
102 break;
kono
parents:
diff changeset
103 case 'S':
kono
parents:
diff changeset
104 case 's':
kono
parents:
diff changeset
105 if (XSTR (x, i))
kono
parents:
diff changeset
106 hstate.add (XSTR (x, 0), strlen (XSTR (x, 0)) + 1);
kono
parents:
diff changeset
107 break;
kono
parents:
diff changeset
108 default:
kono
parents:
diff changeset
109 break;
kono
parents:
diff changeset
110 }
kono
parents:
diff changeset
111 }
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 }