INSN_SCOPE changes break mips-elf

Jan Hubicka jh@suse.cz
Thu Jun 20 12:00:00 GMT 2002


> On Thu, Jun 20, 2002 at 08:12:53PM +0200, Jan Hubicka wrote:
> > Do you have idea for better name/better implementation?
> 
> choose_inner_scope?
Hi,
I am just testing following.  Looks better?

Thu Jun 20 20:55:19 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* cfglayout.c (scope_to_insns_initialize): Call set_block_levels.
	(scope_to_insns_finalize): Do not call set_block_levels; handle
	sequences.
	(choose_inner_scope): New.
	* rtl.h (choose_inner_scope): Declare.

Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cfglayout.c,v
retrieving revision 1.19
diff -c -3 -p -r1.19 cfglayout.c
*** cfglayout.c	4 Jun 2002 17:32:50 -0000	1.19
--- cfglayout.c	20 Jun 2002 18:54:46 -0000
*************** scope_to_insns_initialize ()
*** 241,246 ****
--- 241,250 ----
  	    }
  	}
      }
+ 
+   /* Tag the blocks with a depth number so that change_scope can find
+      the common parent easily.  */
+   set_block_levels (cur_block, 0);
  }
  
  /* For each lexical block, set BLOCK_NUMBER to the depth at which it is
*************** set_block_levels (block, level)
*** 259,264 ****
--- 263,282 ----
      }
  }
  
+ /* Return sope resulting from combination of S1 and S2.  */
+ tree
+ choose_inner_scope (s1, s2)
+      tree s1, s2;
+ {
+    if (!s1)
+      return s2;
+    if (!s2)
+      return s1;
+    if (BLOCK_NUMBER (s1) > BLOCK_NUMBER (s2))
+      return s1;
+    return s2;
+ }
+ 
  /* Emit lexical block notes needed to change scope from S1 to S2.  */
  
  static void
*************** scope_to_insns_finalize ()
*** 315,324 ****
    tree cur_block = DECL_INITIAL (cfun->decl);
    rtx insn, note;
  
-   /* Tag the blocks with a depth number so that change_scope can find
-      the common parent easily.  */
-   set_block_levels (cur_block, 0);
- 
    insn = get_insns ();
    if (!active_insn_p (insn))
      insn = next_active_insn (insn);
--- 333,338 ----
*************** scope_to_insns_finalize ()
*** 327,332 ****
--- 341,358 ----
        tree this_block;
  
        this_block = INSN_SCOPE (insn);
+       /* For sequences compute scope resulting from merging all scopes
+          of instructions nested inside. */
+       if (GET_CODE (PATTERN (insn)) == SEQUENCE)
+ 	{
+ 	  int i;
+ 	  rtx body = PATTERN (insn);
+ 
+ 	  this_block = NULL;
+ 	  for (i = 0; i < XVECLEN (body, 0); i++)
+ 	    this_block = choose_inner_scope (this_block,
+ 			    		 INSN_SCOPE (XVECEXP (body, 0, i)));
+ 	}
        if (! this_block)
  	continue;
  
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.362
diff -c -3 -p -r1.362 rtl.h
*** rtl.h	14 Jun 2002 18:57:36 -0000	1.362
--- rtl.h	20 Jun 2002 18:54:46 -0000
*************** extern rtx next_label			PARAMS ((rtx));
*** 1414,1419 ****
--- 1414,1422 ----
  extern rtx next_cc0_user		PARAMS ((rtx));
  extern rtx prev_cc0_setter		PARAMS ((rtx));
  
+ /* In cfglayout.c  */
+ extern tree choose_inner_scope		PARAMS ((tree, tree));
+ 
  /* In jump.c */
  extern rtx next_nondeleted_insn		PARAMS ((rtx));
  extern enum rtx_code reverse_condition	PARAMS ((enum rtx_code));



More information about the Gcc-patches mailing list