diff options
Diffstat (limited to 'tcg/tcg.h')
-rw-r--r-- | tcg/tcg.h | 39 |
1 files changed, 25 insertions, 14 deletions
@@ -23,6 +23,7 @@ */ #include "qemu-common.h" #include "tcg-target.h" +#include "tcg-runtime.h" #if TCG_TARGET_REG_BITS == 32 typedef int32_t tcg_target_long; @@ -56,8 +57,8 @@ enum { #define tcg_regset_clear(d) (d) = 0 #define tcg_regset_set(d, s) (d) = (s) #define tcg_regset_set32(d, reg, val32) (d) |= (val32) << (reg) -#define tcg_regset_set_reg(d, r) (d) |= 1 << (r) -#define tcg_regset_reset_reg(d, r) (d) &= ~(1 << (r)) +#define tcg_regset_set_reg(d, r) (d) |= 1L << (r) +#define tcg_regset_reset_reg(d, r) (d) &= ~(1L << (r)) #define tcg_regset_test_reg(d, r) (((d) >> (r)) & 1) #define tcg_regset_or(d, a, b) (d) = (a) | (b) #define tcg_regset_and(d, a, b) (d) = (a) & (b) @@ -121,7 +122,7 @@ typedef tcg_target_ulong TCGArg; are aliases for target_ulong and host pointer sized values respectively. */ -#ifdef DEBUG_TCG +#ifdef CONFIG_DEBUG_TCG #define DEBUG_TCGV 1 #endif @@ -204,6 +205,24 @@ typedef enum { TCG_COND_GTU, } TCGCond; +/* Invert the sense of the comparison. */ +static inline TCGCond tcg_invert_cond(TCGCond c) +{ + return (TCGCond)(c ^ 1); +} + +/* Swap the operands in a comparison. */ +static inline TCGCond tcg_swap_cond(TCGCond c) +{ + int mask = (c < TCG_COND_LT ? 0 : c < TCG_COND_LTU ? 7 : 15); + return (TCGCond)(c ^ mask); +} + +static inline TCGCond tcg_unsigned_cond(TCGCond c) +{ + return (c >= TCG_COND_LT && c <= TCG_COND_GT ? c + 4 : c); +} + #define TEMP_VAL_DEAD 0 #define TEMP_VAL_REG 1 #define TEMP_VAL_MEM 2 @@ -393,6 +412,9 @@ typedef struct TCGOpDef { uint16_t copy_size; TCGArgConstraint *args_ct; int *sorted_args; +#if defined(CONFIG_DEBUG_TCG) + int used; +#endif } TCGOpDef; typedef struct TCGTargetOpDef { @@ -452,17 +474,6 @@ TCGv_i64 tcg_const_local_i64(int64_t val); void tcg_out_reloc(TCGContext *s, uint8_t *code_ptr, int type, int label_index, long addend); -const TCGArg *tcg_gen_code_op(TCGContext *s, int opc, const TCGArg *args1, - unsigned int dead_iargs); - -/* tcg-runtime.c */ -int64_t tcg_helper_shl_i64(int64_t arg1, int64_t arg2); -int64_t tcg_helper_shr_i64(int64_t arg1, int64_t arg2); -int64_t tcg_helper_sar_i64(int64_t arg1, int64_t arg2); -int64_t tcg_helper_div_i64(int64_t arg1, int64_t arg2); -int64_t tcg_helper_rem_i64(int64_t arg1, int64_t arg2); -uint64_t tcg_helper_divu_i64(uint64_t arg1, uint64_t arg2); -uint64_t tcg_helper_remu_i64(uint64_t arg1, uint64_t arg2); extern uint8_t code_gen_prologue[]; #if defined(_ARCH_PPC) && !defined(_ARCH_PPC64) |