From be8ac49a3e4f2f84f04c45ceb4d914e070cb6099 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Sun, 1 Jul 2001 15:52:26 +0000 Subject: [PATCH] cse.c (new_label_ref): Variable deleted. * cse.c (new_label_ref): Variable deleted. (insert): Remove set of new_label_ref. (check_for_label_ref): New function. (cse_basic_block): Don't check new_label_ref; call check_for_label_ref. From-SVN: r43672 --- gcc/ChangeLog | 7 +++++++ gcc/cse.c | 45 +++++++++++++++++++++++++++------------------ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8acb947d14e..45be5e87fa7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +Sun Jul 1 11:53:52 2001 Richard Kenner + + * cse.c (new_label_ref): Variable deleted. + (insert): Remove set of new_label_ref. + (check_for_label_ref): New function. + (cse_basic_block): Don't check new_label_ref; call check_for_label_ref. + 2001-06-30 Zack Weinberg * rtl.def (DEFINE_INSN, DEFINE_INSN_AND_SPLIT, DEFINE_PEEPHOLE): diff --git a/gcc/cse.c b/gcc/cse.c index 43cbf9ca020..bc4a05aad76 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -386,10 +386,6 @@ static int cse_jumps_altered; REG_LABEL, we have to rerun jump after CSE to put in the note. */ static int recorded_label_ref; -/* Says which LABEL_REF was put in the hash table. Used to see if we need - to set the above flag. */ -static rtx new_label_ref; - /* canon_hash stores 1 in do_not_record if it notices a reference to CC0, PC, or some other volatile subexpression. */ @@ -692,6 +688,7 @@ static void cse_check_loop_start PARAMS ((rtx, rtx, void *)); static void cse_set_around_loop PARAMS ((rtx, rtx, rtx)); static rtx cse_basic_block PARAMS ((rtx, rtx, struct branch_path *, int)); static void count_reg_usage PARAMS ((rtx, int *, rtx, int)); +static int check_for_label_ref PARAMS ((rtx *, void *)); extern void dump_class PARAMS ((struct table_elt*)); static struct cse_reg_info * get_cse_reg_info PARAMS ((unsigned int)); static int check_dependence PARAMS ((rtx *, void *)); @@ -718,6 +715,7 @@ dump_class (classp) } /* Subroutine of approx_reg_cost; called through for_each_rtx. */ + static int approx_reg_cost_1 (xp, data) rtx *xp; @@ -1580,12 +1578,6 @@ insert (x, classp, hash, mode) SET_HARD_REG_BIT (hard_regs_in_table, i); } - /* If X is a label, show we recorded it. */ - if (GET_CODE (x) == LABEL_REF - || (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS - && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF)) - new_label_ref = x; - /* Put an element for X into the right hash bucket. */ elt = free_element_chain; @@ -1823,6 +1815,7 @@ struct check_dependence_data enum machine_mode mode; rtx exp; }; + static int check_dependence (x, data) rtx *x; @@ -7290,16 +7283,13 @@ cse_basic_block (from, to, next_branch, around_loop) libcall_insn = 0; } - new_label_ref = 0; cse_insn (insn, libcall_insn); - /* If this insn uses a LABEL_REF and there isn't a REG_LABEL - note for it, we must rerun jump since it needs to place the - note. If this is a LABEL_REF for a CODE_LABEL that isn't in - the insn chain, don't do this since no REG_LABEL will be added. */ - if (new_label_ref != 0 && INSN_UID (XEXP (new_label_ref, 0)) != 0 - && reg_mentioned_p (new_label_ref, PATTERN (insn)) - && ! find_reg_note (insn, REG_LABEL, XEXP (new_label_ref, 0))) + /* If we haven't already found an insn where we added a LABEL_REF, + check this one. */ + if (GET_CODE (insn) == INSN && ! recorded_label_ref + && for_each_rtx (&PATTERN (insn), check_for_label_ref, + (void *) insn)) recorded_label_ref = 1; } @@ -7408,6 +7398,25 @@ cse_basic_block (from, to, next_branch, around_loop) return to ? NEXT_INSN (to) : 0; } +/* Called via for_each_rtx to see if an insn is using a LABEL_REF for which + there isn't a REG_DEAD note. Return one if so. DATA is the insn. */ + +static int +check_for_label_ref (rtl, data) + rtx *rtl; + void *data; +{ + rtx insn = (rtx) data; + + /* If this insn uses a LABEL_REF and there isn't a REG_LABEL note for it, + we must rerun jump since it needs to place the note. If this is a + LABEL_REF for a CODE_LABEL that isn't in the insn chain, don't do this + since no REG_LABEL will be added. */ + return (GET_CODE (*rtl) == LABEL_REF + && INSN_UID (XEXP (*rtl, 0)) != 0 + && ! find_reg_note (insn, REG_LABEL, XEXP (*rtl, 0))); +} + /* Count the number of times registers are used (not set) in X. COUNTS is an array in which we accumulate the count, INCR is how much we count each register usage. -- 2.30.2