Jim Cownie | 33f7b24 | 2014-04-09 15:40:23 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 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 |
| 26 | ALLOCATE(OFFLOAD_ENTRY_TABLE_SECTION_END) |
| 27 | #ifdef TARGET_WINNT |
| 28 | __declspec(align(sizeof(FuncTable::Entry))) |
| 29 | #endif // TARGET_WINNT |
| 30 | static FuncTable::Entry __offload_entry_table_end = { (const char*)-1 }; |
| 31 | |
| 32 | // offload function table |
| 33 | ALLOCATE(OFFLOAD_FUNC_TABLE_SECTION_END) |
| 34 | #ifdef TARGET_WINNT |
| 35 | __declspec(align(sizeof(FuncTable::Entry))) |
| 36 | #endif // TARGET_WINNT |
| 37 | static FuncTable::Entry __offload_func_table_end = { (const char*)-1 }; |
| 38 | |
| 39 | // data table |
| 40 | ALLOCATE(OFFLOAD_VAR_TABLE_SECTION_END) |
| 41 | #ifdef TARGET_WINNT |
| 42 | __declspec(align(sizeof(VarTable::Entry))) |
| 43 | #endif // TARGET_WINNT |
| 44 | static VarTable::Entry __offload_var_table_end = { (const char*)-1 }; |
| 45 | |
| 46 | #ifdef MYO_SUPPORT |
| 47 | |
| 48 | // offload myo shared var section epilog |
| 49 | ALLOCATE(OFFLOAD_MYO_SHARED_TABLE_SECTION_END) |
| 50 | #ifdef TARGET_WINNT |
| 51 | __declspec(align(sizeof(SharedTableEntry))) |
| 52 | static SharedTableEntry __offload_myo_shared_table_end = { (const char*)-1, 0 }; |
| 53 | #else // TARGET_WINNT |
| 54 | static SharedTableEntry __offload_myo_shared_table_end = { 0 }; |
| 55 | #endif // TARGET_WINNT |
| 56 | |
| 57 | #if HOST_LIBRARY |
| 58 | // offload myo shared var init section epilog |
| 59 | ALLOCATE(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END) |
| 60 | #ifdef TARGET_WINNT |
| 61 | __declspec(align(sizeof(InitTableEntry))) |
| 62 | static InitTableEntry __offload_myo_shared_init_table_end = { (const char*)-1, 0 }; |
| 63 | #else // TARGET_WINNT |
| 64 | static InitTableEntry __offload_myo_shared_init_table_end = { 0 }; |
| 65 | #endif // TARGET_WINNT |
| 66 | #endif // HOST_LIBRARY |
| 67 | |
| 68 | // offload myo fptr section epilog |
| 69 | ALLOCATE(OFFLOAD_MYO_FPTR_TABLE_SECTION_END) |
| 70 | #ifdef TARGET_WINNT |
| 71 | __declspec(align(sizeof(FptrTableEntry))) |
| 72 | static FptrTableEntry __offload_myo_fptr_table_end = { (const char*)-1, 0, 0 }; |
| 73 | #else // TARGET_WINNT |
| 74 | static FptrTableEntry __offload_myo_fptr_table_end = { 0 }; |
| 75 | #endif // TARGET_WINNT |
| 76 | |
| 77 | #endif // MYO_SUPPORT |