From 2a496e8b7490b064efde59e0bbcddb5b4de099e0 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Thu, 6 Jun 2002 06:37:37 +0000 Subject: [PATCH] emit-rtl.c (get_first_nonnote_insn, [...]): New functions. * emit-rtl.c (get_first_nonnote_insn, get_last_nonnote_insn): New functions. * rtl.h (get_first_nonnote_insn, get_last_nonnote_insn): Declare. * avr/avr.c (avr_output_function_epilogue): Use above to determine function size. * pa/pa.c (pa_output_function_prologue): Likewise. From-SVN: r54304 --- gcc/ChangeLog | 9 +++++++++ gcc/config/avr/avr.c | 4 ++-- gcc/config/pa/pa.c | 2 +- gcc/emit-rtl.c | 36 ++++++++++++++++++++++++++++++++++++ gcc/rtl.h | 2 ++ 5 files changed, 50 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29795af20ef..544fe6f4c7f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2002-06-06 John David Anglin + + * emit-rtl.c (get_first_nonnote_insn, get_last_nonnote_insn): New + functions. + * rtl.h (get_first_nonnote_insn, get_last_nonnote_insn): Declare. + * avr/avr.c (avr_output_function_epilogue): Use above to determine + function size. + * pa/pa.c (pa_output_function_prologue): Likewise. + 2002-06-05 David S. Miller * integrate.c (subst_constants): Handle 'B' RTL format. diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 6176801811e..c23059c6823 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -749,8 +749,8 @@ avr_output_function_epilogue (file, size) interrupt_func_p = interrupt_function_p (current_function_decl); signal_func_p = signal_function_p (current_function_decl); main_p = MAIN_NAME_P (DECL_NAME (current_function_decl)); - function_size = (INSN_ADDRESSES (INSN_UID (get_last_insn ())) - - INSN_ADDRESSES (INSN_UID (get_insns ()))); + function_size = (INSN_ADDRESSES (INSN_UID (get_last_nonnote_insn ())) + - INSN_ADDRESSES (INSN_UID (get_first_nonnote_insn ()))); function_size += jump_tables_size; live_seq = sequent_regs_live (); minimize = (TARGET_CALL_PROLOGUES diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 258972534b5..bfa1c1d45c6 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -3179,7 +3179,7 @@ pa_output_function_prologue (file, size) { unsigned int old_total = total_code_bytes; - total_code_bytes += INSN_ADDRESSES (INSN_UID (get_last_insn ())); + total_code_bytes += INSN_ADDRESSES (INSN_UID (get_last_nonnote_insn ())); total_code_bytes += FUNCTION_BOUNDARY / BITS_PER_UNIT; /* Be prepared to handle overflows. */ diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 4ee90ef1ae9..9d15fdf6ae4 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -2710,6 +2710,42 @@ get_last_insn_anywhere () return 0; } +/* Return the first nonnote insn emitted in current sequence or current + function. This routine looks inside SEQUENCEs. */ + +rtx +get_first_nonnote_insn () +{ + rtx insn = first_insn; + + while (insn) + { + insn = next_insn (insn); + if (insn == 0 || GET_CODE (insn) != NOTE) + break; + } + + return insn; +} + +/* Return the last nonnote insn emitted in current sequence or current + function. This routine looks inside SEQUENCEs. */ + +rtx +get_last_nonnote_insn () +{ + rtx insn = last_insn; + + while (insn) + { + insn = previous_insn (insn); + if (insn == 0 || GET_CODE (insn) != NOTE) + break; + } + + return insn; +} + /* Return a number larger than any instruction's uid in this function. */ int diff --git a/gcc/rtl.h b/gcc/rtl.h index ab03d6bff1b..d4b6063944d 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1342,6 +1342,8 @@ extern rtx get_insns PARAMS ((void)); extern const char *get_insn_name PARAMS ((int)); extern rtx get_last_insn PARAMS ((void)); extern rtx get_last_insn_anywhere PARAMS ((void)); +extern rtx get_first_nonnote_insn PARAMS ((void)); +extern rtx get_last_nonnote_insn PARAMS ((void)); extern void start_sequence PARAMS ((void)); extern void push_to_sequence PARAMS ((rtx)); extern void end_sequence PARAMS ((void)); -- 2.30.2