• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision53c89efd02cef626040165cc8f06b5cf2c15355d (tree)
Time2017-09-08 03:57:35
AuthorRichard Henderson <rth@twid...>
CommiterRichard Henderson

Log Message

tcg/ppc: Use constant pool for movi

Signed-off-by: Richard Henderson <rth@twiddle.net>

Change Summary

Incremental Difference

--- a/tcg/ppc/tcg-target.h
+++ b/tcg/ppc/tcg-target.h
@@ -132,5 +132,6 @@ void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t);
132132 #ifdef CONFIG_SOFTMMU
133133 #define TCG_TARGET_NEED_LDST_LABELS
134134 #endif
135+#define TCG_TARGET_NEED_POOL_LABELS
135136
136137 #endif
--- a/tcg/ppc/tcg-target.inc.c
+++ b/tcg/ppc/tcg-target.inc.c
@@ -22,6 +22,9 @@
2222 * THE SOFTWARE.
2323 */
2424
25+#include "elf.h"
26+#include "tcg-pool.inc.c"
27+
2528 #if defined _CALL_DARWIN || defined __APPLE__
2629 #define TCG_TARGET_CALL_DARWIN
2730 #endif
@@ -58,8 +61,6 @@
5861
5962 static tcg_insn_unit *tb_ret_addr;
6063
61-#include "elf.h"
62-
6364 bool have_isa_2_06;
6465 bool have_isa_3_00;
6566
@@ -224,9 +225,12 @@ static inline void tcg_out_bc_noaddr(TCGContext *s, int insn)
224225 static void patch_reloc(tcg_insn_unit *code_ptr, int type,
225226 intptr_t value, intptr_t addend)
226227 {
227- tcg_insn_unit *target = (tcg_insn_unit *)value;
228+ tcg_insn_unit *target;
229+ tcg_insn_unit old;
230+
231+ value += addend;
232+ target = (tcg_insn_unit *)value;
228233
229- tcg_debug_assert(addend == 0);
230234 switch (type) {
231235 case R_PPC_REL14:
232236 reloc_pc14(code_ptr, target);
@@ -234,6 +238,12 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int type,
234238 case R_PPC_REL24:
235239 reloc_pc24(code_ptr, target);
236240 break;
241+ case R_PPC_ADDR16:
242+ assert(value == (int16_t)value);
243+ old = *code_ptr;
244+ old = deposit32(old, 0, 16, value);
245+ *code_ptr = old;
246+ break;
237247 default:
238248 tcg_abort();
239249 }
@@ -676,6 +686,14 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret,
676686 return;
677687 }
678688
689+ /* Use the constant pool, if possible. */
690+ if (!in_prologue && USE_REG_TB) {
691+ new_pool_label(s, arg, R_PPC_ADDR16, s->code_ptr,
692+ -(intptr_t)s->code_gen_ptr);
693+ tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0));
694+ return;
695+ }
696+
679697 tmp = arg >> 31 >> 1;
680698 tcg_out_movi(s, TCG_TYPE_I32, ret, tmp);
681699 if (tmp) {
@@ -1858,6 +1876,14 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64)
18581876 #endif
18591877 }
18601878
1879+static void tcg_out_nop_fill(tcg_insn_unit *p, int count)
1880+{
1881+ int i;
1882+ for (i = 0; i < count; ++i) {
1883+ p[i] = NOP;
1884+ }
1885+}
1886+
18611887 /* Parameters for function call generation, used in tcg.c. */
18621888 #define TCG_TARGET_STACK_ALIGN 16
18631889 #define TCG_TARGET_EXTEND_ARGS 1