svn merge -r 217500:218679 svn+ssh://gcc.gnu.org/svn/gcc/trunk
[official-gcc.git] / libgomp / oacc-int.h
blobe2b6f7cd15ebb1bcf968d81e28f35d007ba75c99
1 /* OpenACC Runtime - internal declarations
3 Copyright (C) 2013-2014 Free Software Foundation, Inc.
5 Contributed by Mentor Embedded.
7 This file is part of the GNU OpenMP Library (libgomp).
9 Libgomp is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
14 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 more details.
19 Under Section 7 of GPL version 3, you are granted additional
20 permissions described in the GCC Runtime Library Exception, version
21 3.1, as published by the Free Software Foundation.
23 You should have received a copy of the GNU General Public License and
24 a copy of the GCC Runtime Library Exception along with this program;
25 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
26 <http://www.gnu.org/licenses/>. */
28 /* This file contains data types and function declarations that are not
29 part of the official OpenACC user interface. There are declarations
30 in here that are part of the GNU OpenACC ABI, in that the compiler is
31 required to know about them and use them.
33 The convention is that the all caps prefix "GOACC" is used group items
34 that are part of the external ABI, and the lower case prefix "goacc"
35 is used group items that are completely private to the library. */
37 #ifndef _OACC_INT_H
38 #define _OACC_INT_H 1
40 #include "openacc.h"
41 #include "config.h"
42 #include <stddef.h>
43 #include <stdbool.h>
44 #include <stdarg.h>
46 #ifdef HAVE_ATTRIBUTE_VISIBILITY
47 # pragma GCC visibility push(hidden)
48 #endif
50 static inline enum acc_device_t
51 acc_device_type (enum offload_target_type type)
53 return (enum acc_device_t) type;
56 struct goacc_thread
58 /* The device for the current thread. */
59 struct gomp_device_descr *dev;
61 struct gomp_device_descr *saved_bound_dev;
63 /* This is a linked list of data mapped by the "acc data" pragma, following
64 strictly push/pop semantics according to lexical scope. */
65 struct target_mem_desc *mapped_data;
67 /* These structures form a list: this is the next thread in that list. */
68 struct goacc_thread *next;
70 /* Target-specific data (used by plugin). */
71 void *target_tls;
74 #if defined HAVE_TLS || defined USE_EMUTLS
75 extern __thread struct goacc_thread *goacc_tls_data;
76 static inline struct goacc_thread *
77 goacc_thread (void)
79 return goacc_tls_data;
81 #else
82 extern pthread_key_t goacc_tls_key;
83 static inline struct goacc_thread *
84 goacc_thread (void)
86 return pthread_getspecific (goacc_tls_key);
88 #endif
90 struct gomp_device_descr;
92 void ACC_register (struct gomp_device_descr const *) __GOACC_NOTHROW;
94 /* Current dispatcher. */
95 extern struct gomp_device_descr const *base_dev;
97 void ACC_runtime_initialize (void);
98 void ACC_save_and_set_bind (acc_device_t);
99 void ACC_restore_bind (void);
100 void ACC_lazy_initialize (void);
102 #ifdef HAVE_ATTRIBUTE_VISIBILITY
103 # pragma GCC visibility pop
104 #endif
106 #endif /* _OACC_INT_H */