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]

Re: [rs6000] Fix PR 50906, eh_frame and other woes


On Mon, 7 Nov 2011, Alan Modra wrote:

> On Mon, Nov 07, 2011 at 10:53:51AM +0100, Olivier Hainque wrote:
> > Another bug we're running into here is an unwarranted move of the sp
> > restore prior to register fetches despite an attempt at preventing that
> > with a stack_tie instruction (VxWorks target).
> > 
> >   http://gcc.gnu.org/ml/gcc/2011-03/msg00123.html
> > 
> > The failure can still be exposed on mainline with a minor adjustment
> > to the C testcase quoted in the msg.
> 
> Even after revision 181056?

FWIW, when I encountered such a problem in 4.4-based tools I found I 
needed the following change to stack_tie patterns to fix it (applied to 
and rediffed against trunk, but not tested there), in addition to a 
DEFAULT_ABI == ABI_V4 check such as you added.  Given all the confusion 
about this class of bugs and whether they should be addressed in each back 
end or in a target-independent way, I didn't try to send this upstream at 
the time.

2011-04-11  Joseph Myers  <joseph@codesourcery.com>

	* config/rs6000/rs6000.md (stack_tie): Use (mem:BLK (scratch)) as
	output of SET.
	(restore_stack_block, restore_stack_nonlocal): Update UNSPEC_TIE
	patterns.

Index: gcc/config/rs6000/rs6000.md
===================================================================
--- gcc/config/rs6000/rs6000.md	(revision 181085)
+++ gcc/config/rs6000/rs6000.md	(working copy)
@@ -11989,7 +11989,7 @@
 (define_expand "restore_stack_block"
   [(set (match_dup 2) (match_dup 3))
    (set (match_dup 4) (match_dup 2))
-   (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
+   (set (mem:BLK (scratch)) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
    (set (match_operand 0 "register_operand" "")
 	(match_operand 1 "register_operand" ""))]
   ""
@@ -12022,7 +12022,7 @@
   [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
    (set (match_dup 3) (match_dup 4))
    (set (match_dup 5) (match_dup 2))
-   (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
+   (set (mem:BLK (scratch)) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
    (set (match_operand 0 "register_operand" "") (match_dup 3))]
   ""
   "
@@ -15902,8 +15902,8 @@
 ; These are to explain that changes to the stack pointer should
 ; not be moved over stores to stack memory.
 (define_insn "stack_tie"
-  [(set (match_operand:BLK 0 "memory_operand" "+m")
-        (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
+  [(set (mem:BLK (scratch))
+        (unspec:BLK [(match_operand:BLK 0 "memory_operand" "+m")] UNSPEC_TIE))]
   ""
   ""
   [(set_attr "length" "0")])

-- 
Joseph S. Myers
joseph@codesourcery.com


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