OSDN Git Service

* emit-rtl.c (get_first_nonnote_insn, get_last_nonnote_insn): New
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Jun 2002 06:37:37 +0000 (06:37 +0000)
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Jun 2002 06:37:37 +0000 (06:37 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54304 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/avr/avr.c
gcc/config/pa/pa.c
gcc/emit-rtl.c
gcc/rtl.h

index 29795af..544fe6f 100644 (file)
@@ -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.
index 6176801..c23059c 100644 (file)
@@ -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
index 2589725..bfa1c1d 100644 (file)
@@ -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.  */
index 4ee90ef..9d15fdf 100644 (file)
@@ -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
index ab03d6b..d4b6063 100644 (file)
--- 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));