summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2013-08-14 09:46:38 -0700
committerRichard Henderson <rth@twiddle.net>2013-08-26 13:31:53 -0700
commit2bb8656dadcaa521a9699ab2a2632b68da36c998 (patch)
tree8ed7bb10606b8e2701492f29ea7b7f4431c4a0f1
parentf7ad538e1ea130c8b6f3abb06ad6c856242c799e (diff)
downloadfocaccia-qemu-2bb8656dadcaa521a9699ab2a2632b68da36c998.tar.gz
focaccia-qemu-2bb8656dadcaa521a9699ab2a2632b68da36c998.zip
tcg: Tidy generated code for tcg_outN
Aliasing was forcing s->code_ptr to be re-read after the store.
Keep the pointer in a local variable to help the compiler.

Signed-off-by: Richard Henderson <rth@twiddle.net>
-rw-r--r--tcg/tcg.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index dac8224024..42c95af66d 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -121,14 +121,16 @@ static inline void tcg_out8(TCGContext *s, uint8_t v)
 
 static inline void tcg_out16(TCGContext *s, uint16_t v)
 {
-    *(uint16_t *)s->code_ptr = v;
-    s->code_ptr += 2;
+    uint8_t *p = s->code_ptr;
+    *(uint16_t *)p = v;
+    s->code_ptr = p + 2;
 }
 
 static inline void tcg_out32(TCGContext *s, uint32_t v)
 {
-    *(uint32_t *)s->code_ptr = v;
-    s->code_ptr += 4;
+    uint8_t *p = s->code_ptr;
+    *(uint32_t *)p = v;
+    s->code_ptr = p + 4;
 }
 
 /* label relocation processing */