X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Fcommon%2Fsim-inline.h;h=2c5406e8a4c622dae9bd6b1abe7216bfde09f1fb;hb=8b8c7c9f49992750f66f81b4601d593a3858d98c;hp=300658d374e2dfb21a1a2f181c9524e33994c1ce;hpb=c906108c21474dfb4ed285bcc0ac6fe02cd400cc;p=deliverable%2Fbinutils-gdb.git diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h index 300658d374..2c5406e8a4 100644 --- a/sim/common/sim-inline.h +++ b/sim/common/sim-inline.h @@ -1,23 +1,23 @@ -/* This file is part of the program psim. +/* The common simulator framework for GDB, the GNU Debugger. - Copyright (C) 1994-1997, Andrew Cagney - Copyright (C) 1997, Free Software Foundation, Inc. + Copyright 2002-2016 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + Contributed by Andrew Cagney and Red Hat. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifndef SIM_INLINE_H @@ -33,7 +33,7 @@ eliminate the overhead of function calls and (as a consequence) also eliminate further dead code. - On a CISC (x86) I've found that I can achieve an order of magintude + On a CISC (x86) I've found that I can achieve an order of magnitude speed improvement (x3-x5). In the case of RISC (sparc) while the performance gain isn't as great it is still significant. @@ -176,7 +176,7 @@ Since no inlining is defined. All macro's get standard defaults (extern, static, ...). - + H_REVEALS_MODULE (alt includes our): @@ -226,7 +226,7 @@ altprog.c defines ALTPROG_C and then includes sim-inline.c sim-inline.c defines C_INLINE_C and then includes sim-inline.h - + In sim-inline.h the expression `` defined (SIM_INLINE) && ! defined (OURPROG_C) && REVEAL_MODULE_P (OURPROG_INLINE) '' is true so it defines *_OURPROG as static and EXTERN_OURPROG_P as @@ -246,7 +246,7 @@ ourprog.c defines OURPROG_C and then includes sim-inline.c sim-inline.c defines C_INLINE_C and then includes sim-inline.h - + In sim-inline.h the term `` ! defined (OURPROG_C) '' is FALSE so it defines *_OURPROG as non-static and EXTERN_OURPROG_P as TRUE. @@ -266,8 +266,6 @@ #define INLINE_GLOBALS 4 #define INLINE_LOCALS 8 -#define REGPARM_MODULE 32 - #define ALL_H_INLINE (H_REVEALS_MODULE | INLINE_GLOBALS | INLINE_LOCALS) #define ALL_C_INLINE (C_REVEALS_MODULE | INLINE_GLOBALS | INLINE_LOCALS) @@ -303,7 +301,9 @@ /* ??? Temporary, pending decision to always use extern inline and do a vast cleanup of inline support. */ #ifndef INLINE2 -#if defined (__GNUC__) +#if defined (__GNUC_GNU_INLINE__) || defined (__GNUC_STDC_INLINE__) +#define INLINE2 __inline__ __attribute__ ((__gnu_inline__)) +#elif defined (__GNUC__) #define INLINE2 __inline__ #else #define INLINE2 /*inline*/ @@ -347,30 +347,6 @@ - -/* Your compilers nonstandard function call mechanism prefix */ - -#if !defined REGPARM -#if defined (__GNUC__) && (defined (__i386__) || defined (__i486__) || defined (__i586__) || defined (__i686__)) -#if (WITH_REGPARM && WITH_STDCALL) -#define REGPARM __attribute__((__regparm__(WITH_REGPARM),__stdcall__)) -#else -#if (WITH_REGPARM && !WITH_STDCALL) -#define REGPARM __attribute__((__regparm__(WITH_REGPARM))) -#else -#if (!WITH_REGPARM && WITH_STDCALL) -#define REGPARM __attribute__((__stdcall__)) -#endif -#endif -#endif -#endif -#endif - -#if !defined REGPARM -#define REGPARM -#endif - - /* ***** sim-bits and sim-endian are treated differently from the rest @@ -385,12 +361,6 @@ # define SIM_BITS_INLINE (ALL_H_INLINE) #endif -#if (SIM_BITS_INLINE & REGPARM_MODULE) -# define REGPARM_SIM_BITS REGPARM -#else -# define REGPARM_SIM_BITS -#endif - #if ((H_REVEALS_MODULE_P (SIM_BITS_INLINE) || defined (SIM_INLINE_C)) \ && !defined (SIM_BITS_C) \ && (REVEAL_MODULE_P (SIM_BITS_INLINE))) @@ -398,18 +368,18 @@ # define INLINE_SIM_BITS(TYPE) static INLINE TYPE UNUSED # define EXTERN_SIM_BITS_P 0 # else -# define INLINE_SIM_BITS(TYPE) static TYPE UNUSED REGPARM_SIM_BITS +# define INLINE_SIM_BITS(TYPE) static TYPE UNUSED # define EXTERN_SIM_BITS_P 0 # endif #else -# define INLINE_SIM_BITS(TYPE) TYPE REGPARM_SIM_BITS +# define INLINE_SIM_BITS(TYPE) TYPE # define EXTERN_SIM_BITS_P 1 #endif #if (SIM_BITS_INLINE & INLINE_LOCALS) # define STATIC_INLINE_SIM_BITS(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_SIM_BITS(TYPE) static TYPE REGPARM_SIM_BITS +# define STATIC_INLINE_SIM_BITS(TYPE) static TYPE #endif #define STATIC_SIM_BITS(TYPE) static TYPE @@ -422,12 +392,6 @@ # define SIM_CORE_INLINE ALL_C_INLINE #endif -#if (SIM_CORE_INLINE & REGPARM_MODULE) -# define REGPARM_SIM_CORE REGPARM -#else -# define REGPARM_SIM_CORE -#endif - #if ((H_REVEALS_MODULE_P (SIM_CORE_INLINE) || defined (SIM_INLINE_C)) \ && !defined (SIM_CORE_C) \ && (REVEAL_MODULE_P (SIM_CORE_INLINE))) @@ -435,18 +399,18 @@ # define INLINE_SIM_CORE(TYPE) static INLINE TYPE UNUSED # define EXTERN_SIM_CORE_P 0 #else -# define INLINE_SIM_CORE(TYPE) static TYPE UNUSED REGPARM_SIM_CORE +# define INLINE_SIM_CORE(TYPE) static TYPE UNUSED # define EXTERN_SIM_CORE_P 0 #endif #else -# define INLINE_SIM_CORE(TYPE) TYPE REGPARM_SIM_CORE +# define INLINE_SIM_CORE(TYPE) TYPE # define EXTERN_SIM_CORE_P 1 #endif #if (SIM_CORE_INLINE & INLINE_LOCALS) # define STATIC_INLINE_SIM_CORE(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_SIM_CORE(TYPE) static TYPE REGPARM_SIM_CORE +# define STATIC_INLINE_SIM_CORE(TYPE) static TYPE #endif #define STATIC_SIM_CORE(TYPE) static TYPE @@ -459,12 +423,6 @@ # define SIM_ENDIAN_INLINE ALL_H_INLINE #endif -#if (SIM_ENDIAN_INLINE & REGPARM_MODULE) -# define REGPARM_SIM_ENDIAN REGPARM -#else -# define REGPARM_SIM_ENDIAN -#endif - #if ((H_REVEALS_MODULE_P (SIM_ENDIAN_INLINE) || defined (SIM_INLINE_C)) \ && !defined (SIM_ENDIAN_C) \ && (REVEAL_MODULE_P (SIM_ENDIAN_INLINE))) @@ -472,18 +430,18 @@ # define INLINE_SIM_ENDIAN(TYPE) static INLINE TYPE UNUSED # define EXTERN_SIM_ENDIAN_P 0 # else -# define INLINE_SIM_ENDIAN(TYPE) static TYPE UNUSED REGPARM_SIM_ENDIAN +# define INLINE_SIM_ENDIAN(TYPE) static TYPE UNUSED # define EXTERN_SIM_ENDIAN_P 0 # endif #else -# define INLINE_SIM_ENDIAN(TYPE) TYPE REGPARM_SIM_ENDIAN +# define INLINE_SIM_ENDIAN(TYPE) TYPE # define EXTERN_SIM_ENDIAN_P 1 #endif #if (SIM_ENDIAN_INLINE & INLINE_LOCALS) # define STATIC_INLINE_SIM_ENDIAN(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_SIM_ENDIAN(TYPE) static TYPE REGPARM_SIM_ENDIAN +# define STATIC_INLINE_SIM_ENDIAN(TYPE) static TYPE #endif #define STATIC_SIM_ENDIAN(TYPE) static TYPE @@ -496,12 +454,6 @@ # define SIM_EVENTS_INLINE ALL_C_INLINE #endif -#if (SIM_EVENTS_INLINE & REGPARM_MODULE) -# define REGPARM_SIM_EVENTS REGPARM -#else -# define REGPARM_SIM_EVENTS -#endif - #if ((H_REVEALS_MODULE_P (SIM_EVENTS_INLINE) || defined (SIM_INLINE_C)) \ && !defined (SIM_EVENTS_C) \ && (REVEAL_MODULE_P (SIM_EVENTS_INLINE))) @@ -509,18 +461,18 @@ # define INLINE_SIM_EVENTS(TYPE) static INLINE TYPE UNUSED # define EXTERN_SIM_EVENTS_P 0 # else -# define INLINE_SIM_EVENTS(TYPE) static TYPE UNUSED REGPARM_SIM_EVENTS +# define INLINE_SIM_EVENTS(TYPE) static TYPE UNUSED # define EXTERN_SIM_EVENTS_P 0 # endif #else -# define INLINE_SIM_EVENTS(TYPE) TYPE REGPARM_SIM_EVENTS +# define INLINE_SIM_EVENTS(TYPE) TYPE # define EXTERN_SIM_EVENTS_P 1 #endif #if (SIM_EVENTS_INLINE & INLINE_LOCALS) # define STATIC_INLINE_SIM_EVENTS(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_SIM_EVENTS(TYPE) static TYPE REGPARM_SIM_EVENTS +# define STATIC_INLINE_SIM_EVENTS(TYPE) static TYPE #endif #define STATIC_SIM_EVENTS(TYPE) static TYPE @@ -533,12 +485,6 @@ # define SIM_FPU_INLINE ALL_C_INLINE #endif -#if (SIM_FPU_INLINE & REGPARM_MODULE) -# define REGPARM_SIM_FPU REGPARM -#else -# define REGPARM_SIM_FPU -#endif - #if ((H_REVEALS_MODULE_P (SIM_FPU_INLINE) || defined (SIM_INLINE_C)) \ && !defined (SIM_FPU_C) \ && (REVEAL_MODULE_P (SIM_FPU_INLINE))) @@ -546,18 +492,18 @@ # define INLINE_SIM_FPU(TYPE) static INLINE TYPE UNUSED # define EXTERN_SIM_FPU_P 0 # else -# define INLINE_SIM_FPU(TYPE) static TYPE UNUSED REGPARM_SIM_FPU +# define INLINE_SIM_FPU(TYPE) static TYPE UNUSED # define EXTERN_SIM_FPU_P 0 # endif #else -# define INLINE_SIM_FPU(TYPE) TYPE REGPARM_SIM_FPU +# define INLINE_SIM_FPU(TYPE) TYPE # define EXTERN_SIM_FPU_P 1 #endif #if (SIM_FPU_INLINE & INLINE_LOCALS) # define STATIC_INLINE_SIM_FPU(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_SIM_FPU(TYPE) static TYPE REGPARM_SIM_FPU +# define STATIC_INLINE_SIM_FPU(TYPE) static TYPE #endif #define STATIC_SIM_FPU(TYPE) static TYPE @@ -566,12 +512,6 @@ /* sim-types */ -#if (SIM_TYPES_INLINE & REGPARM_MODULE) -# define REGPARM_SIM_TYPES REGPARM -#else -# define REGPARM_SIM_TYPES -#endif - #if ((H_REVEALS_MODULE_P (SIM_TYPES_INLINE) || defined (SIM_INLINE_C)) \ && !defined (SIM_TYPES_C) \ && (REVEAL_MODULE_P (SIM_TYPES_INLINE))) @@ -579,18 +519,18 @@ # define INLINE_SIM_TYPES(TYPE) static INLINE TYPE UNUSED # define EXTERN_SIM_TYPES_P 0 # else -# define INLINE_SIM_TYPES(TYPE) static TYPE UNUSED REGPARM_SIM_TYPES +# define INLINE_SIM_TYPES(TYPE) static TYPE UNUSED # define EXTERN_SIM_TYPES_P 0 # endif #else -# define INLINE_SIM_TYPES(TYPE) TYPE REGPARM_SIM_TYPES +# define INLINE_SIM_TYPES(TYPE) TYPE # define EXTERN_SIM_TYPES_P 1 #endif #if (SIM_TYPES_INLINE & INLINE_LOCALS) # define STATIC_INLINE_SIM_TYPES(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_SIM_TYPES(TYPE) static TYPE REGPARM_SIM_TYPES +# define STATIC_INLINE_SIM_TYPES(TYPE) static TYPE #endif #define STATIC_SIM_TYPES(TYPE) static TYPE @@ -603,12 +543,6 @@ # define SIM_MAIN_INLINE (ALL_C_INLINE) #endif -#if (SIM_MAIN_INLINE & REGPARM_MODULE) -# define REGPARM_SIM_MAIN REGPARM -#else -# define REGPARM_SIM_MAIN -#endif - #if ((H_REVEALS_MODULE_P (SIM_MAIN_INLINE) || defined (SIM_INLINE_C)) \ && !defined (SIM_MAIN_C) \ && (REVEAL_MODULE_P (SIM_MAIN_INLINE))) @@ -616,30 +550,24 @@ # define INLINE_SIM_MAIN(TYPE) static INLINE TYPE UNUSED # define EXTERN_SIM_MAIN_P 0 # else -# define INLINE_SIM_MAIN(TYPE) static TYPE UNUSED REGPARM_SIM_MAIN +# define INLINE_SIM_MAIN(TYPE) static TYPE UNUSED # define EXTERN_SIM_MAIN_P 0 # endif #else -# define INLINE_SIM_MAIN(TYPE) TYPE REGPARM_SIM_MAIN +# define INLINE_SIM_MAIN(TYPE) TYPE # define EXTERN_SIM_MAIN_P 1 #endif #if (SIM_MAIN_INLINE & INLINE_LOCALS) # define STATIC_INLINE_SIM_MAIN(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_SIM_MAIN(TYPE) static TYPE REGPARM_SIM_MAIN +# define STATIC_INLINE_SIM_MAIN(TYPE) static TYPE #endif #define STATIC_SIM_MAIN(TYPE) static TYPE /* engine */ -#if (ENGINE_INLINE & REGPARM_MODULE) -# define REGPARM_ENGINE REGPARM -#else -# define REGPARM_ENGINE -#endif - #if ((H_REVEALS_MODULE_P (ENGINE_INLINE) || defined (SIM_INLINE_C)) \ && !defined (ENGINE_C) \ && (REVEAL_MODULE_P (ENGINE_INLINE))) @@ -647,18 +575,18 @@ # define INLINE_ENGINE(TYPE) static INLINE TYPE UNUSED # define EXTERN_ENGINE_P 0 # else -# define INLINE_ENGINE(TYPE) static TYPE UNUSED REGPARM_ENGINE +# define INLINE_ENGINE(TYPE) static TYPE UNUSED # define EXTERN_ENGINE_P 0 # endif #else -# define INLINE_ENGINE(TYPE) TYPE REGPARM_ENGINE +# define INLINE_ENGINE(TYPE) TYPE # define EXTERN_ENGINE_P 1 #endif #if (ENGINE_INLINE & INLINE_LOCALS) # define STATIC_INLINE_ENGINE(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_ENGINE(TYPE) static TYPE REGPARM_ENGINE +# define STATIC_INLINE_ENGINE(TYPE) static TYPE #endif #define STATIC_ENGINE(TYPE) static TYPE @@ -667,12 +595,6 @@ /* icache */ -#if (ICACHE_INLINE & REGPARM_MODULE) -# define REGPARM_ICACHE REGPARM -#else -# define REGPARM_ICACHE -#endif - #if ((H_REVEALS_MODULE_P (ICACHE_INLINE) || defined (SIM_INLINE_C)) \ && !defined (ICACHE_C) \ && (REVEAL_MODULE_P (ICACHE_INLINE))) @@ -680,18 +602,18 @@ # define INLINE_ICACHE(TYPE) static INLINE TYPE UNUSED # define EXTERN_ICACHE_P 0 #else -# define INLINE_ICACHE(TYPE) static TYPE UNUSED REGPARM_ICACHE +# define INLINE_ICACHE(TYPE) static TYPE UNUSED # define EXTERN_ICACHE_P 0 #endif #else -# define INLINE_ICACHE(TYPE) TYPE REGPARM_ICACHE +# define INLINE_ICACHE(TYPE) TYPE # define EXTERN_ICACHE_P 1 #endif #if (ICACHE_INLINE & INLINE_LOCALS) # define STATIC_INLINE_ICACHE(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_ICACHE(TYPE) static TYPE REGPARM_ICACHE +# define STATIC_INLINE_ICACHE(TYPE) static TYPE #endif #define STATIC_ICACHE(TYPE) static TYPE @@ -700,12 +622,6 @@ /* idecode */ -#if (IDECODE_INLINE & REGPARM_MODULE) -# define REGPARM_IDECODE REGPARM -#else -# define REGPARM_IDECODE -#endif - #if ((H_REVEALS_MODULE_P (IDECODE_INLINE) || defined (SIM_INLINE_C)) \ && !defined (IDECODE_C) \ && (REVEAL_MODULE_P (IDECODE_INLINE))) @@ -713,18 +629,18 @@ # define INLINE_IDECODE(TYPE) static INLINE TYPE UNUSED # define EXTERN_IDECODE_P 0 #else -# define INLINE_IDECODE(TYPE) static TYPE UNUSED REGPARM_IDECODE +# define INLINE_IDECODE(TYPE) static TYPE UNUSED # define EXTERN_IDECODE_P 0 #endif #else -# define INLINE_IDECODE(TYPE) TYPE REGPARM_IDECODE +# define INLINE_IDECODE(TYPE) TYPE # define EXTERN_IDECODE_P 1 #endif #if (IDECODE_INLINE & INLINE_LOCALS) # define STATIC_INLINE_IDECODE(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_IDECODE(TYPE) static TYPE REGPARM_IDECODE +# define STATIC_INLINE_IDECODE(TYPE) static TYPE #endif #define STATIC_IDECODE(TYPE) static TYPE @@ -733,12 +649,6 @@ /* semantics */ -#if (SEMANTICS_INLINE & REGPARM_MODULE) -# define REGPARM_SEMANTICS REGPARM -#else -# define REGPARM_SEMANTICS -#endif - #if ((H_REVEALS_MODULE_P (SEMANTICS_INLINE) || defined (SIM_INLINE_C)) \ && !defined (SEMANTICS_C) \ && (REVEAL_MODULE_P (SEMANTICS_INLINE))) @@ -746,24 +656,24 @@ # define INLINE_SEMANTICS(TYPE) static INLINE TYPE UNUSED # define EXTERN_SEMANTICS_P 0 #else -# define INLINE_SEMANTICS(TYPE) static TYPE UNUSED REGPARM_SEMANTICS +# define INLINE_SEMANTICS(TYPE) static TYPE UNUSED # define EXTERN_SEMANTICS_P 0 #endif #else -# define INLINE_SEMANTICS(TYPE) TYPE REGPARM_SEMANTICS +# define INLINE_SEMANTICS(TYPE) TYPE # define EXTERN_SEMANTICS_P 1 #endif #if EXTERN_SEMANTICS_P -# define EXTERN_SEMANTICS(TYPE) TYPE REGPARM_SEMANTICS +# define EXTERN_SEMANTICS(TYPE) TYPE #else -# define EXTERN_SEMANTICS(TYPE) static TYPE UNUSED REGPARM_SEMANTICS +# define EXTERN_SEMANTICS(TYPE) static TYPE UNUSED #endif #if (SEMANTICS_INLINE & INLINE_LOCALS) # define STATIC_INLINE_SEMANTICS(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_SEMANTICS(TYPE) static TYPE REGPARM_SEMANTICS +# define STATIC_INLINE_SEMANTICS(TYPE) static TYPE #endif #define STATIC_SEMANTICS(TYPE) static TYPE @@ -776,12 +686,6 @@ # define SUPPORT_INLINE ALL_C_INLINE #endif -#if (SUPPORT_INLINE & REGPARM_MODULE) -# define REGPARM_SUPPORT REGPARM -#else -# define REGPARM_SUPPORT -#endif - #if ((H_REVEALS_MODULE_P (SUPPORT_INLINE) || defined (SIM_INLINE_C)) \ && !defined (SUPPORT_C) \ && (REVEAL_MODULE_P (SUPPORT_INLINE))) @@ -789,18 +693,18 @@ # define INLINE_SUPPORT(TYPE) static INLINE TYPE UNUSED # define EXTERN_SUPPORT_P 0 #else -# define INLINE_SUPPORT(TYPE) static TYPE UNUSED REGPARM_SUPPORT +# define INLINE_SUPPORT(TYPE) static TYPE UNUSED # define EXTERN_SUPPORT_P 0 #endif #else -# define INLINE_SUPPORT(TYPE) TYPE REGPARM_SUPPORT +# define INLINE_SUPPORT(TYPE) TYPE # define EXTERN_SUPPORT_P 1 #endif #if (SUPPORT_INLINE & INLINE_LOCALS) # define STATIC_INLINE_SUPPORT(TYPE) static INLINE TYPE #else -# define STATIC_INLINE_SUPPORT(TYPE) static TYPE REGPARM_SUPPORT +# define STATIC_INLINE_SUPPORT(TYPE) static TYPE #endif #define STATIC_SUPPORT(TYPE) static TYPE