diff options
author | Paul Brook <paul@codesourcery.com> | 2004-06-25 17:15:46 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2004-06-25 17:15:46 +0000 |
commit | 4185ae53974032b6760938b7818099cb7dddd28f (patch) | |
tree | b8c2d8bd3079657353a50fef059902fbbf159bfe /gcc/cp/decl2.c | |
parent | 0da2c8ac77a61f9149fcbf3da36f7656aff96a4c (diff) | |
download | gcc-4185ae53974032b6760938b7818099cb7dddd28f.zip gcc-4185ae53974032b6760938b7818099cb7dddd28f.tar.gz gcc-4185ae53974032b6760938b7818099cb7dddd28f.tar.bz2 |
target-def.h (TARGET_CXX_GUARD_TYPE, [...]): Define.
gcc/
* target-def.h (TARGET_CXX_GUARD_TYPE, TARGET_CXX_GUARD_MASK_BIT,
TARGET_CXX): Define.
(TARGET_INITIALIZER): Use TARGET_CXX.
* target.h (struct gcc_target): Add struct cxx.
* targhooks.h (default_cxx_guard_type): Add prototype.
* targhooks.c (default_cxx_guard_type): New function.
* config/arm/arm.c (TARGET_CXX_GUARD_TYPE, TARGET_CXX_GUARD_MASK_BIT):
Define.
(arm_cxx_guard_type, arm_cxx_guard_mask_bit): New functions.
* doc/tm.texi: Document TARGET_CXX_GUARD_TYPE and
TARGET_CXX_GUARD_MASK_BIT.
gcc/cp/
* decl2.c (get_guard): Call targetm.cxx.guard_type.
(get_guard_bits, get_guard_cond): Call targetm.cxx.guard_mask_bit.
libstdc++/
* libsupc++/cxxabi.h: Define __ARM_EABI__
(__guard): Use it.
* libsupc++/guard.h (__cxa_guard_acquire, __cxa_guard_release): Ditto.
From-SVN: r83660
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 10384b3..5b23519 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1823,7 +1823,7 @@ get_guard (tree decl) /* We use a type that is big enough to contain a mutex as well as an integer counter. */ - guard_type = long_long_integer_type_node; + guard_type = targetm.cxx.guard_type (); guard = build_decl (VAR_DECL, sname, guard_type); /* The guard should have the same linkage as what it guards. */ @@ -1847,15 +1847,18 @@ get_guard (tree decl) static tree get_guard_bits (tree guard) { - /* We only set the first byte of the guard, in order to leave room - for a mutex in the high-order bits. */ - guard = build1 (ADDR_EXPR, - build_pointer_type (TREE_TYPE (guard)), - guard); - guard = build1 (NOP_EXPR, - build_pointer_type (char_type_node), - guard); - guard = build1 (INDIRECT_REF, char_type_node, guard); + if (!targetm.cxx.guard_mask_bit ()) + { + /* We only set the first byte of the guard, in order to leave room + for a mutex in the high-order bits. */ + guard = build1 (ADDR_EXPR, + build_pointer_type (TREE_TYPE (guard)), + guard); + guard = build1 (NOP_EXPR, + build_pointer_type (char_type_node), + guard); + guard = build1 (INDIRECT_REF, char_type_node, guard); + } return guard; } @@ -1870,6 +1873,16 @@ get_guard_cond (tree guard) /* Check to see if the GUARD is zero. */ guard = get_guard_bits (guard); + + /* Mask off all but the low bit. */ + if (targetm.cxx.guard_mask_bit ()) + { + guard_value = integer_one_node; + if (!same_type_p (TREE_TYPE (guard_value), TREE_TYPE (guard))) + guard_value = convert (TREE_TYPE (guard), guard_value); + guard = cp_build_binary_op (BIT_AND_EXPR, guard, guard_value); + } + guard_value = integer_zero_node; if (!same_type_p (TREE_TYPE (guard_value), TREE_TYPE (guard))) guard_value = convert (TREE_TYPE (guard), guard_value); |