/* Ensure an initialized instruction beyond the last one for HIOP checks. */
J->cur.nins = lj_ir_nextins(J);
- J->cur.ir[J->cur.nins].o = IR_NOP;
+ lj_ir_nop(&J->cur.ir[J->cur.nins]);
/* Setup initial state. Copy some fields to reduce indirections. */
as->J = J;
LJ_STATIC_ASSERT((int)IRT_GUARD == (int)IRM_W);
+/* Replace IR instruction with NOP. */
+static LJ_AINLINE void lj_ir_nop(IRIns *ir)
+{
+ ir->ot = IRT(IR_NOP, IRT_NIL);
+ ir->op1 = ir->op2 = 0;
+ ir->prev = 0;
+}
+
#endif
pchain[ir->o] = &ir->prev;
} else if (!ir_sideeff(ir)) {
*pchain[ir->o] = ir->prev; /* Reroute original instruction chain. */
- ir->t.irt = IRT_NIL;
- ir->o = IR_NOP; /* Replace instruction with NOP. */
- ir->op1 = ir->op2 = 0;
- ir->prev = 0;
+ lj_ir_nop(ir);
continue;
}
if (ir->op1 >= REF_FIRST) irt_setmark(IR(ir->op1)->t);
goto doemit; /* No elimination possible. */
/* Remove redundant store from chain and replace with NOP. */
*refp = store->prev;
- store->o = IR_NOP;
- store->t.irt = IRT_NIL;
- store->op1 = store->op2 = 0;
- store->prev = 0;
+ lj_ir_nop(store);
/* Now emit the new store instead. */
}
goto doemit;
goto doemit; /* No elimination possible. */
/* Remove redundant store from chain and replace with NOP. */
*refp = store->prev;
- store->o = IR_NOP;
- store->t.irt = IRT_NIL;
- store->op1 = store->op2 = 0;
- store->prev = 0;
+ lj_ir_nop(store);
if (ref+1 < J->cur.nins &&
store[1].o == IR_OBAR && store[1].op1 == xref) {
IRRef1 *bp = &J->chain[IR_OBAR];
bp = &obar->prev;
/* Remove OBAR, too. */
*bp = obar->prev;
- obar->o = IR_NOP;
- obar->t.irt = IRT_NIL;
- obar->op1 = obar->op2 = 0;
- obar->prev = 0;
+ lj_ir_nop(obar);
}
/* Now emit the new store instead. */
}
goto doemit; /* No elimination possible. */
/* Remove redundant store from chain and replace with NOP. */
*refp = store->prev;
- store->o = IR_NOP;
- store->t.irt = IRT_NIL;
- store->op1 = store->op2 = 0;
- store->prev = 0;
+ lj_ir_nop(store);
/* Now emit the new store instead. */
}
goto doemit;
goto doemit; /* No elimination possible. */
/* Remove redundant store from chain and replace with NOP. */
*refp = store->prev;
- store->o = IR_NOP;
- store->t.irt = IRT_NIL;
- store->op1 = store->op2 = 0;
- store->prev = 0;
+ lj_ir_nop(store);
/* Now emit the new store instead. */
}
goto doemit;