annotate gcc/cselib.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Common subexpression elimination for GNU compiler.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 Copyright (C) 1987-2018 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
111
kono
parents: 67
diff changeset
20 #ifndef GCC_CSELIB_H
kono
parents: 67
diff changeset
21 #define GCC_CSELIB_H
kono
parents: 67
diff changeset
22
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 /* Describe a value. */
111
kono
parents: 67
diff changeset
24 struct cselib_val
kono
parents: 67
diff changeset
25 {
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 /* A VALUE rtx that points back to this structure. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 rtx val_rtx;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 /* All rtl expressions that hold this value at the current time during a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 scan. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 struct elt_loc_list *locs;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 /* If this value is used as an address, points to a list of values that
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 use it as an address in a MEM. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 struct elt_list *addr_list;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42
111
kono
parents: 67
diff changeset
43 struct cselib_val *next_containing_mem;
kono
parents: 67
diff changeset
44 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 /* Next element in the list. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 struct elt_loc_list *next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 /* An rtl expression that holds the value. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 rtx loc;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 /* The insn that made the equivalence. */
111
kono
parents: 67
diff changeset
53 rtx_insn *setting_insn;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 extern void (*cselib_discard_hook) (cselib_val *);
111
kono
parents: 67
diff changeset
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
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74
111
kono
parents: 67
diff changeset
75 extern cselib_val *cselib_lookup (rtx, machine_mode,
kono
parents: 67
diff changeset
76 int, machine_mode);
kono
parents: 67
diff changeset
77 extern cselib_val *cselib_lookup_from_insn (rtx, machine_mode,
kono
parents: 67
diff changeset
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
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 extern void cselib_clear_table (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 extern void cselib_finish (void);
111
kono
parents: 67
diff changeset
82 extern void cselib_process_insn (rtx_insn *);
kono
parents: 67
diff changeset
83 extern bool fp_setter_insn (rtx_insn *);
kono
parents: 67
diff changeset
84 extern machine_mode cselib_reg_set_mode (const_rtx);
kono
parents: 67
diff changeset
85 extern int rtx_equal_for_cselib_1 (rtx, rtx, machine_mode, int);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 extern int references_value_p (const_rtx, int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
kono
parents: 67
diff changeset
93 extern rtx cselib_subst_to_values (rtx, machine_mode);
kono
parents: 67
diff changeset
94 extern rtx cselib_subst_to_values_from_insn (rtx, machine_mode, rtx_insn *);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
95 extern void cselib_invalidate_rtx (rtx, const_rtx = NULL);
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
kono
parents: 67
diff changeset
103 extern void cselib_add_permanent_equiv (cselib_val *, rtx, rtx_insn *);
kono
parents: 67
diff changeset
104 extern bool cselib_have_permanent_equivalences (void);
kono
parents: 67
diff changeset
105 extern void cselib_set_value_sp_based (cselib_val *);
kono
parents: 67
diff changeset
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
kono
parents: 67
diff changeset
109
kono
parents: 67
diff changeset
110 /* Return the canonical value for VAL, following the equivalence chain
kono
parents: 67
diff changeset
111 towards the earliest (== lowest uid) equivalent value. */
kono
parents: 67
diff changeset
112
kono
parents: 67
diff changeset
113 static inline cselib_val *
kono
parents: 67
diff changeset
114 canonical_cselib_val (cselib_val *val)
kono
parents: 67
diff changeset
115 {
kono
parents: 67
diff changeset
116 cselib_val *canon;
kono
parents: 67
diff changeset
117
kono
parents: 67
diff changeset
118 if (!val->locs || val->locs->next
kono
parents: 67
diff changeset
119 || !val->locs->loc || GET_CODE (val->locs->loc) != VALUE
kono
parents: 67
diff changeset
120 || val->uid < CSELIB_VAL_PTR (val->locs->loc)->uid)
kono
parents: 67
diff changeset
121 return val;
kono
parents: 67
diff changeset
122
kono
parents: 67
diff changeset
123 canon = CSELIB_VAL_PTR (val->locs->loc);
kono
parents: 67
diff changeset
124 gcc_checking_assert (canonical_cselib_val (canon) == canon);
kono
parents: 67
diff changeset
125 return canon;
kono
parents: 67
diff changeset
126 }
kono
parents: 67
diff changeset
127
kono
parents: 67
diff changeset
128 /* Return nonzero if we can prove that X and Y contain the same value, taking
kono
parents: 67
diff changeset
129 our gathered information into account. */
kono
parents: 67
diff changeset
130
kono
parents: 67
diff changeset
131 static inline int
kono
parents: 67
diff changeset
132 rtx_equal_for_cselib_p (rtx x, rtx y)
kono
parents: 67
diff changeset
133 {
kono
parents: 67
diff changeset
134 if (x == y)
kono
parents: 67
diff changeset
135 return 1;
kono
parents: 67
diff changeset
136
kono
parents: 67
diff changeset
137 return rtx_equal_for_cselib_1 (x, y, VOIDmode, 0);
kono
parents: 67
diff changeset
138 }
kono
parents: 67
diff changeset
139
kono
parents: 67
diff changeset
140 #endif /* GCC_CSELIB_H */