blob: f61fe59d1f4e363b6acdede6d7acfb4fe63ff4f6 [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#if HOST_LIBRARY
12#include "offload_host.h"
13#include "offload_myo_host.h"
14#else
15#include "offload_target.h"
16#include "offload_myo_target.h"
17#endif
18
19#ifdef TARGET_WINNT
20#define ALLOCATE(name) __declspec(allocate(name))
21#else // TARGET_WINNT
22#define ALLOCATE(name) __attribute__((section(name)))
23#endif // TARGET_WINNT
24
25// offload entry table
26ALLOCATE(OFFLOAD_ENTRY_TABLE_SECTION_END)
27#ifdef TARGET_WINNT
28__declspec(align(sizeof(FuncTable::Entry)))
29#endif // TARGET_WINNT
30static FuncTable::Entry __offload_entry_table_end = { (const char*)-1 };
31
32// offload function table
33ALLOCATE(OFFLOAD_FUNC_TABLE_SECTION_END)
34#ifdef TARGET_WINNT
35__declspec(align(sizeof(FuncTable::Entry)))
36#endif // TARGET_WINNT
37static FuncTable::Entry __offload_func_table_end = { (const char*)-1 };
38
39// data table
40ALLOCATE(OFFLOAD_VAR_TABLE_SECTION_END)
41#ifdef TARGET_WINNT
42__declspec(align(sizeof(VarTable::Entry)))
43#endif // TARGET_WINNT
44static VarTable::Entry __offload_var_table_end = { (const char*)-1 };
45
46#ifdef MYO_SUPPORT
47
48// offload myo shared var section epilog
49ALLOCATE(OFFLOAD_MYO_SHARED_TABLE_SECTION_END)
50#ifdef TARGET_WINNT
51__declspec(align(sizeof(SharedTableEntry)))
52static SharedTableEntry __offload_myo_shared_table_end = { (const char*)-1, 0 };
53#else // TARGET_WINNT
54static SharedTableEntry __offload_myo_shared_table_end = { 0 };
55#endif // TARGET_WINNT
56
57#if HOST_LIBRARY
58// offload myo shared var init section epilog
59ALLOCATE(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END)
60#ifdef TARGET_WINNT
61__declspec(align(sizeof(InitTableEntry)))
62static InitTableEntry __offload_myo_shared_init_table_end = { (const char*)-1, 0 };
63#else // TARGET_WINNT
64static InitTableEntry __offload_myo_shared_init_table_end = { 0 };
65#endif // TARGET_WINNT
66#endif // HOST_LIBRARY
67
68// offload myo fptr section epilog
69ALLOCATE(OFFLOAD_MYO_FPTR_TABLE_SECTION_END)
70#ifdef TARGET_WINNT
71__declspec(align(sizeof(FptrTableEntry)))
72static FptrTableEntry __offload_myo_fptr_table_end = { (const char*)-1, 0, 0 };
73#else // TARGET_WINNT
74static FptrTableEntry __offload_myo_fptr_table_end = { 0 };
75#endif // TARGET_WINNT
76
77#endif // MYO_SUPPORT