tcg: Introduce tcg_out_addi_ptr
Implement the function for arm, i386, and s390x, which will use it. Add stubs for all other backends. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
273eb50c0f
commit
6a6d772e30
@ -1102,6 +1102,13 @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd,
|
|||||||
tcg_out_insn(s, 3305, LDR, 0, rd);
|
tcg_out_insn(s, 3305, LDR, 0, rd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
|
||||||
|
tcg_target_long imm)
|
||||||
|
{
|
||||||
|
/* This function is only used for passing structs by reference. */
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
|
||||||
/* Define something more legible for general use. */
|
/* Define something more legible for general use. */
|
||||||
#define tcg_out_ldst_r tcg_out_insn_3310
|
#define tcg_out_ldst_r tcg_out_insn_3310
|
||||||
|
|
||||||
|
@ -2581,6 +2581,26 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
|
|||||||
tcg_out_movi32(s, COND_AL, ret, arg);
|
tcg_out_movi32(s, COND_AL, ret, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
|
||||||
|
tcg_target_long imm)
|
||||||
|
{
|
||||||
|
int enc, opc = ARITH_ADD;
|
||||||
|
|
||||||
|
/* All of the easiest immediates to encode are positive. */
|
||||||
|
if (imm < 0) {
|
||||||
|
imm = -imm;
|
||||||
|
opc = ARITH_SUB;
|
||||||
|
}
|
||||||
|
enc = encode_imm(imm);
|
||||||
|
if (enc >= 0) {
|
||||||
|
tcg_out_dat_imm(s, COND_AL, opc, rd, rs, enc);
|
||||||
|
} else {
|
||||||
|
tcg_out_movi32(s, COND_AL, TCG_REG_TMP, imm);
|
||||||
|
tcg_out_dat_reg(s, COND_AL, opc, rd, rs,
|
||||||
|
TCG_REG_TMP, SHIFT_IMM_LSL(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Type is always V128, with I64 elements. */
|
/* Type is always V128, with I64 elements. */
|
||||||
static void tcg_out_dup2_vec(TCGContext *s, TCGReg rd, TCGReg rl, TCGReg rh)
|
static void tcg_out_dup2_vec(TCGContext *s, TCGReg rd, TCGReg rl, TCGReg rh)
|
||||||
{
|
{
|
||||||
|
@ -1069,6 +1069,14 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
|
||||||
|
tcg_target_long imm)
|
||||||
|
{
|
||||||
|
/* This function is only used for passing structs by reference. */
|
||||||
|
tcg_debug_assert(TCG_TARGET_REG_BITS == 32);
|
||||||
|
tcg_out_modrm_offset(s, OPC_LEA, rd, rs, imm);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void tcg_out_pushi(TCGContext *s, tcg_target_long val)
|
static inline void tcg_out_pushi(TCGContext *s, tcg_target_long val)
|
||||||
{
|
{
|
||||||
if (val == (int8_t)val) {
|
if (val == (int8_t)val) {
|
||||||
|
@ -417,6 +417,13 @@ static void tcg_out_addi(TCGContext *s, TCGType type, TCGReg rd,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
|
||||||
|
tcg_target_long imm)
|
||||||
|
{
|
||||||
|
/* This function is only used for passing structs by reference. */
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
|
||||||
static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg)
|
static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg)
|
||||||
{
|
{
|
||||||
tcg_out_opc_andi(s, ret, arg, 0xff);
|
tcg_out_opc_andi(s, ret, arg, 0xff);
|
||||||
|
@ -550,6 +550,13 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
|
||||||
|
tcg_target_long imm)
|
||||||
|
{
|
||||||
|
/* This function is only used for passing structs by reference. */
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
|
||||||
static void tcg_out_bswap16(TCGContext *s, TCGReg ret, TCGReg arg, int flags)
|
static void tcg_out_bswap16(TCGContext *s, TCGReg ret, TCGReg arg, int flags)
|
||||||
{
|
{
|
||||||
/* ret and arg can't be register tmp0 */
|
/* ret and arg can't be register tmp0 */
|
||||||
|
@ -1125,6 +1125,13 @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg ret,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
|
||||||
|
tcg_target_long imm)
|
||||||
|
{
|
||||||
|
/* This function is only used for passing structs by reference. */
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
|
||||||
static bool mask_operand(uint32_t c, int *mb, int *me)
|
static bool mask_operand(uint32_t c, int *mb, int *me)
|
||||||
{
|
{
|
||||||
uint32_t lsb, test;
|
uint32_t lsb, test;
|
||||||
|
@ -559,6 +559,13 @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd,
|
|||||||
tcg_out_opc_imm(s, OPC_LD, rd, rd, 0);
|
tcg_out_opc_imm(s, OPC_LD, rd, rd, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
|
||||||
|
tcg_target_long imm)
|
||||||
|
{
|
||||||
|
/* This function is only used for passing structs by reference. */
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
|
||||||
static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg)
|
static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg)
|
||||||
{
|
{
|
||||||
tcg_out_opc_imm(s, OPC_ANDI, ret, arg, 0xff);
|
tcg_out_opc_imm(s, OPC_ANDI, ret, arg, 0xff);
|
||||||
|
@ -1073,6 +1073,13 @@ static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
|
||||||
|
tcg_target_long imm)
|
||||||
|
{
|
||||||
|
/* This function is only used for passing structs by reference. */
|
||||||
|
tcg_out_mem(s, RX_LA, RXY_LAY, rd, rs, TCG_REG_NONE, imm);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void tcg_out_risbg(TCGContext *s, TCGReg dest, TCGReg src,
|
static inline void tcg_out_risbg(TCGContext *s, TCGReg dest, TCGReg src,
|
||||||
int msb, int lsb, int ofs, int z)
|
int msb, int lsb, int ofs, int z)
|
||||||
{
|
{
|
||||||
|
@ -496,6 +496,13 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
|
|||||||
tcg_out_movi_int(s, type, ret, arg, false, TCG_REG_T2);
|
tcg_out_movi_int(s, type, ret, arg, false, TCG_REG_T2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
|
||||||
|
tcg_target_long imm)
|
||||||
|
{
|
||||||
|
/* This function is only used for passing structs by reference. */
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
|
||||||
static void tcg_out_ldst_rr(TCGContext *s, TCGReg data, TCGReg a1,
|
static void tcg_out_ldst_rr(TCGContext *s, TCGReg data, TCGReg a1,
|
||||||
TCGReg a2, int op)
|
TCGReg a2, int op)
|
||||||
{
|
{
|
||||||
|
@ -104,6 +104,8 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg1,
|
|||||||
static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
|
static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
|
||||||
static void tcg_out_movi(TCGContext *s, TCGType type,
|
static void tcg_out_movi(TCGContext *s, TCGType type,
|
||||||
TCGReg ret, tcg_target_long arg);
|
TCGReg ret, tcg_target_long arg);
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long)
|
||||||
|
__attribute__((unused));
|
||||||
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
|
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
|
||||||
static void tcg_out_goto_tb(TCGContext *s, int which);
|
static void tcg_out_goto_tb(TCGContext *s, int which);
|
||||||
static void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
static void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
||||||
|
@ -557,6 +557,13 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
|
||||||
|
tcg_target_long imm)
|
||||||
|
{
|
||||||
|
/* This function is only used for passing structs by reference. */
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
|
||||||
static void tcg_out_call(TCGContext *s, const tcg_insn_unit *func,
|
static void tcg_out_call(TCGContext *s, const tcg_insn_unit *func,
|
||||||
const TCGHelperInfo *info)
|
const TCGHelperInfo *info)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user