From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwvTY-0008FW-In for qemu-devel@nongnu.org; Wed, 10 Jul 2013 10:34:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwvTV-0003ZD-S2 for qemu-devel@nongnu.org; Wed, 10 Jul 2013 10:34:36 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 10 Jul 2013 16:33:41 +0200 Message-Id: <1373466860-32732-5-git-send-email-afaerber@suse.de> In-Reply-To: <1373466860-32732-1-git-send-email-afaerber@suse.de> References: <1373466860-32732-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 04/43] cpu: Drop unnecessary dynamic casts in *_env_get_cpu() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Jia Liu , Anthony Green , Alexander Graf , Blue Swirl , Max Filippov , Michael Walle , "open list:PowerPC" , Paul Brook , "Edgar E. Iglesias" , Guan Xuetao , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Aurelien Jarno , Richard Henderson A transition from CPUFooState to FooCPU can be considered safe, just like FooCPU::env access in the opposite direction. The only benefit of the FOO_CPU() casts would be protection against bogus CPUFooState pointers, but then surrounding code would likely break, too. This should slightly improve interrupt etc. performance when going from CPUFooState to FooCPU. For any additional CPU() casts see 3556c233d931ad5ffa46a35cb25cfc057732eb= b8 (qom: allow turning cast debugging off). Reported-by: Anthony Liguori Acked-by: Richard Henderson Signed-off-by: Andreas F=C3=A4rber --- target-alpha/cpu-qom.h | 2 +- target-arm/cpu-qom.h | 2 +- target-cris/cpu-qom.h | 2 +- target-i386/cpu-qom.h | 2 +- target-lm32/cpu-qom.h | 2 +- target-m68k/cpu-qom.h | 2 +- target-microblaze/cpu-qom.h | 2 +- target-mips/cpu-qom.h | 2 +- target-moxie/cpu.h | 2 +- target-openrisc/cpu.h | 2 +- target-ppc/cpu-qom.h | 2 +- target-s390x/cpu-qom.h | 2 +- target-sh4/cpu-qom.h | 2 +- target-sparc/cpu-qom.h | 2 +- target-unicore32/cpu-qom.h | 2 +- target-xtensa/cpu-qom.h | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/target-alpha/cpu-qom.h b/target-alpha/cpu-qom.h index 94e4a54..60125b1 100644 --- a/target-alpha/cpu-qom.h +++ b/target-alpha/cpu-qom.h @@ -67,7 +67,7 @@ typedef struct AlphaCPU { =20 static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env) { - return ALPHA_CPU(container_of(env, AlphaCPU, env)); + return container_of(env, AlphaCPU, env); } =20 #define ENV_GET_CPU(e) CPU(alpha_env_get_cpu(e)) diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h index ef6261f..48ba605 100644 --- a/target-arm/cpu-qom.h +++ b/target-arm/cpu-qom.h @@ -127,7 +127,7 @@ typedef struct ARMCPU { =20 static inline ARMCPU *arm_env_get_cpu(CPUARMState *env) { - return ARM_CPU(container_of(env, ARMCPU, env)); + return container_of(env, ARMCPU, env); } =20 #define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e)) diff --git a/target-cris/cpu-qom.h b/target-cris/cpu-qom.h index e08bdb1..af7d14d 100644 --- a/target-cris/cpu-qom.h +++ b/target-cris/cpu-qom.h @@ -66,7 +66,7 @@ typedef struct CRISCPU { =20 static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env) { - return CRIS_CPU(container_of(env, CRISCPU, env)); + return container_of(env, CRISCPU, env); } =20 #define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e)) diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h index b7c70d6..7e55e5f 100644 --- a/target-i386/cpu-qom.h +++ b/target-i386/cpu-qom.h @@ -72,7 +72,7 @@ typedef struct X86CPU { =20 static inline X86CPU *x86_env_get_cpu(CPUX86State *env) { - return X86_CPU(container_of(env, X86CPU, env)); + return container_of(env, X86CPU, env); } =20 #define ENV_GET_CPU(e) CPU(x86_env_get_cpu(e)) diff --git a/target-lm32/cpu-qom.h b/target-lm32/cpu-qom.h index 5ef884b..e3bb619 100644 --- a/target-lm32/cpu-qom.h +++ b/target-lm32/cpu-qom.h @@ -64,7 +64,7 @@ typedef struct LM32CPU { =20 static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env) { - return LM32_CPU(container_of(env, LM32CPU, env)); + return container_of(env, LM32CPU, env); } =20 #define ENV_GET_CPU(e) CPU(lm32_env_get_cpu(e)) diff --git a/target-m68k/cpu-qom.h b/target-m68k/cpu-qom.h index 2436c13..858bf30 100644 --- a/target-m68k/cpu-qom.h +++ b/target-m68k/cpu-qom.h @@ -63,7 +63,7 @@ typedef struct M68kCPU { =20 static inline M68kCPU *m68k_env_get_cpu(CPUM68KState *env) { - return M68K_CPU(container_of(env, M68kCPU, env)); + return container_of(env, M68kCPU, env); } =20 #define ENV_GET_CPU(e) CPU(m68k_env_get_cpu(e)) diff --git a/target-microblaze/cpu-qom.h b/target-microblaze/cpu-qom.h index 3e9c206..ec2b989 100644 --- a/target-microblaze/cpu-qom.h +++ b/target-microblaze/cpu-qom.h @@ -64,7 +64,7 @@ typedef struct MicroBlazeCPU { =20 static inline MicroBlazeCPU *mb_env_get_cpu(CPUMBState *env) { - return MICROBLAZE_CPU(container_of(env, MicroBlazeCPU, env)); + return container_of(env, MicroBlazeCPU, env); } =20 #define ENV_GET_CPU(e) CPU(mb_env_get_cpu(e)) diff --git a/target-mips/cpu-qom.h b/target-mips/cpu-qom.h index a7ff9e6..654744a 100644 --- a/target-mips/cpu-qom.h +++ b/target-mips/cpu-qom.h @@ -67,7 +67,7 @@ typedef struct MIPSCPU { =20 static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env) { - return MIPS_CPU(container_of(env, MIPSCPU, env)); + return container_of(env, MIPSCPU, env); } =20 #define ENV_GET_CPU(e) CPU(mips_env_get_cpu(e)) diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h index 374b24a..72d02c2 100644 --- a/target-moxie/cpu.h +++ b/target-moxie/cpu.h @@ -106,7 +106,7 @@ typedef struct MoxieCPU { =20 static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env) { - return MOXIE_CPU(container_of(env, MoxieCPU, env)); + return container_of(env, MoxieCPU, env); } =20 #define ENV_GET_CPU(e) CPU(moxie_env_get_cpu(e)) diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h index b016f57..0aff8f2 100644 --- a/target-openrisc/cpu.h +++ b/target-openrisc/cpu.h @@ -335,7 +335,7 @@ typedef struct OpenRISCCPU { =20 static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env) { - return OPENRISC_CPU(container_of(env, OpenRISCCPU, env)); + return container_of(env, OpenRISCCPU, env); } =20 #define ENV_GET_CPU(e) CPU(openrisc_env_get_cpu(e)) diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h index 84ba105..7132599 100644 --- a/target-ppc/cpu-qom.h +++ b/target-ppc/cpu-qom.h @@ -91,7 +91,7 @@ typedef struct PowerPCCPU { =20 static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCState *env) { - return POWERPC_CPU(container_of(env, PowerPCCPU, env)); + return container_of(env, PowerPCCPU, env); } =20 #define ENV_GET_CPU(e) CPU(ppc_env_get_cpu(e)) diff --git a/target-s390x/cpu-qom.h b/target-s390x/cpu-qom.h index ec32d21..4c091e3 100644 --- a/target-s390x/cpu-qom.h +++ b/target-s390x/cpu-qom.h @@ -64,7 +64,7 @@ typedef struct S390CPU { =20 static inline S390CPU *s390_env_get_cpu(CPUS390XState *env) { - return S390_CPU(container_of(env, S390CPU, env)); + return container_of(env, S390CPU, env); } =20 #define ENV_GET_CPU(e) CPU(s390_env_get_cpu(e)) diff --git a/target-sh4/cpu-qom.h b/target-sh4/cpu-qom.h index 01d1637..c229a9a 100644 --- a/target-sh4/cpu-qom.h +++ b/target-sh4/cpu-qom.h @@ -76,7 +76,7 @@ typedef struct SuperHCPU { =20 static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env) { - return SUPERH_CPU(container_of(env, SuperHCPU, env)); + return container_of(env, SuperHCPU, env); } =20 #define ENV_GET_CPU(e) CPU(sh_env_get_cpu(e)) diff --git a/target-sparc/cpu-qom.h b/target-sparc/cpu-qom.h index 97c1ec7..033a5b5 100644 --- a/target-sparc/cpu-qom.h +++ b/target-sparc/cpu-qom.h @@ -68,7 +68,7 @@ typedef struct SPARCCPU { =20 static inline SPARCCPU *sparc_env_get_cpu(CPUSPARCState *env) { - return SPARC_CPU(container_of(env, SPARCCPU, env)); + return container_of(env, SPARCCPU, env); } =20 #define ENV_GET_CPU(e) CPU(sparc_env_get_cpu(e)) diff --git a/target-unicore32/cpu-qom.h b/target-unicore32/cpu-qom.h index 7eec448..350d480 100644 --- a/target-unicore32/cpu-qom.h +++ b/target-unicore32/cpu-qom.h @@ -53,7 +53,7 @@ typedef struct UniCore32CPU { =20 static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env) { - return UNICORE32_CPU(container_of(env, UniCore32CPU, env)); + return container_of(env, UniCore32CPU, env); } =20 #define ENV_GET_CPU(e) CPU(uc32_env_get_cpu(e)) diff --git a/target-xtensa/cpu-qom.h b/target-xtensa/cpu-qom.h index 30506cf..31e7498 100644 --- a/target-xtensa/cpu-qom.h +++ b/target-xtensa/cpu-qom.h @@ -73,7 +73,7 @@ typedef struct XtensaCPU { =20 static inline XtensaCPU *xtensa_env_get_cpu(const CPUXtensaState *env) { - return XTENSA_CPU(container_of(env, XtensaCPU, env)); + return container_of(env, XtensaCPU, env); } =20 #define ENV_GET_CPU(e) CPU(xtensa_env_get_cpu(e)) --=20 1.8.1.4