blob: 1af82b80a30e58e0cc149a5f04406038edd16dfd [file] [log] [blame]
Jim Cownie33f7b242014-04-09 15:40:23 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.txt for details.
7//
8//===----------------------------------------------------------------------===//
9
10
11#include "compiler_if_target.h"
12
13extern "C" void OFFLOAD_TARGET_ENTER(
14 OFFLOAD ofld,
15 int vars_total,
16 VarDesc *vars,
17 VarDesc2 *vars2
18)
19{
20 OFFLOAD_DEBUG_TRACE(3, "%s(%p, %d, %p, %p)\n", __func__, ofld,
21 vars_total, vars, vars2);
22 ofld->merge_var_descs(vars, vars2, vars_total);
23 ofld->scatter_copyin_data();
24}
25
26extern "C" void OFFLOAD_TARGET_LEAVE(
27 OFFLOAD ofld
28)
29{
30 OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, ofld);
31 ofld->gather_copyout_data();
32}
33
34extern "C" void OFFLOAD_TARGET_MAIN(void)
35{
36 // initialize target part
37 __offload_target_init();
38
39 // pass control to COI
40 PipelineStartExecutingRunFunctions();
41 ProcessWaitForShutdown();
42
43 OFFLOAD_DEBUG_TRACE(2, "Exiting main...\n");
44}