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]

PA tweak



This is the last of the changes I had to speed up the PA64 port.

Basically I mis-read/mis-understood one of the uglier aspects of the PA
ABI for PIC code generation.  As a result I thought it was necessary for
the PIC register to always contain the correct value -- ie, there could
be no windows where it was mucked up.

The rule is it must be valid at each call site, even if the call does not
obviously use the PIC register.

Anyway, the PA port was emitting a blockage instruction after each call in
PIC mode.  Not pretty, but highly effective in keeping it valid at all
times...  

The PA64 port always generates PIC code; so we had these blockage insns after
each and every call.  This caused the scheduler to go absolutely nuts.

This change avoids the blockage insn.  It should also improve code for 32bit
PIC and the PA64 port.

	* pa.md (call, call_value): Do not emit a blockage after restoring
	the PIC register.

Index: pa.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/pa/pa.md,v
retrieving revision 1.55
diff -c -3 -p -r1.55 pa.md
*** pa.md	1999/10/15 05:57:07	1.55
--- pa.md	1999/10/20 05:44:03
***************
*** 4731,4736 ****
--- 4731,4738 ----
    if (flag_pic)
      {
        use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
+       use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
+ 	       gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
  
        /* After each call we must restore the PIC register, even if it
  	 doesn't appear to be used.
***************
*** 4739,4755 ****
  	 stored the PIC register in.  */
        emit_move_insn (pic_offset_table_rtx,
  		      gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
-       emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
- 
-       /* Gross.  We have to keep the scheduler from moving the restore
- 	 of the PIC register away from the call.  SCHED_GROUP_P is
- 	 supposed to do this, but for some reason the compiler will
- 	 go into an infinite loop when we use that.
- 
- 	 This method (blockage insn) may make worse code (then again
- 	 it may not since calls are nearly blockages anyway), but at
- 	 least it should work.  */
-       emit_insn (gen_blockage ());
      }
    DONE;
  }")
--- 4741,4746 ----
***************
*** 4888,4893 ****
--- 4879,4886 ----
    if (flag_pic)
      {
        use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
+       use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
+ 	       gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
  
        /* After each call we must restore the PIC register, even if it
  	 doesn't appear to be used.
***************
*** 4896,4912 ****
  	 stored the PIC register in.  */
        emit_move_insn (pic_offset_table_rtx,
  		      gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
-       emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
- 
-       /* Gross.  We have to keep the scheduler from moving the restore
- 	 of the PIC register away from the call.  SCHED_GROUP_P is
- 	 supposed to do this, but for some reason the compiler will
- 	 go into an infinite loop when we use that.
- 
- 	 This method (blockage insn) may make worse code (then again
- 	 it may not since calls are nearly blockages anyway), but at
- 	 least it should work.  */
-       emit_insn (gen_blockage ());
      }
    DONE;
  }")
--- 4889,4894 ----




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