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]
Other format: [Raw text]

Fix setjmp pattern on SPARC64


Looks like the pattern has never taken into account the stack bias...
This makes it possible to build a 64-bit Ada compiler, at last.

Bootstrapped/regtested on SPARC/Solaris 10, SPARC64/Solaris 9 and 
SPARC/Solaris 8, applied to mainline.


2006-02-16  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* config/sparc/sparc.md (setjmp): Rewrite.
	(setjmp_32): Delete.
	(setjmp_64): Likewise.


-- 
Eric Botcazou
Index: config/sparc/sparc.md
===================================================================
--- config/sparc/sparc.md	(revision 111111)
+++ config/sparc/sparc.md	(working copy)
@@ -7244,25 +7244,20 @@ (define_expand "setjmp"
   [(const_int 0)]
   ""
 {
-  if (TARGET_ARCH64)
-    emit_insn (gen_setjmp_64 ());
-  else
-    emit_insn (gen_setjmp_32 ());
+  rtx mem;
+  
+  mem = gen_rtx_MEM (Pmode,
+		     plus_constant (stack_pointer_rtx,
+				    SPARC_STACK_BIAS + 14 * UNITS_PER_WORD));
+  emit_insn (gen_rtx_SET (VOIDmode, mem, frame_pointer_rtx));
+
+  mem = gen_rtx_MEM (Pmode,
+		     plus_constant (stack_pointer_rtx,
+				    SPARC_STACK_BIAS + 15 * UNITS_PER_WORD));
+  emit_insn (gen_rtx_SET (VOIDmode, mem, gen_rtx_REG (Pmode, 31)));
   DONE;
 })
 
-(define_expand "setjmp_32"
-  [(set (mem:SI (plus:SI (reg:SI 14) (const_int 56))) (match_dup 0))
-   (set (mem:SI (plus:SI (reg:SI 14) (const_int 60))) (reg:SI 31))]
-  ""
-  { operands[0] = frame_pointer_rtx; })
-
-(define_expand "setjmp_64"
-  [(set (mem:DI (plus:DI (reg:DI 14) (const_int 112))) (match_dup 0))
-   (set (mem:DI (plus:DI (reg:DI 14) (const_int 120))) (reg:DI 31))]
-  ""
-  { operands[0] = frame_pointer_rtx; })
-
 ;; Special pattern for the FLUSH instruction.
 
 ; We do SImode and DImode versions of this to quiet down genrecog's complaints

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