@@ -4366,15 +4366,11 @@ static void ir_emit_va_arg(ir_ctx *ctx, ir_ref def, ir_insn *insn)
4366
4366
ir_backend_data *data = ctx->data;
4367
4367
dasm_State **Dst = &data->dasm_state;
4368
4368
ir_type type = insn->type;
4369
- ir_reg def_reg = IR_REG_NUM( ctx->regs[def][0]) ;
4369
+ ir_reg def_reg = ctx->regs[def][0];
4370
4370
ir_reg op2_reg = ctx->regs[def][2];
4371
4371
ir_reg tmp_reg = ctx->regs[def][3];
4372
4372
int32_t offset;
4373
4373
4374
- if (ctx->use_lists[def].count == 1) {
4375
- /* dead load */
4376
- return;
4377
- }
4378
4374
IR_ASSERT(def_reg != IR_REG_NONE && tmp_reg != IR_REG_NONE);
4379
4375
if (op2_reg != IR_REG_NONE) {
4380
4376
if (IR_REG_SPILLED(op2_reg)) {
@@ -4398,15 +4394,11 @@ static void ir_emit_va_arg(ir_ctx *ctx, ir_ref def, ir_insn *insn)
4398
4394
ir_backend_data *data = ctx->data;
4399
4395
dasm_State **Dst = &data->dasm_state;
4400
4396
ir_type type = insn->type;
4401
- ir_reg def_reg = IR_REG_NUM( ctx->regs[def][0]) ;
4397
+ ir_reg def_reg = ctx->regs[def][0];
4402
4398
ir_reg op2_reg = ctx->regs[def][2];
4403
4399
ir_reg tmp_reg = ctx->regs[def][3];
4404
4400
int32_t offset;
4405
4401
4406
- if (ctx->use_lists[def].count == 1) {
4407
- /* dead load */
4408
- return;
4409
- }
4410
4402
IR_ASSERT(def_reg != IR_REG_NONE && tmp_reg != IR_REG_NONE);
4411
4403
if (op2_reg != IR_REG_NONE) {
4412
4404
if (IR_REG_SPILLED(op2_reg)) {
@@ -4943,28 +4935,6 @@ static void ir_emit_tailcall(ir_ctx *ctx, ir_ref def, ir_insn *insn)
4943
4935
return;
4944
4936
}
4945
4937
4946
- /* Move op2 to a tmp register before epilogue if it's in
4947
- * used_preserved_regs, because it will be overridden. */
4948
-
4949
- ir_reg op2_reg = IR_REG_NONE;
4950
- if (!IR_IS_CONST_REF(insn->op2)) {
4951
- op2_reg = ctx->regs[def][2];
4952
- IR_ASSERT(op2_reg != IR_REG_NONE);
4953
-
4954
- if (IR_REG_SPILLED(op2_reg)) {
4955
- op2_reg = IR_REG_INT_TMP;
4956
- ir_emit_load(ctx, IR_ADDR, op2_reg, insn->op2);
4957
- } else if (IR_REGSET_IN((ir_regset)ctx->used_preserved_regs, IR_REG_NUM(op2_reg))) {
4958
- ir_reg orig_op2_reg = op2_reg;
4959
- op2_reg = IR_REG_INT_TMP;
4960
-
4961
- ir_type type = ctx->ir_base[insn->op2].type;
4962
- | ASM_REG_REG_OP mov, type, op2_reg, IR_REG_NUM(orig_op2_reg)
4963
- } else {
4964
- op2_reg = IR_REG_NUM(op2_reg);
4965
- }
4966
- }
4967
-
4968
4938
ir_emit_epilogue(ctx);
4969
4939
4970
4940
if (IR_IS_CONST_REF(insn->op2)) {
@@ -4977,8 +4947,13 @@ static void ir_emit_tailcall(ir_ctx *ctx, ir_ref def, ir_insn *insn)
4977
4947
| br Rx(IR_REG_INT_TMP)
4978
4948
}
4979
4949
} else {
4950
+ ir_reg op2_reg = ctx->regs[def][2];
4951
+
4980
4952
IR_ASSERT(op2_reg != IR_REG_NONE);
4981
- IR_ASSERT(!IR_REGSET_IN((ir_regset)ctx->used_preserved_regs, op2_reg));
4953
+ if (IR_REG_SPILLED(op2_reg)) {
4954
+ op2_reg = IR_REG_NUM(op2_reg);
4955
+ ir_emit_load(ctx, IR_ADDR, op2_reg, insn->op2);
4956
+ }
4982
4957
| br Rx(op2_reg)
4983
4958
}
4984
4959
}
0 commit comments