Call symbol_summary<>::release instead of ~symbol_summary (PR ipa/79285).
[official-gcc.git] / gcc / memmodel.h
blob4082614f78aa2a7f890a6483dfc64829a3928963
1 /* Prototypes of memory model helper functions.
2 Copyright (C) 2011-2017 Free Software Foundation, Inc.
4 This file is part of GCC.
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.
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.
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/>. */
20 #ifndef GCC_MEMMODEL_H
21 #define GCC_MEMMODEL_H
23 /* Suppose that higher bits are target dependent. */
24 #define MEMMODEL_MASK ((1<<16)-1)
26 /* Legacy sync operations set this upper flag in the memory model. This allows
27 targets that need to do something stronger for sync operations to
28 differentiate with their target patterns and issue a more appropriate insn
29 sequence. See bugzilla 65697 for background. */
30 #define MEMMODEL_SYNC (1<<15)
32 /* Memory model without SYNC bit for targets/operations that do not care. */
33 #define MEMMODEL_BASE_MASK (MEMMODEL_SYNC-1)
35 /* Memory model types for the __atomic* builtins.
36 This must match the order in libstdc++-v3/include/bits/atomic_base.h. */
37 enum memmodel
39 MEMMODEL_RELAXED = 0,
40 MEMMODEL_CONSUME = 1,
41 MEMMODEL_ACQUIRE = 2,
42 MEMMODEL_RELEASE = 3,
43 MEMMODEL_ACQ_REL = 4,
44 MEMMODEL_SEQ_CST = 5,
45 MEMMODEL_LAST = 6,
46 MEMMODEL_SYNC_ACQUIRE = MEMMODEL_ACQUIRE | MEMMODEL_SYNC,
47 MEMMODEL_SYNC_RELEASE = MEMMODEL_RELEASE | MEMMODEL_SYNC,
48 MEMMODEL_SYNC_SEQ_CST = MEMMODEL_SEQ_CST | MEMMODEL_SYNC
51 /* Return the memory model from a host integer. */
52 static inline enum memmodel
53 memmodel_from_int (unsigned HOST_WIDE_INT val)
55 return (enum memmodel) (val & MEMMODEL_MASK);
58 /* Return the base memory model from a host integer. */
59 static inline enum memmodel
60 memmodel_base (unsigned HOST_WIDE_INT val)
62 return (enum memmodel) (val & MEMMODEL_BASE_MASK);
65 /* Return TRUE if the memory model is RELAXED. */
66 static inline bool
67 is_mm_relaxed (enum memmodel model)
69 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELAXED;
72 /* Return TRUE if the memory model is CONSUME. */
73 static inline bool
74 is_mm_consume (enum memmodel model)
76 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_CONSUME;
79 /* Return TRUE if the memory model is ACQUIRE. */
80 static inline bool
81 is_mm_acquire (enum memmodel model)
83 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQUIRE;
86 /* Return TRUE if the memory model is RELEASE. */
87 static inline bool
88 is_mm_release (enum memmodel model)
90 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELEASE;
93 /* Return TRUE if the memory model is ACQ_REL. */
94 static inline bool
95 is_mm_acq_rel (enum memmodel model)
97 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQ_REL;
100 /* Return TRUE if the memory model is SEQ_CST. */
101 static inline bool
102 is_mm_seq_cst (enum memmodel model)
104 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_SEQ_CST;
107 /* Return TRUE if the memory model is a SYNC variant. */
108 static inline bool
109 is_mm_sync (enum memmodel model)
111 return (model & MEMMODEL_SYNC);
114 #endif /* GCC_MEMMODEL_H */