This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gomp] implement a handfull of easy directives
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Diego Novillo <dnovillo at redhat dot com>
- Date: Wed, 21 Sep 2005 16:49:17 -0700
- Subject: [gomp] implement a handfull of easy directives
Adds "built-in" decls for the functions used from the libgomp library.
They're not realy built in of course, but it's easy to re-use the same
bits for building decls.
Then it uses some of those to implement master, critical, ordered,
barrier, atomic, and flush.
Diego, did you say you were doing compile-only test cases in gcc.dg?
I should write a bunch for this...
r~
* c-omp.c: New file.
* Makefile.in (c-omp.o): New.
* builtin-types.def (BT_PTR_LONG, BT_PTR_PTR, BT_FN_BOOL, BT_FN_INT,
BT_FN_VOID_PTRPTR, BT_PTR_FN_VOID_PTR, BT_FN_VOID_UINT_UINT,
BT_FN_BOOL_LONGPTR_LONGPTR, BT_FN_VOID_OMPFN_PTR_UINT,
BT_FN_VOID_OMPFN_PTR_UINT_UINT,
BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG): New.
* builtins.def (DEF_GOMP_BUILTIN): New.
(BUILT_IN_OMP_GET_THREAD_NUM, BUILT_IN_GOMP_BARRIER,
BUILT_IN_GOMP_CRITICAL_START, BUILT_IN_GOMP_CRITICAL_END,
BUILT_IN_GOMP_CRITICAL_NAME_START, BUILT_IN_GOMP_CRITICAL_NAME_END,
BUILT_IN_GOMP_LOOP_STATIC_START, BUILT_IN_GOMP_LOOP_DYNAMIC_START,
BUILT_IN_GOMP_LOOP_GUIDED_START, BUILT_IN_GOMP_LOOP_RUNTIME_START,
BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_START,
BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_START,
BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_START,
BUILT_IN_GOMP_LOOP_STATIC_NEXT, BUILT_IN_GOMP_LOOP_DYNAMIC_NEXT,
BUILT_IN_GOMP_LOOP_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_RUNTIME_NEXT,
BUILT_IN_GOMP_LOOP_ORDERED_STATIC_NEXT,
BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_NEXT,
BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_NEXT,
BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_NEXT,
BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START,
BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START,
BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START,
BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START,
BUILT_IN_GOMP_LOOP_END, BUILT_IN_GOMP_LOOP_END_NOWAIT,
BUILT_IN_GOMP_ORDERED_START, BUILT_IN_GOMP_ORDERED_END,
BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END,
BUILT_IN_GOMP_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_NEXT,
BUILT_IN_GOMP_PARALLEL_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_END,
BUILT_IN_GOMP_SECTIONS_END_NOWAIT, BUILT_IN_GOMP_SINGLE_START,
BUILT_IN_GOMP_SINGLE_COPY_START, BUILT_IN_GOMP_SINGLE_COPY_END): New.
* c-common.c (DEF_FUNCTION_TYPE_7): New.
* c-tree.h (pushdecl_top_level): Move declaration ...
* c-common.h (pushdecl_top_level): ... here.
(c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered,
c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush): Declare.
* c-parser.c (c_parser_compound_statement_nostart): Don't special
case omp barrier or omp flush.
(c_parser_omp_directive): Implement master, critical, orered,
barrier, atomic, flush.
(c_parser_pragma_omp_no_args): New.
(c_parser_pragma_omp_critical): Remove printf debugging.
(c_parser_pragma_omp_flush): Likewise.
(c_parser_pragma_omp_atomic, c_parser_pragma_omp_barrier,
c_parser_pragma_omp_master, c_parser_pragma_omp_ordered): Remove.
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1501.4.6
diff -u -p -r1.1501.4.6 Makefile.in
--- Makefile.in 20 Sep 2005 21:19:17 -0000 1.1501.4.6
+++ Makefile.in 21 Sep 2005 23:36:06 -0000
@@ -923,7 +923,7 @@ C_AND_OBJC_OBJS = attribs.o c-errors.o c
c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o \
c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \
c-objc-common.o c-dump.o c-pch.o c-parser.o $(C_TARGET_OBJS) \
- c-gimplify.o tree-mudflap.o c-pretty-print.o
+ c-gimplify.o tree-mudflap.o c-pretty-print.o c-omp.o
# Language-specific object files for C.
C_OBJS = c-lang.o stub-objc.o $(C_AND_OBJC_OBJS)
@@ -1578,6 +1578,9 @@ c-pch.o : c-pch.c $(CONFIG_H) $(SYSTEM_H
-DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \
$< $(OUTPUT_OPTION)
+c-omp.o : c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+ $(FUNCTION_H) $(C_COMMON_H) toplev.h $(TREE_GIMPLE_H)
+
# Language-independent files.
DRIVER_DEFINES = \
Index: builtin-types.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtin-types.def,v
retrieving revision 1.31.4.1
diff -u -p -r1.31.4.1 builtin-types.def
--- builtin-types.def 6 Jul 2005 17:37:24 -0000 1.31.4.1
+++ builtin-types.def 21 Sep 2005 23:36:06 -0000
@@ -107,10 +107,14 @@ DEF_PRIMITIVE_TYPE (BT_I4, builtin_type_
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_POINTER_TYPE (BT_PTR_LONG, BT_LONG)
+DEF_POINTER_TYPE (BT_PTR_PTR, BT_PTR)
DEF_FUNCTION_TYPE_0 (BT_FN_VOID, BT_VOID)
+DEF_FUNCTION_TYPE_0 (BT_FN_BOOL, BT_BOOL)
DEF_FUNCTION_TYPE_0 (BT_FN_PTR, BT_PTR)
DEF_FUNCTION_TYPE_0 (BT_FN_PID, BT_PID)
+DEF_FUNCTION_TYPE_0 (BT_FN_INT, BT_INT)
DEF_FUNCTION_TYPE_0 (BT_FN_UINT, BT_UINT)
DEF_FUNCTION_TYPE_0 (BT_FN_FLOAT, BT_FLOAT)
DEF_FUNCTION_TYPE_0 (BT_FN_DOUBLE, BT_DOUBLE)
@@ -173,6 +177,9 @@ DEF_FUNCTION_TYPE_1 (BT_FN_WORD_PTR, BT_
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_1 (BT_FN_VOID_PTRPTR, BT_VOID, BT_PTR_PTR)
+
+DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR, BT_FN_VOID_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,
@@ -259,6 +266,9 @@ DEF_FUNCTION_TYPE_2 (BT_FN_I1_VPTR_I1, B
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_2 (BT_FN_VOID_UINT_UINT, BT_VOID, BT_UINT, BT_UINT)
+DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_LONGPTR_LONGPTR,
+ BT_BOOL, BT_PTR_LONG, BT_PTR_LONG)
DEF_FUNCTION_TYPE_3 (BT_FN_STRING_STRING_CONST_STRING_SIZE,
BT_STRING, BT_STRING, BT_CONST_STRING, BT_SIZE)
@@ -317,6 +327,8 @@ DEF_FUNCTION_TYPE_3 (BT_FN_I1_VPTR_I1_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_3 (BT_FN_VOID_OMPFN_PTR_UINT, BT_VOID, BT_PTR_FN_VOID_PTR,
+ BT_PTR, BT_UINT)
DEF_FUNCTION_TYPE_4 (BT_FN_SIZE_CONST_PTR_SIZE_SIZE_FILEPTR,
BT_SIZE, BT_CONST_PTR, BT_SIZE, BT_SIZE, BT_FILEPTR)
@@ -332,14 +344,29 @@ DEF_FUNCTION_TYPE_4 (BT_FN_STRING_STRING
BT_STRING, BT_STRING, BT_CONST_STRING, BT_SIZE, BT_SIZE)
DEF_FUNCTION_TYPE_4 (BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG,
BT_INT, BT_FILEPTR, BT_INT, BT_CONST_STRING, BT_VALIST_ARG)
+DEF_FUNCTION_TYPE_4 (BT_FN_VOID_OMPFN_PTR_UINT_UINT,
+ BT_VOID, BT_PTR_FN_VOID_PTR, BT_PTR, BT_UINT, BT_UINT)
DEF_FUNCTION_TYPE_5 (BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG,
BT_INT, BT_STRING, BT_INT, BT_SIZE, BT_CONST_STRING,
BT_VALIST_ARG)
+DEF_FUNCTION_TYPE_5 (BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ BT_BOOL, BT_LONG, BT_LONG, BT_LONG,
+ BT_PTR_LONG, BT_PTR_LONG)
DEF_FUNCTION_TYPE_6 (BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG,
BT_INT, BT_STRING, BT_SIZE, BT_INT, BT_SIZE,
BT_CONST_STRING, BT_VALIST_ARG)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ BT_BOOL, BT_LONG, BT_LONG, BT_LONG, BT_LONG,
+ BT_PTR_LONG, BT_PTR_LONG)
+DEF_FUNCTION_TYPE_6 (BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
+ BT_VOID, BT_PTR_FN_VOID_PTR, BT_PTR, BT_UINT,
+ BT_LONG, BT_LONG, BT_LONG)
+
+DEF_FUNCTION_TYPE_7 (BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
+ BT_VOID, BT_PTR_FN_VOID_PTR, BT_PTR, BT_UINT,
+ BT_LONG, BT_LONG, BT_LONG, BT_LONG)
DEF_FUNCTION_TYPE_VAR_0 (BT_FN_VOID_VAR, BT_VOID)
DEF_FUNCTION_TYPE_VAR_0 (BT_FN_INT_VAR, BT_INT)
@@ -378,3 +405,4 @@ DEF_FUNCTION_TYPE_VAR_5 (BT_FN_INT_STRIN
DEF_POINTER_TYPE (BT_PTR_FN_VOID_VAR, BT_FN_VOID_VAR)
DEF_FUNCTION_TYPE_3 (BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE,
BT_PTR, BT_PTR_FN_VOID_VAR, BT_PTR, BT_SIZE)
+
Index: builtins.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.def,v
retrieving revision 1.103.4.2
diff -u -p -r1.103.4.2 builtins.def
--- builtins.def 28 Jul 2005 19:28:15 -0000 1.103.4.2
+++ builtins.def 21 Sep 2005 23:36:07 -0000
@@ -133,6 +133,13 @@ Software Foundation, 51 Franklin Street,
DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, 0, 0, false, false, \
false, 0, false, false)
+/* Builtin used by the implementation of GNU OpenMP. None of these are
+ actually implemented in the compiler; they're all in libgomp. */
+#undef DEF_GOMP_BUILTIN
+#define DEF_GOMP_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
+ DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
+ false, true, true, ATTRS, false, flag_openmp)
+
/* Define an attribute list for math functions that are normally
"impure" because some of them may write into global memory for
`errno'. If !flag_errno_math they are instead "const". */
@@ -884,3 +891,117 @@ DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_
DEF_SYNC_BUILTIN (BUILT_IN_SYNCHRONIZE, "__sync_synchronize",
BT_FN_VOID, ATTR_NOTHROW_LIST)
+
+DEF_GOMP_BUILTIN (BUILT_IN_OMP_GET_THREAD_NUM, "omp_get_thread_num",
+ BT_FN_INT, ATTR_CONST_NOTHROW_LIST)
+
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_BARRIER, "GOMP_barrier",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_CRITICAL_START, "GOMP_critical_start",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_CRITICAL_END, "GOMP_critical_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_CRITICAL_NAME_START,
+ "GOMP_critical_name_start",
+ BT_FN_VOID_PTRPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_CRITICAL_NAME_END,
+ "GOMP_critical_name_end",
+ BT_FN_VOID_PTRPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_STATIC_START,
+ "GOMP_loop_static_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_DYNAMIC_START,
+ "GOMP_loop_dynamic_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_GUIDED_START,
+ "GOMP_loop_guided_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_RUNTIME_START,
+ "GOMP_loop_runtime_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
+ "GOMP_loop_ordered_static_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_START,
+ "GOMP_loop_ordered_dynamic_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_START,
+ "GOMP_loop_ordered_guided_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_START,
+ "GOMP_loop_ordered_runtime_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_STATIC_NEXT, "GOMP_loop_static_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_DYNAMIC_NEXT, "GOMP_loop_dynamic_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_GUIDED_NEXT, "GOMP_loop_guided_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_RUNTIME_NEXT, "GOMP_loop_runtime_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_STATIC_NEXT,
+ "GOMP_loop_ordered_static_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_NEXT,
+ "GOMP_loop_ordered_dynamic_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_NEXT,
+ "GOMP_loop_ordered_guided_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_NEXT,
+ "GOMP_loop_ordered_runtime_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START,
+ "GOMP_parallel_loop_static_start",
+ BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START,
+ "GOMP_parallel_loop_dynamic_start",
+ BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START,
+ "GOMP_parallel_loop_guided_start",
+ BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START,
+ "GOMP_parallel_loop_runtime_start",
+ BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_END, "GOMP_loop_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_END_NOWAIT, "GOMP_loop_end_nowait",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_ORDERED_START, "GOMP_ordered_start",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_ORDERED_END, "GOMP_ordered_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_START, "GOMP_parallel_start",
+ BT_FN_VOID_OMPFN_PTR_UINT, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_END, "GOMP_parallel_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SECTIONS_START, "GOMP_sections_start",
+ BT_FN_VOID_UINT_UINT, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SECTIONS_NEXT, "GOMP_sections_next",
+ BT_FN_UINT, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_SECTIONS_START,
+ "GOMP_parallel_sections_start",
+ BT_FN_VOID_OMPFN_PTR_UINT_UINT, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SECTIONS_END, "GOMP_sections_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SECTIONS_END_NOWAIT,
+ "GOMP_sections_end_nowait",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SINGLE_START, "GOMP_single_start",
+ BT_FN_BOOL, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SINGLE_COPY_START, "GOMP_single_copy_start",
+ BT_FN_PTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SINGLE_COPY_END, "GOMP_single_copy_end",
+ BT_FN_VOID_PTR, ATTR_NOTHROW_LIST)
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.634.4.3
diff -u -p -r1.634.4.3 c-common.c
--- c-common.c 2 Sep 2005 03:36:56 -0000 1.634.4.3
+++ c-common.c 21 Sep 2005 23:36:07 -0000
@@ -2920,8 +2920,8 @@ c_common_nodes_and_builtins (void)
#define DEF_FUNCTION_TYPE_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
#define DEF_FUNCTION_TYPE_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
#define DEF_FUNCTION_TYPE_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) NAME,
-#define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
- NAME,
+#define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) NAME,
+#define DEF_FUNCTION_TYPE_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) NAME,
#define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME,
#define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME,
#define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME,
@@ -2939,6 +2939,7 @@ c_common_nodes_and_builtins (void)
#undef DEF_FUNCTION_TYPE_4
#undef DEF_FUNCTION_TYPE_5
#undef DEF_FUNCTION_TYPE_6
+#undef DEF_FUNCTION_TYPE_7
#undef DEF_FUNCTION_TYPE_VAR_0
#undef DEF_FUNCTION_TYPE_VAR_1
#undef DEF_FUNCTION_TYPE_VAR_2
@@ -3229,6 +3230,28 @@ c_common_nodes_and_builtins (void)
tree_cons (NULL_TREE, \
builtin_types[(int) ARG6],\
void_list_node)))))));
+#define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
+ ARG6, ARG7) \
+ builtin_types[(int) ENUM] \
+ = build_function_type \
+ (builtin_types[(int) RETURN], \
+ tree_cons (NULL_TREE, \
+ builtin_types[(int) ARG1], \
+ tree_cons (NULL_TREE, \
+ builtin_types[(int) ARG2], \
+ tree_cons \
+ (NULL_TREE, \
+ builtin_types[(int) ARG3], \
+ tree_cons \
+ (NULL_TREE, \
+ builtin_types[(int) ARG4], \
+ tree_cons (NULL_TREE, \
+ builtin_types[(int) ARG5], \
+ tree_cons (NULL_TREE, \
+ builtin_types[(int) ARG6],\
+ tree_cons (NULL_TREE, \
+ builtin_types[(int) ARG6], \
+ void_list_node))))))));
#define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \
builtin_types[(int) ENUM] \
= build_function_type (builtin_types[(int) RETURN], NULL_TREE);
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.294.4.2
diff -u -p -r1.294.4.2 c-common.h
--- c-common.h 28 Jul 2005 19:28:20 -0000 1.294.4.2
+++ c-common.h 21 Sep 2005 23:36:07 -0000
@@ -295,6 +295,7 @@ extern tree push_stmt_list (void);
extern tree pop_stmt_list (tree);
extern tree add_stmt (tree);
extern void push_cleanup (tree, tree, bool);
+extern tree pushdecl_top_level (tree);
extern int c_expand_decl (tree);
@@ -927,6 +928,14 @@ extern void pp_file_change (const struct
extern void pp_dir_change (cpp_reader *, const char *);
extern bool check_missing_format_attribute (tree, tree);
+/* In c-omp.c */
+extern void c_finish_omp_master (tree);
+extern void c_finish_omp_critical (tree, tree);
+extern void c_finish_omp_ordered (tree);
+extern void c_finish_omp_barrier (void);
+extern void c_finish_omp_atomic (tree);
+extern void c_finish_omp_flush (void);
+
/* In order for the format checking to accept the C frontend
diagnostic framework extensions, you must include this file before
toplev.h, not after. The C front end formats are a subset of those
Index: c-omp.c
===================================================================
RCS file: c-omp.c
diff -N c-omp.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ c-omp.c 21 Sep 2005 23:36:07 -0000
@@ -0,0 +1,296 @@
+/* This file contains routines to construct GNU OpenMP constructs,
+ called from parsing in the C and C++ front ends.
+
+ Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>,
+ Diego Novillo <dnovillo@redhat.com>.
+
+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 2, 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 COPYING. If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "function.h"
+#include "c-common.h"
+#include "toplev.h"
+#include "tree-gimple.h"
+
+
+/* Complete a #pragma omp master construct. STMT is the structured-block
+ that follows the pragma. In this case all we need to do is wrap the
+ block in a conditional that verifies that this is the master thread for
+ the parallel team. */
+
+void
+c_finish_omp_master (tree stmt)
+{
+ tree x;
+
+ x = built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM];
+ x = build_function_call_expr (x, NULL);
+ x = build2 (EQ_EXPR, boolean_type_node, x, integer_zero_node);
+ x = build3 (COND_EXPR, void_type_node, x, stmt, NULL);
+ add_stmt (x);
+}
+
+
+/* Complete a #pragma omp critical construct. STMT is the structured-block
+ that follows the pragma, NAME is the identifier in the pragma, or null
+ if it was omitted. */
+
+void
+c_finish_omp_critical (tree stmt, tree name)
+{
+ tree lock, unlock;
+
+ if (name)
+ {
+ char *new_str;
+ tree decl, args;
+
+ new_str = ACONCAT ((".gomp_critical_user_",
+ IDENTIFIER_POINTER (name), NULL));
+ name = get_identifier (new_str);
+ decl = identifier_global_value (name);
+ if (decl == NULL)
+ {
+ decl = build_decl (VAR_DECL, name, ptr_type_node);
+ TREE_PUBLIC (decl) = 1;
+ TREE_STATIC (decl) = 1;
+ DECL_COMMON (decl) = 1;
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_IGNORED_P (decl) = 1;
+ decl = pushdecl_top_level (decl);
+ }
+
+ args = tree_cons (NULL, build_fold_addr_expr (decl), NULL);
+ lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_START];
+ lock = build_function_call_expr (lock, args);
+
+ args = tree_cons (NULL, build_fold_addr_expr (decl), NULL);
+ unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_END];
+ unlock = build_function_call_expr (unlock, args);
+ }
+ else
+ {
+ lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_START];
+ lock = build_function_call_expr (lock, NULL);
+
+ unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_END];
+ unlock = build_function_call_expr (unlock, NULL);
+ }
+
+ add_stmt (lock);
+ add_stmt (stmt);
+ add_stmt (unlock);
+}
+
+
+/* Complete a #pragma omp ordered construct. STMT is the structured-block
+ that follows the pragma. */
+
+void
+c_finish_omp_ordered (tree stmt)
+{
+ tree x;
+
+ x = built_in_decls[BUILT_IN_GOMP_ORDERED_START];
+ x = build_function_call_expr (x, NULL);
+ add_stmt (x);
+
+ add_stmt (stmt);
+
+ x = built_in_decls[BUILT_IN_GOMP_ORDERED_END];
+ x = build_function_call_expr (x, NULL);
+ add_stmt (x);
+}
+
+
+/* Complete a #pragma omp barrier construct. */
+
+void
+c_finish_omp_barrier (void)
+{
+ tree x;
+
+ x = built_in_decls[BUILT_IN_GOMP_BARRIER];
+ x = build_function_call_expr (x, NULL);
+ add_stmt (x);
+}
+
+
+/* Complete a #pragma omp atomic construct. The expression to be
+ implemented atomically is LHS code= RHS. */
+
+void
+c_finish_omp_atomic (tree expr)
+{
+ tree lhs, rhs, decl, x, y;
+ enum tree_code code;
+ tree oldval, newval, rhsval, lhsaddr, type, label;
+
+ switch (TREE_CODE (expr))
+ {
+ case PREINCREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ code = PLUS_EXPR;
+ lhs = TREE_OPERAND (expr, 0);
+ rhs = fold_convert (TREE_TYPE (lhs), integer_one_node);
+ break;
+
+ case PREDECREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ code = MINUS_EXPR;
+ lhs = TREE_OPERAND (expr, 0);
+ rhs = fold_convert (TREE_TYPE (lhs), integer_one_node);
+ break;
+
+ case MODIFY_EXPR:
+ lhs = TREE_OPERAND (expr, 0);
+ expr = TREE_OPERAND (expr, 1);
+ code = TREE_CODE (expr);
+ switch (code)
+ {
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ case BIT_AND_EXPR:
+ case BIT_IOR_EXPR:
+ case BIT_XOR_EXPR:
+ case MULT_EXPR:
+ case TRUNC_DIV_EXPR:
+ case RDIV_EXPR:
+ case LSHIFT_EXPR:
+ case RSHIFT_EXPR:
+ x = TREE_OPERAND (expr, 0);
+ y = TREE_OPERAND (expr, 1);
+ break;
+
+ default:
+ goto invalid;
+ }
+
+ if (operand_equal_p (lhs, x, 0))
+ ;
+ else if (commutative_tree_code (code)
+ && operand_equal_p (lhs, rhs, 0))
+ rhs = x;
+ else
+ goto invalid;
+ break;
+
+ default:
+ goto invalid;
+ }
+
+ /* ??? The OpenMP spec appears to allow floating-point types. */
+ type = TREE_TYPE (lhs);
+ if (!INTEGRAL_TYPE_P (type))
+ goto invalid;
+
+ lhsaddr = build_unary_op (ADDR_EXPR, lhs, 0);
+
+ switch (code)
+ {
+ case PLUS_EXPR:
+ decl = built_in_decls[BUILT_IN_FETCH_AND_ADD_N];
+ goto do_fetch_op;
+ case MINUS_EXPR:
+ decl = built_in_decls[BUILT_IN_FETCH_AND_SUB_N];
+ goto do_fetch_op;
+ case BIT_AND_EXPR:
+ decl = built_in_decls[BUILT_IN_FETCH_AND_AND_N];
+ goto do_fetch_op;
+ case BIT_IOR_EXPR:
+ decl = built_in_decls[BUILT_IN_FETCH_AND_OR_N];
+ goto do_fetch_op;
+ case BIT_XOR_EXPR:
+ decl = built_in_decls[BUILT_IN_FETCH_AND_XOR_N];
+ goto do_fetch_op;
+
+ do_fetch_op:
+ y = tree_cons (NULL, rhs, NULL);
+ y = tree_cons (NULL, lhsaddr, y);
+ x = resolve_overloaded_builtin (decl, y);
+ add_stmt (x);
+ return;
+
+ default:
+ break;
+ }
+
+ /* In these cases, we don't have specialized __sync builtins,
+ so we need to implement a compare and swap loop. */
+
+ oldval = create_tmp_var_raw (type, NULL);
+ newval = create_tmp_var_raw (type, NULL);
+ rhsval = create_tmp_var_raw (type, NULL);
+ label = create_artificial_label ();
+ lhsaddr = save_expr (lhsaddr);
+
+ x = build_fold_indirect_ref (lhsaddr);
+ x = build2 (MODIFY_EXPR, void_type_node, oldval, x);
+ add_stmt (x);
+
+ if (TREE_CONSTANT (rhs))
+ rhsval = rhs;
+ else
+ {
+ x = build2 (MODIFY_EXPR, void_type_node, rhsval, rhs);
+ add_stmt (x);
+ }
+
+ add_stmt (build_stmt (LABEL_EXPR, label));
+
+ x = build2 (code, type, oldval, rhsval);
+ x = build2 (MODIFY_EXPR, void_type_node, newval, x);
+ add_stmt (x);
+
+ y = tree_cons (NULL, newval, NULL);
+ y = tree_cons (NULL, oldval, y);
+ y = tree_cons (NULL, lhsaddr, y);
+ decl = built_in_decls[BUILT_IN_VAL_COMPARE_AND_SWAP_N];
+ x = resolve_overloaded_builtin (decl, y);
+ x = build2 (MODIFY_EXPR, void_type_node, oldval, x);
+ add_stmt (x);
+
+ x = build2 (NE_EXPR, boolean_type_node, oldval, newval);
+ y = build1 (GOTO_EXPR, void_type_node, label);
+ x = build3 (COND_EXPR, void_type_node, x, y, NULL);
+ add_stmt (x);
+ return;
+
+ invalid:
+ error ("invalid expression for %<omp atomic%>");
+ add_stmt (expr);
+}
+
+
+/* Complete a #pragma omp flush construct. We don't do anything with the
+ variable list that the syntax allows. */
+
+void
+c_finish_omp_flush (void)
+{
+ tree x;
+
+ x = built_in_decls[BUILT_IN_SYNCHRONIZE];
+ x = build_function_call_expr (x, NULL);
+ add_stmt (x);
+}
Index: c-parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parser.c,v
retrieving revision 2.17.4.7
diff -u -p -r2.17.4.7 c-parser.c
--- c-parser.c 21 Sep 2005 13:12:36 -0000 2.17.4.7
+++ c-parser.c 21 Sep 2005 23:36:07 -0000
@@ -195,20 +195,17 @@ static const struct resword reswords[] =
#define N_reswords (sizeof reswords / sizeof (struct resword))
/* Handlers for parsing OpenMP pragmas. */
-static void c_parser_pragma_omp_atomic (cpp_reader *);
-static void c_parser_pragma_omp_barrier (cpp_reader *);
static void c_parser_pragma_omp_critical (cpp_reader *);
static void c_parser_pragma_omp_flush (cpp_reader *);
static void c_parser_pragma_omp_for (cpp_reader *);
-static void c_parser_pragma_omp_master (cpp_reader *);
-static void c_parser_pragma_omp_ordered (cpp_reader *);
static void c_parser_pragma_omp_parallel (cpp_reader *);
static void c_parser_pragma_omp_section (cpp_reader *);
static void c_parser_pragma_omp_sections (cpp_reader *);
static void c_parser_pragma_omp_single (cpp_reader *);
static void c_parser_pragma_omp_threadprivate (cpp_reader *);
+static void c_parser_pragma_omp_no_args (cpp_reader *);
-/* All OpenMP pragmas. OpenMP draft 2.5. */
+/* All OpenMP pragmas. OpenMP 2.5. */
typedef enum pragma_omp_kind {
PRAGMA_OMP_NONE = 0,
@@ -229,7 +226,7 @@ typedef enum pragma_omp_kind {
} pragma_omp_kind;
-/* All OpenMP clauses. OpenMP draft 2.5. */
+/* All OpenMP clauses. OpenMP 2.5. */
typedef enum pragma_omp_clause {
PRAGMA_OMP_CLAUSE_NONE = 0,
@@ -283,13 +280,13 @@ c_parse_init (void)
/* we want to handle deferred pragmas */
cpp_get_options (parse_in)->defer_pragmas = true;
- c_register_pragma ("omp", "atomic", c_parser_pragma_omp_atomic);
- c_register_pragma ("omp", "barrier", c_parser_pragma_omp_barrier);
+ c_register_pragma ("omp", "atomic", c_parser_pragma_omp_no_args);
+ c_register_pragma ("omp", "barrier", c_parser_pragma_omp_no_args);
c_register_pragma ("omp", "critical", c_parser_pragma_omp_critical);
c_register_pragma ("omp", "flush", c_parser_pragma_omp_flush);
c_register_pragma ("omp", "for", c_parser_pragma_omp_for);
- c_register_pragma ("omp", "master", c_parser_pragma_omp_master);
- c_register_pragma ("omp", "ordered", c_parser_pragma_omp_ordered);
+ c_register_pragma ("omp", "master", c_parser_pragma_omp_no_args);
+ c_register_pragma ("omp", "ordered", c_parser_pragma_omp_no_args);
c_register_pragma ("omp", "parallel", c_parser_pragma_omp_parallel);
c_register_pragma ("omp", "section", c_parser_pragma_omp_section);
c_register_pragma ("omp", "sections", c_parser_pragma_omp_sections);
@@ -3573,9 +3570,6 @@ c_parser_compound_statement_nostart (c_p
else
goto statement;
}
- else if (c_parser_peek_token (parser)->omp_kind == PRAGMA_OMP_BARRIER
- || c_parser_peek_token (parser)->omp_kind == PRAGMA_OMP_FLUSH)
- c_parser_pragma (parser);
else
{
statement:
@@ -3767,10 +3761,10 @@ c_parser_statement (c_parser *parser)
c_parser_statement_after_labels (parser);
}
-static void c_parser_omp_directive (c_parser *parser);
-
/* Parse a statement, other than a labeled statement. */
+static void c_parser_omp_directive (c_parser *parser);
+
static void
c_parser_statement_after_labels (c_parser *parser)
{
@@ -6571,7 +6565,7 @@ c_parser_objc_keywordexpr (c_parser *par
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
section-scope:
{ section-sequence }
@@ -6616,7 +6610,7 @@ c_parser_section_scope (c_parser *parser
static void
c_parser_omp_directive (c_parser *parser)
{
- tree stmt;
+ tree stmt, clause;
enum pragma_omp_kind code = c_parser_peek_token (parser)->omp_kind;
/* Parse the pragma header. */
@@ -6630,13 +6624,6 @@ c_parser_omp_directive (c_parser *parser
stmt));
break;
- case PRAGMA_OMP_CRITICAL:
- case PRAGMA_OMP_MASTER:
- case PRAGMA_OMP_ORDERED:
- case PRAGMA_OMP_SINGLE:
- c_parser_statement (parser);
- break;
-
case PRAGMA_OMP_FOR:
case PRAGMA_OMP_PARALLEL_FOR:
if (c_parser_next_token_is_keyword (parser, RID_FOR))
@@ -6650,6 +6637,45 @@ c_parser_omp_directive (c_parser *parser
add_stmt (c_parser_section_scope (parser));
break;
+ case PRAGMA_OMP_SINGLE:
+ c_parser_statement (parser);
+ break;
+
+ case PRAGMA_OMP_MASTER:
+ stmt = push_stmt_list ();
+ c_parser_statement (parser);
+ stmt = pop_stmt_list (stmt);
+ c_finish_omp_master (stmt);
+ break;
+
+ case PRAGMA_OMP_CRITICAL:
+ clause = curr_clause_set;
+ stmt = push_stmt_list ();
+ c_parser_statement (parser);
+ stmt = pop_stmt_list (stmt);
+ c_finish_omp_critical (stmt, clause);
+ break;
+
+ case PRAGMA_OMP_ORDERED:
+ stmt = push_stmt_list ();
+ c_parser_statement (parser);
+ stmt = pop_stmt_list (stmt);
+ c_finish_omp_ordered (stmt);
+ break;
+
+ case PRAGMA_OMP_BARRIER:
+ c_finish_omp_barrier ();
+ break;
+
+ case PRAGMA_OMP_ATOMIC:
+ c_finish_omp_atomic (c_parser_expr_no_commas (parser, NULL).value);
+ c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
+ break;
+
+ case PRAGMA_OMP_FLUSH:
+ c_finish_omp_flush ();
+ break;
+
default:
c_finish_expr_stmt (c_parser_expression (parser).value);
}
@@ -6738,7 +6764,7 @@ c_parser_pragma_omp_clause (c_parser *pa
return result;
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
variable-list:
identifier
variable-list , identifier */
@@ -6775,7 +6801,7 @@ c_parser_pragma_omp_variable_list (c_par
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
copyin ( variable-list ) */
static void
@@ -6789,7 +6815,7 @@ c_parser_pragma_omp_clause_copyin (c_par
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
copyprivate ( variable-list ) */
static void
@@ -6803,7 +6829,7 @@ c_parser_pragma_omp_clause_copyprivate (
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
default ( shared | none ) */
static void
@@ -6841,7 +6867,7 @@ c_parser_pragma_omp_clause_default (c_pa
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
firstprivate ( variable-list ) */
static void
@@ -6855,7 +6881,7 @@ c_parser_pragma_omp_clause_firstprivate
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
if ( expression ) */
static void
@@ -6875,7 +6901,7 @@ c_parser_pragma_omp_clause_if (c_parser
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
lastprivate ( variable-list ) */
static void
@@ -6889,7 +6915,7 @@ c_parser_pragma_omp_clause_lastprivate (
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
nowait */
static void
@@ -6898,7 +6924,7 @@ c_parser_pragma_omp_clause_nowait (c_par
printf ("nowait\n");
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
num_threads ( expression ) */
static void
@@ -6923,7 +6949,7 @@ c_parser_pragma_omp_clause_num_threads (
printf ("\n");
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
ordered */
static void
@@ -6932,7 +6958,7 @@ c_parser_pragma_omp_clause_ordered (c_pa
printf ("ordered\n");
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
private ( variable-list ) */
static void
@@ -6946,7 +6972,7 @@ c_parser_pragma_omp_clause_private (c_pa
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
reduction ( reduction-operator : variable-list )
reduction-operator:
@@ -7001,7 +7027,7 @@ c_parser_pragma_omp_clause_reduction (c_
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
schedule ( schedule-kind )
schedule ( schedule-kind , expression )
@@ -7076,7 +7102,7 @@ c_parser_pragma_omp_clause_schedule (c_p
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
shared ( variable-list ) */
static void
@@ -7103,34 +7129,21 @@ static GTY (()) c_parser *the_parser;
/* OpenMP pragma handlers. */
-/* OpenMP draft 2.5:
- # pragma omp atomic new-line */
+/* OpenMP 2.5
+ # pragma omp atomic new-line
+ # pragma omp barrier new-line
+ # pragma omp master new-line
+ # pragma omp ordered new-line
+*/
static void
-c_parser_pragma_omp_atomic (cpp_reader *pfile ATTRIBUTE_UNUSED)
+c_parser_pragma_omp_no_args (cpp_reader *pfile ATTRIBUTE_UNUSED)
{
- printf ("#pragma omp atomic");
-
if (c_parser_next_token_is_not (the_parser, CPP_EOF))
c_parser_error (the_parser, "expected new-line");
}
-
-/* OpenMP draft 2.5:
- # pragma omp barrier new-line */
-
-static void
-c_parser_pragma_omp_barrier (cpp_reader *pfile ATTRIBUTE_UNUSED)
-{
- printf ("#pragma omp barrier\n");
-
- if (c_parser_next_token_is_not (the_parser, CPP_EOF))
- {
- c_parser_error (the_parser, "expected new-line");
- }
-}
-
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
# pragma omp critical region-phrase[opt] new-line
region-phrase:
@@ -7139,15 +7152,13 @@ c_parser_pragma_omp_barrier (cpp_reader
static void
c_parser_pragma_omp_critical (cpp_reader *pfile ATTRIBUTE_UNUSED)
{
- printf ("#pragma omp critical\n");
-
+ curr_clause_set = NULL;
if (c_parser_next_token_is (the_parser, CPP_OPEN_PAREN))
{
c_parser_consume_token (the_parser);
if (c_parser_next_token_is (the_parser, CPP_NAME))
{
- printf ("region-phrase: %s\n",
- IDENTIFIER_POINTER (c_parser_peek_token (the_parser)->value));
+ curr_clause_set = c_parser_peek_token (the_parser)->value;
c_parser_consume_token (the_parser);
c_parser_require (the_parser, CPP_CLOSE_PAREN, "expected %<)%>");
}
@@ -7164,7 +7175,7 @@ c_parser_pragma_omp_critical (cpp_reader
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
# pragma omp flush flush-vars[opt] new-line
flush-vars:
@@ -7173,8 +7184,6 @@ c_parser_pragma_omp_critical (cpp_reader
static void
c_parser_pragma_omp_flush (cpp_reader *pfile ATTRIBUTE_UNUSED)
{
- printf ("#pragma omp flush\n");
-
if (c_parser_next_token_is (the_parser, CPP_OPEN_PAREN))
{
c_parser_consume_token (the_parser);
@@ -7183,12 +7192,10 @@ c_parser_pragma_omp_flush (cpp_reader *p
}
if (c_parser_next_token_is_not (the_parser, CPP_EOF))
- {
- c_parser_error (the_parser, "expected new-line");
- }
+ c_parser_error (the_parser, "expected new-line");
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
# pragma omp for for-clause[optseq] */
static void
@@ -7230,36 +7237,7 @@ c_parser_pragma_omp_for (cpp_reader *pfi
}
}
-/* OpenMP draft 2.5
- # pragma omp master new-line */
-
-static void
-c_parser_pragma_omp_master (cpp_reader *pfile ATTRIBUTE_UNUSED)
-{
- printf ("#pragma omp master\n");
-
- if (c_parser_next_token_is_not (the_parser, CPP_EOF))
- {
- c_parser_error (the_parser, "expected new-line");
- }
-}
-
-/* OpenMP draft 2.5:
- # pragma omp ordered new-line */
-
-static void
-c_parser_pragma_omp_ordered (cpp_reader *pfile ATTRIBUTE_UNUSED)
-{
- printf ("#pragma omp ordered\n");
-
- if (c_parser_next_token_is_not (the_parser, CPP_EOF))
- {
- c_parser_error (the_parser, "expected new-line");
- }
-}
-
-
-/* OpenMP draft 2.5.
+/* OpenMP 2.5.
# pragma omp parallel for parallel-for-clause[optseq] new-line */
@@ -7313,7 +7291,7 @@ c_parser_pragma_omp_parallel_for (c_pars
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
#pragma omp parallel sections parallel-sections-clause[optseq] new-line */
@@ -7361,7 +7339,7 @@ c_parser_pragma_omp_parallel_sections (c
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
#pragma omp parallel parallel-clause[optseq] new-line
#pragma omp parallel for parallel-for-clause[optseq] new-line
@@ -7428,7 +7406,7 @@ c_parser_pragma_omp_parallel (cpp_reader
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
# pragma omp section new-line */
static void
@@ -7442,7 +7420,7 @@ c_parser_pragma_omp_section (cpp_reader
}
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
# pragma omp sections sections-clause[optseq] */
static void
@@ -7479,7 +7457,7 @@ c_parser_pragma_omp_sections (cpp_reader
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
# pragma omp single single-clause[optseq] new-line */
static void
@@ -7513,7 +7491,7 @@ c_parser_pragma_omp_single (cpp_reader *
}
-/* OpenMP draft 2.5:
+/* OpenMP 2.5:
# pragma omp threadprivate (variable-list) */
static void
Index: c-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-tree.h,v
retrieving revision 1.203.4.2
diff -u -p -r1.203.4.2 c-tree.h
--- c-tree.h 28 Jul 2005 19:28:31 -0000 1.203.4.2
+++ c-tree.h 21 Sep 2005 23:36:07 -0000
@@ -459,7 +459,6 @@ extern void pending_xref_error (void);
extern void c_push_function_context (struct function *);
extern void c_pop_function_context (struct function *);
extern void push_parm_decl (const struct c_parm *);
-extern tree pushdecl_top_level (tree);
extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
struct c_declarator *,
bool);