annotate gcc/ipa-prop.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
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 /* Interprocedural analyses.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2005-2020 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
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 #ifndef IPA_PROP_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #define IPA_PROP_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 /* The following definitions and interfaces are used by
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
24 interprocedural analyses or parameters. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
25
111
kono
parents: 67
diff changeset
26 #define IPA_UNDESCRIBED_USE -1
kono
parents: 67
diff changeset
27
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
28 /* ipa-prop.c stuff (ipa-cp, indirect inlining): */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 /* A jump function for a callsite represents the values passed as actual
111
kono
parents: 67
diff changeset
31 arguments of the callsite. They were originally proposed in a paper called
kono
parents: 67
diff changeset
32 "Interprocedural Constant Propagation", by David Callahan, Keith D Cooper,
kono
parents: 67
diff changeset
33 Ken Kennedy, Linda Torczon in Comp86, pg 152-161. There are three main
kono
parents: 67
diff changeset
34 types of values :
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
35
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
36 Pass-through - the caller's formal parameter is passed as an actual
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
37 argument, possibly one simple operation performed on it.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
38 Constant - a constant (is_gimple_ip_invariant)is passed as an actual
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
39 argument.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
40 Unknown - neither of the above.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
41
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
42 IPA_JF_LOAD_AGG is a compound pass-through jump function, in which primary
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
43 operation on formal parameter is memory dereference that loads a value from
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
44 a part of an aggregate, which is represented or pointed to by the formal
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
45 parameter. Moreover, an additional unary/binary operation can be applied on
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
46 the loaded value, and final result is passed as actual argument of callee
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
47 (e.g. *(param_1(D) + 4) op 24 ). It is meant to describe usage of aggregate
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
48 parameter or by-reference parameter referenced in argument passing, commonly
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
49 found in C++ and Fortran.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
50
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
51 IPA_JF_ANCESTOR is a special pass-through jump function, which means that
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
52 the result is an address of a part of the object pointed to by the formal
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
53 parameter to which the function refers. It is mainly intended to represent
111
kono
parents: 67
diff changeset
54 getting addresses of ancestor fields in C++
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
55 (e.g. &this_1(D)->D.1766.D.1756). Note that if the original pointer is
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
56 NULL, ancestor jump function must behave like a simple pass-through.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
57
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
58 Other pass-through functions can either simply pass on an unchanged formal
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
59 parameter or can apply one simple binary operation to it (such jump
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
60 functions are called polynomial).
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
61
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
62 Jump functions are computed in ipa-prop.c by function
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
63 update_call_notes_after_inlining. Some information can be lost and jump
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
64 functions degraded accordingly when inlining, see
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
65 update_call_notes_after_inlining in the same file. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
66
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 enum jump_func_type
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
69 IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
70 IPA_JF_CONST, /* represented by field costant */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
71 IPA_JF_PASS_THROUGH, /* represented by field pass_through */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
72 IPA_JF_LOAD_AGG, /* represented by field load_agg */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
73 IPA_JF_ANCESTOR /* represented by field ancestor */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75
111
kono
parents: 67
diff changeset
76 struct ipa_cst_ref_desc;
kono
parents: 67
diff changeset
77
kono
parents: 67
diff changeset
78 /* Structure holding data required to describe a constant jump function. */
kono
parents: 67
diff changeset
79 struct GTY(()) ipa_constant_data
kono
parents: 67
diff changeset
80 {
kono
parents: 67
diff changeset
81 /* THe value of the constant. */
kono
parents: 67
diff changeset
82 tree value;
kono
parents: 67
diff changeset
83 /* Pointer to the structure that describes the reference. */
kono
parents: 67
diff changeset
84 struct ipa_cst_ref_desc GTY((skip)) *rdesc;
kono
parents: 67
diff changeset
85 };
kono
parents: 67
diff changeset
86
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
87 /* Structure holding data required to describe a pass-through jump function. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
88
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
89 struct GTY(()) ipa_pass_through_data
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
90 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
91 /* If an operation is to be performed on the original parameter, this is the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
92 second (constant) operand. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
93 tree operand;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
94 /* Number of the caller's formal parameter being passed. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
95 int formal_id;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
96 /* Operation that is performed on the argument before it is passed on.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
97 NOP_EXPR means no operation. Otherwise oper must be a simple binary
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
98 arithmetic operation where the caller's parameter is the first operand and
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
99 operand field from this structure is the second one. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
100 enum tree_code operation;
111
kono
parents: 67
diff changeset
101 /* When the passed value is a pointer, it is set to true only when we are
kono
parents: 67
diff changeset
102 certain that no write to the object it points to has occurred since the
kono
parents: 67
diff changeset
103 caller functions started execution, except for changes noted in the
kono
parents: 67
diff changeset
104 aggregate part of the jump function (see description of
kono
parents: 67
diff changeset
105 ipa_agg_jump_function). The flag is used only when the operation is
kono
parents: 67
diff changeset
106 NOP_EXPR. */
kono
parents: 67
diff changeset
107 unsigned agg_preserved : 1;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
108 };
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
109
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
110 /* Structure holding data required to describe a load-value-from-aggregate
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
111 jump function. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
112
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
113 struct GTY(()) ipa_load_agg_data
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
114 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
115 /* Inherit from pass through jump function, describing unary/binary
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
116 operation on the value loaded from aggregate that is represented or
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
117 pointed to by the formal parameter, specified by formal_id in this
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
118 pass_through jump function data structure. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
119 struct ipa_pass_through_data pass_through;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
120 /* Type of the value loaded from the aggregate. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
121 tree type;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
122 /* Offset at which the value is located within the aggregate. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
123 HOST_WIDE_INT offset;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
124 /* True if loaded by reference (the aggregate is pointed to by the formal
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
125 parameter) or false if loaded by value (the aggregate is represented
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
126 by the formal parameter). */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
127 bool by_ref;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
128 };
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
129
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
130 /* Structure holding data required to describe an ancestor pass-through
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
131 jump function. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
132
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
133 struct GTY(()) ipa_ancestor_jf_data
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
134 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
135 /* Offset of the field representing the ancestor. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
136 HOST_WIDE_INT offset;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
137 /* Number of the caller's formal parameter being passed. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
138 int formal_id;
111
kono
parents: 67
diff changeset
139 /* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */
kono
parents: 67
diff changeset
140 unsigned agg_preserved : 1;
kono
parents: 67
diff changeset
141 };
kono
parents: 67
diff changeset
142
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
143 /* A jump function for an aggregate part at a given offset, which describes how
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
144 it content value is generated. All unlisted positions are assumed to have a
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
145 value defined in an unknown way. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
146
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
147 struct GTY(()) ipa_agg_jf_item
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
148 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
149 /* The offset for the aggregate part. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
150 HOST_WIDE_INT offset;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
151
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
152 /* Data type of the aggregate part. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
153 tree type;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
154
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
155 /* Jump function type. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
156 enum jump_func_type jftype;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
157
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
158 /* Represents a value of jump function. constant represents the actual constant
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
159 in constant jump function content. pass_through is used only in simple pass
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
160 through jump function context. load_agg is for load-value-from-aggregate
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
161 jump function context. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
162 union jump_func_agg_value
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
163 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
164 tree GTY ((tag ("IPA_JF_CONST"))) constant;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
165 struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
166 struct ipa_load_agg_data GTY ((tag ("IPA_JF_LOAD_AGG"))) load_agg;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
167 } GTY ((desc ("%1.jftype"))) value;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
168 };
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
169
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
170 /* Jump functions describing a set of aggregate contents. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
171
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
172 struct GTY(()) ipa_agg_jump_function
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
173 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
174 /* Description of the individual jump function item. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
175 vec<ipa_agg_jf_item, va_gc> *items;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
176 /* True if the data was passed by reference (as opposed to by value). */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
177 bool by_ref;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
178 };
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
179
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
180 /* An element in an aggregate part describing a known value at a given offset.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
181 All unlisted positions are assumed to be unknown and all listed values must
111
kono
parents: 67
diff changeset
182 fulfill is_gimple_ip_invariant. */
kono
parents: 67
diff changeset
183
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
184 struct ipa_agg_value
111
kono
parents: 67
diff changeset
185 {
kono
parents: 67
diff changeset
186 /* The offset at which the known value is located within the aggregate. */
kono
parents: 67
diff changeset
187 HOST_WIDE_INT offset;
kono
parents: 67
diff changeset
188
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
189 /* The known constant. */
111
kono
parents: 67
diff changeset
190 tree value;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
191
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
192 /* Return true if OTHER describes same agg value. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
193 bool equal_to (const ipa_agg_value &other);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
194 };
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
195
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
196 /* Structure describing a set of known offset/value for aggregate. */
111
kono
parents: 67
diff changeset
197
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
198 struct ipa_agg_value_set
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
199 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
200 /* Description of the individual item. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
201 vec<ipa_agg_value> items;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
202 /* True if the data was passed by reference (as opposed to by value). */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
203 bool by_ref;
111
kono
parents: 67
diff changeset
204
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
205 /* Return true if OTHER describes same agg values. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
206 bool equal_to (const ipa_agg_value_set &other)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
207 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
208 if (by_ref != other.by_ref)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
209 return false;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
210 if (items.length () != other.items.length ())
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
211 return false;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
212 for (unsigned int i = 0; i < items.length (); i++)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
213 if (!items[i].equal_to (other.items[i]))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
214 return false;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
215 return true;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
216 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
217
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
218 /* Return true if there is any value for aggregate. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
219 bool is_empty () const
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
220 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
221 return items.is_empty ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
222 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
223
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
224 ipa_agg_value_set copy () const
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
225 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
226 ipa_agg_value_set new_copy;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
227
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
228 new_copy.items = items.copy ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
229 new_copy.by_ref = by_ref;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
230
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
231 return new_copy;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
232 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
233
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
234 void release ()
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
235 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
236 items.release ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
237 }
111
kono
parents: 67
diff changeset
238 };
kono
parents: 67
diff changeset
239
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
240 /* Return copy of a vec<ipa_agg_value_set>. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
241
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
242 static inline vec<ipa_agg_value_set>
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
243 ipa_copy_agg_values (const vec<ipa_agg_value_set> &aggs)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
244 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
245 vec<ipa_agg_value_set> aggs_copy = vNULL;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
246
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
247 if (!aggs.is_empty ())
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
248 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
249 ipa_agg_value_set *agg;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
250 int i;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
251
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
252 aggs_copy.reserve_exact (aggs.length ());
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
253
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
254 FOR_EACH_VEC_ELT (aggs, i, agg)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
255 aggs_copy.quick_push (agg->copy ());
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
256 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
257
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
258 return aggs_copy;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
259 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
260
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
261 /* For vec<ipa_agg_value_set>, DO NOT call release(), use below function
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
262 instead. Because ipa_agg_value_set contains a field of vector type, we
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
263 should release this child vector in each element before reclaiming the
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
264 whole vector. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
265
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
266 static inline void
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
267 ipa_release_agg_values (vec<ipa_agg_value_set> &aggs,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
268 bool release_vector = true)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
269 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
270 ipa_agg_value_set *agg;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
271 int i;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
272
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
273 FOR_EACH_VEC_ELT (aggs, i, agg)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
274 agg->release ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
275 if (release_vector)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
276 aggs.release ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
277 }
111
kono
parents: 67
diff changeset
278
kono
parents: 67
diff changeset
279 /* Information about zero/non-zero bits. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
280 class GTY(()) ipa_bits
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
282 public:
111
kono
parents: 67
diff changeset
283 /* The propagated value. */
kono
parents: 67
diff changeset
284 widest_int value;
kono
parents: 67
diff changeset
285 /* Mask corresponding to the value.
kono
parents: 67
diff changeset
286 Similar to ccp_lattice_t, if xth bit of mask is 0,
kono
parents: 67
diff changeset
287 implies xth bit of value is constant. */
kono
parents: 67
diff changeset
288 widest_int mask;
kono
parents: 67
diff changeset
289 };
kono
parents: 67
diff changeset
290
kono
parents: 67
diff changeset
291 /* Info about value ranges. */
kono
parents: 67
diff changeset
292
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
293 class GTY(()) ipa_vr
111
kono
parents: 67
diff changeset
294 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
295 public:
111
kono
parents: 67
diff changeset
296 /* The data fields below are valid only if known is true. */
kono
parents: 67
diff changeset
297 bool known;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
298 enum value_range_kind type;
111
kono
parents: 67
diff changeset
299 wide_int min;
kono
parents: 67
diff changeset
300 wide_int max;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
301 bool nonzero_p (tree) const;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 /* A jump function for a callsite represents the values passed as actual
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 arguments of the callsite. See enum jump_func_type for the various
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 types of jump functions supported. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
307 struct GTY (()) ipa_jump_func
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
308 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
309 /* Aggregate jump function description. See struct ipa_agg_jump_function
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
310 and its description. */
111
kono
parents: 67
diff changeset
311 struct ipa_agg_jump_function agg;
kono
parents: 67
diff changeset
312
kono
parents: 67
diff changeset
313 /* Information about zero/non-zero bits. The pointed to structure is shared
kono
parents: 67
diff changeset
314 betweed different jump functions. Use ipa_set_jfunc_bits to set this
kono
parents: 67
diff changeset
315 field. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
316 class ipa_bits *bits;
111
kono
parents: 67
diff changeset
317
kono
parents: 67
diff changeset
318 /* Information about value range, containing valid data only when vr_known is
kono
parents: 67
diff changeset
319 true. The pointed to structure is shared betweed different jump
kono
parents: 67
diff changeset
320 functions. Use ipa_set_jfunc_vr to set this field. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
321 class value_range *m_vr;
111
kono
parents: 67
diff changeset
322
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 enum jump_func_type type;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
324 /* Represents a value of a jump function. pass_through is used only in jump
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
325 function context. constant represents the actual constant in constant jump
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
326 functions and member_cst holds constant c++ member functions. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
327 union jump_func_value
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
328 {
111
kono
parents: 67
diff changeset
329 struct ipa_constant_data GTY ((tag ("IPA_JF_CONST"))) constant;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
330 struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
331 struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
332 } GTY ((desc ("%1.type"))) value;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334
111
kono
parents: 67
diff changeset
335
kono
parents: 67
diff changeset
336 /* Return the constant stored in a constant jump functin JFUNC. */
kono
parents: 67
diff changeset
337
kono
parents: 67
diff changeset
338 static inline tree
kono
parents: 67
diff changeset
339 ipa_get_jf_constant (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
340 {
kono
parents: 67
diff changeset
341 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
kono
parents: 67
diff changeset
342 return jfunc->value.constant.value;
kono
parents: 67
diff changeset
343 }
kono
parents: 67
diff changeset
344
kono
parents: 67
diff changeset
345 static inline struct ipa_cst_ref_desc *
kono
parents: 67
diff changeset
346 ipa_get_jf_constant_rdesc (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
347 {
kono
parents: 67
diff changeset
348 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
kono
parents: 67
diff changeset
349 return jfunc->value.constant.rdesc;
kono
parents: 67
diff changeset
350 }
kono
parents: 67
diff changeset
351
kono
parents: 67
diff changeset
352 /* Return the operand of a pass through jmp function JFUNC. */
kono
parents: 67
diff changeset
353
kono
parents: 67
diff changeset
354 static inline tree
kono
parents: 67
diff changeset
355 ipa_get_jf_pass_through_operand (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
356 {
kono
parents: 67
diff changeset
357 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
kono
parents: 67
diff changeset
358 return jfunc->value.pass_through.operand;
kono
parents: 67
diff changeset
359 }
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
360
111
kono
parents: 67
diff changeset
361 /* Return the number of the caller's formal parameter that a pass through jump
kono
parents: 67
diff changeset
362 function JFUNC refers to. */
kono
parents: 67
diff changeset
363
kono
parents: 67
diff changeset
364 static inline int
kono
parents: 67
diff changeset
365 ipa_get_jf_pass_through_formal_id (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
366 {
kono
parents: 67
diff changeset
367 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
kono
parents: 67
diff changeset
368 return jfunc->value.pass_through.formal_id;
kono
parents: 67
diff changeset
369 }
kono
parents: 67
diff changeset
370
kono
parents: 67
diff changeset
371 /* Return operation of a pass through jump function JFUNC. */
kono
parents: 67
diff changeset
372
kono
parents: 67
diff changeset
373 static inline enum tree_code
kono
parents: 67
diff changeset
374 ipa_get_jf_pass_through_operation (struct ipa_jump_func *jfunc)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
375 {
111
kono
parents: 67
diff changeset
376 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
kono
parents: 67
diff changeset
377 return jfunc->value.pass_through.operation;
kono
parents: 67
diff changeset
378 }
kono
parents: 67
diff changeset
379
kono
parents: 67
diff changeset
380 /* Return the agg_preserved flag of a pass through jump function JFUNC. */
kono
parents: 67
diff changeset
381
kono
parents: 67
diff changeset
382 static inline bool
kono
parents: 67
diff changeset
383 ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
384 {
kono
parents: 67
diff changeset
385 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
kono
parents: 67
diff changeset
386 return jfunc->value.pass_through.agg_preserved;
kono
parents: 67
diff changeset
387 }
kono
parents: 67
diff changeset
388
kono
parents: 67
diff changeset
389 /* Return true if pass through jump function JFUNC preserves type
kono
parents: 67
diff changeset
390 information. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
391
111
kono
parents: 67
diff changeset
392 static inline bool
kono
parents: 67
diff changeset
393 ipa_get_jf_pass_through_type_preserved (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
394 {
kono
parents: 67
diff changeset
395 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
kono
parents: 67
diff changeset
396 return jfunc->value.pass_through.agg_preserved;
kono
parents: 67
diff changeset
397 }
kono
parents: 67
diff changeset
398
kono
parents: 67
diff changeset
399 /* Return the offset of an ancestor jump function JFUNC. */
kono
parents: 67
diff changeset
400
kono
parents: 67
diff changeset
401 static inline HOST_WIDE_INT
kono
parents: 67
diff changeset
402 ipa_get_jf_ancestor_offset (struct ipa_jump_func *jfunc)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 {
111
kono
parents: 67
diff changeset
404 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
kono
parents: 67
diff changeset
405 return jfunc->value.ancestor.offset;
kono
parents: 67
diff changeset
406 }
kono
parents: 67
diff changeset
407
kono
parents: 67
diff changeset
408 /* Return the number of the caller's formal parameter that an ancestor jump
kono
parents: 67
diff changeset
409 function JFUNC refers to. */
kono
parents: 67
diff changeset
410
kono
parents: 67
diff changeset
411 static inline int
kono
parents: 67
diff changeset
412 ipa_get_jf_ancestor_formal_id (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
413 {
kono
parents: 67
diff changeset
414 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
kono
parents: 67
diff changeset
415 return jfunc->value.ancestor.formal_id;
kono
parents: 67
diff changeset
416 }
kono
parents: 67
diff changeset
417
kono
parents: 67
diff changeset
418 /* Return the agg_preserved flag of an ancestor jump function JFUNC. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419
111
kono
parents: 67
diff changeset
420 static inline bool
kono
parents: 67
diff changeset
421 ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
422 {
kono
parents: 67
diff changeset
423 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
kono
parents: 67
diff changeset
424 return jfunc->value.ancestor.agg_preserved;
kono
parents: 67
diff changeset
425 }
kono
parents: 67
diff changeset
426
kono
parents: 67
diff changeset
427 /* Return true if ancestor jump function JFUNC presrves type information. */
kono
parents: 67
diff changeset
428
kono
parents: 67
diff changeset
429 static inline bool
kono
parents: 67
diff changeset
430 ipa_get_jf_ancestor_type_preserved (struct ipa_jump_func *jfunc)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431 {
111
kono
parents: 67
diff changeset
432 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
kono
parents: 67
diff changeset
433 return jfunc->value.ancestor.agg_preserved;
kono
parents: 67
diff changeset
434 }
kono
parents: 67
diff changeset
435
kono
parents: 67
diff changeset
436 /* Summary describing a single formal parameter. */
kono
parents: 67
diff changeset
437
kono
parents: 67
diff changeset
438 struct GTY(()) ipa_param_descriptor
kono
parents: 67
diff changeset
439 {
kono
parents: 67
diff changeset
440 /* In analysis and modification phase, this is the PARAM_DECL of this
kono
parents: 67
diff changeset
441 parameter, in IPA LTO phase, this is the type of the the described
kono
parents: 67
diff changeset
442 parameter or NULL if not known. Do not read this field directly but
kono
parents: 67
diff changeset
443 through ipa_get_param and ipa_get_type as appropriate. */
kono
parents: 67
diff changeset
444 tree decl_or_type;
kono
parents: 67
diff changeset
445 /* If all uses of the parameter are described by ipa-prop structures, this
kono
parents: 67
diff changeset
446 says how many there are. If any use could not be described by means of
kono
parents: 67
diff changeset
447 ipa-prop structures, this is IPA_UNDESCRIBED_USE. */
kono
parents: 67
diff changeset
448 int controlled_uses;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
449 unsigned int move_cost : 28;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
450 /* The parameter is used. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
451 unsigned used : 1;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
452 unsigned used_by_ipa_predicates : 1;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
453 unsigned used_by_indirect_call : 1;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
454 unsigned used_by_polymorphic_call : 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
455 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
456
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
457 /* ipa_node_params stores information related to formal parameters of functions
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
458 and some other information for interprocedural passes that operate on
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
459 parameters (such as ipa-cp). */
111
kono
parents: 67
diff changeset
460
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
461 class GTY((for_user)) ipa_node_params
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
462 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
463 public:
111
kono
parents: 67
diff changeset
464 /* Default constructor. */
kono
parents: 67
diff changeset
465 ipa_node_params ();
kono
parents: 67
diff changeset
466
kono
parents: 67
diff changeset
467 /* Default destructor. */
kono
parents: 67
diff changeset
468 ~ipa_node_params ();
kono
parents: 67
diff changeset
469
kono
parents: 67
diff changeset
470 /* Information about individual formal parameters that are gathered when
kono
parents: 67
diff changeset
471 summaries are generated. */
kono
parents: 67
diff changeset
472 vec<ipa_param_descriptor, va_gc> *descriptors;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 /* Pointer to an array of structures describing individual formal
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 parameters. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
475 class ipcp_param_lattices * GTY((skip)) lattices;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 /* Only for versioned nodes this field would not be NULL,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 it points to the node that IPA cp cloned from. */
111
kono
parents: 67
diff changeset
478 struct cgraph_node * GTY((skip)) ipcp_orig_node;
kono
parents: 67
diff changeset
479 /* If this node is an ipa-cp clone, these are the known constants that
kono
parents: 67
diff changeset
480 describe what it has been specialized for. */
kono
parents: 67
diff changeset
481 vec<tree> GTY((skip)) known_csts;
kono
parents: 67
diff changeset
482 /* If this node is an ipa-cp clone, these are the known polymorphic contexts
kono
parents: 67
diff changeset
483 that describe what it has been specialized for. */
kono
parents: 67
diff changeset
484 vec<ipa_polymorphic_call_context> GTY((skip)) known_contexts;
kono
parents: 67
diff changeset
485 /* Whether the param uses analysis and jump function computation has already
kono
parents: 67
diff changeset
486 been performed. */
kono
parents: 67
diff changeset
487 unsigned analysis_done : 1;
kono
parents: 67
diff changeset
488 /* Whether the function is enqueued in ipa-cp propagation stack. */
kono
parents: 67
diff changeset
489 unsigned node_enqueued : 1;
kono
parents: 67
diff changeset
490 /* Whether we should create a specialized version based on values that are
kono
parents: 67
diff changeset
491 known to be constant in all contexts. */
kono
parents: 67
diff changeset
492 unsigned do_clone_for_all_contexts : 1;
kono
parents: 67
diff changeset
493 /* Set if this is an IPA-CP clone for all contexts. */
kono
parents: 67
diff changeset
494 unsigned is_all_contexts_clone : 1;
kono
parents: 67
diff changeset
495 /* Node has been completely replaced by clones and will be removed after
kono
parents: 67
diff changeset
496 ipa-cp is finished. */
kono
parents: 67
diff changeset
497 unsigned node_dead : 1;
kono
parents: 67
diff changeset
498 /* Node is involved in a recursion, potentionally indirect. */
kono
parents: 67
diff changeset
499 unsigned node_within_scc : 1;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
500 /* Node contains only direct recursion. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
501 unsigned node_is_self_scc : 1;
111
kono
parents: 67
diff changeset
502 /* Node is calling a private function called only once. */
kono
parents: 67
diff changeset
503 unsigned node_calling_single_call : 1;
kono
parents: 67
diff changeset
504 /* False when there is something makes versioning impossible. */
kono
parents: 67
diff changeset
505 unsigned versionable : 1;
kono
parents: 67
diff changeset
506 };
kono
parents: 67
diff changeset
507
kono
parents: 67
diff changeset
508 inline
kono
parents: 67
diff changeset
509 ipa_node_params::ipa_node_params ()
kono
parents: 67
diff changeset
510 : descriptors (NULL), lattices (NULL), ipcp_orig_node (NULL),
kono
parents: 67
diff changeset
511 known_csts (vNULL), known_contexts (vNULL), analysis_done (0),
kono
parents: 67
diff changeset
512 node_enqueued (0), do_clone_for_all_contexts (0), is_all_contexts_clone (0),
kono
parents: 67
diff changeset
513 node_dead (0), node_within_scc (0), node_calling_single_call (0),
kono
parents: 67
diff changeset
514 versionable (0)
kono
parents: 67
diff changeset
515 {
kono
parents: 67
diff changeset
516 }
kono
parents: 67
diff changeset
517
kono
parents: 67
diff changeset
518 inline
kono
parents: 67
diff changeset
519 ipa_node_params::~ipa_node_params ()
kono
parents: 67
diff changeset
520 {
kono
parents: 67
diff changeset
521 free (lattices);
kono
parents: 67
diff changeset
522 known_csts.release ();
kono
parents: 67
diff changeset
523 known_contexts.release ();
kono
parents: 67
diff changeset
524 }
kono
parents: 67
diff changeset
525
kono
parents: 67
diff changeset
526 /* Intermediate information that we get from alias analysis about a particular
kono
parents: 67
diff changeset
527 parameter in a particular basic_block. When a parameter or the memory it
kono
parents: 67
diff changeset
528 references is marked modified, we use that information in all dominated
kono
parents: 67
diff changeset
529 blocks without consulting alias analysis oracle. */
kono
parents: 67
diff changeset
530
kono
parents: 67
diff changeset
531 struct ipa_param_aa_status
kono
parents: 67
diff changeset
532 {
kono
parents: 67
diff changeset
533 /* Set when this structure contains meaningful information. If not, the
kono
parents: 67
diff changeset
534 structure describing a dominating BB should be used instead. */
kono
parents: 67
diff changeset
535 bool valid;
kono
parents: 67
diff changeset
536
kono
parents: 67
diff changeset
537 /* Whether we have seen something which might have modified the data in
kono
parents: 67
diff changeset
538 question. PARM is for the parameter itself, REF is for data it points to
kono
parents: 67
diff changeset
539 but using the alias type of individual accesses and PT is the same thing
kono
parents: 67
diff changeset
540 but for computing aggregate pass-through functions using a very inclusive
kono
parents: 67
diff changeset
541 ao_ref. */
kono
parents: 67
diff changeset
542 bool parm_modified, ref_modified, pt_modified;
kono
parents: 67
diff changeset
543 };
kono
parents: 67
diff changeset
544
kono
parents: 67
diff changeset
545 /* Information related to a given BB that used only when looking at function
kono
parents: 67
diff changeset
546 body. */
kono
parents: 67
diff changeset
547
kono
parents: 67
diff changeset
548 struct ipa_bb_info
kono
parents: 67
diff changeset
549 {
kono
parents: 67
diff changeset
550 /* Call graph edges going out of this BB. */
kono
parents: 67
diff changeset
551 vec<cgraph_edge *> cg_edges;
kono
parents: 67
diff changeset
552 /* Alias analysis statuses of each formal parameter at this bb. */
kono
parents: 67
diff changeset
553 vec<ipa_param_aa_status> param_aa_statuses;
kono
parents: 67
diff changeset
554 };
kono
parents: 67
diff changeset
555
kono
parents: 67
diff changeset
556 /* Structure with global information that is only used when looking at function
kono
parents: 67
diff changeset
557 body. */
kono
parents: 67
diff changeset
558
kono
parents: 67
diff changeset
559 struct ipa_func_body_info
kono
parents: 67
diff changeset
560 {
kono
parents: 67
diff changeset
561 /* The node that is being analyzed. */
kono
parents: 67
diff changeset
562 cgraph_node *node;
kono
parents: 67
diff changeset
563
kono
parents: 67
diff changeset
564 /* Its info. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
565 class ipa_node_params *info;
111
kono
parents: 67
diff changeset
566
kono
parents: 67
diff changeset
567 /* Information about individual BBs. */
kono
parents: 67
diff changeset
568 vec<ipa_bb_info> bb_infos;
kono
parents: 67
diff changeset
569
kono
parents: 67
diff changeset
570 /* Number of parameters. */
kono
parents: 67
diff changeset
571 int param_count;
kono
parents: 67
diff changeset
572
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
573 /* Number of statements we are still allowed to walked by when analyzing this
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
574 function. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
575 unsigned int aa_walk_budget;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
576 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
577
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
578 /* ipa_node_params access functions. Please use these to access fields that
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
579 are or will be shared among various passes. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
580
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
581 /* Return the number of formal parameters. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
582
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
583 static inline int
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
584 ipa_get_param_count (class ipa_node_params *info)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
585 {
111
kono
parents: 67
diff changeset
586 return vec_safe_length (info->descriptors);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
587 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
588
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
589 /* Return the declaration of Ith formal parameter of the function corresponding
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
590 to INFO. Note there is no setter function as this array is built just once
111
kono
parents: 67
diff changeset
591 using ipa_initialize_node_params. This function should not be called in
kono
parents: 67
diff changeset
592 WPA. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
593
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
594 static inline tree
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
595 ipa_get_param (class ipa_node_params *info, int i)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 {
111
kono
parents: 67
diff changeset
597 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
598 tree t = (*info->descriptors)[i].decl_or_type;
kono
parents: 67
diff changeset
599 gcc_checking_assert (TREE_CODE (t) == PARM_DECL);
kono
parents: 67
diff changeset
600 return t;
kono
parents: 67
diff changeset
601 }
kono
parents: 67
diff changeset
602
kono
parents: 67
diff changeset
603 /* Return the type of Ith formal parameter of the function corresponding
kono
parents: 67
diff changeset
604 to INFO if it is known or NULL if not. */
kono
parents: 67
diff changeset
605
kono
parents: 67
diff changeset
606 static inline tree
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
607 ipa_get_type (class ipa_node_params *info, int i)
111
kono
parents: 67
diff changeset
608 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
609 if (vec_safe_length (info->descriptors) <= (unsigned) i)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
610 return NULL;
111
kono
parents: 67
diff changeset
611 tree t = (*info->descriptors)[i].decl_or_type;
kono
parents: 67
diff changeset
612 if (!t)
kono
parents: 67
diff changeset
613 return NULL;
kono
parents: 67
diff changeset
614 if (TYPE_P (t))
kono
parents: 67
diff changeset
615 return t;
kono
parents: 67
diff changeset
616 gcc_checking_assert (TREE_CODE (t) == PARM_DECL);
kono
parents: 67
diff changeset
617 return TREE_TYPE (t);
kono
parents: 67
diff changeset
618 }
kono
parents: 67
diff changeset
619
kono
parents: 67
diff changeset
620 /* Return the move cost of Ith formal parameter of the function corresponding
kono
parents: 67
diff changeset
621 to INFO. */
kono
parents: 67
diff changeset
622
kono
parents: 67
diff changeset
623 static inline int
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
624 ipa_get_param_move_cost (class ipa_node_params *info, int i)
111
kono
parents: 67
diff changeset
625 {
kono
parents: 67
diff changeset
626 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
627 return (*info->descriptors)[i].move_cost;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
629
111
kono
parents: 67
diff changeset
630 /* Set the used flag corresponding to the Ith formal parameter of the function
kono
parents: 67
diff changeset
631 associated with INFO to VAL. */
kono
parents: 67
diff changeset
632
kono
parents: 67
diff changeset
633 static inline void
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
634 ipa_set_param_used (class ipa_node_params *info, int i, bool val)
111
kono
parents: 67
diff changeset
635 {
kono
parents: 67
diff changeset
636 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
637 (*info->descriptors)[i].used = val;
kono
parents: 67
diff changeset
638 }
kono
parents: 67
diff changeset
639
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
640 /* Set the used_by_ipa_predicates flag corresponding to the Ith formal
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
641 parameter of the function associated with INFO to VAL. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
642
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
643 static inline void
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
644 ipa_set_param_used_by_ipa_predicates (class ipa_node_params *info, int i, bool val)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
645 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
646 gcc_checking_assert (info->descriptors);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
647 (*info->descriptors)[i].used_by_ipa_predicates = val;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
648 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
649
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
650 /* Set the used_by_indirect_call flag corresponding to the Ith formal
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
651 parameter of the function associated with INFO to VAL. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
652
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
653 static inline void
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
654 ipa_set_param_used_by_indirect_call (class ipa_node_params *info, int i, bool val)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
655 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
656 gcc_checking_assert (info->descriptors);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
657 (*info->descriptors)[i].used_by_indirect_call = val;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
658 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
659
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
660 /* Set the .used_by_polymorphic_call flag corresponding to the Ith formal
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
661 parameter of the function associated with INFO to VAL. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
662
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
663 static inline void
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
664 ipa_set_param_used_by_polymorphic_call (class ipa_node_params *info, int i, bool val)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
665 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
666 gcc_checking_assert (info->descriptors);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
667 (*info->descriptors)[i].used_by_polymorphic_call = val;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
668 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
669
111
kono
parents: 67
diff changeset
670 /* Return how many uses described by ipa-prop a parameter has or
kono
parents: 67
diff changeset
671 IPA_UNDESCRIBED_USE if there is a use that is not described by these
kono
parents: 67
diff changeset
672 structures. */
kono
parents: 67
diff changeset
673 static inline int
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
674 ipa_get_controlled_uses (class ipa_node_params *info, int i)
111
kono
parents: 67
diff changeset
675 {
kono
parents: 67
diff changeset
676 /* FIXME: introducing speculation causes out of bounds access here. */
kono
parents: 67
diff changeset
677 if (vec_safe_length (info->descriptors) > (unsigned)i)
kono
parents: 67
diff changeset
678 return (*info->descriptors)[i].controlled_uses;
kono
parents: 67
diff changeset
679 return IPA_UNDESCRIBED_USE;
kono
parents: 67
diff changeset
680 }
kono
parents: 67
diff changeset
681
kono
parents: 67
diff changeset
682 /* Set the controlled counter of a given parameter. */
kono
parents: 67
diff changeset
683
kono
parents: 67
diff changeset
684 static inline void
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
685 ipa_set_controlled_uses (class ipa_node_params *info, int i, int val)
111
kono
parents: 67
diff changeset
686 {
kono
parents: 67
diff changeset
687 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
688 (*info->descriptors)[i].controlled_uses = val;
kono
parents: 67
diff changeset
689 }
kono
parents: 67
diff changeset
690
kono
parents: 67
diff changeset
691 /* Return the used flag corresponding to the Ith formal parameter of the
kono
parents: 67
diff changeset
692 function associated with INFO. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
693
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
694 static inline bool
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
695 ipa_is_param_used (class ipa_node_params *info, int i)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
696 {
111
kono
parents: 67
diff changeset
697 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
698 return (*info->descriptors)[i].used;
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
699 }
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
700
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
701 /* Return the used_by_ipa_predicates flag corresponding to the Ith formal
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
702 parameter of the function associated with INFO. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
703
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
704 static inline bool
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
705 ipa_is_param_used_by_ipa_predicates (class ipa_node_params *info, int i)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
706 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
707 gcc_checking_assert (info->descriptors);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
708 return (*info->descriptors)[i].used_by_ipa_predicates;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
709 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
710
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
711 /* Return the used_by_indirect_call flag corresponding to the Ith formal
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
712 parameter of the function associated with INFO. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
713
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
714 static inline bool
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
715 ipa_is_param_used_by_indirect_call (class ipa_node_params *info, int i)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
716 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
717 gcc_checking_assert (info->descriptors);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
718 return (*info->descriptors)[i].used_by_indirect_call;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
719 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
720
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
721 /* Return the used_by_polymorphic_call flag corresponding to the Ith formal
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
722 parameter of the function associated with INFO. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
723
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
724 static inline bool
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
725 ipa_is_param_used_by_polymorphic_call (class ipa_node_params *info, int i)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
726 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
727 gcc_checking_assert (info->descriptors);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
728 return (*info->descriptors)[i].used_by_polymorphic_call;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
729 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
730
111
kono
parents: 67
diff changeset
731 /* Information about replacements done in aggregates for a given node (each
kono
parents: 67
diff changeset
732 node has its linked list). */
kono
parents: 67
diff changeset
733 struct GTY(()) ipa_agg_replacement_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
734 {
111
kono
parents: 67
diff changeset
735 /* Next item in the linked list. */
kono
parents: 67
diff changeset
736 struct ipa_agg_replacement_value *next;
kono
parents: 67
diff changeset
737 /* Offset within the aggregate. */
kono
parents: 67
diff changeset
738 HOST_WIDE_INT offset;
kono
parents: 67
diff changeset
739 /* The constant value. */
kono
parents: 67
diff changeset
740 tree value;
kono
parents: 67
diff changeset
741 /* The paramter index. */
kono
parents: 67
diff changeset
742 int index;
kono
parents: 67
diff changeset
743 /* Whether the value was passed by reference. */
kono
parents: 67
diff changeset
744 bool by_ref;
kono
parents: 67
diff changeset
745 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
746
111
kono
parents: 67
diff changeset
747 /* Structure holding information for the transformation phase of IPA-CP. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
749 struct GTY(()) ipcp_transformation
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750 {
111
kono
parents: 67
diff changeset
751 /* Linked list of known aggregate values. */
kono
parents: 67
diff changeset
752 ipa_agg_replacement_value *agg_values;
kono
parents: 67
diff changeset
753 /* Known bits information. */
kono
parents: 67
diff changeset
754 vec<ipa_bits *, va_gc> *bits;
kono
parents: 67
diff changeset
755 /* Value range information. */
kono
parents: 67
diff changeset
756 vec<ipa_vr, va_gc> *m_vr;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
757
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
758 /* Default constructor. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
759 ipcp_transformation ()
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
760 : agg_values (NULL), bits (NULL), m_vr (NULL)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
761 { }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
762
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
763 /* Default destructor. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
764 ~ipcp_transformation ()
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
765 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
766 ipa_agg_replacement_value *agg = agg_values;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
767 while (agg)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
768 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
769 ipa_agg_replacement_value *next = agg->next;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
770 ggc_free (agg);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
771 agg = next;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
772 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
773 vec_free (bits);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
774 vec_free (m_vr);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
775 }
111
kono
parents: 67
diff changeset
776 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
777
111
kono
parents: 67
diff changeset
778 void ipa_set_node_agg_value_chain (struct cgraph_node *node,
kono
parents: 67
diff changeset
779 struct ipa_agg_replacement_value *aggvals);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
780 void ipcp_transformation_initialize (void);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
781 void ipcp_free_transformation_sum (void);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
782
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
783 /* ipa_edge_args stores information related to a callsite and particularly its
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
784 arguments. It can be accessed by the IPA_EDGE_REF macro. */
111
kono
parents: 67
diff changeset
785
kono
parents: 67
diff changeset
786 class GTY((for_user)) ipa_edge_args
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
787 {
111
kono
parents: 67
diff changeset
788 public:
kono
parents: 67
diff changeset
789
kono
parents: 67
diff changeset
790 /* Default constructor. */
kono
parents: 67
diff changeset
791 ipa_edge_args () : jump_functions (NULL), polymorphic_call_contexts (NULL)
kono
parents: 67
diff changeset
792 {}
kono
parents: 67
diff changeset
793
kono
parents: 67
diff changeset
794 /* Destructor. */
kono
parents: 67
diff changeset
795 ~ipa_edge_args ()
kono
parents: 67
diff changeset
796 {
kono
parents: 67
diff changeset
797 vec_free (jump_functions);
kono
parents: 67
diff changeset
798 vec_free (polymorphic_call_contexts);
kono
parents: 67
diff changeset
799 }
kono
parents: 67
diff changeset
800
kono
parents: 67
diff changeset
801 /* Vectors of the callsite's jump function and polymorphic context
kono
parents: 67
diff changeset
802 information of each parameter. */
kono
parents: 67
diff changeset
803 vec<ipa_jump_func, va_gc> *jump_functions;
kono
parents: 67
diff changeset
804 vec<ipa_polymorphic_call_context, va_gc> *polymorphic_call_contexts;
kono
parents: 67
diff changeset
805 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
806
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
807 /* ipa_edge_args access functions. Please use these to access fields that
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
808 are or will be shared among various passes. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
809
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
810 /* Return the number of actual arguments. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
811
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
812 static inline int
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
813 ipa_get_cs_argument_count (class ipa_edge_args *args)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
814 {
111
kono
parents: 67
diff changeset
815 return vec_safe_length (args->jump_functions);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
816 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
817
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
818 /* Returns a pointer to the jump function for the ith argument. Please note
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
819 there is no setter function as jump functions are all set up in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
820 ipa_compute_jump_functions. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
821
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
822 static inline struct ipa_jump_func *
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
823 ipa_get_ith_jump_func (class ipa_edge_args *args, int i)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
824 {
111
kono
parents: 67
diff changeset
825 return &(*args->jump_functions)[i];
kono
parents: 67
diff changeset
826 }
kono
parents: 67
diff changeset
827
kono
parents: 67
diff changeset
828 /* Returns a pointer to the polymorphic call context for the ith argument.
kono
parents: 67
diff changeset
829 NULL if contexts are not computed. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
830 static inline class ipa_polymorphic_call_context *
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
831 ipa_get_ith_polymorhic_call_context (class ipa_edge_args *args, int i)
111
kono
parents: 67
diff changeset
832 {
kono
parents: 67
diff changeset
833 if (!args->polymorphic_call_contexts)
kono
parents: 67
diff changeset
834 return NULL;
kono
parents: 67
diff changeset
835 return &(*args->polymorphic_call_contexts)[i];
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
836 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
837
111
kono
parents: 67
diff changeset
838 /* Function summary for ipa_node_params. */
kono
parents: 67
diff changeset
839 class GTY((user)) ipa_node_params_t: public function_summary <ipa_node_params *>
kono
parents: 67
diff changeset
840 {
kono
parents: 67
diff changeset
841 public:
kono
parents: 67
diff changeset
842 ipa_node_params_t (symbol_table *table, bool ggc):
kono
parents: 67
diff changeset
843 function_summary<ipa_node_params *> (table, ggc) { }
kono
parents: 67
diff changeset
844
kono
parents: 67
diff changeset
845 /* Hook that is called by summary when a node is duplicated. */
kono
parents: 67
diff changeset
846 virtual void duplicate (cgraph_node *node,
kono
parents: 67
diff changeset
847 cgraph_node *node2,
kono
parents: 67
diff changeset
848 ipa_node_params *data,
kono
parents: 67
diff changeset
849 ipa_node_params *data2);
kono
parents: 67
diff changeset
850 };
kono
parents: 67
diff changeset
851
kono
parents: 67
diff changeset
852 /* Summary to manange ipa_edge_args structures. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
853
111
kono
parents: 67
diff changeset
854 class GTY((user)) ipa_edge_args_sum_t : public call_summary <ipa_edge_args *>
kono
parents: 67
diff changeset
855 {
kono
parents: 67
diff changeset
856 public:
kono
parents: 67
diff changeset
857 ipa_edge_args_sum_t (symbol_table *table, bool ggc)
kono
parents: 67
diff changeset
858 : call_summary<ipa_edge_args *> (table, ggc) { }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
859
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
860 void remove (cgraph_edge *edge)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
861 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
862 call_summary <ipa_edge_args *>::remove (edge);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
863 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
864
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
865 /* Hook that is called by summary when an edge is removed. */
111
kono
parents: 67
diff changeset
866 virtual void remove (cgraph_edge *cs, ipa_edge_args *args);
kono
parents: 67
diff changeset
867 /* Hook that is called by summary when an edge is duplicated. */
kono
parents: 67
diff changeset
868 virtual void duplicate (cgraph_edge *src,
kono
parents: 67
diff changeset
869 cgraph_edge *dst,
kono
parents: 67
diff changeset
870 ipa_edge_args *old_args,
kono
parents: 67
diff changeset
871 ipa_edge_args *new_args);
kono
parents: 67
diff changeset
872 };
kono
parents: 67
diff changeset
873
kono
parents: 67
diff changeset
874 /* Function summary where the parameter infos are actually stored. */
kono
parents: 67
diff changeset
875 extern GTY(()) ipa_node_params_t * ipa_node_params_sum;
kono
parents: 67
diff changeset
876 /* Call summary to store information about edges such as jump functions. */
kono
parents: 67
diff changeset
877 extern GTY(()) ipa_edge_args_sum_t *ipa_edge_args_sum;
kono
parents: 67
diff changeset
878
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
879 /* Function summary for IPA-CP transformation. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
880 class ipcp_transformation_t
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
881 : public function_summary<ipcp_transformation *>
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
882 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
883 public:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
884 ipcp_transformation_t (symbol_table *table, bool ggc):
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
885 function_summary<ipcp_transformation *> (table, ggc) {}
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
886
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
887 ~ipcp_transformation_t () {}
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
888
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
889 static ipcp_transformation_t *create_ggc (symbol_table *symtab)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
890 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
891 ipcp_transformation_t *summary
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
892 = new (ggc_alloc_no_dtor <ipcp_transformation_t> ())
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
893 ipcp_transformation_t (symtab, true);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
894 return summary;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
895 }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
896 /* Hook that is called by summary when a node is duplicated. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
897 virtual void duplicate (cgraph_node *node,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
898 cgraph_node *node2,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
899 ipcp_transformation *data,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
900 ipcp_transformation *data2);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
901 };
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
902
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
903 /* Function summary where the IPA CP transformations are actually stored. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
904 extern GTY(()) function_summary <ipcp_transformation *> *ipcp_transformation_sum;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
905
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
906 /* Return the associated parameter/argument info corresponding to the given
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
907 node/edge. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
908 #define IPA_NODE_REF(NODE) (ipa_node_params_sum->get (NODE))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
909 #define IPA_NODE_REF_GET_CREATE(NODE) (ipa_node_params_sum->get_create (NODE))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
910 #define IPA_EDGE_REF(EDGE) (ipa_edge_args_sum->get (EDGE))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
911 #define IPA_EDGE_REF_GET_CREATE(EDGE) (ipa_edge_args_sum->get_create (EDGE))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
912 /* This macro checks validity of index returned by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
913 ipa_get_param_decl_index function. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
914 #define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
915
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
916 /* Creating and freeing ipa_node_params and ipa_edge_args. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
917 void ipa_create_all_node_params (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
918 void ipa_create_all_edge_args (void);
111
kono
parents: 67
diff changeset
919 void ipa_check_create_edge_args (void);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
920 void ipa_free_all_node_params (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
921 void ipa_free_all_edge_args (void);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
922 void ipa_free_all_structures_after_ipa_cp (void);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
923 void ipa_free_all_structures_after_iinln (void);
111
kono
parents: 67
diff changeset
924
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
925 void ipa_register_cgraph_hooks (void);
111
kono
parents: 67
diff changeset
926 int count_formal_params (tree fndecl);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
927
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
928 /* This function ensures the array of node param infos is big enough to
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
929 accommodate a structure for all nodes and reallocates it if not. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
930
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
931 static inline void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
932 ipa_check_create_node_params (void)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
933 {
111
kono
parents: 67
diff changeset
934 if (!ipa_node_params_sum)
kono
parents: 67
diff changeset
935 ipa_node_params_sum
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
936 = (new (ggc_alloc_no_dtor <ipa_node_params_t> ())
111
kono
parents: 67
diff changeset
937 ipa_node_params_t (symtab, true));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
938 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
939
111
kono
parents: 67
diff changeset
940 /* Returns true if edge summary contains a record for EDGE. The main purpose
kono
parents: 67
diff changeset
941 of this function is that debug dumping function can check info availability
kono
parents: 67
diff changeset
942 without causing allocations. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
943
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
944 static inline bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
945 ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
946 {
111
kono
parents: 67
diff changeset
947 return ipa_edge_args_sum->exists (edge);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
948 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
949
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
950 static inline ipcp_transformation *
111
kono
parents: 67
diff changeset
951 ipcp_get_transformation_summary (cgraph_node *node)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
952 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
953 if (ipcp_transformation_sum == NULL)
111
kono
parents: 67
diff changeset
954 return NULL;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
955
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
956 return ipcp_transformation_sum->get (node);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
957 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
958
111
kono
parents: 67
diff changeset
959 /* Return the aggregate replacements for NODE, if there are any. */
kono
parents: 67
diff changeset
960
kono
parents: 67
diff changeset
961 static inline struct ipa_agg_replacement_value *
kono
parents: 67
diff changeset
962 ipa_get_agg_replacements_for_node (cgraph_node *node)
kono
parents: 67
diff changeset
963 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
964 ipcp_transformation *ts = ipcp_get_transformation_summary (node);
111
kono
parents: 67
diff changeset
965 return ts ? ts->agg_values : NULL;
kono
parents: 67
diff changeset
966 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
967
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
968 /* Function formal parameters related computations. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
969 void ipa_initialize_node_params (struct cgraph_node *node);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
970 bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
111
kono
parents: 67
diff changeset
971 vec<cgraph_edge *> *new_edges);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
972
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
973 /* Indirect edge and binfo processing. */
111
kono
parents: 67
diff changeset
974 tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
975 vec<tree>,
111
kono
parents: 67
diff changeset
976 vec<ipa_polymorphic_call_context>,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
977 vec<ipa_agg_value_set>,
111
kono
parents: 67
diff changeset
978 bool *);
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
979 struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree,
111
kono
parents: 67
diff changeset
980 bool speculative = false);
kono
parents: 67
diff changeset
981 tree ipa_impossible_devirt_target (struct cgraph_edge *, tree);
kono
parents: 67
diff changeset
982 ipa_bits *ipa_get_ipa_bits_for_value (const widest_int &value,
kono
parents: 67
diff changeset
983 const widest_int &mask);
kono
parents: 67
diff changeset
984
kono
parents: 67
diff changeset
985
kono
parents: 67
diff changeset
986 /* Functions related to both. */
kono
parents: 67
diff changeset
987 void ipa_analyze_node (struct cgraph_node *);
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
988
111
kono
parents: 67
diff changeset
989 /* Aggregate jump function related functions. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
990 tree ipa_find_agg_cst_for_param (struct ipa_agg_value_set *agg, tree scalar,
111
kono
parents: 67
diff changeset
991 HOST_WIDE_INT offset, bool by_ref,
kono
parents: 67
diff changeset
992 bool *from_global_constant = NULL);
kono
parents: 67
diff changeset
993 bool ipa_load_from_parm_agg (struct ipa_func_body_info *fbi,
kono
parents: 67
diff changeset
994 vec<ipa_param_descriptor, va_gc> *descriptors,
kono
parents: 67
diff changeset
995 gimple *stmt, tree op, int *index_p,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
996 HOST_WIDE_INT *offset_p, poly_int64 *size_p,
111
kono
parents: 67
diff changeset
997 bool *by_ref, bool *guaranteed_unmodified = NULL);
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
998
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
999 /* Debugging interface. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1000 void ipa_print_node_params (FILE *, struct cgraph_node *node);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1001 void ipa_print_all_params (FILE *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1002 void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1003 void ipa_print_all_jump_functions (FILE * f);
111
kono
parents: 67
diff changeset
1004 void ipcp_verify_propagated_values (void);
kono
parents: 67
diff changeset
1005
kono
parents: 67
diff changeset
1006 template <typename value>
kono
parents: 67
diff changeset
1007 class ipcp_value;
kono
parents: 67
diff changeset
1008
kono
parents: 67
diff changeset
1009 extern object_allocator<ipcp_value<tree> > ipcp_cst_values_pool;
kono
parents: 67
diff changeset
1010 extern object_allocator<ipcp_value<ipa_polymorphic_call_context> >
kono
parents: 67
diff changeset
1011 ipcp_poly_ctx_values_pool;
kono
parents: 67
diff changeset
1012
kono
parents: 67
diff changeset
1013 template <typename valtype>
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1014 struct ipcp_value_source;
111
kono
parents: 67
diff changeset
1015
kono
parents: 67
diff changeset
1016 extern object_allocator<ipcp_value_source<tree> > ipcp_sources_pool;
kono
parents: 67
diff changeset
1017
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1018 struct ipcp_agg_lattice;
111
kono
parents: 67
diff changeset
1019
kono
parents: 67
diff changeset
1020 extern object_allocator<ipcp_agg_lattice> ipcp_agg_lattice_pool;
kono
parents: 67
diff changeset
1021
kono
parents: 67
diff changeset
1022 void ipa_dump_agg_replacement_values (FILE *f,
kono
parents: 67
diff changeset
1023 struct ipa_agg_replacement_value *av);
kono
parents: 67
diff changeset
1024 void ipa_prop_write_jump_functions (void);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1025 void ipa_prop_read_jump_functions (void);
111
kono
parents: 67
diff changeset
1026 void ipcp_write_transformation_summaries (void);
kono
parents: 67
diff changeset
1027 void ipcp_read_transformation_summaries (void);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1028 int ipa_get_param_decl_index (class ipa_node_params *, tree);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1029 tree ipa_value_from_jfunc (class ipa_node_params *info,
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1030 struct ipa_jump_func *jfunc, tree type);
111
kono
parents: 67
diff changeset
1031 unsigned int ipcp_transform_function (struct cgraph_node *node);
kono
parents: 67
diff changeset
1032 ipa_polymorphic_call_context ipa_context_from_jfunc (ipa_node_params *,
kono
parents: 67
diff changeset
1033 cgraph_edge *,
kono
parents: 67
diff changeset
1034 int,
kono
parents: 67
diff changeset
1035 ipa_jump_func *);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1036 value_range ipa_value_range_from_jfunc (ipa_node_params *, cgraph_edge *,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1037 ipa_jump_func *, tree);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1038 ipa_agg_value_set ipa_agg_value_set_from_jfunc (ipa_node_params *,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1039 cgraph_node *,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1040 ipa_agg_jump_function *);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1041 void ipa_dump_param (FILE *, class ipa_node_params *info, int i);
111
kono
parents: 67
diff changeset
1042 void ipa_release_body_info (struct ipa_func_body_info *);
kono
parents: 67
diff changeset
1043 tree ipa_get_callee_param_type (struct cgraph_edge *e, int i);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1044 bool ipcp_get_parm_bits (tree, tree *, widest_int *);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1045
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1046 /* From tree-sra.c: */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1047 tree build_ref_for_offset (location_t, tree, poly_int64, bool, tree,
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
1048 gimple_stmt_iterator *, bool);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1049
111
kono
parents: 67
diff changeset
1050 /* In ipa-cp.c */
kono
parents: 67
diff changeset
1051 void ipa_cp_c_finalize (void);
kono
parents: 67
diff changeset
1052
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1053 #endif /* IPA_PROP_H */