Update copyright year in gdbarch.sh doc/gdb.texinfo and doc/refcard.tex
[binutils-gdb.git] / sim / ppc / inline.h
blob55de0bbfbed4afb832fbf57f7acaeb4a51550911
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/>.
21 #ifndef _INLINE_H_
22 #define _INLINE_H_
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
34 # else
35 # define INLINE_PSIM_ENDIAN(TYPE) static TYPE UNUSED
36 # define EXTERN_PSIM_ENDIAN(TYPE) static TYPE UNUSED
37 # endif
38 #else
39 # define INLINE_PSIM_ENDIAN(TYPE) TYPE
40 # define EXTERN_PSIM_ENDIAN(TYPE) TYPE
41 #endif
43 #if (SIM_ENDIAN_INLINE & PSIM_INLINE_LOCALS)
44 # define STATIC_INLINE_PSIM_ENDIAN(TYPE) static INLINE TYPE
45 #else
46 # define STATIC_INLINE_PSIM_ENDIAN(TYPE) static TYPE
47 #endif
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
56 # else
57 # define INLINE_BITS(TYPE) static TYPE UNUSED
58 # define EXTERN_BITS(TYPE) static TYPE UNUSED
59 # endif
60 #else
61 # define INLINE_BITS(TYPE) TYPE
62 # define EXTERN_BITS(TYPE) TYPE
63 #endif
65 #if (BITS_INLINE & PSIM_INLINE_LOCALS)
66 # define STATIC_INLINE_BITS(TYPE) static INLINE TYPE
67 #else
68 # define STATIC_INLINE_BITS(TYPE) static TYPE
69 #endif
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
78 #else
79 # define INLINE_CORE(TYPE) static TYPE UNUSED
80 # define EXTERN_CORE(TYPE) static TYPE UNUSED
81 #endif
82 #else
83 # define INLINE_CORE(TYPE) TYPE
84 # define EXTERN_CORE(TYPE) TYPE
85 #endif
87 #if (CORE_INLINE & PSIM_INLINE_LOCALS)
88 # define STATIC_INLINE_CORE(TYPE) static INLINE TYPE
89 #else
90 # define STATIC_INLINE_CORE(TYPE) static TYPE
91 #endif
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
100 #else
101 # define INLINE_VM(TYPE) static TYPE UNUSED
102 # define EXTERN_VM(TYPE) static TYPE UNUSED
103 #endif
104 #else
105 # define INLINE_VM(TYPE) TYPE
106 # define EXTERN_VM(TYPE) TYPE
107 #endif
109 #if (VM_INLINE & PSIM_INLINE_LOCALS)
110 # define STATIC_INLINE_VM(TYPE) static INLINE TYPE
111 #else
112 # define STATIC_INLINE_VM(TYPE) static TYPE
113 #endif
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
122 #else
123 # define INLINE_CPU(TYPE) static TYPE UNUSED
124 # define EXTERN_CPU(TYPE) static TYPE UNUSED
125 #endif
126 #else
127 # define INLINE_CPU(TYPE) TYPE
128 # define EXTERN_CPU(TYPE) TYPE
129 #endif
131 #if (CPU_INLINE & PSIM_INLINE_LOCALS)
132 # define STATIC_INLINE_CPU(TYPE) static INLINE TYPE
133 #else
134 # define STATIC_INLINE_CPU(TYPE) static TYPE
135 #endif
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
144 #else
145 # define INLINE_MODEL(TYPE) static TYPE UNUSED
146 # define EXTERN_MODEL(TYPE) static TYPE UNUSED
147 #endif
148 #else
149 # define INLINE_MODEL(TYPE) TYPE
150 # define EXTERN_MODEL(TYPE) TYPE
151 #endif
153 #if (MODEL_INLINE & PSIM_INLINE_LOCALS)
154 # define STATIC_INLINE_MODEL(TYPE) static INLINE TYPE
155 #else
156 # define STATIC_INLINE_MODEL(TYPE) static TYPE
157 #endif
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
166 #else
167 # define INLINE_EVENTS(TYPE) static TYPE UNUSED
168 # define EXTERN_EVENTS(TYPE) static TYPE UNUSED
169 #endif
170 #else
171 # define INLINE_EVENTS(TYPE) TYPE
172 # define EXTERN_EVENTS(TYPE) TYPE
173 #endif
175 #if (EVENTS_INLINE & PSIM_INLINE_LOCALS)
176 # define STATIC_INLINE_EVENTS(TYPE) static INLINE TYPE
177 #else
178 # define STATIC_INLINE_EVENTS(TYPE) static TYPE
179 #endif
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
188 #else
189 # define INLINE_MON(TYPE) static TYPE UNUSED
190 # define EXTERN_MON(TYPE) static TYPE UNUSED
191 #endif
192 #else
193 # define INLINE_MON(TYPE) TYPE
194 # define EXTERN_MON(TYPE) TYPE
195 #endif
197 #if (MON_INLINE & PSIM_INLINE_LOCALS)
198 # define STATIC_INLINE_MON(TYPE) static INLINE TYPE
199 #else
200 # define STATIC_INLINE_MON(TYPE) static TYPE
201 #endif
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
210 #else
211 # define INLINE_REGISTERS(TYPE) static TYPE UNUSED
212 # define EXTERN_REGISTERS(TYPE) static TYPE UNUSED
213 #endif
214 #else
215 # define INLINE_REGISTERS(TYPE) TYPE
216 # define EXTERN_REGISTERS(TYPE) TYPE
217 #endif
219 #if (REGISTERS_INLINE & PSIM_INLINE_LOCALS)
220 # define STATIC_INLINE_REGISTERS(TYPE) static INLINE TYPE
221 #else
222 # define STATIC_INLINE_REGISTERS(TYPE) static TYPE
223 #endif
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
232 #else
233 # define INLINE_INTERRUPTS(TYPE) static TYPE UNUSED
234 # define EXTERN_INTERRUPTS(TYPE) static TYPE UNUSED
235 #endif
236 #else
237 # define INLINE_INTERRUPTS(TYPE) TYPE
238 # define EXTERN_INTERRUPTS(TYPE) TYPE
239 #endif
241 #if (INTERRUPTS_INLINE & PSIM_INLINE_LOCALS)
242 # define STATIC_INLINE_INTERRUPTS(TYPE) static INLINE TYPE
243 #else
244 # define STATIC_INLINE_INTERRUPTS(TYPE) static TYPE
245 #endif
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
254 #else
255 # define INLINE_DEVICE(TYPE) static TYPE UNUSED
256 # define EXTERN_DEVICE(TYPE) static TYPE UNUSED
257 #endif
258 #else
259 # define INLINE_DEVICE(TYPE) TYPE
260 # define EXTERN_DEVICE(TYPE) TYPE
261 #endif
263 #if (DEVICE_INLINE & PSIM_INLINE_LOCALS)
264 # define STATIC_INLINE_DEVICE(TYPE) static INLINE TYPE
265 #else
266 # define STATIC_INLINE_DEVICE(TYPE) static TYPE
267 #endif
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
276 #else
277 # define INLINE_TREE(TYPE) static TYPE UNUSED
278 # define EXTERN_TREE(TYPE) static TYPE UNUSED
279 #endif
280 #else
281 # define INLINE_TREE(TYPE) TYPE
282 # define EXTERN_TREE(TYPE) TYPE
283 #endif
285 #if (TREE_INLINE & PSIM_INLINE_LOCALS)
286 # define STATIC_INLINE_TREE(TYPE) static INLINE TYPE
287 #else
288 # define STATIC_INLINE_TREE(TYPE) static TYPE
289 #endif
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
298 #else
299 # define INLINE_SPREG(TYPE) static TYPE UNUSED
300 # define EXTERN_SPREG(TYPE) static TYPE UNUSED
301 #endif
302 #else
303 # define INLINE_SPREG(TYPE) TYPE
304 # define EXTERN_SPREG(TYPE) TYPE
305 #endif
307 #if (SPREG_INLINE & PSIM_INLINE_LOCALS)
308 # define STATIC_INLINE_SPREG(TYPE) static INLINE TYPE
309 #else
310 # define STATIC_INLINE_SPREG(TYPE) static TYPE
311 #endif
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
320 #else
321 # define PSIM_INLINE_SEMANTICS(TYPE) static TYPE UNUSED
322 # define PSIM_EXTERN_SEMANTICS(TYPE) static TYPE UNUSED
323 #endif
324 #else
325 # define PSIM_INLINE_SEMANTICS(TYPE) TYPE
326 # define PSIM_EXTERN_SEMANTICS(TYPE) TYPE
327 #endif
329 #if 0 /* this isn't used */
330 #if (SEMANTICS_INLINE & PSIM_INLINE_LOCALS)
331 # define STATIC_INLINE_SEMANTICS(TYPE) static INLINE TYPE
332 #else
333 # define STATIC_INLINE_SEMANTICS(TYPE) static TYPE
334 #endif
335 #endif
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
344 #else
345 # define PSIM_INLINE_IDECODE(TYPE) static TYPE UNUSED
346 # define EXTERN_IDECODE(TYPE) static TYPE UNUSED
347 #endif
348 #else
349 # define PSIM_INLINE_IDECODE(TYPE) TYPE
350 # define EXTERN_IDECODE(TYPE) TYPE
351 #endif
353 #if 0 /* this isn't used */
354 #if (IDECODE_INLINE & PSIM_INLINE_LOCALS)
355 # define STATIC_INLINE_IDECODE(TYPE) static INLINE TYPE
356 #else
357 # define STATIC_INLINE_IDECODE(TYPE) static TYPE
358 #endif
359 #endif
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
368 #else
369 # define PSIM_INLINE_ICACHE(TYPE) static TYPE UNUSED
370 # define EXTERN_ICACHE(TYPE) static TYPE UNUSED
371 #endif
372 #else
373 # define PSIM_INLINE_ICACHE(TYPE) TYPE
374 # define EXTERN_ICACHE(TYPE) TYPE
375 #endif
377 #if 0 /* this isn't used */
378 #if (ICACHE_INLINE & PSIM_INLINE_LOCALS)
379 # define STATIC_INLINE_ICACHE(TYPE) static INLINE TYPE
380 #else
381 # define STATIC_INLINE_ICACHE(TYPE) static TYPE
382 #endif
383 #endif
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
392 #else
393 # define PSIM_INLINE_SUPPORT(TYPE) static TYPE UNUSED
394 # define EXTERN_SUPPORT(TYPE) static TYPE UNUSED
395 #endif
396 #else
397 # define PSIM_INLINE_SUPPORT(TYPE) TYPE
398 # define EXTERN_SUPPORT(TYPE) TYPE
399 #endif
401 #if 0 /* this isn't used */
402 #if (SUPPORT_INLINE & PSIM_INLINE_LOCALS)
403 # define STATIC_INLINE_SUPPORT(TYPE) static INLINE TYPE
404 #else
405 # define STATIC_INLINE_SUPPORT(TYPE) static TYPE
406 #endif
407 #endif
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
416 #else
417 # define INLINE_OPTIONS(TYPE) static TYPE UNUSED
418 # define EXTERN_OPTIONS(TYPE) static TYPE UNUSED
419 #endif
420 #else
421 # define INLINE_OPTIONS(TYPE) TYPE
422 # define EXTERN_OPTIONS(TYPE) TYPE
423 #endif
425 #if (OPTIONS_INLINE & PSIM_INLINE_LOCALS)
426 # define STATIC_INLINE_OPTIONS(TYPE) static INLINE TYPE
427 #else
428 # define STATIC_INLINE_OPTIONS(TYPE) static TYPE
429 #endif
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
438 #else
439 # define INLINE_OS_EMUL(TYPE) static TYPE UNUSED
440 # define EXTERN_OS_EMUL(TYPE) static TYPE UNUSED
441 #endif
442 #else
443 # define INLINE_OS_EMUL(TYPE) TYPE
444 # define EXTERN_OS_EMUL(TYPE) TYPE
445 #endif
447 #if (OS_EMUL_INLINE & PSIM_INLINE_LOCALS)
448 # define STATIC_INLINE_OS_EMUL(TYPE) static INLINE TYPE
449 #else
450 # define STATIC_INLINE_OS_EMUL(TYPE) static TYPE
451 #endif
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
460 #else
461 # define INLINE_PSIM(TYPE) static TYPE UNUSED
462 # define EXTERN_PSIM(TYPE) static TYPE UNUSED
463 #endif
464 #else
465 # define INLINE_PSIM(TYPE) TYPE
466 # define EXTERN_PSIM(TYPE) TYPE
467 #endif
469 #if (PSIM_INLINE & PSIM_INLINE_LOCALS)
470 # define STATIC_INLINE_PSIM(TYPE) static INLINE TYPE
471 #else
472 # define STATIC_INLINE_PSIM(TYPE) static TYPE
473 #endif
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
482 #else
483 # define INLINE_CAP(TYPE) static TYPE UNUSED
484 # define EXTERN_CAP(TYPE) static TYPE UNUSED
485 #endif
486 #else
487 # define INLINE_CAP(TYPE) TYPE
488 # define EXTERN_CAP(TYPE) TYPE
489 #endif
491 #if (CAP_INLINE & PSIM_INLINE_LOCALS)
492 # define STATIC_INLINE_CAP(TYPE) static INLINE TYPE
493 #else
494 # define STATIC_INLINE_CAP(TYPE) static TYPE
495 #endif
497 #endif