[parisc-linux-cvs] gcc profiling fix

Alan Modra alan@linuxcare.com.au
Fri, 16 Feb 2001 11:44:08 +1100 (EST)


This should fix the -p crashes.  I'm not too sure whether we actually have
all the infrastructure required for profiling in glibc etc.  Anyone know?

gcc/ChangeLog
	* config/pa/pa.md (call_profiler): `use' r24,r25,r26. clobber r2.

	* config/pa/pa.c (hppa_expand_prologue): Don't use regs_ever_live
	to test for argument registers when profiling.  Instead, use bb
	global_live_at_start.


Index: gcc/config/pa/pa.c
===================================================================
RCS file: /home/cvs/parisc/gcc/gcc/config/pa/pa.c,v
retrieving revision 1.1.1.4.2.13
retrieving revision 1.1.1.4.2.14
diff -u -p -r1.1.1.4.2.13 -r1.1.1.4.2.14
--- pa.c	2001/02/13 02:07:28	1.1.1.4.2.13
+++ pa.c	2001/02/16 00:30:01	1.1.1.4.2.14
@@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "ggc.h"
 #include "recog.h"
+#include "basic-block.h"
 #include "tm_p.h"
 
 #ifndef DO_FRAME_NOTES
@@ -1620,7 +1621,7 @@ emit_move_sequence (operands, mode, scra
 		 extension, then we can use it as-is.  Else we will
 		 need to sign extend the constant from 32->64bits
 		 then zero extend the result from 32->64bits.  */
-	      nval = ((val & (((HOST_WIDE_INT) 1 << 32) - 1))
+	      nval = ((val & (((HOST_WIDE_INT) 2 << 31) - 1))
 		      ^ ((HOST_WIDE_INT) 1 << 31)) - ((HOST_WIDE_INT) 1 << 31);
 	      if (val != nval)
 		{
@@ -3198,7 +3199,7 @@ hppa_expand_prologue ()
 	store_reg (STATIC_CHAIN_REGNUM, - 16 - offsetadj, basereg);
 
       for (i = 26, arg_offset = -36 - offsetadj; i >= 23; i--, arg_offset -= 4)
-	if (regs_ever_live [i])
+	if (REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, i))
 	  {
 	    store_reg (i, arg_offset, basereg);
 	    /* Deal with arg_offset not fitting in 14 bits.  */
@@ -3215,7 +3216,7 @@ hppa_expand_prologue ()
 
       /* Restore argument registers.  */
       for (i = 26, arg_offset = -36 - offsetadj; i >= 23; i--, arg_offset -= 4)
-	if (regs_ever_live [i])
+	if (REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, i))
 	  load_reg (i, arg_offset, basereg);
 
       if (current_function_returns_struct)
Index: gcc/config/pa/pa.md
===================================================================
RCS file: /home/cvs/parisc/gcc/gcc/config/pa/pa.md,v
retrieving revision 1.1.1.4.2.6
retrieving revision 1.1.1.4.2.7
diff -u -p -r1.1.1.4.2.6 -r1.1.1.4.2.7
--- pa.md	2001/01/30 06:10:13	1.1.1.4.2.6
+++ pa.md	2001/02/16 00:30:01	1.1.1.4.2.7
@@ -5557,7 +5557,11 @@
 ;; the call.
 (define_insn "call_profiler"
   [(unspec_volatile [(const_int 0)] 0)
-   (use (match_operand:SI 0 "const_int_operand" ""))]
+   (use (match_operand:SI 0 "const_int_operand" ""))
+   (use (reg:SI 24))
+   (use (reg:SI 25))
+   (use (reg:SI 26))
+   (clobber (reg:SI 2))]
   ""
   "{bl|b,l} _mcount,%%r2\;ldo %0(%%r2),%%r25"
   [(set_attr "type" "multi")