mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
tcg: Introduce TYPE_CONST temporaries
These will hold a single constant for the duration of the TB. They are hashed, so that each value has one temp across the TB. Not used yet, this is all infrastructure. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
54795544e4
commit
c0522136ad
3 changed files with 211 additions and 50 deletions
|
@ -492,6 +492,8 @@ typedef enum TCGTempKind {
|
|||
TEMP_GLOBAL,
|
||||
/* Temp is in a fixed register. */
|
||||
TEMP_FIXED,
|
||||
/* Temp is a fixed constant. */
|
||||
TEMP_CONST,
|
||||
} TCGTempKind;
|
||||
|
||||
typedef struct TCGTemp {
|
||||
|
@ -665,6 +667,7 @@ struct TCGContext {
|
|||
QSIMPLEQ_HEAD(, TCGOp) plugin_ops;
|
||||
#endif
|
||||
|
||||
GHashTable *const_table[TCG_TYPE_COUNT];
|
||||
TCGTempSet free_temps[TCG_TYPE_COUNT * 2];
|
||||
TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */
|
||||
|
||||
|
@ -681,7 +684,7 @@ struct TCGContext {
|
|||
|
||||
static inline bool temp_readonly(TCGTemp *ts)
|
||||
{
|
||||
return ts->kind == TEMP_FIXED;
|
||||
return ts->kind >= TEMP_FIXED;
|
||||
}
|
||||
|
||||
extern TCGContext tcg_init_ctx;
|
||||
|
@ -1079,6 +1082,7 @@ TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *op, TCGOpcode opc);
|
|||
|
||||
void tcg_optimize(TCGContext *s);
|
||||
|
||||
/* Allocate a new temporary and initialize it with a constant. */
|
||||
TCGv_i32 tcg_const_i32(int32_t val);
|
||||
TCGv_i64 tcg_const_i64(int64_t val);
|
||||
TCGv_i32 tcg_const_local_i32(int32_t val);
|
||||
|
@ -1088,6 +1092,24 @@ TCGv_vec tcg_const_ones_vec(TCGType);
|
|||
TCGv_vec tcg_const_zeros_vec_matching(TCGv_vec);
|
||||
TCGv_vec tcg_const_ones_vec_matching(TCGv_vec);
|
||||
|
||||
/*
|
||||
* Locate or create a read-only temporary that is a constant.
|
||||
* This kind of temporary need not and should not be freed.
|
||||
*/
|
||||
TCGTemp *tcg_constant_internal(TCGType type, int64_t val);
|
||||
|
||||
static inline TCGv_i32 tcg_constant_i32(int32_t val)
|
||||
{
|
||||
return temp_tcgv_i32(tcg_constant_internal(TCG_TYPE_I32, val));
|
||||
}
|
||||
|
||||
static inline TCGv_i64 tcg_constant_i64(int64_t val)
|
||||
{
|
||||
return temp_tcgv_i64(tcg_constant_internal(TCG_TYPE_I64, val));
|
||||
}
|
||||
|
||||
TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val);
|
||||
|
||||
#if UINTPTR_MAX == UINT32_MAX
|
||||
# define tcg_const_ptr(x) ((TCGv_ptr)tcg_const_i32((intptr_t)(x)))
|
||||
# define tcg_const_local_ptr(x) ((TCGv_ptr)tcg_const_local_i32((intptr_t)(x)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue