From 003a237ea83b61ad5e264abeaba9d75bb8d64a6b Mon Sep 17 00:00:00 2001
From: rth <>
Date: Thu, 14 Apr 2005 22:37:47 +0000
Subject: 	PR middle-end/14311 	* builtin-types.def (BT_BOOL,
 BT_VOLATILE_PTR, BT_I1, BT_I2, 	BT_I4, BT_I8, BT_FN_VOID_VPTR,
 BT_FN_I1_VPTR_I1, BT_FN_I2_VPTR_I2, 	BT_FN_I4_VPTR_I4, BT_FN_I8_VPTR_I8,
 BT_FN_BOOL_VPTR_I1_I1, 	BT_FN_BOOL_VPTR_I2_I2, BT_FN_BOOL_VPTR_I4_I4,
 BT_FN_BOOL_VPTR_I8_I8, 	BT_FN_I1_VPTR_I1_I1, BT_FN_I2_VPTR_I2_I2,
 BT_FN_I4_VPTR_I4_I4, 	BT_FN_I8_VPTR_I8_I8): New. 	* builtins.def
 (DEF_SYNC_BUILTIN): New. 	(BUILT_IN_FETCH_AND_ADD_N,
 BUILT_IN_FETCH_AND_ADD_1, 	BUILT_IN_FETCH_AND_ADD_2,
 BUILT_IN_FETCH_AND_ADD_4, 	BUILT_IN_FETCH_AND_ADD_8,
 BUILT_IN_FETCH_AND_SUB_N, 	BUILT_IN_FETCH_AND_SUB_1,
 BUILT_IN_FETCH_AND_SUB_2, 	BUILT_IN_FETCH_AND_SUB_4,
 BUILT_IN_FETCH_AND_SUB_8, 	BUILT_IN_FETCH_AND_OR_N,
 BUILT_IN_FETCH_AND_OR_1, 	BUILT_IN_FETCH_AND_OR_2,
 BUILT_IN_FETCH_AND_OR_4, 	BUILT_IN_FETCH_AND_OR_8,
 BUILT_IN_FETCH_AND_AND_N, 	BUILT_IN_FETCH_AND_AND_1,
 BUILT_IN_FETCH_AND_AND_2, 	BUILT_IN_FETCH_AND_AND_4,
 BUILT_IN_FETCH_AND_AND_8, 	BUILT_IN_FETCH_AND_XOR_N,
 BUILT_IN_FETCH_AND_XOR_1, 	BUILT_IN_FETCH_AND_XOR_2,
 BUILT_IN_FETCH_AND_XOR_4, 	BUILT_IN_FETCH_AND_XOR_8,
 BUILT_IN_FETCH_AND_NAND_N, 	BUILT_IN_FETCH_AND_NAND_1,
 BUILT_IN_FETCH_AND_NAND_2, 	BUILT_IN_FETCH_AND_NAND_4,
 BUILT_IN_FETCH_AND_NAND_8, 	BUILT_IN_ADD_AND_FETCH_N,
 BUILT_IN_ADD_AND_FETCH_1, 	BUILT_IN_ADD_AND_FETCH_2,
 BUILT_IN_ADD_AND_FETCH_4, 	BUILT_IN_ADD_AND_FETCH_8,
 BUILT_IN_SUB_AND_FETCH_N, 	BUILT_IN_SUB_AND_FETCH_1,
 BUILT_IN_SUB_AND_FETCH_2, 	BUILT_IN_SUB_AND_FETCH_4,
 BUILT_IN_SUB_AND_FETCH_8, 	BUILT_IN_OR_AND_FETCH_N,
 BUILT_IN_OR_AND_FETCH_1, 	BUILT_IN_OR_AND_FETCH_2,
 BUILT_IN_OR_AND_FETCH_4, 	BUILT_IN_OR_AND_FETCH_8,
 BUILT_IN_AND_AND_FETCH_N, 	BUILT_IN_AND_AND_FETCH_1,
 BUILT_IN_AND_AND_FETCH_2, 	BUILT_IN_AND_AND_FETCH_4,
 BUILT_IN_AND_AND_FETCH_8, 	BUILT_IN_XOR_AND_FETCH_N,
 BUILT_IN_XOR_AND_FETCH_1, 	BUILT_IN_XOR_AND_FETCH_2,
 BUILT_IN_XOR_AND_FETCH_4, 	BUILT_IN_XOR_AND_FETCH_8,
 BUILT_IN_NAND_AND_FETCH_N, 	BUILT_IN_NAND_AND_FETCH_1,
 BUILT_IN_NAND_AND_FETCH_2, 	BUILT_IN_NAND_AND_FETCH_4,
 BUILT_IN_NAND_AND_FETCH_8, 	BUILT_IN_BOOL_COMPARE_AND_SWAP_N,
 BUILT_IN_BOOL_COMPARE_AND_SWAP_1, 	BUILT_IN_BOOL_COMPARE_AND_SWAP_2,
 BUILT_IN_BOOL_COMPARE_AND_SWAP_4, 	BUILT_IN_BOOL_COMPARE_AND_SWAP_8,
 BUILT_IN_VAL_COMPARE_AND_SWAP_N, 	BUILT_IN_VAL_COMPARE_AND_SWAP_1,
 BUILT_IN_VAL_COMPARE_AND_SWAP_2, 	BUILT_IN_VAL_COMPARE_AND_SWAP_4,
 BUILT_IN_VAL_COMPARE_AND_SWAP_8, 	BUILT_IN_LOCK_TEST_AND_SET_N,
 BUILT_IN_LOCK_TEST_AND_SET_1, 	BUILT_IN_LOCK_TEST_AND_SET_2,
 BUILT_IN_LOCK_TEST_AND_SET_4, 	BUILT_IN_LOCK_TEST_AND_SET_8,
 BUILT_IN_LOCK_RELEASE_N, 	BUILT_IN_LOCK_RELEASE_1,
 BUILT_IN_LOCK_RELEASE_2, 	BUILT_IN_LOCK_RELEASE_4,
 BUILT_IN_LOCK_RELEASE_8, 	BUILT_IN_SYNCHRONIZE: New. 	* builtins.c
 (called_as_built_in): Rewrite from CALLED_AS_BUILT_IN 	as a function.  Accept
 __sync_ as a prefix as well. 	(expand_builtin_sync_operation,
 expand_builtin_compare_and_swap, 	expand_builtin_lock_test_and_set,
 expand_builtin_synchronize, 	expand_builtin_lock_release): New. 
 (expand_builtin): Call them. 	* c-common.c (DEF_BUILTIN): Don't require
 __builtin_ prefix if 	neither BOTH_P nor FALLBACK_P are defined. 
 (builtin_type_for_size): New. 	(sync_resolve_size, sync_resolve_params,
 sync_resolve_return): New. 	(resolve_overloaded_builtin): New. 	*
 c-common.h (resolve_overloaded_builtin): Declare. 
 (builtin_type_for_size): Declare. 	* c-typeck.c (build_function_call):
 Invoke resolve_overloaded_builtin. 	* expr.c (sync_add_optab,
 sync_sub_optab, sync_ior_optab, 	sync_and_optab, sync_xor_optab,
 sync_nand_optab, sync_old_add_optab, 	sync_old_sub_optab,
 sync_old_ior_optab, sync_old_and_optab, 	sync_old_xor_optab,
 sync_old_nand_optab, sync_new_add_optab, 	sync_new_sub_optab,
 sync_new_ior_optab, sync_new_and_optab, 	sync_new_xor_optab,
 sync_new_nand_optab, sync_compare_and_swap, 	sync_compare_and_swap_cc,
 sync_lock_test_and_set, 	sync_lock_release): New. 	* optabs.h:
 Declare them. 	* expr.h (expand_val_compare_and_swap,
 expand_bool_compare_and_swap, 	expand_sync_operation,
 expand_sync_fetch_operation, 	expand_sync_lock_test_and_set): Declare. 
 * genopinit.c (optabs): Add sync optabs. 	* optabs.c (init_optabs):
 Initialize sync optabs. 	(expand_val_compare_and_swap_1,
 expand_val_compare_and_swap, 	expand_bool_compare_and_swap,
 expand_compare_and_swap_loop, 	expand_sync_operation,
 expand_sync_fetch_operation, 	expand_sync_lock_test_and_set): New. 	*
 doc/extend.texi (Atomic Builtins): New section 	* doc/md.texi
 (Standard Names): Add sync patterns.

---
 gcc/builtin-types.def | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

(limited to 'gcc/builtin-types.def')

diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index d9b87df309f..4b5f35351e4 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -60,6 +60,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
     the type pointed to.  */
 
 DEF_PRIMITIVE_TYPE (BT_VOID, void_type_node)
+DEF_PRIMITIVE_TYPE (BT_BOOL, boolean_type_node)
 DEF_PRIMITIVE_TYPE (BT_INT, integer_type_node)
 DEF_PRIMITIVE_TYPE (BT_UINT, unsigned_type_node)
 DEF_PRIMITIVE_TYPE (BT_LONG, long_integer_type_node)
@@ -79,6 +80,10 @@ DEF_PRIMITIVE_TYPE (BT_COMPLEX_LONGDOUBLE, complex_long_double_type_node)
 DEF_PRIMITIVE_TYPE (BT_PTR, ptr_type_node)
 DEF_PRIMITIVE_TYPE (BT_FILEPTR, fileptr_type_node)
 DEF_PRIMITIVE_TYPE (BT_CONST_PTR, const_ptr_type_node)
+DEF_PRIMITIVE_TYPE (BT_VOLATILE_PTR,
+		    build_pointer_type
+		     (build_qualified_type (void_type_node,
+					    TYPE_QUAL_VOLATILE)))
 DEF_PRIMITIVE_TYPE (BT_PTRMODE, (*lang_hooks.types.type_for_mode)(ptr_mode, 0))
 DEF_PRIMITIVE_TYPE (BT_INT_PTR, integer_ptr_type_node)
 DEF_PRIMITIVE_TYPE (BT_FLOAT_PTR, float_ptr_type_node)
@@ -94,6 +99,11 @@ DEF_PRIMITIVE_TYPE (BT_CONST_STRING, const_string_type_node)
 DEF_PRIMITIVE_TYPE (BT_VALIST_REF, va_list_ref_type_node)
 DEF_PRIMITIVE_TYPE (BT_VALIST_ARG, va_list_arg_type_node)
 
+DEF_PRIMITIVE_TYPE (BT_I1, builtin_type_for_size (BITS_PER_UNIT*1, 1))
+DEF_PRIMITIVE_TYPE (BT_I2, builtin_type_for_size (BITS_PER_UNIT*2, 1))
+DEF_PRIMITIVE_TYPE (BT_I4, builtin_type_for_size (BITS_PER_UNIT*4, 1))
+DEF_PRIMITIVE_TYPE (BT_I8, builtin_type_for_size (BITS_PER_UNIT*8, 1))
+
 DEF_POINTER_TYPE (BT_PTR_CONST_STRING, BT_CONST_STRING)
 
 DEF_FUNCTION_TYPE_0 (BT_FN_VOID, BT_VOID)
@@ -160,6 +170,7 @@ DEF_FUNCTION_TYPE_1 (BT_FN_STRING_CONST_STRING, BT_STRING, BT_CONST_STRING)
 DEF_FUNCTION_TYPE_1 (BT_FN_WORD_PTR, BT_WORD, BT_PTR)
 DEF_FUNCTION_TYPE_1 (BT_FN_INT_WINT, BT_INT, BT_WINT)
 DEF_FUNCTION_TYPE_1 (BT_FN_WINT_WINT, BT_WINT, BT_WINT)
+DEF_FUNCTION_TYPE_1 (BT_FN_VOID_VPTR, BT_VOID, BT_VOLATILE_PTR)
 
 DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_INT, BT_VOID, BT_PTR, BT_INT)
 DEF_FUNCTION_TYPE_2 (BT_FN_STRING_STRING_CONST_STRING, 
@@ -241,6 +252,10 @@ DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOU
 DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_PTR, BT_VOID, BT_PTR, BT_PTR)
 DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_STRING_PTR_CONST_STRING,
 		     BT_INT, BT_CONST_STRING, BT_PTR_CONST_STRING)
+DEF_FUNCTION_TYPE_2 (BT_FN_I1_VPTR_I1, BT_I1, BT_VOLATILE_PTR, BT_I1)
+DEF_FUNCTION_TYPE_2 (BT_FN_I2_VPTR_I2, BT_I2, BT_VOLATILE_PTR, BT_I2)
+DEF_FUNCTION_TYPE_2 (BT_FN_I4_VPTR_I4, BT_I4, BT_VOLATILE_PTR, BT_I4)
+DEF_FUNCTION_TYPE_2 (BT_FN_I8_VPTR_I8, BT_I8, BT_VOLATILE_PTR, BT_I8)
 
 DEF_FUNCTION_TYPE_3 (BT_FN_STRING_STRING_CONST_STRING_SIZE,
 		     BT_STRING, BT_STRING, BT_CONST_STRING, BT_SIZE)
@@ -285,6 +300,18 @@ DEF_FUNCTION_TYPE_3 (BT_FN_VOID_LONGDOUBLE_LONGDOUBLEPTR_LONGDOUBLEPTR,
 DEF_FUNCTION_TYPE_3 (BT_FN_VOID_PTR_PTR_PTR, BT_VOID, BT_PTR, BT_PTR, BT_PTR)
 DEF_FUNCTION_TYPE_3 (BT_FN_INT_CONST_STRING_PTR_CONST_STRING_PTR_CONST_STRING,
 		     BT_INT, BT_CONST_STRING, BT_PTR_CONST_STRING, BT_PTR_CONST_STRING)
+DEF_FUNCTION_TYPE_3 (BT_FN_BOOL_VPTR_I1_I1, BT_BOOL, BT_VOLATILE_PTR,
+		     BT_I1, BT_I1)
+DEF_FUNCTION_TYPE_3 (BT_FN_BOOL_VPTR_I2_I2, BT_BOOL, BT_VOLATILE_PTR,
+		     BT_I2, BT_I2)
+DEF_FUNCTION_TYPE_3 (BT_FN_BOOL_VPTR_I4_I4, BT_BOOL, BT_VOLATILE_PTR,
+		     BT_I4, BT_I4)
+DEF_FUNCTION_TYPE_3 (BT_FN_BOOL_VPTR_I8_I8, BT_BOOL, BT_VOLATILE_PTR,
+		     BT_I8, BT_I8)
+DEF_FUNCTION_TYPE_3 (BT_FN_I1_VPTR_I1_I1, BT_I1, BT_VOLATILE_PTR, BT_I1, BT_I1)
+DEF_FUNCTION_TYPE_3 (BT_FN_I2_VPTR_I2_I2, BT_I2, BT_VOLATILE_PTR, BT_I2, BT_I2)
+DEF_FUNCTION_TYPE_3 (BT_FN_I4_VPTR_I4_I4, BT_I4, BT_VOLATILE_PTR, BT_I4, BT_I4)
+DEF_FUNCTION_TYPE_3 (BT_FN_I8_VPTR_I8_I8, BT_I8, BT_VOLATILE_PTR, BT_I8, BT_I8)
 
 DEF_FUNCTION_TYPE_4 (BT_FN_SIZE_CONST_PTR_SIZE_SIZE_FILEPTR,
 		     BT_SIZE, BT_CONST_PTR, BT_SIZE, BT_SIZE, BT_FILEPTR)
-- 
cgit v1.2.3

