1 /* This file is part of the program psim.
3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #define STATIC(TYPE) static TYPE
29 /* sim_endian is always inlined */
31 #if !defined(_SIM_ENDIAN_C_) && (SIM_ENDIAN_INLINE & INCLUDE_MODULE)
32 # if (SIM_ENDIAN_INLINE & INLINE_MODULE)
33 # define INLINE_PSIM_ENDIAN(TYPE) static INLINE TYPE UNUSED
34 # define EXTERN_PSIM_ENDIAN(TYPE) static TYPE UNUSED
36 # define INLINE_PSIM_ENDIAN(TYPE) static TYPE UNUSED
37 # define EXTERN_PSIM_ENDIAN(TYPE) static TYPE UNUSED
40 # define INLINE_PSIM_ENDIAN(TYPE) TYPE
41 # define EXTERN_PSIM_ENDIAN(TYPE) TYPE
44 #if (SIM_ENDIAN_INLINE & PSIM_INLINE_LOCALS)
45 # define STATIC_INLINE_PSIM_ENDIAN(TYPE) static INLINE TYPE
47 # define STATIC_INLINE_PSIM_ENDIAN(TYPE) static TYPE
51 /* bits is always inlined */
53 #if !defined(_BITS_C_) && (BITS_INLINE & INCLUDE_MODULE)
54 # if (BITS_INLINE & INLINE_MODULE)
55 # define INLINE_BITS(TYPE) static INLINE TYPE UNUSED
56 # define EXTERN_BITS(TYPE) static TYPE UNUSED
58 # define INLINE_BITS(TYPE) static TYPE UNUSED
59 # define EXTERN_BITS(TYPE) static TYPE UNUSED
62 # define INLINE_BITS(TYPE) TYPE
63 # define EXTERN_BITS(TYPE) TYPE
66 #if (BITS_INLINE & PSIM_INLINE_LOCALS)
67 # define STATIC_INLINE_BITS(TYPE) static INLINE TYPE
69 # define STATIC_INLINE_BITS(TYPE) static TYPE
73 /* core is inlined with inline.c */
75 #if defined(_INLINE_C_) && !defined(_CORE_C_) && (CORE_INLINE & INCLUDE_MODULE)
76 # if (CORE_INLINE & INLINE_MODULE)
77 # define INLINE_CORE(TYPE) static INLINE TYPE UNUSED
78 # define EXTERN_CORE(TYPE) static TYPE UNUSED
80 # define INLINE_CORE(TYPE) static TYPE UNUSED
81 # define EXTERN_CORE(TYPE) static TYPE UNUSED
84 # define INLINE_CORE(TYPE) TYPE
85 # define EXTERN_CORE(TYPE) TYPE
88 #if (CORE_INLINE & PSIM_INLINE_LOCALS)
89 # define STATIC_INLINE_CORE(TYPE) static INLINE TYPE
91 # define STATIC_INLINE_CORE(TYPE) static TYPE
95 /* vm is inlined with inline.c */
97 #if defined(_INLINE_C_) && !defined(_VM_C_) && (VM_INLINE & INCLUDE_MODULE)
98 # if (VM_INLINE & INLINE_MODULE)
99 # define INLINE_VM(TYPE) static INLINE TYPE UNUSED
100 # define EXTERN_VM(TYPE) static TYPE UNUSED
102 # define INLINE_VM(TYPE) static TYPE UNUSED
103 # define EXTERN_VM(TYPE) static TYPE UNUSED
106 # define INLINE_VM(TYPE) TYPE
107 # define EXTERN_VM(TYPE) TYPE
110 #if (VM_INLINE & PSIM_INLINE_LOCALS)
111 # define STATIC_INLINE_VM(TYPE) static INLINE TYPE
113 # define STATIC_INLINE_VM(TYPE) static TYPE
117 /* cpu is always inlined */
119 #if !defined(_CPU_C_) && (CPU_INLINE & INCLUDE_MODULE)
120 # if (CPU_INLINE & INLINE_MODULE)
121 # define INLINE_CPU(TYPE) static INLINE TYPE UNUSED
122 # define EXTERN_CPU(TYPE) static TYPE UNUSED
124 # define INLINE_CPU(TYPE) static TYPE UNUSED
125 # define EXTERN_CPU(TYPE) static TYPE UNUSED
128 # define INLINE_CPU(TYPE) TYPE
129 # define EXTERN_CPU(TYPE) TYPE
132 #if (CPU_INLINE & PSIM_INLINE_LOCALS)
133 # define STATIC_INLINE_CPU(TYPE) static INLINE TYPE
135 # define STATIC_INLINE_CPU(TYPE) static TYPE
139 /* model is inlined with inline.c */
141 #if defined(_INLINE_C_) && !defined(_MODEL_C_) && (MODEL_INLINE & INCLUDE_MODULE)
142 # if (MODEL_INLINE & INLINE_MODULE)
143 # define INLINE_MODEL(TYPE) static INLINE TYPE UNUSED
144 # define EXTERN_MODEL(TYPE) static TYPE UNUSED
146 # define INLINE_MODEL(TYPE) static TYPE UNUSED
147 # define EXTERN_MODEL(TYPE) static TYPE UNUSED
150 # define INLINE_MODEL(TYPE) TYPE
151 # define EXTERN_MODEL(TYPE) TYPE
154 #if (MODEL_INLINE & PSIM_INLINE_LOCALS)
155 # define STATIC_INLINE_MODEL(TYPE) static INLINE TYPE
157 # define STATIC_INLINE_MODEL(TYPE) static TYPE
161 /* events is inlined with inline.c */
163 #if defined(_INLINE_C_) && !defined(_EVENTS_C_) && (EVENTS_INLINE & INCLUDE_MODULE)
164 # if (EVENTS_INLINE & INLINE_MODULE)
165 # define INLINE_EVENTS(TYPE) static INLINE TYPE UNUSED
166 # define EXTERN_EVENTS(TYPE) static TYPE UNUSED
168 # define INLINE_EVENTS(TYPE) static TYPE UNUSED
169 # define EXTERN_EVENTS(TYPE) static TYPE UNUSED
172 # define INLINE_EVENTS(TYPE) TYPE
173 # define EXTERN_EVENTS(TYPE) TYPE
176 #if (EVENTS_INLINE & PSIM_INLINE_LOCALS)
177 # define STATIC_INLINE_EVENTS(TYPE) static INLINE TYPE
179 # define STATIC_INLINE_EVENTS(TYPE) static TYPE
183 /* mon is inlined with inline.c */
185 #if defined(_INLINE_C_) && !defined(_MON_C_) && (MON_INLINE & INCLUDE_MODULE)
186 # if (MON_INLINE & INLINE_MODULE)
187 # define INLINE_MON(TYPE) static INLINE TYPE UNUSED
188 # define EXTERN_MON(TYPE) static TYPE UNUSED
190 # define INLINE_MON(TYPE) static TYPE UNUSED
191 # define EXTERN_MON(TYPE) static TYPE UNUSED
194 # define INLINE_MON(TYPE) TYPE
195 # define EXTERN_MON(TYPE) TYPE
198 #if (MON_INLINE & PSIM_INLINE_LOCALS)
199 # define STATIC_INLINE_MON(TYPE) static INLINE TYPE
201 # define STATIC_INLINE_MON(TYPE) static TYPE
205 /* registers is inlined with inline.c */
207 #if defined(_INLINE_C_) && !defined(_REGISTERS_C_) && (REGISTERS_INLINE & INCLUDE_MODULE)
208 # if (REGISTERS_INLINE & INLINE_MODULE)
209 # define INLINE_REGISTERS(TYPE) static INLINE TYPE UNUSED
210 # define EXTERN_REGISTERS(TYPE) static TYPE UNUSED
212 # define INLINE_REGISTERS(TYPE) static TYPE UNUSED
213 # define EXTERN_REGISTERS(TYPE) static TYPE UNUSED
216 # define INLINE_REGISTERS(TYPE) TYPE
217 # define EXTERN_REGISTERS(TYPE) TYPE
220 #if (REGISTERS_INLINE & PSIM_INLINE_LOCALS)
221 # define STATIC_INLINE_REGISTERS(TYPE) static INLINE TYPE
223 # define STATIC_INLINE_REGISTERS(TYPE) static TYPE
227 /* interrupts is inlined with inline.c */
229 #if defined(_INLINE_C_) && !defined(_INTERRUPTS_C_) && (INTERRUPTS_INLINE & INCLUDE_MODULE)
230 # if (INTERRUPTS_INLINE & INLINE_MODULE)
231 # define INLINE_INTERRUPTS(TYPE) static INLINE TYPE UNUSED
232 # define EXTERN_INTERRUPTS(TYPE) static TYPE UNUSED
234 # define INLINE_INTERRUPTS(TYPE) static TYPE UNUSED
235 # define EXTERN_INTERRUPTS(TYPE) static TYPE UNUSED
238 # define INLINE_INTERRUPTS(TYPE) TYPE
239 # define EXTERN_INTERRUPTS(TYPE) TYPE
242 #if (INTERRUPTS_INLINE & PSIM_INLINE_LOCALS)
243 # define STATIC_INLINE_INTERRUPTS(TYPE) static INLINE TYPE
245 # define STATIC_INLINE_INTERRUPTS(TYPE) static TYPE
249 /* device is inlined with inline.c */
251 #if defined(_INLINE_C_) && !defined(_DEVICE_C_) && (DEVICE_INLINE & INCLUDE_MODULE)
252 # if (DEVICE_INLINE & INLINE_MODULE)
253 # define INLINE_DEVICE(TYPE) static INLINE TYPE UNUSED
254 # define EXTERN_DEVICE(TYPE) static TYPE UNUSED
256 # define INLINE_DEVICE(TYPE) static TYPE UNUSED
257 # define EXTERN_DEVICE(TYPE) static TYPE UNUSED
260 # define INLINE_DEVICE(TYPE) TYPE
261 # define EXTERN_DEVICE(TYPE) TYPE
264 #if (DEVICE_INLINE & PSIM_INLINE_LOCALS)
265 # define STATIC_INLINE_DEVICE(TYPE) static INLINE TYPE
267 # define STATIC_INLINE_DEVICE(TYPE) static TYPE
271 /* tree is inlined with inline.c */
273 #if defined(_INLINE_C_) && !defined(_TREE_C_) && (TREE_INLINE & INCLUDE_MODULE)
274 # if (TREE_INLINE & INLINE_MODULE)
275 # define INLINE_TREE(TYPE) static INLINE TYPE UNUSED
276 # define EXTERN_TREE(TYPE) static TYPE UNUSED
278 # define INLINE_TREE(TYPE) static TYPE UNUSED
279 # define EXTERN_TREE(TYPE) static TYPE UNUSED
282 # define INLINE_TREE(TYPE) TYPE
283 # define EXTERN_TREE(TYPE) TYPE
286 #if (TREE_INLINE & PSIM_INLINE_LOCALS)
287 # define STATIC_INLINE_TREE(TYPE) static INLINE TYPE
289 # define STATIC_INLINE_TREE(TYPE) static TYPE
293 /* spreg is inlined with inline.c */
295 #if defined(_INLINE_C_) && !defined(_SPREG_C_) && (SPREG_INLINE & INCLUDE_MODULE)
296 # if (SPREG_INLINE & INLINE_MODULE)
297 # define INLINE_SPREG(TYPE) static INLINE TYPE UNUSED
298 # define EXTERN_SPREG(TYPE) static TYPE UNUSED
300 # define INLINE_SPREG(TYPE) static TYPE UNUSED
301 # define EXTERN_SPREG(TYPE) static TYPE UNUSED
304 # define INLINE_SPREG(TYPE) TYPE
305 # define EXTERN_SPREG(TYPE) TYPE
308 #if (SPREG_INLINE & PSIM_INLINE_LOCALS)
309 # define STATIC_INLINE_SPREG(TYPE) static INLINE TYPE
311 # define STATIC_INLINE_SPREG(TYPE) static TYPE
315 /* semantics is inlined with inline.c */
317 #if defined(_INLINE_C_) && !defined(_SEMANTICS_C_) && (SEMANTICS_INLINE & INCLUDE_MODULE)
318 # if (SEMANTICS_INLINE & INLINE_MODULE)
319 # define PSIM_INLINE_SEMANTICS(TYPE) static INLINE TYPE UNUSED
320 # define PSIM_EXTERN_SEMANTICS(TYPE) static TYPE UNUSED REGPARM
322 # define PSIM_INLINE_SEMANTICS(TYPE) static TYPE UNUSED REGPARM
323 # define PSIM_EXTERN_SEMANTICS(TYPE) static TYPE UNUSED REGPARM
326 # define PSIM_INLINE_SEMANTICS(TYPE) TYPE REGPARM
327 # define PSIM_EXTERN_SEMANTICS(TYPE) TYPE REGPARM
330 #if 0 /* this isn't used */
331 #if (SEMANTICS_INLINE & PSIM_INLINE_LOCALS)
332 # define STATIC_INLINE_SEMANTICS(TYPE) static INLINE TYPE
334 # define STATIC_INLINE_SEMANTICS(TYPE) static TYPE REGPARM
339 /* idecode is actually not inlined */
341 #if defined(_INLINE_C_) && !defined(_IDECODE_C_) && (IDECODE_INLINE & INCLUDE_MODULE)
342 # if (IDECODE_INLINE & INLINE_MODULE)
343 # define PSIM_INLINE_IDECODE(TYPE) static INLINE TYPE UNUSED
344 # define EXTERN_IDECODE(TYPE) static TYPE UNUSED REGPARM
346 # define PSIM_INLINE_IDECODE(TYPE) static TYPE UNUSED REGPARM
347 # define EXTERN_IDECODE(TYPE) static TYPE UNUSED REGPARM
350 # define PSIM_INLINE_IDECODE(TYPE) TYPE REGPARM
351 # define EXTERN_IDECODE(TYPE) TYPE REGPARM
354 #if 0 /* this isn't used */
355 #if (IDECODE_INLINE & PSIM_INLINE_LOCALS)
356 # define STATIC_INLINE_IDECODE(TYPE) static INLINE TYPE
358 # define STATIC_INLINE_IDECODE(TYPE) static TYPE REGPARM
363 /* icache is inlined with inline.c */
365 #if defined(_INLINE_C_) && !defined(_ICACHE_C_) && (ICACHE_INLINE & INCLUDE_MODULE)
366 # if (ICACHE_INLINE & INLINE_MODULE)
367 # define PSIM_INLINE_ICACHE(TYPE) static INLINE TYPE UNUSED
368 # define EXTERN_ICACHE(TYPE) static TYPE UNUSED REGPARM
370 # define PSIM_INLINE_ICACHE(TYPE) static TYPE UNUSED REGPARM
371 # define EXTERN_ICACHE(TYPE) static TYPE UNUSED REGPARM
374 # define PSIM_INLINE_ICACHE(TYPE) TYPE REGPARM
375 # define EXTERN_ICACHE(TYPE) TYPE REGPARM
378 #if 0 /* this isn't used */
379 #if (ICACHE_INLINE & PSIM_INLINE_LOCALS)
380 # define STATIC_INLINE_ICACHE(TYPE) static INLINE TYPE
382 # define STATIC_INLINE_ICACHE(TYPE) static TYPE REGPARM
387 /* support is always inlined */
389 #if !defined(_SUPPORT_C_) && (SUPPORT_INLINE & INCLUDE_MODULE)
390 # if (SUPPORT_INLINE & INLINE_MODULE)
391 # define PSIM_INLINE_SUPPORT(TYPE) static INLINE TYPE UNUSED
392 # define EXTERN_SUPPORT(TYPE) static TYPE UNUSED
394 # define PSIM_INLINE_SUPPORT(TYPE) static TYPE UNUSED
395 # define EXTERN_SUPPORT(TYPE) static TYPE UNUSED
398 # define PSIM_INLINE_SUPPORT(TYPE) TYPE
399 # define EXTERN_SUPPORT(TYPE) TYPE
402 #if 0 /* this isn't used */
403 #if (SUPPORT_INLINE & PSIM_INLINE_LOCALS)
404 # define STATIC_INLINE_SUPPORT(TYPE) static INLINE TYPE
406 # define STATIC_INLINE_SUPPORT(TYPE) static TYPE
411 /* options is inlined with inline.c */
413 #if defined(_INLINE_C_) && !defined(_OPTIONS_C_) && (OPTIONS_INLINE & INCLUDE_MODULE)
414 # if (OPTIONS_INLINE & INLINE_MODULE)
415 # define INLINE_OPTIONS(TYPE) static INLINE TYPE UNUSED
416 # define EXTERN_OPTIONS(TYPE) static TYPE UNUSED
418 # define INLINE_OPTIONS(TYPE) static TYPE UNUSED
419 # define EXTERN_OPTIONS(TYPE) static TYPE UNUSED
422 # define INLINE_OPTIONS(TYPE) TYPE
423 # define EXTERN_OPTIONS(TYPE) TYPE
426 #if (OPTIONS_INLINE & PSIM_INLINE_LOCALS)
427 # define STATIC_INLINE_OPTIONS(TYPE) static INLINE TYPE
429 # define STATIC_INLINE_OPTIONS(TYPE) static TYPE
433 /* os_emul is inlined with inline.c */
435 #if defined(_INLINE_C_) && !defined(_OS_EMUL_C_) && (OS_EMUL_INLINE & INCLUDE_MODULE)
436 # if (OS_EMUL_INLINE & INLINE_MODULE)
437 # define INLINE_OS_EMUL(TYPE) static INLINE TYPE UNUSED
438 # define EXTERN_OS_EMUL(TYPE) static TYPE UNUSED
440 # define INLINE_OS_EMUL(TYPE) static TYPE UNUSED
441 # define EXTERN_OS_EMUL(TYPE) static TYPE UNUSED
444 # define INLINE_OS_EMUL(TYPE) TYPE
445 # define EXTERN_OS_EMUL(TYPE) TYPE
448 #if (OS_EMUL_INLINE & PSIM_INLINE_LOCALS)
449 # define STATIC_INLINE_OS_EMUL(TYPE) static INLINE TYPE
451 # define STATIC_INLINE_OS_EMUL(TYPE) static TYPE
455 /* psim is actually not inlined */
457 #if defined(_INLINE_C_) && !defined(_PSIM_C_) && (PSIM_INLINE & INCLUDE_MODULE)
458 # if (PSIM_INLINE & INLINE_MODULE)
459 # define INLINE_PSIM(TYPE) static INLINE TYPE UNUSED
460 # define EXTERN_PSIM(TYPE) static TYPE UNUSED
462 # define INLINE_PSIM(TYPE) static TYPE UNUSED
463 # define EXTERN_PSIM(TYPE) static TYPE UNUSED
466 # define INLINE_PSIM(TYPE) TYPE
467 # define EXTERN_PSIM(TYPE) TYPE
470 #if (PSIM_INLINE & PSIM_INLINE_LOCALS)
471 # define STATIC_INLINE_PSIM(TYPE) static INLINE TYPE
473 # define STATIC_INLINE_PSIM(TYPE) static TYPE
477 /* cap is inlined with inline.c */
479 #if defined(_INLINE_C_) && !defined(_CAP_C_) && (CAP_INLINE & INCLUDE_MODULE)
480 # if (CAP_INLINE & INLINE_MODULE)
481 # define INLINE_CAP(TYPE) static INLINE TYPE UNUSED
482 # define EXTERN_CAP(TYPE) static TYPE UNUSED
484 # define INLINE_CAP(TYPE) static TYPE UNUSED
485 # define EXTERN_CAP(TYPE) static TYPE UNUSED
488 # define INLINE_CAP(TYPE) TYPE
489 # define EXTERN_CAP(TYPE) TYPE
492 #if (CAP_INLINE & PSIM_INLINE_LOCALS)
493 # define STATIC_INLINE_CAP(TYPE) static INLINE TYPE
495 # define STATIC_INLINE_CAP(TYPE) static TYPE