summaryrefslogtreecommitdiffstats
path: root/openmp/offload/src/compiler_if_target.cpp
blob: 1af82b80a30e58e0cc149a5f04406038edd16dfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.txt for details.
//
//===----------------------------------------------------------------------===//


#include "compiler_if_target.h"

extern "C" void OFFLOAD_TARGET_ENTER(
    OFFLOAD ofld,
    int vars_total,
    VarDesc *vars,
    VarDesc2 *vars2
)
{
    OFFLOAD_DEBUG_TRACE(3, "%s(%p, %d, %p, %p)\n", __func__, ofld,
                        vars_total, vars, vars2);
    ofld->merge_var_descs(vars, vars2, vars_total);
    ofld->scatter_copyin_data();
}

extern "C" void OFFLOAD_TARGET_LEAVE(
    OFFLOAD ofld
)
{
    OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, ofld);
    ofld->gather_copyout_data();
}

extern "C" void OFFLOAD_TARGET_MAIN(void)
{
    // initialize target part
    __offload_target_init();

    // pass control to COI
    PipelineStartExecutingRunFunctions();
    ProcessWaitForShutdown();

    OFFLOAD_DEBUG_TRACE(2, "Exiting main...\n");
}
OpenPOWER on IntegriCloud