[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gomp-discuss] Work in progress ....
From: |
Pop Sébastian |
Subject: |
Re: [Gomp-discuss] Work in progress .... |
Date: |
Mon, 19 May 2003 11:47:12 +0200 |
User-agent: |
Mutt/1.4i |
Hi,
I gathered some examples from a google search (search for "#pragma omp" and
you'll get the same result).
http://icps.u-strasbg.fr/~pop/omp_examples.tar.gz
For the omp directives parsing here is what I have for the moment:
it just recognizes that it's an omp pragma and switches its directive_name.
Following the discussion from address@hidden we should transform the
entire line into something that looks like a function call:
#pragma omp flush (x)
to
__builtin_omp_flush (x);
But then what happens when we're given something like that:
#pragma omp parallel shared (j, sum) private (i) schedule (runtime)
Would it be transformed into
__builtin_omp_parallel (shared (j, sum), private (i), schedule (runtime));
?
Index: c-pragma.c
===================================================================
RCS file: /home/pop/cvsroot/gcc-cvs/gcc/gcc/c-pragma.c,v
retrieving revision 1.53.2.4
diff -d -u -p -r1.53.2.4 c-pragma.c
--- c-pragma.c 3 Feb 2003 17:08:24 -0000 1.53.2.4
+++ c-pragma.c 17 May 2003 19:32:45 -0000
@@ -260,6 +260,36 @@ handle_pragma_pack (dummy)
static GTY(()) tree pending_weaks;
+static void handle_pragma_omp PARAMS ((cpp_reader *));
+
+/* #pragma omp directive-name [clause[ [,] clause]...] */
+static void
+handle_pragma_omp (dummy)
+ cpp_reader *dummy ATTRIBUTE_UNUSED;
+{
+ tree directive_name;
+ const char *directive_str;
+ enum cpp_ttype t;
+
+ fprintf (stdout, "Looking at a OMP pragmata. \n");
+
+ t = c_lex (&directive_name);
+
+ /* Expect the directive_name to be a name. */
+ if (t != CPP_NAME)
+ GCC_BAD ("malformed #pragma omp, ignored");
+
+ debug_tree (directive_name);
+
+ directive_str = IDENTIFIER_POINTER (directive_name);
+
+ fprintf (stdout, "Directive: ");
+ if (strcmp (directive_str, "parallel") == 0)
+ fprintf (stdout, "parallel.\n");
+ /* ... */
+}
+
+
#ifdef HANDLE_PRAGMA_WEAK
static void apply_pragma_weak PARAMS ((tree, tree));
static void handle_pragma_weak PARAMS ((cpp_reader *));
@@ -498,6 +528,7 @@ c_register_pragma (space, name, handler)
void
init_pragma ()
{
+ c_register_pragma (0, "omp", handle_pragma_omp);
#ifdef HANDLE_PRAGMA_PACK
c_register_pragma (0, "pack", handle_pragma_pack);
#endif