From 8df47bdf99b8eb5d68736fe058559899c4270e4f Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Mon, 6 Aug 2018 09:57:03 +0000 Subject: Remaining support for clobber high gcc/ * alias.c (record_set): Check for clobber high. * cfgexpand.c (expand_gimple_stmt): Likewise. * combine-stack-adj.c (single_set_for_csa): Likewise. * combine.c (find_single_use_1): Likewise. (set_nonzero_bits_and_sign_copies): Likewise. (get_combine_src_dest): Likewise. (is_parallel_of_n_reg_sets): Likewise. (try_combine): Likewise. (record_dead_and_set_regs_1): Likewise. (reg_dead_at_p_1): Likewise. (reg_dead_at_p): Likewise. * dce.c (deletable_insn_p): Likewise. (mark_nonreg_stores_1): Likewise. (mark_nonreg_stores_2): Likewise. * df-scan.c (df_find_hard_reg_defs): Likewise. (df_uses_record): Likewise. (df_get_call_refs): Likewise. * dwarf2out.c (mem_loc_descriptor): Likewise. * haifa-sched.c (haifa_classify_rtx): Likewise. * ira-build.c (create_insn_allocnos): Likewise. * ira-costs.c (scan_one_insn): Likewise. * ira.c (equiv_init_movable_p): Likewise. (rtx_moveable_p): Likewise. (interesting_dest_for_shprep): Likewise. * jump.c (mark_jump_label_1): Likewise. * postreload-gcse.c (record_opr_changes): Likewise. * postreload.c (reload_cse_simplify): Likewise. (struct reg_use): Add source expr. (reload_combine): Check for clobber high. (reload_combine_note_use): Likewise. (reload_cse_move2add): Likewise. (move2add_note_store): Likewise. * print-rtl.c (print_pattern): Likewise. * recog.c (decode_asm_operands): Likewise. (store_data_bypass_p): Likewise. (if_test_bypass_p): Likewise. * regcprop.c (kill_clobbered_value): Likewise. (kill_set_value): Likewise. * reginfo.c (reg_scan_mark_refs): Likewise. * reload1.c (maybe_fix_stack_asms): Likewise. (eliminate_regs_1): Likewise. (elimination_effects): Likewise. (mark_not_eliminable): Likewise. (scan_paradoxical_subregs): Likewise. (forget_old_reloads_1): Likewise. * reorg.c (find_end_label): Likewise. (try_merge_delay_insns): Likewise. (redundant_insn): Likewise. (own_thread_p): Likewise. (fill_simple_delay_slots): Likewise. (fill_slots_from_thread): Likewise. (dbr_schedule): Likewise. * resource.c (update_live_status): Likewise. (mark_referenced_resources): Likewise. (mark_set_resources): Likewise. * rtl.c (copy_rtx): Likewise. * rtlanal.c (reg_referenced_p): Likewise. (single_set_2): Likewise. (noop_move_p): Likewise. (note_stores): Likewise. * sched-deps.c (sched_analyze_reg): Likewise. (sched_analyze_insn): Likewise. From-SVN: r263331 --- gcc/postreload.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'gcc/postreload.c') diff --git a/gcc/postreload.c b/gcc/postreload.c index 0638709..56cb14d 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -133,6 +133,8 @@ reload_cse_simplify (rtx_insn *insn, rtx testreg) for (i = XVECLEN (body, 0) - 1; i >= 0; --i) { rtx part = XVECEXP (body, 0, i); + /* asms can only have full clobbers, not clobber_highs. */ + gcc_assert (GET_CODE (part) != CLOBBER_HIGH); if (GET_CODE (part) == CLOBBER && REG_P (XEXP (part, 0))) cselib_invalidate_rtx (XEXP (part, 0)); } @@ -156,6 +158,7 @@ reload_cse_simplify (rtx_insn *insn, rtx testreg) } } else if (GET_CODE (part) != CLOBBER + && GET_CODE (part) != CLOBBER_HIGH && GET_CODE (part) != USE) break; } @@ -667,7 +670,8 @@ struct reg_use STORE_RUID is always meaningful if we only want to use a value in a register in a different place: it denotes the next insn in the insn stream (i.e. the last encountered) that sets or clobbers the register. - REAL_STORE_RUID is similar, but clobbers are ignored when updating it. */ + REAL_STORE_RUID is similar, but clobbers are ignored when updating it. + EXPR is the expression used when storing the register. */ static struct { struct reg_use reg_use[RELOAD_COMBINE_MAX_USES]; @@ -677,6 +681,7 @@ static struct int real_store_ruid; int use_ruid; bool all_offsets_match; + rtx expr; } reg_state[FIRST_PSEUDO_REGISTER]; /* Reverse linear uid. This is increased in reload_combine while scanning @@ -1341,6 +1346,10 @@ reload_combine (void) { rtx setuse = XEXP (link, 0); rtx usage_rtx = XEXP (setuse, 0); + /* We could support CLOBBER_HIGH and treat it in the same way as + HARD_REGNO_CALL_PART_CLOBBERED, but no port needs that yet. */ + gcc_assert (GET_CODE (setuse) != CLOBBER_HIGH); + if ((GET_CODE (setuse) == USE || GET_CODE (setuse) == CLOBBER) && REG_P (usage_rtx)) { @@ -1516,6 +1525,10 @@ reload_combine_note_use (rtx *xp, rtx_insn *insn, int ruid, rtx containing_mem) } break; + case CLOBBER_HIGH: + gcc_assert (REG_P (SET_DEST (x))); + return; + case PLUS: /* We are interested in (plus (reg) (const_int)) . */ if (!REG_P (XEXP (x, 0)) @@ -2135,6 +2148,9 @@ reload_cse_move2add (rtx_insn *first) { rtx setuse = XEXP (link, 0); rtx usage_rtx = XEXP (setuse, 0); + /* CALL_INSN_FUNCTION_USAGEs can only have full clobbers, not + clobber_highs. */ + gcc_assert (GET_CODE (setuse) != CLOBBER_HIGH); if (GET_CODE (setuse) == CLOBBER && REG_P (usage_rtx)) { @@ -2297,6 +2313,13 @@ move2add_note_store (rtx dst, const_rtx set, void *data) move2add_record_mode (dst); } + else if (GET_CODE (set) == CLOBBER_HIGH) + { + /* Only invalidate if actually clobbered. */ + if (reg_mode[regno] == BLKmode + || reg_is_clobbered_by_clobber_high (regno, reg_mode[regno], dst)) + goto invalidate; + } else { invalidate: -- cgit v1.1