mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
added tcg_temp_free() and improved the handling of constants
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4544 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
+129
-35
@@ -178,88 +178,115 @@ static inline void tcg_gen_movi_i32(TCGv ret, int32_t arg)
|
||||
|
||||
static inline void tcg_gen_helper_0_0(void *func)
|
||||
{
|
||||
TCGv t0;
|
||||
t0 = tcg_const_ptr((tcg_target_long)func);
|
||||
tcg_gen_call(&tcg_ctx,
|
||||
tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
|
||||
t0, TCG_HELPER_CALL_FLAGS,
|
||||
0, NULL, 0, NULL);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_helper_0_1(void *func, TCGv arg)
|
||||
{
|
||||
TCGv t0;
|
||||
t0 = tcg_const_ptr((tcg_target_long)func);
|
||||
tcg_gen_call(&tcg_ctx,
|
||||
tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
|
||||
t0, TCG_HELPER_CALL_FLAGS,
|
||||
0, NULL, 1, &arg);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_helper_0_2(void *func, TCGv arg1, TCGv arg2)
|
||||
{
|
||||
TCGv args[2];
|
||||
TCGv t0;
|
||||
args[0] = arg1;
|
||||
args[1] = arg2;
|
||||
t0 = tcg_const_ptr((tcg_target_long)func);
|
||||
tcg_gen_call(&tcg_ctx,
|
||||
tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
|
||||
t0, TCG_HELPER_CALL_FLAGS,
|
||||
0, NULL, 2, args);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_helper_0_3(void *func,
|
||||
TCGv arg1, TCGv arg2, TCGv arg3)
|
||||
{
|
||||
TCGv args[3];
|
||||
TCGv t0;
|
||||
args[0] = arg1;
|
||||
args[1] = arg2;
|
||||
args[2] = arg3;
|
||||
t0 = tcg_const_ptr((tcg_target_long)func);
|
||||
tcg_gen_call(&tcg_ctx,
|
||||
tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
|
||||
t0, TCG_HELPER_CALL_FLAGS,
|
||||
0, NULL, 3, args);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_helper_0_4(void *func, TCGv arg1, TCGv arg2,
|
||||
TCGv arg3, TCGv arg4)
|
||||
{
|
||||
TCGv args[4];
|
||||
TCGv t0;
|
||||
args[0] = arg1;
|
||||
args[1] = arg2;
|
||||
args[2] = arg3;
|
||||
args[3] = arg4;
|
||||
t0 = tcg_const_ptr((tcg_target_long)func);
|
||||
tcg_gen_call(&tcg_ctx,
|
||||
tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
|
||||
t0, TCG_HELPER_CALL_FLAGS,
|
||||
0, NULL, 4, args);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_helper_1_0(void *func, TCGv ret)
|
||||
{
|
||||
TCGv t0;
|
||||
t0 = tcg_const_ptr((tcg_target_long)func);
|
||||
tcg_gen_call(&tcg_ctx,
|
||||
tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
|
||||
t0, TCG_HELPER_CALL_FLAGS,
|
||||
1, &ret, 0, NULL);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_helper_1_1(void *func, TCGv ret, TCGv arg1)
|
||||
{
|
||||
TCGv t0;
|
||||
t0 = tcg_const_ptr((tcg_target_long)func);
|
||||
tcg_gen_call(&tcg_ctx,
|
||||
tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
|
||||
t0, TCG_HELPER_CALL_FLAGS,
|
||||
1, &ret, 1, &arg1);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_helper_1_2(void *func, TCGv ret,
|
||||
TCGv arg1, TCGv arg2)
|
||||
{
|
||||
TCGv args[2];
|
||||
TCGv t0;
|
||||
args[0] = arg1;
|
||||
args[1] = arg2;
|
||||
t0 = tcg_const_ptr((tcg_target_long)func);
|
||||
tcg_gen_call(&tcg_ctx,
|
||||
tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
|
||||
t0, TCG_HELPER_CALL_FLAGS,
|
||||
1, &ret, 2, args);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_helper_1_3(void *func, TCGv ret,
|
||||
TCGv arg1, TCGv arg2, TCGv arg3)
|
||||
{
|
||||
TCGv args[3];
|
||||
TCGv t0;
|
||||
args[0] = arg1;
|
||||
args[1] = arg2;
|
||||
args[2] = arg3;
|
||||
t0 = tcg_const_ptr((tcg_target_long)func);
|
||||
tcg_gen_call(&tcg_ctx,
|
||||
tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
|
||||
t0, TCG_HELPER_CALL_FLAGS,
|
||||
1, &ret, 3, args);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_helper_1_4(void *func, TCGv ret,
|
||||
@@ -267,13 +294,16 @@ static inline void tcg_gen_helper_1_4(void *func, TCGv ret,
|
||||
TCGv arg4)
|
||||
{
|
||||
TCGv args[4];
|
||||
TCGv t0;
|
||||
args[0] = arg1;
|
||||
args[1] = arg2;
|
||||
args[2] = arg3;
|
||||
args[3] = arg4;
|
||||
t0 = tcg_const_ptr((tcg_target_long)func);
|
||||
tcg_gen_call(&tcg_ctx,
|
||||
tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
|
||||
t0, TCG_HELPER_CALL_FLAGS,
|
||||
1, &ret, 4, args);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
/* 32 bit ops */
|
||||
@@ -329,7 +359,9 @@ static inline void tcg_gen_addi_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||
if (arg2 == 0) {
|
||||
tcg_gen_mov_i32(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_add_i32(ret, arg1, tcg_const_i32(arg2));
|
||||
TCGv t0 = tcg_const_i32(arg2);
|
||||
tcg_gen_add_i32(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,7 +376,9 @@ static inline void tcg_gen_subi_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||
if (arg2 == 0) {
|
||||
tcg_gen_mov_i32(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_sub_i32(ret, arg1, tcg_const_i32(arg2));
|
||||
TCGv t0 = tcg_const_i32(arg2);
|
||||
tcg_gen_sub_i32(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +395,9 @@ static inline void tcg_gen_andi_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||
} else if (arg2 == 0xffffffff) {
|
||||
tcg_gen_mov_i32(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_and_i32(ret, arg1, tcg_const_i32(arg2));
|
||||
TCGv t0 = tcg_const_i32(arg2);
|
||||
tcg_gen_and_i32(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,7 +414,9 @@ static inline void tcg_gen_ori_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||
} else if (arg2 == 0) {
|
||||
tcg_gen_mov_i32(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_or_i32(ret, arg1, tcg_const_i32(arg2));
|
||||
TCGv t0 = tcg_const_i32(arg2);
|
||||
tcg_gen_or_i32(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +431,9 @@ static inline void tcg_gen_xori_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||
if (arg2 == 0) {
|
||||
tcg_gen_mov_i32(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_xor_i32(ret, arg1, tcg_const_i32(arg2));
|
||||
TCGv t0 = tcg_const_i32(arg2);
|
||||
tcg_gen_xor_i32(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,7 +447,9 @@ static inline void tcg_gen_shli_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||
if (arg2 == 0) {
|
||||
tcg_gen_mov_i32(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_shl_i32(ret, arg1, tcg_const_i32(arg2));
|
||||
TCGv t0 = tcg_const_i32(arg2);
|
||||
tcg_gen_shl_i32(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +463,9 @@ static inline void tcg_gen_shri_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||
if (arg2 == 0) {
|
||||
tcg_gen_mov_i32(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_shr_i32(ret, arg1, tcg_const_i32(arg2));
|
||||
TCGv t0 = tcg_const_i32(arg2);
|
||||
tcg_gen_shr_i32(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,7 +479,9 @@ static inline void tcg_gen_sari_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||
if (arg2 == 0) {
|
||||
tcg_gen_mov_i32(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_sar_i32(ret, arg1, tcg_const_i32(arg2));
|
||||
TCGv t0 = tcg_const_i32(arg2);
|
||||
tcg_gen_sar_i32(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,7 +498,9 @@ static inline void tcg_gen_mul_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
|
||||
static inline void tcg_gen_muli_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||
{
|
||||
tcg_gen_mul_i32(ret, arg1, tcg_const_i32(arg2));
|
||||
TCGv t0 = tcg_const_i32(arg2);
|
||||
tcg_gen_mul_i32(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
#ifdef TCG_TARGET_HAS_div_i32
|
||||
@@ -482,6 +530,7 @@ static inline void tcg_gen_div_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
t0 = tcg_temp_new(TCG_TYPE_I32);
|
||||
tcg_gen_sari_i32(t0, arg1, 31);
|
||||
tcg_gen_op5(INDEX_op_div2_i32, ret, t0, arg1, t0, arg2);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_rem_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -490,6 +539,7 @@ static inline void tcg_gen_rem_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
t0 = tcg_temp_new(TCG_TYPE_I32);
|
||||
tcg_gen_sari_i32(t0, arg1, 31);
|
||||
tcg_gen_op5(INDEX_op_div2_i32, t0, ret, arg1, t0, arg2);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_divu_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -498,6 +548,7 @@ static inline void tcg_gen_divu_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
t0 = tcg_temp_new(TCG_TYPE_I32);
|
||||
tcg_gen_movi_i32(t0, 0);
|
||||
tcg_gen_op5(INDEX_op_divu2_i32, ret, t0, arg1, t0, arg2);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_remu_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -506,6 +557,7 @@ static inline void tcg_gen_remu_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
t0 = tcg_temp_new(TCG_TYPE_I32);
|
||||
tcg_gen_movi_i32(t0, 0);
|
||||
tcg_gen_op5(INDEX_op_divu2_i32, t0, ret, arg1, t0, arg2);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -608,7 +660,9 @@ static inline void tcg_gen_add_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
|
||||
static inline void tcg_gen_addi_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
{
|
||||
tcg_gen_add_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_add_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_sub_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -619,7 +673,9 @@ static inline void tcg_gen_sub_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
|
||||
static inline void tcg_gen_subi_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
{
|
||||
tcg_gen_sub_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_sub_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_and_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -713,11 +769,15 @@ static inline void tcg_gen_mul_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
tcg_gen_add_i32(TCGV_HIGH(t0), TCGV_HIGH(t0), t1);
|
||||
|
||||
tcg_gen_mov_i64(ret, t0);
|
||||
tcg_temp_free(t0);
|
||||
tcg_temp_free(t1);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_muli_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
{
|
||||
tcg_gen_mul_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_mul_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -824,7 +884,9 @@ static inline void tcg_gen_add_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
|
||||
static inline void tcg_gen_addi_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
{
|
||||
tcg_gen_add_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_add_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_sub_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -834,7 +896,9 @@ static inline void tcg_gen_sub_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
|
||||
static inline void tcg_gen_subi_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
{
|
||||
tcg_gen_sub_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_sub_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_and_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -844,7 +908,9 @@ static inline void tcg_gen_and_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
|
||||
static inline void tcg_gen_andi_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
{
|
||||
tcg_gen_and_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_and_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_or_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -854,7 +920,9 @@ static inline void tcg_gen_or_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
|
||||
static inline void tcg_gen_ori_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
{
|
||||
tcg_gen_or_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_or_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_xor_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -864,7 +932,9 @@ static inline void tcg_gen_xor_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
|
||||
static inline void tcg_gen_xori_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
{
|
||||
tcg_gen_xor_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_xor_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_shl_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -877,7 +947,9 @@ static inline void tcg_gen_shli_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
if (arg2 == 0) {
|
||||
tcg_gen_mov_i64(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_shl_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_shl_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -891,7 +963,9 @@ static inline void tcg_gen_shri_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
if (arg2 == 0) {
|
||||
tcg_gen_mov_i64(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_shr_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_shr_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -905,7 +979,9 @@ static inline void tcg_gen_sari_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
if (arg2 == 0) {
|
||||
tcg_gen_mov_i64(ret, arg1);
|
||||
} else {
|
||||
tcg_gen_sar_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_sar_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -922,7 +998,9 @@ static inline void tcg_gen_mul_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
|
||||
static inline void tcg_gen_muli_i64(TCGv ret, TCGv arg1, int64_t arg2)
|
||||
{
|
||||
tcg_gen_mul_i64(ret, arg1, tcg_const_i64(arg2));
|
||||
TCGv t0 = tcg_const_i64(arg2);
|
||||
tcg_gen_mul_i64(ret, arg1, t0);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
#ifdef TCG_TARGET_HAS_div_i64
|
||||
@@ -952,6 +1030,7 @@ static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
t0 = tcg_temp_new(TCG_TYPE_I64);
|
||||
tcg_gen_sari_i64(t0, arg1, 63);
|
||||
tcg_gen_op5(INDEX_op_div2_i64, ret, t0, arg1, t0, arg2);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_rem_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -960,6 +1039,7 @@ static inline void tcg_gen_rem_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
t0 = tcg_temp_new(TCG_TYPE_I64);
|
||||
tcg_gen_sari_i64(t0, arg1, 63);
|
||||
tcg_gen_op5(INDEX_op_div2_i64, t0, ret, arg1, t0, arg2);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_divu_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -968,6 +1048,7 @@ static inline void tcg_gen_divu_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
t0 = tcg_temp_new(TCG_TYPE_I64);
|
||||
tcg_gen_movi_i64(t0, 0);
|
||||
tcg_gen_op5(INDEX_op_divu2_i64, ret, t0, arg1, t0, arg2);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_remu_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
@@ -976,6 +1057,7 @@ static inline void tcg_gen_remu_i64(TCGv ret, TCGv arg1, TCGv arg2)
|
||||
t0 = tcg_temp_new(TCG_TYPE_I64);
|
||||
tcg_gen_movi_i64(t0, 0);
|
||||
tcg_gen_op5(INDEX_op_divu2_i64, t0, ret, arg1, t0, arg2);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1030,6 +1112,8 @@ static inline void tcg_gen_bswap16_i32(TCGv ret, TCGv arg)
|
||||
tcg_gen_andi_i32(t1, arg, 0x000000ff);
|
||||
tcg_gen_shli_i32(t1, t1, 8);
|
||||
tcg_gen_or_i32(ret, t0, t1);
|
||||
tcg_temp_free(t0);
|
||||
tcg_temp_free(t1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1054,6 +1138,8 @@ static inline void tcg_gen_bswap_i32(TCGv ret, TCGv arg)
|
||||
|
||||
tcg_gen_shri_i32(t1, arg, 24);
|
||||
tcg_gen_or_i32(ret, t0, t1);
|
||||
tcg_temp_free(t0);
|
||||
tcg_temp_free(t1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1121,6 +1207,8 @@ static inline void tcg_gen_bswap_i64(TCGv ret, TCGv arg)
|
||||
tcg_gen_bswap_i32(t1, TCGV_HIGH(arg));
|
||||
tcg_gen_mov_i32(ret, t1);
|
||||
tcg_gen_mov_i32(TCGV_HIGH(ret), t0);
|
||||
tcg_temp_free(t0);
|
||||
tcg_temp_free(t1);
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -1227,6 +1315,8 @@ static inline void tcg_gen_bswap_i64(TCGv ret, TCGv arg)
|
||||
|
||||
tcg_gen_shri_i64(t1, arg, 56);
|
||||
tcg_gen_or_i64(ret, t0, t1);
|
||||
tcg_temp_free(t0);
|
||||
tcg_temp_free(t1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1237,7 +1327,9 @@ static inline void tcg_gen_neg_i32(TCGv ret, TCGv arg)
|
||||
#ifdef TCG_TARGET_HAS_neg_i32
|
||||
tcg_gen_op2(INDEX_op_neg_i32, ret, arg);
|
||||
#else
|
||||
tcg_gen_sub_i32(ret, tcg_const_i32(0), arg);
|
||||
TCGv t0 = tcg_const_i32(0);
|
||||
tcg_gen_sub_i32(ret, t0, arg);
|
||||
tcg_temp_free(t0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1246,18 +1338,20 @@ static inline void tcg_gen_neg_i64(TCGv ret, TCGv arg)
|
||||
#ifdef TCG_TARGET_HAS_neg_i64
|
||||
tcg_gen_op2(INDEX_op_neg_i64, ret, arg);
|
||||
#else
|
||||
tcg_gen_sub_i64(ret, tcg_const_i64(0), arg);
|
||||
TCGv t0 = tcg_const_i64(0);
|
||||
tcg_gen_sub_i64(ret, t0, arg);
|
||||
tcg_temp_free(t0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void tcg_gen_not_i32(TCGv ret, TCGv arg)
|
||||
{
|
||||
tcg_gen_xor_i32(ret, arg, tcg_const_i32(-1));
|
||||
tcg_gen_xori_i32(ret, arg, -1);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_not_i64(TCGv ret, TCGv arg)
|
||||
{
|
||||
tcg_gen_xor_i64(ret, arg, tcg_const_i64(-1));
|
||||
tcg_gen_xori_i64(ret, arg, -1);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_discard_i32(TCGv arg)
|
||||
|
||||
@@ -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
|
||||
@@ -188,6 +189,9 @@ typedef struct TCGTemp {
|
||||
unsigned int fixed_reg:1;
|
||||
unsigned int mem_coherent:1;
|
||||
unsigned int mem_allocated:1;
|
||||
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;
|
||||
|
||||
@@ -208,6 +212,8 @@ struct TCGContext {
|
||||
TCGTemp *temps; /* globals first, temps after */
|
||||
int nb_globals;
|
||||
int nb_temps;
|
||||
int first_free_temp[TCG_TYPE_COUNT]; /* index of free temps, -1 if none */
|
||||
|
||||
/* constant indexes (end of temp array) */
|
||||
int const_start;
|
||||
int const_end;
|
||||
@@ -236,6 +242,7 @@ struct TCGContext {
|
||||
TCGHelperInfo *helpers;
|
||||
int nb_helpers;
|
||||
int allocated_helpers;
|
||||
int helpers_sorted;
|
||||
|
||||
#ifdef CONFIG_PROFILER
|
||||
/* profiling info */
|
||||
@@ -299,6 +306,7 @@ TCGv tcg_global_reg2_new_hack(TCGType type, int reg1, int reg2,
|
||||
TCGv tcg_global_mem_new(TCGType type, int reg, tcg_target_long offset,
|
||||
const char *name);
|
||||
TCGv tcg_temp_new(TCGType type);
|
||||
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, ...));
|
||||
@@ -381,9 +389,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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user