annotate gcc/tree-data-ref.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1 /* Data references and dependences detectors.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2003-2020 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 Contributed by Sebastian Pop <pop@cri.ensmp.fr>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 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
8 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
9 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
10 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 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
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 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
15 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 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
18 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #ifndef GCC_TREE_DATA_REF_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #define GCC_TREE_DATA_REF_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #include "graphds.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "tree-chrec.h"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
26 #include "opt-problem.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 /*
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 innermost_loop_behavior describes the evolution of the address of the memory
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 reference in the innermost enclosing loop. The address is expressed as
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 BASE + STEP * # of iteration, and base is further decomposed as the base
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 pointer (BASE_ADDRESS), loop invariant offset (OFFSET) and
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
33 constant offset (INIT). Examples, in loop nest
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
34
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 for (i = 0; i < 100; i++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 for (j = 3; j < 100; j++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 Example 1 Example 2
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 data-ref a[j].b[i][j] *(p + x + 16B + 4B * j)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
40
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 innermost_loop_behavior
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 base_address &a p
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 offset i * D_i x
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 init 3 * D_j + offsetof (b) 28
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 step D_j 4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 struct innermost_loop_behavior
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 tree base_address;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 tree offset;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 tree init;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 tree step;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
111
kono
parents: 67
diff changeset
56 /* BASE_ADDRESS is known to be misaligned by BASE_MISALIGNMENT bytes
kono
parents: 67
diff changeset
57 from an alignment boundary of BASE_ALIGNMENT bytes. For example,
kono
parents: 67
diff changeset
58 if we had:
kono
parents: 67
diff changeset
59
kono
parents: 67
diff changeset
60 struct S __attribute__((aligned(16))) { ... };
kono
parents: 67
diff changeset
61
kono
parents: 67
diff changeset
62 char *ptr;
kono
parents: 67
diff changeset
63 ... *(struct S *) (ptr - 4) ...;
kono
parents: 67
diff changeset
64
kono
parents: 67
diff changeset
65 the information would be:
kono
parents: 67
diff changeset
66
kono
parents: 67
diff changeset
67 base_address: ptr
kono
parents: 67
diff changeset
68 base_aligment: 16
kono
parents: 67
diff changeset
69 base_misalignment: 4
kono
parents: 67
diff changeset
70 init: -4
kono
parents: 67
diff changeset
71
kono
parents: 67
diff changeset
72 where init cancels the base misalignment. If instead we had a
kono
parents: 67
diff changeset
73 reference to a particular field:
kono
parents: 67
diff changeset
74
kono
parents: 67
diff changeset
75 struct S __attribute__((aligned(16))) { ... int f; ... };
kono
parents: 67
diff changeset
76
kono
parents: 67
diff changeset
77 char *ptr;
kono
parents: 67
diff changeset
78 ... ((struct S *) (ptr - 4))->f ...;
kono
parents: 67
diff changeset
79
kono
parents: 67
diff changeset
80 the information would be:
kono
parents: 67
diff changeset
81
kono
parents: 67
diff changeset
82 base_address: ptr
kono
parents: 67
diff changeset
83 base_aligment: 16
kono
parents: 67
diff changeset
84 base_misalignment: 4
kono
parents: 67
diff changeset
85 init: -4 + offsetof (S, f)
kono
parents: 67
diff changeset
86
kono
parents: 67
diff changeset
87 where base_address + init might also be misaligned, and by a different
kono
parents: 67
diff changeset
88 amount from base_address. */
kono
parents: 67
diff changeset
89 unsigned int base_alignment;
kono
parents: 67
diff changeset
90 unsigned int base_misalignment;
kono
parents: 67
diff changeset
91
kono
parents: 67
diff changeset
92 /* The largest power of two that divides OFFSET, capped to a suitably
kono
parents: 67
diff changeset
93 high value if the offset is zero. This is a byte rather than a bit
kono
parents: 67
diff changeset
94 quantity. */
kono
parents: 67
diff changeset
95 unsigned int offset_alignment;
kono
parents: 67
diff changeset
96
kono
parents: 67
diff changeset
97 /* Likewise for STEP. */
kono
parents: 67
diff changeset
98 unsigned int step_alignment;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 /* Describes the evolutions of indices of the memory reference. The indices
111
kono
parents: 67
diff changeset
102 are indices of the ARRAY_REFs, indexes in artificial dimensions
kono
parents: 67
diff changeset
103 added for member selection of records and the operands of MEM_REFs.
kono
parents: 67
diff changeset
104 BASE_OBJECT is the part of the reference that is loop-invariant
kono
parents: 67
diff changeset
105 (note that this reference does not have to cover the whole object
kono
parents: 67
diff changeset
106 being accessed, in which case UNCONSTRAINED_BASE is set; hence it is
kono
parents: 67
diff changeset
107 not recommended to use BASE_OBJECT in any code generation).
kono
parents: 67
diff changeset
108 For the examples above,
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109
111
kono
parents: 67
diff changeset
110 base_object: a *(p + x + 4B * j_0)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 indices: {j_0, +, 1}_2 {16, +, 4}_2
111
kono
parents: 67
diff changeset
112 4
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 {i_0, +, 1}_1
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 {j_0, +, 1}_2
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 struct indices
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 /* The object. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 tree base_object;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
121
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 /* A list of chrecs. Access functions of the indices. */
111
kono
parents: 67
diff changeset
123 vec<tree> access_fns;
kono
parents: 67
diff changeset
124
kono
parents: 67
diff changeset
125 /* Whether BASE_OBJECT is an access representing the whole object
kono
parents: 67
diff changeset
126 or whether the access could not be constrained. */
kono
parents: 67
diff changeset
127 bool unconstrained_base;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 struct dr_alias
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 /* The alias information that should be used for new pointers to this
111
kono
parents: 67
diff changeset
133 location. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 struct ptr_info_def *ptr_info;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136
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
137 /* An integer vector. A vector formally consists of an element of a vector
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
138 space. A vector space is a set that is closed under vector addition
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
139 and scalar multiplication. In this vector space, an element is a list of
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
140 integers. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
141 typedef HOST_WIDE_INT lambda_int;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
142 typedef lambda_int *lambda_vector;
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
143
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
144 /* An integer matrix. A matrix consists of m vectors of length n (IE
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
145 all vectors are the same length). */
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
146 typedef lambda_vector *lambda_matrix;
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
147
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 struct data_reference
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 /* A pointer to the statement that contains this DR. */
111
kono
parents: 67
diff changeset
153 gimple *stmt;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
154
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 /* A pointer to the memory reference. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 tree ref;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 /* Auxiliary info specific to a pass. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 void *aux;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 /* True when the data reference is in RHS of a stmt. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 bool is_read;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163
111
kono
parents: 67
diff changeset
164 /* True when the data reference is conditional within STMT,
kono
parents: 67
diff changeset
165 i.e. if it might not occur even when the statement is executed
kono
parents: 67
diff changeset
166 and runs to completion. */
kono
parents: 67
diff changeset
167 bool is_conditional_in_stmt;
kono
parents: 67
diff changeset
168
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 /* Behavior of the memory reference in the innermost loop. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 struct innermost_loop_behavior innermost;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 /* Subscripts of this data reference. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 struct indices indices;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 /* Alias information for the data reference. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 struct dr_alias alias;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 #define DR_STMT(DR) (DR)->stmt
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 #define DR_REF(DR) (DR)->ref
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 #define DR_BASE_OBJECT(DR) (DR)->indices.base_object
111
kono
parents: 67
diff changeset
182 #define DR_UNCONSTRAINED_BASE(DR) (DR)->indices.unconstrained_base
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 #define DR_ACCESS_FNS(DR) (DR)->indices.access_fns
111
kono
parents: 67
diff changeset
184 #define DR_ACCESS_FN(DR, I) DR_ACCESS_FNS (DR)[I]
kono
parents: 67
diff changeset
185 #define DR_NUM_DIMENSIONS(DR) DR_ACCESS_FNS (DR).length ()
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 #define DR_IS_READ(DR) (DR)->is_read
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
187 #define DR_IS_WRITE(DR) (!DR_IS_READ (DR))
111
kono
parents: 67
diff changeset
188 #define DR_IS_CONDITIONAL_IN_STMT(DR) (DR)->is_conditional_in_stmt
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 #define DR_BASE_ADDRESS(DR) (DR)->innermost.base_address
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 #define DR_OFFSET(DR) (DR)->innermost.offset
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 #define DR_INIT(DR) (DR)->innermost.init
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 #define DR_STEP(DR) (DR)->innermost.step
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 #define DR_PTR_INFO(DR) (DR)->alias.ptr_info
111
kono
parents: 67
diff changeset
194 #define DR_BASE_ALIGNMENT(DR) (DR)->innermost.base_alignment
kono
parents: 67
diff changeset
195 #define DR_BASE_MISALIGNMENT(DR) (DR)->innermost.base_misalignment
kono
parents: 67
diff changeset
196 #define DR_OFFSET_ALIGNMENT(DR) (DR)->innermost.offset_alignment
kono
parents: 67
diff changeset
197 #define DR_STEP_ALIGNMENT(DR) (DR)->innermost.step_alignment
kono
parents: 67
diff changeset
198 #define DR_INNERMOST(DR) (DR)->innermost
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
199
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 typedef struct data_reference *data_reference_p;
111
kono
parents: 67
diff changeset
201
kono
parents: 67
diff changeset
202 /* This struct is used to store the information of a data reference,
kono
parents: 67
diff changeset
203 including the data ref itself and the segment length for aliasing
kono
parents: 67
diff changeset
204 checks. This is used to merge alias checks. */
kono
parents: 67
diff changeset
205
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
206 class dr_with_seg_len
111
kono
parents: 67
diff changeset
207 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
208 public:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
209 dr_with_seg_len (data_reference_p d, tree len, unsigned HOST_WIDE_INT size,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
210 unsigned int a)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
211 : dr (d), seg_len (len), access_size (size), align (a) {}
111
kono
parents: 67
diff changeset
212
kono
parents: 67
diff changeset
213 data_reference_p dr;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
214 /* The offset of the last access that needs to be checked minus
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
215 the offset of the first. */
111
kono
parents: 67
diff changeset
216 tree seg_len;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
217 /* A value that, when added to abs (SEG_LEN), gives the total number of
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
218 bytes in the segment. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
219 poly_uint64 access_size;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
220 /* The minimum common alignment of DR's start address, SEG_LEN and
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
221 ACCESS_SIZE. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
222 unsigned int align;
111
kono
parents: 67
diff changeset
223 };
kono
parents: 67
diff changeset
224
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
225 /* Flags that describe a potential alias between two dr_with_seg_lens.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
226 In general, each pair of dr_with_seg_lens represents a composite of
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
227 multiple access pairs P, so testing flags like DR_IS_READ on the DRs
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
228 does not give meaningful information.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
229
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
230 DR_ALIAS_RAW:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
231 There is a pair in P for which the second reference is a read
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
232 and the first is a write.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
233
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
234 DR_ALIAS_WAR:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
235 There is a pair in P for which the second reference is a write
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
236 and the first is a read.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
237
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
238 DR_ALIAS_WAW:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
239 There is a pair in P for which both references are writes.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
240
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
241 DR_ALIAS_ARBITRARY:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
242 Either
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
243 (a) it isn't possible to classify one pair in P as RAW, WAW or WAR; or
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
244 (b) there is a pair in P that breaks the ordering assumption below.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
245
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
246 This flag overrides the RAW, WAR and WAW flags above.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
247
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
248 DR_ALIAS_UNSWAPPED:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
249 DR_ALIAS_SWAPPED:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
250 Temporary flags that indicate whether there is a pair P whose
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
251 DRs have or haven't been swapped around.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
252
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
253 DR_ALIAS_MIXED_STEPS:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
254 The DR_STEP for one of the data references in the pair does not
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
255 accurately describe that reference for all members of P. (Note
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
256 that the flag does not say anything about whether the DR_STEPs
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
257 of the two references in the pair are the same.)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
258
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
259 The ordering assumption mentioned above is that for every pair
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
260 (DR_A, DR_B) in P:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
261
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
262 (1) The original code accesses n elements for DR_A and n elements for DR_B,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
263 interleaved as follows:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
264
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
265 one access of size DR_A.access_size at DR_A.dr
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
266 one access of size DR_B.access_size at DR_B.dr
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
267 one access of size DR_A.access_size at DR_A.dr + STEP_A
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
268 one access of size DR_B.access_size at DR_B.dr + STEP_B
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
269 one access of size DR_A.access_size at DR_A.dr + STEP_A * 2
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
270 one access of size DR_B.access_size at DR_B.dr + STEP_B * 2
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
271 ...
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
272
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
273 (2) The new code accesses the same data in exactly two chunks:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
274
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
275 one group of accesses spanning |DR_A.seg_len| + DR_A.access_size
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
276 one group of accesses spanning |DR_B.seg_len| + DR_B.access_size
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
277
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
278 A pair might break this assumption if the DR_A and DR_B accesses
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
279 in the original or the new code are mingled in some way. For example,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
280 if DR_A.access_size represents the effect of two individual writes
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
281 to nearby locations, the pair breaks the assumption if those writes
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
282 occur either side of the access for DR_B.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
283
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
284 Note that DR_ALIAS_ARBITRARY describes whether the ordering assumption
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
285 fails to hold for any individual pair in P. If the assumption *does*
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
286 hold for every pair in P, it doesn't matter whether it holds for the
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
287 composite pair or not. In other words, P should represent the complete
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
288 set of pairs that the composite pair is testing, so only the ordering
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
289 of two accesses in the same member of P matters. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
290 const unsigned int DR_ALIAS_RAW = 1U << 0;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
291 const unsigned int DR_ALIAS_WAR = 1U << 1;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
292 const unsigned int DR_ALIAS_WAW = 1U << 2;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
293 const unsigned int DR_ALIAS_ARBITRARY = 1U << 3;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
294 const unsigned int DR_ALIAS_SWAPPED = 1U << 4;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
295 const unsigned int DR_ALIAS_UNSWAPPED = 1U << 5;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
296 const unsigned int DR_ALIAS_MIXED_STEPS = 1U << 6;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
297
111
kono
parents: 67
diff changeset
298 /* This struct contains two dr_with_seg_len objects with aliasing data
kono
parents: 67
diff changeset
299 refs. Two comparisons are generated from them. */
kono
parents: 67
diff changeset
300
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
301 class dr_with_seg_len_pair_t
111
kono
parents: 67
diff changeset
302 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
303 public:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
304 /* WELL_ORDERED indicates that the ordering assumption described above
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
305 DR_ALIAS_ARBITRARY holds. REORDERED indicates that it doesn't. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
306 enum sequencing { WELL_ORDERED, REORDERED };
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
307
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
308 dr_with_seg_len_pair_t (const dr_with_seg_len &,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
309 const dr_with_seg_len &, sequencing);
111
kono
parents: 67
diff changeset
310
kono
parents: 67
diff changeset
311 dr_with_seg_len first;
kono
parents: 67
diff changeset
312 dr_with_seg_len second;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
313 unsigned int flags;
111
kono
parents: 67
diff changeset
314 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
316 inline dr_with_seg_len_pair_t::
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
317 dr_with_seg_len_pair_t (const dr_with_seg_len &d1, const dr_with_seg_len &d2,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
318 sequencing seq)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
319 : first (d1), second (d2), flags (0)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
320 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
321 if (DR_IS_READ (d1.dr) && DR_IS_WRITE (d2.dr))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
322 flags |= DR_ALIAS_WAR;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
323 else if (DR_IS_WRITE (d1.dr) && DR_IS_READ (d2.dr))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
324 flags |= DR_ALIAS_RAW;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
325 else if (DR_IS_WRITE (d1.dr) && DR_IS_WRITE (d2.dr))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
326 flags |= DR_ALIAS_WAW;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
327 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
328 gcc_unreachable ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
329 if (seq == REORDERED)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
330 flags |= DR_ALIAS_ARBITRARY;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
331 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
332
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 enum data_dependence_direction {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
334 dir_positive,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
335 dir_negative,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
336 dir_equal,
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 dir_positive_or_negative,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 dir_positive_or_equal,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 dir_negative_or_equal,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340 dir_star,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 dir_independent
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
343
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 /* The description of the grid of iterations that overlap. At most
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 two loops are considered at the same time just now, hence at most
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
346 two functions are needed. For each of the functions, we store
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 the vector of coefficients, f[0] + x * f[1] + y * f[2] + ...,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 where x, y, ... are variables. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
349
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 #define MAX_DIM 2
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
351
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
352 /* Special values of N. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 #define NO_DEPENDENCE 0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 #define NOT_KNOWN (MAX_DIM + 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
355 #define CF_NONTRIVIAL_P(CF) ((CF)->n != NO_DEPENDENCE && (CF)->n != NOT_KNOWN)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
356 #define CF_NOT_KNOWN_P(CF) ((CF)->n == NOT_KNOWN)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
357 #define CF_NO_DEPENDENCE_P(CF) ((CF)->n == NO_DEPENDENCE)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358
111
kono
parents: 67
diff changeset
359 typedef vec<tree> affine_fn;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360
111
kono
parents: 67
diff changeset
361 struct conflict_function
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 unsigned n;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 affine_fn fns[MAX_DIM];
111
kono
parents: 67
diff changeset
365 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
366
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367 /* What is a subscript? Given two array accesses a subscript is the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 tuple composed of the access functions for a given dimension.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 Example: Given A[f1][f2][f3] and B[g1][g2][g3], there are three
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
370 subscripts: (f1, g1), (f2, g2), (f3, g3). These three subscripts
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
371 are stored in the data_dependence_relation structure under the form
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
372 of an array of subscripts. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 struct subscript
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 {
111
kono
parents: 67
diff changeset
376 /* The access functions of the two references. */
kono
parents: 67
diff changeset
377 tree access_fn[2];
kono
parents: 67
diff changeset
378
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
379 /* A description of the iterations for which the elements are
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 accessed twice. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 conflict_function *conflicting_iterations_in_a;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 conflict_function *conflicting_iterations_in_b;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
383
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
384 /* This field stores the information about the iteration domain
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 validity of the dependence relation. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
386 tree last_conflict;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
387
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
388 /* Distance from the iteration that access a conflicting element in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 A to the iteration that access this same conflicting element in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 B. The distance is a tree scalar expression, i.e. a constant or a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 symbolic expression, but certainly not a chrec function. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 tree distance;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
395 typedef struct subscript *subscript_p;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
396
111
kono
parents: 67
diff changeset
397 #define SUB_ACCESS_FN(SUB, I) (SUB)->access_fn[I]
kono
parents: 67
diff changeset
398 #define SUB_CONFLICTS_IN_A(SUB) (SUB)->conflicting_iterations_in_a
kono
parents: 67
diff changeset
399 #define SUB_CONFLICTS_IN_B(SUB) (SUB)->conflicting_iterations_in_b
kono
parents: 67
diff changeset
400 #define SUB_LAST_CONFLICT(SUB) (SUB)->last_conflict
kono
parents: 67
diff changeset
401 #define SUB_DISTANCE(SUB) (SUB)->distance
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
402
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 /* A data_dependence_relation represents a relation between two
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 data_references A and B. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 struct data_dependence_relation
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
407 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
408
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 struct data_reference *a;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 struct data_reference *b;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 /* A "yes/no/maybe" field for the dependence relation:
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
413
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 - when "ARE_DEPENDENT == NULL_TREE", there exist a dependence
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
415 relation between A and B, and the description of this relation
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
416 is given in the SUBSCRIPTS array,
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
417
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 - when "ARE_DEPENDENT == chrec_known", there is no dependence and
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419 SUBSCRIPTS is empty,
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
420
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 - when "ARE_DEPENDENT == chrec_dont_know", there may be a dependence,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422 but the analyzer cannot be more specific. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 tree are_dependent;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
424
111
kono
parents: 67
diff changeset
425 /* If nonnull, COULD_BE_INDEPENDENT_P is true and the accesses are
kono
parents: 67
diff changeset
426 independent when the runtime addresses of OBJECT_A and OBJECT_B
kono
parents: 67
diff changeset
427 are different. The addresses of both objects are invariant in the
kono
parents: 67
diff changeset
428 loop nest. */
kono
parents: 67
diff changeset
429 tree object_a;
kono
parents: 67
diff changeset
430 tree object_b;
kono
parents: 67
diff changeset
431
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 /* For each subscript in the dependence test, there is an element in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
433 this array. This is the attribute that labels the edge A->B of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 the data_dependence_relation. */
111
kono
parents: 67
diff changeset
435 vec<subscript_p> subscripts;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
436
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
437 /* The analyzed loop nest. */
111
kono
parents: 67
diff changeset
438 vec<loop_p> loop_nest;
0
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 /* The classic direction vector. */
111
kono
parents: 67
diff changeset
441 vec<lambda_vector> dir_vects;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 /* The classic distance vector. */
111
kono
parents: 67
diff changeset
444 vec<lambda_vector> dist_vects;
0
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 /* Is the dependence reversed with respect to the lexicographic order? */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
447 bool reversed_p;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 /* When the dependence relation is affine, it can be represented by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 a distance vector. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 bool affine_p;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 /* Set to true when the dependence relation is on the same data
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 access. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
455 bool self_reference_p;
111
kono
parents: 67
diff changeset
456
kono
parents: 67
diff changeset
457 /* True if the dependence described is conservatively correct rather
kono
parents: 67
diff changeset
458 than exact, and if it is still possible for the accesses to be
kono
parents: 67
diff changeset
459 conditionally independent. For example, the a and b references in:
kono
parents: 67
diff changeset
460
kono
parents: 67
diff changeset
461 struct s *a, *b;
kono
parents: 67
diff changeset
462 for (int i = 0; i < n; ++i)
kono
parents: 67
diff changeset
463 a->f[i] += b->f[i];
kono
parents: 67
diff changeset
464
kono
parents: 67
diff changeset
465 conservatively have a distance vector of (0), for the case in which
kono
parents: 67
diff changeset
466 a == b, but the accesses are independent if a != b. Similarly,
kono
parents: 67
diff changeset
467 the a and b references in:
kono
parents: 67
diff changeset
468
kono
parents: 67
diff changeset
469 struct s *a, *b;
kono
parents: 67
diff changeset
470 for (int i = 0; i < n; ++i)
kono
parents: 67
diff changeset
471 a[0].f[i] += b[i].f[i];
kono
parents: 67
diff changeset
472
kono
parents: 67
diff changeset
473 conservatively have a distance vector of (0), but they are indepenent
kono
parents: 67
diff changeset
474 when a != b + i. In contrast, the references in:
kono
parents: 67
diff changeset
475
kono
parents: 67
diff changeset
476 struct s *a;
kono
parents: 67
diff changeset
477 for (int i = 0; i < n; ++i)
kono
parents: 67
diff changeset
478 a->f[i] += a->f[i];
kono
parents: 67
diff changeset
479
kono
parents: 67
diff changeset
480 have the same distance vector of (0), but the accesses can never be
kono
parents: 67
diff changeset
481 independent. */
kono
parents: 67
diff changeset
482 bool could_be_independent_p;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 typedef struct data_dependence_relation *ddr_p;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486
111
kono
parents: 67
diff changeset
487 #define DDR_A(DDR) (DDR)->a
kono
parents: 67
diff changeset
488 #define DDR_B(DDR) (DDR)->b
kono
parents: 67
diff changeset
489 #define DDR_AFFINE_P(DDR) (DDR)->affine_p
kono
parents: 67
diff changeset
490 #define DDR_ARE_DEPENDENT(DDR) (DDR)->are_dependent
kono
parents: 67
diff changeset
491 #define DDR_OBJECT_A(DDR) (DDR)->object_a
kono
parents: 67
diff changeset
492 #define DDR_OBJECT_B(DDR) (DDR)->object_b
kono
parents: 67
diff changeset
493 #define DDR_SUBSCRIPTS(DDR) (DDR)->subscripts
kono
parents: 67
diff changeset
494 #define DDR_SUBSCRIPT(DDR, I) DDR_SUBSCRIPTS (DDR)[I]
kono
parents: 67
diff changeset
495 #define DDR_NUM_SUBSCRIPTS(DDR) DDR_SUBSCRIPTS (DDR).length ()
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
496
111
kono
parents: 67
diff changeset
497 #define DDR_LOOP_NEST(DDR) (DDR)->loop_nest
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
498 /* The size of the direction/distance vectors: the number of loops in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
499 the loop nest. */
111
kono
parents: 67
diff changeset
500 #define DDR_NB_LOOPS(DDR) (DDR_LOOP_NEST (DDR).length ())
kono
parents: 67
diff changeset
501 #define DDR_SELF_REFERENCE(DDR) (DDR)->self_reference_p
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
502
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
503 #define DDR_DIST_VECTS(DDR) ((DDR)->dist_vects)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504 #define DDR_DIR_VECTS(DDR) ((DDR)->dir_vects)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
505 #define DDR_NUM_DIST_VECTS(DDR) \
111
kono
parents: 67
diff changeset
506 (DDR_DIST_VECTS (DDR).length ())
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
507 #define DDR_NUM_DIR_VECTS(DDR) \
111
kono
parents: 67
diff changeset
508 (DDR_DIR_VECTS (DDR).length ())
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
509 #define DDR_DIR_VECT(DDR, I) \
111
kono
parents: 67
diff changeset
510 DDR_DIR_VECTS (DDR)[I]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511 #define DDR_DIST_VECT(DDR, I) \
111
kono
parents: 67
diff changeset
512 DDR_DIST_VECTS (DDR)[I]
kono
parents: 67
diff changeset
513 #define DDR_REVERSED_P(DDR) (DDR)->reversed_p
kono
parents: 67
diff changeset
514 #define DDR_COULD_BE_INDEPENDENT_P(DDR) (DDR)->could_be_independent_p
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
515
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
516
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
517 opt_result dr_analyze_innermost (innermost_loop_behavior *, tree,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
518 class loop *, const gimple *);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
519 extern bool compute_data_dependences_for_loop (class loop *, bool,
111
kono
parents: 67
diff changeset
520 vec<loop_p> *,
kono
parents: 67
diff changeset
521 vec<data_reference_p> *,
kono
parents: 67
diff changeset
522 vec<ddr_p> *);
kono
parents: 67
diff changeset
523 extern void debug_ddrs (vec<ddr_p> );
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524 extern void dump_data_reference (FILE *, struct data_reference *);
111
kono
parents: 67
diff changeset
525 extern void debug (data_reference &ref);
kono
parents: 67
diff changeset
526 extern void debug (data_reference *ptr);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
527 extern void debug_data_reference (struct data_reference *);
111
kono
parents: 67
diff changeset
528 extern void debug_data_references (vec<data_reference_p> );
kono
parents: 67
diff changeset
529 extern void debug (vec<data_reference_p> &ref);
kono
parents: 67
diff changeset
530 extern void debug (vec<data_reference_p> *ptr);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
531 extern void debug_data_dependence_relation (struct data_dependence_relation *);
111
kono
parents: 67
diff changeset
532 extern void dump_data_dependence_relations (FILE *, vec<ddr_p> );
kono
parents: 67
diff changeset
533 extern void debug (vec<ddr_p> &ref);
kono
parents: 67
diff changeset
534 extern void debug (vec<ddr_p> *ptr);
kono
parents: 67
diff changeset
535 extern void debug_data_dependence_relations (vec<ddr_p> );
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
536 extern void free_dependence_relation (struct data_dependence_relation *);
111
kono
parents: 67
diff changeset
537 extern void free_dependence_relations (vec<ddr_p> );
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
538 extern void free_data_ref (data_reference_p);
111
kono
parents: 67
diff changeset
539 extern void free_data_refs (vec<data_reference_p> );
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
540 extern opt_result find_data_references_in_stmt (class loop *, gimple *,
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
541 vec<data_reference_p> *);
111
kono
parents: 67
diff changeset
542 extern bool graphite_find_data_references_in_stmt (edge, loop_p, gimple *,
kono
parents: 67
diff changeset
543 vec<data_reference_p> *);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
544 tree find_data_references_in_loop (class loop *, vec<data_reference_p> *);
111
kono
parents: 67
diff changeset
545 bool loop_nest_has_data_refs (loop_p loop);
kono
parents: 67
diff changeset
546 struct data_reference *create_data_ref (edge, loop_p, tree, gimple *, bool,
kono
parents: 67
diff changeset
547 bool);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
548 extern bool find_loop_nest (class loop *, vec<loop_p> *);
111
kono
parents: 67
diff changeset
549 extern struct data_dependence_relation *initialize_data_dependence_relation
kono
parents: 67
diff changeset
550 (struct data_reference *, struct data_reference *, vec<loop_p>);
kono
parents: 67
diff changeset
551 extern void compute_affine_dependence (struct data_dependence_relation *,
kono
parents: 67
diff changeset
552 loop_p);
kono
parents: 67
diff changeset
553 extern void compute_self_dependence (struct data_dependence_relation *);
kono
parents: 67
diff changeset
554 extern bool compute_all_dependences (vec<data_reference_p> ,
kono
parents: 67
diff changeset
555 vec<ddr_p> *,
kono
parents: 67
diff changeset
556 vec<loop_p>, bool);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
557 extern tree find_data_references_in_bb (class loop *, basic_block,
111
kono
parents: 67
diff changeset
558 vec<data_reference_p> *);
kono
parents: 67
diff changeset
559 extern unsigned int dr_alignment (innermost_loop_behavior *);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
560 extern tree get_base_for_alignment (tree, unsigned int *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
561
111
kono
parents: 67
diff changeset
562 /* Return the alignment in bytes that DR is guaranteed to have at all
kono
parents: 67
diff changeset
563 times. */
kono
parents: 67
diff changeset
564
kono
parents: 67
diff changeset
565 inline unsigned int
kono
parents: 67
diff changeset
566 dr_alignment (data_reference *dr)
kono
parents: 67
diff changeset
567 {
kono
parents: 67
diff changeset
568 return dr_alignment (&DR_INNERMOST (dr));
kono
parents: 67
diff changeset
569 }
kono
parents: 67
diff changeset
570
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
571 extern bool dr_may_alias_p (const struct data_reference *,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
572 const struct data_reference *, class loop *);
111
kono
parents: 67
diff changeset
573 extern bool dr_equal_offsets_p (struct data_reference *,
kono
parents: 67
diff changeset
574 struct data_reference *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
575
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
576 extern opt_result runtime_alias_check_p (ddr_p, class loop *, bool);
111
kono
parents: 67
diff changeset
577 extern int data_ref_compare_tree (tree, tree);
kono
parents: 67
diff changeset
578 extern void prune_runtime_alias_test_list (vec<dr_with_seg_len_pair_t> *,
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
579 poly_uint64);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
580 extern void create_runtime_alias_checks (class loop *,
111
kono
parents: 67
diff changeset
581 vec<dr_with_seg_len_pair_t> *, tree*);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
582 extern tree dr_direction_indicator (struct data_reference *);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
583 extern tree dr_zero_step_indicator (struct data_reference *);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
584 extern bool dr_known_forward_stride_p (struct data_reference *);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
585
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
586 /* Return true when the base objects of data references A and B are
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
587 the same memory object. */
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
588
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
589 static inline bool
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
590 same_data_refs_base_objects (data_reference_p a, data_reference_p b)
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
591 {
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
592 return DR_NUM_DIMENSIONS (a) == DR_NUM_DIMENSIONS (b)
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
593 && operand_equal_p (DR_BASE_OBJECT (a), DR_BASE_OBJECT (b), 0);
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
594 }
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
595
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
596 /* Return true when the data references A and B are accessing the same
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
597 memory object with the same access functions. */
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
598
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
599 static inline bool
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
600 same_data_refs (data_reference_p a, data_reference_p b)
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
601 {
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
602 unsigned int i;
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
603
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
604 /* The references are exactly the same. */
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
605 if (operand_equal_p (DR_REF (a), DR_REF (b), 0))
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
606 return true;
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
607
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
608 if (!same_data_refs_base_objects (a, b))
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
609 return false;
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
610
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
611 for (i = 0; i < DR_NUM_DIMENSIONS (a); i++)
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
612 if (!eq_evolutions_p (DR_ACCESS_FN (a, i), DR_ACCESS_FN (b, i)))
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
613 return false;
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
614
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
615 return true;
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
616 }
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
617
111
kono
parents: 67
diff changeset
618 /* Returns true when all the dependences are computable. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
619
111
kono
parents: 67
diff changeset
620 inline bool
kono
parents: 67
diff changeset
621 known_dependences_p (vec<ddr_p> dependence_relations)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
622 {
111
kono
parents: 67
diff changeset
623 ddr_p ddr;
kono
parents: 67
diff changeset
624 unsigned int i;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
625
111
kono
parents: 67
diff changeset
626 FOR_EACH_VEC_ELT (dependence_relations, i, ddr)
kono
parents: 67
diff changeset
627 if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
629
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
630 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
631 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
632
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
633 /* Returns the dependence level for a vector DIST of size LENGTH.
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
634 LEVEL = 0 means a lexicographic dependence, i.e. a dependence due
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
635 to the sequence of statements, not carried by any loop. */
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
636
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
637 static inline unsigned
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
638 dependence_level (lambda_vector dist_vect, int length)
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
639 {
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
640 int i;
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
641
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
642 for (i = 0; i < length; i++)
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
643 if (dist_vect[i] != 0)
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
644 return i + 1;
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
645
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
646 return 0;
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
647 }
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
648
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
649 /* Return the dependence level for the DDR relation. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
650
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
651 static inline unsigned
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
652 ddr_dependence_level (ddr_p ddr)
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 unsigned vector;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
655 unsigned level = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
656
111
kono
parents: 67
diff changeset
657 if (DDR_DIST_VECTS (ddr).exists ())
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 level = dependence_level (DDR_DIST_VECT (ddr, 0), DDR_NB_LOOPS (ddr));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
659
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 for (vector = 1; vector < DDR_NUM_DIST_VECTS (ddr); vector++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
661 level = MIN (level, dependence_level (DDR_DIST_VECT (ddr, vector),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
662 DDR_NB_LOOPS (ddr)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
663 return level;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
664 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
665
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
666 /* Return the index of the variable VAR in the LOOP_NEST array. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
667
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
668 static inline int
111
kono
parents: 67
diff changeset
669 index_in_loop_nest (int var, vec<loop_p> loop_nest)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
670 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
671 class loop *loopi;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
672 int var_index;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
673
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
674 for (var_index = 0; loop_nest.iterate (var_index, &loopi); var_index++)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
675 if (loopi->num == var)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
676 return var_index;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
677
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
678 gcc_unreachable ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
679 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
680
111
kono
parents: 67
diff changeset
681 /* Returns true when the data reference DR the form "A[i] = ..."
kono
parents: 67
diff changeset
682 with a stride equal to its unit type size. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
683
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
684 static inline bool
111
kono
parents: 67
diff changeset
685 adjacent_dr_p (struct data_reference *dr)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
686 {
111
kono
parents: 67
diff changeset
687 /* If this is a bitfield store bail out. */
kono
parents: 67
diff changeset
688 if (TREE_CODE (DR_REF (dr)) == COMPONENT_REF
kono
parents: 67
diff changeset
689 && DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1)))
kono
parents: 67
diff changeset
690 return false;
kono
parents: 67
diff changeset
691
kono
parents: 67
diff changeset
692 if (!DR_STEP (dr)
kono
parents: 67
diff changeset
693 || TREE_CODE (DR_STEP (dr)) != INTEGER_CST)
kono
parents: 67
diff changeset
694 return false;
kono
parents: 67
diff changeset
695
kono
parents: 67
diff changeset
696 return tree_int_cst_equal (fold_unary (ABS_EXPR, TREE_TYPE (DR_STEP (dr)),
kono
parents: 67
diff changeset
697 DR_STEP (dr)),
kono
parents: 67
diff changeset
698 TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dr))));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
699 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
700
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
701 void split_constant_offset (tree , tree *, tree *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
702
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
703 /* Compute the greatest common divisor of a VECTOR of SIZE numbers. */
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
704
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
705 static inline lambda_int
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
706 lambda_vector_gcd (lambda_vector vector, int size)
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
707 {
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
708 int i;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
709 lambda_int gcd1 = 0;
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
710
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
711 if (size > 0)
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
712 {
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
713 gcd1 = vector[0];
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
714 for (i = 1; i < size; i++)
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
715 gcd1 = gcd (gcd1, vector[i]);
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
716 }
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
717 return gcd1;
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
718 }
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
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
720 /* Allocate a new vector of given SIZE. */
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
721
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
722 static inline lambda_vector
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
723 lambda_vector_new (int size)
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
724 {
111
kono
parents: 67
diff changeset
725 /* ??? We shouldn't abuse the GC allocator here. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
726 return ggc_cleared_vec_alloc<lambda_int> (size);
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
727 }
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
728
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
729 /* Clear out vector VEC1 of length SIZE. */
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
730
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
731 static inline void
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
732 lambda_vector_clear (lambda_vector vec1, int size)
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
733 {
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 memset (vec1, 0, size * sizeof (*vec1));
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
735 }
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
736
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
737 /* Returns true when the vector V is lexicographically positive, in
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
738 other words, when the first nonzero element is positive. */
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
739
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
740 static inline bool
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
741 lambda_vector_lexico_pos (lambda_vector v,
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
742 unsigned n)
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
743 {
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 unsigned i;
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
745 for (i = 0; i < n; i++)
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
746 {
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
747 if (v[i] == 0)
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
748 continue;
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
749 if (v[i] < 0)
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
750 return false;
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
751 if (v[i] > 0)
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
752 return true;
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
753 }
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
754 return true;
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
755 }
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
756
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
757 /* Return true if vector VEC1 of length SIZE is the zero vector. */
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
758
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
759 static inline bool
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
760 lambda_vector_zerop (lambda_vector vec1, int size)
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
761 {
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
762 int i;
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
763 for (i = 0; i < size; i++)
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
764 if (vec1[i] != 0)
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
765 return false;
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
766 return true;
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
767 }
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
768
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
769 /* Allocate a matrix of M rows x N cols. */
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
770
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
771 static inline lambda_matrix
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
772 lambda_matrix_new (int m, int n, struct obstack *lambda_obstack)
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
773 {
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
774 lambda_matrix mat;
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
775 int i;
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
776
111
kono
parents: 67
diff changeset
777 mat = XOBNEWVEC (lambda_obstack, lambda_vector, m);
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
778
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
779 for (i = 0; i < m; i++)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
780 mat[i] = XOBNEWVEC (lambda_obstack, lambda_int, n);
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
781
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
782 return mat;
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 }
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
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
785 #endif /* GCC_TREE_DATA_REF_H */