]> git.proxmox.com Git - qemu.git/commitdiff
cpu: Drop unnecessary dynamic casts in *_env_get_cpu()
authorAndreas Färber <afaerber@suse.de>
Fri, 10 May 2013 14:34:06 +0000 (16:34 +0200)
committerAndreas Färber <afaerber@suse.de>
Tue, 9 Jul 2013 19:20:28 +0000 (21:20 +0200)
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 3556c233d931ad5ffa46a35cb25cfc057732ebb8
(qom: allow turning cast debugging off).

Reported-by: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
16 files changed:
target-alpha/cpu-qom.h
target-arm/cpu-qom.h
target-cris/cpu-qom.h
target-i386/cpu-qom.h
target-lm32/cpu-qom.h
target-m68k/cpu-qom.h
target-microblaze/cpu-qom.h
target-mips/cpu-qom.h
target-moxie/cpu.h
target-openrisc/cpu.h
target-ppc/cpu-qom.h
target-s390x/cpu-qom.h
target-sh4/cpu-qom.h
target-sparc/cpu-qom.h
target-unicore32/cpu-qom.h
target-xtensa/cpu-qom.h

index 94e4a547fd1f1bb1bd5a51a8f2d09302bb961613..60125b19d58272886b23b49a8cabc0886ead69a1 100644 (file)
@@ -67,7 +67,7 @@ typedef struct AlphaCPU {
 
 static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env)
 {
-    return ALPHA_CPU(container_of(env, AlphaCPU, env));
+    return container_of(env, AlphaCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(alpha_env_get_cpu(e))
index ef6261fd17c5c2bf3b992146920ba7daac51a1ad..48ba6054ecdf29745c57dcf55c9a039004d106bd 100644 (file)
@@ -127,7 +127,7 @@ typedef struct ARMCPU {
 
 static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)
 {
-    return ARM_CPU(container_of(env, ARMCPU, env));
+    return container_of(env, ARMCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e))
index e08bdb1ec75caccc41952742ac38d087f47795d1..af7d14de4bd907ec89759cddf586397b2ea6d885 100644 (file)
@@ -66,7 +66,7 @@ typedef struct CRISCPU {
 
 static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env)
 {
-    return CRIS_CPU(container_of(env, CRISCPU, env));
+    return container_of(env, CRISCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e))
index b7c70d6ddc9e05cf01de1abcdfd82f238ed4a954..7e55e5fd2edcc8b85370b00a575ac4c54ad222c0 100644 (file)
@@ -72,7 +72,7 @@ typedef struct X86CPU {
 
 static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
 {
-    return X86_CPU(container_of(env, X86CPU, env));
+    return container_of(env, X86CPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(x86_env_get_cpu(e))
index 5ef884b97c9b8d9244752d220850a11a764e229a..e3bb619dc3d9b386d2c31f68abeeac9d7c55c794 100644 (file)
@@ -64,7 +64,7 @@ typedef struct LM32CPU {
 
 static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env)
 {
-    return LM32_CPU(container_of(env, LM32CPU, env));
+    return container_of(env, LM32CPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(lm32_env_get_cpu(e))
index 2436c13c5ca5712f70f2a264097419806917d9b0..858bf300887b87064de19361738c93c86cf4d2c9 100644 (file)
@@ -63,7 +63,7 @@ typedef struct M68kCPU {
 
 static inline M68kCPU *m68k_env_get_cpu(CPUM68KState *env)
 {
-    return M68K_CPU(container_of(env, M68kCPU, env));
+    return container_of(env, M68kCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(m68k_env_get_cpu(e))
index 3e9c20668ffdf8e4ddbe649d3ac91fbe74c5b02e..ec2b989a23c85ebbe182b1324396f3c947ca68db 100644 (file)
@@ -64,7 +64,7 @@ typedef struct MicroBlazeCPU {
 
 static inline MicroBlazeCPU *mb_env_get_cpu(CPUMBState *env)
 {
-    return MICROBLAZE_CPU(container_of(env, MicroBlazeCPU, env));
+    return container_of(env, MicroBlazeCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(mb_env_get_cpu(e))
index a7ff9e6ee1b867f9b02e7054f65803b7387cd528..654744a45b379c69effe8c34aa0c855be9ef785c 100644 (file)
@@ -67,7 +67,7 @@ typedef struct MIPSCPU {
 
 static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env)
 {
-    return MIPS_CPU(container_of(env, MIPSCPU, env));
+    return container_of(env, MIPSCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(mips_env_get_cpu(e))
index 374b24af5213e27149364f3d0b08814a98b956da..72d02c20c10c59fcb78dcce060fd09d61a0bccb2 100644 (file)
@@ -106,7 +106,7 @@ typedef struct MoxieCPU {
 
 static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env)
 {
-    return MOXIE_CPU(container_of(env, MoxieCPU, env));
+    return container_of(env, MoxieCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(moxie_env_get_cpu(e))
index b016f57bd5983e71b1896615c00192ba80144f3b..0aff8f20c7bba5de0661c880216f5b9a3232db32 100644 (file)
@@ -335,7 +335,7 @@ typedef struct OpenRISCCPU {
 
 static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env)
 {
-    return OPENRISC_CPU(container_of(env, OpenRISCCPU, env));
+    return container_of(env, OpenRISCCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(openrisc_env_get_cpu(e))
index 84ba1054d5f2002b51dc0eb1878f76470d6d3dd5..7132599516cff4b11850cb5cdade5ea8cc026521 100644 (file)
@@ -91,7 +91,7 @@ typedef struct PowerPCCPU {
 
 static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCState *env)
 {
-    return POWERPC_CPU(container_of(env, PowerPCCPU, env));
+    return container_of(env, PowerPCCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(ppc_env_get_cpu(e))
index ec32d21f051189ff9545d266ff3e221b8b9fe3fe..4c091e3ea07dfd5a44f96ff31a5ec72a7d0c37e0 100644 (file)
@@ -64,7 +64,7 @@ typedef struct S390CPU {
 
 static inline S390CPU *s390_env_get_cpu(CPUS390XState *env)
 {
-    return S390_CPU(container_of(env, S390CPU, env));
+    return container_of(env, S390CPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(s390_env_get_cpu(e))
index 01d16372b54eec26b2f91e40b8addab4d5049be3..c229a9a29bbe6995404c82dcea69102d4eeb3a2c 100644 (file)
@@ -76,7 +76,7 @@ typedef struct SuperHCPU {
 
 static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env)
 {
-    return SUPERH_CPU(container_of(env, SuperHCPU, env));
+    return container_of(env, SuperHCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(sh_env_get_cpu(e))
index 97c1ec7a592ea521e9987257089a45bdd9fb6ef3..033a5b5219b1491e6ab8fe59c566839b403e0c99 100644 (file)
@@ -68,7 +68,7 @@ typedef struct SPARCCPU {
 
 static inline SPARCCPU *sparc_env_get_cpu(CPUSPARCState *env)
 {
-    return SPARC_CPU(container_of(env, SPARCCPU, env));
+    return container_of(env, SPARCCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(sparc_env_get_cpu(e))
index 7eec4481c2c5af30364e7b0989c68c40e2a94ba2..350d48034c99cd4a1b1b441201e21c345f38cc19 100644 (file)
@@ -53,7 +53,7 @@ typedef struct UniCore32CPU {
 
 static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env)
 {
-    return UNICORE32_CPU(container_of(env, UniCore32CPU, env));
+    return container_of(env, UniCore32CPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(uc32_env_get_cpu(e))
index 30506cf6d52c6d4bacf5febecbfdf540031bd8a8..31e749818129d2bbb290335d10214417de90e465 100644 (file)
@@ -73,7 +73,7 @@ typedef struct XtensaCPU {
 
 static inline XtensaCPU *xtensa_env_get_cpu(const CPUXtensaState *env)
 {
-    return XTENSA_CPU(container_of(env, XtensaCPU, env));
+    return container_of(env, XtensaCPU, env);
 }
 
 #define ENV_GET_CPU(e) CPU(xtensa_env_get_cpu(e))