1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
commit ea36272bdc2602a690019b9612d23594571d3d2b
Author: thopre01 <thopre01@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon Sep 26 17:20:39 2016 +0000
2016-09-26 Thomas Preud'homme <thomas.preudhomme@arm.com>
gcc/
* tree.h (memmodel_from_int, memmodel_base, is_mm_relaxed,
is_mm_consume, is_mm_acquire, is_mm_release, is_mm_acq_rel,
is_mm_seq_cst, is_mm_sync): Move to ...
* memmodel.h: This. New file.
* builtins.c: Include memmodel.h.
* optabs.c: Likewise.
* tsan.c: Likewise.
* config/aarch64/aarch64.c: Likewise.
* config/alpha/alpha.c: Likewise.
* config/arm/arm.c: Likewise.
* config/i386/i386.c: Likewise.
* config/ia64/ia64.c: Likewise.
* config/mips/mips.c: Likewise.
* config/rs6000/rs6000.c: Likewise.
* config/sparc/sparc.c: Likewise.
* genconditions.c: Include memmodel.h in generated file.
* genemit.c: Likewise.
* genoutput.c: Likewise.
* genpeep.c: Likewise.
* genpreds.c: Likewise.
* genrecog.c: Likewise.
gcc/c-family/
* c-common.c: Include memmodel.h.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240504 138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 93cbe15ad3c..04dcf95acd2 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "gimple.h"
#include "predict.h"
#include "tm_p.h"
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index e9f619fd3af..2652259a312 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "function.h"
#include "tree.h"
+#include "memmodel.h"
#include "c-common.h"
#include "gimple-expr.h"
#include "tm_p.h"
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 6078b163548..c65b826b0cc 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -26,6 +26,7 @@
#include "target.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "gimple.h"
#include "cfghooks.h"
#include "cfgloop.h"
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 6d4af04dd7d..d646879e7e8 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "gimple.h"
#include "df.h"
#include "tm_p.h"
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 619c3291c87..feb54cbc64a 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -27,6 +27,7 @@
#include "target.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "cfghooks.h"
#include "df.h"
#include "tm_p.h"
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 143b905a341..01e2ad8e1b2 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "backend.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "gimple.h"
#include "cfghooks.h"
#include "cfgloop.h"
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 5f0bf43a103..573872eb85f 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "cfghooks.h"
#include "df.h"
#include "tm_p.h"
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 88f4038224a..3586a1001e7 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "gimple.h"
#include "cfghooks.h"
#include "df.h"
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d76f479d9e5..6897b5c260d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -24,6 +24,7 @@
#include "backend.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "gimple.h"
#include "cfghooks.h"
#include "cfgloop.h"
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 5efed3dc52f..5936f96bd80 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "gimple.h"
#include "df.h"
#include "tm_p.h"
diff --git a/gcc/genconditions.c b/gcc/genconditions.c
index e4f45b097cd..d8b0ebba56b 100644
--- a/gcc/genconditions.c
+++ b/gcc/genconditions.c
@@ -94,6 +94,7 @@ write_header (void)
#include \"resource.h\"\n\
#include \"diagnostic-core.h\"\n\
#include \"reload.h\"\n\
+#include \"memmodel.h\"\n\
#include \"tm-constrs.h\"\n");
if (saw_eh_return)
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 33040aac36d..d5e07a97a6d 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -792,6 +792,7 @@ from the machine description file `md'. */\n\n");
printf ("#include \"reload.h\"\n");
printf ("#include \"diagnostic-core.h\"\n");
printf ("#include \"regs.h\"\n");
+ printf ("#include \"memmodel.h\"\n");
printf ("#include \"tm-constrs.h\"\n");
printf ("#include \"ggc.h\"\n");
printf ("#include \"dumpfile.h\"\n");
diff --git a/gcc/genoutput.c b/gcc/genoutput.c
index f8c25ac4df0..59092580e49 100644
--- a/gcc/genoutput.c
+++ b/gcc/genoutput.c
@@ -231,6 +231,7 @@ output_prologue (void)
printf ("#include \"diagnostic-core.h\"\n");
printf ("#include \"output.h\"\n");
printf ("#include \"target.h\"\n");
+ printf ("#include \"memmodel.h\"\n");
printf ("#include \"tm-constrs.h\"\n");
}
diff --git a/gcc/genpeep.c b/gcc/genpeep.c
index 132cdced690..e1997e03e47 100644
--- a/gcc/genpeep.c
+++ b/gcc/genpeep.c
@@ -373,6 +373,7 @@ from the machine description file `md'. */\n\n");
printf ("#include \"except.h\"\n");
printf ("#include \"diagnostic-core.h\"\n");
printf ("#include \"flags.h\"\n");
+ printf ("#include \"memmodel.h\"\n");
printf ("#include \"tm-constrs.h\"\n\n");
printf ("extern rtx peep_operand[];\n\n");
diff --git a/gcc/genpreds.c b/gcc/genpreds.c
index d18ebd2ab5a..6db1b7b0301 100644
--- a/gcc/genpreds.c
+++ b/gcc/genpreds.c
@@ -1580,6 +1580,7 @@ write_insn_preds_c (void)
#include \"reload.h\"\n\
#include \"regs.h\"\n\
#include \"emit-rtl.h\"\n\
+#include \"memmodel.h\"\n\
#include \"tm-constrs.h\"\n");
FOR_ALL_PREDICATES (p)
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index 056798c82f7..77861074492 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -4192,6 +4192,7 @@ write_header (void)
#include \"diagnostic-core.h\"\n\
#include \"reload.h\"\n\
#include \"regs.h\"\n\
+#include \"memmodel.h\"\n\
#include \"tm-constrs.h\"\n\
\n");
diff --git a/gcc/memmodel.h b/gcc/memmodel.h
new file mode 100644
index 00000000000..d53eb7bc9d9
--- /dev/null
+++ b/gcc/memmodel.h
@@ -0,0 +1,86 @@
+/* Prototypes of memory model helper functions.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_MEMMODEL_H
+#define GCC_MEMMODEL_H
+
+/* Return the memory model from a host integer. */
+static inline enum memmodel
+memmodel_from_int (unsigned HOST_WIDE_INT val)
+{
+ return (enum memmodel) (val & MEMMODEL_MASK);
+}
+
+/* Return the base memory model from a host integer. */
+static inline enum memmodel
+memmodel_base (unsigned HOST_WIDE_INT val)
+{
+ return (enum memmodel) (val & MEMMODEL_BASE_MASK);
+}
+
+/* Return TRUE if the memory model is RELAXED. */
+static inline bool
+is_mm_relaxed (enum memmodel model)
+{
+ return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELAXED;
+}
+
+/* Return TRUE if the memory model is CONSUME. */
+static inline bool
+is_mm_consume (enum memmodel model)
+{
+ return (model & MEMMODEL_BASE_MASK) == MEMMODEL_CONSUME;
+}
+
+/* Return TRUE if the memory model is ACQUIRE. */
+static inline bool
+is_mm_acquire (enum memmodel model)
+{
+ return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQUIRE;
+}
+
+/* Return TRUE if the memory model is RELEASE. */
+static inline bool
+is_mm_release (enum memmodel model)
+{
+ return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELEASE;
+}
+
+/* Return TRUE if the memory model is ACQ_REL. */
+static inline bool
+is_mm_acq_rel (enum memmodel model)
+{
+ return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQ_REL;
+}
+
+/* Return TRUE if the memory model is SEQ_CST. */
+static inline bool
+is_mm_seq_cst (enum memmodel model)
+{
+ return (model & MEMMODEL_BASE_MASK) == MEMMODEL_SEQ_CST;
+}
+
+/* Return TRUE if the memory model is a SYNC variant. */
+static inline bool
+is_mm_sync (enum memmodel model)
+{
+ return (model & MEMMODEL_SYNC);
+}
+
+#endif /* GCC_MEMMODEL_H */
diff --git a/gcc/optabs.c b/gcc/optabs.c
index e41747a630f..c5e9b4f8e13 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "predict.h"
#include "tm_p.h"
#include "expmed.h"
diff --git a/gcc/tree.h b/gcc/tree.h
index 0d9ad0198fa..563e6d9e287 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4675,69 +4675,6 @@ extern void warn_deprecated_use (tree, tree);
extern void cache_integer_cst (tree);
extern const char *combined_fn_name (combined_fn);
-/* Return the memory model from a host integer. */
-static inline enum memmodel
-memmodel_from_int (unsigned HOST_WIDE_INT val)
-{
- return (enum memmodel) (val & MEMMODEL_MASK);
-}
-
-/* Return the base memory model from a host integer. */
-static inline enum memmodel
-memmodel_base (unsigned HOST_WIDE_INT val)
-{
- return (enum memmodel) (val & MEMMODEL_BASE_MASK);
-}
-
-/* Return TRUE if the memory model is RELAXED. */
-static inline bool
-is_mm_relaxed (enum memmodel model)
-{
- return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELAXED;
-}
-
-/* Return TRUE if the memory model is CONSUME. */
-static inline bool
-is_mm_consume (enum memmodel model)
-{
- return (model & MEMMODEL_BASE_MASK) == MEMMODEL_CONSUME;
-}
-
-/* Return TRUE if the memory model is ACQUIRE. */
-static inline bool
-is_mm_acquire (enum memmodel model)
-{
- return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQUIRE;
-}
-
-/* Return TRUE if the memory model is RELEASE. */
-static inline bool
-is_mm_release (enum memmodel model)
-{
- return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELEASE;
-}
-
-/* Return TRUE if the memory model is ACQ_REL. */
-static inline bool
-is_mm_acq_rel (enum memmodel model)
-{
- return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQ_REL;
-}
-
-/* Return TRUE if the memory model is SEQ_CST. */
-static inline bool
-is_mm_seq_cst (enum memmodel model)
-{
- return (model & MEMMODEL_BASE_MASK) == MEMMODEL_SEQ_CST;
-}
-
-/* Return TRUE if the memory model is a SYNC variant. */
-static inline bool
-is_mm_sync (enum memmodel model)
-{
- return (model & MEMMODEL_SYNC);
-}
-
/* Compare and hash for any structure which begins with a canonical
pointer. Assumes all pointers are interchangeable, which is sort
of already assumed by gcc elsewhere IIRC. */
diff --git a/gcc/tsan.c b/gcc/tsan.c
index 91dbd41a0b4..cc194749665 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "backend.h"
#include "rtl.h"
#include "tree.h"
+#include "memmodel.h"
#include "gimple.h"
#include "tree-pass.h"
#include "ssa.h"
|