This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gomp4 6/9] OpenACC: Infrastructure for builtins.


From: Thomas Schwinge <thomas@codesourcery.com>

	gcc/
	* oacc-builtins.def: New file.
	* Makefile.in (BUILTINS_DEF): Add oacc-builtins.def.
	* builtins.def (DEF_GOACC_BUILTIN): New macro.
	Include "oacc-builtins.def".
	gcc/fortran/
	* f95-lang.c (DEF_GOACC_BUILTIN): New macro.
	Include "../oacc-builtins.def".
	libgomp/
	* libgomp.map (GOACC_2.0): New symbol version.
---
 gcc/Makefile.in        |  3 ++-
 gcc/builtins.def       | 10 ++++++++++
 gcc/fortran/f95-lang.c | 10 ++++++++++
 gcc/oacc-builtins.def  | 28 ++++++++++++++++++++++++++++
 libgomp/libgomp.map    |  3 +++
 5 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 gcc/oacc-builtins.def

diff --git gcc/Makefile.in gcc/Makefile.in
index cc88fb8..0511097 100644
--- gcc/Makefile.in
+++ gcc/Makefile.in
@@ -871,7 +871,8 @@ FIXED_VALUE_H = fixed-value.h $(MACHMODE_H) double-int.h
 RTL_H = $(RTL_BASE_H) $(FLAGS_H) genrtl.h
 READ_MD_H = $(OBSTACK_H) $(HASHTAB_H) read-md.h
 PARAMS_H = params.h params.def
-BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def \
+BUILTINS_DEF = builtins.def sync-builtins.def \
+	oacc-builtins.def omp-builtins.def \
 	gtm-builtins.def sanitizer.def cilkplus.def cilk-builtins.def
 INTERNAL_FN_DEF = internal-fn.def
 INTERNAL_FN_H = internal-fn.h $(INTERNAL_FN_DEF)
diff --git gcc/builtins.def gcc/builtins.def
index e2d8849..9a9a20a 100644
--- gcc/builtins.def
+++ gcc/builtins.def
@@ -139,6 +139,13 @@ along with GCC; see the file COPYING3.  If not see
   DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, BT_LAST, BT_LAST, false, false, \
 	       false, ATTR_LAST, false, false)
 
+/* Builtin used by the implementation of GNU OpenACC.  None of these are
+   actually implemented in the compiler; they're all in libgomp.  */
+#undef DEF_GOACC_BUILTIN
+#define DEF_GOACC_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
+  DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,    \
+               false, true, true, ATTRS, false, flag_openacc)
+
 /* 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
@@ -856,6 +863,9 @@ DEF_GCC_BUILTIN (BUILT_IN_LINE, "LINE", BT_FN_INT, ATTR_NOTHROW_LEAF_LIST)
 /* Synchronization Primitives.  */
 #include "sync-builtins.def"
 
+/* OpenACC builtins.  */
+#include "oacc-builtins.def"
+
 /* OpenMP builtins.  */
 #include "omp-builtins.def"
 
diff --git gcc/fortran/f95-lang.c gcc/fortran/f95-lang.c
index 873c137..69012b6 100644
--- gcc/fortran/f95-lang.c
+++ gcc/fortran/f95-lang.c
@@ -1035,6 +1035,16 @@ gfc_init_builtin_functions (void)
 #include "../sync-builtins.def"
 #undef DEF_SYNC_BUILTIN
 
+  if (gfc_option.gfc_flag_openacc)
+    {
+#undef DEF_GOACC_BUILTIN
+#define DEF_GOACC_BUILTIN(code, name, type, attr) \
+      gfc_define_builtin ("__builtin_" name, builtin_types[type], \
+			  code, name, attr);
+#include "../oacc-builtins.def"
+#undef DEF_GOACC_BUILTIN
+    }
+
   if (gfc_option.gfc_flag_openmp || flag_tree_parallelize_loops)
     {
 #undef DEF_GOMP_BUILTIN
diff --git gcc/oacc-builtins.def gcc/oacc-builtins.def
new file mode 100644
index 0000000..fd630e0
--- /dev/null
+++ gcc/oacc-builtins.def
@@ -0,0 +1,28 @@
+/* This file contains the definitions and documentation for the
+   OpenACC builtins used in the GNU compiler.
+
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+   Contributed by Thomas Schwinge <thomas@codesourcery.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 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/>.  */
+
+/* Before including this file, you should define a macro:
+
+     DEF_GOACC_BUILTIN (ENUM, NAME, TYPE, ATTRS)
+
+   See builtins.def for details.  */
diff --git libgomp/libgomp.map libgomp/libgomp.map
index 4f87d00..f094ed2 100644
--- libgomp/libgomp.map
+++ libgomp/libgomp.map
@@ -230,3 +230,6 @@ GOMP_4.0 {
 
 OACC_2.0 {
 };
+
+GOACC_2.0 {
+};
-- 
1.8.1.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]