[gcc]
[official-gcc.git] / libgomp / libgomp-plugin.h
blob53f9248363175324e24b98fbf1471e29667d3057
1 /* Copyright (C) 2014-2016 Free Software Foundation, Inc.
3 Contributed by Mentor Embedded.
5 This file is part of the GNU Offloading and Multi Processing Library
6 (libgomp).
8 Libgomp is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
27 /* An interface to various libgomp-internal functions for use by plugins. */
29 #ifndef LIBGOMP_PLUGIN_H
30 #define LIBGOMP_PLUGIN_H 1
32 #include <stddef.h>
33 #include <stdint.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 /* Capabilities of offloading devices. */
40 #define GOMP_OFFLOAD_CAP_SHARED_MEM (1 << 0)
41 #define GOMP_OFFLOAD_CAP_NATIVE_EXEC (1 << 1)
42 #define GOMP_OFFLOAD_CAP_OPENMP_400 (1 << 2)
43 #define GOMP_OFFLOAD_CAP_OPENACC_200 (1 << 3)
45 /* Type of offload target device. Keep in sync with include/gomp-constants.h. */
46 enum offload_target_type
48 OFFLOAD_TARGET_TYPE_HOST = 2,
49 /* OFFLOAD_TARGET_TYPE_HOST_NONSHM = 3 removed. */
50 OFFLOAD_TARGET_TYPE_NVIDIA_PTX = 5,
51 OFFLOAD_TARGET_TYPE_INTEL_MIC = 6,
52 OFFLOAD_TARGET_TYPE_HSA = 7
55 /* Auxiliary struct, used for transferring pairs of addresses from plugin
56 to libgomp. */
57 struct addr_pair
59 uintptr_t start;
60 uintptr_t end;
63 /* Miscellaneous functions. */
64 extern void *GOMP_PLUGIN_malloc (size_t) __attribute__ ((malloc));
65 extern void *GOMP_PLUGIN_malloc_cleared (size_t) __attribute__ ((malloc));
66 extern void *GOMP_PLUGIN_realloc (void *, size_t);
67 void GOMP_PLUGIN_target_task_completion (void *);
69 extern void GOMP_PLUGIN_debug (int, const char *, ...)
70 __attribute__ ((format (printf, 2, 3)));
71 extern void GOMP_PLUGIN_error (const char *, ...)
72 __attribute__ ((format (printf, 1, 2)));
73 extern void GOMP_PLUGIN_fatal (const char *, ...)
74 __attribute__ ((noreturn, format (printf, 1, 2)));
76 #ifdef __cplusplus
78 #endif
80 #endif