Commit | Line | Data |
---|---|---|
b85e4829 AC |
1 | /* The common simulator framework for GDB, the GNU Debugger. |
2 | ||
3666a048 | 3 | Copyright 2002-2021 Free Software Foundation, Inc. |
b85e4829 AC |
4 | |
5 | Contributed by Andrew Cagney and Red Hat. | |
6 | ||
7 | This file is part of GDB. | |
8 | ||
9 | This program is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
4744ac1b | 11 | the Free Software Foundation; either version 3 of the License, or |
b85e4829 AC |
12 | (at your option) any later version. |
13 | ||
14 | This program is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
4744ac1b | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c906108c SS |
21 | |
22 | ||
23 | #ifndef SIM_INLINE_H | |
24 | #define SIM_INLINE_H | |
25 | ||
26 | ||
27 | /* INLINE CODE SELECTION: | |
28 | ||
29 | GCC -O3 attempts to inline any function or procedure in scope. The | |
30 | options below facilitate finer grained control over what is and | |
31 | what is not inlined. In particular, it allows the selection of | |
32 | modules for inlining. Doing this allows the compiler to both | |
33 | eliminate the overhead of function calls and (as a consequence) | |
34 | also eliminate further dead code. | |
35 | ||
c272cb46 | 36 | On a CISC (x86) I've found that I can achieve an order of magnitude |
c906108c SS |
37 | speed improvement (x3-x5). In the case of RISC (sparc) while the |
38 | performance gain isn't as great it is still significant. | |
39 | ||
40 | Each module is controled by the macro <module>_INLINE which can | |
41 | have the values described below | |
42 | ||
43 | 0 (ZERO) | |
44 | ||
45 | Do not inline any thing for the given module | |
46 | ||
47 | The following bit fields values can be combined: | |
48 | ||
49 | H_REVEALS_MODULE: | |
50 | C_REVEALS_MODULE: | |
51 | ||
52 | Include the C file for the module into the file being | |
53 | compiled. The actual inlining is controlled separatly. | |
54 | ||
55 | While of no apparent benefit, this makes it possible for the | |
56 | included module, when compiled, to inline its calls to what | |
57 | would otherwize be external functions. | |
58 | ||
59 | {C_,H_} Determines where the module is inlined. A | |
60 | H_REVEALS_MODULE will be included everywhere. | |
61 | ||
62 | INLINE_GLOBALS: | |
63 | ||
64 | Make external functions within the module `inline'. Thus if | |
65 | the module is included into a file being compiled, calls to | |
66 | the included modules funtions can be eliminated. INLINE_MODULE | |
67 | implies REVEAL_MODULE. | |
68 | ||
69 | INLINE_LOCALS: | |
70 | ||
71 | Make internal (static) functions within the module `inline'. | |
72 | ||
73 | ||
74 | CODING STYLE: | |
75 | ||
76 | The inline ability is enabled by specifying every data and function | |
77 | declaration and definition using one of the following methods: | |
78 | ||
79 | ||
80 | GLOBAL INLINE FUNCTIONS: | |
81 | ||
82 | Such functions are small and used heavily. Inlining them | |
83 | will eliminate an unnecessary function call overhead. | |
84 | ||
85 | .h: INLINE_OURPKG (void) ourpkg_func | |
86 | (int x, | |
87 | int y); | |
88 | ||
89 | .c: INLINE_OURPKG (void) | |
90 | ourpkg_func (int x, | |
91 | int y) | |
92 | { | |
93 | ... | |
94 | } | |
95 | ||
96 | ||
97 | GLOBAL INLINE VARIABLES: | |
98 | ||
99 | This doesn't make much sense. | |
100 | ||
101 | ||
102 | GLOBAL NON-INLINE (EXTERN) FUNCTIONS AND VARIABLES: | |
103 | ||
104 | These include functions with varargs parameters. It can | |
105 | also include large rarely used functions that contribute | |
106 | little when inlined. | |
107 | ||
108 | .h: extern int ourpkg_print | |
109 | (char *fmt, ...); | |
110 | extern int a_global_variable; | |
111 | ||
112 | .c: #if EXTERN_OURPKG_P | |
113 | int | |
114 | ourpkg_print (char *fmt, | |
115 | ...) | |
116 | { | |
117 | ... | |
118 | } | |
119 | #endif | |
120 | #if EXTERN_OURPKG_P | |
121 | int a_global_variable = 1; | |
122 | #endif | |
123 | ||
124 | ||
125 | LOCAL (STATIC) FUNCTIONS: | |
126 | ||
127 | These can either be marked inline or just static static vis: | |
128 | ||
129 | .h: STATIC_INLINE_OURPKG (int) ourpkg_staticf (void); | |
130 | .c: STATIC_INLINE_OURPKG (int) | |
131 | ourpkg_staticf (void) | |
132 | { | |
133 | .. | |
134 | } | |
135 | ||
136 | .h: STATIC_OURPKG (int) ourpkg_staticf (void); | |
137 | .c: STATIC_OURPKG (int) | |
138 | ourpkg_staticf (void) | |
139 | { | |
140 | .. | |
141 | } | |
142 | ||
143 | ||
144 | All .h files: | |
145 | ||
146 | ||
147 | All modules must wrap their .h code in the following: | |
148 | ||
149 | #ifndef OURPKG_H | |
150 | #define OURPKG_H | |
151 | ... code proper ... | |
152 | #endif | |
153 | ||
154 | In addition, modules that want to allow global inlining must | |
155 | include the lines (below) at the end of the .h file. (FIXME: | |
156 | Shouldn't be needed). | |
157 | ||
158 | #if H_REVEALS_MODULE_P (OURPKG_INLINE) | |
159 | #include "ourpkg.c" | |
160 | #endif | |
161 | ||
162 | ||
163 | All .c files: | |
164 | ||
165 | All modules must wrap their .c code in the following | |
166 | ||
167 | #ifndef OURPKG_C | |
168 | #define OURPKG_C | |
169 | ... code proper ... | |
170 | #endif | |
171 | ||
172 | ||
173 | NOW IT WORKS: | |
174 | ||
175 | 0: | |
176 | ||
177 | Since no inlining is defined. All macro's get standard defaults | |
178 | (extern, static, ...). | |
028f6515 | 179 | |
c906108c SS |
180 | |
181 | ||
182 | H_REVEALS_MODULE (alt includes our): | |
183 | ||
184 | ||
185 | altprog.c defines ALTPROG_C and then includes sim-inline.h. | |
186 | ||
187 | In sim-inline.h the expression `` H_REVEALS_MODULE_P | |
188 | (OURPROG_INLINE) && ! defined (OURPROG_C) && REVEAL_MODULE_P | |
189 | (OURPROG_INLINE) '' is TRUE so it defines *_OURPROG as static | |
190 | and EXTERN_OURPROG_P as FALSE. | |
191 | ||
192 | altprog.c includes ourprog.h. | |
193 | ||
194 | In ourprog.h the expression ``H_REVEALS_MODULE_P | |
195 | (OURPROG_INLINE)'' is TRUE so it includes ourprog.c. | |
196 | ||
197 | Consequently, all the code in ourprog.c is visible and static in | |
198 | the file altprog.c | |
199 | ||
200 | ||
201 | ||
202 | H_REVEALS_MODULE (our includes our): | |
203 | ||
204 | ||
205 | ourprog.c defines OURPROG_C and then includes sim-inline.h. | |
206 | ||
207 | In sim-inline.h the term `` ! defined (OURPROG_C) '' is FALSE so | |
208 | it defines *_OURPROG as non-static and EXTERN_OURPROG_P as TRUE. | |
209 | ||
210 | ourprog.c includes ourprog.h. | |
211 | ||
212 | In ourprog.h the expression ``H_REVEALS_MODULE_P | |
213 | (OURPROG_INLINE)'' is true so it includes ourprog.c. | |
214 | ||
215 | In ourprog.c (second include) the expression defined (OURPROG_C) | |
216 | and so the body is not re-included. | |
217 | ||
218 | Consequently, ourprog.o will contain a non-static copy of all | |
219 | the exported symbols. | |
220 | ||
221 | ||
222 | ||
223 | C_REVEALS_MODULE (alt includes our): | |
224 | ||
225 | ||
226 | altprog.c defines ALTPROG_C and then includes sim-inline.c | |
227 | ||
228 | sim-inline.c defines C_INLINE_C and then includes sim-inline.h | |
028f6515 | 229 | |
c906108c SS |
230 | In sim-inline.h the expression `` defined (SIM_INLINE) && ! |
231 | defined (OURPROG_C) && REVEAL_MODULE_P (OURPROG_INLINE) '' is | |
232 | true so it defines *_OURPROG as static and EXTERN_OURPROG_P as | |
233 | FALSE. | |
234 | ||
235 | In sim-inline.c the expression ``C_REVEALS_MODULE_P | |
236 | (OURPROG_INLINE)'' is true so it includes ourprog.c. | |
237 | ||
238 | Consequently, all the code in ourprog.c is visible and static in | |
239 | the file altprog.c. | |
240 | ||
241 | ||
242 | ||
243 | C_REVEALS_MODULE (our includes our): | |
244 | ||
245 | ||
246 | ourprog.c defines OURPROG_C and then includes sim-inline.c | |
247 | ||
248 | sim-inline.c defines C_INLINE_C and then includes sim-inline.h | |
028f6515 | 249 | |
c906108c SS |
250 | In sim-inline.h the term `` ! defined (OURPROG_C) '' is FALSE |
251 | so it defines *_OURPROG as non-static and EXTERN_OURPROG_P as | |
252 | TRUE. | |
253 | ||
254 | Consequently, ourprog.o will contain a non-static copy of all | |
255 | the exported symbols. | |
256 | ||
257 | ||
258 | ||
259 | REALITY CHECK: | |
260 | ||
261 | This is not for the faint hearted. I've seen GCC get up to 500mb | |
262 | trying to compile what this can create. */ | |
263 | \f | |
264 | #define H_REVEALS_MODULE 1 | |
265 | #define C_REVEALS_MODULE 2 | |
266 | #define INLINE_GLOBALS 4 | |
267 | #define INLINE_LOCALS 8 | |
268 | ||
c906108c SS |
269 | #define ALL_H_INLINE (H_REVEALS_MODULE | INLINE_GLOBALS | INLINE_LOCALS) |
270 | #define ALL_C_INLINE (C_REVEALS_MODULE | INLINE_GLOBALS | INLINE_LOCALS) | |
271 | ||
272 | ||
273 | /* Default macro to simplify control several of key the inlines */ | |
274 | ||
275 | #ifndef DEFAULT_INLINE | |
276 | #define DEFAULT_INLINE INLINE_LOCALS | |
277 | #endif | |
278 | ||
279 | #define REVEAL_MODULE_P(X) (X & (H_REVEALS_MODULE | C_REVEALS_MODULE)) | |
280 | #define H_REVEALS_MODULE_P(X) ((X & H_REVEALS_MODULE)) | |
281 | #define C_REVEALS_MODULE_P(X) ((X & C_REVEALS_MODULE)) | |
282 | ||
283 | ||
284 | #ifndef HAVE_INLINE | |
285 | #ifdef __GNUC__ | |
286 | #define HAVE_INLINE | |
287 | #endif | |
288 | #endif | |
289 | ||
290 | ||
291 | /* Your compilers inline prefix */ | |
292 | ||
293 | #ifndef INLINE | |
294 | #if defined (__GNUC__) && defined (__OPTIMIZE__) | |
295 | #define INLINE __inline__ | |
296 | #else | |
297 | #define INLINE /*inline*/ | |
298 | #endif | |
299 | #endif | |
300 | ||
301 | /* ??? Temporary, pending decision to always use extern inline and do a vast | |
302 | cleanup of inline support. */ | |
303 | #ifndef INLINE2 | |
92fc6153 MF |
304 | #if defined (__GNUC_GNU_INLINE__) || defined (__GNUC_STDC_INLINE__) |
305 | #define INLINE2 __inline__ __attribute__ ((__gnu_inline__)) | |
306 | #elif defined (__GNUC__) | |
c906108c SS |
307 | #define INLINE2 __inline__ |
308 | #else | |
309 | #define INLINE2 /*inline*/ | |
310 | #endif | |
311 | #endif | |
312 | ||
313 | ||
314 | /* Your compiler's static inline prefix */ | |
315 | ||
316 | #ifndef STATIC_INLINE | |
317 | #define STATIC_INLINE static INLINE | |
318 | #endif | |
319 | ||
320 | ||
321 | /* Your compiler's extern inline prefix */ | |
322 | ||
323 | #ifndef EXTERN_INLINE | |
324 | #define EXTERN_INLINE extern INLINE2 | |
325 | #endif | |
326 | ||
327 | ||
c906108c SS |
328 | /* Your compilers's unused reserved word */ |
329 | ||
330 | #if !defined (UNUSED) | |
f0c4dc40 | 331 | #define UNUSED ATTRIBUTE_UNUSED |
c906108c SS |
332 | #endif |
333 | ||
334 | ||
335 | ||
c906108c | 336 | \f |
ef986697 SH |
337 | |
338 | /* sim_arange */ | |
339 | ||
340 | #if !defined (SIM_ARANGE_INLINE) && (DEFAULT_INLINE) | |
341 | # define SIM_ARANGE_INLINE (ALL_H_INLINE) | |
342 | #endif | |
343 | ||
344 | #if ((H_REVEALS_MODULE_P (SIM_ARANGE_INLINE) || defined (SIM_INLINE_C)) \ | |
345 | && !defined (SIM_ARANGE_C) \ | |
346 | && (REVEAL_MODULE_P (SIM_ARANGE_INLINE))) | |
347 | # if (SIM_ARANGE_INLINE & INLINE_GLOBALS) | |
57a922a5 | 348 | # define INLINE_SIM_ARANGE(TYPE) static INLINE UNUSED TYPE |
ef986697 SH |
349 | # define EXTERN_SIM_ARANGE_P 0 |
350 | # else | |
57a922a5 | 351 | # define INLINE_SIM_ARANGE(TYPE) static UNUSED TYPE |
ef986697 SH |
352 | # define EXTERN_SIM_ARANGE_P 0 |
353 | # endif | |
354 | #else | |
355 | # define INLINE_SIM_ARANGE(TYPE) TYPE | |
356 | # define EXTERN_SIM_ARANGE_P 1 | |
357 | #endif | |
358 | ||
359 | #if (SIM_ARANGE_INLINE & INLINE_LOCALS) | |
360 | # define STATIC_INLINE_SIM_ARANGE(TYPE) static INLINE TYPE | |
361 | #else | |
362 | # define STATIC_INLINE_SIM_ARANGE(TYPE) static TYPE | |
363 | #endif | |
364 | ||
365 | #define STATIC_SIM_ARANGE(TYPE) static TYPE | |
366 | ||
367 | ||
368 | ||
c906108c SS |
369 | /* ***** |
370 | sim-bits and sim-endian are treated differently from the rest | |
371 | of the modules below. Their default value is ALL_H_INLINE. | |
372 | The rest are ALL_C_INLINE. Don't blink, you'll miss it! | |
373 | ***** | |
374 | */ | |
375 | ||
376 | /* sim-bits */ | |
377 | ||
378 | #if !defined (SIM_BITS_INLINE) && (DEFAULT_INLINE) | |
379 | # define SIM_BITS_INLINE (ALL_H_INLINE) | |
380 | #endif | |
381 | ||
c906108c SS |
382 | #if ((H_REVEALS_MODULE_P (SIM_BITS_INLINE) || defined (SIM_INLINE_C)) \ |
383 | && !defined (SIM_BITS_C) \ | |
384 | && (REVEAL_MODULE_P (SIM_BITS_INLINE))) | |
385 | # if (SIM_BITS_INLINE & INLINE_GLOBALS) | |
57a922a5 | 386 | # define INLINE_SIM_BITS(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
387 | # define EXTERN_SIM_BITS_P 0 |
388 | # else | |
57a922a5 | 389 | # define INLINE_SIM_BITS(TYPE) static UNUSED TYPE |
c906108c SS |
390 | # define EXTERN_SIM_BITS_P 0 |
391 | # endif | |
392 | #else | |
0dc73ef7 | 393 | # define INLINE_SIM_BITS(TYPE) TYPE |
c906108c SS |
394 | # define EXTERN_SIM_BITS_P 1 |
395 | #endif | |
396 | ||
397 | #if (SIM_BITS_INLINE & INLINE_LOCALS) | |
398 | # define STATIC_INLINE_SIM_BITS(TYPE) static INLINE TYPE | |
399 | #else | |
0dc73ef7 | 400 | # define STATIC_INLINE_SIM_BITS(TYPE) static TYPE |
c906108c SS |
401 | #endif |
402 | ||
403 | #define STATIC_SIM_BITS(TYPE) static TYPE | |
404 | ||
405 | ||
406 | ||
407 | /* sim-core */ | |
408 | ||
409 | #if !defined (SIM_CORE_INLINE) && (DEFAULT_INLINE) | |
410 | # define SIM_CORE_INLINE ALL_C_INLINE | |
411 | #endif | |
412 | ||
c906108c SS |
413 | #if ((H_REVEALS_MODULE_P (SIM_CORE_INLINE) || defined (SIM_INLINE_C)) \ |
414 | && !defined (SIM_CORE_C) \ | |
415 | && (REVEAL_MODULE_P (SIM_CORE_INLINE))) | |
416 | # if (SIM_CORE_INLINE & INLINE_GLOBALS) | |
57a922a5 | 417 | # define INLINE_SIM_CORE(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
418 | # define EXTERN_SIM_CORE_P 0 |
419 | #else | |
57a922a5 | 420 | # define INLINE_SIM_CORE(TYPE) static UNUSED TYPE |
c906108c SS |
421 | # define EXTERN_SIM_CORE_P 0 |
422 | #endif | |
423 | #else | |
0dc73ef7 | 424 | # define INLINE_SIM_CORE(TYPE) TYPE |
c906108c SS |
425 | # define EXTERN_SIM_CORE_P 1 |
426 | #endif | |
427 | ||
428 | #if (SIM_CORE_INLINE & INLINE_LOCALS) | |
429 | # define STATIC_INLINE_SIM_CORE(TYPE) static INLINE TYPE | |
430 | #else | |
0dc73ef7 | 431 | # define STATIC_INLINE_SIM_CORE(TYPE) static TYPE |
c906108c SS |
432 | #endif |
433 | ||
434 | #define STATIC_SIM_CORE(TYPE) static TYPE | |
435 | ||
436 | ||
437 | ||
438 | /* sim-endian */ | |
439 | ||
440 | #if !defined (SIM_ENDIAN_INLINE) && (DEFAULT_INLINE) | |
441 | # define SIM_ENDIAN_INLINE ALL_H_INLINE | |
442 | #endif | |
443 | ||
c906108c SS |
444 | #if ((H_REVEALS_MODULE_P (SIM_ENDIAN_INLINE) || defined (SIM_INLINE_C)) \ |
445 | && !defined (SIM_ENDIAN_C) \ | |
446 | && (REVEAL_MODULE_P (SIM_ENDIAN_INLINE))) | |
447 | # if (SIM_ENDIAN_INLINE & INLINE_GLOBALS) | |
57a922a5 | 448 | # define INLINE_SIM_ENDIAN(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
449 | # define EXTERN_SIM_ENDIAN_P 0 |
450 | # else | |
57a922a5 | 451 | # define INLINE_SIM_ENDIAN(TYPE) static UNUSED TYPE |
c906108c SS |
452 | # define EXTERN_SIM_ENDIAN_P 0 |
453 | # endif | |
454 | #else | |
0dc73ef7 | 455 | # define INLINE_SIM_ENDIAN(TYPE) TYPE |
c906108c SS |
456 | # define EXTERN_SIM_ENDIAN_P 1 |
457 | #endif | |
458 | ||
459 | #if (SIM_ENDIAN_INLINE & INLINE_LOCALS) | |
460 | # define STATIC_INLINE_SIM_ENDIAN(TYPE) static INLINE TYPE | |
461 | #else | |
0dc73ef7 | 462 | # define STATIC_INLINE_SIM_ENDIAN(TYPE) static TYPE |
c906108c SS |
463 | #endif |
464 | ||
465 | #define STATIC_SIM_ENDIAN(TYPE) static TYPE | |
466 | ||
467 | ||
468 | ||
469 | /* sim-events */ | |
470 | ||
471 | #if !defined (SIM_EVENTS_INLINE) && (DEFAULT_INLINE) | |
472 | # define SIM_EVENTS_INLINE ALL_C_INLINE | |
473 | #endif | |
474 | ||
c906108c SS |
475 | #if ((H_REVEALS_MODULE_P (SIM_EVENTS_INLINE) || defined (SIM_INLINE_C)) \ |
476 | && !defined (SIM_EVENTS_C) \ | |
477 | && (REVEAL_MODULE_P (SIM_EVENTS_INLINE))) | |
478 | # if (SIM_EVENTS_INLINE & INLINE_GLOBALS) | |
57a922a5 | 479 | # define INLINE_SIM_EVENTS(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
480 | # define EXTERN_SIM_EVENTS_P 0 |
481 | # else | |
57a922a5 | 482 | # define INLINE_SIM_EVENTS(TYPE) static UNUSED TYPE |
c906108c SS |
483 | # define EXTERN_SIM_EVENTS_P 0 |
484 | # endif | |
485 | #else | |
0dc73ef7 | 486 | # define INLINE_SIM_EVENTS(TYPE) TYPE |
c906108c SS |
487 | # define EXTERN_SIM_EVENTS_P 1 |
488 | #endif | |
489 | ||
490 | #if (SIM_EVENTS_INLINE & INLINE_LOCALS) | |
491 | # define STATIC_INLINE_SIM_EVENTS(TYPE) static INLINE TYPE | |
492 | #else | |
0dc73ef7 | 493 | # define STATIC_INLINE_SIM_EVENTS(TYPE) static TYPE |
c906108c SS |
494 | #endif |
495 | ||
496 | #define STATIC_SIM_EVENTS(TYPE) static TYPE | |
497 | ||
498 | ||
499 | ||
500 | /* sim-fpu */ | |
501 | ||
502 | #if !defined (SIM_FPU_INLINE) && (DEFAULT_INLINE) | |
503 | # define SIM_FPU_INLINE ALL_C_INLINE | |
504 | #endif | |
505 | ||
c906108c SS |
506 | #if ((H_REVEALS_MODULE_P (SIM_FPU_INLINE) || defined (SIM_INLINE_C)) \ |
507 | && !defined (SIM_FPU_C) \ | |
508 | && (REVEAL_MODULE_P (SIM_FPU_INLINE))) | |
509 | # if (SIM_FPU_INLINE & INLINE_GLOBALS) | |
57a922a5 | 510 | # define INLINE_SIM_FPU(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
511 | # define EXTERN_SIM_FPU_P 0 |
512 | # else | |
57a922a5 | 513 | # define INLINE_SIM_FPU(TYPE) static UNUSED TYPE |
c906108c SS |
514 | # define EXTERN_SIM_FPU_P 0 |
515 | # endif | |
516 | #else | |
0dc73ef7 | 517 | # define INLINE_SIM_FPU(TYPE) TYPE |
c906108c SS |
518 | # define EXTERN_SIM_FPU_P 1 |
519 | #endif | |
520 | ||
521 | #if (SIM_FPU_INLINE & INLINE_LOCALS) | |
522 | # define STATIC_INLINE_SIM_FPU(TYPE) static INLINE TYPE | |
523 | #else | |
0dc73ef7 | 524 | # define STATIC_INLINE_SIM_FPU(TYPE) static TYPE |
c906108c SS |
525 | #endif |
526 | ||
527 | #define STATIC_SIM_FPU(TYPE) static TYPE | |
528 | ||
529 | ||
530 | ||
531 | /* sim-types */ | |
532 | ||
c906108c SS |
533 | #if ((H_REVEALS_MODULE_P (SIM_TYPES_INLINE) || defined (SIM_INLINE_C)) \ |
534 | && !defined (SIM_TYPES_C) \ | |
535 | && (REVEAL_MODULE_P (SIM_TYPES_INLINE))) | |
536 | # if (SIM_TYPES_INLINE & INLINE_GLOBALS) | |
57a922a5 | 537 | # define INLINE_SIM_TYPES(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
538 | # define EXTERN_SIM_TYPES_P 0 |
539 | # else | |
57a922a5 | 540 | # define INLINE_SIM_TYPES(TYPE) static UNUSED TYPE |
c906108c SS |
541 | # define EXTERN_SIM_TYPES_P 0 |
542 | # endif | |
543 | #else | |
0dc73ef7 | 544 | # define INLINE_SIM_TYPES(TYPE) TYPE |
c906108c SS |
545 | # define EXTERN_SIM_TYPES_P 1 |
546 | #endif | |
547 | ||
548 | #if (SIM_TYPES_INLINE & INLINE_LOCALS) | |
549 | # define STATIC_INLINE_SIM_TYPES(TYPE) static INLINE TYPE | |
550 | #else | |
0dc73ef7 | 551 | # define STATIC_INLINE_SIM_TYPES(TYPE) static TYPE |
c906108c SS |
552 | #endif |
553 | ||
554 | #define STATIC_SIM_TYPES(TYPE) static TYPE | |
555 | ||
556 | ||
557 | ||
558 | /* sim_main */ | |
559 | ||
560 | #if !defined (SIM_MAIN_INLINE) && (DEFAULT_INLINE) | |
561 | # define SIM_MAIN_INLINE (ALL_C_INLINE) | |
562 | #endif | |
563 | ||
c906108c SS |
564 | #if ((H_REVEALS_MODULE_P (SIM_MAIN_INLINE) || defined (SIM_INLINE_C)) \ |
565 | && !defined (SIM_MAIN_C) \ | |
566 | && (REVEAL_MODULE_P (SIM_MAIN_INLINE))) | |
567 | # if (SIM_MAIN_INLINE & INLINE_GLOBALS) | |
57a922a5 | 568 | # define INLINE_SIM_MAIN(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
569 | # define EXTERN_SIM_MAIN_P 0 |
570 | # else | |
57a922a5 | 571 | # define INLINE_SIM_MAIN(TYPE) static UNUSED TYPE |
c906108c SS |
572 | # define EXTERN_SIM_MAIN_P 0 |
573 | # endif | |
574 | #else | |
0dc73ef7 | 575 | # define INLINE_SIM_MAIN(TYPE) TYPE |
c906108c SS |
576 | # define EXTERN_SIM_MAIN_P 1 |
577 | #endif | |
578 | ||
579 | #if (SIM_MAIN_INLINE & INLINE_LOCALS) | |
580 | # define STATIC_INLINE_SIM_MAIN(TYPE) static INLINE TYPE | |
581 | #else | |
0dc73ef7 | 582 | # define STATIC_INLINE_SIM_MAIN(TYPE) static TYPE |
c906108c SS |
583 | #endif |
584 | ||
585 | #define STATIC_SIM_MAIN(TYPE) static TYPE | |
586 | \f | |
587 | /* engine */ | |
588 | ||
c906108c SS |
589 | #if ((H_REVEALS_MODULE_P (ENGINE_INLINE) || defined (SIM_INLINE_C)) \ |
590 | && !defined (ENGINE_C) \ | |
591 | && (REVEAL_MODULE_P (ENGINE_INLINE))) | |
592 | # if (ENGINE_INLINE & INLINE_GLOBALS) | |
57a922a5 | 593 | # define INLINE_ENGINE(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
594 | # define EXTERN_ENGINE_P 0 |
595 | # else | |
57a922a5 | 596 | # define INLINE_ENGINE(TYPE) static UNUSED TYPE |
c906108c SS |
597 | # define EXTERN_ENGINE_P 0 |
598 | # endif | |
599 | #else | |
0dc73ef7 | 600 | # define INLINE_ENGINE(TYPE) TYPE |
c906108c SS |
601 | # define EXTERN_ENGINE_P 1 |
602 | #endif | |
603 | ||
604 | #if (ENGINE_INLINE & INLINE_LOCALS) | |
605 | # define STATIC_INLINE_ENGINE(TYPE) static INLINE TYPE | |
606 | #else | |
0dc73ef7 | 607 | # define STATIC_INLINE_ENGINE(TYPE) static TYPE |
c906108c SS |
608 | #endif |
609 | ||
610 | #define STATIC_ENGINE(TYPE) static TYPE | |
611 | ||
612 | ||
613 | ||
614 | /* icache */ | |
615 | ||
c906108c SS |
616 | #if ((H_REVEALS_MODULE_P (ICACHE_INLINE) || defined (SIM_INLINE_C)) \ |
617 | && !defined (ICACHE_C) \ | |
618 | && (REVEAL_MODULE_P (ICACHE_INLINE))) | |
619 | # if (ICACHE_INLINE & INLINE_GLOBALS) | |
57a922a5 | 620 | # define INLINE_ICACHE(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
621 | # define EXTERN_ICACHE_P 0 |
622 | #else | |
57a922a5 | 623 | # define INLINE_ICACHE(TYPE) static UNUSED TYPE |
c906108c SS |
624 | # define EXTERN_ICACHE_P 0 |
625 | #endif | |
626 | #else | |
0dc73ef7 | 627 | # define INLINE_ICACHE(TYPE) TYPE |
c906108c SS |
628 | # define EXTERN_ICACHE_P 1 |
629 | #endif | |
630 | ||
631 | #if (ICACHE_INLINE & INLINE_LOCALS) | |
632 | # define STATIC_INLINE_ICACHE(TYPE) static INLINE TYPE | |
633 | #else | |
0dc73ef7 | 634 | # define STATIC_INLINE_ICACHE(TYPE) static TYPE |
c906108c SS |
635 | #endif |
636 | ||
637 | #define STATIC_ICACHE(TYPE) static TYPE | |
638 | ||
639 | ||
640 | ||
641 | /* idecode */ | |
642 | ||
c906108c SS |
643 | #if ((H_REVEALS_MODULE_P (IDECODE_INLINE) || defined (SIM_INLINE_C)) \ |
644 | && !defined (IDECODE_C) \ | |
645 | && (REVEAL_MODULE_P (IDECODE_INLINE))) | |
646 | # if (IDECODE_INLINE & INLINE_GLOBALS) | |
57a922a5 | 647 | # define INLINE_IDECODE(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
648 | # define EXTERN_IDECODE_P 0 |
649 | #else | |
57a922a5 | 650 | # define INLINE_IDECODE(TYPE) static UNUSED TYPE |
c906108c SS |
651 | # define EXTERN_IDECODE_P 0 |
652 | #endif | |
653 | #else | |
0dc73ef7 | 654 | # define INLINE_IDECODE(TYPE) TYPE |
c906108c SS |
655 | # define EXTERN_IDECODE_P 1 |
656 | #endif | |
657 | ||
658 | #if (IDECODE_INLINE & INLINE_LOCALS) | |
659 | # define STATIC_INLINE_IDECODE(TYPE) static INLINE TYPE | |
660 | #else | |
0dc73ef7 | 661 | # define STATIC_INLINE_IDECODE(TYPE) static TYPE |
c906108c SS |
662 | #endif |
663 | ||
664 | #define STATIC_IDECODE(TYPE) static TYPE | |
665 | ||
666 | ||
667 | ||
668 | /* semantics */ | |
669 | ||
c906108c SS |
670 | #if ((H_REVEALS_MODULE_P (SEMANTICS_INLINE) || defined (SIM_INLINE_C)) \ |
671 | && !defined (SEMANTICS_C) \ | |
672 | && (REVEAL_MODULE_P (SEMANTICS_INLINE))) | |
673 | # if (SEMANTICS_INLINE & INLINE_GLOBALS) | |
57a922a5 | 674 | # define INLINE_SEMANTICS(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
675 | # define EXTERN_SEMANTICS_P 0 |
676 | #else | |
57a922a5 | 677 | # define INLINE_SEMANTICS(TYPE) static UNUSED TYPE |
c906108c SS |
678 | # define EXTERN_SEMANTICS_P 0 |
679 | #endif | |
680 | #else | |
0dc73ef7 | 681 | # define INLINE_SEMANTICS(TYPE) TYPE |
c906108c SS |
682 | # define EXTERN_SEMANTICS_P 1 |
683 | #endif | |
684 | ||
685 | #if EXTERN_SEMANTICS_P | |
0dc73ef7 | 686 | # define EXTERN_SEMANTICS(TYPE) TYPE |
c906108c | 687 | #else |
57a922a5 | 688 | # define EXTERN_SEMANTICS(TYPE) static UNUSED TYPE |
c906108c SS |
689 | #endif |
690 | ||
691 | #if (SEMANTICS_INLINE & INLINE_LOCALS) | |
692 | # define STATIC_INLINE_SEMANTICS(TYPE) static INLINE TYPE | |
693 | #else | |
0dc73ef7 | 694 | # define STATIC_INLINE_SEMANTICS(TYPE) static TYPE |
c906108c SS |
695 | #endif |
696 | ||
697 | #define STATIC_SEMANTICS(TYPE) static TYPE | |
698 | ||
699 | ||
700 | ||
701 | /* support */ | |
702 | ||
703 | #if !defined (SUPPORT_INLINE) && (DEFAULT_INLINE) | |
704 | # define SUPPORT_INLINE ALL_C_INLINE | |
705 | #endif | |
706 | ||
c906108c SS |
707 | #if ((H_REVEALS_MODULE_P (SUPPORT_INLINE) || defined (SIM_INLINE_C)) \ |
708 | && !defined (SUPPORT_C) \ | |
709 | && (REVEAL_MODULE_P (SUPPORT_INLINE))) | |
710 | # if (SUPPORT_INLINE & INLINE_GLOBALS) | |
57a922a5 | 711 | # define INLINE_SUPPORT(TYPE) static INLINE UNUSED TYPE |
c906108c SS |
712 | # define EXTERN_SUPPORT_P 0 |
713 | #else | |
57a922a5 | 714 | # define INLINE_SUPPORT(TYPE) static UNUSED TYPE |
c906108c SS |
715 | # define EXTERN_SUPPORT_P 0 |
716 | #endif | |
717 | #else | |
0dc73ef7 | 718 | # define INLINE_SUPPORT(TYPE) TYPE |
c906108c SS |
719 | # define EXTERN_SUPPORT_P 1 |
720 | #endif | |
721 | ||
722 | #if (SUPPORT_INLINE & INLINE_LOCALS) | |
723 | # define STATIC_INLINE_SUPPORT(TYPE) static INLINE TYPE | |
724 | #else | |
0dc73ef7 | 725 | # define STATIC_INLINE_SUPPORT(TYPE) static TYPE |
c906108c SS |
726 | #endif |
727 | ||
728 | #define STATIC_SUPPORT(TYPE) static TYPE | |
729 | ||
730 | ||
731 | ||
732 | #endif |