PR c++/64359
[official-gcc.git] / liboffloadmic / runtime / offload_myo_host.h
blob1116ee3601ea9eda3e2d99766fd820ed2581f2de
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 #ifndef OFFLOAD_MYO_HOST_H_INCLUDED
32 #define OFFLOAD_MYO_HOST_H_INCLUDED
34 #include <myotypes.h>
35 #include <myoimpl.h>
36 #include <myo.h>
37 #include "offload.h"
39 typedef MyoiSharedVarEntry SharedTableEntry;
40 //typedef MyoiHostSharedFptrEntry FptrTableEntry;
41 typedef struct {
42 //! Function Name
43 const char *funcName;
44 //! Function Address
45 void *funcAddr;
46 //! Local Thunk Address
47 void *localThunkAddr;
48 #ifdef TARGET_WINNT
49 // Dummy to pad up to 32 bytes
50 void *dummy;
51 #endif // TARGET_WINNT
52 } FptrTableEntry;
54 struct InitTableEntry {
55 #ifdef TARGET_WINNT
56 // Dummy to pad up to 16 bytes
57 // Function Name
58 const char *funcName;
59 #endif // TARGET_WINNT
60 void (*func)(void);
63 #ifdef TARGET_WINNT
64 #define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable$a"
65 #define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable$z"
67 #define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START ".MyoSharedInitTable$a"
68 #define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END ".MyoSharedInitTable$z"
70 #define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable$a"
71 #define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable$z"
72 #else // TARGET_WINNT
73 #define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable."
74 #define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable."
76 #define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START ".MyoSharedInitTable."
77 #define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END ".MyoSharedInitTable."
79 #define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable."
80 #define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable."
81 #endif // TARGET_WINNT
83 #pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_START, read, write)
84 #pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_END, read, write)
86 #pragma section(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START, read, write)
87 #pragma section(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END, read, write)
89 #pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_START, read, write)
90 #pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_END, read, write)
92 extern "C" void __offload_myoRegisterTables(
93 InitTableEntry *init_table,
94 SharedTableEntry *shared_table,
95 FptrTableEntry *fptr_table
98 extern void __offload_myoFini(void);
100 #endif // OFFLOAD_MYO_HOST_H_INCLUDED