OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libffi/] [src/] [mips/] [ffitarget.h] - Blame information for rev 750

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 732 jeremybenn
/* -----------------------------------------------------------------*-C-*-
2
   ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
3
   Target configuration macros for MIPS.
4
 
5
   Permission is hereby granted, free of charge, to any person obtaining
6
   a copy of this software and associated documentation files (the
7
   ``Software''), to deal in the Software without restriction, including
8
   without limitation the rights to use, copy, modify, merge, publish,
9
   distribute, sublicense, and/or sell copies of the Software, and to
10
   permit persons to whom the Software is furnished to do so, subject to
11
   the following conditions:
12
 
13
   The above copyright notice and this permission notice shall be included
14
   in all copies or substantial portions of the Software.
15
 
16
   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
17
   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
   DEALINGS IN THE SOFTWARE.
24
 
25
   ----------------------------------------------------------------------- */
26
 
27
#ifndef LIBFFI_TARGET_H
28
#define LIBFFI_TARGET_H
29
 
30
#ifdef linux
31
# include <asm/sgidefs.h>
32
#elif defined(__rtems__)
33
/*
34
 * Subprogram calling convention - copied from sgidefs.h
35
 */
36
#define _MIPS_SIM_ABI32         1
37
#define _MIPS_SIM_NABI32        2
38
#define _MIPS_SIM_ABI64         3
39
#else
40
# include <sgidefs.h>
41
#endif
42
 
43
#  ifndef _ABIN32
44
#    define _ABIN32 _MIPS_SIM_NABI32
45
#  endif
46
#  ifndef _ABI64
47
#    define _ABI64 _MIPS_SIM_ABI64
48
#  endif
49
#  ifndef _ABIO32
50
#    define _ABIO32 _MIPS_SIM_ABI32
51
#  endif
52
 
53
#if !defined(_MIPS_SIM)
54
-- something is very wrong --
55
#else
56
#  if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64))
57
#    define FFI_MIPS_N32
58
#  else
59
#    if (_MIPS_SIM==_ABIO32 && defined(_ABIO32))
60
#      define FFI_MIPS_O32
61
#    else
62
-- this is an unsupported platform --
63
#    endif
64
#  endif
65
#endif
66
 
67
#ifdef FFI_MIPS_O32
68
/* O32 stack frames have 32bit integer args */
69
#  define FFI_SIZEOF_ARG    4
70
#else
71
/* N32 and N64 frames have 64bit integer args */
72
#  define FFI_SIZEOF_ARG    8
73
#  if _MIPS_SIM == _ABIN32
74
#    define FFI_SIZEOF_JAVA_RAW  4
75
#  endif
76
#endif
77
 
78
#define FFI_FLAG_BITS 2
79
 
80
/* SGI's strange assembler requires that we multiply by 4 rather
81
   than shift left by FFI_FLAG_BITS */
82
 
83
#define FFI_ARGS_D   FFI_TYPE_DOUBLE
84
#define FFI_ARGS_F   FFI_TYPE_FLOAT
85
#define FFI_ARGS_DD  FFI_TYPE_DOUBLE * 4 + FFI_TYPE_DOUBLE
86
#define FFI_ARGS_FF  FFI_TYPE_FLOAT * 4 +  FFI_TYPE_FLOAT
87
#define FFI_ARGS_FD  FFI_TYPE_DOUBLE * 4 + FFI_TYPE_FLOAT
88
#define FFI_ARGS_DF  FFI_TYPE_FLOAT * 4 + FFI_TYPE_DOUBLE
89
 
90
/* Needed for N32 structure returns */
91
#define FFI_TYPE_SMALLSTRUCT  FFI_TYPE_UINT8
92
#define FFI_TYPE_SMALLSTRUCT2 FFI_TYPE_SINT8
93
 
94
#if 0
95
/* The SGI assembler can't handle this.. */
96
#define FFI_TYPE_STRUCT_DD (( FFI_ARGS_DD ) << 4) + FFI_TYPE_STRUCT
97
/* (and so on) */
98
#else
99
/* ...so we calculate these by hand! */
100
#define FFI_TYPE_STRUCT_D      61
101
#define FFI_TYPE_STRUCT_F      45
102
#define FFI_TYPE_STRUCT_DD     253
103
#define FFI_TYPE_STRUCT_FF     173
104
#define FFI_TYPE_STRUCT_FD     237
105
#define FFI_TYPE_STRUCT_DF     189
106
#define FFI_TYPE_STRUCT_SMALL  93
107
#define FFI_TYPE_STRUCT_SMALL2 109
108
 
109
/* and for n32 soft float, add 16 * 2^4 */
110
#define FFI_TYPE_STRUCT_D_SOFT      317
111
#define FFI_TYPE_STRUCT_F_SOFT      301
112
#define FFI_TYPE_STRUCT_DD_SOFT     509
113
#define FFI_TYPE_STRUCT_FF_SOFT     429
114
#define FFI_TYPE_STRUCT_FD_SOFT     493
115
#define FFI_TYPE_STRUCT_DF_SOFT     445
116
#define FFI_TYPE_STRUCT_SOFT        16
117
#endif
118
 
119
#ifdef LIBFFI_ASM
120
#define v0 $2
121
#define v1 $3
122
#define a0 $4
123
#define a1 $5
124
#define a2 $6
125
#define a3 $7
126
#define a4 $8           
127
#define a5 $9           
128
#define a6 $10          
129
#define a7 $11          
130
#define t0 $8
131
#define t1 $9
132
#define t2 $10
133
#define t3 $11
134
#define t4 $12          
135
#define t5 $13
136
#define t6 $14  
137
#define t7 $15
138
#define t8 $24
139
#define t9 $25
140
#define ra $31          
141
 
142
#ifdef FFI_MIPS_O32
143
# define REG_L  lw
144
# define REG_S  sw
145
# define SUBU   subu
146
# define ADDU   addu
147
# define SRL    srl
148
# define LI     li
149
#else /* !FFI_MIPS_O32 */
150
# define REG_L  ld
151
# define REG_S  sd
152
# define SUBU   dsubu
153
# define ADDU   daddu
154
# define SRL    dsrl
155
# define LI     dli
156
# if (_MIPS_SIM==_ABI64)
157
#  define LA dla
158
#  define EH_FRAME_ALIGN 3
159
#  define FDE_ADDR_BYTES .8byte
160
# else
161
#  define LA la
162
#  define EH_FRAME_ALIGN 2
163
#  define FDE_ADDR_BYTES .4byte
164
# endif /* _MIPS_SIM==_ABI64 */
165
#endif /* !FFI_MIPS_O32 */
166
#else /* !LIBFFI_ASM */
167
# ifdef __GNUC__
168
#  ifdef FFI_MIPS_O32
169
/* O32 stack frames have 32bit integer args */
170
typedef unsigned int     ffi_arg __attribute__((__mode__(__SI__)));
171
typedef signed   int     ffi_sarg __attribute__((__mode__(__SI__)));
172
#else
173
/* N32 and N64 frames have 64bit integer args */
174
typedef unsigned int     ffi_arg __attribute__((__mode__(__DI__)));
175
typedef signed   int     ffi_sarg __attribute__((__mode__(__DI__)));
176
#  endif
177
# else
178
#  ifdef FFI_MIPS_O32
179
/* O32 stack frames have 32bit integer args */
180
typedef __uint32_t ffi_arg;
181
typedef __int32_t ffi_sarg;
182
#  else
183
/* N32 and N64 frames have 64bit integer args */
184
typedef __uint64_t ffi_arg;
185
typedef __int64_t ffi_sarg;
186
#  endif
187
# endif /* __GNUC__ */
188
 
189
typedef enum ffi_abi {
190
  FFI_FIRST_ABI = 0,
191
  FFI_O32,
192
  FFI_N32,
193
  FFI_N64,
194
  FFI_O32_SOFT_FLOAT,
195
  FFI_N32_SOFT_FLOAT,
196
  FFI_N64_SOFT_FLOAT,
197
 
198
#ifdef FFI_MIPS_O32
199
#ifdef __mips_soft_float
200
  FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT,
201
#else
202
  FFI_DEFAULT_ABI = FFI_O32,
203
#endif
204
#else
205
# if _MIPS_SIM==_ABI64
206
#  ifdef __mips_soft_float
207
  FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT,
208
#  else
209
  FFI_DEFAULT_ABI = FFI_N64,
210
#  endif
211
# else
212
#  ifdef __mips_soft_float
213
  FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT,
214
#  else
215
  FFI_DEFAULT_ABI = FFI_N32,
216
#  endif
217
# endif
218
#endif
219
 
220
  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
221
} ffi_abi;
222
 
223
#define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag
224
#endif /* !LIBFFI_ASM */
225
 
226
/* ---- Definitions for closures ----------------------------------------- */
227
 
228
#if defined(FFI_MIPS_O32)
229
#define FFI_CLOSURES 1
230
#define FFI_TRAMPOLINE_SIZE 20
231
#else
232
/* N32/N64. */
233
# define FFI_CLOSURES 1
234
#if _MIPS_SIM==_ABI64
235
#define FFI_TRAMPOLINE_SIZE 52
236
#else
237
#define FFI_TRAMPOLINE_SIZE 20
238
#endif
239
#endif /* FFI_MIPS_O32 */
240
#define FFI_NATIVE_RAW_API 0
241
 
242
#endif
243
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.