Commit 2ea815cac75a6ebd866e2b4ef6237f9db07216b1

Authored by blueswir1
1 parent f2bc7e7f

Free temps

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4591 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 313 additions and 109 deletions
target-sparc/translate.c
@@ -311,6 +311,7 @@ static inline void gen_cc_NZ_icc(TCGv dst) @@ -311,6 +311,7 @@ static inline void gen_cc_NZ_icc(TCGv dst)
311 tcg_gen_brcondi_tl(TCG_COND_GE, r_temp, 0, l2); 311 tcg_gen_brcondi_tl(TCG_COND_GE, r_temp, 0, l2);
312 tcg_gen_ori_i32(cpu_psr, cpu_psr, PSR_NEG); 312 tcg_gen_ori_i32(cpu_psr, cpu_psr, PSR_NEG);
313 gen_set_label(l2); 313 gen_set_label(l2);
  314 + tcg_temp_free(r_temp);
314 } 315 }
315 316
316 #ifdef TARGET_SPARC64 317 #ifdef TARGET_SPARC64
@@ -344,6 +345,7 @@ static inline void gen_cc_C_add_icc(TCGv dst, TCGv src1) @@ -344,6 +345,7 @@ static inline void gen_cc_C_add_icc(TCGv dst, TCGv src1)
344 tcg_gen_brcond_tl(TCG_COND_GEU, dst, src1, l1); 345 tcg_gen_brcond_tl(TCG_COND_GEU, dst, src1, l1);
345 tcg_gen_ori_i32(cpu_psr, cpu_psr, PSR_CARRY); 346 tcg_gen_ori_i32(cpu_psr, cpu_psr, PSR_CARRY);
346 gen_set_label(l1); 347 gen_set_label(l1);
  348 + tcg_temp_free(r_temp);
347 } 349 }
348 350
349 #ifdef TARGET_SPARC64 351 #ifdef TARGET_SPARC64
@@ -374,6 +376,7 @@ static inline void gen_cc_V_add_icc(TCGv dst, TCGv src1, TCGv src2) @@ -374,6 +376,7 @@ static inline void gen_cc_V_add_icc(TCGv dst, TCGv src1, TCGv src2)
374 tcg_gen_andi_tl(r_temp, r_temp, (1 << 31)); 376 tcg_gen_andi_tl(r_temp, r_temp, (1 << 31));
375 tcg_gen_shri_tl(r_temp, r_temp, 31 - PSR_OVF_SHIFT); 377 tcg_gen_shri_tl(r_temp, r_temp, 31 - PSR_OVF_SHIFT);
376 tcg_gen_trunc_tl_i32(cpu_tmp32, r_temp); 378 tcg_gen_trunc_tl_i32(cpu_tmp32, r_temp);
  379 + tcg_temp_free(r_temp);
377 tcg_gen_or_i32(cpu_psr, cpu_psr, cpu_tmp32); 380 tcg_gen_or_i32(cpu_psr, cpu_psr, cpu_tmp32);
378 } 381 }
379 382
@@ -390,13 +393,14 @@ static inline void gen_cc_V_add_xcc(TCGv dst, TCGv src1, TCGv src2) @@ -390,13 +393,14 @@ static inline void gen_cc_V_add_xcc(TCGv dst, TCGv src1, TCGv src2)
390 tcg_gen_andi_tl(r_temp, r_temp, (1ULL << 63)); 393 tcg_gen_andi_tl(r_temp, r_temp, (1ULL << 63));
391 tcg_gen_shri_tl(r_temp, r_temp, 63 - PSR_OVF_SHIFT); 394 tcg_gen_shri_tl(r_temp, r_temp, 63 - PSR_OVF_SHIFT);
392 tcg_gen_trunc_tl_i32(cpu_tmp32, r_temp); 395 tcg_gen_trunc_tl_i32(cpu_tmp32, r_temp);
  396 + tcg_temp_free(r_temp);
393 tcg_gen_or_i32(cpu_xcc, cpu_xcc, cpu_tmp32); 397 tcg_gen_or_i32(cpu_xcc, cpu_xcc, cpu_tmp32);
394 } 398 }
395 #endif 399 #endif
396 400
397 static inline void gen_add_tv(TCGv dst, TCGv src1, TCGv src2) 401 static inline void gen_add_tv(TCGv dst, TCGv src1, TCGv src2)
398 { 402 {
399 - TCGv r_temp; 403 + TCGv r_temp, r_const;
400 int l1; 404 int l1;
401 405
402 l1 = gen_new_label(); 406 l1 = gen_new_label();
@@ -408,8 +412,11 @@ static inline void gen_add_tv(TCGv dst, TCGv src1, TCGv src2) @@ -408,8 +412,11 @@ static inline void gen_add_tv(TCGv dst, TCGv src1, TCGv src2)
408 tcg_gen_and_tl(r_temp, r_temp, cpu_tmp0); 412 tcg_gen_and_tl(r_temp, r_temp, cpu_tmp0);
409 tcg_gen_andi_tl(r_temp, r_temp, (1 << 31)); 413 tcg_gen_andi_tl(r_temp, r_temp, (1 << 31));
410 tcg_gen_brcondi_tl(TCG_COND_EQ, r_temp, 0, l1); 414 tcg_gen_brcondi_tl(TCG_COND_EQ, r_temp, 0, l1);
411 - tcg_gen_helper_0_1(raise_exception, tcg_const_i32(TT_TOVF)); 415 + r_const = tcg_const_i32(TT_TOVF);
  416 + tcg_gen_helper_0_1(raise_exception, r_const);
  417 + tcg_temp_free(r_const);
412 gen_set_label(l1); 418 gen_set_label(l1);
  419 + tcg_temp_free(r_temp);
413 } 420 }
414 421
415 static inline void gen_cc_V_tag(TCGv src1, TCGv src2) 422 static inline void gen_cc_V_tag(TCGv src1, TCGv src2)
@@ -427,12 +434,15 @@ static inline void gen_cc_V_tag(TCGv src1, TCGv src2) @@ -427,12 +434,15 @@ static inline void gen_cc_V_tag(TCGv src1, TCGv src2)
427 static inline void gen_tag_tv(TCGv src1, TCGv src2) 434 static inline void gen_tag_tv(TCGv src1, TCGv src2)
428 { 435 {
429 int l1; 436 int l1;
  437 + TCGv r_const;
430 438
431 l1 = gen_new_label(); 439 l1 = gen_new_label();
432 tcg_gen_or_tl(cpu_tmp0, src1, src2); 440 tcg_gen_or_tl(cpu_tmp0, src1, src2);
433 tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0x3); 441 tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0x3);
434 tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_tmp0, 0, l1); 442 tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_tmp0, 0, l1);
435 - tcg_gen_helper_0_1(raise_exception, tcg_const_i32(TT_TOVF)); 443 + r_const = tcg_const_i32(TT_TOVF);
  444 + tcg_gen_helper_0_1(raise_exception, r_const);
  445 + tcg_temp_free(r_const);
436 gen_set_label(l1); 446 gen_set_label(l1);
437 } 447 }
438 448
@@ -533,6 +543,8 @@ static inline void gen_cc_C_sub_icc(TCGv src1, TCGv src2) @@ -533,6 +543,8 @@ static inline void gen_cc_C_sub_icc(TCGv src1, TCGv src2)
533 tcg_gen_brcond_tl(TCG_COND_GEU, r_temp1, r_temp2, l1); 543 tcg_gen_brcond_tl(TCG_COND_GEU, r_temp1, r_temp2, l1);
534 tcg_gen_ori_i32(cpu_psr, cpu_psr, PSR_CARRY); 544 tcg_gen_ori_i32(cpu_psr, cpu_psr, PSR_CARRY);
535 gen_set_label(l1); 545 gen_set_label(l1);
  546 + tcg_temp_free(r_temp1);
  547 + tcg_temp_free(r_temp2);
536 } 548 }
537 549
538 #ifdef TARGET_SPARC64 550 #ifdef TARGET_SPARC64
@@ -563,6 +575,7 @@ static inline void gen_cc_V_sub_icc(TCGv dst, TCGv src1, TCGv src2) @@ -563,6 +575,7 @@ static inline void gen_cc_V_sub_icc(TCGv dst, TCGv src1, TCGv src2)
563 tcg_gen_shri_tl(r_temp, r_temp, 31 - PSR_OVF_SHIFT); 575 tcg_gen_shri_tl(r_temp, r_temp, 31 - PSR_OVF_SHIFT);
564 tcg_gen_trunc_tl_i32(cpu_tmp32, r_temp); 576 tcg_gen_trunc_tl_i32(cpu_tmp32, r_temp);
565 tcg_gen_or_i32(cpu_psr, cpu_psr, cpu_tmp32); 577 tcg_gen_or_i32(cpu_psr, cpu_psr, cpu_tmp32);
  578 + tcg_temp_free(r_temp);
566 } 579 }
567 580
568 #ifdef TARGET_SPARC64 581 #ifdef TARGET_SPARC64
@@ -578,12 +591,13 @@ static inline void gen_cc_V_sub_xcc(TCGv dst, TCGv src1, TCGv src2) @@ -578,12 +591,13 @@ static inline void gen_cc_V_sub_xcc(TCGv dst, TCGv src1, TCGv src2)
578 tcg_gen_shri_tl(r_temp, r_temp, 63 - PSR_OVF_SHIFT); 591 tcg_gen_shri_tl(r_temp, r_temp, 63 - PSR_OVF_SHIFT);
579 tcg_gen_trunc_tl_i32(cpu_tmp32, r_temp); 592 tcg_gen_trunc_tl_i32(cpu_tmp32, r_temp);
580 tcg_gen_or_i32(cpu_xcc, cpu_xcc, cpu_tmp32); 593 tcg_gen_or_i32(cpu_xcc, cpu_xcc, cpu_tmp32);
  594 + tcg_temp_free(r_temp);
581 } 595 }
582 #endif 596 #endif
583 597
584 static inline void gen_sub_tv(TCGv dst, TCGv src1, TCGv src2) 598 static inline void gen_sub_tv(TCGv dst, TCGv src1, TCGv src2)
585 { 599 {
586 - TCGv r_temp; 600 + TCGv r_temp, r_const;
587 int l1; 601 int l1;
588 602
589 l1 = gen_new_label(); 603 l1 = gen_new_label();
@@ -594,8 +608,11 @@ static inline void gen_sub_tv(TCGv dst, TCGv src1, TCGv src2) @@ -594,8 +608,11 @@ static inline void gen_sub_tv(TCGv dst, TCGv src1, TCGv src2)
594 tcg_gen_and_tl(r_temp, r_temp, cpu_tmp0); 608 tcg_gen_and_tl(r_temp, r_temp, cpu_tmp0);
595 tcg_gen_andi_tl(r_temp, r_temp, (1 << 31)); 609 tcg_gen_andi_tl(r_temp, r_temp, (1 << 31));
596 tcg_gen_brcondi_tl(TCG_COND_EQ, r_temp, 0, l1); 610 tcg_gen_brcondi_tl(TCG_COND_EQ, r_temp, 0, l1);
597 - tcg_gen_helper_0_1(raise_exception, tcg_const_i32(TT_TOVF)); 611 + r_const = tcg_const_i32(TT_TOVF);
  612 + tcg_gen_helper_0_1(raise_exception, r_const);
  613 + tcg_temp_free(r_const);
598 gen_set_label(l1); 614 gen_set_label(l1);
  615 + tcg_temp_free(r_temp);
599 } 616 }
600 617
601 static inline void gen_op_sub_cc(TCGv dst, TCGv src1, TCGv src2) 618 static inline void gen_op_sub_cc(TCGv dst, TCGv src1, TCGv src2)
@@ -708,12 +725,14 @@ static inline void gen_op_mulscc(TCGv dst, TCGv src1, TCGv src2) @@ -708,12 +725,14 @@ static inline void gen_op_mulscc(TCGv dst, TCGv src1, TCGv src2)
708 tcg_gen_ld_i32(cpu_tmp32, cpu_env, offsetof(CPUSPARCState, y)); 725 tcg_gen_ld_i32(cpu_tmp32, cpu_env, offsetof(CPUSPARCState, y));
709 tcg_gen_shri_i32(cpu_tmp32, cpu_tmp32, 1); 726 tcg_gen_shri_i32(cpu_tmp32, cpu_tmp32, 1);
710 tcg_gen_or_i32(cpu_tmp32, cpu_tmp32, r_temp2); 727 tcg_gen_or_i32(cpu_tmp32, cpu_tmp32, r_temp2);
  728 + tcg_temp_free(r_temp2);
711 tcg_gen_st_i32(cpu_tmp32, cpu_env, offsetof(CPUSPARCState, y)); 729 tcg_gen_st_i32(cpu_tmp32, cpu_env, offsetof(CPUSPARCState, y));
712 730
713 // b1 = N ^ V; 731 // b1 = N ^ V;
714 gen_mov_reg_N(cpu_tmp0, cpu_psr); 732 gen_mov_reg_N(cpu_tmp0, cpu_psr);
715 gen_mov_reg_V(r_temp, cpu_psr); 733 gen_mov_reg_V(r_temp, cpu_psr);
716 tcg_gen_xor_tl(cpu_tmp0, cpu_tmp0, r_temp); 734 tcg_gen_xor_tl(cpu_tmp0, cpu_tmp0, r_temp);
  735 + tcg_temp_free(r_temp);
717 736
718 // T0 = (b1 << 31) | (T0 >> 1); 737 // T0 = (b1 << 31) | (T0 >> 1);
719 // src1 = T0; 738 // src1 = T0;
@@ -745,11 +764,13 @@ static inline void gen_op_umul(TCGv dst, TCGv src1, TCGv src2) @@ -745,11 +764,13 @@ static inline void gen_op_umul(TCGv dst, TCGv src1, TCGv src2)
745 tcg_gen_shri_i64(r_temp, r_temp2, 32); 764 tcg_gen_shri_i64(r_temp, r_temp2, 32);
746 tcg_gen_trunc_i64_i32(r_temp, r_temp); 765 tcg_gen_trunc_i64_i32(r_temp, r_temp);
747 tcg_gen_st_i32(r_temp, cpu_env, offsetof(CPUSPARCState, y)); 766 tcg_gen_st_i32(r_temp, cpu_env, offsetof(CPUSPARCState, y));
  767 + tcg_temp_free(r_temp);
748 #ifdef TARGET_SPARC64 768 #ifdef TARGET_SPARC64
749 tcg_gen_mov_i64(dst, r_temp2); 769 tcg_gen_mov_i64(dst, r_temp2);
750 #else 770 #else
751 tcg_gen_trunc_i64_tl(dst, r_temp2); 771 tcg_gen_trunc_i64_tl(dst, r_temp2);
752 #endif 772 #endif
  773 + tcg_temp_free(r_temp2);
753 } 774 }
754 775
755 static inline void gen_op_smul(TCGv dst, TCGv src1, TCGv src2) 776 static inline void gen_op_smul(TCGv dst, TCGv src1, TCGv src2)
@@ -766,21 +787,26 @@ static inline void gen_op_smul(TCGv dst, TCGv src1, TCGv src2) @@ -766,21 +787,26 @@ static inline void gen_op_smul(TCGv dst, TCGv src1, TCGv src2)
766 tcg_gen_shri_i64(r_temp, r_temp2, 32); 787 tcg_gen_shri_i64(r_temp, r_temp2, 32);
767 tcg_gen_trunc_i64_i32(r_temp, r_temp); 788 tcg_gen_trunc_i64_i32(r_temp, r_temp);
768 tcg_gen_st_i32(r_temp, cpu_env, offsetof(CPUSPARCState, y)); 789 tcg_gen_st_i32(r_temp, cpu_env, offsetof(CPUSPARCState, y));
  790 + tcg_temp_free(r_temp);
769 #ifdef TARGET_SPARC64 791 #ifdef TARGET_SPARC64
770 tcg_gen_mov_i64(dst, r_temp2); 792 tcg_gen_mov_i64(dst, r_temp2);
771 #else 793 #else
772 tcg_gen_trunc_i64_tl(dst, r_temp2); 794 tcg_gen_trunc_i64_tl(dst, r_temp2);
773 #endif 795 #endif
  796 + tcg_temp_free(r_temp2);
774 } 797 }
775 798
776 #ifdef TARGET_SPARC64 799 #ifdef TARGET_SPARC64
777 static inline void gen_trap_ifdivzero_tl(TCGv divisor) 800 static inline void gen_trap_ifdivzero_tl(TCGv divisor)
778 { 801 {
  802 + TCGv r_const;
779 int l1; 803 int l1;
780 804
781 l1 = gen_new_label(); 805 l1 = gen_new_label();
782 tcg_gen_brcondi_tl(TCG_COND_NE, divisor, 0, l1); 806 tcg_gen_brcondi_tl(TCG_COND_NE, divisor, 0, l1);
783 - tcg_gen_helper_0_1(raise_exception, tcg_const_i32(TT_DIV_ZERO)); 807 + r_const = tcg_const_i32(TT_DIV_ZERO);
  808 + tcg_gen_helper_0_1(raise_exception, r_const);
  809 + tcg_temp_free(r_const);
784 gen_set_label(l1); 810 gen_set_label(l1);
785 } 811 }
786 812
@@ -1563,17 +1589,25 @@ static inline void gen_op_fcmpeq(int fccno) @@ -1563,17 +1589,25 @@ static inline void gen_op_fcmpeq(int fccno)
1563 1589
1564 static inline void gen_op_fpexception_im(int fsr_flags) 1590 static inline void gen_op_fpexception_im(int fsr_flags)
1565 { 1591 {
  1592 + TCGv r_const;
  1593 +
1566 tcg_gen_andi_tl(cpu_fsr, cpu_fsr, ~FSR_FTT_MASK); 1594 tcg_gen_andi_tl(cpu_fsr, cpu_fsr, ~FSR_FTT_MASK);
1567 tcg_gen_ori_tl(cpu_fsr, cpu_fsr, fsr_flags); 1595 tcg_gen_ori_tl(cpu_fsr, cpu_fsr, fsr_flags);
1568 - tcg_gen_helper_0_1(raise_exception, tcg_const_i32(TT_FP_EXCP)); 1596 + r_const = tcg_const_i32(TT_FP_EXCP);
  1597 + tcg_gen_helper_0_1(raise_exception, r_const);
  1598 + tcg_temp_free(r_const);
1569 } 1599 }
1570 1600
1571 static int gen_trap_ifnofpu(DisasContext *dc, TCGv r_cond) 1601 static int gen_trap_ifnofpu(DisasContext *dc, TCGv r_cond)
1572 { 1602 {
1573 #if !defined(CONFIG_USER_ONLY) 1603 #if !defined(CONFIG_USER_ONLY)
1574 if (!dc->fpu_enabled) { 1604 if (!dc->fpu_enabled) {
  1605 + TCGv r_const;
  1606 +
1575 save_state(dc, r_cond); 1607 save_state(dc, r_cond);
1576 - tcg_gen_helper_0_1(raise_exception, tcg_const_i32(TT_NFPU_INSN)); 1608 + r_const = tcg_const_i32(TT_NFPU_INSN);
  1609 + tcg_gen_helper_0_1(raise_exception, r_const);
  1610 + tcg_temp_free(r_const);
1577 dc->is_br = 1; 1611 dc->is_br = 1;
1578 return 1; 1612 return 1;
1579 } 1613 }
@@ -1613,58 +1647,80 @@ static inline TCGv gen_get_asi(int insn, TCGv r_addr) @@ -1613,58 +1647,80 @@ static inline TCGv gen_get_asi(int insn, TCGv r_addr)
1613 static inline void gen_ld_asi(TCGv dst, TCGv addr, int insn, int size, 1647 static inline void gen_ld_asi(TCGv dst, TCGv addr, int insn, int size,
1614 int sign) 1648 int sign)
1615 { 1649 {
1616 - TCGv r_asi; 1650 + TCGv r_asi, r_size, r_sign;
1617 1651
1618 r_asi = gen_get_asi(insn, addr); 1652 r_asi = gen_get_asi(insn, addr);
1619 - tcg_gen_helper_1_4(helper_ld_asi, dst, addr, r_asi,  
1620 - tcg_const_i32(size), tcg_const_i32(sign)); 1653 + r_size = tcg_const_i32(size);
  1654 + r_sign = tcg_const_i32(sign);
  1655 + tcg_gen_helper_1_4(helper_ld_asi, dst, addr, r_asi, r_size, r_sign);
  1656 + tcg_temp_free(r_sign);
  1657 + tcg_temp_free(r_size);
  1658 + tcg_temp_free(r_asi);
1621 } 1659 }
1622 1660
1623 static inline void gen_st_asi(TCGv src, TCGv addr, int insn, int size) 1661 static inline void gen_st_asi(TCGv src, TCGv addr, int insn, int size)
1624 { 1662 {
1625 - TCGv r_asi; 1663 + TCGv r_asi, r_size;
1626 1664
1627 r_asi = gen_get_asi(insn, addr); 1665 r_asi = gen_get_asi(insn, addr);
1628 - tcg_gen_helper_0_4(helper_st_asi, addr, src, r_asi, tcg_const_i32(size)); 1666 + r_size = tcg_const_i32(size);
  1667 + tcg_gen_helper_0_4(helper_st_asi, addr, src, r_asi, r_size);
  1668 + tcg_temp_free(r_size);
  1669 + tcg_temp_free(r_asi);
1629 } 1670 }
1630 1671
1631 static inline void gen_ldf_asi(TCGv addr, int insn, int size, int rd) 1672 static inline void gen_ldf_asi(TCGv addr, int insn, int size, int rd)
1632 { 1673 {
1633 - TCGv r_asi; 1674 + TCGv r_asi, r_size, r_rd;
1634 1675
1635 r_asi = gen_get_asi(insn, addr); 1676 r_asi = gen_get_asi(insn, addr);
1636 - tcg_gen_helper_0_4(helper_ldf_asi, addr, r_asi, tcg_const_i32(size),  
1637 - tcg_const_i32(rd)); 1677 + r_size = tcg_const_i32(size);
  1678 + r_rd = tcg_const_i32(rd);
  1679 + tcg_gen_helper_0_4(helper_ldf_asi, addr, r_asi, r_size, r_rd);
  1680 + tcg_temp_free(r_rd);
  1681 + tcg_temp_free(r_size);
  1682 + tcg_temp_free(r_asi);
1638 } 1683 }
1639 1684
1640 static inline void gen_stf_asi(TCGv addr, int insn, int size, int rd) 1685 static inline void gen_stf_asi(TCGv addr, int insn, int size, int rd)
1641 { 1686 {
1642 - TCGv r_asi; 1687 + TCGv r_asi, r_size, r_rd;
1643 1688
1644 r_asi = gen_get_asi(insn, addr); 1689 r_asi = gen_get_asi(insn, addr);
1645 - tcg_gen_helper_0_4(helper_stf_asi, addr, r_asi, tcg_const_i32(size),  
1646 - tcg_const_i32(rd)); 1690 + r_size = tcg_const_i32(size);
  1691 + r_rd = tcg_const_i32(rd);
  1692 + tcg_gen_helper_0_4(helper_stf_asi, addr, r_asi, r_size, r_rd);
  1693 + tcg_temp_free(r_rd);
  1694 + tcg_temp_free(r_size);
  1695 + tcg_temp_free(r_asi);
1647 } 1696 }
1648 1697
1649 static inline void gen_swap_asi(TCGv dst, TCGv addr, int insn) 1698 static inline void gen_swap_asi(TCGv dst, TCGv addr, int insn)
1650 { 1699 {
1651 - TCGv r_asi; 1700 + TCGv r_asi, r_size, r_sign;
1652 1701
1653 r_asi = gen_get_asi(insn, addr); 1702 r_asi = gen_get_asi(insn, addr);
1654 - tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, r_asi,  
1655 - tcg_const_i32(4), tcg_const_i32(0));  
1656 - tcg_gen_helper_0_4(helper_st_asi, addr, dst, r_asi,  
1657 - tcg_const_i32(4)); 1703 + r_size = tcg_const_i32(4);
  1704 + r_sign = tcg_const_i32(0);
  1705 + tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, r_asi, r_size, r_sign);
  1706 + tcg_temp_free(r_sign);
  1707 + tcg_gen_helper_0_4(helper_st_asi, addr, dst, r_asi, r_size);
  1708 + tcg_temp_free(r_size);
  1709 + tcg_temp_free(r_asi);
1658 tcg_gen_trunc_i64_tl(dst, cpu_tmp64); 1710 tcg_gen_trunc_i64_tl(dst, cpu_tmp64);
1659 } 1711 }
1660 1712
1661 static inline void gen_ldda_asi(TCGv lo, TCGv hi, TCGv addr, int insn) 1713 static inline void gen_ldda_asi(TCGv lo, TCGv hi, TCGv addr, int insn)
1662 { 1714 {
1663 - TCGv r_asi; 1715 + TCGv r_asi, r_size, r_sign;
1664 1716
1665 r_asi = gen_get_asi(insn, addr); 1717 r_asi = gen_get_asi(insn, addr);
1666 - tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, r_asi,  
1667 - tcg_const_i32(8), tcg_const_i32(0)); 1718 + r_size = tcg_const_i32(8);
  1719 + r_sign = tcg_const_i32(0);
  1720 + tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, r_asi, r_size, r_sign);
  1721 + tcg_temp_free(r_sign);
  1722 + tcg_temp_free(r_size);
  1723 + tcg_temp_free(r_asi);
1668 tcg_gen_andi_i64(lo, cpu_tmp64, 0xffffffffULL); 1724 tcg_gen_andi_i64(lo, cpu_tmp64, 0xffffffffULL);
1669 tcg_gen_shri_i64(cpu_tmp64, cpu_tmp64, 32); 1725 tcg_gen_shri_i64(cpu_tmp64, cpu_tmp64, 32);
1670 tcg_gen_andi_i64(hi, cpu_tmp64, 0xffffffffULL); 1726 tcg_gen_andi_i64(hi, cpu_tmp64, 0xffffffffULL);
@@ -1672,15 +1728,18 @@ static inline void gen_ldda_asi(TCGv lo, TCGv hi, TCGv addr, int insn) @@ -1672,15 +1728,18 @@ static inline void gen_ldda_asi(TCGv lo, TCGv hi, TCGv addr, int insn)
1672 1728
1673 static inline void gen_stda_asi(TCGv hi, TCGv addr, int insn, int rd) 1729 static inline void gen_stda_asi(TCGv hi, TCGv addr, int insn, int rd)
1674 { 1730 {
1675 - TCGv r_temp, r_asi; 1731 + TCGv r_temp, r_asi, r_size;
1676 1732
1677 r_temp = tcg_temp_new(TCG_TYPE_TL); 1733 r_temp = tcg_temp_new(TCG_TYPE_TL);
1678 gen_movl_reg_TN(rd + 1, r_temp); 1734 gen_movl_reg_TN(rd + 1, r_temp);
1679 tcg_gen_helper_1_2(helper_pack64, cpu_tmp64, hi, 1735 tcg_gen_helper_1_2(helper_pack64, cpu_tmp64, hi,
1680 r_temp); 1736 r_temp);
  1737 + tcg_temp_free(r_temp);
1681 r_asi = gen_get_asi(insn, addr); 1738 r_asi = gen_get_asi(insn, addr);
1682 - tcg_gen_helper_0_4(helper_st_asi, addr, cpu_tmp64, r_asi,  
1683 - tcg_const_i32(8)); 1739 + r_size = tcg_const_i32(8);
  1740 + tcg_gen_helper_0_4(helper_st_asi, addr, cpu_tmp64, r_asi, r_size);
  1741 + tcg_temp_free(r_size);
  1742 + tcg_temp_free(r_asi);
1684 } 1743 }
1685 1744
1686 static inline void gen_cas_asi(TCGv dst, TCGv addr, TCGv val2, int insn, 1745 static inline void gen_cas_asi(TCGv dst, TCGv addr, TCGv val2, int insn,
@@ -1692,6 +1751,8 @@ static inline void gen_cas_asi(TCGv dst, TCGv addr, TCGv val2, int insn, @@ -1692,6 +1751,8 @@ static inline void gen_cas_asi(TCGv dst, TCGv addr, TCGv val2, int insn,
1692 gen_movl_reg_TN(rd, r_val1); 1751 gen_movl_reg_TN(rd, r_val1);
1693 r_asi = gen_get_asi(insn, addr); 1752 r_asi = gen_get_asi(insn, addr);
1694 tcg_gen_helper_1_4(helper_cas_asi, dst, addr, r_val1, val2, r_asi); 1753 tcg_gen_helper_1_4(helper_cas_asi, dst, addr, r_val1, val2, r_asi);
  1754 + tcg_temp_free(r_asi);
  1755 + tcg_temp_free(r_val1);
1695 } 1756 }
1696 1757
1697 static inline void gen_casx_asi(TCGv dst, TCGv addr, TCGv val2, int insn, 1758 static inline void gen_casx_asi(TCGv dst, TCGv addr, TCGv val2, int insn,
@@ -1702,6 +1763,7 @@ static inline void gen_casx_asi(TCGv dst, TCGv addr, TCGv val2, int insn, @@ -1702,6 +1763,7 @@ static inline void gen_casx_asi(TCGv dst, TCGv addr, TCGv val2, int insn,
1702 gen_movl_reg_TN(rd, cpu_tmp64); 1763 gen_movl_reg_TN(rd, cpu_tmp64);
1703 r_asi = gen_get_asi(insn, addr); 1764 r_asi = gen_get_asi(insn, addr);
1704 tcg_gen_helper_1_4(helper_casx_asi, dst, addr, cpu_tmp64, val2, r_asi); 1765 tcg_gen_helper_1_4(helper_casx_asi, dst, addr, cpu_tmp64, val2, r_asi);
  1766 + tcg_temp_free(r_asi);
1705 } 1767 }
1706 1768
1707 #elif !defined(CONFIG_USER_ONLY) 1769 #elif !defined(CONFIG_USER_ONLY)
@@ -1709,43 +1771,56 @@ static inline void gen_casx_asi(TCGv dst, TCGv addr, TCGv val2, int insn, @@ -1709,43 +1771,56 @@ static inline void gen_casx_asi(TCGv dst, TCGv addr, TCGv val2, int insn,
1709 static inline void gen_ld_asi(TCGv dst, TCGv addr, int insn, int size, 1771 static inline void gen_ld_asi(TCGv dst, TCGv addr, int insn, int size,
1710 int sign) 1772 int sign)
1711 { 1773 {
1712 - int asi; 1774 + TCGv r_asi, r_size, r_sign;
1713 1775
1714 - asi = GET_FIELD(insn, 19, 26);  
1715 - tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, tcg_const_i32(asi),  
1716 - tcg_const_i32(size), tcg_const_i32(sign)); 1776 + r_asi = tcg_const_i32(GET_FIELD(insn, 19, 26));
  1777 + r_size = tcg_const_i32(size);
  1778 + r_sign = tcg_const_i32(sign);
  1779 + tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, r_asi, r_size, r_sign);
  1780 + tcg_temp_free(r_sign);
  1781 + tcg_temp_free(r_size);
  1782 + tcg_temp_free(r_asi);
1717 tcg_gen_trunc_i64_tl(dst, cpu_tmp64); 1783 tcg_gen_trunc_i64_tl(dst, cpu_tmp64);
1718 } 1784 }
1719 1785
1720 static inline void gen_st_asi(TCGv src, TCGv addr, int insn, int size) 1786 static inline void gen_st_asi(TCGv src, TCGv addr, int insn, int size)
1721 { 1787 {
1722 - int asi; 1788 + TCGv r_asi, r_size;
1723 1789
1724 tcg_gen_extu_tl_i64(cpu_tmp64, src); 1790 tcg_gen_extu_tl_i64(cpu_tmp64, src);
1725 - asi = GET_FIELD(insn, 19, 26);  
1726 - tcg_gen_helper_0_4(helper_st_asi, addr, cpu_tmp64, tcg_const_i32(asi),  
1727 - tcg_const_i32(size)); 1791 + r_asi = tcg_const_i32(GET_FIELD(insn, 19, 26));
  1792 + r_size = tcg_const_i32(size);
  1793 + tcg_gen_helper_0_4(helper_st_asi, addr, cpu_tmp64, r_asi, r_size);
  1794 + tcg_temp_free(r_size);
  1795 + tcg_temp_free(r_asi);
1728 } 1796 }
1729 1797
1730 static inline void gen_swap_asi(TCGv dst, TCGv addr, int insn) 1798 static inline void gen_swap_asi(TCGv dst, TCGv addr, int insn)
1731 { 1799 {
1732 - int asi; 1800 + TCGv r_asi, r_size, r_sign;
1733 1801
1734 - asi = GET_FIELD(insn, 19, 26);  
1735 - tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, tcg_const_i32(asi),  
1736 - tcg_const_i32(4), tcg_const_i32(0));  
1737 - tcg_gen_helper_0_4(helper_st_asi, addr, dst, tcg_const_i32(asi),  
1738 - tcg_const_i32(4)); 1802 + r_asi = tcg_const_i32(GET_FIELD(insn, 19, 26));
  1803 + r_size = tcg_const_i32(4);
  1804 + r_sign = tcg_const_i32(0);
  1805 + tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, r_asi, r_size, r_sign);
  1806 + tcg_temp_free(r_sign);
  1807 + tcg_gen_helper_0_4(helper_st_asi, addr, dst, r_asi, r_size);
  1808 + tcg_temp_free(r_size);
  1809 + tcg_temp_free(r_asi);
1739 tcg_gen_trunc_i64_tl(dst, cpu_tmp64); 1810 tcg_gen_trunc_i64_tl(dst, cpu_tmp64);
1740 } 1811 }
1741 1812
1742 static inline void gen_ldda_asi(TCGv lo, TCGv hi, TCGv addr, int insn) 1813 static inline void gen_ldda_asi(TCGv lo, TCGv hi, TCGv addr, int insn)
1743 { 1814 {
1744 - int asi; 1815 + TCGv r_asi, r_size, r_sign;
1745 1816
1746 - asi = GET_FIELD(insn, 19, 26);  
1747 - tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, tcg_const_i32(asi),  
1748 - tcg_const_i32(8), tcg_const_i32(0)); 1817 + r_asi = tcg_const_i32(GET_FIELD(insn, 19, 26));
  1818 + r_size = tcg_const_i32(8);
  1819 + r_sign = tcg_const_i32(0);
  1820 + tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, r_asi, r_size, r_sign);
  1821 + tcg_temp_free(r_sign);
  1822 + tcg_temp_free(r_size);
  1823 + tcg_temp_free(r_asi);
1749 tcg_gen_trunc_i64_tl(lo, cpu_tmp64); 1824 tcg_gen_trunc_i64_tl(lo, cpu_tmp64);
1750 tcg_gen_shri_i64(cpu_tmp64, cpu_tmp64, 32); 1825 tcg_gen_shri_i64(cpu_tmp64, cpu_tmp64, 32);
1751 tcg_gen_trunc_i64_tl(hi, cpu_tmp64); 1826 tcg_gen_trunc_i64_tl(hi, cpu_tmp64);
@@ -1753,28 +1828,34 @@ static inline void gen_ldda_asi(TCGv lo, TCGv hi, TCGv addr, int insn) @@ -1753,28 +1828,34 @@ static inline void gen_ldda_asi(TCGv lo, TCGv hi, TCGv addr, int insn)
1753 1828
1754 static inline void gen_stda_asi(TCGv hi, TCGv addr, int insn, int rd) 1829 static inline void gen_stda_asi(TCGv hi, TCGv addr, int insn, int rd)
1755 { 1830 {
1756 - int asi;  
1757 - TCGv r_temp; 1831 + TCGv r_temp, r_asi, r_size;
1758 1832
1759 r_temp = tcg_temp_new(TCG_TYPE_TL); 1833 r_temp = tcg_temp_new(TCG_TYPE_TL);
1760 gen_movl_reg_TN(rd + 1, r_temp); 1834 gen_movl_reg_TN(rd + 1, r_temp);
1761 tcg_gen_helper_1_2(helper_pack64, cpu_tmp64, hi, r_temp); 1835 tcg_gen_helper_1_2(helper_pack64, cpu_tmp64, hi, r_temp);
1762 - asi = GET_FIELD(insn, 19, 26);  
1763 - tcg_gen_helper_0_4(helper_st_asi, addr, cpu_tmp64, tcg_const_i32(asi),  
1764 - tcg_const_i32(8)); 1836 + tcg_temp_free(r_temp);
  1837 + r_asi = tcg_const_i32(GET_FIELD(insn, 19, 26));
  1838 + r_size = tcg_const_i32(8);
  1839 + tcg_gen_helper_0_4(helper_st_asi, addr, cpu_tmp64, r_asi, r_size);
  1840 + tcg_temp_free(r_size);
  1841 + tcg_temp_free(r_asi);
1765 } 1842 }
1766 #endif 1843 #endif
1767 1844
1768 #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) 1845 #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64)
1769 static inline void gen_ldstub_asi(TCGv dst, TCGv addr, int insn) 1846 static inline void gen_ldstub_asi(TCGv dst, TCGv addr, int insn)
1770 { 1847 {
1771 - int asi; 1848 + TCGv r_val, r_asi, r_size;
1772 1849
1773 gen_ld_asi(dst, addr, insn, 1, 0); 1850 gen_ld_asi(dst, addr, insn, 1, 0);
1774 1851
1775 - asi = GET_FIELD(insn, 19, 26);  
1776 - tcg_gen_helper_0_4(helper_st_asi, addr, tcg_const_i64(0xffULL),  
1777 - tcg_const_i32(asi), tcg_const_i32(1)); 1852 + r_val = tcg_const_i64(0xffULL);
  1853 + r_asi = tcg_const_i32(GET_FIELD(insn, 19, 26));
  1854 + r_size = tcg_const_i32(1);
  1855 + tcg_gen_helper_0_4(helper_st_asi, addr, r_val, r_asi, r_size);
  1856 + tcg_temp_free(r_size);
  1857 + tcg_temp_free(r_asi);
  1858 + tcg_temp_free(r_val);
1778 } 1859 }
1779 #endif 1860 #endif
1780 1861
@@ -1802,11 +1883,11 @@ static inline TCGv get_src2(unsigned int insn, TCGv def) @@ -1802,11 +1883,11 @@ static inline TCGv get_src2(unsigned int insn, TCGv def)
1802 1883
1803 if (IS_IMM) { /* immediate */ 1884 if (IS_IMM) { /* immediate */
1804 rs2 = GET_FIELDs(insn, 19, 31); 1885 rs2 = GET_FIELDs(insn, 19, 31);
1805 - r_rs2 = tcg_const_tl((int)rs2); 1886 + r_rs2 = tcg_const_tl((int)rs2); // XXX how to free?
1806 } else { /* register */ 1887 } else { /* register */
1807 rs2 = GET_FIELD(insn, 27, 31); 1888 rs2 = GET_FIELD(insn, 27, 31);
1808 if (rs2 == 0) 1889 if (rs2 == 0)
1809 - r_rs2 = tcg_const_tl(0); 1890 + r_rs2 = tcg_const_tl(0); // XXX how to free?
1810 else if (rs2 < 8) 1891 else if (rs2 < 8)
1811 r_rs2 = cpu_gregs[rs2]; 1892 r_rs2 = cpu_gregs[rs2];
1812 else 1893 else
@@ -1913,7 +1994,11 @@ static void disas_sparc_insn(DisasContext * dc) @@ -1913,7 +1994,11 @@ static void disas_sparc_insn(DisasContext * dc)
1913 case 0x4: /* SETHI */ 1994 case 0x4: /* SETHI */
1914 if (rd) { // nop 1995 if (rd) { // nop
1915 uint32_t value = GET_FIELD(insn, 10, 31); 1996 uint32_t value = GET_FIELD(insn, 10, 31);
1916 - gen_movl_TN_reg(rd, tcg_const_tl(value << 10)); 1997 + TCGv r_const;
  1998 +
  1999 + r_const = tcg_const_tl(value << 10);
  2000 + gen_movl_TN_reg(rd, r_const);
  2001 + tcg_temp_free(r_const);
1917 } 2002 }
1918 break; 2003 break;
1919 case 0x0: /* UNIMPL */ 2004 case 0x0: /* UNIMPL */
@@ -1926,8 +2011,11 @@ static void disas_sparc_insn(DisasContext * dc) @@ -1926,8 +2011,11 @@ static void disas_sparc_insn(DisasContext * dc)
1926 case 1: 2011 case 1:
1927 /*CALL*/ { 2012 /*CALL*/ {
1928 target_long target = GET_FIELDs(insn, 2, 31) << 2; 2013 target_long target = GET_FIELDs(insn, 2, 31) << 2;
  2014 + TCGv r_const;
1929 2015
1930 - gen_movl_TN_reg(15, tcg_const_tl(dc->pc)); 2016 + r_const = tcg_const_tl(dc->pc);
  2017 + gen_movl_TN_reg(15, r_const);
  2018 + tcg_temp_free(r_const);
1931 target += dc->pc; 2019 target += dc->pc;
1932 gen_mov_pc_npc(dc, cpu_cond); 2020 gen_mov_pc_npc(dc, cpu_cond);
1933 dc->npc = target; 2021 dc->npc = target;
@@ -1973,6 +2061,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -1973,6 +2061,7 @@ static void disas_sparc_insn(DisasContext * dc)
1973 gen_cond(r_cond, 0, cond); 2061 gen_cond(r_cond, 0, cond);
1974 #endif 2062 #endif
1975 tcg_gen_helper_0_2(helper_trapcc, cpu_dst, r_cond); 2063 tcg_gen_helper_0_2(helper_trapcc, cpu_dst, r_cond);
  2064 + tcg_temp_free(r_cond);
1976 } 2065 }
1977 gen_op_next_insn(); 2066 gen_op_next_insn();
1978 tcg_gen_exit_tb(0); 2067 tcg_gen_exit_tb(0);
@@ -2016,11 +2105,18 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2016,11 +2105,18 @@ static void disas_sparc_insn(DisasContext * dc)
2016 offsetof(CPUState, tick)); 2105 offsetof(CPUState, tick));
2017 tcg_gen_helper_1_1(helper_tick_get_count, cpu_dst, 2106 tcg_gen_helper_1_1(helper_tick_get_count, cpu_dst,
2018 r_tickptr); 2107 r_tickptr);
  2108 + tcg_temp_free(r_tickptr);
2019 gen_movl_TN_reg(rd, cpu_dst); 2109 gen_movl_TN_reg(rd, cpu_dst);
2020 } 2110 }
2021 break; 2111 break;
2022 case 0x5: /* V9 rdpc */ 2112 case 0x5: /* V9 rdpc */
2023 - gen_movl_TN_reg(rd, tcg_const_tl(dc->pc)); 2113 + {
  2114 + TCGv r_const;
  2115 +
  2116 + r_const = tcg_const_tl(dc->pc);
  2117 + gen_movl_TN_reg(rd, r_const);
  2118 + tcg_temp_free(r_const);
  2119 + }
2024 break; 2120 break;
2025 case 0x6: /* V9 rdfprs */ 2121 case 0x6: /* V9 rdfprs */
2026 tcg_gen_ld_i32(cpu_tmp32, cpu_env, 2122 tcg_gen_ld_i32(cpu_tmp32, cpu_env,
@@ -2051,6 +2147,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2051,6 +2147,7 @@ static void disas_sparc_insn(DisasContext * dc)
2051 offsetof(CPUState, stick)); 2147 offsetof(CPUState, stick));
2052 tcg_gen_helper_1_1(helper_tick_get_count, cpu_dst, 2148 tcg_gen_helper_1_1(helper_tick_get_count, cpu_dst,
2053 r_tickptr); 2149 r_tickptr);
  2150 + tcg_temp_free(r_tickptr);
2054 gen_movl_TN_reg(rd, cpu_dst); 2151 gen_movl_TN_reg(rd, cpu_dst);
2055 } 2152 }
2056 break; 2153 break;
@@ -2127,6 +2224,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2127,6 +2224,7 @@ static void disas_sparc_insn(DisasContext * dc)
2127 offsetof(CPUState, tsptr)); 2224 offsetof(CPUState, tsptr));
2128 tcg_gen_ld_tl(cpu_dst, r_tsptr, 2225 tcg_gen_ld_tl(cpu_dst, r_tsptr,
2129 offsetof(trap_state, tpc)); 2226 offsetof(trap_state, tpc));
  2227 + tcg_temp_free(r_tsptr);
2130 } 2228 }
2131 break; 2229 break;
2132 case 1: // tnpc 2230 case 1: // tnpc
@@ -2138,6 +2236,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2138,6 +2236,7 @@ static void disas_sparc_insn(DisasContext * dc)
2138 offsetof(CPUState, tsptr)); 2236 offsetof(CPUState, tsptr));
2139 tcg_gen_ld_tl(cpu_dst, r_tsptr, 2237 tcg_gen_ld_tl(cpu_dst, r_tsptr,
2140 offsetof(trap_state, tnpc)); 2238 offsetof(trap_state, tnpc));
  2239 + tcg_temp_free(r_tsptr);
2141 } 2240 }
2142 break; 2241 break;
2143 case 2: // tstate 2242 case 2: // tstate
@@ -2149,6 +2248,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2149,6 +2248,7 @@ static void disas_sparc_insn(DisasContext * dc)
2149 offsetof(CPUState, tsptr)); 2248 offsetof(CPUState, tsptr));
2150 tcg_gen_ld_tl(cpu_dst, r_tsptr, 2249 tcg_gen_ld_tl(cpu_dst, r_tsptr,
2151 offsetof(trap_state, tstate)); 2250 offsetof(trap_state, tstate));
  2251 + tcg_temp_free(r_tsptr);
2152 } 2252 }
2153 break; 2253 break;
2154 case 3: // tt 2254 case 3: // tt
@@ -2160,6 +2260,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2160,6 +2260,7 @@ static void disas_sparc_insn(DisasContext * dc)
2160 offsetof(CPUState, tsptr)); 2260 offsetof(CPUState, tsptr));
2161 tcg_gen_ld_i32(cpu_dst, r_tsptr, 2261 tcg_gen_ld_i32(cpu_dst, r_tsptr,
2162 offsetof(trap_state, tt)); 2262 offsetof(trap_state, tt));
  2263 + tcg_temp_free(r_tsptr);
2163 } 2264 }
2164 break; 2265 break;
2165 case 4: // tick 2266 case 4: // tick
@@ -2172,6 +2273,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2172,6 +2273,7 @@ static void disas_sparc_insn(DisasContext * dc)
2172 tcg_gen_helper_1_1(helper_tick_get_count, cpu_dst, 2273 tcg_gen_helper_1_1(helper_tick_get_count, cpu_dst,
2173 r_tickptr); 2274 r_tickptr);
2174 gen_movl_TN_reg(rd, cpu_dst); 2275 gen_movl_TN_reg(rd, cpu_dst);
  2276 + tcg_temp_free(r_tickptr);
2175 } 2277 }
2176 break; 2278 break;
2177 case 5: // tba 2279 case 5: // tba
@@ -2653,6 +2755,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2653,6 +2755,7 @@ static void disas_sparc_insn(DisasContext * dc)
2653 glue(glue(gen_op_store_, size_FDQ), T0_fpr) \ 2755 glue(glue(gen_op_store_, size_FDQ), T0_fpr) \
2654 (glue(size_FDQ, FPREG(rd))); \ 2756 (glue(size_FDQ, FPREG(rd))); \
2655 gen_set_label(l1); \ 2757 gen_set_label(l1); \
  2758 + tcg_temp_free(r_cond); \
2656 } 2759 }
2657 case 0x001: /* V9 fmovscc %fcc0 */ 2760 case 0x001: /* V9 fmovscc %fcc0 */
2658 FMOVCC(F, 0); 2761 FMOVCC(F, 0);
@@ -2711,6 +2814,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2711,6 +2814,7 @@ static void disas_sparc_insn(DisasContext * dc)
2711 glue(glue(gen_op_store_, size_FDQ), T0_fpr) \ 2814 glue(glue(gen_op_store_, size_FDQ), T0_fpr) \
2712 (glue(size_FDQ, FPREG(rd))); \ 2815 (glue(size_FDQ, FPREG(rd))); \
2713 gen_set_label(l1); \ 2816 gen_set_label(l1); \
  2817 + tcg_temp_free(r_cond); \
2714 } 2818 }
2715 2819
2716 case 0x101: /* V9 fmovscc %icc */ 2820 case 0x101: /* V9 fmovscc %icc */
@@ -2776,8 +2880,12 @@ static void disas_sparc_insn(DisasContext * dc) @@ -2776,8 +2880,12 @@ static void disas_sparc_insn(DisasContext * dc)
2776 if (rs1 == 0) { 2880 if (rs1 == 0) {
2777 // or %g0, x, y -> mov T0, x; mov y, T0 2881 // or %g0, x, y -> mov T0, x; mov y, T0
2778 if (IS_IMM) { /* immediate */ 2882 if (IS_IMM) { /* immediate */
  2883 + TCGv r_const;
  2884 +
2779 rs2 = GET_FIELDs(insn, 19, 31); 2885 rs2 = GET_FIELDs(insn, 19, 31);
2780 - gen_movl_TN_reg(rd, tcg_const_tl((int)rs2)); 2886 + r_const = tcg_const_tl((int)rs2);
  2887 + gen_movl_TN_reg(rd, r_const);
  2888 + tcg_temp_free(r_const);
2781 } else { /* register */ 2889 } else { /* register */
2782 rs2 = GET_FIELD(insn, 27, 31); 2890 rs2 = GET_FIELD(insn, 27, 31);
2783 gen_movl_reg_TN(rs2, cpu_dst); 2891 gen_movl_reg_TN(rs2, cpu_dst);
@@ -3107,6 +3215,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3107,6 +3215,7 @@ static void disas_sparc_insn(DisasContext * dc)
3107 offsetof(CPUState, tick)); 3215 offsetof(CPUState, tick));
3108 tcg_gen_helper_0_2(helper_tick_set_limit, 3216 tcg_gen_helper_0_2(helper_tick_set_limit,
3109 r_tickptr, cpu_dst); 3217 r_tickptr, cpu_dst);
  3218 + tcg_temp_free(r_tickptr);
3110 } 3219 }
3111 break; 3220 break;
3112 case 0x18: /* System tick */ 3221 case 0x18: /* System tick */
@@ -3124,6 +3233,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3124,6 +3233,7 @@ static void disas_sparc_insn(DisasContext * dc)
3124 offsetof(CPUState, stick)); 3233 offsetof(CPUState, stick));
3125 tcg_gen_helper_0_2(helper_tick_set_count, 3234 tcg_gen_helper_0_2(helper_tick_set_count,
3126 r_tickptr, cpu_dst); 3235 r_tickptr, cpu_dst);
  3236 + tcg_temp_free(r_tickptr);
3127 } 3237 }
3128 break; 3238 break;
3129 case 0x19: /* System tick compare */ 3239 case 0x19: /* System tick compare */
@@ -3144,6 +3254,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3144,6 +3254,7 @@ static void disas_sparc_insn(DisasContext * dc)
3144 offsetof(CPUState, stick)); 3254 offsetof(CPUState, stick));
3145 tcg_gen_helper_0_2(helper_tick_set_limit, 3255 tcg_gen_helper_0_2(helper_tick_set_limit,
3146 r_tickptr, cpu_dst); 3256 r_tickptr, cpu_dst);
  3257 + tcg_temp_free(r_tickptr);
3147 } 3258 }
3148 break; 3259 break;
3149 3260
@@ -3207,6 +3318,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3207,6 +3318,7 @@ static void disas_sparc_insn(DisasContext * dc)
3207 offsetof(CPUState, tsptr)); 3318 offsetof(CPUState, tsptr));
3208 tcg_gen_st_tl(cpu_dst, r_tsptr, 3319 tcg_gen_st_tl(cpu_dst, r_tsptr,
3209 offsetof(trap_state, tpc)); 3320 offsetof(trap_state, tpc));
  3321 + tcg_temp_free(r_tsptr);
3210 } 3322 }
3211 break; 3323 break;
3212 case 1: // tnpc 3324 case 1: // tnpc
@@ -3218,6 +3330,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3218,6 +3330,7 @@ static void disas_sparc_insn(DisasContext * dc)
3218 offsetof(CPUState, tsptr)); 3330 offsetof(CPUState, tsptr));
3219 tcg_gen_st_tl(cpu_dst, r_tsptr, 3331 tcg_gen_st_tl(cpu_dst, r_tsptr,
3220 offsetof(trap_state, tnpc)); 3332 offsetof(trap_state, tnpc));
  3333 + tcg_temp_free(r_tsptr);
3221 } 3334 }
3222 break; 3335 break;
3223 case 2: // tstate 3336 case 2: // tstate
@@ -3230,6 +3343,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3230,6 +3343,7 @@ static void disas_sparc_insn(DisasContext * dc)
3230 tcg_gen_st_tl(cpu_dst, r_tsptr, 3343 tcg_gen_st_tl(cpu_dst, r_tsptr,
3231 offsetof(trap_state, 3344 offsetof(trap_state,
3232 tstate)); 3345 tstate));
  3346 + tcg_temp_free(r_tsptr);
3233 } 3347 }
3234 break; 3348 break;
3235 case 3: // tt 3349 case 3: // tt
@@ -3241,6 +3355,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3241,6 +3355,7 @@ static void disas_sparc_insn(DisasContext * dc)
3241 offsetof(CPUState, tsptr)); 3355 offsetof(CPUState, tsptr));
3242 tcg_gen_st_i32(cpu_dst, r_tsptr, 3356 tcg_gen_st_i32(cpu_dst, r_tsptr,
3243 offsetof(trap_state, tt)); 3357 offsetof(trap_state, tt));
  3358 + tcg_temp_free(r_tsptr);
3244 } 3359 }
3245 break; 3360 break;
3246 case 4: // tick 3361 case 4: // tick
@@ -3252,6 +3367,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3252,6 +3367,7 @@ static void disas_sparc_insn(DisasContext * dc)
3252 offsetof(CPUState, tick)); 3367 offsetof(CPUState, tick));
3253 tcg_gen_helper_0_2(helper_tick_set_count, 3368 tcg_gen_helper_0_2(helper_tick_set_count,
3254 r_tickptr, cpu_dst); 3369 r_tickptr, cpu_dst);
  3370 + tcg_temp_free(r_tickptr);
3255 } 3371 }
3256 break; 3372 break;
3257 case 5: // tba 3373 case 5: // tba
@@ -3378,6 +3494,7 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3378,6 +3494,7 @@ static void disas_sparc_insn(DisasContext * dc)
3378 offsetof(CPUState, hstick)); 3494 offsetof(CPUState, hstick));
3379 tcg_gen_helper_0_2(helper_tick_set_limit, 3495 tcg_gen_helper_0_2(helper_tick_set_limit,
3380 r_tickptr, cpu_dst); 3496 r_tickptr, cpu_dst);
  3497 + tcg_temp_free(r_tickptr);
3381 } 3498 }
3382 break; 3499 break;
3383 case 6: // hver readonly 3500 case 6: // hver readonly
@@ -3412,14 +3529,19 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3412,14 +3529,19 @@ static void disas_sparc_insn(DisasContext * dc)
3412 3529
3413 tcg_gen_brcondi_tl(TCG_COND_EQ, r_cond, 0, l1); 3530 tcg_gen_brcondi_tl(TCG_COND_EQ, r_cond, 0, l1);
3414 if (IS_IMM) { /* immediate */ 3531 if (IS_IMM) { /* immediate */
  3532 + TCGv r_const;
  3533 +
3415 rs2 = GET_FIELD_SPs(insn, 0, 10); 3534 rs2 = GET_FIELD_SPs(insn, 0, 10);
3416 - gen_movl_TN_reg(rd, tcg_const_tl((int)rs2)); 3535 + r_const = tcg_const_tl((int)rs2);
  3536 + gen_movl_TN_reg(rd, r_const);
  3537 + tcg_temp_free(r_const);
3417 } else { 3538 } else {
3418 rs2 = GET_FIELD_SP(insn, 0, 4); 3539 rs2 = GET_FIELD_SP(insn, 0, 4);
3419 gen_movl_reg_TN(rs2, cpu_tmp0); 3540 gen_movl_reg_TN(rs2, cpu_tmp0);
3420 gen_movl_TN_reg(rd, cpu_tmp0); 3541 gen_movl_TN_reg(rd, cpu_tmp0);
3421 } 3542 }
3422 gen_set_label(l1); 3543 gen_set_label(l1);
  3544 + tcg_temp_free(r_cond);
3423 break; 3545 break;
3424 } 3546 }
3425 case 0x2d: /* V9 sdivx */ 3547 case 0x2d: /* V9 sdivx */
@@ -3445,8 +3567,12 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3445,8 +3567,12 @@ static void disas_sparc_insn(DisasContext * dc)
3445 tcg_gen_brcondi_tl(gen_tcg_cond_reg[cond], 3567 tcg_gen_brcondi_tl(gen_tcg_cond_reg[cond],
3446 cpu_src1, 0, l1); 3568 cpu_src1, 0, l1);
3447 if (IS_IMM) { /* immediate */ 3569 if (IS_IMM) { /* immediate */
  3570 + TCGv r_const;
  3571 +
3448 rs2 = GET_FIELD_SPs(insn, 0, 9); 3572 rs2 = GET_FIELD_SPs(insn, 0, 9);
3449 - gen_movl_TN_reg(rd, tcg_const_tl((int)rs2)); 3573 + r_const = tcg_const_tl((int)rs2);
  3574 + gen_movl_TN_reg(rd, r_const);
  3575 + tcg_temp_free(r_const);
3450 } else { 3576 } else {
3451 rs2 = GET_FIELD_SP(insn, 0, 4); 3577 rs2 = GET_FIELD_SP(insn, 0, 4);
3452 gen_movl_reg_TN(rs2, cpu_tmp0); 3578 gen_movl_reg_TN(rs2, cpu_tmp0);
@@ -3934,6 +4060,8 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3934,6 +4060,8 @@ static void disas_sparc_insn(DisasContext * dc)
3934 #endif 4060 #endif
3935 #ifdef TARGET_SPARC64 4061 #ifdef TARGET_SPARC64
3936 } else if (xop == 0x39) { /* V9 return */ 4062 } else if (xop == 0x39) { /* V9 return */
  4063 + TCGv r_const;
  4064 +
3937 save_state(dc, cpu_cond); 4065 save_state(dc, cpu_cond);
3938 cpu_src1 = get_src1(insn, cpu_src1); 4066 cpu_src1 = get_src1(insn, cpu_src1);
3939 if (IS_IMM) { /* immediate */ 4067 if (IS_IMM) { /* immediate */
@@ -3949,8 +4077,9 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3949,8 +4077,9 @@ static void disas_sparc_insn(DisasContext * dc)
3949 } 4077 }
3950 tcg_gen_helper_0_0(helper_restore); 4078 tcg_gen_helper_0_0(helper_restore);
3951 gen_mov_pc_npc(dc, cpu_cond); 4079 gen_mov_pc_npc(dc, cpu_cond);
3952 - tcg_gen_helper_0_2(helper_check_align, cpu_dst,  
3953 - tcg_const_i32(3)); 4080 + r_const = tcg_const_i32(3);
  4081 + tcg_gen_helper_0_2(helper_check_align, cpu_dst, r_const);
  4082 + tcg_temp_free(r_const);
3954 tcg_gen_mov_tl(cpu_npc, cpu_dst); 4083 tcg_gen_mov_tl(cpu_npc, cpu_dst);
3955 dc->npc = DYNAMIC_PC; 4084 dc->npc = DYNAMIC_PC;
3956 goto jmp_insn; 4085 goto jmp_insn;
@@ -3971,10 +4100,16 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3971,10 +4100,16 @@ static void disas_sparc_insn(DisasContext * dc)
3971 switch (xop) { 4100 switch (xop) {
3972 case 0x38: /* jmpl */ 4101 case 0x38: /* jmpl */
3973 { 4102 {
3974 - gen_movl_TN_reg(rd, tcg_const_tl(dc->pc)); 4103 + TCGv r_const;
  4104 +
  4105 + r_const = tcg_const_tl(dc->pc);
  4106 + gen_movl_TN_reg(rd, r_const);
  4107 + tcg_temp_free(r_const);
3975 gen_mov_pc_npc(dc, cpu_cond); 4108 gen_mov_pc_npc(dc, cpu_cond);
  4109 + r_const = tcg_const_i32(3);
3976 tcg_gen_helper_0_2(helper_check_align, cpu_dst, 4110 tcg_gen_helper_0_2(helper_check_align, cpu_dst,
3977 - tcg_const_i32(3)); 4111 + r_const);
  4112 + tcg_temp_free(r_const);
3978 tcg_gen_mov_tl(cpu_npc, cpu_dst); 4113 tcg_gen_mov_tl(cpu_npc, cpu_dst);
3979 dc->npc = DYNAMIC_PC; 4114 dc->npc = DYNAMIC_PC;
3980 } 4115 }
@@ -3982,11 +4117,15 @@ static void disas_sparc_insn(DisasContext * dc) @@ -3982,11 +4117,15 @@ static void disas_sparc_insn(DisasContext * dc)
3982 #if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) 4117 #if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64)
3983 case 0x39: /* rett, V9 return */ 4118 case 0x39: /* rett, V9 return */
3984 { 4119 {
  4120 + TCGv r_const;
  4121 +
3985 if (!supervisor(dc)) 4122 if (!supervisor(dc))
3986 goto priv_insn; 4123 goto priv_insn;
3987 gen_mov_pc_npc(dc, cpu_cond); 4124 gen_mov_pc_npc(dc, cpu_cond);
  4125 + r_const = tcg_const_i32(3);
3988 tcg_gen_helper_0_2(helper_check_align, cpu_dst, 4126 tcg_gen_helper_0_2(helper_check_align, cpu_dst,
3989 - tcg_const_i32(3)); 4127 + r_const);
  4128 + tcg_temp_free(r_const);
3990 tcg_gen_mov_tl(cpu_npc, cpu_dst); 4129 tcg_gen_mov_tl(cpu_npc, cpu_dst);
3991 dc->npc = DYNAMIC_PC; 4130 dc->npc = DYNAMIC_PC;
3992 tcg_gen_helper_0_0(helper_rett); 4131 tcg_gen_helper_0_0(helper_rett);
@@ -4080,9 +4219,13 @@ static void disas_sparc_insn(DisasContext * dc) @@ -4080,9 +4219,13 @@ static void disas_sparc_insn(DisasContext * dc)
4080 if (rd & 1) 4219 if (rd & 1)
4081 goto illegal_insn; 4220 goto illegal_insn;
4082 else { 4221 else {
  4222 + TCGv r_const;
  4223 +
4083 save_state(dc, cpu_cond); 4224 save_state(dc, cpu_cond);
4084 - tcg_gen_helper_0_2(helper_check_align, cpu_addr,  
4085 - tcg_const_i32(7)); // XXX remove 4225 + r_const = tcg_const_i32(7);
  4226 + tcg_gen_helper_0_2(helper_check_align, cpu_dst,
  4227 + r_const); // XXX remove
  4228 + tcg_temp_free(r_const);
4086 ABI32_MASK(cpu_addr); 4229 ABI32_MASK(cpu_addr);
4087 tcg_gen_qemu_ld64(cpu_tmp64, cpu_addr, dc->mem_idx); 4230 tcg_gen_qemu_ld64(cpu_tmp64, cpu_addr, dc->mem_idx);
4088 tcg_gen_trunc_i64_tl(cpu_tmp0, cpu_tmp64); 4231 tcg_gen_trunc_i64_tl(cpu_tmp0, cpu_tmp64);
@@ -4102,10 +4245,15 @@ static void disas_sparc_insn(DisasContext * dc) @@ -4102,10 +4245,15 @@ static void disas_sparc_insn(DisasContext * dc)
4102 tcg_gen_qemu_ld16s(cpu_val, cpu_addr, dc->mem_idx); 4245 tcg_gen_qemu_ld16s(cpu_val, cpu_addr, dc->mem_idx);
4103 break; 4246 break;
4104 case 0xd: /* ldstub -- XXX: should be atomically */ 4247 case 0xd: /* ldstub -- XXX: should be atomically */
4105 - ABI32_MASK(cpu_addr);  
4106 - tcg_gen_qemu_ld8s(cpu_val, cpu_addr, dc->mem_idx);  
4107 - tcg_gen_qemu_st8(tcg_const_tl(0xff), cpu_addr,  
4108 - dc->mem_idx); 4248 + {
  4249 + TCGv r_const;
  4250 +
  4251 + ABI32_MASK(cpu_addr);
  4252 + tcg_gen_qemu_ld8s(cpu_val, cpu_addr, dc->mem_idx);
  4253 + r_const = tcg_const_tl(0xff);
  4254 + tcg_gen_qemu_st8(r_const, cpu_addr, dc->mem_idx);
  4255 + tcg_temp_free(r_const);
  4256 + }
4109 break; 4257 break;
4110 case 0x0f: /* swap register with memory. Also 4258 case 0x0f: /* swap register with memory. Also
4111 atomically */ 4259 atomically */
@@ -4272,15 +4420,25 @@ static void disas_sparc_insn(DisasContext * dc) @@ -4272,15 +4420,25 @@ static void disas_sparc_insn(DisasContext * dc)
4272 tcg_gen_helper_0_0(helper_ldfsr); 4420 tcg_gen_helper_0_0(helper_ldfsr);
4273 break; 4421 break;
4274 case 0x22: /* load quad fpreg */ 4422 case 0x22: /* load quad fpreg */
4275 - CHECK_FPU_FEATURE(dc, FLOAT128);  
4276 - tcg_gen_helper_0_2(helper_ldqf, cpu_addr,  
4277 - tcg_const_i32(dc->mem_idx));  
4278 - gen_op_store_QT0_fpr(QFPREG(rd)); 4423 + {
  4424 + TCGv r_const;
  4425 +
  4426 + CHECK_FPU_FEATURE(dc, FLOAT128);
  4427 + r_const = tcg_const_i32(dc->mem_idx);
  4428 + tcg_gen_helper_0_2(helper_ldqf, cpu_addr, r_const);
  4429 + tcg_temp_free(r_const);
  4430 + gen_op_store_QT0_fpr(QFPREG(rd));
  4431 + }
4279 break; 4432 break;
4280 case 0x23: /* load double fpreg */ 4433 case 0x23: /* load double fpreg */
4281 - tcg_gen_helper_0_2(helper_lddf, cpu_addr,  
4282 - tcg_const_i32(dc->mem_idx));  
4283 - gen_op_store_DT0_fpr(DFPREG(rd)); 4434 + {
  4435 + TCGv r_const;
  4436 +
  4437 + r_const = tcg_const_i32(dc->mem_idx);
  4438 + tcg_gen_helper_0_2(helper_lddf, cpu_addr, r_const);
  4439 + tcg_temp_free(r_const);
  4440 + gen_op_store_DT0_fpr(DFPREG(rd));
  4441 + }
4284 break; 4442 break;
4285 default: 4443 default:
4286 goto illegal_insn; 4444 goto illegal_insn;
@@ -4305,16 +4463,19 @@ static void disas_sparc_insn(DisasContext * dc) @@ -4305,16 +4463,19 @@ static void disas_sparc_insn(DisasContext * dc)
4305 if (rd & 1) 4463 if (rd & 1)
4306 goto illegal_insn; 4464 goto illegal_insn;
4307 else { 4465 else {
4308 - TCGv r_low; 4466 + TCGv r_low, r_const;
4309 4467
4310 save_state(dc, cpu_cond); 4468 save_state(dc, cpu_cond);
4311 ABI32_MASK(cpu_addr); 4469 ABI32_MASK(cpu_addr);
  4470 + r_const = tcg_const_i32(7);
4312 tcg_gen_helper_0_2(helper_check_align, cpu_addr, 4471 tcg_gen_helper_0_2(helper_check_align, cpu_addr,
4313 - tcg_const_i32(7)); // XXX remove 4472 + r_const); // XXX remove
  4473 + tcg_temp_free(r_const);
4314 r_low = tcg_temp_new(TCG_TYPE_TL); 4474 r_low = tcg_temp_new(TCG_TYPE_TL);
4315 gen_movl_reg_TN(rd + 1, r_low); 4475 gen_movl_reg_TN(rd + 1, r_low);
4316 tcg_gen_helper_1_2(helper_pack64, cpu_tmp64, cpu_val, 4476 tcg_gen_helper_1_2(helper_pack64, cpu_tmp64, cpu_val,
4317 r_low); 4477 r_low);
  4478 + tcg_temp_free(r_low);
4318 tcg_gen_qemu_st64(cpu_tmp64, cpu_addr, dc->mem_idx); 4479 tcg_gen_qemu_st64(cpu_tmp64, cpu_addr, dc->mem_idx);
4319 } 4480 }
4320 break; 4481 break;
@@ -4398,10 +4559,15 @@ static void disas_sparc_insn(DisasContext * dc) @@ -4398,10 +4559,15 @@ static void disas_sparc_insn(DisasContext * dc)
4398 case 0x26: 4559 case 0x26:
4399 #ifdef TARGET_SPARC64 4560 #ifdef TARGET_SPARC64
4400 /* V9 stqf, store quad fpreg */ 4561 /* V9 stqf, store quad fpreg */
4401 - CHECK_FPU_FEATURE(dc, FLOAT128);  
4402 - gen_op_load_fpr_QT0(QFPREG(rd));  
4403 - tcg_gen_helper_0_2(helper_stqf, cpu_addr,  
4404 - tcg_const_i32(dc->mem_idx)); 4562 + {
  4563 + TCGv r_const;
  4564 +
  4565 + CHECK_FPU_FEATURE(dc, FLOAT128);
  4566 + gen_op_load_fpr_QT0(QFPREG(rd));
  4567 + r_const = tcg_const_i32(dc->mem_idx);
  4568 + tcg_gen_helper_0_2(helper_stqf, cpu_addr, r_const);
  4569 + tcg_temp_free(r_const);
  4570 + }
4405 break; 4571 break;
4406 #else /* !TARGET_SPARC64 */ 4572 #else /* !TARGET_SPARC64 */
4407 /* stdfq, store floating point queue */ 4573 /* stdfq, store floating point queue */
@@ -4416,9 +4582,14 @@ static void disas_sparc_insn(DisasContext * dc) @@ -4416,9 +4582,14 @@ static void disas_sparc_insn(DisasContext * dc)
4416 #endif 4582 #endif
4417 #endif 4583 #endif
4418 case 0x27: /* store double fpreg */ 4584 case 0x27: /* store double fpreg */
4419 - gen_op_load_fpr_DT0(DFPREG(rd));  
4420 - tcg_gen_helper_0_2(helper_stdf, cpu_addr,  
4421 - tcg_const_i32(dc->mem_idx)); 4585 + {
  4586 + TCGv r_const;
  4587 +
  4588 + gen_op_load_fpr_DT0(DFPREG(rd));
  4589 + r_const = tcg_const_i32(dc->mem_idx);
  4590 + tcg_gen_helper_0_2(helper_stdf, cpu_addr, r_const);
  4591 + tcg_temp_free(r_const);
  4592 + }
4422 break; 4593 break;
4423 default: 4594 default:
4424 goto illegal_insn; 4595 goto illegal_insn;
@@ -4432,11 +4603,17 @@ static void disas_sparc_insn(DisasContext * dc) @@ -4432,11 +4603,17 @@ static void disas_sparc_insn(DisasContext * dc)
4432 gen_stf_asi(cpu_addr, insn, 4, rd); 4603 gen_stf_asi(cpu_addr, insn, 4, rd);
4433 break; 4604 break;
4434 case 0x36: /* V9 stqfa */ 4605 case 0x36: /* V9 stqfa */
4435 - CHECK_FPU_FEATURE(dc, FLOAT128);  
4436 - tcg_gen_helper_0_2(helper_check_align, cpu_addr,  
4437 - tcg_const_i32(7));  
4438 - gen_op_load_fpr_QT0(QFPREG(rd));  
4439 - gen_stf_asi(cpu_addr, insn, 16, QFPREG(rd)); 4606 + {
  4607 + TCGv r_const;
  4608 +
  4609 + CHECK_FPU_FEATURE(dc, FLOAT128);
  4610 + r_const = tcg_const_i32(7);
  4611 + tcg_gen_helper_0_2(helper_check_align, cpu_addr,
  4612 + r_const);
  4613 + tcg_temp_free(r_const);
  4614 + gen_op_load_fpr_QT0(QFPREG(rd));
  4615 + gen_stf_asi(cpu_addr, insn, 16, QFPREG(rd));
  4616 + }
4440 break; 4617 break;
4441 case 0x37: /* V9 stdfa */ 4618 case 0x37: /* V9 stdfa */
4442 gen_op_load_fpr_DT0(DFPREG(rd)); 4619 gen_op_load_fpr_DT0(DFPREG(rd));
@@ -4481,20 +4658,38 @@ static void disas_sparc_insn(DisasContext * dc) @@ -4481,20 +4658,38 @@ static void disas_sparc_insn(DisasContext * dc)
4481 jmp_insn: 4658 jmp_insn:
4482 return; 4659 return;
4483 illegal_insn: 4660 illegal_insn:
4484 - save_state(dc, cpu_cond);  
4485 - tcg_gen_helper_0_1(raise_exception, tcg_const_i32(TT_ILL_INSN));  
4486 - dc->is_br = 1; 4661 + {
  4662 + TCGv r_const;
  4663 +
  4664 + save_state(dc, cpu_cond);
  4665 + r_const = tcg_const_i32(TT_ILL_INSN);
  4666 + tcg_gen_helper_0_1(raise_exception, r_const);
  4667 + tcg_temp_free(r_const);
  4668 + dc->is_br = 1;
  4669 + }
4487 return; 4670 return;
4488 unimp_flush: 4671 unimp_flush:
4489 - save_state(dc, cpu_cond);  
4490 - tcg_gen_helper_0_1(raise_exception, tcg_const_i32(TT_UNIMP_FLUSH));  
4491 - dc->is_br = 1; 4672 + {
  4673 + TCGv r_const;
  4674 +
  4675 + save_state(dc, cpu_cond);
  4676 + r_const = tcg_const_i32(TT_UNIMP_FLUSH);
  4677 + tcg_gen_helper_0_1(raise_exception, r_const);
  4678 + tcg_temp_free(r_const);
  4679 + dc->is_br = 1;
  4680 + }
4492 return; 4681 return;
4493 #if !defined(CONFIG_USER_ONLY) 4682 #if !defined(CONFIG_USER_ONLY)
4494 priv_insn: 4683 priv_insn:
4495 - save_state(dc, cpu_cond);  
4496 - tcg_gen_helper_0_1(raise_exception, tcg_const_i32(TT_PRIV_INSN));  
4497 - dc->is_br = 1; 4684 + {
  4685 + TCGv r_const;
  4686 +
  4687 + save_state(dc, cpu_cond);
  4688 + r_const = tcg_const_i32(TT_PRIV_INSN);
  4689 + tcg_gen_helper_0_1(raise_exception, r_const);
  4690 + tcg_temp_free(r_const);
  4691 + dc->is_br = 1;
  4692 + }
4498 return; 4693 return;
4499 #endif 4694 #endif
4500 nfpu_insn: 4695 nfpu_insn:
@@ -4511,9 +4706,15 @@ static void disas_sparc_insn(DisasContext * dc) @@ -4511,9 +4706,15 @@ static void disas_sparc_insn(DisasContext * dc)
4511 #endif 4706 #endif
4512 #ifndef TARGET_SPARC64 4707 #ifndef TARGET_SPARC64
4513 ncp_insn: 4708 ncp_insn:
4514 - save_state(dc, cpu_cond);  
4515 - tcg_gen_helper_0_1(raise_exception, tcg_const_i32(TT_NCP_INSN));  
4516 - dc->is_br = 1; 4709 + {
  4710 + TCGv r_const;
  4711 +
  4712 + save_state(dc, cpu_cond);
  4713 + r_const = tcg_const_i32(TT_NCP_INSN);
  4714 + tcg_gen_helper_0_1(raise_exception, r_const);
  4715 + tcg_temp_free(r_const);
  4716 + dc->is_br = 1;
  4717 + }
4517 return; 4718 return;
4518 #endif 4719 #endif
4519 } 4720 }
@@ -4596,6 +4797,9 @@ static inline int gen_intermediate_code_internal(TranslationBlock * tb, @@ -4596,6 +4797,9 @@ static inline int gen_intermediate_code_internal(TranslationBlock * tb,
4596 (dc->pc - pc_start) < (TARGET_PAGE_SIZE - 32)); 4797 (dc->pc - pc_start) < (TARGET_PAGE_SIZE - 32));
4597 4798
4598 exit_gen_loop: 4799 exit_gen_loop:
  4800 + tcg_temp_free(cpu_tmp64);
  4801 + tcg_temp_free(cpu_tmp32);
  4802 + tcg_temp_free(cpu_tmp0);
4599 if (!dc->is_br) { 4803 if (!dc->is_br) {
4600 if (dc->pc != DYNAMIC_PC && 4804 if (dc->pc != DYNAMIC_PC &&
4601 (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) { 4805 (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) {