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]

Re: ppc prologue scheduling/ SVR4 rs6000_pic_labelno patch


On Wed, Jan 26, 2000 at 03:39:32PM -0800, Geoff Keating wrote:
 
> My suggestion, though, is that we make rs6000_pic_func_labelno and
> rs6000_pic_labelno completely separate values.  The load_toc_v4_PIC_1
> and load_toc_v4_PIC_1b don't need to share any data, so as long as we
> use different temporary labels---I'd suggest making load_toc_v4_PIC_1b
> use labels starting with 'LCG'---the counters don't have to be
> distinct.
> 
> Then rs6000_pic_labelno can be incremented in the !from_prolog case of
> rs6000_emit_load_toc_table, and we increment rs6000_pic_func_labelno
> in some convenient place---I'd suggest incrementing it at the end of 
> output_prolog after everything that uses it has been output.

Ok.  Since rs6000_pic_labelno would then only be used in the !from_prolog case
of rs6000_emit_load_toc_table, I made it a local static of that block.  Since
that left no naming collision, I used rs6000_pic_labelno instead of
rs6000_pic_func_labelno for the prologue label global, thus minimizing the
patch.

2000-01-26  Clinton Popetz  <cpopetz@cygnus.com>

	* rs6000.c (rs6000_emit_load_toc_table): Use "LCG" and
	reload_toc_labelno for non-prologue TOC reloads.  Also, don't
	increment rs6000_pic_labelno here.
	(rs6000_emit_prologue): Pass TRUE to rs6000_emit_load_toc_table,
	and increment rs6000_pic_labelno here.
	
Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.108.2.9
diff -c -2 -p -r1.108.2.9 rs6000.c
*** rs6000.c	2000/01/20 01:25:37	1.108.2.9
--- rs6000.c	2000/01/27 16:35:58
*************** rs6000_emit_load_toc_table (fromprolog)
*** 4314,4320 ****
  			: gen_reg_rtx (Pmode));
  	  rtx symF;
- 	  
- 	  ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno);
- 	  symF = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
  
  	  /* possibly create the toc section */
--- 4314,4317 ----
*************** rs6000_emit_load_toc_table (fromprolog)
*** 4328,4331 ****
--- 4325,4332 ----
  	    {
  	      rtx symL;
+ 	  
+ 	      ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno);
+ 	      symF = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
+ 
  	      ASM_GENERATE_INTERNAL_LABEL (buf, "LCL", rs6000_pic_labelno);
  	      symL = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
*************** rs6000_emit_load_toc_table (fromprolog)
*** 4338,4344 ****
--- 4339,4350 ----
  	    {
  	      rtx tocsym;
+ 	      static int reload_toc_labelno = 0;
+ 
  	      ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1);
  	      tocsym = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
  
+ 	      ASM_GENERATE_INTERNAL_LABEL (buf, "LCG", reload_toc_labelno++);
+ 	      symF = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
+ 
  	      emit_insn (gen_load_toc_v4_PIC_1b (tempLR, symF, tocsym));
  	      emit_move_insn (dest, tempLR);
*************** rs6000_emit_load_toc_table (fromprolog)
*** 4346,4350 ****
  	    }
  	  emit_insn (gen_addsi3 (dest, temp0, dest));
- 	  rs6000_pic_labelno++;
  	}
        else if (flag_pic == 0 && TARGET_MINIMAL_TOC)
--- 4352,4355 ----
*************** rs6000_emit_prologue()
*** 4667,4671 ****
  		      gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM));
      
!     rs6000_emit_load_toc_table (gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM));
  
      if (save_LR_around_toc_setup)
--- 4672,4676 ----
  		      gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM));
      
!     rs6000_emit_load_toc_table (TRUE);
  
      if (save_LR_around_toc_setup)
*************** output_prolog (file, size)
*** 4729,4732 ****
--- 4734,4739 ----
        end_sequence ();
      }
+ 
+   rs6000_pic_labelno++;
  }
    

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