1/* Copyright (C) 2014-2015 Free Software Foundation, Inc.
2
3   Contributed by Mentor Embedded.
4
5   This file is part of the GNU Offloading and Multi Processing Library
6   (libgomp).
7
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.
12
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.
17
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.
21
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/>.  */
26
27/* An interface to various libgomp-internal functions for use by plugins.  */
28
29#ifndef LIBGOMP_PLUGIN_H
30#define LIBGOMP_PLUGIN_H 1
31
32#include <stddef.h>
33#include <stdint.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
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)
44
45/* Type of offload target device.  Keep in sync with include/gomp-constants.h.  */
46enum offload_target_type
47{
48  OFFLOAD_TARGET_TYPE_HOST = 2,
49  OFFLOAD_TARGET_TYPE_HOST_NONSHM = 3,
50  OFFLOAD_TARGET_TYPE_NVIDIA_PTX = 5,
51  OFFLOAD_TARGET_TYPE_INTEL_MIC = 6
52};
53
54/* Auxiliary struct, used for transferring pairs of addresses from plugin
55   to libgomp.  */
56struct addr_pair
57{
58  uintptr_t start;
59  uintptr_t end;
60};
61
62/* Miscellaneous functions.  */
63extern void *GOMP_PLUGIN_malloc (size_t) __attribute__ ((malloc));
64extern void *GOMP_PLUGIN_malloc_cleared (size_t) __attribute__ ((malloc));
65extern void *GOMP_PLUGIN_realloc (void *, size_t);
66
67extern void GOMP_PLUGIN_debug (int, const char *, ...)
68	__attribute__ ((format (printf, 2, 3)));
69extern void GOMP_PLUGIN_error (const char *, ...)
70	__attribute__ ((format (printf, 1, 2)));
71extern void GOMP_PLUGIN_fatal (const char *, ...)
72	__attribute__ ((noreturn, format (printf, 1, 2)));
73
74#ifdef __cplusplus
75}
76#endif
77
78#endif
79