Mercurial > hg > CbC > CbC_gcc
annotate gcc/cselib.h @ 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 |
rev | line source |
---|---|
0 | 1 /* Common subexpression elimination for GNU compiler. |
145 | 2 Copyright (C) 1987-2020 Free Software Foundation, Inc. |
0 | 3 |
4 This file is part of GCC. | |
5 | |
6 GCC is free software; you can redistribute it and/or modify it under | |
7 the terms of the GNU General Public License as published by the Free | |
8 Software Foundation; either version 3, or (at your option) any later | |
9 version. | |
10 | |
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GCC; see the file COPYING3. If not see | |
18 <http://www.gnu.org/licenses/>. */ | |
19 | |
111 | 20 #ifndef GCC_CSELIB_H |
21 #define GCC_CSELIB_H | |
22 | |
0 | 23 /* Describe a value. */ |
111 | 24 struct cselib_val |
25 { | |
0 | 26 /* The hash value. */ |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
27 unsigned int hash; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
28 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
29 /* A unique id assigned to values. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
30 int uid; |
0 | 31 |
32 /* A VALUE rtx that points back to this structure. */ | |
33 rtx val_rtx; | |
34 | |
35 /* All rtl expressions that hold this value at the current time during a | |
36 scan. */ | |
37 struct elt_loc_list *locs; | |
38 | |
39 /* If this value is used as an address, points to a list of values that | |
40 use it as an address in a MEM. */ | |
41 struct elt_list *addr_list; | |
42 | |
111 | 43 struct cselib_val *next_containing_mem; |
44 }; | |
0 | 45 |
46 /* A list of rtl expressions that hold the same value. */ | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
47 struct elt_loc_list { |
0 | 48 /* Next element in the list. */ |
49 struct elt_loc_list *next; | |
50 /* An rtl expression that holds the value. */ | |
51 rtx loc; | |
52 /* The insn that made the equivalence. */ | |
111 | 53 rtx_insn *setting_insn; |
0 | 54 }; |
55 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
56 /* Describe a single set that is part of an insn. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
57 struct cselib_set |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
58 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
59 rtx src; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
60 rtx dest; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
61 cselib_val *src_elt; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
62 cselib_val *dest_addr_elt; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
63 }; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
64 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
65 enum cselib_record_what |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
66 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
67 CSELIB_RECORD_MEMORY = 1, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
68 CSELIB_PRESERVE_CONSTANTS = 2 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
69 }; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
70 |
0 | 71 extern void (*cselib_discard_hook) (cselib_val *); |
111 | 72 extern void (*cselib_record_sets_hook) (rtx_insn *insn, struct cselib_set *sets, |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
73 int n_sets); |
0 | 74 |
111 | 75 extern cselib_val *cselib_lookup (rtx, machine_mode, |
76 int, machine_mode); | |
77 extern cselib_val *cselib_lookup_from_insn (rtx, machine_mode, | |
78 int, machine_mode, rtx_insn *); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
79 extern void cselib_init (int); |
0 | 80 extern void cselib_clear_table (void); |
81 extern void cselib_finish (void); | |
111 | 82 extern void cselib_process_insn (rtx_insn *); |
83 extern bool fp_setter_insn (rtx_insn *); | |
84 extern machine_mode cselib_reg_set_mode (const_rtx); | |
85 extern int rtx_equal_for_cselib_1 (rtx, rtx, machine_mode, int); | |
0 | 86 extern int references_value_p (const_rtx, int); |
87 extern rtx cselib_expand_value_rtx (rtx, bitmap, int); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
88 typedef rtx (*cselib_expand_callback)(rtx, bitmap, int, void *); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
89 extern rtx cselib_expand_value_rtx_cb (rtx, bitmap, int, |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
90 cselib_expand_callback, void *); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
91 extern bool cselib_dummy_expand_value_rtx_cb (rtx, bitmap, int, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
92 cselib_expand_callback, void *); |
111 | 93 extern rtx cselib_subst_to_values (rtx, machine_mode); |
94 extern rtx cselib_subst_to_values_from_insn (rtx, machine_mode, rtx_insn *); | |
145 | 95 extern void cselib_invalidate_rtx (rtx); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
96 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
97 extern void cselib_reset_table (unsigned int); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
98 extern unsigned int cselib_get_next_uid (void); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
99 extern void cselib_preserve_value (cselib_val *); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
100 extern bool cselib_preserved_value_p (cselib_val *); |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
101 extern void cselib_preserve_only_values (void); |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
102 extern void cselib_preserve_cfa_base_value (cselib_val *, unsigned int); |
111 | 103 extern void cselib_add_permanent_equiv (cselib_val *, rtx, rtx_insn *); |
104 extern bool cselib_have_permanent_equivalences (void); | |
105 extern void cselib_set_value_sp_based (cselib_val *); | |
106 extern bool cselib_sp_based_value_p (cselib_val *); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
107 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
108 extern void dump_cselib_table (FILE *); |
111 | 109 |
110 /* Return the canonical value for VAL, following the equivalence chain | |
111 towards the earliest (== lowest uid) equivalent value. */ | |
112 | |
113 static inline cselib_val * | |
114 canonical_cselib_val (cselib_val *val) | |
115 { | |
116 cselib_val *canon; | |
117 | |
118 if (!val->locs || val->locs->next | |
119 || !val->locs->loc || GET_CODE (val->locs->loc) != VALUE | |
120 || val->uid < CSELIB_VAL_PTR (val->locs->loc)->uid) | |
121 return val; | |
122 | |
123 canon = CSELIB_VAL_PTR (val->locs->loc); | |
124 gcc_checking_assert (canonical_cselib_val (canon) == canon); | |
125 return canon; | |
126 } | |
127 | |
128 /* Return nonzero if we can prove that X and Y contain the same value, taking | |
129 our gathered information into account. */ | |
130 | |
131 static inline int | |
132 rtx_equal_for_cselib_p (rtx x, rtx y) | |
133 { | |
134 if (x == y) | |
135 return 1; | |
136 | |
137 return rtx_equal_for_cselib_1 (x, y, VOIDmode, 0); | |
138 } | |
139 | |
140 #endif /* GCC_CSELIB_H */ |