LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File ia64-unwind.patch of Package gcc33 (Project openSUSE:Factory)

2005-01-10  David Mosberger  <davidm@hpl.hp.com>

	PR target/18987
	* config/ia64/ia64.c (process_set): For alloc insn, only call
	process_epilogue is !frame_pointer_needed.

2004-10-27  David Mosberger  <davidm@hpl.hp.com>
	    James E Wilson  <wilson@specifixinc.com>

	PR target/13158
	* config/ia64/ia64.c (ia64_expand_epilogue): Set RTX_FRAME_RELATED_P on
	sibcall alloc instruction.
	(process_set): Handle sibcall alloc instruction.

2003-04-01  David Mosberger <davidm@hpl.hp.com>

	* config/ia64/crtend.asm: (__do_global_ctors_aux): Add unwind
	directives.

	* config/ia64/crtbegin.asm: (__do_global_dtors_aux): Add unwind
	directives.
	(__do_jv_register_classes): Ditto.

Index: gcc-3.3.3/gcc/config/ia64/crtbegin.asm
===================================================================
--- gcc-3.3.3.orig/gcc/config/ia64/crtbegin.asm	2003-01-25 18:28:42.000000000 +0100
+++ gcc-3.3.3/gcc/config/ia64/crtbegin.asm	2009-11-20 13:05:21.000000000 +0100
@@ -48,8 +48,9 @@ __dso_handle:
 	data8	__dso_handle#
 #else
 	.section .bss
+	.align 8
 __dso_handle:
-	data8	0
+	.skip	8
 #endif
 	.hidden __dso_handle#
 
@@ -116,11 +117,15 @@ __dso_handle:
 	.align	16
 	.proc	__do_global_dtors_aux#
 __do_global_dtors_aux:
+	.prologue
 #ifndef SHARED
 	{ .mii
+	  .save ar.pfs, r35
 	  alloc loc3 = ar.pfs, 0, 4, 1, 0
 	  addl loc0 = @gprel(dtor_ptr#), gp
+	  .save rp, loc1
 	  mov loc1 = b0
+	  .body
 	}
 	{ .mib
 	  mov loc2 = gp
@@ -133,6 +138,7 @@ __do_global_dtors_aux:
 		  __cxa_finalize(__dso_handle)
 	*/
 	{ .mii
+	  .save ar.pfs, r35
 	  alloc loc3 = ar.pfs, 0, 4, 1, 0
 	  addl loc0 = @gprel(dtor_ptr#), gp
 	  addl r16 = @ltoff(@fptr(__cxa_finalize#)), gp
@@ -148,16 +154,17 @@ __do_global_dtors_aux:
 	{ .mmi
 	  ld8 out0 = [out0]
 (p7)	  ld8 r18 = [r16], 8
+	  .save rp, loc1
 	  mov loc1 = b0
 	  ;;
 	}
-	{ .mfi
+	{ .mmi
 	  mov loc2 = gp
+(p7)	  ld8 gp = [r16]
 (p7)	  mov b6 = r18
 	}
 	{
 	  .mfb
-(p7)	  ld8 gp = [r16]
 (p7)	  br.call.sptk.many b0 = b6
 	}
 	{ .mfb
@@ -189,15 +196,14 @@ __do_global_dtors_aux:
 	  adds r15 = 8, r15
 	  ;;
 	}
-	{ .mmi
+	{ .mii
 	  ld8 r16 = [r16]
-	  mov gp = loc2
 	  mov b0 = loc1
+	  mov ar.pfs = loc3
 	  ;;
 	}
 	{ .mib
 	  cmp.ne p6, p0 = r0, r16
-	  mov ar.pfs = loc3
 (p6)	  br.cond.sptk.few 0b
 	}
 	{ .bbb
@@ -209,7 +215,9 @@ __do_global_dtors_aux:
 	.align	16
 	.proc	__do_jv_register_classes#
 __do_jv_register_classes:
+	.prologue
 	{ .mlx
+	  .save ar.pfs, r34
 	  alloc loc2 = ar.pfs, 0, 3, 1, 0
 	  movl out0 = @gprel(__JCR_LIST__)
 	  ;;
@@ -232,7 +240,9 @@ __do_jv_register_classes:
 	}
 	{ .mii
 	  ld8 r15 = [r14], 8
+	  .save rp, loc0
 	  mov loc0 = b0
+	  .body
 	  mov loc1 = gp
 	  ;;
 	}
Index: gcc-3.3.3/gcc/config/ia64/crtend.asm
===================================================================
--- gcc-3.3.3.orig/gcc/config/ia64/crtend.asm	2003-01-25 18:28:42.000000000 +0100
+++ gcc-3.3.3/gcc/config/ia64/crtend.asm	2009-11-20 13:05:21.000000000 +0100
@@ -74,18 +74,22 @@ __JCR_END__:
 #endif
 	.proc __do_global_ctors_aux#
 __do_global_ctors_aux:
+	.prologue
 	/*
 		for (loc0 = __CTOR_END__-1; *p != -1; --p)
 		  (*p) ();
 	*/
 	{ .mlx
+	  .save ar.pfs, r36
 	  alloc loc4 = ar.pfs, 0, 5, 0, 0
 	  movl loc0 = @gprel(__CTOR_END__# - 8)
 	  ;;
 	}
 	{ .mmi
 	  add loc0 = loc0, gp
+	  .save rp, loc1
 	  mov loc1 = b0
+	  .body
 	  ;;
 	}
 	{
Index: gcc-3.3.3/gcc/config/ia64/ia64.c
===================================================================
--- gcc-3.3.3.orig/gcc/config/ia64/ia64.c	2009-11-20 13:04:57.000000000 +0100
+++ gcc-3.3.3/gcc/config/ia64/ia64.c	2009-11-20 13:05:21.000000000 +0100
@@ -2885,10 +2885,13 @@ ia64_expand_epilogue (sibcall_p)
 	 preserve those input registers used as arguments to the sibling call.
 	 It is unclear how to compute that number here.  */
       if (current_frame_info.n_input_regs != 0)
-	emit_insn (gen_alloc (gen_rtx_REG (DImode, fp),
-			      GEN_INT (0), GEN_INT (0),
-			      GEN_INT (current_frame_info.n_input_regs),
-			      GEN_INT (0)));
+	{
+	  rtx n_inputs = GEN_INT (current_frame_info.n_input_regs);
+	  insn = emit_insn (gen_alloc (gen_rtx_REG (DImode, fp),
+				GEN_INT (0), GEN_INT (0),
+				n_inputs, GEN_INT (0)));
+	  RTX_FRAME_RELATED_P (insn) = 1;
+	}
     }
 }
 
@@ -7446,13 +7449,24 @@ process_set (asm_out_file, pat)
     {
       dest_regno = REGNO (dest);
 
-      /* If this isn't the final destination for ar.pfs, the alloc
-	 shouldn't have been marked frame related.  */
-      if (dest_regno != current_frame_info.reg_save_ar_pfs)
-	abort ();
-
-      fprintf (asm_out_file, "\t.save ar.pfs, r%d\n",
-	       ia64_dbx_register_number (dest_regno));
+      /* If this is the final destination for ar.pfs, then this must
+	 be the alloc in the prologue.  */
+      if (dest_regno == current_frame_info.reg_save_ar_pfs)
+	fprintf (asm_out_file, "\t.save ar.pfs, r%d\n",
+		 ia64_dbx_register_number (dest_regno));
+      else
+	{
+	  /* This must be an alloc before a sibcall.  We must drop the
+	     old frame info.  The easiest way to drop the old frame
+	     info is to ensure we had a ".restore sp" directive
+	     followed by a new prologue.  If the procedure doesn't
+	     have a memory-stack frame, we'll issue a dummy ".restore
+	     sp" now.  */
+	  if (current_frame_info.total_size == 0 && !frame_pointer_needed)
+	    /* if haven't done process_epilogue() yet, do it now */
+	    process_epilogue ();
+	  fprintf (asm_out_file, "\t.prologue\n");
+	}
       return 1;
     }