aboutsummaryrefslogtreecommitdiff
path: root/src/lj_asm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_asm.c')
-rw-r--r--src/lj_asm.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index 7ebde7b8..a550d3b3 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -1057,26 +1057,30 @@ static void asm_bufhdr(ASMState *as, IRIns *ir)
1057 1057
1058static void asm_bufput(ASMState *as, IRIns *ir) 1058static void asm_bufput(ASMState *as, IRIns *ir)
1059{ 1059{
1060 const CCallInfo *ci; 1060 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_buf_putstr];
1061 IRRef args[2]; 1061 IRRef args[2];
1062 IRIns *ir2; 1062 IRIns *irs;
1063 if (!ra_used(ir)) return; 1063 if (!ra_used(ir)) return;
1064 args[0] = ir->op1; /* SBuf * */ 1064 args[0] = ir->op1; /* SBuf * */
1065 args[1] = ir->op2; /* int, double, GCstr * */ 1065 args[1] = ir->op2; /* GCstr * */
1066 ir2 = IR(ir->op2); 1066 irs = IR(ir->op2);
1067 if (irt_isstr(ir2->t)) { 1067 lua_assert(irt_isstr(irs->t));
1068 ci = &lj_ir_callinfo[IRCALL_lj_buf_putstr]; 1068 if (mayfuse(as, ir->op2) && ra_noreg(irs->r)) {
1069 } else if (LJ_SOFTFP ? irt_type((ir2+1)->t)==IRT_SOFTFP : irt_isnum(ir2->t)) { 1069 if (irs->o == IR_TOSTR) { /* Fuse number to string conversions. */
1070 ci = &lj_ir_callinfo[IRCALL_lj_buf_putnum]; 1070 if (LJ_SOFTFP ? (irs+1)->o == IR_HIOP : irt_isnum(IR(irs->op1)->t)) {
1071 args[1] = ASMREF_TMP1; 1071 ci = &lj_ir_callinfo[IRCALL_lj_buf_putnum];
1072 } else { 1072 args[1] = ASMREF_TMP1; /* TValue * */
1073 lua_assert(irt_isinteger(ir2->t)); 1073 } else {
1074 ci = &lj_ir_callinfo[IRCALL_lj_buf_putint]; 1074 lua_assert(irt_isinteger(IR(irs->op1)->t));
1075 ci = &lj_ir_callinfo[IRCALL_lj_buf_putint];
1076 args[1] = irs->op1; /* int */
1077 }
1078 }
1075 } 1079 }
1076 asm_setupresult(as, ir, ci); /* SBuf * */ 1080 asm_setupresult(as, ir, ci); /* SBuf * */
1077 asm_gencall(as, ci, args); 1081 asm_gencall(as, ci, args);
1078 if (args[1] == ASMREF_TMP1) 1082 if (args[1] == ASMREF_TMP1)
1079 asm_tvptr(as, ra_releasetmp(as, ASMREF_TMP1), ir->op2); 1083 asm_tvptr(as, ra_releasetmp(as, ASMREF_TMP1), irs->op1);
1080} 1084}
1081 1085
1082static void asm_bufstr(ASMState *as, IRIns *ir) 1086static void asm_bufstr(ASMState *as, IRIns *ir)