]>
Commit | Line | Data |
---|---|---|
e73cf9a2 TP |
1 | /* Prototypes of memory model helper functions. |
2 | Copyright (C) 2015-2016 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GCC. | |
5 | ||
6 | GCC is free software; you can redistribute it and/or modify it under | |
7 | the terms of the GNU General Public License as published by the Free | |
8 | Software Foundation; either version 3, or (at your option) any later | |
9 | version. | |
10 | ||
11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GCC; see the file COPYING3. If not see | |
18 | <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | #ifndef GCC_MEMMODEL_H | |
21 | #define GCC_MEMMODEL_H | |
22 | ||
23 | /* Return the memory model from a host integer. */ | |
24 | static inline enum memmodel | |
25 | memmodel_from_int (unsigned HOST_WIDE_INT val) | |
26 | { | |
27 | return (enum memmodel) (val & MEMMODEL_MASK); | |
28 | } | |
29 | ||
30 | /* Return the base memory model from a host integer. */ | |
31 | static inline enum memmodel | |
32 | memmodel_base (unsigned HOST_WIDE_INT val) | |
33 | { | |
34 | return (enum memmodel) (val & MEMMODEL_BASE_MASK); | |
35 | } | |
36 | ||
37 | /* Return TRUE if the memory model is RELAXED. */ | |
38 | static inline bool | |
39 | is_mm_relaxed (enum memmodel model) | |
40 | { | |
41 | return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELAXED; | |
42 | } | |
43 | ||
44 | /* Return TRUE if the memory model is CONSUME. */ | |
45 | static inline bool | |
46 | is_mm_consume (enum memmodel model) | |
47 | { | |
48 | return (model & MEMMODEL_BASE_MASK) == MEMMODEL_CONSUME; | |
49 | } | |
50 | ||
51 | /* Return TRUE if the memory model is ACQUIRE. */ | |
52 | static inline bool | |
53 | is_mm_acquire (enum memmodel model) | |
54 | { | |
55 | return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQUIRE; | |
56 | } | |
57 | ||
58 | /* Return TRUE if the memory model is RELEASE. */ | |
59 | static inline bool | |
60 | is_mm_release (enum memmodel model) | |
61 | { | |
62 | return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELEASE; | |
63 | } | |
64 | ||
65 | /* Return TRUE if the memory model is ACQ_REL. */ | |
66 | static inline bool | |
67 | is_mm_acq_rel (enum memmodel model) | |
68 | { | |
69 | return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQ_REL; | |
70 | } | |
71 | ||
72 | /* Return TRUE if the memory model is SEQ_CST. */ | |
73 | static inline bool | |
74 | is_mm_seq_cst (enum memmodel model) | |
75 | { | |
76 | return (model & MEMMODEL_BASE_MASK) == MEMMODEL_SEQ_CST; | |
77 | } | |
78 | ||
79 | /* Return TRUE if the memory model is a SYNC variant. */ | |
80 | static inline bool | |
81 | is_mm_sync (enum memmodel model) | |
82 | { | |
83 | return (model & MEMMODEL_SYNC); | |
84 | } | |
85 | ||
86 | #endif /* GCC_MEMMODEL_H */ |