This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Speed-up for annotate_with_file_line


The following patch speeds up annotate_with_file_line a little
by comparing the line numbers before the file names of two
annotations. The line numbers are more likely to differ and
easier to compare.

Bootstrapped and regtested on i686-pc-linux-gnu.
Ok for mainline? Maybe 4.0 branch, too?

Regards,
Volker


2005-09-11  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	* tree.c (annotate_with_file_line): Compare line numbers before
	file names.

===================================================================
*** gcc/gcc/tree.c	16 Aug 2005 00:35:50 -0000	1.500
--- gcc/gcc/tree.c	11 Sep 2005 16:26:28 -0000
*************** annotate_with_file_line (tree node, cons
*** 3113,3121 ****
       a node with the same information already attached to that node!
       Just return instead of wasting memory.  */
    if (EXPR_LOCUS (node)
        && (EXPR_FILENAME (node) == file
! 	  || ! strcmp (EXPR_FILENAME (node), file))
!       && EXPR_LINENO (node) == line)
      {
        last_annotated_node = node;
        return;
--- 3113,3121 ----
       a node with the same information already attached to that node!
       Just return instead of wasting memory.  */
    if (EXPR_LOCUS (node)
+       && EXPR_LINENO (node) == line
        && (EXPR_FILENAME (node) == file
! 	  || !strcmp (EXPR_FILENAME (node), file)))
      {
        last_annotated_node = node;
        return;
*************** annotate_with_file_line (tree node, cons
*** 3126,3134 ****
       than half.  */
    if (last_annotated_node
        && EXPR_LOCUS (last_annotated_node)
        && (EXPR_FILENAME (last_annotated_node) == file
! 	  || ! strcmp (EXPR_FILENAME (last_annotated_node), file))
!       && EXPR_LINENO (last_annotated_node) == line)
      {
        SET_EXPR_LOCUS (node, EXPR_LOCUS (last_annotated_node));
        return;
--- 3126,3134 ----
       than half.  */
    if (last_annotated_node
        && EXPR_LOCUS (last_annotated_node)
+       && EXPR_LINENO (last_annotated_node) == line
        && (EXPR_FILENAME (last_annotated_node) == file
! 	  || !strcmp (EXPR_FILENAME (last_annotated_node), file)))
      {
        SET_EXPR_LOCUS (node, EXPR_LOCUS (last_annotated_node));
        return;
===================================================================



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]