From: David Malcolm Date: Fri, 5 Sep 2014 14:13:28 +0000 (+0000) Subject: Eliminate the checked cast from get_call_reg_set_usage X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86bf2d46b6350e9af1d3a2e6ee75c1080d26b1c5;p=gcc.git Eliminate the checked cast from get_call_reg_set_usage gcc/ChangeLog 2014-09-05 David Malcolm * caller-save.c (setup_save_areas): Strengthen local "insn" from rtx to rtx_insn *. * final.c (get_call_reg_set_usage): Likewise for first param, eliminating a checked cast. * regs.h (get_call_reg_set_usage): Likewise for first param. * resource.c (mark_set_resources): Introduce local rtx_call_insn * "call_insn" for the case of a MARK_SRC_DEST_CALL via a checked cast, replacing references to "x" with "call_insn" where appropriate. (mark_target_live_regs): Strengthen local "real_insn" from rtx to rtx_insn *, adding a checked cast. From-SVN: r214962 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4a07b3c2a72..6ca2c64d235 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2014-09-05 David Malcolm + + * caller-save.c (setup_save_areas): Strengthen local "insn" from + rtx to rtx_insn *. + * final.c (get_call_reg_set_usage): Likewise for first param, + eliminating a checked cast. + * regs.h (get_call_reg_set_usage): Likewise for first param. + * resource.c (mark_set_resources): Introduce local rtx_call_insn * + "call_insn" for the case of a MARK_SRC_DEST_CALL via a checked + cast, replacing references to "x" with "call_insn" where + appropriate. + (mark_target_live_regs): Strengthen local "real_insn" from rtx to + rtx_insn *, adding a checked cast. + 2014-09-05 David Malcolm * output.h (final_scan_insn): Strengthen first param from rtx to diff --git a/gcc/caller-save.c b/gcc/caller-save.c index d94343edfe9..a0c402ef228 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -418,7 +418,7 @@ setup_save_areas (void) int i, j, k, freq; HARD_REG_SET hard_regs_used; struct saved_hard_reg *saved_reg; - rtx insn; + rtx_insn *insn; struct insn_chain *chain, *next; unsigned int regno; HARD_REG_SET hard_regs_to_save, used_regs, this_insn_sets; diff --git a/gcc/final.c b/gcc/final.c index 81c750d0b6e..d9a887f965c 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -4879,10 +4879,9 @@ get_call_cgraph_rtl_info (rtx_insn *insn) in REG_SET. Return DEFAULT_SET in REG_SET if not found. */ bool -get_call_reg_set_usage (rtx uncast_insn, HARD_REG_SET *reg_set, +get_call_reg_set_usage (rtx_insn *insn, HARD_REG_SET *reg_set, HARD_REG_SET default_set) { - rtx_insn *insn = safe_as_a (uncast_insn); if (flag_use_caller_save) { struct cgraph_rtl_info *node = get_call_cgraph_rtl_info (insn); diff --git a/gcc/regs.h b/gcc/regs.h index 36e803ddaa6..17a7e58a2d8 100644 --- a/gcc/regs.h +++ b/gcc/regs.h @@ -412,7 +412,7 @@ range_in_hard_reg_set_p (const HARD_REG_SET set, unsigned regno, int nregs) } /* Get registers used by given function call instruction. */ -extern bool get_call_reg_set_usage (rtx insn, HARD_REG_SET *reg_set, +extern bool get_call_reg_set_usage (rtx_insn *insn, HARD_REG_SET *reg_set, HARD_REG_SET default_set); #endif /* GCC_REGS_H */ diff --git a/gcc/resource.c b/gcc/resource.c index 55288317fbc..ff9b87890de 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -659,15 +659,16 @@ mark_set_resources (rtx x, struct resources *res, int in_dest, if (mark_type == MARK_SRC_DEST_CALL) { + rtx_call_insn *call_insn = as_a (x); rtx link; HARD_REG_SET regs; res->cc = res->memory = 1; - get_call_reg_set_usage (x, ®s, regs_invalidated_by_call); + get_call_reg_set_usage (call_insn, ®s, regs_invalidated_by_call); IOR_HARD_REG_SET (res->regs, regs); - for (link = CALL_INSN_FUNCTION_USAGE (x); + for (link = CALL_INSN_FUNCTION_USAGE (call_insn); link; link = XEXP (link, 1)) if (GET_CODE (XEXP (link, 0)) == CLOBBER) mark_set_resources (SET_DEST (XEXP (link, 0)), res, 1, @@ -675,7 +676,7 @@ mark_set_resources (rtx x, struct resources *res, int in_dest, /* Check for a REG_SETJMP. If it exists, then we must assume that this call can clobber any register. */ - if (find_reg_note (x, REG_SETJMP, NULL)) + if (find_reg_note (call_insn, REG_SETJMP, NULL)) SET_HARD_REG_SET (res->regs); } @@ -995,7 +996,7 @@ mark_target_live_regs (rtx_insn *insns, rtx target_maybe_return, struct resource insn = next_insn_no_annul (insn)) { rtx link; - rtx real_insn = insn; + rtx_insn *real_insn = insn; enum rtx_code code = GET_CODE (insn); if (DEBUG_INSN_P (insn)) @@ -1013,7 +1014,7 @@ mark_target_live_regs (rtx_insn *insns, rtx target_maybe_return, struct resource if (code == INSN && GET_CODE (PATTERN (insn)) == USE && INSN_P (XEXP (PATTERN (insn), 0))) - real_insn = XEXP (PATTERN (insn), 0); + real_insn = as_a (XEXP (PATTERN (insn), 0)); if (CALL_P (real_insn)) {