* gcc.dg/20150120-1.c (dg-final): Cleanup original tree dump.
[official-gcc.git] / liboffloadmic / runtime / compiler_if_host.h
blob1a7135088f622847da33b3c73ff0d907e6f5f884
1 /*
2 Copyright (c) 2014 Intel Corporation. All Rights Reserved.
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
6 are met:
8 * Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its
14 contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 /*! \file
32 \brief The interface between compiler-generated host code and runtime library
35 #ifndef COMPILER_IF_HOST_H_INCLUDED
36 #define COMPILER_IF_HOST_H_INCLUDED
38 #include "offload_host.h"
40 #define OFFLOAD_TARGET_ACQUIRE OFFLOAD_PREFIX(target_acquire)
41 #define OFFLOAD_TARGET_ACQUIRE1 OFFLOAD_PREFIX(target_acquire1)
42 #define OFFLOAD_OFFLOAD OFFLOAD_PREFIX(offload)
43 #define OFFLOAD_OFFLOAD1 OFFLOAD_PREFIX(offload1)
44 #define OFFLOAD_OFFLOAD2 OFFLOAD_PREFIX(offload2)
45 #define OFFLOAD_CALL_COUNT OFFLOAD_PREFIX(offload_call_count)
48 /*! \fn OFFLOAD_TARGET_ACQUIRE
49 \brief Attempt to acquire the target.
50 \param target_type The type of target.
51 \param target_number The device number.
52 \param is_optional Whether CPU fall-back is allowed.
53 \param status Address of variable to hold offload status.
54 \param file Filename in which this offload occurred.
55 \param line Line number in the file where this offload occurred.
57 extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE(
58 TARGET_TYPE target_type,
59 int target_number,
60 int is_optional,
61 _Offload_status* status,
62 const char* file,
63 uint64_t line
66 /*! \fn OFFLOAD_TARGET_ACQUIRE1
67 \brief Acquire the target for offload (OpenMP).
68 \param device_number Device number or null if not specified.
69 \param file Filename in which this offload occurred
70 \param line Line number in the file where this offload occurred.
72 extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE1(
73 const int* device_number,
74 const char* file,
75 uint64_t line
78 /*! \fn OFFLOAD_OFFLOAD1
79 \brief Run function on target using interface for old data persistence.
80 \param o Offload descriptor created by OFFLOAD_TARGET_ACQUIRE.
81 \param name Name of offload entry point.
82 \param is_empty If no code to execute (e.g. offload_transfer)
83 \param num_vars Number of variable descriptors.
84 \param vars Pointer to VarDesc array.
85 \param vars2 Pointer to VarDesc2 array.
86 \param num_waits Number of "wait" values.
87 \param waits Pointer to array of wait values.
88 \param signal Pointer to signal value or NULL.
90 extern "C" int OFFLOAD_OFFLOAD1(
91 OFFLOAD o,
92 const char *name,
93 int is_empty,
94 int num_vars,
95 VarDesc *vars,
96 VarDesc2 *vars2,
97 int num_waits,
98 const void** waits,
99 const void** signal
102 /*! \fn OFFLOAD_OFFLOAD2
103 \brief Run function on target using interface for new data persistence.
104 \param o Offload descriptor created by OFFLOAD_TARGET_ACQUIRE.
105 \param name Name of offload entry point.
106 \param is_empty If no code to execute (e.g. offload_transfer)
107 \param num_vars Number of variable descriptors.
108 \param vars Pointer to VarDesc array.
109 \param vars2 Pointer to VarDesc2 array.
110 \param num_waits Number of "wait" values.
111 \param waits Pointer to array of wait values.
112 \param signal Pointer to signal value or NULL.
113 \param entry_id A signature for the function doing the offload.
114 \param stack_addr The stack frame address of the function doing offload.
116 extern "C" int OFFLOAD_OFFLOAD2(
117 OFFLOAD o,
118 const char *name,
119 int is_empty,
120 int num_vars,
121 VarDesc *vars,
122 VarDesc2 *vars2,
123 int num_waits,
124 const void** waits,
125 const void** signal,
126 int entry_id,
127 const void *stack_addr
130 // Run function on target (obsolete).
131 // @param o OFFLOAD object
132 // @param name function name
133 extern "C" int OFFLOAD_OFFLOAD(
134 OFFLOAD o,
135 const char *name,
136 int is_empty,
137 int num_vars,
138 VarDesc *vars,
139 VarDesc2 *vars2,
140 int num_waits,
141 const void** waits,
142 const void* signal,
143 int entry_id = 0,
144 const void *stack_addr = NULL
147 // Global counter on host.
148 // This variable is used if P2OPT_offload_do_data_persistence == 2.
149 // The variable used to identify offload constructs contained in one procedure.
150 // Call to OFFLOAD_CALL_COUNT() is inserted at HOST on entry of the routine.
151 extern "C" int OFFLOAD_CALL_COUNT();
153 #endif // COMPILER_IF_HOST_H_INCLUDED