Lines Matching refs:inv
94 bool can_prop_to_addr_uses; /* True if the corresponding inv can be
158 struct invariant *inv;
300 struct invariant *inv;
314 inv = invariant_for_use (use);
315 if (!inv)
318 gcc_assert (inv->eqto != ~0u);
319 return inv->eqto;
461 return invariant_expr_equal_p (entry1->inv->insn, entry1->expr,
462 entry2->inv->insn, entry2->expr);
469 insert INV to the table for this expression and return INV. */
473 struct invariant *inv)
475 hashval_t hash = hash_invariant_expr_1 (inv->insn, expr);
481 pentry.inv = inv;
487 return entry->inv;
490 entry->inv = inv;
496 return inv;
499 /* Finds invariants identical to INV and records the equivalence. EQ is the
503 find_identical_invariants (invariant_htab_type *eq, struct invariant *inv)
512 if (inv->eqto != ~0u)
515 EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, depno, bi)
521 set = single_set (inv->insn);
527 tmp = find_or_insert_inv (eq, expr, mode, inv);
528 inv->eqto = tmp->invno;
530 if (tmp->invno != inv->invno && inv->always_executed)
533 if (dump_file && inv->eqto != inv->invno)
536 inv->invno, inv->eqto);
545 struct invariant *inv;
548 FOR_EACH_VEC_ELT (invariants, i, inv)
549 find_identical_invariants (&eq, inv);
706 struct invariant *inv = XNEW (struct invariant);
710 inv->def = def;
711 inv->always_executed = always_executed;
712 inv->depends_on = depends_on;
718 inv->cost = set_rtx_cost (set, speed);
729 inv->cheap_address = address_cost (SET_SRC (set), word_mode,
732 inv->cheap_address = false;
736 inv->cost = set_src_cost (SET_SRC (set), GET_MODE (SET_DEST (set)),
738 inv->cheap_address = false;
741 inv->move = false;
742 inv->reg = NULL_RTX;
743 inv->orig_regno = -1;
744 inv->stamp = 0;
745 inv->insn = insn;
747 inv->invno = invariants.length ();
748 inv->eqto = ~0u;
751 inv->eqno = 1;
754 def->invno = inv->invno;
755 invariants.safe_push (inv);
761 INSN_UID (insn), inv->invno, inv->cost);
762 dump_bitmap (dump_file, inv->depends_on);
765 return inv;
898 struct invariant *inv;
904 inv = invariants[def->invno];
906 if (!inv->cheap_address)
909 def_insn = inv->insn;
960 use of the inv def. */
981 struct invariant *inv;
1010 inv = invariant_table[DF_REF_ID (def)];
1011 if (!inv)
1014 def_data = inv->def;
1074 powerful enough to handle such cases, just ignore the INV
1095 struct invariant *inv;
1136 inv = create_new_invariant (def, insn, depends_on, always_executed);
1142 invariant_table[DF_REF_ID (ref)] = inv;
1153 struct invariant *inv;
1157 inv = invariant_for_use (use);
1158 if (inv)
1159 record_use (inv->def, use);
1163 inv = invariant_for_use (use);
1164 if (inv)
1165 record_use (inv->def, use);
1305 /* Calculates cost and number of registers needed for moving invariant INV
1307 the REG_CLASS of INV. Return
1308 -1: if INV is invalid.
1309 0: if INV and its depends_on have same reg_class
1310 1: if INV and its depends_on have different reg_classes. */
1313 get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed,
1324 inv = invariants[inv->eqto];
1335 if (inv->move
1336 || inv->stamp == actual_stamp)
1338 inv->stamp = actual_stamp;
1347 pressure_class = get_pressure_class_and_nregs (inv->insn, &nregs);
1353 if (!inv->cheap_address
1354 || inv->def->n_uses == 0
1355 || inv->def->n_addr_uses < inv->def->n_uses
1356 /* Count cost if the inv can't be propagated into address uses. */
1357 || !inv->def->can_prop_to_addr_uses)
1358 (*comp_cost) += inv->cost * inv->eqno;
1378 rtx set = single_set (inv->insn);
1391 EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, depno, bi)
1437 pressure_class = get_pressure_class_and_nregs (inv->insn, &nregs);
1455 /* Calculates gain for eliminating invariant INV. REGS_USED is the number
1462 gain_for_invariant (struct invariant *inv, unsigned *regs_needed,
1474 ret = get_inv_cost (inv, &comp_cost, regs_needed, &cl);
1548 struct invariant *inv;
1552 FOR_EACH_VEC_ELT (invariants, invno, inv)
1554 if (inv->move)
1558 if (inv->eqto != inv->invno)
1561 again = gain_for_invariant (inv, aregs_needed, new_regs, regs_used,
1566 *best = inv;
1586 struct invariant *inv = invariants[invno];
1590 inv = invariants[inv->eqto];
1592 if (inv->move)
1594 inv->move = true;
1606 EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, invno, bi)
1619 struct invariant *inv = NULL;
1653 while ((gain = best_gain_for_invariant (&inv, regs_needed,
1657 set_move_mark (inv->invno, gain);
1669 /* Replace the uses, reached by the definition of invariant INV, by REG.
1676 replace_uses (struct invariant *inv, rtx reg, bool in_group)
1681 if (inv->def)
1684 for (use = inv->def->uses; use; use = use->next)
1695 /* Whether invariant INV setting REG can be moved out of LOOP, at the end of
1699 can_move_invariant_reg (class loop *loop, struct invariant *inv, rtx reg)
1703 rtx_insn *insn = inv->insn;
1704 basic_block bb = BLOCK_FOR_INSN (inv->insn);
1717 if (!inv->always_executed)
1785 struct invariant *inv = invariants[invno];
1786 struct invariant *repr = invariants[inv->eqto];
1793 if (inv->reg)
1801 if (inv == repr)
1803 if (inv->depends_on)
1805 EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, i, bi)
1814 set = single_set (inv->insn);
1821 if (!can_move_invariant_reg (loop, inv, dest))
1826 validate_change (inv->insn, &SET_DEST (set), reg, true);
1829 replace_uses (inv, reg, true);
1835 emit_insn_after (gen_move_insn (dest, reg), inv->insn);
1842 reorder_insns (inv->insn, inv->insn, BB_END (preheader));
1852 if ((note = find_reg_note (inv->insn, REG_EQUAL, NULL_RTX))
1853 && (!inv->always_executed
1855 remove_note (inv->insn, note);
1863 if (!replace_uses (inv, reg, false))
1865 set = single_set (inv->insn);
1866 emit_insn_after (gen_move_insn (SET_DEST (set), reg), inv->insn);
1867 delete_insn (inv->insn);
1870 inv->reg = reg;
1871 inv->orig_regno = regno;
1876 /* If we failed, clear move flag, so that we do not try to move inv
1880 inv->move = false;
1881 inv->reg = NULL_RTX;
1882 inv->orig_regno = -1;
1893 struct invariant *inv;
1896 FOR_EACH_VEC_ELT (invariants, i, inv)
1900 FOR_EACH_VEC_ELT (invariants, i, inv)
1901 if (inv->reg != NULL_RTX)
1903 if (inv->orig_regno >= 0)
1904 setup_reg_classes (REGNO (inv->reg),
1905 reg_preferred_class (inv->orig_regno),
1906 reg_alternate_class (inv->orig_regno),
1907 reg_allocno_class (inv->orig_regno));
1909 setup_reg_classes (REGNO (inv->reg),
1936 struct invariant *inv;
1941 inv = invariant_table[i];
1942 if (inv)
1944 def = inv->def;
1953 FOR_EACH_VEC_ELT (invariants, i, inv)
1955 BITMAP_FREE (inv->depends_on);
1956 free (inv);