aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJohn David Anglin <dave@hiauly1.hia.nrc.ca>2002-06-06 06:37:37 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2002-06-06 06:37:37 +0000
commit2a496e8b7490b064efde59e0bbcddb5b4de099e0 (patch)
tree4f5d9afc2707e7938b6e600328e3f42c1ff4d0b7 /gcc
parent2ff581c3af4da7710ff2d4152e5c9c3d961c6c2b (diff)
downloadgcc-2a496e8b7490b064efde59e0bbcddb5b4de099e0.zip
gcc-2a496e8b7490b064efde59e0bbcddb5b4de099e0.tar.gz
gcc-2a496e8b7490b064efde59e0bbcddb5b4de099e0.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/avr/avr.c4
-rw-r--r--gcc/config/pa/pa.c2
-rw-r--r--gcc/emit-rtl.c36
-rw-r--r--gcc/rtl.h2
5 files changed, 50 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 29795af..544fe6f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2002-06-06 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * 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 <davem@redhat.com>
* integrate.c (subst_constants): Handle 'B' RTL format.
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 61768018..c23059c 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 2589725..bfa1c1d 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 4ee90ef..9d15fdf 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 ab03d6b..d4b6063 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));