Subject: [PATCH 5/5] tci: speed optimization --- tcg/tci.c | 66 ++++++++++++++++++++++++++++++------------------------------ 1 files changed, 33 insertions(+), 33 deletions(-) diff --git a/tcg/tci.c b/tcg/tci.c index 3e4165b..8628e69 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -71,88 +71,88 @@ uint8_t * tci_tb_ptr; static tcg_target_ulong tci_reg[TCG_TARGET_NB_REGS]; -static tcg_target_ulong tci_read_reg(uint32_t index) +static inline tcg_target_ulong tci_read_reg(uint32_t index) { assert(index < ARRAY_SIZE(tci_reg)); return tci_reg[index]; } -static uint8_t tci_read_reg8(uint32_t index) +static inline uint8_t tci_read_reg8(uint32_t index) { return (uint8_t)tci_read_reg(index); } -static int8_t tci_read_reg8s(uint32_t index) +static inline int8_t tci_read_reg8s(uint32_t index) { return (int8_t)tci_read_reg(index); } -static uint16_t tci_read_reg16(uint32_t index) +static inline uint16_t tci_read_reg16(uint32_t index) { return (uint16_t)tci_read_reg(index); } -static int16_t tci_read_reg16s(uint32_t index) +static inline int16_t tci_read_reg16s(uint32_t index) { return (int16_t)tci_read_reg(index); } -static uint32_t tci_read_reg32(uint32_t index) +static inline uint32_t tci_read_reg32(uint32_t index) { return (uint32_t)tci_read_reg(index); } #if TCG_TARGET_REG_BITS == 64 -static int32_t tci_read_reg32s(uint32_t index) +static inline int32_t tci_read_reg32s(uint32_t index) { return (int32_t)tci_read_reg(index); } -static uint64_t tci_read_reg64(uint32_t index) +static inline uint64_t tci_read_reg64(uint32_t index) { return tci_read_reg(index); } #endif -static void tci_write_reg(uint32_t index, tcg_target_ulong value) +static inline void tci_write_reg(uint32_t index, tcg_target_ulong value) { assert(index < ARRAY_SIZE(tci_reg)); assert(index != TCG_AREG0); tci_reg[index] = value; } -static void tci_write_reg8(uint32_t index, uint8_t value) +static inline void tci_write_reg8(uint32_t index, uint8_t value) { tci_write_reg(index, value); } -static void tci_write_reg8s(uint32_t index, int8_t value) +static inline void tci_write_reg8s(uint32_t index, int8_t value) { tci_write_reg(index, value); } -static void tci_write_reg16s(uint32_t index, int16_t value) +static inline void tci_write_reg16s(uint32_t index, int16_t value) { tci_write_reg(index, value); } -static void tci_write_reg16(uint32_t index, uint16_t value) +static inline void tci_write_reg16(uint32_t index, uint16_t value) { tci_write_reg(index, value); } -static void tci_write_reg32(uint32_t index, uint32_t value) +static inline void tci_write_reg32(uint32_t index, uint32_t value) { tci_write_reg(index, value); } -static void tci_write_reg32s(uint32_t index, int32_t value) +static inline void tci_write_reg32s(uint32_t index, int32_t value) { tci_write_reg(index, value); } #if TCG_TARGET_REG_BITS == 64 -static void tci_write_reg64(uint32_t index, uint64_t value) +static inline void tci_write_reg64(uint32_t index, uint64_t value) { tci_write_reg(index, value); } @@ -160,14 +160,14 @@ static void tci_write_reg64(uint32_t index, uint64_t value) #if TCG_TARGET_REG_BITS == 32 /* Create a 64 bit value from two 32 bit values. */ -static uint64_t tci_uint64(uint32_t high, uint32_t low) +static inline uint64_t tci_uint64(uint32_t high, uint32_t low) { return ((uint64_t)high << 32) + low; } #endif /* Read constant (native size) from bytecode. */ -static tcg_target_ulong tci_read_i(uint8_t **tb_ptr) +static inline tcg_target_ulong tci_read_i(uint8_t **tb_ptr) { tcg_target_ulong value = *(tcg_target_ulong *)(*tb_ptr); *tb_ptr += sizeof(tcg_target_ulong); @@ -175,7 +175,7 @@ static tcg_target_ulong tci_read_i(uint8_t **tb_ptr) } /* Read constant (32 bit) from bytecode. */ -static uint32_t tci_read_i32(uint8_t **tb_ptr) +static inline uint32_t tci_read_i32(uint8_t **tb_ptr) { uint32_t value = *(uint32_t *)(*tb_ptr); *tb_ptr += 4; @@ -184,7 +184,7 @@ static uint32_t tci_read_i32(uint8_t **tb_ptr) #if TCG_TARGET_REG_BITS == 64 /* Read constant (64 bit) from bytecode. */ -static uint64_t tci_read_i64(uint8_t **tb_ptr) +static inline uint64_t tci_read_i64(uint8_t **tb_ptr) { uint64_t value = *(uint64_t *)(*tb_ptr); *tb_ptr += 8; @@ -193,7 +193,7 @@ static uint64_t tci_read_i64(uint8_t **tb_ptr) #endif /* Read indexed register (native size) from bytecode. */ -static tcg_target_ulong tci_read_r(uint8_t **tb_ptr) +static inline tcg_target_ulong tci_read_r(uint8_t **tb_ptr) { tcg_target_ulong value = tci_read_reg(**tb_ptr); *tb_ptr += 1; @@ -201,7 +201,7 @@ static tcg_target_ulong tci_read_r(uint8_t **tb_ptr) } /* Read indexed register (8 bit) from bytecode. */ -static uint8_t tci_read_r8(uint8_t **tb_ptr) +static inline uint8_t tci_read_r8(uint8_t **tb_ptr) { uint8_t value = tci_read_reg8(**tb_ptr); *tb_ptr += 1; @@ -209,7 +209,7 @@ static uint8_t tci_read_r8(uint8_t **tb_ptr) } /* Read indexed register (8 bit signed) from bytecode. */ -static int8_t tci_read_r8s(uint8_t **tb_ptr) +static inline int8_t tci_read_r8s(uint8_t **tb_ptr) { int8_t value = tci_read_reg8s(**tb_ptr); *tb_ptr += 1; @@ -217,7 +217,7 @@ static int8_t tci_read_r8s(uint8_t **tb_ptr) } /* Read indexed register (16 bit) from bytecode. */ -static uint16_t tci_read_r16(uint8_t **tb_ptr) +static inline uint16_t tci_read_r16(uint8_t **tb_ptr) { uint16_t value = tci_read_reg16(**tb_ptr); *tb_ptr += 1; @@ -225,7 +225,7 @@ static uint16_t tci_read_r16(uint8_t **tb_ptr) } /* Read indexed register (16 bit signed) from bytecode. */ -static int16_t tci_read_r16s(uint8_t **tb_ptr) +static inline int16_t tci_read_r16s(uint8_t **tb_ptr) { uint16_t value = tci_read_reg16s(**tb_ptr); *tb_ptr += 1; @@ -233,7 +233,7 @@ static int16_t tci_read_r16s(uint8_t **tb_ptr) } /* Read indexed register (32 bit) from bytecode. */ -static uint32_t tci_read_r32(uint8_t **tb_ptr) +static inline uint32_t tci_read_r32(uint8_t **tb_ptr) { uint32_t value = tci_read_reg32(**tb_ptr); *tb_ptr += 1; @@ -242,7 +242,7 @@ static uint32_t tci_read_r32(uint8_t **tb_ptr) #if TCG_TARGET_REG_BITS == 64 /* Read indexed register (32 bit signed) from bytecode. */ -static int32_t tci_read_r32s(uint8_t **tb_ptr) +static inline int32_t tci_read_r32s(uint8_t **tb_ptr) { int32_t value = tci_read_reg32s(**tb_ptr); *tb_ptr += 1; @@ -250,7 +250,7 @@ static int32_t tci_read_r32s(uint8_t **tb_ptr) } /* Read indexed register (64 bit) from bytecode. */ -static uint64_t tci_read_r64(uint8_t **tb_ptr) +static inline uint64_t tci_read_r64(uint8_t **tb_ptr) { uint64_t value = tci_read_reg64(**tb_ptr); *tb_ptr += 1; @@ -259,7 +259,7 @@ static uint64_t tci_read_r64(uint8_t **tb_ptr) #endif /* Read indexed register or constant (native size) from bytecode. */ -static tcg_target_ulong tci_read_ri(uint8_t **tb_ptr) +static inline tcg_target_ulong tci_read_ri(uint8_t **tb_ptr) { bool const_arg; tcg_target_ulong value; @@ -274,7 +274,7 @@ static tcg_target_ulong tci_read_ri(uint8_t **tb_ptr) } /* Read indexed register or constant (32 bit) from bytecode. */ -static uint32_t tci_read_ri32(uint8_t **tb_ptr) +static inline uint32_t tci_read_ri32(uint8_t **tb_ptr) { bool const_arg; uint32_t value; @@ -290,7 +290,7 @@ static uint32_t tci_read_ri32(uint8_t **tb_ptr) #if TCG_TARGET_REG_BITS == 64 /* Read indexed register or constant (64 bit) from bytecode. */ -static uint64_t tci_read_ri64(uint8_t **tb_ptr) +static inline uint64_t tci_read_ri64(uint8_t **tb_ptr) { bool const_arg; uint64_t value; @@ -305,7 +305,7 @@ static uint64_t tci_read_ri64(uint8_t **tb_ptr) } #endif -static bool tci_compare32(uint32_t u0, uint32_t u1, TCGCond condition) +static inline bool tci_compare32(uint32_t u0, uint32_t u1, TCGCond condition) { bool result = false; int32_t i0 = u0; @@ -347,7 +347,7 @@ static bool tci_compare32(uint32_t u0, uint32_t u1, TCGCond condition) return result; } -static bool tci_compare64(uint64_t u0, uint64_t u1, TCGCond condition) +static inline bool tci_compare64(uint64_t u0, uint64_t u1, TCGCond condition) { bool result = false; int64_t i0 = u0; -- 1.6.3.msysgit.0