diff options
author | Thomas Preud'homme <thomas.preudhomme@arm.com> | 2016-09-26 17:20:39 +0000 |
---|---|---|
committer | Thomas Preud'homme <thopre01@gcc.gnu.org> | 2016-09-26 17:20:39 +0000 |
commit | e73cf9a208d8ef5482f3f3ca7bc78bd38d633595 (patch) | |
tree | 2cc75ac7cc2f3f7e00bcda2ebf61b8484b518328 /gcc/memmodel.h | |
parent | 991075a49668f776b727b3b358557a02a896afa2 (diff) | |
download | gcc-e73cf9a208d8ef5482f3f3ca7bc78bd38d633595.zip gcc-e73cf9a208d8ef5482f3f3ca7bc78bd38d633595.tar.gz gcc-e73cf9a208d8ef5482f3f3ca7bc78bd38d633595.tar.bz2 |
tree.h (memmodel_from_int, [...]): Move to ...
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.
From-SVN: r240504
Diffstat (limited to 'gcc/memmodel.h')
-rw-r--r-- | gcc/memmodel.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/gcc/memmodel.h b/gcc/memmodel.h new file mode 100644 index 0000000..d53eb7b --- /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 */ |