annotate gcc/ipa-prop.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
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.
111
kono
parents: 67
diff changeset
2 Copyright (C) 2005-2017 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
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
42 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
43 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
44 parameter to which the function refers. It is mainly intended to represent
111
kono
parents: 67
diff changeset
45 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
46 (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
47 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
48
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
49 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
50 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
51 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
52
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
53 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
54 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
55 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
56 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
57
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 enum jump_func_type
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
60 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
61 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
62 IPA_JF_PASS_THROUGH, /* represented by field 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
63 IPA_JF_ANCESTOR /* represented by field ancestor */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65
111
kono
parents: 67
diff changeset
66 struct ipa_cst_ref_desc;
kono
parents: 67
diff changeset
67
kono
parents: 67
diff changeset
68 /* Structure holding data required to describe a constant jump function. */
kono
parents: 67
diff changeset
69 struct GTY(()) ipa_constant_data
kono
parents: 67
diff changeset
70 {
kono
parents: 67
diff changeset
71 /* THe value of the constant. */
kono
parents: 67
diff changeset
72 tree value;
kono
parents: 67
diff changeset
73 /* Pointer to the structure that describes the reference. */
kono
parents: 67
diff changeset
74 struct ipa_cst_ref_desc GTY((skip)) *rdesc;
kono
parents: 67
diff changeset
75 };
kono
parents: 67
diff changeset
76
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
77 /* 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
78
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
79 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
80 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
81 /* 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
82 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
83 tree operand;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
84 /* 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
85 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
86 /* 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
87 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
88 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
89 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
90 enum tree_code operation;
111
kono
parents: 67
diff changeset
91 /* When the passed value is a pointer, it is set to true only when we are
kono
parents: 67
diff changeset
92 certain that no write to the object it points to has occurred since the
kono
parents: 67
diff changeset
93 caller functions started execution, except for changes noted in the
kono
parents: 67
diff changeset
94 aggregate part of the jump function (see description of
kono
parents: 67
diff changeset
95 ipa_agg_jump_function). The flag is used only when the operation is
kono
parents: 67
diff changeset
96 NOP_EXPR. */
kono
parents: 67
diff changeset
97 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
98 };
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
99
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
100 /* 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
101 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
102
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
103 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
104 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
105 /* 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
106 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
107 /* 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
108 int formal_id;
111
kono
parents: 67
diff changeset
109 /* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */
kono
parents: 67
diff changeset
110 unsigned agg_preserved : 1;
kono
parents: 67
diff changeset
111 };
kono
parents: 67
diff changeset
112
kono
parents: 67
diff changeset
113 /* An element in an aggegate part of a jump function describing a known value
kono
parents: 67
diff changeset
114 at a given offset. When it is part of a pass-through jump function with
kono
parents: 67
diff changeset
115 agg_preserved set or an ancestor jump function with agg_preserved set, all
kono
parents: 67
diff changeset
116 unlisted positions are assumed to be preserved but the value can be a type
kono
parents: 67
diff changeset
117 node, which means that the particular piece (starting at offset and having
kono
parents: 67
diff changeset
118 the size of the type) is clobbered with an unknown value. When
kono
parents: 67
diff changeset
119 agg_preserved is false or the type of the containing jump function is
kono
parents: 67
diff changeset
120 different, all unlisted parts are assumed to be unknown and all values must
kono
parents: 67
diff changeset
121 fulfill is_gimple_ip_invariant. */
kono
parents: 67
diff changeset
122
kono
parents: 67
diff changeset
123 struct GTY(()) ipa_agg_jf_item
kono
parents: 67
diff changeset
124 {
kono
parents: 67
diff changeset
125 /* The offset at which the known value is located within the aggregate. */
kono
parents: 67
diff changeset
126 HOST_WIDE_INT offset;
kono
parents: 67
diff changeset
127
kono
parents: 67
diff changeset
128 /* The known constant or type if this is a clobber. */
kono
parents: 67
diff changeset
129 tree value;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
130 };
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
131
111
kono
parents: 67
diff changeset
132
kono
parents: 67
diff changeset
133 /* Aggregate jump function - i.e. description of contents of aggregates passed
kono
parents: 67
diff changeset
134 either by reference or value. */
kono
parents: 67
diff changeset
135
kono
parents: 67
diff changeset
136 struct GTY(()) ipa_agg_jump_function
kono
parents: 67
diff changeset
137 {
kono
parents: 67
diff changeset
138 /* Description of the individual items. */
kono
parents: 67
diff changeset
139 vec<ipa_agg_jf_item, va_gc> *items;
kono
parents: 67
diff changeset
140 /* True if the data was passed by reference (as opposed to by value). */
kono
parents: 67
diff changeset
141 bool by_ref;
kono
parents: 67
diff changeset
142 };
kono
parents: 67
diff changeset
143
kono
parents: 67
diff changeset
144 typedef struct ipa_agg_jump_function *ipa_agg_jump_function_p;
kono
parents: 67
diff changeset
145
kono
parents: 67
diff changeset
146 /* Information about zero/non-zero bits. */
kono
parents: 67
diff changeset
147 struct GTY(()) ipa_bits
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 {
111
kono
parents: 67
diff changeset
149 /* The propagated value. */
kono
parents: 67
diff changeset
150 widest_int value;
kono
parents: 67
diff changeset
151 /* Mask corresponding to the value.
kono
parents: 67
diff changeset
152 Similar to ccp_lattice_t, if xth bit of mask is 0,
kono
parents: 67
diff changeset
153 implies xth bit of value is constant. */
kono
parents: 67
diff changeset
154 widest_int mask;
kono
parents: 67
diff changeset
155 };
kono
parents: 67
diff changeset
156
kono
parents: 67
diff changeset
157 /* Info about value ranges. */
kono
parents: 67
diff changeset
158
kono
parents: 67
diff changeset
159 struct GTY(()) ipa_vr
kono
parents: 67
diff changeset
160 {
kono
parents: 67
diff changeset
161 /* The data fields below are valid only if known is true. */
kono
parents: 67
diff changeset
162 bool known;
kono
parents: 67
diff changeset
163 enum value_range_type type;
kono
parents: 67
diff changeset
164 wide_int min;
kono
parents: 67
diff changeset
165 wide_int max;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 /* 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
169 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
170 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
171 struct GTY (()) ipa_jump_func
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 {
111
kono
parents: 67
diff changeset
173 /* Aggregate contants description. See struct ipa_agg_jump_function and its
kono
parents: 67
diff changeset
174 description. */
kono
parents: 67
diff changeset
175 struct ipa_agg_jump_function agg;
kono
parents: 67
diff changeset
176
kono
parents: 67
diff changeset
177 /* Information about zero/non-zero bits. The pointed to structure is shared
kono
parents: 67
diff changeset
178 betweed different jump functions. Use ipa_set_jfunc_bits to set this
kono
parents: 67
diff changeset
179 field. */
kono
parents: 67
diff changeset
180 struct ipa_bits *bits;
kono
parents: 67
diff changeset
181
kono
parents: 67
diff changeset
182 /* Information about value range, containing valid data only when vr_known is
kono
parents: 67
diff changeset
183 true. The pointed to structure is shared betweed different jump
kono
parents: 67
diff changeset
184 functions. Use ipa_set_jfunc_vr to set this field. */
kono
parents: 67
diff changeset
185 struct value_range *m_vr;
kono
parents: 67
diff changeset
186
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 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
188 /* 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
189 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
190 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
191 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
192 {
111
kono
parents: 67
diff changeset
193 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
194 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
195 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
196 } GTY ((desc ("%1.type"))) value;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198
111
kono
parents: 67
diff changeset
199
kono
parents: 67
diff changeset
200 /* Return the constant stored in a constant jump functin JFUNC. */
kono
parents: 67
diff changeset
201
kono
parents: 67
diff changeset
202 static inline tree
kono
parents: 67
diff changeset
203 ipa_get_jf_constant (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
204 {
kono
parents: 67
diff changeset
205 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
kono
parents: 67
diff changeset
206 return jfunc->value.constant.value;
kono
parents: 67
diff changeset
207 }
kono
parents: 67
diff changeset
208
kono
parents: 67
diff changeset
209 static inline struct ipa_cst_ref_desc *
kono
parents: 67
diff changeset
210 ipa_get_jf_constant_rdesc (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
211 {
kono
parents: 67
diff changeset
212 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
kono
parents: 67
diff changeset
213 return jfunc->value.constant.rdesc;
kono
parents: 67
diff changeset
214 }
kono
parents: 67
diff changeset
215
kono
parents: 67
diff changeset
216 /* Return the operand of a pass through jmp function JFUNC. */
kono
parents: 67
diff changeset
217
kono
parents: 67
diff changeset
218 static inline tree
kono
parents: 67
diff changeset
219 ipa_get_jf_pass_through_operand (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
220 {
kono
parents: 67
diff changeset
221 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
kono
parents: 67
diff changeset
222 return jfunc->value.pass_through.operand;
kono
parents: 67
diff changeset
223 }
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
224
111
kono
parents: 67
diff changeset
225 /* Return the number of the caller's formal parameter that a pass through jump
kono
parents: 67
diff changeset
226 function JFUNC refers to. */
kono
parents: 67
diff changeset
227
kono
parents: 67
diff changeset
228 static inline int
kono
parents: 67
diff changeset
229 ipa_get_jf_pass_through_formal_id (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
230 {
kono
parents: 67
diff changeset
231 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
kono
parents: 67
diff changeset
232 return jfunc->value.pass_through.formal_id;
kono
parents: 67
diff changeset
233 }
kono
parents: 67
diff changeset
234
kono
parents: 67
diff changeset
235 /* Return operation of a pass through jump function JFUNC. */
kono
parents: 67
diff changeset
236
kono
parents: 67
diff changeset
237 static inline enum tree_code
kono
parents: 67
diff changeset
238 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
239 {
111
kono
parents: 67
diff changeset
240 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
kono
parents: 67
diff changeset
241 return jfunc->value.pass_through.operation;
kono
parents: 67
diff changeset
242 }
kono
parents: 67
diff changeset
243
kono
parents: 67
diff changeset
244 /* Return the agg_preserved flag of a pass through jump function JFUNC. */
kono
parents: 67
diff changeset
245
kono
parents: 67
diff changeset
246 static inline bool
kono
parents: 67
diff changeset
247 ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
248 {
kono
parents: 67
diff changeset
249 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
kono
parents: 67
diff changeset
250 return jfunc->value.pass_through.agg_preserved;
kono
parents: 67
diff changeset
251 }
kono
parents: 67
diff changeset
252
kono
parents: 67
diff changeset
253 /* Return true if pass through jump function JFUNC preserves type
kono
parents: 67
diff changeset
254 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
255
111
kono
parents: 67
diff changeset
256 static inline bool
kono
parents: 67
diff changeset
257 ipa_get_jf_pass_through_type_preserved (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
258 {
kono
parents: 67
diff changeset
259 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
kono
parents: 67
diff changeset
260 return jfunc->value.pass_through.agg_preserved;
kono
parents: 67
diff changeset
261 }
kono
parents: 67
diff changeset
262
kono
parents: 67
diff changeset
263 /* Return the offset of an ancestor jump function JFUNC. */
kono
parents: 67
diff changeset
264
kono
parents: 67
diff changeset
265 static inline HOST_WIDE_INT
kono
parents: 67
diff changeset
266 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
267 {
111
kono
parents: 67
diff changeset
268 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
kono
parents: 67
diff changeset
269 return jfunc->value.ancestor.offset;
kono
parents: 67
diff changeset
270 }
kono
parents: 67
diff changeset
271
kono
parents: 67
diff changeset
272 /* Return the number of the caller's formal parameter that an ancestor jump
kono
parents: 67
diff changeset
273 function JFUNC refers to. */
kono
parents: 67
diff changeset
274
kono
parents: 67
diff changeset
275 static inline int
kono
parents: 67
diff changeset
276 ipa_get_jf_ancestor_formal_id (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
277 {
kono
parents: 67
diff changeset
278 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
kono
parents: 67
diff changeset
279 return jfunc->value.ancestor.formal_id;
kono
parents: 67
diff changeset
280 }
kono
parents: 67
diff changeset
281
kono
parents: 67
diff changeset
282 /* 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
283
111
kono
parents: 67
diff changeset
284 static inline bool
kono
parents: 67
diff changeset
285 ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc)
kono
parents: 67
diff changeset
286 {
kono
parents: 67
diff changeset
287 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
kono
parents: 67
diff changeset
288 return jfunc->value.ancestor.agg_preserved;
kono
parents: 67
diff changeset
289 }
kono
parents: 67
diff changeset
290
kono
parents: 67
diff changeset
291 /* Return true if ancestor jump function JFUNC presrves type information. */
kono
parents: 67
diff changeset
292
kono
parents: 67
diff changeset
293 static inline bool
kono
parents: 67
diff changeset
294 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
295 {
111
kono
parents: 67
diff changeset
296 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
kono
parents: 67
diff changeset
297 return jfunc->value.ancestor.agg_preserved;
kono
parents: 67
diff changeset
298 }
kono
parents: 67
diff changeset
299
kono
parents: 67
diff changeset
300 /* Summary describing a single formal parameter. */
kono
parents: 67
diff changeset
301
kono
parents: 67
diff changeset
302 struct GTY(()) ipa_param_descriptor
kono
parents: 67
diff changeset
303 {
kono
parents: 67
diff changeset
304 /* In analysis and modification phase, this is the PARAM_DECL of this
kono
parents: 67
diff changeset
305 parameter, in IPA LTO phase, this is the type of the the described
kono
parents: 67
diff changeset
306 parameter or NULL if not known. Do not read this field directly but
kono
parents: 67
diff changeset
307 through ipa_get_param and ipa_get_type as appropriate. */
kono
parents: 67
diff changeset
308 tree decl_or_type;
kono
parents: 67
diff changeset
309 /* If all uses of the parameter are described by ipa-prop structures, this
kono
parents: 67
diff changeset
310 says how many there are. If any use could not be described by means of
kono
parents: 67
diff changeset
311 ipa-prop structures, this is IPA_UNDESCRIBED_USE. */
kono
parents: 67
diff changeset
312 int controlled_uses;
kono
parents: 67
diff changeset
313 unsigned int move_cost : 31;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
314 /* 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
315 unsigned used : 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
317
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 /* 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
319 and some other information for interprocedural passes that operate on
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 parameters (such as ipa-cp). */
111
kono
parents: 67
diff changeset
321
kono
parents: 67
diff changeset
322 struct GTY((for_user)) ipa_node_params
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 {
111
kono
parents: 67
diff changeset
324 /* Default constructor. */
kono
parents: 67
diff changeset
325 ipa_node_params ();
kono
parents: 67
diff changeset
326
kono
parents: 67
diff changeset
327 /* Default destructor. */
kono
parents: 67
diff changeset
328 ~ipa_node_params ();
kono
parents: 67
diff changeset
329
kono
parents: 67
diff changeset
330 /* Information about individual formal parameters that are gathered when
kono
parents: 67
diff changeset
331 summaries are generated. */
kono
parents: 67
diff changeset
332 vec<ipa_param_descriptor, va_gc> *descriptors;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 /* Pointer to an array of structures describing individual formal
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 parameters. */
111
kono
parents: 67
diff changeset
335 struct ipcp_param_lattices * GTY((skip)) lattices;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 /* Only for versioned nodes this field would not be NULL,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 it points to the node that IPA cp cloned from. */
111
kono
parents: 67
diff changeset
338 struct cgraph_node * GTY((skip)) ipcp_orig_node;
kono
parents: 67
diff changeset
339 /* If this node is an ipa-cp clone, these are the known constants that
kono
parents: 67
diff changeset
340 describe what it has been specialized for. */
kono
parents: 67
diff changeset
341 vec<tree> GTY((skip)) known_csts;
kono
parents: 67
diff changeset
342 /* If this node is an ipa-cp clone, these are the known polymorphic contexts
kono
parents: 67
diff changeset
343 that describe what it has been specialized for. */
kono
parents: 67
diff changeset
344 vec<ipa_polymorphic_call_context> GTY((skip)) known_contexts;
kono
parents: 67
diff changeset
345 /* Whether the param uses analysis and jump function computation has already
kono
parents: 67
diff changeset
346 been performed. */
kono
parents: 67
diff changeset
347 unsigned analysis_done : 1;
kono
parents: 67
diff changeset
348 /* Whether the function is enqueued in ipa-cp propagation stack. */
kono
parents: 67
diff changeset
349 unsigned node_enqueued : 1;
kono
parents: 67
diff changeset
350 /* Whether we should create a specialized version based on values that are
kono
parents: 67
diff changeset
351 known to be constant in all contexts. */
kono
parents: 67
diff changeset
352 unsigned do_clone_for_all_contexts : 1;
kono
parents: 67
diff changeset
353 /* Set if this is an IPA-CP clone for all contexts. */
kono
parents: 67
diff changeset
354 unsigned is_all_contexts_clone : 1;
kono
parents: 67
diff changeset
355 /* Node has been completely replaced by clones and will be removed after
kono
parents: 67
diff changeset
356 ipa-cp is finished. */
kono
parents: 67
diff changeset
357 unsigned node_dead : 1;
kono
parents: 67
diff changeset
358 /* Node is involved in a recursion, potentionally indirect. */
kono
parents: 67
diff changeset
359 unsigned node_within_scc : 1;
kono
parents: 67
diff changeset
360 /* Node is calling a private function called only once. */
kono
parents: 67
diff changeset
361 unsigned node_calling_single_call : 1;
kono
parents: 67
diff changeset
362 /* False when there is something makes versioning impossible. */
kono
parents: 67
diff changeset
363 unsigned versionable : 1;
kono
parents: 67
diff changeset
364 };
kono
parents: 67
diff changeset
365
kono
parents: 67
diff changeset
366 inline
kono
parents: 67
diff changeset
367 ipa_node_params::ipa_node_params ()
kono
parents: 67
diff changeset
368 : descriptors (NULL), lattices (NULL), ipcp_orig_node (NULL),
kono
parents: 67
diff changeset
369 known_csts (vNULL), known_contexts (vNULL), analysis_done (0),
kono
parents: 67
diff changeset
370 node_enqueued (0), do_clone_for_all_contexts (0), is_all_contexts_clone (0),
kono
parents: 67
diff changeset
371 node_dead (0), node_within_scc (0), node_calling_single_call (0),
kono
parents: 67
diff changeset
372 versionable (0)
kono
parents: 67
diff changeset
373 {
kono
parents: 67
diff changeset
374 }
kono
parents: 67
diff changeset
375
kono
parents: 67
diff changeset
376 inline
kono
parents: 67
diff changeset
377 ipa_node_params::~ipa_node_params ()
kono
parents: 67
diff changeset
378 {
kono
parents: 67
diff changeset
379 free (lattices);
kono
parents: 67
diff changeset
380 known_csts.release ();
kono
parents: 67
diff changeset
381 known_contexts.release ();
kono
parents: 67
diff changeset
382 }
kono
parents: 67
diff changeset
383
kono
parents: 67
diff changeset
384 /* Intermediate information that we get from alias analysis about a particular
kono
parents: 67
diff changeset
385 parameter in a particular basic_block. When a parameter or the memory it
kono
parents: 67
diff changeset
386 references is marked modified, we use that information in all dominated
kono
parents: 67
diff changeset
387 blocks without consulting alias analysis oracle. */
kono
parents: 67
diff changeset
388
kono
parents: 67
diff changeset
389 struct ipa_param_aa_status
kono
parents: 67
diff changeset
390 {
kono
parents: 67
diff changeset
391 /* Set when this structure contains meaningful information. If not, the
kono
parents: 67
diff changeset
392 structure describing a dominating BB should be used instead. */
kono
parents: 67
diff changeset
393 bool valid;
kono
parents: 67
diff changeset
394
kono
parents: 67
diff changeset
395 /* Whether we have seen something which might have modified the data in
kono
parents: 67
diff changeset
396 question. PARM is for the parameter itself, REF is for data it points to
kono
parents: 67
diff changeset
397 but using the alias type of individual accesses and PT is the same thing
kono
parents: 67
diff changeset
398 but for computing aggregate pass-through functions using a very inclusive
kono
parents: 67
diff changeset
399 ao_ref. */
kono
parents: 67
diff changeset
400 bool parm_modified, ref_modified, pt_modified;
kono
parents: 67
diff changeset
401 };
kono
parents: 67
diff changeset
402
kono
parents: 67
diff changeset
403 /* Information related to a given BB that used only when looking at function
kono
parents: 67
diff changeset
404 body. */
kono
parents: 67
diff changeset
405
kono
parents: 67
diff changeset
406 struct ipa_bb_info
kono
parents: 67
diff changeset
407 {
kono
parents: 67
diff changeset
408 /* Call graph edges going out of this BB. */
kono
parents: 67
diff changeset
409 vec<cgraph_edge *> cg_edges;
kono
parents: 67
diff changeset
410 /* Alias analysis statuses of each formal parameter at this bb. */
kono
parents: 67
diff changeset
411 vec<ipa_param_aa_status> param_aa_statuses;
kono
parents: 67
diff changeset
412 };
kono
parents: 67
diff changeset
413
kono
parents: 67
diff changeset
414 /* Structure with global information that is only used when looking at function
kono
parents: 67
diff changeset
415 body. */
kono
parents: 67
diff changeset
416
kono
parents: 67
diff changeset
417 struct ipa_func_body_info
kono
parents: 67
diff changeset
418 {
kono
parents: 67
diff changeset
419 /* The node that is being analyzed. */
kono
parents: 67
diff changeset
420 cgraph_node *node;
kono
parents: 67
diff changeset
421
kono
parents: 67
diff changeset
422 /* Its info. */
kono
parents: 67
diff changeset
423 struct ipa_node_params *info;
kono
parents: 67
diff changeset
424
kono
parents: 67
diff changeset
425 /* Information about individual BBs. */
kono
parents: 67
diff changeset
426 vec<ipa_bb_info> bb_infos;
kono
parents: 67
diff changeset
427
kono
parents: 67
diff changeset
428 /* Number of parameters. */
kono
parents: 67
diff changeset
429 int param_count;
kono
parents: 67
diff changeset
430
kono
parents: 67
diff changeset
431 /* Number of statements already walked by when analyzing this function. */
kono
parents: 67
diff changeset
432 unsigned int aa_walked;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
433 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 /* 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
436 are or will be shared among various passes. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
437
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
438 /* Return the number of formal parameters. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 static inline int
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441 ipa_get_param_count (struct ipa_node_params *info)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 {
111
kono
parents: 67
diff changeset
443 return vec_safe_length (info->descriptors);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
446 /* 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
447 to INFO. Note there is no setter function as this array is built just once
111
kono
parents: 67
diff changeset
448 using ipa_initialize_node_params. This function should not be called in
kono
parents: 67
diff changeset
449 WPA. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 static inline tree
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452 ipa_get_param (struct ipa_node_params *info, int i)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 {
111
kono
parents: 67
diff changeset
454 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
455 gcc_checking_assert (!flag_wpa);
kono
parents: 67
diff changeset
456 tree t = (*info->descriptors)[i].decl_or_type;
kono
parents: 67
diff changeset
457 gcc_checking_assert (TREE_CODE (t) == PARM_DECL);
kono
parents: 67
diff changeset
458 return t;
kono
parents: 67
diff changeset
459 }
kono
parents: 67
diff changeset
460
kono
parents: 67
diff changeset
461 /* Return the type of Ith formal parameter of the function corresponding
kono
parents: 67
diff changeset
462 to INFO if it is known or NULL if not. */
kono
parents: 67
diff changeset
463
kono
parents: 67
diff changeset
464 static inline tree
kono
parents: 67
diff changeset
465 ipa_get_type (struct ipa_node_params *info, int i)
kono
parents: 67
diff changeset
466 {
kono
parents: 67
diff changeset
467 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
468 tree t = (*info->descriptors)[i].decl_or_type;
kono
parents: 67
diff changeset
469 if (!t)
kono
parents: 67
diff changeset
470 return NULL;
kono
parents: 67
diff changeset
471 if (TYPE_P (t))
kono
parents: 67
diff changeset
472 return t;
kono
parents: 67
diff changeset
473 gcc_checking_assert (TREE_CODE (t) == PARM_DECL);
kono
parents: 67
diff changeset
474 return TREE_TYPE (t);
kono
parents: 67
diff changeset
475 }
kono
parents: 67
diff changeset
476
kono
parents: 67
diff changeset
477 /* Return the move cost of Ith formal parameter of the function corresponding
kono
parents: 67
diff changeset
478 to INFO. */
kono
parents: 67
diff changeset
479
kono
parents: 67
diff changeset
480 static inline int
kono
parents: 67
diff changeset
481 ipa_get_param_move_cost (struct ipa_node_params *info, int i)
kono
parents: 67
diff changeset
482 {
kono
parents: 67
diff changeset
483 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
484 return (*info->descriptors)[i].move_cost;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486
111
kono
parents: 67
diff changeset
487 /* Set the used flag corresponding to the Ith formal parameter of the function
kono
parents: 67
diff changeset
488 associated with INFO to VAL. */
kono
parents: 67
diff changeset
489
kono
parents: 67
diff changeset
490 static inline void
kono
parents: 67
diff changeset
491 ipa_set_param_used (struct ipa_node_params *info, int i, bool val)
kono
parents: 67
diff changeset
492 {
kono
parents: 67
diff changeset
493 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
494 (*info->descriptors)[i].used = val;
kono
parents: 67
diff changeset
495 }
kono
parents: 67
diff changeset
496
kono
parents: 67
diff changeset
497 /* Return how many uses described by ipa-prop a parameter has or
kono
parents: 67
diff changeset
498 IPA_UNDESCRIBED_USE if there is a use that is not described by these
kono
parents: 67
diff changeset
499 structures. */
kono
parents: 67
diff changeset
500 static inline int
kono
parents: 67
diff changeset
501 ipa_get_controlled_uses (struct ipa_node_params *info, int i)
kono
parents: 67
diff changeset
502 {
kono
parents: 67
diff changeset
503 /* FIXME: introducing speculation causes out of bounds access here. */
kono
parents: 67
diff changeset
504 if (vec_safe_length (info->descriptors) > (unsigned)i)
kono
parents: 67
diff changeset
505 return (*info->descriptors)[i].controlled_uses;
kono
parents: 67
diff changeset
506 return IPA_UNDESCRIBED_USE;
kono
parents: 67
diff changeset
507 }
kono
parents: 67
diff changeset
508
kono
parents: 67
diff changeset
509 /* Set the controlled counter of a given parameter. */
kono
parents: 67
diff changeset
510
kono
parents: 67
diff changeset
511 static inline void
kono
parents: 67
diff changeset
512 ipa_set_controlled_uses (struct ipa_node_params *info, int i, int val)
kono
parents: 67
diff changeset
513 {
kono
parents: 67
diff changeset
514 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
515 (*info->descriptors)[i].controlled_uses = val;
kono
parents: 67
diff changeset
516 }
kono
parents: 67
diff changeset
517
kono
parents: 67
diff changeset
518 /* Return the used flag corresponding to the Ith formal parameter of the
kono
parents: 67
diff changeset
519 function associated with INFO. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
520
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
521 static inline bool
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
522 ipa_is_param_used (struct ipa_node_params *info, int i)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
523 {
111
kono
parents: 67
diff changeset
524 gcc_checking_assert (info->descriptors);
kono
parents: 67
diff changeset
525 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
526 }
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
527
111
kono
parents: 67
diff changeset
528 /* Information about replacements done in aggregates for a given node (each
kono
parents: 67
diff changeset
529 node has its linked list). */
kono
parents: 67
diff changeset
530 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
531 {
111
kono
parents: 67
diff changeset
532 /* Next item in the linked list. */
kono
parents: 67
diff changeset
533 struct ipa_agg_replacement_value *next;
kono
parents: 67
diff changeset
534 /* Offset within the aggregate. */
kono
parents: 67
diff changeset
535 HOST_WIDE_INT offset;
kono
parents: 67
diff changeset
536 /* The constant value. */
kono
parents: 67
diff changeset
537 tree value;
kono
parents: 67
diff changeset
538 /* The paramter index. */
kono
parents: 67
diff changeset
539 int index;
kono
parents: 67
diff changeset
540 /* Whether the value was passed by reference. */
kono
parents: 67
diff changeset
541 bool by_ref;
kono
parents: 67
diff changeset
542 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
543
111
kono
parents: 67
diff changeset
544 /* 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
545
111
kono
parents: 67
diff changeset
546 struct GTY(()) ipcp_transformation_summary
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 {
111
kono
parents: 67
diff changeset
548 /* Linked list of known aggregate values. */
kono
parents: 67
diff changeset
549 ipa_agg_replacement_value *agg_values;
kono
parents: 67
diff changeset
550 /* Known bits information. */
kono
parents: 67
diff changeset
551 vec<ipa_bits *, va_gc> *bits;
kono
parents: 67
diff changeset
552 /* Value range information. */
kono
parents: 67
diff changeset
553 vec<ipa_vr, va_gc> *m_vr;
kono
parents: 67
diff changeset
554 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555
111
kono
parents: 67
diff changeset
556 void ipa_set_node_agg_value_chain (struct cgraph_node *node,
kono
parents: 67
diff changeset
557 struct ipa_agg_replacement_value *aggvals);
kono
parents: 67
diff changeset
558 void ipcp_grow_transformations_if_necessary (void);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
559
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
560 /* 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
561 arguments. It can be accessed by the IPA_EDGE_REF macro. */
111
kono
parents: 67
diff changeset
562
kono
parents: 67
diff changeset
563 class GTY((for_user)) ipa_edge_args
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
564 {
111
kono
parents: 67
diff changeset
565 public:
kono
parents: 67
diff changeset
566
kono
parents: 67
diff changeset
567 /* Default constructor. */
kono
parents: 67
diff changeset
568 ipa_edge_args () : jump_functions (NULL), polymorphic_call_contexts (NULL)
kono
parents: 67
diff changeset
569 {}
kono
parents: 67
diff changeset
570
kono
parents: 67
diff changeset
571 /* Destructor. */
kono
parents: 67
diff changeset
572 ~ipa_edge_args ()
kono
parents: 67
diff changeset
573 {
kono
parents: 67
diff changeset
574 vec_free (jump_functions);
kono
parents: 67
diff changeset
575 vec_free (polymorphic_call_contexts);
kono
parents: 67
diff changeset
576 }
kono
parents: 67
diff changeset
577
kono
parents: 67
diff changeset
578 /* Vectors of the callsite's jump function and polymorphic context
kono
parents: 67
diff changeset
579 information of each parameter. */
kono
parents: 67
diff changeset
580 vec<ipa_jump_func, va_gc> *jump_functions;
kono
parents: 67
diff changeset
581 vec<ipa_polymorphic_call_context, va_gc> *polymorphic_call_contexts;
kono
parents: 67
diff changeset
582 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
583
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
584 /* 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
585 are or will be shared among various passes. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
586
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
587 /* Return the number of actual arguments. */
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 static inline int
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
590 ipa_get_cs_argument_count (struct ipa_edge_args *args)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
591 {
111
kono
parents: 67
diff changeset
592 return vec_safe_length (args->jump_functions);
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
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
595 /* 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
596 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
597 ipa_compute_jump_functions. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
598
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
599 static inline struct ipa_jump_func *
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
600 ipa_get_ith_jump_func (struct ipa_edge_args *args, int i)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
601 {
111
kono
parents: 67
diff changeset
602 return &(*args->jump_functions)[i];
kono
parents: 67
diff changeset
603 }
kono
parents: 67
diff changeset
604
kono
parents: 67
diff changeset
605 /* Returns a pointer to the polymorphic call context for the ith argument.
kono
parents: 67
diff changeset
606 NULL if contexts are not computed. */
kono
parents: 67
diff changeset
607 static inline struct ipa_polymorphic_call_context *
kono
parents: 67
diff changeset
608 ipa_get_ith_polymorhic_call_context (struct ipa_edge_args *args, int i)
kono
parents: 67
diff changeset
609 {
kono
parents: 67
diff changeset
610 if (!args->polymorphic_call_contexts)
kono
parents: 67
diff changeset
611 return NULL;
kono
parents: 67
diff changeset
612 return &(*args->polymorphic_call_contexts)[i];
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
613 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
614
111
kono
parents: 67
diff changeset
615 /* Function summary for ipa_node_params. */
kono
parents: 67
diff changeset
616 class GTY((user)) ipa_node_params_t: public function_summary <ipa_node_params *>
kono
parents: 67
diff changeset
617 {
kono
parents: 67
diff changeset
618 public:
kono
parents: 67
diff changeset
619 ipa_node_params_t (symbol_table *table, bool ggc):
kono
parents: 67
diff changeset
620 function_summary<ipa_node_params *> (table, ggc) { }
kono
parents: 67
diff changeset
621
kono
parents: 67
diff changeset
622 /* Hook that is called by summary when a node is duplicated. */
kono
parents: 67
diff changeset
623 virtual void duplicate (cgraph_node *node,
kono
parents: 67
diff changeset
624 cgraph_node *node2,
kono
parents: 67
diff changeset
625 ipa_node_params *data,
kono
parents: 67
diff changeset
626 ipa_node_params *data2);
kono
parents: 67
diff changeset
627 };
kono
parents: 67
diff changeset
628
kono
parents: 67
diff changeset
629 /* Summary to manange ipa_edge_args structures. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
630
111
kono
parents: 67
diff changeset
631 class GTY((user)) ipa_edge_args_sum_t : public call_summary <ipa_edge_args *>
kono
parents: 67
diff changeset
632 {
kono
parents: 67
diff changeset
633 public:
kono
parents: 67
diff changeset
634 ipa_edge_args_sum_t (symbol_table *table, bool ggc)
kono
parents: 67
diff changeset
635 : call_summary<ipa_edge_args *> (table, ggc) { }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
636
111
kono
parents: 67
diff changeset
637 /* Hook that is called by summary when an edge is duplicated. */
kono
parents: 67
diff changeset
638 virtual void remove (cgraph_edge *cs, ipa_edge_args *args);
kono
parents: 67
diff changeset
639 /* Hook that is called by summary when an edge is duplicated. */
kono
parents: 67
diff changeset
640 virtual void duplicate (cgraph_edge *src,
kono
parents: 67
diff changeset
641 cgraph_edge *dst,
kono
parents: 67
diff changeset
642 ipa_edge_args *old_args,
kono
parents: 67
diff changeset
643 ipa_edge_args *new_args);
kono
parents: 67
diff changeset
644 };
kono
parents: 67
diff changeset
645
kono
parents: 67
diff changeset
646 /* Function summary where the parameter infos are actually stored. */
kono
parents: 67
diff changeset
647 extern GTY(()) ipa_node_params_t * ipa_node_params_sum;
kono
parents: 67
diff changeset
648 /* Call summary to store information about edges such as jump functions. */
kono
parents: 67
diff changeset
649 extern GTY(()) ipa_edge_args_sum_t *ipa_edge_args_sum;
kono
parents: 67
diff changeset
650
kono
parents: 67
diff changeset
651 /* Vector of IPA-CP transformation data for each clone. */
kono
parents: 67
diff changeset
652 extern GTY(()) vec<ipcp_transformation_summary, va_gc> *ipcp_transformations;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
653
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
654 /* Return the associated parameter/argument info corresponding to the given
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
655 node/edge. */
111
kono
parents: 67
diff changeset
656 #define IPA_NODE_REF(NODE) (ipa_node_params_sum->get (NODE))
kono
parents: 67
diff changeset
657 #define IPA_EDGE_REF(EDGE) (ipa_edge_args_sum->get (EDGE))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 /* This macro checks validity of index returned by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
659 ipa_get_param_decl_index function. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 #define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
661
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
662 /* Creating and freeing ipa_node_params and ipa_edge_args. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
663 void ipa_create_all_node_params (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
664 void ipa_create_all_edge_args (void);
111
kono
parents: 67
diff changeset
665 void ipa_check_create_edge_args (void);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
666 void ipa_free_edge_args_substructures (struct ipa_edge_args *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
667 void ipa_free_all_node_params (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
668 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
669 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
670 void ipa_free_all_structures_after_iinln (void);
111
kono
parents: 67
diff changeset
671
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
672 void ipa_register_cgraph_hooks (void);
111
kono
parents: 67
diff changeset
673 int count_formal_params (tree fndecl);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
674
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
675 /* 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
676 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
677
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
678 static inline void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
679 ipa_check_create_node_params (void)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
680 {
111
kono
parents: 67
diff changeset
681 if (!ipa_node_params_sum)
kono
parents: 67
diff changeset
682 ipa_node_params_sum
kono
parents: 67
diff changeset
683 = (new (ggc_cleared_alloc <ipa_node_params_t> ())
kono
parents: 67
diff changeset
684 ipa_node_params_t (symtab, true));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
685 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
686
111
kono
parents: 67
diff changeset
687 /* Returns true if edge summary contains a record for EDGE. The main purpose
kono
parents: 67
diff changeset
688 of this function is that debug dumping function can check info availability
kono
parents: 67
diff changeset
689 without causing allocations. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
690
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
691 static inline bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
692 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
693 {
111
kono
parents: 67
diff changeset
694 return ipa_edge_args_sum->exists (edge);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
695 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
696
111
kono
parents: 67
diff changeset
697 static inline ipcp_transformation_summary *
kono
parents: 67
diff changeset
698 ipcp_get_transformation_summary (cgraph_node *node)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
699 {
111
kono
parents: 67
diff changeset
700 if ((unsigned) node->uid >= vec_safe_length (ipcp_transformations))
kono
parents: 67
diff changeset
701 return NULL;
kono
parents: 67
diff changeset
702 return &(*ipcp_transformations)[node->uid];
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
703 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
704
111
kono
parents: 67
diff changeset
705 /* Return the aggregate replacements for NODE, if there are any. */
kono
parents: 67
diff changeset
706
kono
parents: 67
diff changeset
707 static inline struct ipa_agg_replacement_value *
kono
parents: 67
diff changeset
708 ipa_get_agg_replacements_for_node (cgraph_node *node)
kono
parents: 67
diff changeset
709 {
kono
parents: 67
diff changeset
710 ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node);
kono
parents: 67
diff changeset
711 return ts ? ts->agg_values : NULL;
kono
parents: 67
diff changeset
712 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
713
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
714 /* Function formal parameters related computations. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
715 void ipa_initialize_node_params (struct cgraph_node *node);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
716 bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
111
kono
parents: 67
diff changeset
717 vec<cgraph_edge *> *new_edges);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
718
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
719 /* Indirect edge and binfo processing. */
111
kono
parents: 67
diff changeset
720 tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
kono
parents: 67
diff changeset
721 vec<tree> ,
kono
parents: 67
diff changeset
722 vec<ipa_polymorphic_call_context>,
kono
parents: 67
diff changeset
723 vec<ipa_agg_jump_function_p>,
kono
parents: 67
diff changeset
724 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
725 struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree,
111
kono
parents: 67
diff changeset
726 bool speculative = false);
kono
parents: 67
diff changeset
727 tree ipa_impossible_devirt_target (struct cgraph_edge *, tree);
kono
parents: 67
diff changeset
728 ipa_bits *ipa_get_ipa_bits_for_value (const widest_int &value,
kono
parents: 67
diff changeset
729 const widest_int &mask);
kono
parents: 67
diff changeset
730
kono
parents: 67
diff changeset
731
kono
parents: 67
diff changeset
732 /* Functions related to both. */
kono
parents: 67
diff changeset
733 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
734
111
kono
parents: 67
diff changeset
735 /* Aggregate jump function related functions. */
kono
parents: 67
diff changeset
736 tree ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *agg, tree scalar,
kono
parents: 67
diff changeset
737 HOST_WIDE_INT offset, bool by_ref,
kono
parents: 67
diff changeset
738 bool *from_global_constant = NULL);
kono
parents: 67
diff changeset
739 bool ipa_load_from_parm_agg (struct ipa_func_body_info *fbi,
kono
parents: 67
diff changeset
740 vec<ipa_param_descriptor, va_gc> *descriptors,
kono
parents: 67
diff changeset
741 gimple *stmt, tree op, int *index_p,
kono
parents: 67
diff changeset
742 HOST_WIDE_INT *offset_p, HOST_WIDE_INT *size_p,
kono
parents: 67
diff changeset
743 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
744
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
745 /* Debugging interface. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
746 void ipa_print_node_params (FILE *, struct cgraph_node *node);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
747 void ipa_print_all_params (FILE *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748 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
749 void ipa_print_all_jump_functions (FILE * f);
111
kono
parents: 67
diff changeset
750 void ipcp_verify_propagated_values (void);
kono
parents: 67
diff changeset
751
kono
parents: 67
diff changeset
752 template <typename value>
kono
parents: 67
diff changeset
753 class ipcp_value;
kono
parents: 67
diff changeset
754
kono
parents: 67
diff changeset
755 extern object_allocator<ipcp_value<tree> > ipcp_cst_values_pool;
kono
parents: 67
diff changeset
756 extern object_allocator<ipcp_value<ipa_polymorphic_call_context> >
kono
parents: 67
diff changeset
757 ipcp_poly_ctx_values_pool;
kono
parents: 67
diff changeset
758
kono
parents: 67
diff changeset
759 template <typename valtype>
kono
parents: 67
diff changeset
760 class ipcp_value_source;
kono
parents: 67
diff changeset
761
kono
parents: 67
diff changeset
762 extern object_allocator<ipcp_value_source<tree> > ipcp_sources_pool;
kono
parents: 67
diff changeset
763
kono
parents: 67
diff changeset
764 class ipcp_agg_lattice;
kono
parents: 67
diff changeset
765
kono
parents: 67
diff changeset
766 extern object_allocator<ipcp_agg_lattice> ipcp_agg_lattice_pool;
kono
parents: 67
diff changeset
767
kono
parents: 67
diff changeset
768 /* Operation to be performed for the parameter in ipa_parm_adjustment
kono
parents: 67
diff changeset
769 below. */
kono
parents: 67
diff changeset
770 enum ipa_parm_op {
kono
parents: 67
diff changeset
771 IPA_PARM_OP_NONE,
kono
parents: 67
diff changeset
772
kono
parents: 67
diff changeset
773 /* This describes a brand new parameter.
kono
parents: 67
diff changeset
774
kono
parents: 67
diff changeset
775 The field `type' should be set to the new type, `arg_prefix'
kono
parents: 67
diff changeset
776 should be set to the string prefix for the new DECL_NAME, and
kono
parents: 67
diff changeset
777 `new_decl' will ultimately hold the newly created argument. */
kono
parents: 67
diff changeset
778 IPA_PARM_OP_NEW,
kono
parents: 67
diff changeset
779
kono
parents: 67
diff changeset
780 /* This new parameter is an unmodified parameter at index base_index. */
kono
parents: 67
diff changeset
781 IPA_PARM_OP_COPY,
kono
parents: 67
diff changeset
782
kono
parents: 67
diff changeset
783 /* This adjustment describes a parameter that is about to be removed
kono
parents: 67
diff changeset
784 completely. Most users will probably need to book keep those so that they
kono
parents: 67
diff changeset
785 don't leave behinfd any non default def ssa names belonging to them. */
kono
parents: 67
diff changeset
786 IPA_PARM_OP_REMOVE
kono
parents: 67
diff changeset
787 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
788
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
789 /* Structure to describe transformations of formal parameters and actual
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
790 arguments. Each instance describes one new parameter and they are meant to
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
791 be stored in a vector. Additionally, most users will probably want to store
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
792 adjustments about parameters that are being removed altogether so that SSA
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
793 names belonging to them can be replaced by SSA names of an artificial
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
794 variable. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
795 struct ipa_parm_adjustment
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
796 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
797 /* The original PARM_DECL itself, helpful for processing of the body of the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
798 function itself. Intended for traversing function bodies.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
799 ipa_modify_formal_parameters, ipa_modify_call_arguments and
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
800 ipa_combine_adjustments ignore this and use base_index.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
801 ipa_modify_formal_parameters actually sets this. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
802 tree base;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
803
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
804 /* Type of the new parameter. However, if by_ref is true, the real type will
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
805 be a pointer to this type. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
806 tree type;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
807
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
808 /* Alias refrerence type to be used in MEM_REFs when adjusting caller
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
809 arguments. */
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
810 tree alias_ptr_type;
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
811
111
kono
parents: 67
diff changeset
812 /* The new declaration when creating/replacing a parameter. Created
kono
parents: 67
diff changeset
813 by ipa_modify_formal_parameters, useful for functions modifying
kono
parents: 67
diff changeset
814 the body accordingly. For brand new arguments, this is the newly
kono
parents: 67
diff changeset
815 created argument. */
kono
parents: 67
diff changeset
816 tree new_decl;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
817
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
818 /* New declaration of a substitute variable that we may use to replace all
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
819 non-default-def ssa names when a parm decl is going away. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
820 tree new_ssa_base;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
821
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
822 /* If non-NULL and the original parameter is to be removed (copy_param below
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
823 is NULL), this is going to be its nonlocalized vars value. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
824 tree nonlocal_value;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
825
111
kono
parents: 67
diff changeset
826 /* This holds the prefix to be used for the new DECL_NAME. */
kono
parents: 67
diff changeset
827 const char *arg_prefix;
kono
parents: 67
diff changeset
828
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
829 /* Offset into the original parameter (for the cases when the new parameter
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
830 is a component of an original one). */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
831 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
832
111
kono
parents: 67
diff changeset
833 /* Zero based index of the original parameter this one is based on. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
834 int base_index;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
835
111
kono
parents: 67
diff changeset
836 /* Whether this parameter is a new parameter, a copy of an old one,
kono
parents: 67
diff changeset
837 or one about to be removed. */
kono
parents: 67
diff changeset
838 enum ipa_parm_op op;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
839
111
kono
parents: 67
diff changeset
840 /* Storage order of the original parameter (for the cases when the new
kono
parents: 67
diff changeset
841 parameter is a component of an original one). */
kono
parents: 67
diff changeset
842 unsigned reverse : 1;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
843
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
844 /* The parameter is to be passed by reference. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
845 unsigned by_ref : 1;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
846 };
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
847
111
kono
parents: 67
diff changeset
848 typedef vec<ipa_parm_adjustment> ipa_parm_adjustment_vec;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
849
111
kono
parents: 67
diff changeset
850 vec<tree> ipa_get_vector_of_formal_parms (tree fndecl);
kono
parents: 67
diff changeset
851 vec<tree> ipa_get_vector_of_formal_parm_types (tree fntype);
kono
parents: 67
diff changeset
852 void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec);
kono
parents: 67
diff changeset
853 void ipa_modify_call_arguments (struct cgraph_edge *, gcall *,
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
854 ipa_parm_adjustment_vec);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
855 ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
856 ipa_parm_adjustment_vec);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
857 void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree);
111
kono
parents: 67
diff changeset
858 void ipa_dump_agg_replacement_values (FILE *f,
kono
parents: 67
diff changeset
859 struct ipa_agg_replacement_value *av);
kono
parents: 67
diff changeset
860 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
861 void ipa_prop_read_jump_functions (void);
111
kono
parents: 67
diff changeset
862 void ipcp_write_transformation_summaries (void);
kono
parents: 67
diff changeset
863 void ipcp_read_transformation_summaries (void);
kono
parents: 67
diff changeset
864 int ipa_get_param_decl_index (struct ipa_node_params *, tree);
kono
parents: 67
diff changeset
865 tree ipa_value_from_jfunc (struct ipa_node_params *info,
kono
parents: 67
diff changeset
866 struct ipa_jump_func *jfunc);
kono
parents: 67
diff changeset
867 unsigned int ipcp_transform_function (struct cgraph_node *node);
kono
parents: 67
diff changeset
868 ipa_polymorphic_call_context ipa_context_from_jfunc (ipa_node_params *,
kono
parents: 67
diff changeset
869 cgraph_edge *,
kono
parents: 67
diff changeset
870 int,
kono
parents: 67
diff changeset
871 ipa_jump_func *);
kono
parents: 67
diff changeset
872 void ipa_dump_param (FILE *, struct ipa_node_params *info, int i);
kono
parents: 67
diff changeset
873 bool ipa_modify_expr (tree *, bool, ipa_parm_adjustment_vec);
kono
parents: 67
diff changeset
874 ipa_parm_adjustment *ipa_get_adjustment_candidate (tree **, bool *,
kono
parents: 67
diff changeset
875 ipa_parm_adjustment_vec,
kono
parents: 67
diff changeset
876 bool);
kono
parents: 67
diff changeset
877 void ipa_release_body_info (struct ipa_func_body_info *);
kono
parents: 67
diff changeset
878 tree ipa_get_callee_param_type (struct cgraph_edge *e, int i);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
879
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
880 /* From tree-sra.c: */
111
kono
parents: 67
diff changeset
881 tree build_ref_for_offset (location_t, tree, HOST_WIDE_INT, 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
882 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
883
111
kono
parents: 67
diff changeset
884 /* In ipa-cp.c */
kono
parents: 67
diff changeset
885 void ipa_cp_c_finalize (void);
kono
parents: 67
diff changeset
886
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
887 #endif /* IPA_PROP_H */