2 * local-propagation.c: Local constant, copy and tree propagation.
4 * To make some sense of the tree mover, read mono/docs/tree-mover.txt
7 * Paolo Molaro (lupus@ximian.com)
8 * Dietmar Maurer (dietmar@ximian.com)
9 * Massimiliano Mantione (massi@ximian.com)
11 * (C) 2006 Novell, Inc. http://www.novell.com
12 * Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
24 #include <mono/metadata/debug-helpers.h>
25 #include <mono/metadata/mempool.h>
26 #include <mono/metadata/opcodes.h>
30 #ifndef MONO_ARCH_IS_OP_MEMBASE
31 #define MONO_ARCH_IS_OP_MEMBASE(opcode) FALSE
34 static inline MonoBitSet*
35 mono_bitset_mp_new_noinit (MonoMemPool *mp, guint32 max_size)
37 int size = mono_bitset_alloc_size (max_size, 0);
40 mem = mono_mempool_alloc (mp, size);
41 return mono_bitset_mem_new (mem, max_size, MONO_BITSET_DONT_FREE);
45 * Replaces ins with optimized opcodes.
47 * We can emit to cbb the equivalent instructions which will be used as
48 * replacement for ins, or simply change the fields of ins. Spec needs to
49 * be updated if we silently change the opcode of ins.
51 * Returns TRUE if additional vregs were allocated.
54 mono_strength_reduction_ins (MonoCompile *cfg, MonoInst *ins, const char **spec)
56 gboolean allocated_vregs = FALSE;
58 /* FIXME: Add long/float */
59 switch (ins->opcode) {
62 if (ins->dreg == ins->sreg1) {
70 #if SIZEOF_REGISTER == 8
74 if (ins->inst_imm == 0) {
75 ins->opcode = OP_MOVE;
80 #if SIZEOF_REGISTER == 8
83 if (ins->inst_imm == 0) {
84 ins->opcode = (ins->opcode == OP_LMUL_IMM) ? OP_I8CONST : OP_ICONST;
87 } else if (ins->inst_imm == 1) {
88 ins->opcode = OP_MOVE;
89 } else if ((ins->opcode == OP_IMUL_IMM) && (ins->inst_imm == -1)) {
90 ins->opcode = OP_INEG;
91 } else if ((ins->opcode == OP_LMUL_IMM) && (ins->inst_imm == -1)) {
92 ins->opcode = OP_LNEG;
94 int power2 = mono_is_power_of_two (ins->inst_imm);
96 ins->opcode = (ins->opcode == OP_MUL_IMM) ? OP_SHL_IMM : ((ins->opcode == OP_LMUL_IMM) ? OP_LSHL_IMM : OP_ISHL_IMM);
97 ins->inst_imm = power2;
102 case OP_IDIV_UN_IMM: {
103 int c = ins->inst_imm;
104 int power2 = mono_is_power_of_two (c);
107 if (ins->opcode == OP_IREM_UN_IMM) {
108 ins->opcode = OP_IAND_IMM;
110 ins->inst_imm = (1 << power2) - 1;
111 } else if (ins->opcode == OP_IDIV_UN_IMM) {
112 ins->opcode = OP_ISHR_UN_IMM;
114 ins->inst_imm = power2;
120 int c = ins->inst_imm;
121 int power2 = mono_is_power_of_two (c);
124 int r1 = mono_alloc_ireg (cfg);
126 MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_UN_IMM, r1, ins->sreg1, 31);
127 MONO_EMIT_NEW_BIALU (cfg, OP_IADD, r1, r1, ins->sreg1);
128 MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_IMM, ins->dreg, r1, 1);
130 allocated_vregs = TRUE;
131 } else if (power2 > 0 && power2 < 31) {
132 int r1 = mono_alloc_ireg (cfg);
134 MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_IMM, r1, ins->sreg1, 31);
135 MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_UN_IMM, r1, r1, (32 - power2));
136 MONO_EMIT_NEW_BIALU (cfg, OP_IADD, r1, r1, ins->sreg1);
137 MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_IMM, ins->dreg, r1, power2);
139 allocated_vregs = TRUE;
143 #if SIZEOF_REGISTER == 8
147 int power = mono_is_power_of_two (ins->inst_imm);
148 if (ins->inst_imm == 1) {
149 ins->opcode = OP_ICONST;
150 MONO_INST_NULLIFY_SREGS (ins);
155 } else if ((ins->inst_imm > 0) && (ins->inst_imm < (1LL << 32)) && (power != -1)) {
156 gboolean is_long = ins->opcode == OP_LREM_IMM;
157 int compensator_reg = alloc_ireg (cfg);
158 int intermediate_reg;
160 /* Based on gcc code */
162 /* Add compensation for negative numerators */
165 intermediate_reg = compensator_reg;
166 MONO_EMIT_NEW_BIALU_IMM (cfg, is_long ? OP_LSHR_IMM : OP_ISHR_IMM, intermediate_reg, ins->sreg1, is_long ? 63 : 31);
168 intermediate_reg = ins->sreg1;
171 MONO_EMIT_NEW_BIALU_IMM (cfg, is_long ? OP_LSHR_UN_IMM : OP_ISHR_UN_IMM, compensator_reg, intermediate_reg, (is_long ? 64 : 32) - power);
172 MONO_EMIT_NEW_BIALU (cfg, is_long ? OP_LADD : OP_IADD, ins->dreg, ins->sreg1, compensator_reg);
173 /* Compute remainder */
174 MONO_EMIT_NEW_BIALU_IMM (cfg, is_long ? OP_LAND_IMM : OP_AND_IMM, ins->dreg, ins->dreg, (1 << power) - 1);
175 /* Remove compensation */
176 MONO_EMIT_NEW_BIALU (cfg, is_long ? OP_LSUB : OP_ISUB, ins->dreg, ins->dreg, compensator_reg);
178 allocated_vregs = TRUE;
188 *spec = INS_INFO (ins->opcode);
189 return allocated_vregs;
195 * A combined local copy and constant propagation pass.
198 mono_local_cprop (MonoCompile *cfg)
200 MonoBasicBlock *bb, *bb_opt;
204 int filter = FILTER_IL_SEQ_POINT;
205 int initial_max_vregs = cfg->next_vreg;
207 max = cfg->next_vreg;
208 defs = (MonoInst **)mono_mempool_alloc (cfg->mempool, sizeof (MonoInst*) * cfg->next_vreg);
209 def_index = (gint32 *)mono_mempool_alloc (cfg->mempool, sizeof (guint32) * cfg->next_vreg);
210 cfg->cbb = bb_opt = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoBasicBlock));
212 for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
217 /* Manually init the defs entries used by the bblock */
218 MONO_BB_FOR_EACH_INS (bb, ins) {
219 int sregs [MONO_MAX_SRC_REGS];
222 if ((ins->dreg != -1) && (ins->dreg < max)) {
223 defs [ins->dreg] = NULL;
224 #if SIZEOF_REGISTER == 4
225 defs [ins->dreg + 1] = NULL;
229 num_sregs = mono_inst_get_src_registers (ins, sregs);
230 for (i = 0; i < num_sregs; ++i) {
231 int sreg = sregs [i];
234 #if SIZEOF_REGISTER == 4
235 defs [sreg + 1] = NULL;
242 last_call_index = -1;
243 MONO_BB_FOR_EACH_INS (bb, ins) {
244 const char *spec = INS_INFO (ins->opcode);
245 int regtype, srcindex, sreg;
247 int sregs [MONO_MAX_SRC_REGS];
249 if (ins->opcode == OP_NOP) {
250 MONO_DELETE_INS (bb, ins);
254 g_assert (ins->opcode > MONO_CEE_LAST);
256 /* FIXME: Optimize this */
257 if (ins->opcode == OP_LDADDR) {
258 MonoInst *var = (MonoInst *)ins->inst_p0;
260 defs [var->dreg] = NULL;
262 if (!MONO_TYPE_ISSTRUCT (var->inst_vtype))
267 if (MONO_IS_STORE_MEMBASE (ins)) {
271 if ((regtype == 'i') && (sreg != -1) && defs [sreg]) {
272 MonoInst *def = defs [sreg];
274 if ((def->opcode == OP_MOVE) && (!defs [def->sreg1] || (def_index [def->sreg1] < def_index [sreg])) && !vreg_is_volatile (cfg, def->sreg1)) {
275 int vreg = def->sreg1;
276 if (cfg->verbose_level > 2) printf ("CCOPY: R%d -> R%d\n", sreg, vreg);
282 num_sregs = mono_inst_get_src_registers (ins, sregs);
283 for (srcindex = 0; srcindex < num_sregs; ++srcindex) {
286 mono_inst_get_src_registers (ins, sregs);
288 regtype = spec [MONO_INST_SRC1 + srcindex];
289 sreg = sregs [srcindex];
291 if ((regtype == ' ') || (sreg == -1) || (!defs [sreg]))
296 /* Copy propagation */
298 * The first check makes sure the source of the copy did not change since
300 * The second check avoids volatile variables.
301 * The third check avoids copy propagating local vregs through a call,
302 * since the lvreg will be spilled
303 * The fourth check avoids copy propagating a vreg in cases where
304 * it would be eliminated anyway by reverse copy propagation later,
305 * because propagating it would create another use for it, thus making
306 * it impossible to use reverse copy propagation.
308 /* Enabling this for floats trips up the fp stack */
310 * Enabling this for floats on amd64 seems to cause a failure in
311 * basic-math.cs, most likely because it gets rid of some r8->r4
314 if (MONO_IS_MOVE (def) &&
315 (!defs [def->sreg1] || (def_index [def->sreg1] < def_index [sreg])) &&
316 !vreg_is_volatile (cfg, def->sreg1) &&
317 /* This avoids propagating local vregs across calls */
318 ((get_vreg_to_inst (cfg, def->sreg1) || !defs [def->sreg1] || (def_index [def->sreg1] >= last_call_index) || (def->opcode == OP_VMOVE))) &&
319 !(defs [def->sreg1] && mono_inst_next (defs [def->sreg1], filter) == def) &&
320 (!MONO_ARCH_USE_FPSTACK || (def->opcode != OP_FMOVE)) &&
321 (def->opcode != OP_FMOVE)) {
322 int vreg = def->sreg1;
324 if (cfg->verbose_level > 2) printf ("CCOPY/2: R%d -> R%d\n", sreg, vreg);
325 sregs [srcindex] = vreg;
326 mono_inst_set_src_registers (ins, sregs);
328 /* Allow further iterations */
333 /* Constant propagation */
334 /* FIXME: Make is_inst_imm a macro */
335 /* FIXME: Make is_inst_imm take an opcode argument */
336 /* is_inst_imm is only needed for binops */
337 if ((((def->opcode == OP_ICONST) || ((sizeof (gpointer) == 8) && (def->opcode == OP_I8CONST))) &&
338 (((srcindex == 0) && (ins->sreg2 == -1)) || mono_arch_is_inst_imm (def->inst_c0))) ||
339 (!MONO_ARCH_USE_FPSTACK && (def->opcode == OP_R8CONST))) {
342 /* srcindex == 1 -> binop, ins->sreg2 == -1 -> unop */
343 if ((srcindex == 1) && (ins->sreg1 != -1) && defs [ins->sreg1] && (defs [ins->sreg1]->opcode == OP_ICONST) && defs [ins->sreg2]) {
344 /* Both arguments are constants, perform cfold */
345 mono_constant_fold_ins (cfg, ins, defs [ins->sreg1], defs [ins->sreg2], TRUE);
346 } else if ((srcindex == 0) && (ins->sreg2 != -1) && defs [ins->sreg2]) {
347 /* Arg 1 is constant, swap arguments if possible */
348 int opcode = ins->opcode;
349 mono_constant_fold_ins (cfg, ins, defs [ins->sreg1], defs [ins->sreg2], TRUE);
350 if (ins->opcode != opcode) {
351 /* Allow further iterations */
355 } else if ((srcindex == 0) && (ins->sreg2 == -1)) {
356 /* Constant unop, perform cfold */
357 mono_constant_fold_ins (cfg, ins, defs [ins->sreg1], NULL, TRUE);
360 opcode2 = mono_op_to_op_imm (ins->opcode);
361 if ((opcode2 != -1) && mono_arch_is_inst_imm (def->inst_c0) && ((srcindex == 1) || (ins->sreg2 == -1))) {
362 ins->opcode = opcode2;
363 if ((def->opcode == OP_I8CONST) && (sizeof (gpointer) == 4)) {
364 ins->inst_ls_word = def->inst_ls_word;
365 ins->inst_ms_word = def->inst_ms_word;
367 ins->inst_imm = def->inst_c0;
369 sregs [srcindex] = -1;
370 mono_inst_set_src_registers (ins, sregs);
372 if ((opcode2 == OP_VOIDCALL) || (opcode2 == OP_CALL) || (opcode2 == OP_LCALL) || (opcode2 == OP_FCALL))
373 ((MonoCallInst*)ins)->fptr = (gpointer)ins->inst_imm;
375 /* Allow further iterations */
381 #if defined(TARGET_X86) || defined(TARGET_AMD64)
382 if ((ins->opcode == OP_X86_LEA) && (srcindex == 1)) {
383 #if SIZEOF_REGISTER == 8
384 /* FIXME: Use OP_PADD_IMM when the new JIT is done */
385 ins->opcode = OP_LADD_IMM;
387 ins->opcode = OP_ADD_IMM;
389 ins->inst_imm += def->inst_c0 << ins->backend.shift_amount;
393 opcode2 = mono_load_membase_to_load_mem (ins->opcode);
394 if ((srcindex == 0) && (opcode2 != -1) && mono_arch_is_inst_imm (def->inst_c0)) {
395 ins->opcode = opcode2;
396 ins->inst_imm = def->inst_c0 + ins->inst_offset;
401 else if (((def->opcode == OP_ADD_IMM) || (def->opcode == OP_LADD_IMM)) && (MONO_IS_LOAD_MEMBASE (ins) || MONO_ARCH_IS_OP_MEMBASE (ins->opcode))) {
402 /* ADD_IMM is created by spill_global_vars */
404 * We have to guarantee that def->sreg1 haven't changed since def->dreg
405 * was defined. cfg->frame_reg is assumed to remain constant.
407 if ((def->sreg1 == cfg->frame_reg) || ((mono_inst_next (def, filter) == ins) && (def->dreg != def->sreg1))) {
408 ins->inst_basereg = def->sreg1;
409 ins->inst_offset += def->inst_imm;
411 } else if ((ins->opcode == OP_ISUB_IMM) && (def->opcode == OP_IADD_IMM) && (mono_inst_next (def, filter) == ins) && (def->dreg != def->sreg1)) {
412 ins->sreg1 = def->sreg1;
413 ins->inst_imm -= def->inst_imm;
414 } else if ((ins->opcode == OP_IADD_IMM) && (def->opcode == OP_ISUB_IMM) && (mono_inst_next (def, filter) == ins) && (def->dreg != def->sreg1)) {
415 ins->sreg1 = def->sreg1;
416 ins->inst_imm -= def->inst_imm;
417 } else if (ins->opcode == OP_STOREI1_MEMBASE_REG &&
418 (def->opcode == OP_ICONV_TO_U1 || def->opcode == OP_ICONV_TO_I1 || def->opcode == OP_SEXT_I4 || (SIZEOF_REGISTER == 8 && def->opcode == OP_LCONV_TO_U1)) &&
419 (!defs [def->sreg1] || (def_index [def->sreg1] < def_index [sreg]))) {
420 /* Avoid needless sign extension */
421 ins->sreg1 = def->sreg1;
422 } else if (ins->opcode == OP_STOREI2_MEMBASE_REG &&
423 (def->opcode == OP_ICONV_TO_U2 || def->opcode == OP_ICONV_TO_I2 || def->opcode == OP_SEXT_I4 || (SIZEOF_REGISTER == 8 && def->opcode == OP_LCONV_TO_I2)) &&
424 (!defs [def->sreg1] || (def_index [def->sreg1] < def_index [sreg]))) {
425 /* Avoid needless sign extension */
426 ins->sreg1 = def->sreg1;
430 g_assert (cfg->cbb == bb_opt);
431 g_assert (!bb_opt->code);
432 /* Do strength reduction here */
433 if (mono_strength_reduction_ins (cfg, ins, &spec) && max < cfg->next_vreg) {
434 MonoInst **defs_prev = defs;
435 gint32 *def_index_prev = def_index;
436 guint32 prev_max = max;
437 guint32 additional_vregs = cfg->next_vreg - initial_max_vregs;
439 /* We have more vregs so we need to reallocate defs and def_index arrays */
440 max = initial_max_vregs + additional_vregs * 2;
441 defs = (MonoInst **)mono_mempool_alloc (cfg->mempool, sizeof (MonoInst*) * max);
442 def_index = (gint32 *)mono_mempool_alloc (cfg->mempool, sizeof (guint32) * max);
444 /* Keep the entries for the previous vregs, zero the rest */
445 memcpy (defs, defs_prev, sizeof (MonoInst*) * prev_max);
446 memset (defs + prev_max, 0, sizeof (MonoInst*) * (max - prev_max));
447 memcpy (def_index, def_index_prev, sizeof (guint32) * prev_max);
448 memset (def_index + prev_max, 0, sizeof (guint32) * (max - prev_max));
451 if (cfg->cbb->code || (cfg->cbb != bb_opt)) {
452 MonoInst *saved_prev = ins->prev;
454 /* If we have code in cbb, we need to replace ins with the decomposition */
455 mono_replace_ins (cfg, bb, ins, &ins->prev, bb_opt, cfg->cbb);
456 bb_opt->code = bb_opt->last_ins = NULL;
457 bb_opt->in_count = bb_opt->out_count = 0;
460 /* ins is hanging, continue scanning the emitted code */
465 if (spec [MONO_INST_DEST] != ' ') {
466 MonoInst *def = defs [ins->dreg];
468 if (def && (def->opcode == OP_ADD_IMM) && (def->sreg1 == cfg->frame_reg) && (MONO_IS_STORE_MEMBASE (ins))) {
469 /* ADD_IMM is created by spill_global_vars */
470 /* cfg->frame_reg is assumed to remain constant */
471 ins->inst_destbasereg = def->sreg1;
472 ins->inst_offset += def->inst_imm;
476 if ((spec [MONO_INST_DEST] != ' ') && !MONO_IS_STORE_MEMBASE (ins) && !vreg_is_volatile (cfg, ins->dreg)) {
477 defs [ins->dreg] = ins;
478 def_index [ins->dreg] = ins_index;
481 if (MONO_IS_CALL (ins))
482 last_call_index = ins_index;
489 static inline gboolean
490 reg_is_softreg_no_fpstack (int reg, const char spec)
492 return (spec == 'i' && reg >= MONO_MAX_IREGS)
493 || ((spec == 'f' && reg >= MONO_MAX_FREGS) && !MONO_ARCH_USE_FPSTACK)
494 #ifdef MONO_ARCH_SIMD_INTRINSICS
495 || (spec == 'x' && reg >= MONO_MAX_XREGS)
500 static inline gboolean
501 reg_is_softreg (int reg, const char spec)
503 return (spec == 'i' && reg >= MONO_MAX_IREGS)
504 || (spec == 'f' && reg >= MONO_MAX_FREGS)
505 #ifdef MONO_ARCH_SIMD_INTRINSICS
506 || (spec == 'x' && reg >= MONO_MAX_XREGS)
511 static inline gboolean
512 mono_is_simd_accessor (MonoInst *ins)
514 switch (ins->opcode) {
515 #ifdef MONO_ARCH_SIMD_INTRINSICS
523 case OP_INSERTX_U1_SLOW:
524 case OP_INSERTX_I4_SLOW:
525 case OP_INSERTX_R4_SLOW:
526 case OP_INSERTX_R8_SLOW:
527 case OP_INSERTX_I8_SLOW:
538 * Get rid of the dead assignments to local vregs like the ones created by the
542 mono_local_deadce (MonoCompile *cfg)
545 MonoInst *ins, *prev;
546 MonoBitSet *used, *defined;
548 //mono_print_code (cfg, "BEFORE LOCAL-DEADCE");
551 * Assignments to global vregs can't be eliminated so this pass must come
552 * after the handle_global_vregs () pass.
555 used = mono_bitset_mp_new_noinit (cfg->mempool, cfg->next_vreg + 1);
556 defined = mono_bitset_mp_new_noinit (cfg->mempool, cfg->next_vreg + 1);
558 /* First pass: collect liveness info */
559 for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
560 /* Manually init the defs entries used by the bblock */
561 MONO_BB_FOR_EACH_INS (bb, ins) {
562 const char *spec = INS_INFO (ins->opcode);
563 int sregs [MONO_MAX_SRC_REGS];
566 if (spec [MONO_INST_DEST] != ' ') {
567 mono_bitset_clear_fast (used, ins->dreg);
568 mono_bitset_clear_fast (defined, ins->dreg);
569 #if SIZEOF_REGISTER == 4
571 mono_bitset_clear_fast (used, ins->dreg + 1);
572 mono_bitset_clear_fast (defined, ins->dreg + 1);
575 num_sregs = mono_inst_get_src_registers (ins, sregs);
576 for (i = 0; i < num_sregs; ++i) {
577 mono_bitset_clear_fast (used, sregs [i]);
578 #if SIZEOF_REGISTER == 4
579 mono_bitset_clear_fast (used, sregs [i] + 1);
585 * Make a reverse pass over the instruction list
587 MONO_BB_FOR_EACH_INS_REVERSE_SAFE (bb, prev, ins) {
588 const char *spec = INS_INFO (ins->opcode);
589 int sregs [MONO_MAX_SRC_REGS];
591 MonoInst *prev_f = mono_inst_prev (ins, FILTER_NOP | FILTER_IL_SEQ_POINT);
593 if (ins->opcode == OP_NOP) {
594 MONO_DELETE_INS (bb, ins);
598 g_assert (ins->opcode > MONO_CEE_LAST);
600 if (MONO_IS_NON_FP_MOVE (ins) && prev_f) {
605 spec2 = INS_INFO (def->opcode);
608 * Perform a limited kind of reverse copy propagation, i.e.
609 * transform B <- FOO; A <- B into A <- FOO
610 * This isn't copyprop, not deadce, but it can only be performed
611 * after handle_global_vregs () has run.
613 if (!get_vreg_to_inst (cfg, ins->sreg1) && (spec2 [MONO_INST_DEST] != ' ') && (def->dreg == ins->sreg1) && !mono_bitset_test_fast (used, ins->sreg1) && !MONO_IS_STORE_MEMBASE (def) && reg_is_softreg (ins->sreg1, spec [MONO_INST_DEST]) && !mono_is_simd_accessor (def)) {
614 if (cfg->verbose_level > 2) {
615 printf ("\tReverse copyprop in BB%d on ", bb->block_num);
616 mono_print_ins (ins);
619 def->dreg = ins->dreg;
620 MONO_DELETE_INS (bb, ins);
621 spec = INS_INFO (ins->opcode);
625 /* Enabling this on x86 could screw up the fp stack */
626 if (reg_is_softreg_no_fpstack (ins->dreg, spec [MONO_INST_DEST])) {
628 * Assignments to global vregs can only be eliminated if there is another
629 * assignment to the same vreg later in the same bblock.
631 if (!mono_bitset_test_fast (used, ins->dreg) &&
632 (!get_vreg_to_inst (cfg, ins->dreg) || (!bb->extended && !vreg_is_volatile (cfg, ins->dreg) && mono_bitset_test_fast (defined, ins->dreg))) &&
633 MONO_INS_HAS_NO_SIDE_EFFECT (ins)) {
634 /* Happens with CMOV instructions */
635 if (prev_f && prev_f->opcode == OP_ICOMPARE_IMM) {
636 MonoInst *prev = prev_f;
638 * Can't use DELETE_INS since that would interfere with the
643 //printf ("DEADCE: "); mono_print_ins (ins);
644 MONO_DELETE_INS (bb, ins);
645 spec = INS_INFO (ins->opcode);
648 if (spec [MONO_INST_DEST] != ' ')
649 mono_bitset_clear_fast (used, ins->dreg);
652 if (spec [MONO_INST_DEST] != ' ')
653 mono_bitset_set_fast (defined, ins->dreg);
654 num_sregs = mono_inst_get_src_registers (ins, sregs);
655 for (i = 0; i < num_sregs; ++i)
656 mono_bitset_set_fast (used, sregs [i]);
657 if (MONO_IS_STORE_MEMBASE (ins))
658 mono_bitset_set_fast (used, ins->dreg);
660 if (MONO_IS_CALL (ins)) {
661 MonoCallInst *call = (MonoCallInst*)ins;
664 if (call->out_ireg_args) {
665 for (l = call->out_ireg_args; l; l = l->next) {
666 guint32 regpair, reg;
668 regpair = (guint32)(gssize)(l->data);
669 reg = regpair & 0xffffff;
671 mono_bitset_set_fast (used, reg);
675 if (call->out_freg_args) {
676 for (l = call->out_freg_args; l; l = l->next) {
677 guint32 regpair, reg;
679 regpair = (guint32)(gssize)(l->data);
680 reg = regpair & 0xffffff;
682 mono_bitset_set_fast (used, reg);
689 //mono_print_code (cfg, "AFTER LOCAL-DEADCE");
692 #endif /* DISABLE_JIT */