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 3 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, see <http://www.gnu.org/licenses/>.
25 #define STATIC(TYPE) static TYPE
28 /* sim_endian is always inlined */
30 #if !defined(_SIM_ENDIAN_C_) && (SIM_ENDIAN_INLINE & INCLUDE_MODULE)
31 # if (SIM_ENDIAN_INLINE & INLINE_MODULE)
32 # define INLINE_PSIM_ENDIAN(TYPE) static INLINE TYPE UNUSED
33 # define EXTERN_PSIM_ENDIAN(TYPE) static TYPE UNUSED
35 # define INLINE_PSIM_ENDIAN(TYPE) static TYPE UNUSED
36 # define EXTERN_PSIM_ENDIAN(TYPE) static TYPE UNUSED
39 # define INLINE_PSIM_ENDIAN(TYPE) TYPE
40 # define EXTERN_PSIM_ENDIAN(TYPE) TYPE
43 #if (SIM_ENDIAN_INLINE & PSIM_INLINE_LOCALS)
44 # define STATIC_INLINE_PSIM_ENDIAN(TYPE) static INLINE TYPE
46 # define STATIC_INLINE_PSIM_ENDIAN(TYPE) static TYPE
50 /* bits is always inlined */
52 #if !defined(_BITS_C_) && (BITS_INLINE & INCLUDE_MODULE)
53 # if (BITS_INLINE & INLINE_MODULE)
54 # define INLINE_BITS(TYPE) static INLINE TYPE UNUSED
55 # define EXTERN_BITS(TYPE) static TYPE UNUSED
57 # define INLINE_BITS(TYPE) static TYPE UNUSED
58 # define EXTERN_BITS(TYPE) static TYPE UNUSED
61 # define INLINE_BITS(TYPE) TYPE
62 # define EXTERN_BITS(TYPE) TYPE
65 #if (BITS_INLINE & PSIM_INLINE_LOCALS)
66 # define STATIC_INLINE_BITS(TYPE) static INLINE TYPE
68 # define STATIC_INLINE_BITS(TYPE) static TYPE
72 /* core is inlined with inline.c */
74 #if defined(_INLINE_C_) && !defined(_CORE_C_) && (CORE_INLINE & INCLUDE_MODULE)
75 # if (CORE_INLINE & INLINE_MODULE)
76 # define INLINE_CORE(TYPE) static INLINE TYPE UNUSED
77 # define EXTERN_CORE(TYPE) static TYPE UNUSED
79 # define INLINE_CORE(TYPE) static TYPE UNUSED
80 # define EXTERN_CORE(TYPE) static TYPE UNUSED
83 # define INLINE_CORE(TYPE) TYPE
84 # define EXTERN_CORE(TYPE) TYPE
87 #if (CORE_INLINE & PSIM_INLINE_LOCALS)
88 # define STATIC_INLINE_CORE(TYPE) static INLINE TYPE
90 # define STATIC_INLINE_CORE(TYPE) static TYPE
94 /* vm is inlined with inline.c */
96 #if defined(_INLINE_C_) && !defined(_VM_C_) && (VM_INLINE & INCLUDE_MODULE)
97 # if (VM_INLINE & INLINE_MODULE)
98 # define INLINE_VM(TYPE) static INLINE TYPE UNUSED
99 # define EXTERN_VM(TYPE) static TYPE UNUSED
101 # define INLINE_VM(TYPE) static TYPE UNUSED
102 # define EXTERN_VM(TYPE) static TYPE UNUSED
105 # define INLINE_VM(TYPE) TYPE
106 # define EXTERN_VM(TYPE) TYPE
109 #if (VM_INLINE & PSIM_INLINE_LOCALS)
110 # define STATIC_INLINE_VM(TYPE) static INLINE TYPE
112 # define STATIC_INLINE_VM(TYPE) static TYPE
116 /* cpu is always inlined */
118 #if !defined(_CPU_C_) && (CPU_INLINE & INCLUDE_MODULE)
119 # if (CPU_INLINE & INLINE_MODULE)
120 # define INLINE_CPU(TYPE) static INLINE TYPE UNUSED
121 # define EXTERN_CPU(TYPE) static TYPE UNUSED
123 # define INLINE_CPU(TYPE) static TYPE UNUSED
124 # define EXTERN_CPU(TYPE) static TYPE UNUSED
127 # define INLINE_CPU(TYPE) TYPE
128 # define EXTERN_CPU(TYPE) TYPE
131 #if (CPU_INLINE & PSIM_INLINE_LOCALS)
132 # define STATIC_INLINE_CPU(TYPE) static INLINE TYPE
134 # define STATIC_INLINE_CPU(TYPE) static TYPE
138 /* model is inlined with inline.c */
140 #if defined(_INLINE_C_) && !defined(_MODEL_C_) && (MODEL_INLINE & INCLUDE_MODULE)
141 # if (MODEL_INLINE & INLINE_MODULE)
142 # define INLINE_MODEL(TYPE) static INLINE TYPE UNUSED
143 # define EXTERN_MODEL(TYPE) static TYPE UNUSED
145 # define INLINE_MODEL(TYPE) static TYPE UNUSED
146 # define EXTERN_MODEL(TYPE) static TYPE UNUSED
149 # define INLINE_MODEL(TYPE) TYPE
150 # define EXTERN_MODEL(TYPE) TYPE
153 #if (MODEL_INLINE & PSIM_INLINE_LOCALS)
154 # define STATIC_INLINE_MODEL(TYPE) static INLINE TYPE
156 # define STATIC_INLINE_MODEL(TYPE) static TYPE
160 /* events is inlined with inline.c */
162 #if defined(_INLINE_C_) && !defined(_EVENTS_C_) && (EVENTS_INLINE & INCLUDE_MODULE)
163 # if (EVENTS_INLINE & INLINE_MODULE)
164 # define INLINE_EVENTS(TYPE) static INLINE TYPE UNUSED
165 # define EXTERN_EVENTS(TYPE) static TYPE UNUSED
167 # define INLINE_EVENTS(TYPE) static TYPE UNUSED
168 # define EXTERN_EVENTS(TYPE) static TYPE UNUSED
171 # define INLINE_EVENTS(TYPE) TYPE
172 # define EXTERN_EVENTS(TYPE) TYPE
175 #if (EVENTS_INLINE & PSIM_INLINE_LOCALS)
176 # define STATIC_INLINE_EVENTS(TYPE) static INLINE TYPE
178 # define STATIC_INLINE_EVENTS(TYPE) static TYPE
182 /* mon is inlined with inline.c */
184 #if defined(_INLINE_C_) && !defined(_MON_C_) && (MON_INLINE & INCLUDE_MODULE)
185 # if (MON_INLINE & INLINE_MODULE)
186 # define INLINE_MON(TYPE) static INLINE TYPE UNUSED
187 # define EXTERN_MON(TYPE) static TYPE UNUSED
189 # define INLINE_MON(TYPE) static TYPE UNUSED
190 # define EXTERN_MON(TYPE) static TYPE UNUSED
193 # define INLINE_MON(TYPE) TYPE
194 # define EXTERN_MON(TYPE) TYPE
197 #if (MON_INLINE & PSIM_INLINE_LOCALS)
198 # define STATIC_INLINE_MON(TYPE) static INLINE TYPE
200 # define STATIC_INLINE_MON(TYPE) static TYPE
204 /* registers is inlined with inline.c */
206 #if defined(_INLINE_C_) && !defined(_REGISTERS_C_) && (REGISTERS_INLINE & INCLUDE_MODULE)
207 # if (REGISTERS_INLINE & INLINE_MODULE)
208 # define INLINE_REGISTERS(TYPE) static INLINE TYPE UNUSED
209 # define EXTERN_REGISTERS(TYPE) static TYPE UNUSED
211 # define INLINE_REGISTERS(TYPE) static TYPE UNUSED
212 # define EXTERN_REGISTERS(TYPE) static TYPE UNUSED
215 # define INLINE_REGISTERS(TYPE) TYPE
216 # define EXTERN_REGISTERS(TYPE) TYPE
219 #if (REGISTERS_INLINE & PSIM_INLINE_LOCALS)
220 # define STATIC_INLINE_REGISTERS(TYPE) static INLINE TYPE
222 # define STATIC_INLINE_REGISTERS(TYPE) static TYPE
226 /* interrupts is inlined with inline.c */
228 #if defined(_INLINE_C_) && !defined(_INTERRUPTS_C_) && (INTERRUPTS_INLINE & INCLUDE_MODULE)
229 # if (INTERRUPTS_INLINE & INLINE_MODULE)
230 # define INLINE_INTERRUPTS(TYPE) static INLINE TYPE UNUSED
231 # define EXTERN_INTERRUPTS(TYPE) static TYPE UNUSED
233 # define INLINE_INTERRUPTS(TYPE) static TYPE UNUSED
234 # define EXTERN_INTERRUPTS(TYPE) static TYPE UNUSED
237 # define INLINE_INTERRUPTS(TYPE) TYPE
238 # define EXTERN_INTERRUPTS(TYPE) TYPE
241 #if (INTERRUPTS_INLINE & PSIM_INLINE_LOCALS)
242 # define STATIC_INLINE_INTERRUPTS(TYPE) static INLINE TYPE
244 # define STATIC_INLINE_INTERRUPTS(TYPE) static TYPE
248 /* device is inlined with inline.c */
250 #if defined(_INLINE_C_) && !defined(_DEVICE_C_) && (DEVICE_INLINE & INCLUDE_MODULE)
251 # if (DEVICE_INLINE & INLINE_MODULE)
252 # define INLINE_DEVICE(TYPE) static INLINE TYPE UNUSED
253 # define EXTERN_DEVICE(TYPE) static TYPE UNUSED
255 # define INLINE_DEVICE(TYPE) static TYPE UNUSED
256 # define EXTERN_DEVICE(TYPE) static TYPE UNUSED
259 # define INLINE_DEVICE(TYPE) TYPE
260 # define EXTERN_DEVICE(TYPE) TYPE
263 #if (DEVICE_INLINE & PSIM_INLINE_LOCALS)
264 # define STATIC_INLINE_DEVICE(TYPE) static INLINE TYPE
266 # define STATIC_INLINE_DEVICE(TYPE) static TYPE
270 /* tree is inlined with inline.c */
272 #if defined(_INLINE_C_) && !defined(_TREE_C_) && (TREE_INLINE & INCLUDE_MODULE)
273 # if (TREE_INLINE & INLINE_MODULE)
274 # define INLINE_TREE(TYPE) static INLINE TYPE UNUSED
275 # define EXTERN_TREE(TYPE) static TYPE UNUSED
277 # define INLINE_TREE(TYPE) static TYPE UNUSED
278 # define EXTERN_TREE(TYPE) static TYPE UNUSED
281 # define INLINE_TREE(TYPE) TYPE
282 # define EXTERN_TREE(TYPE) TYPE
285 #if (TREE_INLINE & PSIM_INLINE_LOCALS)
286 # define STATIC_INLINE_TREE(TYPE) static INLINE TYPE
288 # define STATIC_INLINE_TREE(TYPE) static TYPE
292 /* spreg is inlined with inline.c */
294 #if defined(_INLINE_C_) && !defined(_SPREG_C_) && (SPREG_INLINE & INCLUDE_MODULE)
295 # if (SPREG_INLINE & INLINE_MODULE)
296 # define INLINE_SPREG(TYPE) static INLINE TYPE UNUSED
297 # define EXTERN_SPREG(TYPE) static TYPE UNUSED
299 # define INLINE_SPREG(TYPE) static TYPE UNUSED
300 # define EXTERN_SPREG(TYPE) static TYPE UNUSED
303 # define INLINE_SPREG(TYPE) TYPE
304 # define EXTERN_SPREG(TYPE) TYPE
307 #if (SPREG_INLINE & PSIM_INLINE_LOCALS)
308 # define STATIC_INLINE_SPREG(TYPE) static INLINE TYPE
310 # define STATIC_INLINE_SPREG(TYPE) static TYPE
314 /* semantics is inlined with inline.c */
316 #if defined(_INLINE_C_) && !defined(_SEMANTICS_C_) && (SEMANTICS_INLINE & INCLUDE_MODULE)
317 # if (SEMANTICS_INLINE & INLINE_MODULE)
318 # define PSIM_INLINE_SEMANTICS(TYPE) static INLINE TYPE UNUSED
319 # define PSIM_EXTERN_SEMANTICS(TYPE) static TYPE UNUSED
321 # define PSIM_INLINE_SEMANTICS(TYPE) static TYPE UNUSED
322 # define PSIM_EXTERN_SEMANTICS(TYPE) static TYPE UNUSED
325 # define PSIM_INLINE_SEMANTICS(TYPE) TYPE
326 # define PSIM_EXTERN_SEMANTICS(TYPE) TYPE
329 #if 0 /* this isn't used */
330 #if (SEMANTICS_INLINE & PSIM_INLINE_LOCALS)
331 # define STATIC_INLINE_SEMANTICS(TYPE) static INLINE TYPE
333 # define STATIC_INLINE_SEMANTICS(TYPE) static TYPE
338 /* idecode is actually not inlined */
340 #if defined(_INLINE_C_) && !defined(_IDECODE_C_) && (IDECODE_INLINE & INCLUDE_MODULE)
341 # if (IDECODE_INLINE & INLINE_MODULE)
342 # define PSIM_INLINE_IDECODE(TYPE) static INLINE TYPE UNUSED
343 # define EXTERN_IDECODE(TYPE) static TYPE UNUSED
345 # define PSIM_INLINE_IDECODE(TYPE) static TYPE UNUSED
346 # define EXTERN_IDECODE(TYPE) static TYPE UNUSED
349 # define PSIM_INLINE_IDECODE(TYPE) TYPE
350 # define EXTERN_IDECODE(TYPE) TYPE
353 #if 0 /* this isn't used */
354 #if (IDECODE_INLINE & PSIM_INLINE_LOCALS)
355 # define STATIC_INLINE_IDECODE(TYPE) static INLINE TYPE
357 # define STATIC_INLINE_IDECODE(TYPE) static TYPE
362 /* icache is inlined with inline.c */
364 #if defined(_INLINE_C_) && !defined(_ICACHE_C_) && (ICACHE_INLINE & INCLUDE_MODULE)
365 # if (ICACHE_INLINE & INLINE_MODULE)
366 # define PSIM_INLINE_ICACHE(TYPE) static INLINE TYPE UNUSED
367 # define EXTERN_ICACHE(TYPE) static TYPE UNUSED
369 # define PSIM_INLINE_ICACHE(TYPE) static TYPE UNUSED
370 # define EXTERN_ICACHE(TYPE) static TYPE UNUSED
373 # define PSIM_INLINE_ICACHE(TYPE) TYPE
374 # define EXTERN_ICACHE(TYPE) TYPE
377 #if 0 /* this isn't used */
378 #if (ICACHE_INLINE & PSIM_INLINE_LOCALS)
379 # define STATIC_INLINE_ICACHE(TYPE) static INLINE TYPE
381 # define STATIC_INLINE_ICACHE(TYPE) static TYPE
386 /* support is always inlined */
388 #if !defined(_SUPPORT_C_) && (SUPPORT_INLINE & INCLUDE_MODULE)
389 # if (SUPPORT_INLINE & INLINE_MODULE)
390 # define PSIM_INLINE_SUPPORT(TYPE) static INLINE TYPE UNUSED
391 # define EXTERN_SUPPORT(TYPE) static TYPE UNUSED
393 # define PSIM_INLINE_SUPPORT(TYPE) static TYPE UNUSED
394 # define EXTERN_SUPPORT(TYPE) static TYPE UNUSED
397 # define PSIM_INLINE_SUPPORT(TYPE) TYPE
398 # define EXTERN_SUPPORT(TYPE) TYPE
401 #if 0 /* this isn't used */
402 #if (SUPPORT_INLINE & PSIM_INLINE_LOCALS)
403 # define STATIC_INLINE_SUPPORT(TYPE) static INLINE TYPE
405 # define STATIC_INLINE_SUPPORT(TYPE) static TYPE
410 /* options is inlined with inline.c */
412 #if defined(_INLINE_C_) && !defined(_OPTIONS_C_) && (OPTIONS_INLINE & INCLUDE_MODULE)
413 # if (OPTIONS_INLINE & INLINE_MODULE)
414 # define INLINE_OPTIONS(TYPE) static INLINE TYPE UNUSED
415 # define EXTERN_OPTIONS(TYPE) static TYPE UNUSED
417 # define INLINE_OPTIONS(TYPE) static TYPE UNUSED
418 # define EXTERN_OPTIONS(TYPE) static TYPE UNUSED
421 # define INLINE_OPTIONS(TYPE) TYPE
422 # define EXTERN_OPTIONS(TYPE) TYPE
425 #if (OPTIONS_INLINE & PSIM_INLINE_LOCALS)
426 # define STATIC_INLINE_OPTIONS(TYPE) static INLINE TYPE
428 # define STATIC_INLINE_OPTIONS(TYPE) static TYPE
432 /* os_emul is inlined with inline.c */
434 #if defined(_INLINE_C_) && !defined(_OS_EMUL_C_) && (OS_EMUL_INLINE & INCLUDE_MODULE)
435 # if (OS_EMUL_INLINE & INLINE_MODULE)
436 # define INLINE_OS_EMUL(TYPE) static INLINE TYPE UNUSED
437 # define EXTERN_OS_EMUL(TYPE) static TYPE UNUSED
439 # define INLINE_OS_EMUL(TYPE) static TYPE UNUSED
440 # define EXTERN_OS_EMUL(TYPE) static TYPE UNUSED
443 # define INLINE_OS_EMUL(TYPE) TYPE
444 # define EXTERN_OS_EMUL(TYPE) TYPE
447 #if (OS_EMUL_INLINE & PSIM_INLINE_LOCALS)
448 # define STATIC_INLINE_OS_EMUL(TYPE) static INLINE TYPE
450 # define STATIC_INLINE_OS_EMUL(TYPE) static TYPE
454 /* psim is actually not inlined */
456 #if defined(_INLINE_C_) && !defined(_PSIM_C_) && (PSIM_INLINE & INCLUDE_MODULE)
457 # if (PSIM_INLINE & INLINE_MODULE)
458 # define INLINE_PSIM(TYPE) static INLINE TYPE UNUSED
459 # define EXTERN_PSIM(TYPE) static TYPE UNUSED
461 # define INLINE_PSIM(TYPE) static TYPE UNUSED
462 # define EXTERN_PSIM(TYPE) static TYPE UNUSED
465 # define INLINE_PSIM(TYPE) TYPE
466 # define EXTERN_PSIM(TYPE) TYPE
469 #if (PSIM_INLINE & PSIM_INLINE_LOCALS)
470 # define STATIC_INLINE_PSIM(TYPE) static INLINE TYPE
472 # define STATIC_INLINE_PSIM(TYPE) static TYPE
476 /* cap is inlined with inline.c */
478 #if defined(_INLINE_C_) && !defined(_CAP_C_) && (CAP_INLINE & INCLUDE_MODULE)
479 # if (CAP_INLINE & INLINE_MODULE)
480 # define INLINE_CAP(TYPE) static INLINE TYPE UNUSED
481 # define EXTERN_CAP(TYPE) static TYPE UNUSED
483 # define INLINE_CAP(TYPE) static TYPE UNUSED
484 # define EXTERN_CAP(TYPE) static TYPE UNUSED
487 # define INLINE_CAP(TYPE) TYPE
488 # define EXTERN_CAP(TYPE) TYPE
491 #if (CAP_INLINE & PSIM_INLINE_LOCALS)
492 # define STATIC_INLINE_CAP(TYPE) static INLINE TYPE
494 # define STATIC_INLINE_CAP(TYPE) static TYPE