• 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

Revision75a37253896017eeb52d8cdecb98a3d95bc84de7 (tree)
Time2019-06-07 18:00:27
AuthorRichard Henderson <richard.henderson@lina...>
CommiterYoshinori Sato

Log Message

target/rx: Replace operand with prt_ldmi in disassembler

This has consistency with prt_ri(). It loads all data before
beginning output. It uses exactly one call to prt() to emit
the full instruction.

Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Change Summary

Incremental Difference

--- a/target/rx/disas.c
+++ b/target/rx/disas.c
@@ -135,18 +135,18 @@ static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi)
135135 sprintf(out, "%u", dsp << (mi < 3 ? mi : 4 - mi));
136136 }
137137
138-static void operand(DisasContext *ctx, int ld, int mi, int rs, int rd)
138+static void prt_ldmi(DisasContext *ctx, const char *insn,
139+ int ld, int mi, int rs, int rd)
139140 {
140141 static const char sizes[][4] = {".b", ".w", ".l", ".uw", ".ub"};
141142 char dsp[8];
142143
143144 if (ld < 3) {
144145 rx_index_addr(ctx, dsp, ld, mi);
145- prt("%s[r%d]%s", dsp, rs, sizes[mi]);
146+ prt("%s\t%s[r%d]%s, r%d", insn, dsp, rs, sizes[mi], rd);
146147 } else {
147- prt("r%d", rs);
148+ prt("%s\tr%d, r%d", insn, rs, rd);
148149 }
149- prt(", r%d", rd);
150150 }
151151
152152 static void prt_ir(DisasContext *ctx, const char *insn, int imm, int rd)
@@ -416,8 +416,7 @@ static bool trans_AND_ir(DisasContext *ctx, arg_AND_ir *a)
416416 /* and rs,rd */
417417 static bool trans_AND_mr(DisasContext *ctx, arg_AND_mr *a)
418418 {
419- prt("and\t");
420- operand(ctx, a->ld, a->mi, a->rs, a->rd);
419+ prt_ldmi(ctx, "and", a->ld, a->mi, a->rs, a->rd);
421420 return true;
422421 }
423422
@@ -440,8 +439,7 @@ static bool trans_OR_ir(DisasContext *ctx, arg_OR_ir *a)
440439 /* or rs,rd */
441440 static bool trans_OR_mr(DisasContext *ctx, arg_OR_mr *a)
442441 {
443- prt("or\t");
444- operand(ctx, a->ld, a->mi, a->rs, a->rd);
442+ prt_ldmi(ctx, "or", a->ld, a->mi, a->rs, a->rd);
445443 return true;
446444 }
447445
@@ -463,8 +461,7 @@ static bool trans_XOR_ir(DisasContext *ctx, arg_XOR_ir *a)
463461 /* xor rs,rd */
464462 static bool trans_XOR_mr(DisasContext *ctx, arg_XOR_mr *a)
465463 {
466- prt("xor\t");
467- operand(ctx, a->ld, a->mi, a->rs, a->rd);
464+ prt_ldmi(ctx, "xor", a->ld, a->mi, a->rs, a->rd);
468465 return true;
469466 }
470467
@@ -479,8 +476,7 @@ static bool trans_TST_ir(DisasContext *ctx, arg_TST_ir *a)
479476 /* tst rs, rd */
480477 static bool trans_TST_mr(DisasContext *ctx, arg_TST_mr *a)
481478 {
482- prt("tst\t");
483- operand(ctx, a->ld, a->mi, a->rs, a->rd);
479+ prt_ldmi(ctx, "tst", a->ld, a->mi, a->rs, a->rd);
484480 return true;
485481 }
486482
@@ -548,8 +544,7 @@ static bool trans_ADD_irr(DisasContext *ctx, arg_ADD_irr *a)
548544 /* add dsp[rs], rd */
549545 static bool trans_ADD_mr(DisasContext *ctx, arg_ADD_mr *a)
550546 {
551- prt("add\t");
552- operand(ctx, a->ld, a->mi, a->rs, a->rd);
547+ prt_ldmi(ctx, "add", a->ld, a->mi, a->rs, a->rd);
553548 return true;
554549 }
555550
@@ -573,8 +568,7 @@ static bool trans_CMP_ir(DisasContext *ctx, arg_CMP_ir *a)
573568 /* cmp dsp[rs], rs2 */
574569 static bool trans_CMP_mr(DisasContext *ctx, arg_CMP_mr *a)
575570 {
576- prt("cmp\t");
577- operand(ctx, a->ld, a->mi, a->rs, a->rd);
571+ prt_ldmi(ctx, "cmp", a->ld, a->mi, a->rs, a->rd);
578572 return true;
579573 }
580574
@@ -589,8 +583,7 @@ static bool trans_SUB_ir(DisasContext *ctx, arg_SUB_ir *a)
589583 /* sub dsp[rs], rd */
590584 static bool trans_SUB_mr(DisasContext *ctx, arg_SUB_mr *a)
591585 {
592- prt("sub\t");
593- operand(ctx, a->ld, a->mi, a->rs, a->rd);
586+ prt_ldmi(ctx, "sub", a->ld, a->mi, a->rs, a->rd);
594587 return true;
595588 }
596589
@@ -611,8 +604,7 @@ static bool trans_SBB_rr(DisasContext *ctx, arg_SBB_rr *a)
611604 /* sbb dsp[rs], rd */
612605 static bool trans_SBB_mr(DisasContext *ctx, arg_SBB_mr *a)
613606 {
614- prt("sbb\t");
615- operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd);
607+ prt_ldmi(ctx, "sbb", a->ld, RX_IM_LONG, a->rs, a->rd);
616608 return true;
617609 }
618610
@@ -640,8 +632,7 @@ static bool trans_MAX_ir(DisasContext *ctx, arg_MAX_ir *a)
640632 /* max dsp[rs], rd */
641633 static bool trans_MAX_mr(DisasContext *ctx, arg_MAX_mr *a)
642634 {
643- prt("max\t");
644- operand(ctx, a->ld, a->mi, a->rs, a->rd);
635+ prt_ldmi(ctx, "max", a->ld, a->mi, a->rs, a->rd);
645636 return true;
646637 }
647638
@@ -656,8 +647,7 @@ static bool trans_MIN_ir(DisasContext *ctx, arg_MIN_ir *a)
656647 /* min dsp[rs], rd */
657648 static bool trans_MIN_mr(DisasContext *ctx, arg_MIN_mr *a)
658649 {
659- prt("max\t");
660- operand(ctx, a->ld, a->mi, a->rs, a->rd);
650+ prt_ldmi(ctx, "min", a->ld, a->mi, a->rs, a->rd);
661651 return true;
662652 }
663653
@@ -673,8 +663,7 @@ static bool trans_MUL_ir(DisasContext *ctx, arg_MUL_ir *a)
673663 /* mul dsp[rs], rd */
674664 static bool trans_MUL_mr(DisasContext *ctx, arg_MUL_mr *a)
675665 {
676- prt("mul\t");
677- operand(ctx, a->ld, a->mi, a->rs, a->rd);
666+ prt_ldmi(ctx, "mul", a->ld, a->mi, a->rs, a->rd);
678667 return true;
679668 }
680669
@@ -696,8 +685,7 @@ static bool trans_EMUL_ir(DisasContext *ctx, arg_EMUL_ir *a)
696685 /* emul dsp[rs], rd */
697686 static bool trans_EMUL_mr(DisasContext *ctx, arg_EMUL_mr *a)
698687 {
699- prt("emul\t");
700- operand(ctx, a->ld, a->mi, a->rs, a->rd);
688+ prt_ldmi(ctx, "emul", a->ld, a->mi, a->rs, a->rd);
701689 return true;
702690 }
703691
@@ -712,8 +700,7 @@ static bool trans_EMULU_ir(DisasContext *ctx, arg_EMULU_ir *a)
712700 /* emulu dsp[rs], rd */
713701 static bool trans_EMULU_mr(DisasContext *ctx, arg_EMULU_mr *a)
714702 {
715- prt("emulu\t");
716- operand(ctx, a->ld, a->mi, a->rs, a->rd);
703+ prt_ldmi(ctx, "emulu", a->ld, a->mi, a->rs, a->rd);
717704 return true;
718705 }
719706
@@ -728,8 +715,7 @@ static bool trans_DIV_ir(DisasContext *ctx, arg_DIV_ir *a)
728715 /* div dsp[rs], rd */
729716 static bool trans_DIV_mr(DisasContext *ctx, arg_DIV_mr *a)
730717 {
731- prt("div\t");
732- operand(ctx, a->ld, a->mi, a->rs, a->rd);
718+ prt_ldmi(ctx, "div", a->ld, a->mi, a->rs, a->rd);
733719 return true;
734720 }
735721
@@ -744,8 +730,7 @@ static bool trans_DIVU_ir(DisasContext *ctx, arg_DIVU_ir *a)
744730 /* divu dsp[rs], rd */
745731 static bool trans_DIVU_mr(DisasContext *ctx, arg_DIVU_mr *a)
746732 {
747- prt("divu\t");
748- operand(ctx, a->ld, a->mi, a->rs, a->rd);
733+ prt_ldmi(ctx, "divu", a->ld, a->mi, a->rs, a->rd);
749734 return true;
750735 }
751736
@@ -1089,8 +1074,7 @@ static bool trans_FADD_ir(DisasContext *ctx, arg_FADD_ir *a)
10891074 /* fadd rs, rd */
10901075 static bool trans_FADD_mr(DisasContext *ctx, arg_FADD_mr *a)
10911076 {
1092- prt("fadd\t");
1093- operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd);
1077+ prt_ldmi(ctx, "fadd", a->ld, RX_IM_LONG, a->rs, a->rd);
10941078 return true;
10951079 }
10961080
@@ -1105,8 +1089,7 @@ static bool trans_FCMP_ir(DisasContext *ctx, arg_FCMP_ir *a)
11051089 /* fcmp rs, rd */
11061090 static bool trans_FCMP_mr(DisasContext *ctx, arg_FCMP_mr *a)
11071091 {
1108- prt("fcmp\t");
1109- operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd);
1092+ prt_ldmi(ctx, "fcmp", a->ld, RX_IM_LONG, a->rs, a->rd);
11101093 return true;
11111094 }
11121095
@@ -1121,8 +1104,7 @@ static bool trans_FSUB_ir(DisasContext *ctx, arg_FSUB_ir *a)
11211104 /* fsub rs, rd */
11221105 static bool trans_FSUB_mr(DisasContext *ctx, arg_FSUB_mr *a)
11231106 {
1124- prt("fsub\t");
1125- operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd);
1107+ prt_ldmi(ctx, "fsub", a->ld, RX_IM_LONG, a->rs, a->rd);
11261108 return true;
11271109 }
11281110
@@ -1130,8 +1112,7 @@ static bool trans_FSUB_mr(DisasContext *ctx, arg_FSUB_mr *a)
11301112 /* ftoi rs, rd */
11311113 static bool trans_FTOI(DisasContext *ctx, arg_FTOI *a)
11321114 {
1133- prt("ftoi\t");
1134- operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd);
1115+ prt_ldmi(ctx, "ftoi", a->ld, RX_IM_LONG, a->rs, a->rd);
11351116 return true;
11361117 }
11371118
@@ -1146,8 +1127,7 @@ static bool trans_FMUL_ir(DisasContext *ctx, arg_FMUL_ir *a)
11461127 /* fmul rs, rd */
11471128 static bool trans_FMUL_mr(DisasContext *ctx, arg_FMUL_mr *a)
11481129 {
1149- prt("fmul\t");
1150- operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd);
1130+ prt_ldmi(ctx, "fmul", a->ld, RX_IM_LONG, a->rs, a->rd);
11511131 return true;
11521132 }
11531133
@@ -1162,8 +1142,7 @@ static bool trans_FDIV_ir(DisasContext *ctx, arg_FDIV_ir *a)
11621142 /* fdiv rs, rd */
11631143 static bool trans_FDIV_mr(DisasContext *ctx, arg_FDIV_mr *a)
11641144 {
1165- prt("fdiv\t");
1166- operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd);
1145+ prt_ldmi(ctx, "fdiv", a->ld, RX_IM_LONG, a->rs, a->rd);
11671146 return true;
11681147 }
11691148
@@ -1171,8 +1150,7 @@ static bool trans_FDIV_mr(DisasContext *ctx, arg_FDIV_mr *a)
11711150 /* round rs, rd */
11721151 static bool trans_ROUND(DisasContext *ctx, arg_ROUND *a)
11731152 {
1174- prt("round\t");
1175- operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd);
1153+ prt_ldmi(ctx, "round", a->ld, RX_IM_LONG, a->rs, a->rd);
11761154 return true;
11771155 }
11781156
@@ -1180,8 +1158,7 @@ static bool trans_ROUND(DisasContext *ctx, arg_ROUND *a)
11801158 /* itof dsp[rs], rd */
11811159 static bool trans_ITOF(DisasContext *ctx, arg_ITOF *a)
11821160 {
1183- prt("itof\t");
1184- operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd);
1161+ prt_ldmi(ctx, "itof", a->ld, RX_IM_LONG, a->rs, a->rd);
11851162 return true;
11861163 }
11871164