]> Git Repo - qemu.git/blobdiff - tcg/tcg.h
Fuse EQ and NE handling in tcg_out_brcond2
[qemu.git] / tcg / tcg.h
index 3a78a7faeed721772c5e020634432b940777e0ec..2ce36b8786368416c14af5e2e3bdafae1b38e513 100644 (file)
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -98,6 +98,7 @@ typedef int TCGType;
 
 #define TCG_TYPE_I32 0
 #define TCG_TYPE_I64 1
+#define TCG_TYPE_COUNT 2 /* number of different types */
 
 #if TCG_TARGET_REG_BITS == 32
 #define TCG_TYPE_PTR TCG_TYPE_I32
@@ -142,6 +143,9 @@ typedef int TCGv;
 
 #endif /* DEBUG_TCGV */
 
+/* Dummy definition to avoid compiler warnings.  */
+#define TCGV_UNUSED(x) x = MAKE_TCGV(-1)
+
 /* call flags */
 #define TCG_CALL_TYPE_MASK      0x000f
 #define TCG_CALL_TYPE_STD       0x0000 /* standard C call */
@@ -153,6 +157,10 @@ typedef int TCGv;
    safely suppressed if the return value is not used. */
 #define TCG_CALL_PURE           0x0010 
 
+/* used to align parameters */
+#define TCG_CALL_DUMMY_TCGV     MAKE_TCGV(-1)
+#define TCG_CALL_DUMMY_ARG      ((TCGArg)(-1))
+
 typedef enum {
     TCG_COND_EQ,
     TCG_COND_NE,
@@ -184,18 +192,22 @@ typedef struct TCGTemp {
     unsigned int fixed_reg:1;
     unsigned int mem_coherent:1;
     unsigned int mem_allocated:1;
+    unsigned int temp_local:1; /* If true, the temp is saved accross
+                                  basic blocks. Otherwise, it is not
+                                  preserved accross basic blocks. */
+    unsigned int temp_allocated:1; /* never used for code gen */
+    /* index of next free temp of same base type, -1 if end */
+    int next_free_temp;
     const char *name;
 } TCGTemp;
 
 typedef struct TCGHelperInfo {
-    void *func;
+    tcg_target_ulong func;
     const char *name;
 } TCGHelperInfo;
 
 typedef struct TCGContext TCGContext;
 
-typedef void TCGMacroFunc(TCGContext *s, int macro_id, const int *dead_args);
-
 struct TCGContext {
     uint8_t *pool_cur, *pool_end;
     TCGPool *pool_first, *pool_current;
@@ -204,9 +216,8 @@ struct TCGContext {
     TCGTemp *temps; /* globals first, temps after */
     int nb_globals;
     int nb_temps;
-    /* constant indexes (end of temp array) */
-    int const_start;
-    int const_end;
+    /* index of free temps, -1 if none */
+    int first_free_temp[TCG_TYPE_COUNT * 2]; 
 
     /* goto_tb support */
     uint8_t *code_buf;
@@ -214,8 +225,10 @@ struct TCGContext {
     uint16_t *tb_next_offset;
     uint16_t *tb_jmp_offset; /* != NULL if USE_DIRECT_JUMP */
 
+    /* liveness analysis */
     uint16_t *op_dead_iargs; /* for each operation, each bit tells if the
                                 corresponding input argument is dead */
+    
     /* tells in which temporary a given register is. It does not take
        into account fixed registers */
     int reg_to_temp[TCG_TARGET_NB_REGS];
@@ -228,10 +241,29 @@ struct TCGContext {
     uint8_t *code_ptr;
     TCGTemp static_temps[TCG_MAX_TEMPS];
 
-    TCGMacroFunc *macro_func;
     TCGHelperInfo *helpers;
     int nb_helpers;
     int allocated_helpers;
+    int helpers_sorted;
+
+#ifdef CONFIG_PROFILER
+    /* profiling info */
+    int64_t tb_count1;
+    int64_t tb_count;
+    int64_t op_count; /* total insn count */
+    int op_count_max; /* max insn per TB */
+    int64_t temp_count;
+    int temp_count_max;
+    int64_t old_op_count;
+    int64_t del_op_count;
+    int64_t code_in_len;
+    int64_t code_out_len;
+    int64_t interm_time;
+    int64_t code_time;
+    int64_t la_time;
+    int64_t restore_count;
+    int64_t restore_time;
+#endif
 };
 
 extern TCGContext tcg_ctx;
@@ -269,14 +301,24 @@ int dyngen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset);
 
 void tcg_set_frame(TCGContext *s, int reg,
                    tcg_target_long start, tcg_target_long size);
-void tcg_set_macro_func(TCGContext *s, TCGMacroFunc *func);
 TCGv tcg_global_reg_new(TCGType type, int reg, const char *name);
 TCGv tcg_global_reg2_new_hack(TCGType type, int reg1, int reg2, 
                               const char *name);
 TCGv tcg_global_mem_new(TCGType type, int reg, tcg_target_long offset,
                         const char *name);
-TCGv tcg_temp_new(TCGType type);
+TCGv tcg_temp_new_internal(TCGType type, int temp_local);
+static inline TCGv tcg_temp_new(TCGType type)
+{
+    return tcg_temp_new_internal(type, 0);
+}
+static inline TCGv tcg_temp_local_new(TCGType type)
+{
+    return tcg_temp_new_internal(type, 1);
+}
+void tcg_temp_free(TCGv arg);
 char *tcg_get_arg_str(TCGContext *s, char *buf, int buf_size, TCGv arg);
+void tcg_dump_info(FILE *f,
+                   int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
 
 #define TCG_CT_ALIAS  0x80
 #define TCG_CT_IALIAS 0x40
@@ -356,9 +398,6 @@ TCGv tcg_const_i64(int64_t val);
 
 void tcg_out_reloc(TCGContext *s, uint8_t *code_ptr, int type, 
                    int label_index, long addend);
-void tcg_reg_alloc_start(TCGContext *s);
-void tcg_reg_alloc_bb_end(TCGContext *s);
-void tcg_liveness_analysis(TCGContext *s);
 const TCGArg *tcg_gen_code_op(TCGContext *s, int opc, const TCGArg *args1,
                               unsigned int dead_iargs);
 
@@ -374,4 +413,9 @@ 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[];
+#ifdef __powerpc__
+#define tcg_qemu_tb_exec(tb_ptr) \
+    ((long REGPARM __attribute__ ((longcall)) (*)(void *))code_gen_prologue)(tb_ptr)
+#else
 #define tcg_qemu_tb_exec(tb_ptr) ((long REGPARM (*)(void *))code_gen_prologue)(tb_ptr)
+#endif
This page took 0.02849 seconds and 4 git commands to generate.