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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [sim/] [common/] [sim-inline.h] - Blame information for rev 330

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

Line No. Rev Author Line
1 330 jeremybenn
/* The common simulator framework for GDB, the GNU Debugger.
2
 
3
   Copyright 2002, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
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
11
   the Free Software Foundation; either version 3 of the License, or
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
20
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
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
 
36
   On a CISC (x86) I've found that I can achieve an order of magnitude
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
 
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, ...).
179
 
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
229
 
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
249
 
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
 
264
#define H_REVEALS_MODULE                1
265
#define C_REVEALS_MODULE                2
266
#define INLINE_GLOBALS                  4
267
#define INLINE_LOCALS                   8
268
 
269
#define REGPARM_MODULE                 32
270
 
271
#define ALL_H_INLINE (H_REVEALS_MODULE | INLINE_GLOBALS | INLINE_LOCALS)
272
#define ALL_C_INLINE (C_REVEALS_MODULE | INLINE_GLOBALS | INLINE_LOCALS)
273
 
274
 
275
/* Default macro to simplify control several of key the inlines */
276
 
277
#ifndef DEFAULT_INLINE
278
#define DEFAULT_INLINE                  INLINE_LOCALS
279
#endif
280
 
281
#define REVEAL_MODULE_P(X) (X & (H_REVEALS_MODULE | C_REVEALS_MODULE))
282
#define H_REVEALS_MODULE_P(X) ((X & H_REVEALS_MODULE))
283
#define C_REVEALS_MODULE_P(X) ((X & C_REVEALS_MODULE))
284
 
285
 
286
#ifndef HAVE_INLINE
287
#ifdef __GNUC__
288
#define HAVE_INLINE
289
#endif
290
#endif
291
 
292
 
293
/* Your compilers inline prefix */
294
 
295
#ifndef INLINE
296
#if defined (__GNUC__) && defined (__OPTIMIZE__)
297
#define INLINE __inline__
298
#else
299
#define INLINE /*inline*/
300
#endif
301
#endif
302
 
303
/* ??? Temporary, pending decision to always use extern inline and do a vast
304
   cleanup of inline support.  */
305
#ifndef INLINE2
306
#if defined (__GNUC__)
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
 
328
/* Your compiler's no-return reserved word */
329
 
330
#ifndef NORETURN
331
#define NORETURN
332
#endif
333
 
334
 
335
 
336
/* Your compilers's unused reserved word */
337
 
338
#if !defined (UNUSED)
339
#if (!defined (__GNUC__) \
340
     || (__GNUC__ < 2) \
341
     || (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
342
#define UNUSED
343
#else
344
#define UNUSED __attribute__((__unused__))
345
#endif
346
#endif
347
 
348
 
349
 
350
 
351
/* Your compilers nonstandard function call mechanism prefix */
352
 
353
#if !defined REGPARM
354
#if defined (__GNUC__) && (defined (__i386__) || defined (__i486__) || defined (__i586__) || defined (__i686__))
355
#if (WITH_REGPARM && WITH_STDCALL)
356
#define REGPARM __attribute__((__regparm__(WITH_REGPARM),__stdcall__))
357
#else
358
#if (WITH_REGPARM && !WITH_STDCALL)
359
#define REGPARM __attribute__((__regparm__(WITH_REGPARM)))
360
#else
361
#if (!WITH_REGPARM && WITH_STDCALL)
362
#define REGPARM __attribute__((__stdcall__))
363
#endif
364
#endif
365
#endif
366
#endif
367
#endif
368
 
369
#if !defined REGPARM
370
#define REGPARM
371
#endif
372
 
373
 
374
 
375
/* *****
376
   sim-bits and sim-endian are treated differently from the rest
377
   of the modules below.  Their default value is ALL_H_INLINE.
378
   The rest are ALL_C_INLINE.  Don't blink, you'll miss it!
379
   *****
380
   */
381
 
382
/* sim-bits */
383
 
384
#if !defined (SIM_BITS_INLINE) && (DEFAULT_INLINE)
385
# define SIM_BITS_INLINE (ALL_H_INLINE)
386
#endif
387
 
388
#if (SIM_BITS_INLINE & REGPARM_MODULE)
389
# define REGPARM_SIM_BITS REGPARM
390
#else
391
# define REGPARM_SIM_BITS
392
#endif
393
 
394
#if ((H_REVEALS_MODULE_P (SIM_BITS_INLINE) || defined (SIM_INLINE_C)) \
395
     && !defined (SIM_BITS_C) \
396
     && (REVEAL_MODULE_P (SIM_BITS_INLINE)))
397
# if (SIM_BITS_INLINE & INLINE_GLOBALS)
398
#  define INLINE_SIM_BITS(TYPE) static INLINE TYPE UNUSED
399
#  define EXTERN_SIM_BITS_P 0
400
# else
401
#  define INLINE_SIM_BITS(TYPE) static TYPE UNUSED REGPARM_SIM_BITS
402
#  define EXTERN_SIM_BITS_P 0
403
# endif
404
#else
405
# define INLINE_SIM_BITS(TYPE) TYPE REGPARM_SIM_BITS
406
# define EXTERN_SIM_BITS_P 1
407
#endif
408
 
409
#if (SIM_BITS_INLINE & INLINE_LOCALS)
410
# define STATIC_INLINE_SIM_BITS(TYPE) static INLINE TYPE
411
#else
412
# define STATIC_INLINE_SIM_BITS(TYPE) static TYPE REGPARM_SIM_BITS
413
#endif
414
 
415
#define STATIC_SIM_BITS(TYPE) static TYPE
416
 
417
 
418
 
419
/* sim-core */
420
 
421
#if !defined (SIM_CORE_INLINE) && (DEFAULT_INLINE)
422
# define SIM_CORE_INLINE ALL_C_INLINE
423
#endif
424
 
425
#if (SIM_CORE_INLINE & REGPARM_MODULE)
426
# define REGPARM_SIM_CORE REGPARM
427
#else
428
# define REGPARM_SIM_CORE
429
#endif
430
 
431
#if ((H_REVEALS_MODULE_P (SIM_CORE_INLINE) || defined (SIM_INLINE_C)) \
432
     && !defined (SIM_CORE_C) \
433
     && (REVEAL_MODULE_P (SIM_CORE_INLINE)))
434
# if (SIM_CORE_INLINE & INLINE_GLOBALS)
435
#  define INLINE_SIM_CORE(TYPE) static INLINE TYPE UNUSED
436
#  define EXTERN_SIM_CORE_P 0
437
#else
438
#  define INLINE_SIM_CORE(TYPE) static TYPE UNUSED REGPARM_SIM_CORE
439
#  define EXTERN_SIM_CORE_P 0
440
#endif
441
#else
442
# define INLINE_SIM_CORE(TYPE) TYPE REGPARM_SIM_CORE
443
# define EXTERN_SIM_CORE_P 1
444
#endif
445
 
446
#if (SIM_CORE_INLINE & INLINE_LOCALS)
447
# define STATIC_INLINE_SIM_CORE(TYPE) static INLINE TYPE
448
#else
449
# define STATIC_INLINE_SIM_CORE(TYPE) static TYPE REGPARM_SIM_CORE
450
#endif
451
 
452
#define STATIC_SIM_CORE(TYPE) static TYPE
453
 
454
 
455
 
456
/* sim-endian */
457
 
458
#if !defined (SIM_ENDIAN_INLINE) && (DEFAULT_INLINE)
459
# define SIM_ENDIAN_INLINE ALL_H_INLINE
460
#endif
461
 
462
#if (SIM_ENDIAN_INLINE & REGPARM_MODULE)
463
# define REGPARM_SIM_ENDIAN REGPARM
464
#else
465
# define REGPARM_SIM_ENDIAN
466
#endif
467
 
468
#if ((H_REVEALS_MODULE_P (SIM_ENDIAN_INLINE) || defined (SIM_INLINE_C)) \
469
     && !defined (SIM_ENDIAN_C) \
470
     && (REVEAL_MODULE_P (SIM_ENDIAN_INLINE)))
471
# if (SIM_ENDIAN_INLINE & INLINE_GLOBALS)
472
#  define INLINE_SIM_ENDIAN(TYPE) static INLINE TYPE UNUSED
473
#  define EXTERN_SIM_ENDIAN_P 0
474
# else
475
#  define INLINE_SIM_ENDIAN(TYPE) static TYPE UNUSED REGPARM_SIM_ENDIAN
476
#  define EXTERN_SIM_ENDIAN_P 0
477
# endif
478
#else
479
# define INLINE_SIM_ENDIAN(TYPE) TYPE REGPARM_SIM_ENDIAN
480
# define EXTERN_SIM_ENDIAN_P 1
481
#endif
482
 
483
#if (SIM_ENDIAN_INLINE & INLINE_LOCALS)
484
# define STATIC_INLINE_SIM_ENDIAN(TYPE) static INLINE TYPE
485
#else
486
# define STATIC_INLINE_SIM_ENDIAN(TYPE) static TYPE REGPARM_SIM_ENDIAN
487
#endif
488
 
489
#define STATIC_SIM_ENDIAN(TYPE) static TYPE
490
 
491
 
492
 
493
/* sim-events */
494
 
495
#if !defined (SIM_EVENTS_INLINE) && (DEFAULT_INLINE)
496
# define SIM_EVENTS_INLINE ALL_C_INLINE
497
#endif
498
 
499
#if (SIM_EVENTS_INLINE & REGPARM_MODULE)
500
# define REGPARM_SIM_EVENTS REGPARM
501
#else
502
# define REGPARM_SIM_EVENTS
503
#endif
504
 
505
#if ((H_REVEALS_MODULE_P (SIM_EVENTS_INLINE) || defined (SIM_INLINE_C)) \
506
     && !defined (SIM_EVENTS_C) \
507
     && (REVEAL_MODULE_P (SIM_EVENTS_INLINE)))
508
# if (SIM_EVENTS_INLINE & INLINE_GLOBALS)
509
#  define INLINE_SIM_EVENTS(TYPE) static INLINE TYPE UNUSED
510
#  define EXTERN_SIM_EVENTS_P 0
511
# else
512
#  define INLINE_SIM_EVENTS(TYPE) static TYPE UNUSED REGPARM_SIM_EVENTS
513
#  define EXTERN_SIM_EVENTS_P 0
514
# endif
515
#else
516
# define INLINE_SIM_EVENTS(TYPE) TYPE REGPARM_SIM_EVENTS
517
# define EXTERN_SIM_EVENTS_P 1
518
#endif
519
 
520
#if (SIM_EVENTS_INLINE & INLINE_LOCALS)
521
# define STATIC_INLINE_SIM_EVENTS(TYPE) static INLINE TYPE
522
#else
523
# define STATIC_INLINE_SIM_EVENTS(TYPE) static TYPE REGPARM_SIM_EVENTS
524
#endif
525
 
526
#define STATIC_SIM_EVENTS(TYPE) static TYPE
527
 
528
 
529
 
530
/* sim-fpu */
531
 
532
#if !defined (SIM_FPU_INLINE) && (DEFAULT_INLINE)
533
# define SIM_FPU_INLINE ALL_C_INLINE
534
#endif
535
 
536
#if (SIM_FPU_INLINE & REGPARM_MODULE)
537
# define REGPARM_SIM_FPU REGPARM
538
#else
539
# define REGPARM_SIM_FPU
540
#endif
541
 
542
#if ((H_REVEALS_MODULE_P (SIM_FPU_INLINE) || defined (SIM_INLINE_C)) \
543
     && !defined (SIM_FPU_C) \
544
     && (REVEAL_MODULE_P (SIM_FPU_INLINE)))
545
# if (SIM_FPU_INLINE & INLINE_GLOBALS)
546
#  define INLINE_SIM_FPU(TYPE) static INLINE TYPE UNUSED
547
#  define EXTERN_SIM_FPU_P 0
548
# else
549
#  define INLINE_SIM_FPU(TYPE) static TYPE UNUSED REGPARM_SIM_FPU
550
#  define EXTERN_SIM_FPU_P 0
551
# endif
552
#else
553
# define INLINE_SIM_FPU(TYPE) TYPE REGPARM_SIM_FPU
554
# define EXTERN_SIM_FPU_P 1
555
#endif
556
 
557
#if (SIM_FPU_INLINE & INLINE_LOCALS)
558
# define STATIC_INLINE_SIM_FPU(TYPE) static INLINE TYPE
559
#else
560
# define STATIC_INLINE_SIM_FPU(TYPE) static TYPE REGPARM_SIM_FPU
561
#endif
562
 
563
#define STATIC_SIM_FPU(TYPE) static TYPE
564
 
565
 
566
 
567
/* sim-types */
568
 
569
#if (SIM_TYPES_INLINE & REGPARM_MODULE)
570
# define REGPARM_SIM_TYPES REGPARM
571
#else
572
# define REGPARM_SIM_TYPES
573
#endif
574
 
575
#if ((H_REVEALS_MODULE_P (SIM_TYPES_INLINE) || defined (SIM_INLINE_C)) \
576
     && !defined (SIM_TYPES_C) \
577
     && (REVEAL_MODULE_P (SIM_TYPES_INLINE)))
578
# if (SIM_TYPES_INLINE & INLINE_GLOBALS)
579
#  define INLINE_SIM_TYPES(TYPE) static INLINE TYPE UNUSED
580
#  define EXTERN_SIM_TYPES_P 0
581
# else
582
#  define INLINE_SIM_TYPES(TYPE) static TYPE UNUSED REGPARM_SIM_TYPES
583
#  define EXTERN_SIM_TYPES_P 0
584
# endif
585
#else
586
# define INLINE_SIM_TYPES(TYPE) TYPE REGPARM_SIM_TYPES
587
# define EXTERN_SIM_TYPES_P 1
588
#endif
589
 
590
#if (SIM_TYPES_INLINE & INLINE_LOCALS)
591
# define STATIC_INLINE_SIM_TYPES(TYPE) static INLINE TYPE
592
#else
593
# define STATIC_INLINE_SIM_TYPES(TYPE) static TYPE REGPARM_SIM_TYPES
594
#endif
595
 
596
#define STATIC_SIM_TYPES(TYPE) static TYPE
597
 
598
 
599
 
600
/* sim_main */
601
 
602
#if !defined (SIM_MAIN_INLINE) && (DEFAULT_INLINE)
603
# define SIM_MAIN_INLINE (ALL_C_INLINE)
604
#endif
605
 
606
#if (SIM_MAIN_INLINE & REGPARM_MODULE)
607
# define REGPARM_SIM_MAIN REGPARM
608
#else
609
# define REGPARM_SIM_MAIN
610
#endif
611
 
612
#if ((H_REVEALS_MODULE_P (SIM_MAIN_INLINE) || defined (SIM_INLINE_C)) \
613
     && !defined (SIM_MAIN_C) \
614
     && (REVEAL_MODULE_P (SIM_MAIN_INLINE)))
615
# if (SIM_MAIN_INLINE & INLINE_GLOBALS)
616
#  define INLINE_SIM_MAIN(TYPE) static INLINE TYPE UNUSED
617
#  define EXTERN_SIM_MAIN_P 0
618
# else
619
#  define INLINE_SIM_MAIN(TYPE) static TYPE UNUSED REGPARM_SIM_MAIN
620
#  define EXTERN_SIM_MAIN_P 0
621
# endif
622
#else
623
# define INLINE_SIM_MAIN(TYPE) TYPE REGPARM_SIM_MAIN
624
# define EXTERN_SIM_MAIN_P 1
625
#endif
626
 
627
#if (SIM_MAIN_INLINE & INLINE_LOCALS)
628
# define STATIC_INLINE_SIM_MAIN(TYPE) static INLINE TYPE
629
#else
630
# define STATIC_INLINE_SIM_MAIN(TYPE) static TYPE REGPARM_SIM_MAIN
631
#endif
632
 
633
#define STATIC_SIM_MAIN(TYPE) static TYPE
634
 
635
/* engine */
636
 
637
#if (ENGINE_INLINE & REGPARM_MODULE)
638
# define REGPARM_ENGINE REGPARM
639
#else
640
# define REGPARM_ENGINE
641
#endif
642
 
643
#if ((H_REVEALS_MODULE_P (ENGINE_INLINE) || defined (SIM_INLINE_C)) \
644
     && !defined (ENGINE_C) \
645
     && (REVEAL_MODULE_P (ENGINE_INLINE)))
646
# if (ENGINE_INLINE & INLINE_GLOBALS)
647
#  define INLINE_ENGINE(TYPE) static INLINE TYPE UNUSED
648
#  define EXTERN_ENGINE_P 0
649
# else
650
#  define INLINE_ENGINE(TYPE) static TYPE UNUSED REGPARM_ENGINE
651
#  define EXTERN_ENGINE_P 0
652
# endif
653
#else
654
# define INLINE_ENGINE(TYPE) TYPE REGPARM_ENGINE
655
# define EXTERN_ENGINE_P 1
656
#endif
657
 
658
#if (ENGINE_INLINE & INLINE_LOCALS)
659
# define STATIC_INLINE_ENGINE(TYPE) static INLINE TYPE
660
#else
661
# define STATIC_INLINE_ENGINE(TYPE) static TYPE REGPARM_ENGINE
662
#endif
663
 
664
#define STATIC_ENGINE(TYPE) static TYPE
665
 
666
 
667
 
668
/* icache */
669
 
670
#if (ICACHE_INLINE & REGPARM_MODULE)
671
# define REGPARM_ICACHE REGPARM
672
#else
673
# define REGPARM_ICACHE
674
#endif
675
 
676
#if ((H_REVEALS_MODULE_P (ICACHE_INLINE) || defined (SIM_INLINE_C)) \
677
     && !defined (ICACHE_C) \
678
     && (REVEAL_MODULE_P (ICACHE_INLINE)))
679
# if (ICACHE_INLINE & INLINE_GLOBALS)
680
#  define INLINE_ICACHE(TYPE) static INLINE TYPE UNUSED
681
#  define EXTERN_ICACHE_P 0
682
#else
683
#  define INLINE_ICACHE(TYPE) static TYPE UNUSED REGPARM_ICACHE
684
#  define EXTERN_ICACHE_P 0
685
#endif
686
#else
687
# define INLINE_ICACHE(TYPE) TYPE REGPARM_ICACHE
688
# define EXTERN_ICACHE_P 1
689
#endif
690
 
691
#if (ICACHE_INLINE & INLINE_LOCALS)
692
# define STATIC_INLINE_ICACHE(TYPE) static INLINE TYPE
693
#else
694
# define STATIC_INLINE_ICACHE(TYPE) static TYPE REGPARM_ICACHE
695
#endif
696
 
697
#define STATIC_ICACHE(TYPE) static TYPE
698
 
699
 
700
 
701
/* idecode */
702
 
703
#if (IDECODE_INLINE & REGPARM_MODULE)
704
# define REGPARM_IDECODE REGPARM
705
#else
706
# define REGPARM_IDECODE
707
#endif
708
 
709
#if ((H_REVEALS_MODULE_P (IDECODE_INLINE) || defined (SIM_INLINE_C)) \
710
     && !defined (IDECODE_C) \
711
     && (REVEAL_MODULE_P (IDECODE_INLINE)))
712
# if (IDECODE_INLINE & INLINE_GLOBALS)
713
#  define INLINE_IDECODE(TYPE) static INLINE TYPE UNUSED
714
#  define EXTERN_IDECODE_P 0
715
#else
716
#  define INLINE_IDECODE(TYPE) static TYPE UNUSED REGPARM_IDECODE
717
#  define EXTERN_IDECODE_P 0
718
#endif
719
#else
720
# define INLINE_IDECODE(TYPE) TYPE REGPARM_IDECODE
721
# define EXTERN_IDECODE_P 1
722
#endif
723
 
724
#if (IDECODE_INLINE & INLINE_LOCALS)
725
# define STATIC_INLINE_IDECODE(TYPE) static INLINE TYPE
726
#else
727
# define STATIC_INLINE_IDECODE(TYPE) static TYPE REGPARM_IDECODE
728
#endif
729
 
730
#define STATIC_IDECODE(TYPE) static TYPE
731
 
732
 
733
 
734
/* semantics */
735
 
736
#if (SEMANTICS_INLINE & REGPARM_MODULE)
737
# define REGPARM_SEMANTICS REGPARM
738
#else
739
# define REGPARM_SEMANTICS
740
#endif
741
 
742
#if ((H_REVEALS_MODULE_P (SEMANTICS_INLINE) || defined (SIM_INLINE_C)) \
743
     && !defined (SEMANTICS_C) \
744
     && (REVEAL_MODULE_P (SEMANTICS_INLINE)))
745
# if (SEMANTICS_INLINE & INLINE_GLOBALS)
746
#  define INLINE_SEMANTICS(TYPE) static INLINE TYPE UNUSED
747
#  define EXTERN_SEMANTICS_P 0
748
#else
749
#  define INLINE_SEMANTICS(TYPE) static TYPE UNUSED REGPARM_SEMANTICS
750
#  define EXTERN_SEMANTICS_P 0
751
#endif
752
#else
753
# define INLINE_SEMANTICS(TYPE) TYPE REGPARM_SEMANTICS
754
# define EXTERN_SEMANTICS_P 1
755
#endif
756
 
757
#if EXTERN_SEMANTICS_P
758
# define EXTERN_SEMANTICS(TYPE) TYPE REGPARM_SEMANTICS
759
#else
760
# define EXTERN_SEMANTICS(TYPE) static TYPE UNUSED REGPARM_SEMANTICS
761
#endif
762
 
763
#if (SEMANTICS_INLINE & INLINE_LOCALS)
764
# define STATIC_INLINE_SEMANTICS(TYPE) static INLINE TYPE
765
#else
766
# define STATIC_INLINE_SEMANTICS(TYPE) static TYPE REGPARM_SEMANTICS
767
#endif
768
 
769
#define STATIC_SEMANTICS(TYPE) static TYPE
770
 
771
 
772
 
773
/* support */
774
 
775
#if !defined (SUPPORT_INLINE) && (DEFAULT_INLINE)
776
# define SUPPORT_INLINE ALL_C_INLINE
777
#endif
778
 
779
#if (SUPPORT_INLINE & REGPARM_MODULE)
780
# define REGPARM_SUPPORT REGPARM
781
#else
782
# define REGPARM_SUPPORT
783
#endif
784
 
785
#if ((H_REVEALS_MODULE_P (SUPPORT_INLINE) || defined (SIM_INLINE_C)) \
786
     && !defined (SUPPORT_C) \
787
     && (REVEAL_MODULE_P (SUPPORT_INLINE)))
788
# if (SUPPORT_INLINE & INLINE_GLOBALS)
789
#  define INLINE_SUPPORT(TYPE) static INLINE TYPE UNUSED
790
#  define EXTERN_SUPPORT_P 0
791
#else
792
#  define INLINE_SUPPORT(TYPE) static TYPE UNUSED REGPARM_SUPPORT
793
#  define EXTERN_SUPPORT_P 0
794
#endif
795
#else
796
# define INLINE_SUPPORT(TYPE) TYPE REGPARM_SUPPORT
797
# define EXTERN_SUPPORT_P 1
798
#endif
799
 
800
#if (SUPPORT_INLINE & INLINE_LOCALS)
801
# define STATIC_INLINE_SUPPORT(TYPE) static INLINE TYPE
802
#else
803
# define STATIC_INLINE_SUPPORT(TYPE) static TYPE REGPARM_SUPPORT
804
#endif
805
 
806
#define STATIC_SUPPORT(TYPE) static TYPE
807
 
808
 
809
 
810
#endif

powered by: WebSVN 2.1.0

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