eda/EDASQLite: Improved SQL Custom Functions support, now taking an arbitrary set...
[sdk] / deps / libffi-3.0.11 / src / x86 / ffitarget.h
1 /* -----------------------------------------------------------------*-C-*-
2    ffitarget.h - Copyright (c) 2012  Anthony Green
3                  Copyright (c) 1996-2003, 2010  Red Hat, Inc.
4                  Copyright (C) 2008  Free Software Foundation, Inc.
5
6    Target configuration macros for x86 and x86-64.
7
8    Permission is hereby granted, free of charge, to any person obtaining
9    a copy of this software and associated documentation files (the
10    ``Software''), to deal in the Software without restriction, including
11    without limitation the rights to use, copy, modify, merge, publish,
12    distribute, sublicense, and/or sell copies of the Software, and to
13    permit persons to whom the Software is furnished to do so, subject to
14    the following conditions:
15
16    The above copyright notice and this permission notice shall be included
17    in all copies or substantial portions of the Software.
18
19    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
20    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22    NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26    DEALINGS IN THE SOFTWARE.
27
28    ----------------------------------------------------------------------- */
29
30 #ifndef LIBFFI_TARGET_H
31 #define LIBFFI_TARGET_H
32
33 #ifndef LIBFFI_H
34 #error "Please do not include ffitarget.h directly into your source.  Use ffi.h instead."
35 #endif
36
37 /* ---- System specific configurations ----------------------------------- */
38
39 /* For code common to all platforms on x86 and x86_64. */
40 #define X86_ANY
41
42 #if defined (X86_64) && defined (__i386__)
43 #undef X86_64
44 #define X86
45 #endif
46
47 #ifdef X86_WIN64
48 #define FFI_SIZEOF_ARG 8
49 #define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */
50 #endif
51
52 /* ---- Generic type definitions ----------------------------------------- */
53
54 #ifndef LIBFFI_ASM
55 #ifdef X86_WIN64
56 #ifdef _MSC_VER
57 typedef unsigned __int64       ffi_arg;
58 typedef __int64                ffi_sarg;
59 #else
60 typedef unsigned long long     ffi_arg;
61 typedef long long              ffi_sarg;
62 #endif
63 #else
64 #if defined __x86_64__ && !defined __LP64__
65 #define FFI_SIZEOF_ARG 8
66 typedef unsigned long long     ffi_arg;
67 typedef long long              ffi_sarg;
68 #else
69 typedef unsigned long          ffi_arg;
70 typedef signed long            ffi_sarg;
71 #endif
72 #endif
73
74 typedef enum ffi_abi {
75   FFI_FIRST_ABI = 0,
76
77   /* ---- Intel x86 Win32 ---------- */
78 #ifdef X86_WIN32
79   FFI_SYSV,
80   FFI_STDCALL,
81   FFI_THISCALL,
82   FFI_FASTCALL,
83   FFI_MS_CDECL,
84   FFI_LAST_ABI,
85 #ifdef _MSC_VER
86   FFI_DEFAULT_ABI = FFI_MS_CDECL
87 #else
88   FFI_DEFAULT_ABI = FFI_SYSV
89 #endif
90
91 #elif defined(X86_WIN64)
92   FFI_WIN64,
93   FFI_LAST_ABI,
94   FFI_DEFAULT_ABI = FFI_WIN64
95
96 #else
97   /* ---- Intel x86 and AMD x86-64 - */
98   FFI_SYSV,
99   FFI_UNIX64,   /* Unix variants all use the same ABI for x86-64  */
100   FFI_LAST_ABI,
101 #if defined(__i386__) || defined(__i386)
102   FFI_DEFAULT_ABI = FFI_SYSV
103 #else
104   FFI_DEFAULT_ABI = FFI_UNIX64
105 #endif
106 #endif
107 } ffi_abi;
108 #endif
109
110 /* ---- Definitions for closures ----------------------------------------- */
111
112 #define FFI_CLOSURES 1
113 #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)
114 #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)
115 #define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3)
116 #define FFI_TYPE_MS_STRUCT       (FFI_TYPE_LAST + 4)
117
118 #if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))
119 #define FFI_TRAMPOLINE_SIZE 24
120 #define FFI_NATIVE_RAW_API 0
121 #else
122 #ifdef X86_WIN32
123 #define FFI_TRAMPOLINE_SIZE 52
124 #else
125 #ifdef X86_WIN64
126 #define FFI_TRAMPOLINE_SIZE 29
127 #define FFI_NATIVE_RAW_API 0
128 #define FFI_NO_RAW_API 1
129 #else
130 #define FFI_TRAMPOLINE_SIZE 10
131 #endif
132 #endif
133 #ifndef X86_WIN64
134 #define FFI_NATIVE_RAW_API 1    /* x86 has native raw api support */
135 #endif
136 #endif
137
138 #endif
139