*参照元 [#cb5d69fa] #backlinks *説明 [#h79f9309] -パス: [[gcc-8.3/gcc/lra-spills.c]] -FIXME: これは何? --説明 **引数 [#v4f4637d] -なし **返り値 [#afb252d2] -なし **参考 [#yd0a3eab] *実装 [#q31e904c] /* Final change of pseudos got hard registers into the corresponding hard registers and removing temporary clobbers. */ void lra_final_code_change (void) { int i, hard_regno; basic_block bb; rtx_insn *insn, *curr; int max_regno = max_reg_num (); - --[[gcc-8.3/gcc/basic_block]] --[[gcc-8.3/gcc/rtx_insn]] --[[gcc-8.3/gcc/max_reg_num()]] for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) if (lra_reg_info[i].nrefs != 0 && (hard_regno = lra_get_regno_hard_regno (i)) >= 0) SET_REGNO (regno_reg_rtx[i], hard_regno); - --[[gcc-8.3/gcc/lra_get_regno_hard_regno()]] --[[gcc-8.3/gcc/SET_REGNO()]] FOR_EACH_BB_FN (bb, cfun) FOR_BB_INSNS_SAFE (bb, insn, curr) if (INSN_P (insn)) { - --[[gcc-8.3/gcc/FOR_EACH_BB_FN()]] --[[gcc-8.3/gcc/FOR_BB_INSNS_SAFE()]] --[[gcc-8.3/gcc/INSN_P()]] rtx pat = PATTERN (insn); if (GET_CODE (pat) == CLOBBER && LRA_TEMP_CLOBBER_P (pat)) { /* Remove clobbers temporarily created in LRA. We don't need them anymore and don't want to waste compiler time processing them in a few subsequent passes. */ lra_invalidate_insn_data (insn); delete_insn (insn); continue; } - --[[gcc-8.3/gcc/rtx]] --[[gcc-8.3/gcc/PATTERN()]] --[[gcc-8.3/gcc/GET_CODE()]] --[[gcc-8.3/gcc/LRA_TEMP_CLOBBER_P()]] --[[gcc-8.3/gcc/lra_invalidate_insn_data()]] --[[gcc-8.3/gcc/delete_insn()]] /* IRA can generate move insns involving pseudos. It is better remove them earlier to speed up compiler a bit. It is also better to do it here as they might not pass final RTL check in LRA, (e.g. insn moving a control register into itself). So remove an useless move insn unless next insn is USE marking the return reg (we should save this as some subsequent optimizations assume that such original insns are saved). */ if (NONJUMP_INSN_P (insn) && GET_CODE (pat) == SET && REG_P (SET_SRC (pat)) && REG_P (SET_DEST (pat)) && REGNO (SET_SRC (pat)) == REGNO (SET_DEST (pat)) && (! return_regno_p (REGNO (SET_SRC (pat))) || ! regno_in_use_p (insn, REGNO (SET_SRC (pat))))) { lra_invalidate_insn_data (insn); delete_insn (insn); continue; } - --[[gcc-8.3/gcc/NONJUMP_INSN_P()]] --[[gcc-8.3/gcc/GET_CODE()]] --[[gcc-8.3/gcc/REG_P()]] --[[gcc-8.3/gcc/SET_SRC()]] --[[gcc-8.3/gcc/SET_DEST()]] --[[gcc-8.3/gcc/REGNO()]] --[[gcc-8.3/gcc/return_regno_p()]] --[[gcc-8.3/gcc/regno_in_use_p()]] --[[gcc-8.3/gcc/lra_invalidate_insn_data()]] --[[gcc-8.3/gcc/delete_insn()]] lra_insn_recog_data_t id = lra_get_insn_recog_data (insn); struct lra_insn_reg *reg; for (reg = id->regs; reg != NULL; reg = reg->next) if (reg->regno >= FIRST_PSEUDO_REGISTER && lra_reg_info [reg->regno].nrefs == 0) break; - --[[gcc-8.3/gcc/lra_insn_recog_data_t]] --[[gcc-8.3/gcc/lra_insn_reg]] if (reg != NULL) { /* Pseudos still can be in debug insns in some very rare and complicated cases, e.g. the pseudo was removed by inheritance and the debug insn is not EBBs where the inheritance happened. It is difficult and time consuming to find what hard register corresponds the pseudo -- so just remove the debug insn. Another solution could be assigning hard reg/memory but it would be a misleading info. It is better not to have info than have it wrong. */ lra_assert (DEBUG_INSN_P (insn)); lra_invalidate_insn_data (insn); delete_insn (insn); continue; } - --[[gcc-8.3/gcc/lra_assert()]] --[[gcc-8.3/gcc/DEBUG_INSN_P()]] --[[gcc-8.3/gcc/lra_invalidate_insn_data()]] --[[gcc-8.3/gcc/delete_insn()]] struct lra_static_insn_data *static_id = id->insn_static_data; bool insn_change_p = false; for (i = id->insn_static_data->n_operands - 1; i >= 0; i--) if ((DEBUG_INSN_P (insn) || ! static_id->operand[i].is_operator) && alter_subregs (id->operand_loc[i], ! DEBUG_INSN_P (insn))) { lra_update_dup (id, i); insn_change_p = true; } if (insn_change_p) lra_update_operator_dups (id); } - --[[gcc-8.3/gcc/lra_static_insn_data]] --[[gcc-8.3/gcc/DEBUG_INSN_P()]] --[[gcc-8.3/gcc/alter_subregs()]] --[[gcc-8.3/gcc/lra_update_dup()]] --[[gcc-8.3/gcc/lra_update_operator_dups()]] } *コメント [#hf507037]