* config/visium/visium.c (visium_gimplify_va_arg): Emit a big-endian
[official-gcc.git] / gcc / memmodel.h
blobd53eb7bc9d9966c2b1510e584f0fd50b13cde572
1 /* Prototypes of memory model helper functions.
2 Copyright (C) 2015-2016 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 /* Return the memory model from a host integer. */
24 static inline enum memmodel
25 memmodel_from_int (unsigned HOST_WIDE_INT val)
27 return (enum memmodel) (val & MEMMODEL_MASK);
30 /* Return the base memory model from a host integer. */
31 static inline enum memmodel
32 memmodel_base (unsigned HOST_WIDE_INT val)
34 return (enum memmodel) (val & MEMMODEL_BASE_MASK);
37 /* Return TRUE if the memory model is RELAXED. */
38 static inline bool
39 is_mm_relaxed (enum memmodel model)
41 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELAXED;
44 /* Return TRUE if the memory model is CONSUME. */
45 static inline bool
46 is_mm_consume (enum memmodel model)
48 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_CONSUME;
51 /* Return TRUE if the memory model is ACQUIRE. */
52 static inline bool
53 is_mm_acquire (enum memmodel model)
55 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQUIRE;
58 /* Return TRUE if the memory model is RELEASE. */
59 static inline bool
60 is_mm_release (enum memmodel model)
62 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELEASE;
65 /* Return TRUE if the memory model is ACQ_REL. */
66 static inline bool
67 is_mm_acq_rel (enum memmodel model)
69 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQ_REL;
72 /* Return TRUE if the memory model is SEQ_CST. */
73 static inline bool
74 is_mm_seq_cst (enum memmodel model)
76 return (model & MEMMODEL_BASE_MASK) == MEMMODEL_SEQ_CST;
79 /* Return TRUE if the memory model is a SYNC variant. */
80 static inline bool
81 is_mm_sync (enum memmodel model)
83 return (model & MEMMODEL_SYNC);
86 #endif /* GCC_MEMMODEL_H */